aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-catalog-db-adapter/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-catalog-db-adapter/src/test/java')
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/EmbeddedMariaDbConfig.java60
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java782
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionTest.java (renamed from adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionTest.java)6
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java153
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java (renamed from adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java)16
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsarTest.java (renamed from adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceCsarTest.java)12
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModuleTest.java (renamed from adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModuleTest.java)22
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/TestAppender.java37
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestClassTest.java380
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestHttpTest.java490
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestTest.java103
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryTest.java155
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomizationTest.java67
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMarcoHolderTest.java74
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworksTest.java72
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfsTest.java73
16 files changed, 1057 insertions, 1445 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/EmbeddedMariaDbConfig.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/EmbeddedMariaDbConfig.java
new file mode 100644
index 0000000000..7f0c07bdf6
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/EmbeddedMariaDbConfig.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb;
+import ch.vorburger.exec.ManagedProcessException;
+import ch.vorburger.mariadb4j.DBConfigurationBuilder;
+import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import javax.sql.DataSource;
+
+@Configuration
+@Profile({"test","local"})
+public class EmbeddedMariaDbConfig {
+
+ @Bean
+ MariaDB4jSpringService mariaDB4jSpringService() {
+ return new MariaDB4jSpringService();
+ }
+
+ @Bean
+ DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService,
+ @Value("${mariaDB4j.databaseName}") String databaseName,
+ @Value("${spring.datasource.username}") String datasourceUsername,
+ @Value("${spring.datasource.password}") String datasourcePassword,
+ @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException {
+ //Create our database with default root user and no password
+ mariaDB4jSpringService.getDB().createDB(databaseName);
+
+ DBConfigurationBuilder config = mariaDB4jSpringService.getConfiguration();
+
+ return DataSourceBuilder
+ .create()
+ .username(datasourceUsername)
+ .password(datasourcePassword)
+ .url(config.getURL(databaseName))
+ .driverClassName(datasourceDriver)
+ .build();
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
new file mode 100644
index 0000000000..f3315b57eb
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
@@ -0,0 +1,782 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.catalogrest;
+
+import static org.junit.Assert.*;
+
+
+import java.io.IOException;
+import java.util.Map;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+
+import org.json.JSONException;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.adapters.catalogdb.CatalogDBApplication;
+
+import org.onap.so.logger.MsoLogger;
+import org.skyscreamer.jsonassert.JSONAssert;
+import org.skyscreamer.jsonassert.JSONCompareMode;
+import org.springframework.boot.context.embedded.LocalServerPort;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.annotation.DirtiesContext.ClassMode;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.web.util.UriComponentsBuilder;
+
+import ch.qos.logback.classic.spi.ILoggingEvent;
+
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+
+public class CatalogDBRestTest {
+
+ private static final String ECOMP_MSO_CATALOG_V2_VF_MODULES = "ecomp/mso/catalog/v2/vfModules";
+
+ private static final String ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES = "ecomp/mso/catalog/v2/serviceAllottedResources";
+
+ private static final String ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS = "ecomp/mso/catalog/v2/serviceNetworks";
+
+ private static final String ECOMP_MSO_CATALOG_V2_SERVICE_VNFS = "ecomp/mso/catalog/v2/serviceVnfs";
+
+ private static final String ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES = "ecomp/mso/catalog/v2/serviceResources";
+
+ @LocalServerPort
+ private int port;
+
+ TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
+
+ HttpHeaders headers = new HttpHeaders();
+
+ private final String expectedServiceResourceResponse = "{\r\n\"serviceResources\": {\r\n\"modelInfo\": {\r\n\"modelName\": \"MSOTADevInfra_vSAMP10a_Service\",\r\n\"modelUuid\": \"5df8b6de-2083-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"9647dfc4-2083-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"1.0\"\r\n},\r\n\"serviceType\": \"NA\",\r\n\"serviceRole\": \"NA\",\r\n\"environmentContext\": \"Luna\",\r\n\"workloadContext\": \"Oxygen\",\r\n\"serviceVnfs\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10a\",\r\n\"modelUuid\": \"ff2ae348-214a-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"2fff5b20-214b-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"68dc9a92-214c-11e7-93ae-92361f002671\",\r\n\"modelInstanceName\": \"vSAMP10a 1\"\r\n},\r\n\"toscaNodeType\": \"VF\",\r\n\"nfFunction\": \"vSAMP\",\r\n\"nfType\": \"vSAMP\",\r\n\"nfRole\": \"vSAMP\",\r\n\"nfNamingCode\": \"vSAMP\",\r\n\"multiStageDesign\": null,\r\n\"vfModules\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::base::module-0\",\r\n\"modelUuid\": \"20c4431c-246d-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"cb82ffd8-252a-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": true,\r\n\"vfModuleLabel\": \"base\",\r\n\"initialCount\": 1,\r\n\"hasVolumeGroup\": false\r\n},\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::PCM::module-1\",\r\n\"modelUuid\": \"066de97e-253e-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"64efd51a-2544-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"b4ea86b4-253f-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": false,\r\n\"vfModuleLabel\": \"PCM\",\r\n\"initialCount\": 0,\r\n\"hasVolumeGroup\": false\r\n}\r\n]\r\n}\r\n],\r\n\"serviceNetworks\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"CONTRAIL30_GNDIRECT\",\r\n\"modelUuid\": \"10b36f65-f4e6-4be6-ae49-9596dc1c47fc\",\r\n\"modelInvariantUuid\": \"ce4ff476-9641-4e60-b4d5-b4abbec1271d\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"3bdbb104-476c-483e-9f8b-c095b3d308ac\",\r\n\"modelInstanceName\": \"CONTRAIL30_GNDIRECT 9\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"networkType\": \"\",\r\n\"networkTechnology\": \"\",\r\n\"networkRole\": \"\",\r\n\"networkScope\": \"\"\r\n}\r\n],\r\n\"serviceAllottedResources\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"Tunnel_Xconn\",\r\n\"modelUuid\": \"f6b7d4c6-e8a4-46e2-81bc-31cad5072842\",\r\n\"modelInvariantUuid\": \"b7a1b78e-6b6b-4b36-9698-8c9530da14af\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"367a8ba9-057a-4506-b106-fbae818597c6\",\r\n\"modelInstanceName\": \"Sec_Tunnel_Xconn 11\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"allottedResourceType\": \"\",\r\n\"allottedResourceRole\": null,\r\n\"providingServiceModelName\": null,\r\n\"providingServiceModelInvariantUuid\": null,\r\n\"providingServiceModelUuid\": null,\r\n\"nfFunction\": null,\r\n\"nfType\": null,\r\n\"nfRole\": null,\r\n\"nfNamingCode\": null\r\n}\r\n]\r\n}\r\n}";
+
+ private final String expectedServiceResourceResponsev2 = "{\r\n\"serviceResources\": {\r\n\"modelInfo\": {\r\n\"modelName\": \"MSOTADevInfra_vSAMP10a_Service\",\r\n\"modelUuid\": \"5df8b6de-2083-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"9647dfc4-2083-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2.0\"\r\n},\r\n\"serviceType\": \"NA\",\r\n\"serviceRole\": \"NA\",\r\n\"environmentContext\": \"Luna\",\r\n\"workloadContext\": \"Oxygen\",\r\n\"serviceVnfs\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10a\",\r\n\"modelUuid\": \"ff2ae348-214a-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"2fff5b20-214b-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2.0\",\r\n\"modelCustomizationUuid\": \"68dc9a92-214c-11e7-93ae-92361f002672\",\r\n\"modelInstanceName\": \"vSAMP10a 2\"\r\n},\r\n\"toscaNodeType\": \"VF\",\r\n\"nfFunction\": \"vSAMP\",\r\n\"nfType\": \"vSAMP\",\r\n\"nfRole\": \"vSAMP\",\r\n\"nfNamingCode\": \"vSAMP\",\r\n\"multiStageDesign\": null,\r\n\"vfModules\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::base::module-0\",\r\n\"modelUuid\": \"20c4431c-246d-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"cb82ffd8-252a-11e7-93ae-92361f002672\"\r\n},\r\n\"isBase\": true,\r\n\"vfModuleLabel\": \"base\",\r\n\"initialCount\": 1,\r\n\"hasVolumeGroup\": false\r\n},\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::PCM::module-1\",\r\n\"modelUuid\": \"066de97e-253e-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"64efd51a-2544-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"b4ea86b4-253f-11e7-93ae-92361f002672\"\r\n},\r\n\"isBase\": false,\r\n\"vfModuleLabel\": \"PCM\",\r\n\"initialCount\": 0,\r\n\"hasVolumeGroup\": false\r\n}\r\n]\r\n}\r\n],\r\n\"serviceNetworks\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"CONTRAIL30_GNDIRECT\",\r\n\"modelUuid\": \"10b36f65-f4e6-4be6-ae49-9596dc1c47fc\",\r\n\"modelInvariantUuid\": \"ce4ff476-9641-4e60-b4d5-b4abbec1271d\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"3bdbb104-476c-483e-9f8b-c095b3d308ac\",\r\n\"modelInstanceName\": \"CONTRAIL30_GNDIRECT 9\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"networkType\": \"\",\r\n\"networkTechnology\": \"\",\r\n\"networkRole\": \"\",\r\n\"networkScope\": \"\"\r\n}\r\n],\r\n\"serviceAllottedResources\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"Tunnel_Xconn\",\r\n\"modelUuid\": \"f6b7d4c6-e8a4-46e2-81bc-31cad5072842\",\r\n\"modelInvariantUuid\": \"b7a1b78e-6b6b-4b36-9698-8c9530da14af\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"367a8ba9-057a-4506-b106-fbae818597c6\",\r\n\"modelInstanceName\": \"Sec_Tunnel_Xconn 11\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"allottedResourceType\": \"\",\r\n\"allottedResourceRole\": null,\r\n\"providingServiceModelName\": null,\r\n\"providingServiceModelInvariantUuid\": null,\r\n\"providingServiceModelUuid\": null,\r\n\"nfFunction\": null,\r\n\"nfType\": null,\r\n\"nfRole\": null,\r\n\"nfNamingCode\": null\r\n}\r\n]\r\n}\r\n}";
+
+
+ private final String expectedServiceVnfResponse = "{\r\n\"serviceVnfs\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10a\",\r\n\"modelUuid\": \"ff2ae348-214a-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"2fff5b20-214b-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"68dc9a92-214c-11e7-93ae-92361f002671\",\r\n\"modelInstanceName\": \"vSAMP10a 1\"\r\n},\r\n\"toscaNodeType\": \"VF\",\r\n\"nfFunction\": \"vSAMP\",\r\n\"nfType\": \"vSAMP\",\r\n\"nfRole\": \"vSAMP\",\r\n\"nfNamingCode\": \"vSAMP\",\r\n\"multiStageDesign\": null,\r\n\"vfModules\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::base::module-0\",\r\n\"modelUuid\": \"20c4431c-246d-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"cb82ffd8-252a-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": true,\r\n\"vfModuleLabel\": \"base\",\r\n\"initialCount\": 1,\r\n\"hasVolumeGroup\": false\r\n},\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::PCM::module-1\",\r\n\"modelUuid\": \"066de97e-253e-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"64efd51a-2544-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"b4ea86b4-253f-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": false,\r\n\"vfModuleLabel\": \"PCM\",\r\n\"initialCount\": 0,\r\n\"hasVolumeGroup\": false\r\n}\r\n]\r\n}\r\n]\r\n}";
+
+ private final String expectedServiceVnfResponseV3 = "{\r\n\"serviceVnfs\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10a\",\r\n\"modelUuid\": \"ff2ae348-214a-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"2fff5b20-214b-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2.0\",\r\n\"modelCustomizationUuid\": \"68dc9a92-214c-11e7-93ae-92361f002672\",\r\n\"modelInstanceName\": \"vSAMP10a 2\"\r\n},\r\n\"toscaNodeType\": \"VF\",\r\n\"nfFunction\": \"vSAMP\",\r\n\"nfType\": \"vSAMP\",\r\n\"nfRole\": \"vSAMP\",\r\n\"nfNamingCode\": \"vSAMP\",\r\n\"multiStageDesign\": null,\r\n\"vfModules\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::base::module-0\",\r\n\"modelUuid\": \"20c4431c-246d-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"cb82ffd8-252a-11e7-93ae-92361f002672\"\r\n},\r\n\"isBase\": true,\r\n\"vfModuleLabel\": \"base\",\r\n\"initialCount\": 1,\r\n\"hasVolumeGroup\": false\r\n},\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::PCM::module-1\",\r\n\"modelUuid\": \"066de97e-253e-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"64efd51a-2544-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"b4ea86b4-253f-11e7-93ae-92361f002672\"\r\n},\r\n\"isBase\": false,\r\n\"vfModuleLabel\": \"PCM\",\r\n\"initialCount\": 0,\r\n\"hasVolumeGroup\": false\r\n}\r\n]\r\n}\r\n]\r\n}";
+
+ private final String expectedServiceNetworkResourceResponse = "{\r\n\"serviceNetworks\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"CONTRAIL30_GNDIRECT\",\r\n\"modelUuid\": \"10b36f65-f4e6-4be6-ae49-9596dc1c47fc\",\r\n\"modelInvariantUuid\": \"ce4ff476-9641-4e60-b4d5-b4abbec1271d\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"3bdbb104-476c-483e-9f8b-c095b3d308ac\",\r\n\"modelInstanceName\": \"CONTRAIL30_GNDIRECT 9\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"networkType\": \"\",\r\n\"networkTechnology\": \"\",\r\n\"networkRole\": \"\",\r\n\"networkScope\": \"\"\r\n}\r\n]\r\n}";
+
+ private final String badQueryParamResponse = "{\"messageId\":null,\"message\":\"no matching parameters\",\"category\":\"INTERNAL\",\"rolledBack\":false}\"";
+
+ private final String expectedAllottedResponse = "{\r\n\"serviceAllottedResources\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"Tunnel_Xconn\",\r\n\"modelUuid\": \"f6b7d4c6-e8a4-46e2-81bc-31cad5072842\",\r\n\"modelInvariantUuid\": \"b7a1b78e-6b6b-4b36-9698-8c9530da14af\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"367a8ba9-057a-4506-b106-fbae818597c6\",\r\n\"modelInstanceName\": \"Sec_Tunnel_Xconn 11\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"allottedResourceType\": \"\",\r\n\"allottedResourceRole\": null,\r\n\"providingServiceModelName\": null,\r\n\"providingServiceModelInvariantUuid\": null,\r\n\"providingServiceModelUuid\": null,\r\n\"nfFunction\": null,\r\n\"nfType\": null,\r\n\"nfRole\": null,\r\n\"nfNamingCode\": null\r\n}\r\n]\r\n}";
+
+ private final String serviceUUID = "5df8b6de-2083-11e7-93ae-92361f002671";
+
+ private final String serviceInvariantUUID = "9647dfc4-2083-11e7-93ae-92361f002671";
+
+ /* Health Check Resources Endpoint */
+
+ @Test
+ public void testHealthcheck() throws JSONException {
+
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ createURLWithPort("/manage/health"),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ }
+
+ /* Service Resources Endpoint */
+
+ @Test
+ public void testGetServiceModelUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES))
+ .queryParam("serviceModelUuid", serviceUUID);
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceResourceResponse, response.getBody().toString(), JSONCompareMode.LENIENT);
+ }
+
+ @Test
+ public void testGetServiceInvariantUUIDAndVersion() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES))
+ .queryParam("serviceModelInvariantUuid", "9647dfc4-2083-11e7-93ae-92361f002671").queryParam("serviceModelVersion", "1.0");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceResourceResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceInvariantUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES))
+ .queryParam("serviceModelInvariantUuid", "9647dfc4-2083-11e7-93ae-92361f002671");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceResourceResponsev2, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceInvariantUUIDEmtpyModelVer() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES))
+ .queryParam("serviceModelInvariantUuid", "9647dfc4-2083-11e7-93ae-92361f002671").queryParam("serviceModelVersion", "");;
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceResourceResponsev2, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceModelUUID404() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ String expectedResponse = "\"serviceResources\": null";
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES))
+ .queryParam("serviceModelUuid", "5df8b6de-2083-11e7-93");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceBadQueryParams() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES))
+ .queryParam("BadQueryParam", "5df8b6de-2083-11e7-93");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(badQueryParamResponse, response.getBody().toString(), false);
+ }
+
+ /* VNF Resources Endpoint */
+
+ @Test
+ public void testGetVNFResourcesByCustomizationUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ String expectedResponse = "{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10a\",\r\n\"modelUuid\": \"ff2ae348-214a-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"2fff5b20-214b-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"68dc9a92-214c-11e7-93ae-92361f002671\",\r\n\"modelInstanceName\": \"vSAMP10a 1\"\r\n},\r\n\"toscaNodeType\": \"VF\",\r\n\"nfFunction\": \"vSAMP\",\r\n\"nfType\": \"vSAMP\",\r\n\"nfRole\": \"vSAMP\",\r\n\"nfNamingCode\": \"vSAMP\",\r\n\"multiStageDesign\": null,\r\n\"vfModules\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::base::module-0\",\r\n\"modelUuid\": \"20c4431c-246d-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"cb82ffd8-252a-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": true,\r\n\"vfModuleLabel\": \"base\",\r\n\"initialCount\": 1,\r\n\"hasVolumeGroup\": false\r\n},\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::PCM::module-1\",\r\n\"modelUuid\": \"066de97e-253e-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"64efd51a-2544-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"b4ea86b4-253f-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": false,\r\n\"vfModuleLabel\": \"PCM\",\r\n\"initialCount\": 0,\r\n\"hasVolumeGroup\": false\r\n}\r\n]\r\n}";
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort("ecomp/mso/catalog/v2/vnfResources/68dc9a92-214c-11e7-93ae-92361f002671"))
+ ;
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedResponse, response.getBody().toString(), false);
+ }
+
+
+
+ @Test
+ public void testGetVNFResources404() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort("ecomp/mso/catalog/v2/vnfResources/68dc-11e7-93ae-92361f002671"))
+ ;
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatusCode().value());
+
+ }
+
+ @Test
+ public void testGetServiceVNFResourcesByCustomizationUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("vnfModelCustomizationUuid", "68dc9a92-214c-11e7-93ae-92361f002671");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceVnfResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceVNFResourcesByServiceModelUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("serviceModelUuid", serviceUUID);
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceVnfResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceVNFResourcesByServiceModelInvariantUUIDAndVersion() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("serviceModelInvariantUuid", "9647dfc4-2083-11e7-93ae-92361f002671")
+ .queryParam("serviceModelVersion", "1.0");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceVnfResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceVNFResourcesByServiceModelInvariantUUIDEmptyVersion() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("serviceModelInvariantUuid", "9647dfc4-2083-11e7-93ae-92361f002671")
+ .queryParam("serviceModelVersion", "");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceVnfResponseV3, response.getBody().toString(), false);
+ }
+
+
+ @Test
+ public void testGetServiceVNFResourcesByServiceModelInvariantUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("serviceModelInvariantUuid", "9647dfc4-2083-11e7-93ae-92361f002671");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceVnfResponseV3, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceVNFResourcesByServiceModelName() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("serviceModelName", "MSOTADevInfra_vSAMP10a_Service");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceVnfResponseV3, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceVNFResourcesByServiceModelNameEmptyVersion() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("serviceModelName", "MSOTADevInfra_vSAMP10a_Service").queryParam("serviceModelVersion", "");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceVnfResponseV3, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceVNFResourcesByServiceModelNameAndVersion() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("serviceModelName", "MSOTADevInfra_vSAMP10a_Service").queryParam("serviceModelVersion", "1.0");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceVnfResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testSerfviceVNFResources404() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("serviceModelName", "BADNAME").queryParam("serviceModelVersion", "1.0");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatusCode().value());
+
+ }
+
+
+ @Test
+ public void testSerfviceVNFBadParams() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("BadParamName", "BADNAME");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(badQueryParamResponse, response.getBody().toString(), false);
+
+
+ }
+
+
+
+ /* Network Resources Endpoint */
+
+ @Test
+ public void testGetNetworkResourcesByCustomizationUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ String expectedResponse = "{\r\n\"modelInfo\": {\r\n\"modelName\": \"CONTRAIL30_GNDIRECT\",\r\n\"modelUuid\": \"10b36f65-f4e6-4be6-ae49-9596dc1c47fc\",\r\n\"modelInvariantUuid\": \"ce4ff476-9641-4e60-b4d5-b4abbec1271d\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"3bdbb104-476c-483e-9f8b-c095b3d308ac\",\r\n\"modelInstanceName\": \"CONTRAIL30_GNDIRECT 9\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"networkType\": \"\",\r\n\"networkTechnology\": \"\",\r\n\"networkRole\": \"\",\r\n\"networkScope\": \"\"\r\n}";
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort("ecomp/mso/catalog/v2/networkResources/3bdbb104-476c-483e-9f8b-c095b3d308ac"))
+ ;
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedResponse, response.getBody().toString(), false);
+ }
+
+
+
+ @Test
+ public void testGetNetworkResources404() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort("ecomp/mso/catalog/v2/networkResources/3bdbb104-4asdf"))
+ ;
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatusCode().value());
+
+ }
+
+ /* Service Network Resources Endpoints */
+
+ @Test
+ public void testGetServiceNetworkResourcesByUnknownQueryParam() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
+ .queryParam("serviceModelName", "PROVIDER NETWORK").queryParam("serviceModelVersion", "2.0");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(badQueryParamResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceNetworkResourcesByServiceModelUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
+ .queryParam("serviceModelUuid", serviceUUID);
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceNetworkResourceResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceNetworkResourcesByServiceModelUUIDNotExist() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
+ .queryParam("serviceModelUuid", "doesNotExist");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatusCode().value());
+
+ }
+
+ @Test
+ public void testGetServiceNetworkResourcesByNetworkCustomizationUUIDNotExist() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
+ .queryParam("networkModelCustomizationUuid", "06b8966e-097c-4d63-afda-e0d");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatusCode().value());
+
+ }
+
+ @Test
+ public void testGetServiceNetworkResourcesByServiceModelInvariantUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
+ .queryParam("serviceModelInvariantUuid", serviceInvariantUUID);
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceNetworkResourceResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceNetworkResourcesByServiceModelInvariantUUIDAndVersion() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
+ .queryParam("serviceModelInvariantUuid", serviceInvariantUUID)
+ .queryParam("serviceModelVersion", "2.0");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceNetworkResourceResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceNetworkResourcesByServiceModelInvariantAndEmptyVersion() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
+ .queryParam("serviceModelInvariantUuid", serviceInvariantUUID)
+ .queryParam("serviceModelVersion", "");
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceNetworkResourceResponse, response.getBody().toString(), false);
+ }
+
+
+ @Test
+ public void testGetServiceNetworkResourcesByNetworkCustomizationUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
+ .queryParam("networkModelCustomizationUuid", "3bdbb104-476c-483e-9f8b-c095b3d308ac");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceNetworkResourceResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceNetworkResourcesByNetworkModelName() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
+ .queryParam("networkModelName", "CONTRAIL30_GNDIRECT");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceNetworkResourceResponse, response.getBody().toString(), false);
+ }
+
+ /* Allotted endpoints */
+
+ @Test
+ public void testGetAllottedResourcesByCustomizationUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ String expectedResponse = "{\r\n\"modelInfo\": {\r\n\"modelName\": \"Tunnel_Xconn\",\r\n\"modelUuid\": \"f6b7d4c6-e8a4-46e2-81bc-31cad5072842\",\r\n\"modelInvariantUuid\": \"b7a1b78e-6b6b-4b36-9698-8c9530da14af\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"367a8ba9-057a-4506-b106-fbae818597c6\",\r\n\"modelInstanceName\": \"Sec_Tunnel_Xconn 11\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"allottedResourceType\": \"\",\r\n\"allottedResourceRole\": null,\r\n\"providingServiceModelName\": null,\r\n\"providingServiceModelInvariantUuid\": null,\r\n\"providingServiceModelUuid\": null,\r\n\"nfFunction\": null,\r\n\"nfType\": null,\r\n\"nfRole\": null,\r\n\"nfNamingCode\": null\r\n}";
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort("ecomp/mso/catalog/v2/allottedResources/367a8ba9-057a-4506-b106-fbae818597c6"));
+
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedResponse, response.getBody().toString(), false);
+ }
+
+
+ @Test
+ public void testGetAllottedResourcesByServiceModelUuuid() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES))
+ .queryParam("serviceModelUuid",serviceUUID);
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedAllottedResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceAllottedResourcesByServiceModelInvariantUuid() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES))
+ .queryParam("serviceModelInvariantUuid", serviceInvariantUUID);
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedAllottedResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceAllottedResourcesByServiceModelInvariantUuidModelVersion() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES))
+ .queryParam("serviceModelInvariantUuid", serviceInvariantUUID)
+ .queryParam("serviceModelVersion", "1.0");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedAllottedResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceAllottedResourcesByServiceModelInvariantUuidModelVersionEmpty() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES))
+ .queryParam("serviceModelInvariantUuid", serviceInvariantUUID)
+ .queryParam("serviceModelVersion", "1.0");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedAllottedResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetAllottedResourcesByAllottedCustomizationId() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES))
+ .queryParam("arModelCustomizationUuid", "367a8ba9-057a-4506-b106-fbae818597c6");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedAllottedResponse, response.getBody().toString(), false);
+ }
+
+
+ @Test
+ public void testGetAllottedResourcesResourcesNonExistResource() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES))
+ .queryParam("arModelCustomizationUuid", "NOTEXIST");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatusCode().value());
+
+ }
+
+ /* VF Modules Endpoint */
+
+ @Test
+ public void testGetVFModulesNonExistResource() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_VF_MODULES))
+ .queryParam("vfModuleModelName", "NEUTRON_BASIC");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatusCode().value());
+
+ }
+
+ @Test
+ public void testGetVFModulesByVfModuleModelName() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ String expectedResponse = "{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::base::module-0\",\r\n\"modelUuid\": \"20c4431c-246d-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"cb82ffd8-252a-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": true,\r\n\"vfModuleLabel\": \"base\",\r\n\"initialCount\": 1,\r\n\"hasVolumeGroup\": false\r\n}";
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_VF_MODULES))
+ .queryParam("vfModuleModelName", "vSAMP10aDEV::base::module-0");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedResponse, response.getBody().toString(), false);
+
+ }
+
+ @Test
+ public void testGetVFModulesBadQueryParam() throws JSONException, IOException {
+ TestAppender.events.clear();
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_VF_MODULES))
+ .queryParam("ADASD", "NEUTRON_BASIC");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(badQueryParamResponse, response.getBody().toString(), false);
+
+
+ ILoggingEvent logEvent = TestAppender.events.get(0);
+ Map<String,String> mdc = logEvent.getMDCPropertyMap();
+ assertNotNull(mdc.get(MsoLogger.BEGINTIME));
+ assertNotNull(mdc.get(MsoLogger.ENDTIME));
+ assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(MsoLogger.TIMER));
+ assertEquals("500",mdc.get(MsoLogger.RESPONSECODE));
+ assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
+ assertEquals("v2/vfModules",mdc.get(MsoLogger.SERVICE_NAME));
+ assertEquals("ERROR",mdc.get(MsoLogger.STATUSCODE));
+ assertNotNull(mdc.get(MsoLogger.RESPONSEDESC));
+ }
+
+ private String createURLWithPort(String uri) {
+ return "http://localhost:" + port + uri;
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionTest.java
index 365c9abcf5..3e30dcc3b2 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.catalogdb.catalogrest;
+package org.onap.so.adapters.catalogdb.catalogrest;
import org.junit.Test;
import static org.junit.Assert.assertNotNull;
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java
new file mode 100644
index 0000000000..f09df8823c
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java
@@ -0,0 +1,153 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.catalogrest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import javax.transaction.Transactional;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.adapters.catalogdb.CatalogDBApplication;
+import org.onap.so.db.catalog.beans.BuildingBlockDetail;
+import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
+import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
+import org.onap.so.db.catalog.beans.InstanceGroup;
+import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+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;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class NetworkCollectionCatalogDbQueryTest {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkCollectionCatalogDbQueryTest.class);
+ private static final String NETWORKCOLLECTION = "NetworkCollection";
+
+ private final String serviceUUID = "5df8b6de-2083-11e7-93ae-92361f002671";
+
+ @LocalServerPort
+ private int port;
+
+ @Autowired
+ private CatalogDbClient client;
+
+ @Before
+ public void setPort() {
+ client.removePortFromEndpoint();
+ client.setPortToEndpoint(Integer.toString(port));
+ }
+
+ @Test
+ @Transactional
+ public void networkCollectionTest() {
+ msoLogger.debug("TEST IS STARTING UP...");
+ String modelUUID = "4694a55f-58b3-4f17-92a5-796d6f5ffd0d";
+ boolean found = false;
+ msoLogger.debug(Integer.toString(port));
+ InstanceGroup instanceGroup = null;
+ List<CollectionResourceInstanceGroupCustomization> collectionInstanceGroupList = null;
+ org.onap.so.db.catalog.beans.Service service = client.getServiceByID(modelUUID);
+ if (service == null) {
+ msoLogger.debug("null");
+ } else {
+ List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations();
+ if (customizations.isEmpty()) {
+ msoLogger.debug("No Network Collection found. CollectionResourceCustomizations is empty");
+ }
+ for (CollectionResourceCustomization crc : customizations) {
+ if(client.getNetworkCollectionResourceCustomizationByID(crc.getModelCustomizationUUID())
+ instanceof NetworkCollectionResourceCustomization) {
+ if (crc.getCollectionResource() != null) {
+ if (crc.getCollectionResource()
+ .getToscaNodeType() != null) {
+ String toscaNodeType = crc.getCollectionResource()
+ .getToscaNodeType();
+ if (toscaNodeType.contains(NETWORKCOLLECTION)) {
+ msoLogger.debug("Found a network collection");
+ instanceGroup = crc.getCollectionResource().getInstanceGroup();
+ collectionInstanceGroupList =
+ instanceGroup.getCollectionInstanceGroupCustomizations();
+ CollectionNetworkResourceCustomization collectionNetworkCust = instanceGroup.getCollectionNetworkResourceCustomizations().get(0);
+ msoLogger.debug("Found Collection Network Resource Customization: " + collectionNetworkCust.getModelCustomizationUUID());
+ } else {
+ msoLogger.debug(
+ "No Network Collection found. toscaNodeType does not contain NetworkCollection");
+ }
+ } else {
+ msoLogger.debug("No Network Collection found. toscaNodeType is null");
+ }
+ } else {
+ msoLogger.debug("No Network Collection found. collectionResource is null");
+ }
+ found = true;
+ } else {
+ msoLogger.debug("Not a Network Collection Resource Customization Instance");
+ }
+ }
+ }
+ assertEquals("Number of CollectionResourceInstanceGroupCustomization in list", 2, collectionInstanceGroupList.size());
+ assertNotNull(instanceGroup);
+ assertTrue(found);
+ }
+
+ @Test
+ public void buildingBlockDetailTest() {
+ msoLogger.debug("TEST IS STARTING UP...");
+ msoLogger.debug(Integer.toString(port));
+ String buildingBlockFlowName = "CreateNetworkCollectionBB";
+ BuildingBlockDetail buildingBlockDetail = client.getBuildingBlockDetail(buildingBlockFlowName);
+ msoLogger.debug("" + buildingBlockDetail.getResourceType());
+ assertNotNull(buildingBlockDetail);
+ }
+
+ @Test
+ public void fetchServiceTopology_Test() {
+ org.onap.so.db.catalog.beans.Service service = client.getServiceByID(serviceUUID);
+
+ if (service == null) {
+ fail("Service is null");
+ }
+ assertEquals(serviceUUID, service.getModelUUID());
+ assertEquals("MSOTADevInfra_vSAMP10a_Service",service.getModelName());
+ }
+
+ @Test
+ public void CollectionNetworkResourceCustomizationTest() {
+ String modelCustId = "1a61be4b-3378-4c9a-91c8-c919519b2d01";
+ CollectionNetworkResourceCustomization collectionNetworkCust = client.getCollectionNetworkResourceCustomizationByID(modelCustId);
+ assertNotNull(collectionNetworkCust);
+ msoLogger.debug(collectionNetworkCust.getModelCustomizationUUID());
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java
index fa1a1fc94e..645714cc80 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java
@@ -18,14 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.catalogdb.catalogrest;
+package org.onap.so.adapters.catalogdb.catalogrest;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Before;
import org.junit.Test;
-import org.openecomp.mso.db.catalog.beans.Recipe;
-import org.openecomp.mso.jsonpath.JsonPathUtil;
+import org.onap.so.db.catalog.beans.Recipe;
+import org.onap.so.db.catalog.beans.ServiceRecipe;
+import org.onap.so.jsonpath.JsonPathUtil;
public class QueryResourceRecipeTest {
@@ -55,18 +56,13 @@ public class QueryResourceRecipeTest {
assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.description")).contains(RECIPE_DESCRIPTION);
}
- @Test
- public void toString_properContent() {
- assertThat(testedObject.toString()).contains("RECIPE: actionTest,uri=uriTest");
- }
-
private Recipe createRecipe() {
- Recipe recipe = new Recipe();
+ ServiceRecipe recipe = new ServiceRecipe();
recipe.setId(RECIPE_ID);
recipe.setAction(RECIPE_ACTION);
recipe.setOrchestrationUri(RECIPE_URI);
recipe.setRecipeTimeout(RECIPE_TIMEOUT);
- recipe.setParamXSD(RECIPE_PARAMS_XSD);
+ recipe.setParamXsd(RECIPE_PARAMS_XSD);
recipe.setDescription(RECIPE_DESCRIPTION);
return recipe;
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceCsarTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsarTest.java
index e9c947d50e..32cc2946db 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceCsarTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsarTest.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.catalogdb.catalogrest;
+package org.onap.so.adapters.catalogdb.catalogrest;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Before;
import org.junit.Test;
-import org.openecomp.mso.db.catalog.beans.ToscaCsar;
-import org.openecomp.mso.jsonpath.JsonPathUtil;
+import org.onap.so.db.catalog.beans.ToscaCsar;
+import org.onap.so.jsonpath.JsonPathUtil;
public class QueryServiceCsarTest {
@@ -55,12 +55,6 @@ public class QueryServiceCsarTest {
assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.description")).contains(TOSCA_DESCRIPTION);
}
- @Test
- public void toString_properContent() {
- assertThat(testedObject.toString()).contains(
- "TOSCACSAR: artifactUUID=artUuidTest,name=toscaNameTest,version=v12,description=toscaDescr,artifactChecksum=tosArtCheck,url=tosUrl");
- }
-
private ToscaCsar createToscaCsar() {
ToscaCsar toscaCsar = new ToscaCsar();
toscaCsar.setArtifactUUID(TOSCA_ARTIFACT_UUID);
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModuleTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModuleTest.java
index b00b5b7ca8..98e90c828c 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModuleTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModuleTest.java
@@ -18,16 +18,18 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.catalogdb.catalogrest;
+package org.onap.so.adapters.catalogdb.catalogrest;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.ArrayList;
import java.util.List;
+
import org.junit.Test;
-import org.openecomp.mso.db.catalog.beans.VfModule;
-import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;
-import org.openecomp.mso.jsonpath.JsonPathUtil;
+import org.onap.so.db.catalog.beans.HeatEnvironment;
+import org.onap.so.db.catalog.beans.VfModule;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.jsonpath.JsonPathUtil;
public class QueryVfModuleTest {
@@ -74,13 +76,13 @@ public class QueryVfModuleTest {
VfModule vfModule = new VfModule();
vfModule.setModelName(VF_MODULE_MODEL_NAME);
vfModule.setModelUUID(VF_MODEL_UUID);
- vfModule.setModelInvariantUuid(VF_MODULE_INVARIANT_UUID);
- vfModule.setVersion(VF_MODULE_VERSION);
- vfModule.setIsBase(1);
+ vfModule.setModelInvariantUUID(VF_MODULE_INVARIANT_UUID);
+ vfModule.setModelVersion(VF_MODULE_VERSION);
+ vfModule.setIsBase(true);
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
vfModuleCustomization.setVfModule(vfModule);
- vfModuleCustomization.setModelCustomizationUuid(VF_MODEL_CUSTOMIZATION_UUID);
+ vfModuleCustomization.setModelCustomizationUUID(VF_MODEL_CUSTOMIZATION_UUID);
vfModuleCustomization.setLabel(VF_MODEL_CUSTOMIZATION_LABEL);
vfModuleCustomization.setInitialCount(VF_MODEL_CUSTOMIZATION_INITIAL_COUNT);
list.add(vfModuleCustomization);
@@ -89,7 +91,9 @@ public class QueryVfModuleTest {
private List<VfModuleCustomization> createListWithHeatEnvironmentArtifactUuid() {
List<VfModuleCustomization> list = createList();
- list.get(0).setHeatEnvironmentArtifactUuid("heatEnvTest");
+ HeatEnvironment he = new HeatEnvironment();
+ he.setArtifactUuid("heatEnvTest");
+ list.get(0).setVolumeHeatEnv(he);
return list;
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/TestAppender.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/TestAppender.java
new file mode 100644
index 0000000000..c5772d9883
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/TestAppender.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.catalogrest;
+
+import java.util.ArrayList;
+import java.util.List;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.AppenderBase;
+
+
+
+public class TestAppender extends AppenderBase<ILoggingEvent> {
+ static List<ILoggingEvent> events = new ArrayList<>();
+
+ @Override
+ protected void append(ILoggingEvent loggingEvent) {
+ events.add(loggingEvent);
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestClassTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestClassTest.java
deleted file mode 100644
index 31594905fd..0000000000
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestClassTest.java
+++ /dev/null
@@ -1,380 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.adapters.catalogdb;
-
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.http.HttpStatus;
-import javax.json.*;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.openecomp.mso.adapters.catalogdb.CatalogDbAdapterRest;
-import org.openecomp.mso.adapters.catalogdb.catalogrest.CatalogQueryException;
-import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryServiceVnfs;
-import org.openecomp.mso.db.catalog.CatalogDatabase;
-import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.junit.Before;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.when;
-import static org.powermock.api.mockito.PowerMockito.mockStatic;
-import static org.powermock.api.mockito.PowerMockito.verifyStatic;
-import static org.hamcrest.CoreMatchers.instanceOf;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({CatalogDbAdapterRest.class, CatalogDatabase.class})
-public class CatalogDbAdapterRestClassTest {
- @Mock
- private static CatalogDatabase dbMock;
-
- private static List<VnfResourceCustomization> paramList;
-
- @Before
- public void prepare () {
- /*
- * 1. for non routing related methods/classes, use mockito
- * 2. for routing methods, use TJWSEmbeddedJaxrsServer
- */
-
- /*
- * in the setup portion, create a mock db object
- *
- */
- // set up mock return value
- paramList = new ArrayList<>();
- VnfResourceCustomization d1 = new VnfResourceCustomization();
- d1.setModelCustomizationUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- d1.setModelInstanceName("ciVFOnboarded-FNAT-aab06c41 1");
- paramList.add(d1);
- // end
-
- PowerMockito.mockStatic(CatalogDatabase.class);
- dbMock = PowerMockito.mock(CatalogDatabase.class);
- PowerMockito.when(CatalogDatabase.getInstance()).thenReturn(dbMock);
- try {
-
- PowerMockito.whenNew(CatalogDatabase.class).withAnyArguments().thenReturn(dbMock);
- PowerMockito.spy (dbMock);
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void respond_Test(){
- QueryServiceVnfs qryResp = new QueryServiceVnfs(paramList);
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
- CatalogDbAdapterRest spyAdapter = Mockito.spy(adapter);
-
- Response resp = spyAdapter.respond("v1", HttpStatus.SC_OK, false, qryResp);
- Mockito.verify(spyAdapter,Mockito.times(1)).respond("v1", HttpStatus.SC_OK, false, qryResp);
-
- String s = resp.getEntity().toString();
- // System.out.println(s);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- // end
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
-
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- }
-
-
- @Test
- public void serviceVnfsImpl_vnfUuid_ver_Test()
- {
- PowerMockito.when(dbMock.getAllVnfsByVnfModelCustomizationUuid(Mockito.anyString())).thenReturn (paramList);
-
- try {
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
-
- // Run
- Response resp = adapter.serviceVnfsImpl("v1", true, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391", null, null, null, null);
- String s = resp.getEntity().toString();
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- // end
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
-
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- //
- Mockito.verify(dbMock, Mockito.times(1)).getAllVnfsByVnfModelCustomizationUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void serviceVnfsImpl_smiUuid_NoVer_Test()
- {
- PowerMockito.when(dbMock.getAllVnfsByServiceModelInvariantUuid(Mockito.anyString())).thenReturn (paramList);
-
- try {
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
-
- // Run
- Response resp = adapter.serviceVnfsImpl("v1", true, null, null, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391", null, null);
- String s = resp.getEntity().toString();
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- // end
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
-
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- Mockito.verify(dbMock, Mockito.times(1)).getAllVnfsByServiceModelInvariantUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void serviceVnfsImpl_smUuid_ver_Test()
- {
- PowerMockito.when(dbMock.getAllVnfsByServiceModelUuid(Mockito.anyString())).thenReturn (paramList);
-
- try {
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
-
- // Run
- Response resp = adapter.serviceVnfsImpl("v1", true, null,"16ea3e56-a8ce-4ad7-8edd-4d2eae095391", null, null, null);
- String s = resp.getEntity().toString();
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- // end
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
-
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- Mockito.verify(dbMock, Mockito.times(1)).getAllVnfsByServiceModelUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void serviceVnfsImpl_smiUuid_ver_Test()
- {
- PowerMockito.when(dbMock.getAllVnfsByServiceModelInvariantUuid(Mockito.anyString(),Mockito.anyString())).thenReturn (paramList);
-
- try {
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
-
- // Run
- Response resp = adapter.serviceVnfsImpl("v1", true, null, null, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391", "v1", null);
- String s = resp.getEntity().toString();
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
- // end
-
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- Mockito.verify(dbMock, Mockito.times(1)).getAllVnfsByServiceModelInvariantUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391","v1");
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void serviceVnfsImpl_smName_ver_Test()
- {
- PowerMockito.when(dbMock.getAllVnfsByServiceName(Mockito.anyString(),Mockito.anyString())).thenReturn (paramList);
-
- try {
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
-
- // Run
- Response resp = adapter.serviceVnfsImpl("v1", true, null, null, null, "v1", "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- String s = resp.getEntity().toString();
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- // end
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
-
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- Mockito.verify(dbMock, Mockito.times(1)).getAllVnfsByServiceName("16ea3e56-a8ce-4ad7-8edd-4d2eae095391","v1");
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void serviceVnfsImpl_smName_NoVer_Test()
- {
- PowerMockito.when(dbMock.getAllVnfsByServiceName(Mockito.anyString())).thenReturn (paramList);
-
- try {
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
-
- // Run
- Response resp = adapter.serviceVnfsImpl("v1", true, null, null, null, null, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- String s = resp.getEntity().toString();
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- // end
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
-
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- Mockito.verify(dbMock, Mockito.times(1)).getAllVnfsByServiceName("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void serviceVnfsImpl_Exception_Test()
- {
- PowerMockito.when(dbMock.getAllVnfsByServiceName(Mockito.anyString())).thenReturn (null);
-
- try {
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
-
- // Run
- Response resp = adapter.serviceVnfsImpl("v1", true, null, null, null, null, null);
-
- assertEquals(resp.getStatus(), HttpStatus.SC_INTERNAL_SERVER_ERROR);
- assertThat(resp.getEntity(), instanceOf(CatalogQueryException.class));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void serviceNetworksImpl_nUuid_ver_Test(){
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
- CatalogDbAdapterRest spyAdapter = Mockito.spy(adapter);
-
- Response resp = Response
- .status(HttpStatus.SC_OK)
- .entity("{\"serviceVnfs\":[{\"version\":\"v1\",\"modelCustomizationUuid\":\"16ea3e56-a8ce-4ad7-8edd-4d2eae095391\",\"modelInstanceName\":\"ciVFOnboarded-FNAT-aab06c41 1\",\"created\":null,\"vnfResourceModelUuid\":null,\"vnfResourceModelUUID\":null,\"minInstances\":null,\"maxInstances\":null,\"availabilityZoneMaxCount\":null,\"vnfResource\":null,\"nfFunction\":null,\"nfType\":null,\"nfRole\":null,\"nfNamingCode\":null,\"multiStageDesign\":null,\"vfModuleCustomizations\":null,\"serviceResourceCustomizations\":null,\"creationTimestamp\":null}]}")
- .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .build();
-
- Mockito.doReturn(resp).when(spyAdapter).serviceNetworksImpl(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
-
- // Run
-
- Response ret = spyAdapter.serviceNetworksImpl("v1", false, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391",null, null, null, null);
- Mockito.verify(spyAdapter).serviceNetworksImpl("v1", false, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391", null, null, null, null);
-
- assertTrue(ret.getStatus() == HttpStatus.SC_OK);
- String s = resp.getEntity().toString();
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- // end
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
-
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
-
- }
-
- @Test
- public void serviceAllottedResourcesImpl_Test()
- {
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
- CatalogDbAdapterRest spyAdapter = Mockito.spy(adapter);
-
- Response resp = Response
- .status(HttpStatus.SC_OK)
- .entity("{\"serviceVnfs\":[{\"version\":\"v1\",\"modelCustomizationUuid\":\"16ea3e56-a8ce-4ad7-8edd-4d2eae095391\",\"modelInstanceName\":\"ciVFOnboarded-FNAT-aab06c41 1\",\"created\":null,\"vnfResourceModelUuid\":null,\"vnfResourceModelUUID\":null,\"minInstances\":null,\"maxInstances\":null,\"availabilityZoneMaxCount\":null,\"vnfResource\":null,\"nfFunction\":null,\"nfType\":null,\"nfRole\":null,\"nfNamingCode\":null,\"multiStageDesign\":null,\"vfModuleCustomizations\":null,\"serviceResourceCustomizations\":null,\"creationTimestamp\":null}]}")
- .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .build();
-
- Mockito.doReturn(resp).when(spyAdapter).serviceAllottedResourcesImpl(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
-
- // Run
-
- Response ret = spyAdapter.serviceAllottedResourcesImpl("v1", false, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391",null, null, null);
- Mockito.verify(spyAdapter).serviceAllottedResourcesImpl("v1", false, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391", null, null, null);
-
- assertTrue(ret.getStatus() == HttpStatus.SC_OK);
- String s = resp.getEntity().toString();
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- // end
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
-
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
-
- }
-
-}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestHttpTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestHttpTest.java
deleted file mode 100644
index ae5e663777..0000000000
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestHttpTest.java
+++ /dev/null
@@ -1,490 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.adapters.catalogdb;
-
-import javax.json.Json;
-import javax.json.JsonArray;
-import javax.json.JsonObject;
-import javax.json.JsonReader;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.jboss.resteasy.plugins.server.tjws.TJWSEmbeddedJaxrsServer;
-import static org.junit.Assert.*;
-
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.resteasy.spi.Registry;
-import org.jboss.resteasy.spi.ResteasyProviderFactory;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.openecomp.mso.adapters.catalogdb.CatalogDbAdapterRest;
-import org.openecomp.mso.db.catalog.CatalogDatabase;
-import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.ServiceMacroHolder;
-import org.openecomp.mso.db.catalog.beans.VfModule;
-import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;
-import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PowerMockIgnore;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.apache.http.HttpStatus;
-import org.jboss.resteasy.client.jaxrs.ResteasyClient;
-import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
-import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({CatalogDatabase.class})
-@PowerMockIgnore("javax.net.ssl.*")
-public class CatalogDbAdapterRestHttpTest {
- @Mock
- private static CatalogDatabase dbMock;
- private static TJWSEmbeddedJaxrsServer server;
- private static final int PORT = 3099;
- private static Registry registry;
- private static ResteasyProviderFactory factory;
-
- @BeforeClass
- public static void beforeClass() throws Exception {
- server = new TJWSEmbeddedJaxrsServer();
- server.setPort(PORT);
- server.start();
- registry = server.getDeployment().getRegistry();
- factory = server.getDeployment().getDispatcher().getProviderFactory();
- registry.addPerRequestResource(CatalogDbAdapterRest.class);
- factory.registerProvider(CatalogDbAdapterRest.class);
- }
-
- @Before
- public void before(){
- PowerMockito.mockStatic(CatalogDatabase.class);
- dbMock = PowerMockito.mock(CatalogDatabase.class);
- PowerMockito.when(CatalogDatabase.getInstance()).thenReturn(dbMock);
-
- try {
- PowerMockito.whenNew(CatalogDatabase.class).withAnyArguments().thenReturn(dbMock);
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void healthCheck_Test(){
- ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target("http://localhost:3099/v1/healthcheck");
- Response response = target.request().get();
- String value = response.readEntity(String.class);
- assertTrue(value.contains("Application v1 ready"));
- }
-
- @Test
- public void vnfResourcesUrl_Test()
- {
- try {
- List<VnfResourceCustomization> paramList;
- // set up mock return value
- paramList = new ArrayList<>();
- VnfResourceCustomization d1 = new VnfResourceCustomization();
- d1.setModelCustomizationUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- d1.setModelInstanceName("RG_6-26_mog11 0");
- d1.setVersion("v1");
- paramList.add(d1);
- PowerMockito.when(dbMock.getAllVnfsByVnfModelCustomizationUuid(Mockito.anyString())).thenReturn (paramList);
- // end
-
- // Run
- ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target("http://localhost:3099/v1/vnfResources/16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- Response response = target.request().get();
- String value = response.readEntity(String.class);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
- assertTrue(jArray.size() == 1);
- if(jArray.size() == 1){
- JsonObject rec = jArray.getJsonObject(0);
- String version = rec.getString("version");
- String uuid = rec.getString("modelCustomizationUuid");
-
- assertTrue(version.equals("v1"));
- assertTrue(uuid.equals("16ea3e56-a8ce-4ad7-8edd-4d2eae095391"));
- }
- // end
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void serviceVnfsUrl_smiUuid_smVer_Test(){
- try {
- List<VnfResourceCustomization> paramList;
- // set up mock return value
- paramList = new ArrayList<>();
- VnfResourceCustomization d1 = new VnfResourceCustomization();
- d1.setVnfResourceModelUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- d1.setModelInstanceName("RG_6-26_mog11 0");
- d1.setVersion("v1");
- d1.setMaxInstances(50);
- paramList.add(d1);
- PowerMockito.when(dbMock.getAllVnfsByServiceModelInvariantUuid(Mockito.anyString(),Mockito.anyString())).thenReturn (paramList);
- // end
-
- // Run
- ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target("http://localhost:3099/v1/serviceVnfs?serviceModelInvariantUuid=16ea3e56-a8ce-4ad7-8edd-4d2eae095391&serviceModelVersion=ver1");
- Response response = target.request().get();
- String value = response.readEntity(String.class);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
- assertTrue(jArray.size() == 1);
- if(jArray.size() == 1){
- JsonObject rec = jArray.getJsonObject(0);
- String version = rec.getString("version");
- String uuid = rec.getString("vnfResourceModelUuid");
- int maxInstance = rec.getInt("maxInstances");
-
- assertTrue(version.equals("v1"));
- assertTrue(uuid.equals("16ea3e56-a8ce-4ad7-8edd-4d2eae095391"));
- assertTrue(maxInstance == 50);
- }
- // end
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- }
-
- @Test
- public void serviceVnfsUrl_vnfUuid_Test(){
- try {
- List<VnfResourceCustomization> paramList;
- // set up mock return value
- paramList = new ArrayList<>();
- VnfResourceCustomization d1 = new VnfResourceCustomization();
- d1.setModelCustomizationUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- d1.setModelInstanceName("RG_6-26_mog11 0");
- d1.setVersion("v1");
- paramList.add(d1);
- PowerMockito.when(dbMock.getAllVnfsByVnfModelCustomizationUuid(Mockito.anyString())).thenReturn (paramList);
- // end
-
- // Run
- ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target("http://localhost:3099/v1/serviceVnfs?vnfModelCustomizationUuid=16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- Response response = target.request().get();
- String value = response.readEntity(String.class);
-
- // System.out.println(value);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
- assertTrue(jArray.size() == 1);
- if(jArray.size() == 1){
- JsonObject rec = jArray.getJsonObject(0);
- String version = rec.getString("version");
- String uuid = rec.getString("modelCustomizationUuid");
-
- assertTrue(version.equals("v1"));
- assertTrue(uuid.equals("16ea3e56-a8ce-4ad7-8edd-4d2eae095391"));
- }
- // end
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- }
-
- @Test
- public void networkResourcesUrl_nUuid_Ver_Test(){
- try {
- List<NetworkResourceCustomization> paramList;
- // set up mock return value
- paramList = new ArrayList<>();
- NetworkResourceCustomization d1 = new NetworkResourceCustomization();
- d1.setNetworkResourceModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9");
- paramList.add(d1);
- PowerMockito.when(dbMock.getAllNetworksByNetworkModelCustomizationUuid(Mockito.anyString())).thenReturn (paramList);
- // end
-
- // Run
- ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target("http://localhost:3099/v1/networkResources/0cb9b26a-9820-48a7-86e5-16c510e993d9");
- Response response = target.request().get();
- String value = response.readEntity(String.class);
-
- // System.out.println(value);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonArray jArray = respObj.getJsonArray("serviceNetworks");
- assertTrue(jArray.size() == 1);
- if(jArray.size() == 1){
- JsonObject rec = jArray.getJsonObject(0);
- String uuid = rec.getString("networkResourceModelUuid");
-
- assertTrue(uuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
- }
- // end
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- }
-
- @Test
- public void serviceNetworksUrl_nType_Test(){
- try {
- List<NetworkResourceCustomization> paramList;
- // set up mock return value
- paramList = new ArrayList<>();
- NetworkResourceCustomization d1 = new NetworkResourceCustomization();
- d1.setNetworkResourceModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9");
- paramList.add(d1);
- PowerMockito.when(dbMock.getAllNetworksByNetworkType(Mockito.anyString())).thenReturn (paramList);
- // end
-
- // Run
- ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target("http://localhost:3099/v1/serviceNetworks?networkModelName=0cb9b26a-9820-48a7-86e5-16c510e993d9");
- Response response = target.request().get();
- String value = response.readEntity(String.class);
-
- // System.out.println(value);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonArray jArray = respObj.getJsonArray("serviceNetworks");
- assertTrue(jArray.size() == 1);
- if(jArray.size() == 1){
- JsonObject rec = jArray.getJsonObject(0);
- String uuid = rec.getString("networkResourceModelUuid");
-
- assertTrue(uuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
- }
- // end
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- }
-
- @Test
- public void serviceResourcesUrl_smiUuid_Ver_Test(){
- try {
- ArrayList<NetworkResourceCustomization> paramList;
- // set up mock return value
- paramList = new ArrayList<>();
- NetworkResourceCustomization d1 = new NetworkResourceCustomization();
- d1.setNetworkResourceModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9");
- paramList.add(d1);
- ServiceMacroHolder ret = new ServiceMacroHolder();
- ret.setNetworkResourceCustomization(paramList);
- PowerMockito.when(dbMock.getAllResourcesByServiceModelInvariantUuid(Mockito.anyString(),Mockito.anyString())).thenReturn (ret);
- // end
-
- // Run
- ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target("http://localhost:3099/v1/serviceResources?serviceModelInvariantUuid=0cb9b26a-9820-48a7-86e5-16c510e993d9&serviceModelVersion=ver1");
- Response response = target.request().get();
- String value = response.readEntity(String.class);
-
- // System.out.println(value);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonObject obj = respObj.getJsonObject("serviceResources");
- JsonArray jArray = obj.getJsonArray("networkResourceCustomization");
- assertTrue(jArray.size() == 1);
-
- if(jArray.size() == 1){
- JsonObject rec = jArray.getJsonObject(0);
- String uuid = rec.getString("networkResourceModelUuid");
-
- assertTrue(uuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
- }
- // end
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- }
-
- @Test
- public void allottedResourcesUrl_aUuid_Test()
- {
- try {
- List<AllottedResourceCustomization> paramList;
- // set up mock return value
- paramList = new ArrayList<>();
- AllottedResourceCustomization d1 = new AllottedResourceCustomization();
- d1.setArModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9");
- paramList.add(d1);
- PowerMockito.when(dbMock.getAllAllottedResourcesByArModelCustomizationUuid(Mockito.anyString())).thenReturn (paramList);
- // end
-
- // Run
- ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target("http://localhost:3099/v1/allottedResources/0cb9b26a-9820-48a7-86e5-16c510e993d9");
- Response response = target.request().get();
- String value = response.readEntity(String.class);
-
- // System.out.println(value);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonArray jArray = respObj.getJsonArray("serviceAllottedResources");
- assertTrue(jArray.size() == 1);
- if(jArray.size() == 1){
- JsonObject rec = jArray.getJsonObject(0);
- String uuid = rec.getString("arModelUuid");
-
- assertTrue(uuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
- }
- // end
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
-
- }
-
- @Test
- public void serviceAllottedResourcesUrl_smiUuid_Test()
- {
- try {
- List<AllottedResourceCustomization> paramList;
- // set up mock return value
- paramList = new ArrayList<>();
- AllottedResourceCustomization d1 = new AllottedResourceCustomization();
- d1.setArModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9");
- paramList.add(d1);
- PowerMockito.when(dbMock.getAllAllottedResourcesByServiceModelInvariantUuid(Mockito.anyString(), Mockito.anyString())).thenReturn (paramList);
- // end
-
- // Run
- ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target("http://localhost:3099/v1/serviceAllottedResources?serviceModelInvariantUuid=0cb9b26a-9820-48a7-86e5-16c510e993d9&serviceModelVersion=ver1");
- Response response = target.request().get();
- String value = response.readEntity(String.class);
-
- // System.out.println(value);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonArray jArray = respObj.getJsonArray("serviceAllottedResources");
- assertTrue(jArray.size() == 1);
- if(jArray.size() == 1){
- JsonObject rec = jArray.getJsonObject(0);
- String uuid = rec.getString("arModelUuid");
-
- assertTrue(uuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
- }
- // end
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- }
-
- @Test
- public void vfModulesUrl_modelName_Test()
- {
- try {
- // set up mock return value
- VfModule vfm = new VfModule();
- vfm.setModelName("test Model");
- vfm.setModelUUID("0cb9b26a-9820-48a7-86e5-16c510e993d9");
-
- VfModuleCustomization ret = new VfModuleCustomization();
- ret.setVfModule(vfm);
- PowerMockito.when(dbMock.getVfModuleCustomizationByModelName(Mockito.anyString())).thenReturn (ret);
- // end
-
- // Run
- ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target("http://localhost:3099/v1/vfModules?vfModuleModelName=0cb9b26a-9820-48a7-86e5-16c510e993d9");
- Response response = target.request().get();
- String value = response.readEntity(String.class);
-
- // System.out.println(value);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonObject jObj = respObj.getJsonObject("modelInfo");
- String uuid = jObj.getString("modelUuid");
- String name = jObj.getString("modelName");
- assertTrue(uuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
- assertTrue(name.equals("test Model"));
- // end
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- }
-
- @AfterClass
- public static void afterClass() throws Exception {
- server.stop();
- }
-}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestTest.java
deleted file mode 100644
index 2e22e97a81..0000000000
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.mso.adapters.catalogdb;
-
-import org.junit.Test;
-
-public class CatalogDbAdapterRestTest {
-
- CatalogDbAdapterRest catalogDbAdapterRest = new CatalogDbAdapterRest();
-
- @Test(expected = NullPointerException.class)
- public void respond() throws Exception {
- catalogDbAdapterRest.respond(null, 0, true, null);
- }
-
- @Test
- public void healthcheck() throws Exception {
- catalogDbAdapterRest.healthcheck("test");
- }
-
- @Test
- public void serviceVnfs() throws Exception {
- catalogDbAdapterRest.serviceVnfs("test", "test");
- }
-
- @Test
- public void serviceVnfs1() throws Exception {
- catalogDbAdapterRest.serviceVnfs("test", "test", "test", "test", "test", "test");
- }
-
- @Test
- public void serviceVnfsImpl() throws Exception {
- catalogDbAdapterRest.serviceVnfsImpl("test", false, "test", "test", "test", "test", "test");
- }
-
- @Test
- public void serviceNetworks() throws Exception {
- catalogDbAdapterRest.serviceNetworks("test", "test");
- }
-
- @Test
- public void serviceNetworks1() throws Exception {
- catalogDbAdapterRest.serviceNetworks("test", "test", "test", "test", "test", "test", "test", "test");
- }
-
- @Test
- public void serviceNetworksImpl() throws Exception {
- catalogDbAdapterRest.serviceNetworksImpl("test", false, "test", "test", "test", "test", "test");
- }
-
- @Test
- public void serviceResources() throws Exception {
- catalogDbAdapterRest.serviceResources("test", "test", "test", "test");
- }
-
- @Test
- public void serviceAllottedResources() throws Exception {
- catalogDbAdapterRest.serviceAllottedResources("test", "test");
- }
-
- @Test
- public void serviceAllottedResources1() throws Exception {
- catalogDbAdapterRest.serviceAllottedResources("test", "test", "test", "test", "test");
- }
-
- @Test
- public void serviceAllottedResourcesImpl() throws Exception {
- catalogDbAdapterRest.serviceAllottedResourcesImpl("test", false, "test", "test", "test", "test");
- }
-
- @Test
- public void vfModules() throws Exception {
- catalogDbAdapterRest.vfModules("test");
- }
-
- @Test
- public void serviceToscaCsar() throws Exception {
- catalogDbAdapterRest.serviceToscaCsar("test");
- }
-
- @Test
- public void resourceRecipe() throws Exception {
- catalogDbAdapterRest.resourceRecipe("test", "test");
- }
-
-} \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryTest.java
deleted file mode 100644
index a4a5df7536..0000000000
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryTest.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.adapters.catalogdb.catalogrest;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.junit.Before;
-import org.junit.Test;
-
-public class CatalogQueryTest {
- private static final String MAP_KEY = "keyTest";
- private static final String VALUE_MAP = "valueTest";
- private CatalogQuery testedObject;
-
- @Before
- public void init() {
- testedObject = new CatalogQueryForTesting();
- }
-
- @Test
- public void putStringValueToMap() {
- Map<String, String> valueMap = new HashMap<>();
- testedObject.put(valueMap, MAP_KEY, VALUE_MAP);
- assertThat(valueMap).hasSize(1).containsEntry(MAP_KEY, "\"valueTest\"");
- }
-
- @Test
- public void putNullStringValueToMap() {
- Map<String, String> valueMap = new HashMap<>();
- String value = null;
- testedObject.put(valueMap, MAP_KEY, value);
- assertThat(valueMap).hasSize(1).containsEntry(MAP_KEY, "null");
- }
-
- @Test
- public void putIntegerValueToMap() {
- Map<String, String> valueMap = new HashMap<>();
- testedObject.put(valueMap, MAP_KEY, 1);
- assertThat(valueMap).hasSize(1).containsEntry(MAP_KEY, "1");
- }
-
- @Test
- public void putNullIntegerValueToMap() {
- Map<String, String> valueMap = new HashMap<>();
- Integer value = null;
- testedObject.put(valueMap, MAP_KEY, value);
- assertThat(valueMap).hasSize(1).containsEntry(MAP_KEY, "null");
- }
-
- @Test
- public void putTrueBooleanValueToMap() {
- Map<String, String> valueMap = new HashMap<>();
- testedObject.put(valueMap, MAP_KEY, true);
- assertThat(valueMap).hasSize(1).containsEntry(MAP_KEY, "true");
- }
-
- @Test
- public void putFalseBooleanValueToMap() {
- Map<String, String> valueMap = new HashMap<>();
- testedObject.put(valueMap, MAP_KEY, false);
- assertThat(valueMap).hasSize(1).containsEntry(MAP_KEY, "false");
- }
-
- @Test
- public void putNullBooleanValueToMap() {
- Map<String, String> valueMap = new HashMap<>();
- Boolean value = null;
- testedObject.put(valueMap, MAP_KEY, value);
- assertThat(valueMap).hasSize(1).containsEntry(MAP_KEY, "null");
- }
-
- @Test
- public void setTemplate_keyFindInMap() {
- Map<String, String> valueMap = new HashMap<>();
- valueMap.put(MAP_KEY, VALUE_MAP);
- String template = "<keyTest>";
- String result = testedObject.setTemplate(template, valueMap);
- assertThat(result).isEqualTo(VALUE_MAP);
- }
-
- @Test
- public void setTemplate_keyNotFindInMap() {
- Map<String, String> valueMap = new HashMap<>();
- String template = "<keyTest>";
- String result = testedObject.setTemplate(template, valueMap);
- assertThat(result).isEqualTo("\"TBD\"");
- }
-
- @Test
- public void setTemplate_templateDoesNotMatch() {
- Map<String, String> valueMap = new HashMap<>();
- String template = "key";
- String result = testedObject.setTemplate(template, valueMap);
- assertThat(result).isEqualTo("key");
- }
-
- @Test
- public void smartToJson(){
- String expectedResult = "{\"s\":\"s1\"}";
- assertThat(testedObject.smartToJSON()).isEqualTo(expectedResult);
- }
-
- @Test
- public void toJsonString_withVersion1() {
- String expectedResult = "{\"s\":\"s1\"}";
- assertThat(testedObject.toJsonString("v1",true)).isEqualTo(expectedResult);
- }
-
- @Test
- public void toJsonString_withVersion2() {
- assertThat(testedObject.toJsonString("v2",true)).isEqualTo("json2");
- }
-
- @Test
- public void toJsonString_withInvalidVersion() {
- assertThat(testedObject.toJsonString("ver77",true)).isEqualTo("invalid version: ver77");
- }
-
- private class CatalogQueryForTesting extends CatalogQuery {
-
- private String s = "s1";
-
- public String getS() {
- return s;
- }
-
- @Override
- public String JSON2(boolean isArray, boolean isEmbed) {
- return "json2";
- }
- }
-
-}
-
-
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomizationTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomizationTest.java
deleted file mode 100644
index 0d86a6cf10..0000000000
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomizationTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.adapters.catalogdb.catalogrest;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.json.Json;
-import javax.json.JsonArray;
-import javax.json.JsonObject;
-import javax.json.JsonReader;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
-
-@RunWith(MockitoJUnitRunner.class)
-public class QueryAllottedResourceCustomizationTest {
-
- @Test
- public void JSON2_Test()
- {
- List<AllottedResourceCustomization> paramList;
- paramList = new ArrayList<>();
- AllottedResourceCustomization d1 = new AllottedResourceCustomization();
- d1.setModelInstanceName("0cb9b26a-9820-48a7-86e5-16c510e993d9");
- d1.setModelCustomizationUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- paramList.add(d1);
-
- QueryAllottedResourceCustomization qarcObj = new QueryAllottedResourceCustomization(paramList);
- String ret = qarcObj.JSON2(true, true);
- System.out.println(ret);
- ret = "{" + ret + "}";
-
- JsonReader reader = Json.createReader(new StringReader(ret.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonArray jArray = respObj.getJsonArray("serviceAllottedResources");
- assertEquals(jArray.size(), 1);
-
- assertEquals(jArray.getJsonObject(0).getJsonObject("modelInfo").getString("modelInstanceName"), "0cb9b26a-9820-48a7-86e5-16c510e993d9");
- assertEquals(jArray.getJsonObject(0).getJsonObject("modelInfo").getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- }
-
-}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMarcoHolderTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMarcoHolderTest.java
deleted file mode 100644
index 3a767a8609..0000000000
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMarcoHolderTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.adapters.catalogdb.catalogrest;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.StringReader;
-import java.util.ArrayList;
-
-import javax.json.Json;
-import javax.json.JsonArray;
-import javax.json.JsonObject;
-import javax.json.JsonReader;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.Service;
-import org.openecomp.mso.db.catalog.beans.ServiceMacroHolder;
-
-@RunWith(MockitoJUnitRunner.class)
-public class QueryServiceMarcoHolderTest {
-
- @Test
- public void JSON2_Test()
- {
- Service svc = new Service();
- svc.setModelUUID("0cb9b26a-9820-48a7-86e5-16c510e993d9");
- svc.setModelName("Testing Model One");
- ArrayList<NetworkResourceCustomization> paramList;
- paramList = new ArrayList<>();
- NetworkResourceCustomization d1 = new NetworkResourceCustomization();
- d1.setNetworkResourceModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9");
- paramList.add(d1);
- ServiceMacroHolder ret = new ServiceMacroHolder(svc);
- ret.setNetworkResourceCustomization(paramList);
- QueryServiceMacroHolder holder = new QueryServiceMacroHolder(ret);
- String s = holder.JSON2(true, true);
-
- // System.out.println(s);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonObject obj = respObj.getJsonObject("serviceResources");
- JsonObject obj2 = obj.getJsonObject("modelInfo");
- String modelName = obj2.getString("modelName");
- String modelUuid = obj2.getString("modelUuid");
-
- assertTrue(modelName.equals("Testing Model One"));
- assertTrue(modelUuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
- // end
- }
-}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworksTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworksTest.java
deleted file mode 100644
index 1c855eaa72..0000000000
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworksTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.adapters.catalogdb.catalogrest;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.StringReader;
-import java.util.ArrayList;
-
-import javax.json.Json;
-import javax.json.JsonArray;
-import javax.json.JsonObject;
-import javax.json.JsonReader;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.Service;
-import org.openecomp.mso.db.catalog.beans.ServiceMacroHolder;
-
-@RunWith(MockitoJUnitRunner.class)
-public class QueryServiceNetworksTest {
-
-
- @Test
- public void JSON2_Test()
- {
- ArrayList<NetworkResourceCustomization> paramList;
- paramList = new ArrayList<>();
- NetworkResourceCustomization d1 = new NetworkResourceCustomization();
- d1.setModelInstanceName("0cb9b26a-9820-48a7-86e5-16c510e993d9");
- paramList.add(d1);
- QueryServiceNetworks qsn = new QueryServiceNetworks(paramList);
-
- String s = qsn.JSON2(true, true);
- s = "{" + s + "}";
- System.out.println(s);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonArray objArr = respObj.getJsonArray("serviceNetworks");
-
- assertTrue(objArr.size() == 1);
-
- JsonObject obj2 = objArr.getJsonObject(0).getJsonObject("modelInfo");
- String modelName = obj2.getString("modelInstanceName");
-
- assertTrue(modelName.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
- // end
- }
-}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfsTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfsTest.java
deleted file mode 100644
index 8c8fc967da..0000000000
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfsTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.adapters.catalogdb.catalogrest;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.json.Json;
-import javax.json.JsonArray;
-import javax.json.JsonObject;
-import javax.json.JsonReader;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
-
-@RunWith(MockitoJUnitRunner.class)
-public class QueryServiceVnfsTest {
-
- @Test
- public void JSON2_Test()
- {
- List<VnfResourceCustomization> paramList;
- paramList = new ArrayList<>();
- VnfResourceCustomization d1 = new VnfResourceCustomization();
- d1.setModelInstanceName("0cb9b26a-9820-48a7-86e5-16c510e993d9");
- d1.setVnfResourceModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9");
- paramList.add(d1);
- QueryServiceVnfs qsn = new QueryServiceVnfs(paramList);
-
- String s = qsn.JSON2(true, true);
- s = "{" + s + "}";
- System.out.println(s);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonArray objArr = respObj.getJsonArray("serviceVnfs");
-
- assertTrue(objArr.size() == 1);
-
- JsonObject obj2 = objArr.getJsonObject(0).getJsonObject("modelInfo");
- String modelName = obj2.getString("modelInstanceName");
-
- assertTrue(modelName.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
- // end
-
- }
-}