diff options
23 files changed, 1905 insertions, 22 deletions
diff --git a/adapters/mso-adapter-utils/pom.xml b/adapters/mso-adapter-utils/pom.xml index 62e7153473..90d1bbd680 100644 --- a/adapters/mso-adapter-utils/pom.xml +++ b/adapters/mso-adapter-utils/pom.xml @@ -105,6 +105,18 @@ <version>1.10.19</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.jmockit</groupId> + <artifactId>jmockit</artifactId> + <version>1.8</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> <dependency> <groupId>org.jboss.spec.javax.ejb</groupId> diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java index 22a2c636e7..cd96756644 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java @@ -24,9 +24,7 @@ import java.util.HashMap; import org.junit.BeforeClass; import org.junit.Test; - import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.openstack.exceptions.MsoAdapterException; import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound; import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound; import org.openecomp.mso.openstack.exceptions.MsoException; @@ -37,7 +35,7 @@ import org.openecomp.mso.openstack.utils.MsoCommonUtils; import org.openecomp.mso.openstack.utils.MsoHeatUtils; import org.openecomp.mso.properties.MsoPropertiesFactory; - +import com.woorea.openstack.heat.model.CreateStackParam; /** * This class implements test methods of the MsoHeatUtils @@ -54,25 +52,41 @@ public class MsoHeatUtilsTest extends MsoCommonUtils { ClassLoader classLoader = CloudConfigTest.class.getClassLoader(); String config = classLoader.getResource("cloud_config.json").toString().substring(5); cloudConfigFactory.initializeCloudConfig(config, 1); - msoHeatUtils = new MsoHeatUtils("NO_PROP",msoPropertiesFactory,cloudConfigFactory); + msoHeatUtils = new MsoHeatUtils("NO_PROP", msoPropertiesFactory, cloudConfigFactory); } @Test - public final void testCreateStackBadCloudConfig () throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { + public final void testCreateStackBadCloudConfig() + throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { try { - msoHeatUtils.createStack ("DOESNOTEXIST", "test", "stackName", "test", new HashMap<String,Object> (), Boolean.TRUE, 10); + msoHeatUtils.createStack("DOESNOTEXIST", "test", "stackName", "test", new HashMap<String, Object>(), + Boolean.TRUE, 10); } catch (MsoCloudSiteNotFound e) { } catch (java.lang.NullPointerException npe) { - + + } + + } + + @Test + public final void testCreateStackFailedConnectionHeatClient() + throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { + try { + msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<String, Object>(), Boolean.TRUE, + 10); + } catch (MsoIOException e) { + } } @Test - public final void testCreateStackFailedConnectionHeatClient () throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { + public final void testCreateStackFailedConnection() + throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { try { - msoHeatUtils.createStack ("MT", "test", "stackName", "test", new HashMap<String,Object> (), Boolean.TRUE, 10); + msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<String, Object>(), Boolean.TRUE, + 10); } catch (MsoIOException e) { } @@ -80,15 +94,64 @@ public class MsoHeatUtilsTest extends MsoCommonUtils { } @Test - public final void testCreateStackFailedConnection () throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { + public final void createStackSuccessWithEnvironment() throws MsoException { try { - msoHeatUtils.createStack ("MT", "test", "stackName", "test", new HashMap<String,Object> (), Boolean.TRUE, 10); + msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<String, Object>(), Boolean.TRUE, 10, + "environment"); } catch (MsoIOException e) { } } + @Test + public final void createStackSuccessWithFiles() throws MsoException { + try { + msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<String, Object>(), Boolean.TRUE, 10, + "environment", new HashMap<String, Object>()); + } catch (MsoIOException e) { + } + + } + @Test + public final void createStackSuccessWithHeatFiles() throws MsoException { + try { + msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<String, Object>(), Boolean.TRUE, 10, + "environment", new HashMap<String, Object>(), new HashMap<String, Object>()); + } catch (MsoIOException e) { + + } + } + + @Test + public final void requestToStringBuilderTest() { + CreateStackParam param = new CreateStackParam(); + param.setDisableRollback(false); + param.setEnvironment("environment"); + param.setFiles(new HashMap<String, Object>()); + param.setParameters(new HashMap<>()); + param.setStackName("stackName"); + param.setTemplate("template"); + param.setTemplateUrl("http://templateUrl"); + param.setTimeoutMinutes(1); + + msoHeatUtils.requestToStringBuilder(param); + } + + @Test + public final void heatCacheResetTest() { + msoHeatUtils.heatCacheReset(); + } + + @Test + public final void expireHeatClientTest() { + msoHeatUtils.expireHeatClient("tenantId", "cloudId"); + } + + @Test + public final void heatCacheCleanupTest() { + msoHeatUtils.heatCacheCleanup(); + } } diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java index 684933f3a9..52286fd3ac 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java @@ -82,6 +82,7 @@ public class VfcAdapterRest { RestfulResponse rsp = driverMgr.createNs(nsInput); return buildResponse(rsp); } catch(ApplicationException e) { + LOGGER.debug("ApplicationException: ", e); return e.buildErrorResponse(); } } @@ -107,6 +108,7 @@ public class VfcAdapterRest { RestfulResponse rsp = driverMgr.deleteNs(nsOperationKey, nsInstanceId); return buildResponse(rsp); } catch(ApplicationException e) { + LOGGER.debug("ApplicationException: ", e); return e.buildErrorResponse(); } } @@ -135,6 +137,7 @@ public class VfcAdapterRest { RestfulResponse rsp = driverMgr.getNsProgress(nsOperationKey, jobId); return buildResponse(rsp); } catch(ApplicationException e) { + LOGGER.debug("ApplicationException: ", e); return e.buildErrorResponse(); } } @@ -161,6 +164,7 @@ public class VfcAdapterRest { RestfulResponse rsp = driverMgr.instantiateNs(nsInstanceId, nsInput); return buildResponse(rsp); } catch(ApplicationException e) { + LOGGER.debug("ApplicationException: ", e); return e.buildErrorResponse(); } } @@ -188,6 +192,7 @@ public class VfcAdapterRest { RestfulResponse rsp = driverMgr.terminateNs(nsOperationKey, nsInstanceId); return buildResponse(rsp); } catch(ApplicationException e) { + LOGGER.debug("ApplicationException: ", e); return e.buildErrorResponse(); } } diff --git a/adapters/mso-vnf-adapter/pom.xml b/adapters/mso-vnf-adapter/pom.xml index ba0c87ab5e..9c5d74cb81 100644 --- a/adapters/mso-vnf-adapter/pom.xml +++ b/adapters/mso-vnf-adapter/pom.xml @@ -30,7 +30,7 @@ <version>2.3</version>
<executions>
<execution>
- <id>Synch</id>
+ <id>Synch</id>
<goals>
<goal>wsgen</goal>
</goals>
@@ -42,7 +42,7 @@ </configuration>
</execution>
<execution>
- <id>Asynch</id>
+ <id>Asynch</id>
<goals>
<goal>wsgen</goal>
</goals>
@@ -70,7 +70,7 @@ </plugins>
<pluginManagement>
<plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings
+ <!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
@@ -144,7 +144,18 @@ <artifactId>status-control</artifactId>
<version>${project.version}</version>
</dependency>
-
+ <dependency>
+ <groupId>org.jmockit</groupId>
+ <artifactId>jmockit</artifactId>
+ <version>1.8</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
<!-- <dependency> -->
<!-- <groupId>org.openecomp.so</groupId> -->
<!-- <artifactId>mso-catalog-db</artifactId> -->
diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterAsyncImplTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterAsyncImplTest.java new file mode 100644 index 0000000000..b680170abe --- /dev/null +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterAsyncImplTest.java @@ -0,0 +1,131 @@ +/*-
+ * ============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.vnf.test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.openecomp.mso.adapters.vnf.MsoVnfAdapterAsyncImpl;
+import org.openecomp.mso.entity.MsoRequest;
+import org.openecomp.mso.openstack.beans.HeatStatus;
+import org.openecomp.mso.openstack.beans.StackInfo;
+import org.openecomp.mso.openstack.beans.VnfRollback;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+import org.openecomp.mso.openstack.utils.MsoHeatUtils;
+
+import mockit.Mock;
+import mockit.MockUp;
+
+public class MsoVnfAdapterAsyncImplTest {
+
+ @Test
+ public void healthCheckVNFTest() {
+ MsoVnfAdapterAsyncImpl instance = new MsoVnfAdapterAsyncImpl();
+ instance.healthCheckA();
+ }
+
+ @Test
+ public void createVNFTest() {
+ new MockUp<MsoHeatUtils>() {
+ @Mock
+ public StackInfo queryStack(String cloudSiteId, String tenantId, String stackName) throws MsoException {
+ StackInfo info = new StackInfo();
+ info.setStatus(HeatStatus.CREATED);
+ return info;
+ }
+ };
+
+ MsoVnfAdapterAsyncImpl instance = new MsoVnfAdapterAsyncImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+ try {
+
+ instance.createVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
+ "volumeGroupHeatStackId|1", new HashMap<String, String>(), Boolean.FALSE, Boolean.TRUE, "messageId",
+ null, "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest");
+ } catch (Exception e) {
+
+ }
+ }
+
+ @Test
+ public void updateVnfTest() {
+ MsoVnfAdapterAsyncImpl instance = new MsoVnfAdapterAsyncImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ try {
+ instance.updateVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
+ "volumeGroupHeatStackId|1", map, "messageId", msoRequest,
+ "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest");
+ } catch (Exception e) {
+
+ }
+ }
+
+ @Test
+ public void queryVnfTest() {
+ MsoVnfAdapterAsyncImpl instance = new MsoVnfAdapterAsyncImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+ try {
+ instance.queryVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest,
+ "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest");
+ } catch (Exception e) {
+
+ }
+ }
+
+ @Test
+ public void deleteVnfTest() {
+ MsoVnfAdapterAsyncImpl instance = new MsoVnfAdapterAsyncImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+ try {
+ instance.deleteVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest,
+ "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest");
+ } catch (Exception e) {
+
+ }
+ }
+
+ @Test
+ public void rollbackVnfTest() {
+ MsoVnfAdapterAsyncImpl instance = new MsoVnfAdapterAsyncImpl();
+ VnfRollback vnfRollBack = new VnfRollback();
+ vnfRollBack.setCloudSiteId("mdt1");
+ vnfRollBack.setTenantId("88a6ca3ee0394ade9403f075db23167e");
+ vnfRollBack.setVnfId("ff5256d1-5a33-55df-13ab-12abad84e7ff");
+ try {
+ instance.rollbackVnfA(vnfRollBack, "messageId",
+ "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest");
+ } catch (Exception e) {
+
+ }
+ }
+}
diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterImplTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterImplTest.java new file mode 100644 index 0000000000..77879089e9 --- /dev/null +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterImplTest.java @@ -0,0 +1,156 @@ +/*-
+ * ============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.vnf.test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.ws.Holder;
+
+import org.junit.Test;
+import org.openecomp.mso.adapters.vnf.MsoVnfAdapterImpl;
+import org.openecomp.mso.db.catalog.CatalogDatabase;
+import org.openecomp.mso.db.catalog.beans.VfModule;
+import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;
+import org.openecomp.mso.db.catalog.beans.VnfResource;
+import org.openecomp.mso.entity.MsoRequest;
+import org.openecomp.mso.openstack.beans.HeatStatus;
+import org.openecomp.mso.openstack.beans.StackInfo;
+import org.openecomp.mso.openstack.beans.VnfRollback;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+import org.openecomp.mso.openstack.utils.MsoHeatUtils;
+
+import mockit.Mock;
+import mockit.MockUp;
+
+public class MsoVnfAdapterImplTest {
+
+ @Test
+ public void healthCheckVNFTest() {
+ MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl();
+ instance.healthCheck();
+ }
+
+ @Test
+ public void createVnfTest() {
+
+ new MockUp<MsoHeatUtils>() {
+ @Mock
+ public StackInfo queryStack(String cloudSiteId, String tenantId, String stackName) throws MsoException {
+ StackInfo info = new StackInfo();
+ info.setStatus(HeatStatus.CREATED);
+ return info;
+ }
+ };
+
+ MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ try {
+ instance.createVfModule("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
+ "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
+ Boolean.FALSE, Boolean.TRUE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ } catch (Exception e) {
+
+ }
+ }
+
+ @Test
+ public void updateVnfTest() {
+
+ new MockUp<MsoHeatUtils>() {
+ @Mock
+ public StackInfo queryStack(String cloudSiteId, String tenantId, String stackName) throws MsoException {
+ StackInfo info = new StackInfo();
+ info.setStatus(HeatStatus.CREATED);
+ return info;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public VfModuleCustomization getVfModuleCustomizationByModelCustomizationId(String modelCustomizationUuid) {
+ VfModuleCustomization vfcModule = new VfModuleCustomization();
+ VfModule vfm = new VfModule();
+ vfm.setVnfResourceModelUUId("88a6ca3ee0394ade9403f075db23167e");
+ vfcModule.setVfModule(vfm);
+ return vfcModule;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public VnfResource getVnfResourceByModelUuid(String modelUuid) {
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setAicVersionMin("1");
+ vnfResource.setAicVersionMax("2");
+ return vnfResource;
+ }
+ };
+
+ MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ try {
+ instance.updateVfModule("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
+ "volumeGroupHeatStackId|1", "baseVfHeatStackId", "vfModuleStackId",
+ "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ } catch (Exception e) {
+
+ }
+ }
+
+ @Test
+ public void deleteVnfTest() {
+ new MockUp<MsoHeatUtils>() {
+ @Mock
+ public Map<String, Object> queryStackForOutputs(String cloudSiteId, String tenantId, String stackName)
+ throws MsoException {
+
+ Map<String, Object> outputs = new HashMap<>();
+ outputs.put("Key1", "value1");
+ return outputs;
+ }
+ };
+
+ MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+ try {
+ instance.deleteVfModule("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest,
+ new Holder<Map<String, String>>());
+ } catch (Exception e) {
+
+ }
+ }
+
+}
diff --git a/doc/ONAP SO Debug Env Setup.docx b/doc/ONAP SO Debug Env Setup.docx Binary files differdeleted file mode 100644 index 6d96c0dea1..0000000000 --- a/doc/ONAP SO Debug Env Setup.docx +++ /dev/null diff --git a/docs/ONAP_SO_Env_Setup_Guide.pdf b/docs/ONAP_SO_Env_Setup_Guide.pdf Binary files differnew file mode 100644 index 0000000000..44b8d9cad6 --- /dev/null +++ b/docs/ONAP_SO_Env_Setup_Guide.pdf diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000000..3ef709c232 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,12 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2017 Huawei Technologies Co., Ltd.
+
+ONAP Service Orchestration Documentation
+========================================
+
+.. toctree::
+ :maxdepth: 1
+
+
+ ONAP SO Env Setup.pdf
\ No newline at end of file diff --git a/mso-catalog-db/src/main/resources/VnfResourceCustomization.hbm.xml b/mso-catalog-db/src/main/resources/VnfResourceCustomization.hbm.xml index b068e66e1e..72e7209d53 100644 --- a/mso-catalog-db/src/main/resources/VnfResourceCustomization.hbm.xml +++ b/mso-catalog-db/src/main/resources/VnfResourceCustomization.hbm.xml @@ -41,8 +41,8 @@ <property name="created" type="timestamp" generated="insert" update="false" insert="false" column="CREATION_TIMESTAMP" not-null="true"/>
<set name="vfModuleCustomizations" inverse="true" cascade="all">
- <key column="VNF_RESOURCE_MODEL_UUID" not-null="true" />
- <one-to-many class="VnfResCustomToVfModuleCustom" />
- </set>
+ <key column="VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID" not-null="true" />
+ <one-to-many class="VnfResCustomToVfModuleCustom" />
+ </set>
</class>
</hibernate-mapping>
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java new file mode 100644 index 0000000000..a00079d8a9 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java @@ -0,0 +1,757 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.db.catalog.test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.mso.db.catalog.CatalogDatabase;
+import org.openecomp.mso.db.catalog.beans.AllottedResource;
+import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
+import org.openecomp.mso.db.catalog.beans.HeatEnvironment;
+import org.openecomp.mso.db.catalog.beans.HeatFiles;
+import org.openecomp.mso.db.catalog.beans.HeatTemplate;
+import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
+import org.openecomp.mso.db.catalog.beans.NetworkResource;
+import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization;
+import org.openecomp.mso.db.catalog.beans.Service;
+import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
+import org.openecomp.mso.db.catalog.beans.ServiceToResourceCustomization;
+import org.openecomp.mso.db.catalog.beans.TempNetworkHeatTemplateLookup;
+import org.openecomp.mso.db.catalog.beans.ToscaCsar;
+import org.openecomp.mso.db.catalog.beans.VfModule;
+import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;
+import org.openecomp.mso.db.catalog.beans.VfModuleToHeatFiles;
+import org.openecomp.mso.db.catalog.beans.VnfComponent;
+import org.openecomp.mso.db.catalog.beans.VnfComponentsRecipe;
+import org.openecomp.mso.db.catalog.beans.VnfRecipe;
+import org.openecomp.mso.db.catalog.beans.VnfResource;
+import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
+import org.openecomp.mso.db.catalog.utils.RecordNotFoundException;
+
+public class CatalogDatabaseTest {
+
+ CatalogDatabase cd = null;
+
+ @Before
+ public void setup(){
+ cd = CatalogDatabase.getInstance();
+ }
+ @Test(expected = Exception.class)
+ public void getAllHeatTemplatesTestException(){
+ List <HeatTemplate> list = cd.getAllHeatTemplates();
+ }
+
+ @Test(expected = Exception.class)
+ public void getHeatTemplateTestException(){
+ HeatTemplate ht = cd.getHeatTemplate(10);
+ }
+
+ @Test(expected = Exception.class)
+ public void getHeatTemplateTest2Exception(){
+ HeatTemplate ht = cd.getHeatTemplate("heat123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getHeatTemplateTest3Exception(){
+ HeatTemplate ht = cd.getHeatTemplate("heat123","v2");
+ }
+
+ @Test(expected = Exception.class)
+ public void getHeatTemplateByArtifactUuidException(){
+ HeatTemplate ht = cd.getHeatTemplateByArtifactUuid("123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getHeatTemplateByArtifactUuidRegularQueryException(){
+ HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getParametersForHeatTemplateTestException(){
+ List<HeatTemplateParam> ht = cd.getParametersForHeatTemplate("123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getHeatEnvironmentByArtifactUuidTestException(){
+ HeatEnvironment ht = cd.getHeatEnvironmentByArtifactUuid("123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getServiceByInvariantUUIDTestException(){
+ Service ht = cd.getServiceByInvariantUUID("123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getServiceTestException(){
+ Service ht = cd.getService("123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getServiceByModelUUIDTestException(){
+ Service ht = cd.getServiceByModelUUID("123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getService2TestException(){
+ HashMap<String, String> map = new HashMap<>();
+ map.put("serviceNameVersionId", "v2");
+ Service ht = cd.getService(map, "123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getServiceByModelNameTestException(){
+ Service ht = cd.getServiceByModelName("123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getServiceByVersionAndInvariantIdTestException() throws Exception{
+ Service ht = cd.getServiceByVersionAndInvariantId("123","tetwe");
+ }
+
+ @Test(expected = Exception.class)
+ public void getServiceRecipeTestException() throws Exception{
+ ServiceRecipe ht = cd.getServiceRecipe("123","tetwe");
+ }
+
+ @Test(expected = Exception.class)
+ public void getServiceRecipeByServiceModelUuidTestException() throws Exception{
+ ServiceRecipe ht = cd.getServiceRecipeByServiceModelUuid("123","tetwe");
+ }
+
+ @Test(expected = Exception.class)
+ public void getServiceRecipesTestException() throws Exception{
+ List<ServiceRecipe> ht = cd.getServiceRecipes("123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfComponentTestException() throws Exception{
+ VnfComponent ht = cd.getVnfComponent(123,"vnf");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfResourceTestException() throws Exception{
+ VnfResource ht = cd.getVnfResource("vnf");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfResource2TestException() throws Exception{
+ VnfResource ht = cd.getVnfResource("vnf","3992");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfResourceByModelCustomizationIdTestException() throws Exception{
+ VnfResource ht = cd.getVnfResourceByModelCustomizationId("3992");
+ }
+
+ @Test(expected = Exception.class)
+ public void getServiceRecipeTest2Exception() throws Exception{
+ ServiceRecipe ht = cd.getServiceRecipe(1001,"3992");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfResourceCustomizationByModelCustomizationNameTestException(){
+ VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationName("test", "test234");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfResourceByModelInvariantIdTestException(){
+ VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfResourceByIdTestException(){
+ VnfResource vnf = cd.getVnfResourceById(19299);
+ }
+
+ @Test(expected = Exception.class)
+ public void getVfModuleModelNameTestException(){
+ VfModule vnf = cd.getVfModuleModelName("tetes");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVfModuleModelName2TestException(){
+ VfModule vnf = cd.getVfModuleModelName("tetes","4kidsl");
+ }
+
+ @Test(expected = Exception.class)
+ public void ggetVfModuleCustomizationByModelNameTestException(){
+ VfModuleCustomization vnf = cd.getVfModuleCustomizationByModelName("tetes");
+ }
+
+ @Test(expected = Exception.class)
+ public void getNetworkResourceTestException(){
+ NetworkResource vnf = cd.getNetworkResource("tetes");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfRecipeTestException(){
+ VnfRecipe vnf = cd.getVnfRecipe("tetes","ergfedrf","4993493");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfRecipe2TestException(){
+ VnfRecipe vnf = cd.getVnfRecipe("tetes","4993493");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfRecipeByVfModuleIdTestException(){
+ VnfRecipe vnf = cd.getVnfRecipeByVfModuleId("tetes","4993493","vnf");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVfModuleTypeTestException(){
+ VfModule vnf = cd.getVfModuleType("4993493");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVfModuleType2TestException(){
+ VfModule vnf = cd.getVfModuleType("4993493","vnf");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResourceByServiceUuidTestException(){
+ VnfResource vnf = cd.getVnfResourceByServiceUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResourceByVnfUuidTestException(){
+ VnfResource vnf = cd.getVnfResourceByVnfUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleByModelInvariantUuidTestException(){
+ VfModule vnf = cd.getVfModuleByModelInvariantUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleByModelCustomizationUuidTestException(){
+ VfModuleCustomization vnf = cd.getVfModuleByModelCustomizationUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleByModelInvariantUuidAndModelVersionTestException(){
+ VfModule vnf = cd.getVfModuleByModelInvariantUuidAndModelVersion("4993493","vnf");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleCustomizationByModelCustomizationIdTestException(){
+ VfModuleCustomization vnf = cd.getVfModuleCustomizationByModelCustomizationId("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleByModelUuidTestException(){
+ VfModule vnf = cd.getVfModuleByModelUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResourceCustomizationByModelCustomizationUuidTestException(){
+ VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResourceCustomizationByModelVersionIdTestException(){
+ VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelVersionId("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleByModelCustomizationIdAndVersionTestException(){
+ cd.getVfModuleByModelCustomizationIdAndVersion("4993493","test");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleByModelCustomizationIdModelVersionAndModelInvariantIdTestException(){
+ cd.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId("4993493","vnf","test");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResourceCustomizationByModelInvariantIdTest(){
+ cd.getVnfResourceCustomizationByModelInvariantId("4993493","vnf","test");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleCustomizationByVnfModuleCustomizationUuidTest(){
+ cd.getVfModuleCustomizationByVnfModuleCustomizationUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionIdTest(){
+ cd.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId("4993493","test");
+ }
+ @Test(expected = Exception.class)
+ public void getAllVfModuleCustomizationstest(){
+ cd.getAllVfModuleCustomizations("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResourceByModelUuidTest(){
+ cd.getVnfResourceByModelUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResCustomToVfModuleTest(){
+ cd.getVnfResCustomToVfModule("4993493","test");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModulesForVnfResourceTest(){
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setModelUuid("48839");
+ cd.getVfModulesForVnfResource(vnfResource);
+ }
+ @Test(expected = Exception.class)
+ public void getVfModulesForVnfResource2Test(){
+ cd.getVfModulesForVnfResource("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getServiceByUuidTest(){
+ cd.getServiceByUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getNetworkResourceById2Test(){
+ cd.getNetworkResourceById(4993493);
+ }
+ @Test(expected = Exception.class)
+ public void getNetworkResourceByIdTest(){
+ cd.getVfModuleTypeByUuid("4993493");
+ }
+ @Test
+ public void isEmptyOrNullTest(){
+ boolean is = cd.isEmptyOrNull("4993493");
+ assertFalse(is);
+ }
+ @Test(expected = Exception.class)
+ public void getSTRTest(){
+ cd.getSTR("4993493","test","vnf");
+ }
+ @Test(expected = Exception.class)
+ public void getVRCtoVFMCTest(){
+ cd.getVRCtoVFMC("4993493","388492");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleTypeByUuidTestException(){
+ cd.getVfModuleTypeByUuid("4993493");
+ }
+
+ @Test(expected = Exception.class)
+ public void getTempNetworkHeatTemplateLookupTest(){
+ cd.getTempNetworkHeatTemplateLookup("4993493");
+ }
+
+ @Test(expected = Exception.class)
+ public void getAllNetworksByServiceModelUuidTest(){
+ cd.getAllNetworksByServiceModelUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllNetworksByServiceModelInvariantUuidTest(){
+ cd.getAllNetworksByServiceModelInvariantUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllNetworksByServiceModelInvariantUuid2Test(){
+ cd.getAllNetworksByServiceModelInvariantUuid("4993493","test");
+ }
+ @Test(expected = Exception.class)
+ public void getAllNetworksByNetworkModelCustomizationUuidTest(){
+ cd.getAllNetworksByNetworkModelCustomizationUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllNetworksByNetworkTypeTest(){
+ cd.getAllNetworksByNetworkType("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllVfmcForVrcTest(){
+ VnfResourceCustomization re = new VnfResourceCustomization();
+ re.setModelCustomizationUuid("377483");
+ cd.getAllVfmcForVrc(re);
+ }
+ @Test(expected = Exception.class)
+ public void getAllVnfsByServiceModelUuidTest(){
+ cd.getAllVnfsByServiceModelUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllVnfsByServiceModelInvariantUuidTest(){
+ cd.getAllVnfsByServiceModelInvariantUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllVnfsByServiceModelInvariantUuid2Test(){
+ cd.getAllVnfsByServiceModelInvariantUuid("4993493","test");
+ }
+ @Test(expected = Exception.class)
+ public void getAllVnfsByServiceNameTest(){
+ cd.getAllVnfsByServiceName("4993493","test");
+ }
+ @Test(expected = Exception.class)
+ public void getAllVnfsByServiceName2Test(){
+ cd.getAllVnfsByServiceName("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllVnfsByVnfModelCustomizationUuidTest(){
+ cd.getAllVnfsByVnfModelCustomizationUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllAllottedResourcesByServiceModelUuidTest(){
+ cd.getAllAllottedResourcesByServiceModelUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllAllottedResourcesByServiceModelInvariantUuidTest(){
+ cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllAllottedResourcesByServiceModelInvariantUuid2Test(){
+ cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493","test");
+ }
+ @Test(expected = Exception.class)
+ public void getAllAllottedResourcesByArModelCustomizationUuidTest(){
+ cd.getAllAllottedResourcesByArModelCustomizationUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllottedResourceByModelUuidTest(){
+ cd.getAllottedResourceByModelUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllResourcesByServiceModelUuidTest(){
+ cd.getAllResourcesByServiceModelUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllResourcesByServiceModelInvariantUuidTest(){
+ cd.getAllResourcesByServiceModelInvariantUuid("4993493");
+ }
+
+ @Test(expected = Exception.class)
+ public void getAllResourcesByServiceModelInvariantUuid2Test(){
+ cd.getAllResourcesByServiceModelInvariantUuid("4993493","test");
+ }
+ @Test(expected = Exception.class)
+ public void getSingleNetworkByModelCustomizationUuidTest(){
+ cd.getSingleNetworkByModelCustomizationUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getSingleAllottedResourceByModelCustomizationUuidTest(){
+ cd.getSingleAllottedResourceByModelCustomizationUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleRecipeTest(){
+ cd.getVfModuleRecipe("4993493","test","get");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleTest(){
+ cd.getVfModule("4993493","test","get","v2","vnf");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfComponentsRecipeTest(){
+ cd.getVnfComponentsRecipe("4993493","test","v2","vnf","get","3992");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfComponentsRecipeByVfModuleTest(){
+ List <VfModule> resultList = new ArrayList<>();
+ VfModule m = new VfModule();
+ resultList.add(m);
+ cd.getVnfComponentsRecipeByVfModule(resultList,"4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllVnfResourcesTest(){
+ cd.getAllVnfResources();
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResourcesByRoleTest(){
+ cd.getVnfResourcesByRole("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResourceCustomizationsByRoleTest(){
+ cd.getVnfResourceCustomizationsByRole("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllNetworkResourcesTest(){
+ cd.getAllNetworkResources();
+ }
+ @Test(expected = Exception.class)
+ public void getAllNetworkResourceCustomizationsTest(){
+ cd.getAllNetworkResourceCustomizations();
+ }
+ @Test(expected = Exception.class)
+ public void getAllVfModulesTest(){
+ cd.getAllVfModules();
+ }
+ @Test(expected = Exception.class)
+ public void getAllVfModuleCustomizationsTest(){
+ cd.getAllVfModuleCustomizations();
+ }
+ @Test(expected = Exception.class)
+ public void getAllHeatEnvironmentTest(){
+ cd.getAllHeatEnvironment();
+ }
+ @Test(expected = Exception.class)
+ public void getHeatEnvironment2Test(){
+ cd.getHeatEnvironment(4993493);
+ }
+ @Test(expected = Exception.class)
+ public void getNestedTemplatesTest(){
+ cd.getNestedTemplates(4993493);
+ }
+ @Test(expected = Exception.class)
+ public void getNestedTemplates2Test(){
+ cd.getNestedTemplates("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getHeatFilesTest(){
+ cd.getHeatFiles(4993493);
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleToHeatFilesEntryTest(){
+ cd.getVfModuleToHeatFilesEntry("4993493","49959499");
+ }
+ @Test(expected = Exception.class)
+ public void getServiceToResourceCustomization(){
+ cd.getServiceToResourceCustomization("4993493","599349","49900");
+ }
+ @Test(expected = Exception.class)
+ public void getHeatFilesForVfModuleTest(){
+ cd.getHeatFilesForVfModule("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getHeatTemplateTest(){
+ cd.getHeatTemplate("4993493","test","heat");
+ }
+
+ @Test(expected = Exception.class)
+ public void saveHeatTemplateTest(){
+ HeatTemplate heat = new HeatTemplate();
+ Set <HeatTemplateParam> paramSet = new HashSet<HeatTemplateParam>();
+ cd.saveHeatTemplate(heat,paramSet);
+ }
+ @Test(expected = Exception.class)
+ public void getHeatEnvironmentTest(){
+ cd.getHeatEnvironment("4993493","test","heat");
+ }
+ @Test(expected = Exception.class)
+ public void getHeatEnvironment3Test(){
+ cd.getHeatEnvironment("4993493","test");
+ }
+ @Test(expected = Exception.class)
+ public void saveHeatEnvironmentTest(){
+ HeatEnvironment en = new HeatEnvironment();
+ cd.saveHeatEnvironment(en);
+ }
+ @Test(expected = Exception.class)
+ public void saveHeatTemplate2Test(){
+ HeatTemplate heat = new HeatTemplate();
+ cd.saveHeatTemplate(heat);
+ }
+ @Test(expected = Exception.class)
+ public void saveHeatFileTest(){
+ HeatFiles hf = new HeatFiles();
+ cd.saveHeatFile(hf);
+ }
+ @Test(expected = Exception.class)
+ public void saveVnfRecipeTest(){
+ VnfRecipe vr = new VnfRecipe();
+ cd.saveVnfRecipe(vr);
+ }
+ @Test(expected = Exception.class)
+ public void saveVnfComponentsRecipe(){
+ VnfComponentsRecipe vr = new VnfComponentsRecipe();
+ cd.saveVnfComponentsRecipe(vr);
+ }
+ @Test(expected = Exception.class)
+ public void saveOrUpdateVnfResourceTest(){
+ VnfResource vr = new VnfResource();
+ cd.saveOrUpdateVnfResource(vr);
+ }
+ @Test(expected = Exception.class)
+ public void saveVnfResourceCustomizationTest(){
+ VnfResourceCustomization vr = new VnfResourceCustomization();
+ cd.saveVnfResourceCustomization(vr);
+ }
+ @Test(expected = Exception.class)
+ public void saveAllottedResourceCustomizationTest(){
+ AllottedResourceCustomization arc = new AllottedResourceCustomization();
+ cd.saveAllottedResourceCustomization(arc);
+ }
+ @Test(expected = Exception.class)
+ public void saveAllottedResourceTest(){
+ AllottedResource ar = new AllottedResource();
+ cd.saveAllottedResource(ar);
+ }
+ @Test(expected = Exception.class)
+ public void saveNetworkResourceTest() throws RecordNotFoundException {
+ NetworkResource nr = new NetworkResource();
+ cd.saveNetworkResource(nr);
+ }
+ @Test(expected = Exception.class)
+ public void saveToscaCsarTest()throws RecordNotFoundException {
+ ToscaCsar ts = new ToscaCsar();
+ cd.saveToscaCsar(ts);
+ }
+ @Test(expected = Exception.class)
+ public void getToscaCsar(){
+ cd.getToscaCsar("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void saveTempNetworkHeatTemplateLookupTest(){
+ TempNetworkHeatTemplateLookup t = new TempNetworkHeatTemplateLookup();
+ cd.saveTempNetworkHeatTemplateLookup(t);
+ }
+ @Test(expected = Exception.class)
+ public void saveVfModuleToHeatFiles(){
+ VfModuleToHeatFiles v = new VfModuleToHeatFiles();
+ cd.saveVfModuleToHeatFiles(v);
+ }
+ @Test(expected = Exception.class)
+ public void saveVnfResourceToVfModuleCustomizationTest() throws RecordNotFoundException {
+ VnfResourceCustomization v =new VnfResourceCustomization();
+ VfModuleCustomization vm = new VfModuleCustomization();
+ cd.saveVnfResourceToVfModuleCustomization(v, vm);
+ }
+ @Test(expected = Exception.class)
+ public void saveNetworkResourceCustomizationTest() throws RecordNotFoundException {
+ NetworkResourceCustomization nrc = new NetworkResourceCustomization();
+ cd.saveNetworkResourceCustomization(nrc);
+ }
+
+ @Test(expected = Exception.class)
+ public void saveServiceToNetworksTest(){
+ AllottedResource ar = new AllottedResource();
+ cd.saveAllottedResource(ar);
+ }
+ @Test(expected = Exception.class)
+ public void saveServiceToResourceCustomizationTest(){
+ ServiceToResourceCustomization ar = new ServiceToResourceCustomization();
+ cd.saveServiceToResourceCustomization(ar);
+ }
+ @Test(expected = Exception.class)
+ public void saveServiceTest(){
+ Service ar = new Service();
+ cd.saveService(ar);
+ }
+ @Test(expected = Exception.class)
+ public void saveOrUpdateVfModuleTest(){
+ VfModule ar = new VfModule();
+ cd.saveOrUpdateVfModule(ar);
+ }
+ @Test(expected = Exception.class)
+ public void saveOrUpdateVfModuleCustomizationTest(){
+ VfModuleCustomization ar = new VfModuleCustomization();
+ cd.saveOrUpdateVfModuleCustomization(ar);
+ }
+
+ @Test(expected = Exception.class)
+ public void getNestedHeatTemplateTest(){
+ cd.getNestedHeatTemplate(101,201);
+ }
+ @Test(expected = Exception.class)
+ public void getNestedHeatTemplate2Test(){
+ cd.getNestedHeatTemplate("1002","1002");
+ }
+ @Test(expected = Exception.class)
+ public void saveNestedHeatTemplateTest(){
+ HeatTemplate ar = new HeatTemplate();
+ cd.saveNestedHeatTemplate("1001",ar,"test");
+ }
+ @Test(expected = Exception.class)
+ public void getHeatFiles2Test(){
+ VfModuleCustomization ar = new VfModuleCustomization();
+ cd.getHeatFiles(101,"test","1001","v2");
+ }
+ @Test(expected = Exception.class)
+ public void getHeatFiles3Test(){
+ VfModuleCustomization ar = new VfModuleCustomization();
+ cd.getHeatFiles("200192");
+ }
+ @Test(expected = Exception.class)
+ public void saveHeatFilesTest(){
+ HeatFiles ar = new HeatFiles();
+ cd.saveHeatFiles(ar);
+ }
+ @Test(expected = Exception.class)
+ public void saveVfModuleToHeatFilesTest(){
+ HeatFiles ar = new HeatFiles();
+ cd.saveVfModuleToHeatFiles("3772893",ar);
+ }
+ @Test
+ public void getNetworkResourceByModelUuidTest(){
+
+ cd.getNetworkResourceByModelUuid("3899291");
+ }
+ @Test(expected = Exception.class)
+ public void getNetworkRecipeTest(){
+
+ cd.getNetworkRecipe("test","test1","test2");
+ }
+ @Test(expected = Exception.class)
+ public void getNetworkRecipe2Test(){
+
+ cd.getNetworkRecipe("test","test1");
+ }
+ @Test
+ public void getNetworkResourceByModelCustUuidTest(){
+
+ cd.getNetworkResourceByModelCustUuid("test");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfComponentsRecipe2Test(){
+
+ cd.getVnfComponentsRecipe("test1","test2","test3","test4");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfComponentsRecipeByVfModuleModelUUIdTest(){
+
+ cd.getVnfComponentsRecipeByVfModuleModelUUId("test1","test2","test3");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfComponentRecipesTest(){
+
+ cd.getVnfComponentRecipes("test");
+ }
+ @Test(expected = Exception.class)
+ public void saveOrUpdateVnfComponentTest(){
+ VnfComponent ar = new VnfComponent();
+ cd.saveOrUpdateVnfComponent(ar);
+ }
+
+ @Test(expected = Exception.class)
+ public void getVfModule2Test(){
+
+ cd.getVfModule("test");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleByModelUUIDTest(){
+
+ cd.getVfModuleByModelUUID("test");
+ }
+ @Test(expected = Exception.class)
+ public void getServiceRecipeByModelUUIDTest(){
+
+ cd.getServiceRecipeByModelUUID("test1","test2");
+ }
+ @Test(expected = Exception.class)
+ public void getModelRecipeTest(){
+
+ cd.getModelRecipe("test1","test2","test3");
+ }
+ @Test(expected = Exception.class)
+ public void healthCheck(){
+
+ cd.healthCheck();
+ }
+ @Test(expected = Exception.class)
+ public void executeQuerySingleRow(){
+ VnfComponent ar = new VnfComponent();
+ HashMap<String, String> variables = new HashMap<String, String>();
+ cd.executeQuerySingleRow("tets",variables,false);
+ }
+ @Test(expected = Exception.class)
+ public void executeQueryMultipleRows(){
+ HashMap<String, String> variables = new HashMap<String, String>();
+ cd.executeQueryMultipleRows("select",variables,false);
+ }
+}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatFilesTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatFilesTest.java new file mode 100644 index 0000000000..da4e87806c --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatFilesTest.java @@ -0,0 +1,87 @@ +/*- + * ============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.db.catalog.test; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.UUID; + +import org.junit.Test; +import org.openecomp.mso.db.catalog.beans.HeatFiles; + +/** + */ + +public class HeatFilesTest { + + @Test + public final void heatFilesTest() { + + HeatFiles heatFiles = new HeatFiles(); + heatFiles.setFileBody("testBody"); + heatFiles.setArtifactUuid(UUID.randomUUID().toString()); + assertTrue(heatFiles.getFileBody().equals("testBody")); + assertTrue(!heatFiles.toString().contains("8 chars")); + heatFiles.setFileBody(null); + assertTrue(!heatFiles.toString().contains("Not defined")); + heatFiles.setVersion("12"); + assertTrue(heatFiles.getVersion().equals("12")); + + heatFiles.setFileName("File"); + assertTrue(heatFiles.getFileName().equalsIgnoreCase("File")); + + heatFiles.setCreated(null); + assertTrue(heatFiles.getCreated() == null); + heatFiles.setAsdcUuid("asdc"); + + assertTrue(heatFiles.getAsdcUuid().equalsIgnoreCase("asdc")); + + heatFiles.setDescription("desc"); + assertTrue(heatFiles.getDescription().equalsIgnoreCase("desc")); + + + heatFiles.setArtifactChecksum("artifactChecksum"); + assertTrue(heatFiles.getArtifactChecksum().equalsIgnoreCase("artifactChecksum")); + File tempFile; + try { + tempFile = File.createTempFile("heatFiles", "test"); + tempFile.deleteOnExit(); + try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tempFile), "utf-8"))) { + writer.write("something\n"); + writer.write("something2\n"); + } + heatFiles.setFileBody(tempFile.getAbsolutePath()); + assertTrue(heatFiles.getFileBody().contains("test")); + } catch (IOException e) { + e.printStackTrace(); + fail("Exception caught"); + } + + } + +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelRecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelRecipeTest.java new file mode 100644 index 0000000000..d70f267cc1 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelRecipeTest.java @@ -0,0 +1,59 @@ +/*- + * ============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.db.catalog.test; + +import static org.junit.Assert.assertTrue; + +import java.sql.Timestamp; + +import org.junit.Test; +import org.openecomp.mso.db.catalog.beans.ModelRecipe; + +/** + */ + +public class ModelRecipeTest { + + @Test + public final void modelRecipeDataTest() { + ModelRecipe modelRecipe = new ModelRecipe(); + modelRecipe.setAction("action"); + assertTrue(modelRecipe.getAction().equalsIgnoreCase("action")); + modelRecipe.setCreated(new Timestamp(System.currentTimeMillis())); + assertTrue(modelRecipe.getCreated() != null); + modelRecipe.setDescription("description"); + assertTrue(modelRecipe.getDescription().equalsIgnoreCase("description")); + modelRecipe.setId(1); + assertTrue(modelRecipe.getId() == 1); + modelRecipe.setModelId(1); + assertTrue(modelRecipe.getModelId() == 1); + modelRecipe.setModelParamXSD("modelParamXSD"); + assertTrue(modelRecipe.getModelParamXSD().equalsIgnoreCase("modelParamXSD")); + modelRecipe.setOrchestrationUri("orchestrationUri"); + assertTrue(modelRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri")); + modelRecipe.setRecipeTimeout(1); + assertTrue(modelRecipe.getRecipeTimeout() == 1); + modelRecipe.setSchemaVersion("schemaVersion"); + assertTrue(modelRecipe.getSchemaVersion().equalsIgnoreCase("schemaVersion")); +// assertTrue(modelRecipe.toString() != null); + } + +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelTest.java new file mode 100644 index 0000000000..dcc9810042 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelTest.java @@ -0,0 +1,69 @@ +/*- + * ============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.db.catalog.test; + +import static org.junit.Assert.assertTrue; + +import java.sql.Timestamp; + +import org.junit.Test; +import org.openecomp.mso.db.catalog.beans.Model; + +/** + */ + +public class ModelTest { + + @Test + public final void modelDataTest() { + Model model = new Model(); + model.setId(1); + assertTrue(model.getId() == 1); + + model.setCreated(new Timestamp(System.currentTimeMillis())); + assertTrue(model.getCreated() != null); + model.setModelCustomizationId("modelCustomizationId"); + + assertTrue(model.getModelCustomizationId().equalsIgnoreCase("modelCustomizationId")); + model.setModelCustomizationName("modelCustomizationName"); + assertTrue(model.getModelCustomizationName().equalsIgnoreCase("modelCustomizationName")); + + model.setModelInvariantId("modelInvariantId"); + assertTrue(model.getModelInvariantId().equalsIgnoreCase("modelInvariantId")); + model.setModelName("modelName"); + assertTrue(model.getModelName().equalsIgnoreCase("modelName")); + + model.setModelType("modelType"); + assertTrue(model.getModelType().equalsIgnoreCase("modelType")); + model.setModelVersion("modelVersion"); + assertTrue(model.getModelVersion().equalsIgnoreCase("modelVersion")); + model.setModelVersionId("modelVersionId"); + assertTrue(model.getModelVersionId().equalsIgnoreCase("modelVersionId")); + model.setVersion("1"); + assertTrue(model.getVersion().equalsIgnoreCase("1")); + model.setRecipes(null); + + assertTrue(model.getRecipes() == null); +// assertTrue(model.toString() != null); + + } + +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkRecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkRecipeTest.java new file mode 100644 index 0000000000..97eadb3f1d --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkRecipeTest.java @@ -0,0 +1,63 @@ +/*- + * ============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.db.catalog.test; + +import static org.junit.Assert.assertTrue; + +import java.sql.Timestamp; + +import org.junit.Test; +import org.openecomp.mso.db.catalog.beans.NetworkRecipe; + +/** + */ + +public class NetworkRecipeTest { + + @Test + public final void networkRecipeDataTest() { + + NetworkRecipe networkRecipe = new NetworkRecipe(); + networkRecipe.setAction("action"); + assertTrue(networkRecipe.getAction().equalsIgnoreCase("action")); + networkRecipe.setCreated(new Timestamp(System.currentTimeMillis())); + assertTrue(networkRecipe.getCreated() != null); + networkRecipe.setDescription("description"); + assertTrue(networkRecipe.getDescription().equalsIgnoreCase("description")); + networkRecipe.setId(1); + assertTrue(networkRecipe.getId() == 1); + networkRecipe.setModelName("modelName"); + assertTrue(networkRecipe.getModelName().equalsIgnoreCase("modelName")); + networkRecipe.setNetworkParamXSD("networkParamXSD"); + assertTrue(networkRecipe.getNetworkParamXSD().equalsIgnoreCase("networkParamXSD")); + networkRecipe.setOrchestrationUri("orchestrationUri"); + assertTrue(networkRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri")); + networkRecipe.setRecipeTimeout(1); + assertTrue(networkRecipe.getRecipeTimeout() == 1); + networkRecipe.setServiceType("serviceType"); + assertTrue(networkRecipe.getServiceType().equalsIgnoreCase("serviceType")); + networkRecipe.setVersion("version"); + assertTrue(networkRecipe.getVersion().equalsIgnoreCase("version")); +// assertTrue(networkRecipe.toString() != null); + + } + +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceCustomizationTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceCustomizationTest.java new file mode 100644 index 0000000000..7b54854fd9 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceCustomizationTest.java @@ -0,0 +1,62 @@ +/*- + * ============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.db.catalog.test; + +import static org.junit.Assert.assertTrue; + +import java.sql.Timestamp; + +import org.junit.Test; +import org.openecomp.mso.db.catalog.beans.NetworkResource; +import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization; + +/** + */ + +public class NetworkResourceCustomizationTest { + + @Test + public final void networkResourceCustomizationDataTest() { + NetworkResourceCustomization networkResourceCustomization = new NetworkResourceCustomization(); + networkResourceCustomization.setModelCustomizationUuid("modelCustomizationUuid"); + assertTrue(networkResourceCustomization.getModelCustomizationUuid().equalsIgnoreCase("modelCustomizationUuid")); + networkResourceCustomization.setModelInstanceName("modelInstanceName"); + assertTrue(networkResourceCustomization.getModelInstanceName().equalsIgnoreCase("modelInstanceName")); + networkResourceCustomization.setCreated(new Timestamp(System.currentTimeMillis())); + assertTrue(networkResourceCustomization.getCreated() != null); + networkResourceCustomization.setNetworkResource(new NetworkResource()); + assertTrue(networkResourceCustomization.getNetworkResource() != null); + networkResourceCustomization.setNetworkResourceModelUuid("networkResourceModelUuid"); + assertTrue(networkResourceCustomization.getNetworkResourceModelUuid() + .equalsIgnoreCase("networkResourceModelUuid")); + networkResourceCustomization.setNetworkRole("networkRole"); + assertTrue(networkResourceCustomization.getNetworkRole().equalsIgnoreCase("networkRole")); + networkResourceCustomization.setNetworkScope("networkScope"); + assertTrue(networkResourceCustomization.getNetworkScope().equalsIgnoreCase("networkScope")); + networkResourceCustomization.setNetworkTechnology("networkTechnology"); + assertTrue(networkResourceCustomization.getNetworkTechnology().equalsIgnoreCase("networkTechnology")); + networkResourceCustomization.setNetworkType("networkType"); + assertTrue(networkResourceCustomization.getNetworkType().equalsIgnoreCase("networkType")); +// assertTrue(networkResourceCustomization.toString() != null); + + } + +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceTest.java new file mode 100644 index 0000000000..11ee57b86b --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceTest.java @@ -0,0 +1,68 @@ +/*- + * ============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.db.catalog.test; + +import static org.junit.Assert.assertTrue; + +import java.sql.Timestamp; + +import org.junit.Test; +import org.openecomp.mso.db.catalog.beans.NetworkResource; + +/** + */ + +public class NetworkResourceTest { + + @Test + public final void networkResourceDataTest() { + NetworkResource networkResource = new NetworkResource(); + networkResource.setAicVersionMax("aicVersionMax"); + assertTrue(networkResource.getAicVersionMax().equalsIgnoreCase("aicVersionMax")); + networkResource.setAicVersionMin("aicVersionMin"); + assertTrue(networkResource.getAicVersionMin().equalsIgnoreCase("aicVersionMin")); + networkResource.setCreated(new Timestamp(System.currentTimeMillis())); + assertTrue(networkResource.getCreated() != null); + networkResource.setDescription("description"); + assertTrue(networkResource.getDescription().equalsIgnoreCase("description")); + networkResource.setHeatTemplateArtifactUUID("heatTemplateArtifactUUID"); + assertTrue(networkResource.getHeatTemplateArtifactUUID().equalsIgnoreCase("heatTemplateArtifactUUID")); + networkResource.setModelInvariantUUID("modelInvariantUUID"); + assertTrue(networkResource.getModelInvariantUUID().equalsIgnoreCase("modelInvariantUUID")); + networkResource.setModelName("modelName"); + assertTrue(networkResource.getModelName().equalsIgnoreCase("modelName")); + networkResource.setModelUUID("modelUUID"); + assertTrue(networkResource.getModelUUID().equalsIgnoreCase("modelUUID")); + networkResource.setModelVersion("modelVersion"); + assertTrue(networkResource.getModelVersion().equalsIgnoreCase("modelVersion")); + networkResource.setNeutronNetworkType("neutronNetworkType"); + assertTrue(networkResource.getNeutronNetworkType().equalsIgnoreCase("neutronNetworkType")); + networkResource.setOrchestrationMode("orchestrationMode"); + assertTrue(networkResource.getOrchestrationMode().equalsIgnoreCase("orchestrationMode")); + networkResource.setToscaNodeType("toscaNodeType"); + assertTrue(networkResource.getToscaNodeType().equalsIgnoreCase("toscaNodeType")); + networkResource.setVersion("1"); + assertTrue(networkResource.getVersion().equalsIgnoreCase("1")); +// assertTrue(networkResource.toString() != null); + + } + +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/RecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/RecipeTest.java new file mode 100644 index 0000000000..49dc9b7079 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/RecipeTest.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.db.catalog.test; + +import static org.junit.Assert.assertTrue; + +import java.sql.Timestamp; + +import org.junit.Test; +import org.openecomp.mso.db.catalog.beans.Recipe; + +/** + */ + +public class RecipeTest { + + @Test + public final void recipeDataTest() { + Recipe recipe = new Recipe(); + recipe.setAction("action"); + assertTrue(recipe.getAction().equalsIgnoreCase("action")); + recipe.setCreated(new Timestamp(System.currentTimeMillis())); + assertTrue(recipe.getCreated() != null); + recipe.setDescription("description"); + assertTrue(recipe.getDescription().equalsIgnoreCase("description")); + recipe.setId(1); + assertTrue(recipe.getId() == 1); + recipe.setOrchestrationUri("orchestrationUri"); + assertTrue(recipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri")); + recipe.setRecipeTimeout(1); + assertTrue(recipe.getRecipeTimeout() == 1); + recipe.setServiceType("serviceType"); + assertTrue(recipe.getServiceType().equalsIgnoreCase("serviceType")); +// assertTrue(recipe.toString() != null); + } + +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java new file mode 100644 index 0000000000..0e3492170e --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.db.catalog.test; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +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.VnfResource; +import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization; + +/** + */ + +public class ServiceMacroHolderTest { + + @Test + public final void serviceMacroHolderDataTest() { + ServiceMacroHolder serviceMacroHolder = new ServiceMacroHolder(); + assertTrue(serviceMacroHolder.getService() == null); + serviceMacroHolder.addVnfResource(new VnfResource()); + serviceMacroHolder.addVnfResourceCustomizations(new VnfResourceCustomization()); + serviceMacroHolder.addNetworkResourceCustomization(new NetworkResourceCustomization()); + serviceMacroHolder.addAllottedResourceCustomization(new AllottedResourceCustomization()); + assertTrue(serviceMacroHolder != null); + } + +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceRecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceRecipeTest.java new file mode 100644 index 0000000000..4b4a5adf4a --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceRecipeTest.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.db.catalog.test; + +import static org.junit.Assert.assertTrue; + +import java.sql.Timestamp; +import java.util.Date; + +import org.junit.Test; +import org.openecomp.mso.db.catalog.beans.ServiceRecipe; + +/** + */ + +public class ServiceRecipeTest { + + @Test + public final void serviceRecipeDataTest() { + + ServiceRecipe serviceRecipe = new ServiceRecipe(); + serviceRecipe.setAction("action"); + assertTrue(serviceRecipe.getAction().equalsIgnoreCase("action")); + serviceRecipe.setCreated(new Timestamp(System.currentTimeMillis())); + assertTrue(serviceRecipe.getCreated() != null); + serviceRecipe.setDescription("description"); + assertTrue(serviceRecipe.getDescription().equalsIgnoreCase("description")); + serviceRecipe.setId(1); + assertTrue(serviceRecipe.getId() == 1); + serviceRecipe.setOrchestrationUri("orchestrationUri"); + assertTrue(serviceRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri")); + serviceRecipe.setRecipeTimeout(1); + assertTrue(serviceRecipe.getRecipeTimeout() == 1); + serviceRecipe.setVersion("version"); + assertTrue(serviceRecipe.getVersion().equalsIgnoreCase("version")); + serviceRecipe.setServiceTimeoutInterim(1); + assertTrue(serviceRecipe.getServiceTimeoutInterim() == 1); + serviceRecipe.setServiceParamXSD("serviceParamXSD"); + assertTrue(serviceRecipe.getServiceParamXSD().equalsIgnoreCase("serviceParamXSD")); + assertTrue(serviceRecipe.toString() != null); + ServiceRecipe serviceRecipeWithValue = new ServiceRecipe(1, "string", "string", "string", "string", "string", 1, + 1, new Date()); + assertTrue(serviceRecipeWithValue.toString() != null); + + } + +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java new file mode 100644 index 0000000000..05e857f178 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java @@ -0,0 +1,151 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.db.catalog.test; + +import static org.junit.Assert.assertTrue; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.junit.Test; +import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization; +import org.openecomp.mso.db.catalog.beans.HeatFiles; +import org.openecomp.mso.db.catalog.beans.Model; +import org.openecomp.mso.db.catalog.beans.ModelRecipe; +import org.openecomp.mso.db.catalog.beans.NetworkResource; +import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization; +import org.openecomp.mso.db.catalog.beans.Service; +import org.openecomp.mso.db.catalog.beans.ServiceMacroHolder; +import org.openecomp.mso.db.catalog.beans.ServiceRecipe; +import org.openecomp.mso.db.catalog.beans.ServiceToResourceCustomization; +import org.openecomp.mso.db.catalog.beans.TempNetworkHeatTemplateLookup; +import org.openecomp.mso.db.catalog.beans.VfModule; +import org.openecomp.mso.db.catalog.beans.VnfComponent; +import org.openecomp.mso.db.catalog.beans.VnfResource; +import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization; + +public class ToStringTest { + + @Test + public void testTModelRecipeToString(){ + ModelRecipe mr = new ModelRecipe(); + mr.setCreated(new Timestamp(10001)); + mr.setModelId(102); + mr.setRecipeTimeout(100); + String str = mr.toString(); + assertTrue(str != null); + } + + @Test + public void networkResourcetoStringTest(){ + NetworkResource nr = new NetworkResource(); + nr.setCreated(new Timestamp(10000)); + String str = nr.toString(); + assertTrue(str != null); + } + + @Test + public void modelTestToString(){ + Model m = new Model(); + m.setCreated(new Timestamp(100000)); + m.setId(1001); + m.setModelCustomizationId("10012"); + String str = m.toString(); + assertTrue(str != null); + } + + @Test + public void serviceMacroHolderTest(){ + ServiceMacroHolder smh = new ServiceMacroHolder(); + Service service = new Service(); + Map<String,ServiceRecipe> recipes = new HashMap<>(); + recipes.put("test", new ServiceRecipe()); + service.setRecipes(recipes); + + Set<ServiceToResourceCustomization> serviceResourceCustomizations = new HashSet<>(); + ServiceToResourceCustomization sr = new ServiceToResourceCustomization(); + serviceResourceCustomizations.add(sr); + service.setServiceResourceCustomizations(serviceResourceCustomizations); + smh.setService(service); + + ArrayList<VnfResource> vnflist = new ArrayList<>(); + smh.setVnfResources(vnflist); + + VnfResource vr = new VnfResource(); + Set<VnfResourceCustomization> vnfResourceCustomization = new HashSet<>(); + vnfResourceCustomization.add(new VnfResourceCustomization()); + vr.setVnfResourceCustomizations(vnfResourceCustomization); + + Set<VfModule> vfModules = new HashSet<>(); + vfModules.add(new VfModule()); + vr.setVfModules(vfModules); + smh.addVnfResource(vr); + + ArrayList<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>(); + smh.setVnfResourceCustomizations(vnfResourceCustomizations); + + VnfResourceCustomization vrc = new VnfResourceCustomization(); + smh.addVnfResourceCustomizations(vrc); + + ArrayList<NetworkResourceCustomization> networkResourceCustomizations = new ArrayList<>(); + smh.setNetworkResourceCustomization(networkResourceCustomizations); + + NetworkResourceCustomization nrc = new NetworkResourceCustomization(); + smh.addNetworkResourceCustomization(nrc); + + ArrayList<AllottedResourceCustomization> allottedResourceCustomizations = new ArrayList<>(); + smh.setAllottedResourceCustomization(allottedResourceCustomizations); + + AllottedResourceCustomization arc = new AllottedResourceCustomization(); + smh.addAllottedResourceCustomization(arc); + + String str = smh.toString(); + assertTrue(str != null); + } + + @Test + public void heatFilesTest(){ + HeatFiles hf = new HeatFiles(); + String str = hf.toString(); + assertTrue(str != null); + + } + + @Test + public void testVnfConponent(){ + VnfComponent vnf = new VnfComponent(); + String str = vnf.toString(); + assertTrue(str != null); + } + + @Test + public void testTempNetworkHeatTemplateLookup(){ + TempNetworkHeatTemplateLookup tn =new TempNetworkHeatTemplateLookup(); + String str = tn.toString(); + assertTrue(str != null); + } + + +} diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final b/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final index 8238923139..f471caa340 100644 --- a/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final +++ b/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final @@ -82,10 +82,10 @@ COPY ./maven/artifacts/* $JBOSS_HOME/standalone/deployments/ RUN mkdir -p /etc/mso/config.d/ASDC && chown -R jboss:jboss /etc/mso/config.d/ASDC && chmod u+xrw /etc/mso/config.d/ASDC ## Install heatbridge -RUN apt-get install -y python && apt-get install -y python-pip && echo 'PIP Installed, doing upgrade' && pip install --upgrade pip -RUN mkdir /opt/mso/heatbridge -COPY heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl /opt/mso/heatbridge -RUN pip install /opt/mso/heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl +#RUN apt-get install -y python && apt-get install -y python-pip && echo 'PIP Installed, doing upgrade' && pip install --upgrade pip +#RUN mkdir /opt/mso/heatbridge +#COPY heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl /opt/mso/heatbridge +#RUN pip install /opt/mso/heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl ### Open Ports EXPOSE 8080 diff --git a/packages/pom.xml b/packages/pom.xml index e632f82d62..40a9b6efb6 100644 --- a/packages/pom.xml +++ b/packages/pom.xml @@ -26,12 +26,17 @@ </modules>
</profile>
+ <!-- Those profile are exclusive, choose docker or with-integration-tests -->
<profile>
<id>docker</id>
<modules>
<module>deliveries</module>
<module>docker</module>
</modules>
+ <properties>
+ <!-- For this profile we probably don't want to skip the docker push (if deploy goal is specified) -->
+ <docker.skip.push>false</docker.skip.push>
+ </properties>
</profile>
<profile>
@@ -41,6 +46,10 @@ <module>docker</module>
<module>arquillian-unit-tests</module>
</modules>
+ <properties>
+ <!-- For this profile we want to skip the docker push (if deploy goal is specified) -->
+ <docker.skip.push>true</docker.skip.push>
+ </properties>
</profile>
</profiles>
|