aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-catalog-db-adapter/src/test
diff options
context:
space:
mode:
authorMarcus G K Williams <marcus.williams@intel.com>2018-09-24 16:22:51 -0700
committerMarcus G K Williams <marcus.williams@intel.com>2018-09-24 16:30:57 -0700
commit105bdfc688df2b0443517c47b7449dcb5a0e9853 (patch)
tree3d04bddece68f331a133e9327d6343b11a908071 /adapters/mso-catalog-db-adapter/src/test
parentd3bbcec732486df9375c238594c81a5d526c48f0 (diff)
Add cloudSite Post to catalogDbClient
Issue-ID: SO-1081 Change-Id: I5808292c4b11413dfef07216d2b933b3358e4fae Signed-off-by: Marcus G K Williams <marcus.williams@intel.com>
Diffstat (limited to 'adapters/mso-catalog-db-adapter/src/test')
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java9
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java42
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/application-test.yaml6
3 files changed, 52 insertions, 5 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java
index bf69686a76..e38bd02069 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java
@@ -29,6 +29,15 @@ public class CatalogDbClientPortChanger extends CatalogDbClient {
public String wiremockPort;
+ CatalogDbClientPortChanger(){
+
+ }
+
+ CatalogDbClientPortChanger(String baseUri, String auth, String wiremockPort) {
+ super(baseUri, auth);
+ this.wiremockPort = wiremockPort;
+ }
+
protected URI getUri(String template) {
URI uri = URI.create(template);
String path = uri.getPath();
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index 3783a51689..5c7b64d054 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -26,10 +26,13 @@ import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.adapters.catalogdb.CatalogDBApplication;
+import org.onap.so.db.catalog.beans.AuthenticationType;
+import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.CloudifyManager;
import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.ServerType;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.catalog.beans.VfModule;
@@ -40,11 +43,13 @@ import org.onap.so.db.catalog.beans.VnfResource;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
+import java.net.URI;
import java.util.List;
import java.util.UUID;
@@ -55,12 +60,16 @@ public class CatalogDbClientTest {
public static final String MTN13 = "mtn13";
@LocalServerPort
private int port;
+
+ @Value("${mso.db.auth}")
+ private String msoAdaptersAuth;
+
@Autowired
CatalogDbClientPortChanger client;
@Before
- public void initialize() {
- client.wiremockPort = String.valueOf(port);
+ public void initialize(){
+ client.wiremockPort= String.valueOf(port);
}
@Test
@@ -376,4 +385,33 @@ public class CatalogDbClientTest {
VfModule module = moduleList.get(0);
Assert.assertEquals("vSAMP10a DEV Base",module.getDescription());
}
+
+ @Test
+ public void testPostCloudSite() {
+ CatalogDbClientPortChanger localClient = new CatalogDbClientPortChanger("http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort);
+ CloudSite cloudSite = new CloudSite();
+ cloudSite.setId("MTN6");
+ cloudSite.setClli("TESTCLLI");
+ cloudSite.setRegionId("regionId");
+ cloudSite.setCloudVersion("VERSION");
+ cloudSite.setPlatform("PLATFORM");
+
+ CloudIdentity cloudIdentity = new CloudIdentity();
+ cloudIdentity.setId("RANDOMID");
+ cloudIdentity.setIdentityUrl("URL");
+ cloudIdentity.setMsoId("MSO_ID");
+ cloudIdentity.setMsoPass("MSO_PASS");
+ cloudIdentity.setAdminTenant("ADMIN_TENANT");
+ cloudIdentity.setMemberRole("ROLE");
+ cloudIdentity.setIdentityServerType(ServerType.KEYSTONE);
+ cloudIdentity.setIdentityAuthenticationType(AuthenticationType.RACKSPACE_APIKEY);
+ cloudSite.setIdentityService(cloudIdentity);
+ localClient.postCloudSite(cloudSite);
+ CloudSite getCloudSite = this.client.getCloudSite("MTN6");
+ Assert.assertNotNull(getCloudSite);
+ Assert.assertNotNull(getCloudSite.getIdentityService());
+ Assert.assertEquals("TESTCLLI", getCloudSite.getClli());
+ Assert.assertEquals("regionId", getCloudSite.getRegionId());
+ Assert.assertEquals("RANDOMID", getCloudSite.getIdentityServiceId());
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/application-test.yaml b/adapters/mso-catalog-db-adapter/src/test/resources/application-test.yaml
index a1e62f5e85..a59ea0ef65 100644
--- a/adapters/mso-catalog-db-adapter/src/test/resources/application-test.yaml
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/application-test.yaml
@@ -1,5 +1,5 @@
# TEST FILE
-catalog.db.endpoint: "http://localhost:"
+catalog.db.endpoint: http://localhost:${wiremock.server.port}
ssl-enable: false
mso:
@@ -8,7 +8,7 @@ mso:
catalog:
db:
spring:
- endpoint: "http://localhost:"
+ endpoint: http://localhost:${wiremock.server.port}
db:
auth: Basic YnBlbDptc28tZGItMTUwNyE=
@@ -50,7 +50,7 @@ mariaDB4j:
databaseName: catalogdb
server:
- port: 8080
+ port: ${wiremock.server.port}
tomcat:
max-threads: 50
='n525' href='#n525'>525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936