diff options
Diffstat (limited to 'mso-catalog-db/src/test')
39 files changed, 2114 insertions, 7743 deletions
diff --git a/mso-catalog-db/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java b/mso-catalog-db/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java new file mode 100644 index 0000000000..60f8de6c2e --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/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; +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/mso-catalog-db/src/test/java/org/onap/so/TestApplication.java b/mso-catalog-db/src/test/java/org/onap/so/TestApplication.java new file mode 100644 index 0000000000..6ee88e407d --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/TestApplication.java @@ -0,0 +1,48 @@ +/*- + * ============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; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.context.annotation.Profile; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; + +@SpringBootApplication(scanBasePackages = { "org.onap"}) +@EnableJpaRepositories("org.onap.so.db.catalog.data.repository") +@EntityScan("org.onap.so.db.catalog.beans") +@Profile("test") +public class TestApplication { + private static final String LOGS_DIR = "logs_dir"; + + private static void setLogsDir() { + if (System.getProperty(LOGS_DIR) == null) { + System.getProperties().setProperty(LOGS_DIR, "./logs/catdb/"); + } + } + + public static void main(String... args) { + SpringApplication.run(TestApplication.class, args); + System.getProperties().setProperty("mso.db", "MARIADB"); + System.getProperties().setProperty("server.name", "Springboot"); + setLogsDir(); + } +} diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BuildingBlockDetailTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BuildingBlockDetailTest.java new file mode 100644 index 0000000000..7a9fc19fcb --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BuildingBlockDetailTest.java @@ -0,0 +1,53 @@ +/*- + * ============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.db.catalog; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.TestApplication; +import org.onap.so.db.catalog.beans.BuildingBlockDetail; +import org.onap.so.db.catalog.beans.OrchestrationAction; +import org.onap.so.db.catalog.beans.ResourceType; +import org.onap.so.db.catalog.data.repository.BuildingBlockDetailRepository; +import org.springframework.beans.factory.annotation.Autowired; +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 = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public class BuildingBlockDetailTest { + @Autowired + private BuildingBlockDetailRepository buildingBlockDetailRepository; + + @Test + public void BuildingBlockDetailSingleLookupValidationTest() { + String buildingBlockName = "AssignServiceInstanceBB"; + + BuildingBlockDetail buildingBlockDetail = buildingBlockDetailRepository.findOneByBuildingBlockName(buildingBlockName); + assertEquals(buildingBlockName, buildingBlockDetail.getBuildingBlockName()); + assertEquals(ResourceType.SERVICE, buildingBlockDetail.getResourceType()); + assertEquals(OrchestrationAction.ASSIGN, buildingBlockDetail.getTargetAction()); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/MavenVersioningTest.java index c99a714b11..b5d6271f7c 100644 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/MavenVersioningTest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.db.catalog.test; +package org.onap.so.db.catalog; import static org.junit.Assert.*; @@ -29,8 +29,8 @@ import java.util.List; import org.junit.Test; -import org.openecomp.mso.db.catalog.utils.MavenLikeVersioningComparator; -import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; +import org.onap.so.db.catalog.utils.MavenLikeVersioningComparator; +import org.onap.so.db.catalog.utils.MavenLikeVersioning; public class MavenVersioningTest { @@ -153,7 +153,7 @@ public class MavenVersioningTest { MavenLikeVersioning test12 = new MavenLikeVersioning(); test12.setVersion("2.0"); - List<MavenLikeVersioning> list= new LinkedList<>(); + List<MavenLikeVersioning> list= new LinkedList<MavenLikeVersioning>(); list.add(test1); list.add(test2); list.add(test3); @@ -167,7 +167,7 @@ public class MavenVersioningTest { list.add(test11); list.add(test12); - list.sort(new MavenLikeVersioningComparator()); + Collections.sort(list,new MavenLikeVersioningComparator()); //Collections.reverse(list); assertTrue(list.get(0).getVersion().equals("0.02")); assertTrue(list.get(1).getVersion().equals("1.1")); diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/NetworkTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/NetworkTest.java new file mode 100644 index 0000000000..55c5c8351b --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/NetworkTest.java @@ -0,0 +1,47 @@ +/*- + * ============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.db.catalog; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.TestApplication; +import org.onap.so.db.catalog.beans.NetworkResource; +import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; +import org.springframework.beans.factory.annotation.Autowired; +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 = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public class NetworkTest { + @Autowired + private NetworkResourceRepository networkRepo; + + @Test + public void BuildingBlockDetailSingleLookupValidationTest() { + NetworkResource latestNetwork = networkRepo.findFirstByModelNameOrderByModelVersionDesc("CONTRAIL30_GNDIRECT"); + assertEquals("10b36f65-f4e6-4be6-ae49-9596dc1c47fz",latestNetwork.getModelUUID()); + } +} diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/OrchestrationStatusStateTransitionDirectiveTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/OrchestrationStatusStateTransitionDirectiveTest.java new file mode 100644 index 0000000000..52cac88402 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/OrchestrationStatusStateTransitionDirectiveTest.java @@ -0,0 +1,54 @@ +/*- + * ============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.db.catalog; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.TestApplication; +import org.onap.so.db.catalog.beans.OrchestrationAction; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective; +import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective; +import org.onap.so.db.catalog.beans.ResourceType; +import org.onap.so.db.catalog.data.repository.OrchestrationStatusStateTransitionDirectiveRepository; +import org.springframework.beans.factory.annotation.Autowired; +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 = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public class OrchestrationStatusStateTransitionDirectiveTest { + @Autowired + private OrchestrationStatusStateTransitionDirectiveRepository orchestrationStatusStateTransitionDirectiveRepository; + + @Test + public void OrchestrationStatusTransitionDBSingleLookupValidationTest() { + OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = orchestrationStatusStateTransitionDirectiveRepository.findOneByResourceTypeAndOrchestrationStatusAndTargetAction(ResourceType.SERVICE, OrchestrationStatus.ASSIGNED, OrchestrationAction.ASSIGN); + assertEquals(ResourceType.SERVICE, orchestrationStatusStateTransitionDirective.getResourceType()); + assertEquals(OrchestrationStatus.ASSIGNED, orchestrationStatusStateTransitionDirective.getOrchestrationStatus()); + assertEquals(OrchestrationAction.ASSIGN, orchestrationStatusStateTransitionDirective.getTargetAction()); + assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS, orchestrationStatusStateTransitionDirective.getFlowDirective()); + } +} diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.java new file mode 100644 index 0000000000..0ecaa5fbba --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.java @@ -0,0 +1,79 @@ +/*- + * ============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.db.catalog; + +import static org.junit.Assert.assertEquals; + +import java.util.List; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.TestApplication; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.data.repository.ServiceRepository; +import org.springframework.beans.factory.annotation.Autowired; +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 = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public class ServiceTest { + @Autowired + private ServiceRepository serviceRepo; + + @Test + public void Find_LatestService_Test() { + Service latestVersionService = serviceRepo.findFirstByModelNameOrderByModelVersionDesc("MSOTADevInfra_vSAMP10a_Service"); + assertEquals("5df8b6de-2083-11e7-93ae-92361f002675",latestVersionService.getModelUUID()); + } + + + @Test + public void Find_LatestService_Test_2() { + Service latestVersionService = serviceRepo.findByModelNameOrderByModelVersionDesc("MSOTADevInfra_vSAMP10a_Service"); + assertEquals("5df8b6de-2083-11e7-93ae-92361f002675",latestVersionService.getModelUUID()); + } + + + @Test + public void Find_LatestService_Test_Invariant_UUID() { + List<Service> latestVersionService = serviceRepo.findByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671"); + assertEquals("5df8b6de-2083-11e7-93ae-92361f002675",latestVersionService.get(0).getModelUUID()); + assertEquals("5df8b6de-2083-11e7-93ae-92361f002674",latestVersionService.get(1).getModelUUID()); + assertEquals("5df8b6de-2083-11e7-93ae-92361f002673",latestVersionService.get(2).getModelUUID()); + assertEquals("5df8b6de-2083-11e7-93ae-92361f002672",latestVersionService.get(3).getModelUUID()); + assertEquals("5df8b6de-2083-11e7-93ae-92361f002671",latestVersionService.get(4).getModelUUID()); + } + + @Test + public void Find_LatestService_Test_4() { + Service latestVersionService = serviceRepo.findOneByModelUUIDOrderByModelVersionDesc("5df8b6de-2083-11e7-93ae-92361f002671"); + assertEquals("5df8b6de-2083-11e7-93ae-92361f002671",latestVersionService.getModelUUID()); + } + + @Test + public void Find_LatestService_Test_5() { + Service latestVersionService = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671"); + assertEquals("5df8b6de-2083-11e7-93ae-92361f002675",latestVersionService.getModelUUID()); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/TempNetworkHeatTemplateLookupTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/TempNetworkHeatTemplateLookupTest.java index b0ccfdd781..b09ec7193d 100644 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/TempNetworkHeatTemplateLookupTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/TempNetworkHeatTemplateLookupTest.java @@ -1,50 +1,50 @@ -/*-
- * ============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 org.junit.Test;
-import org.openecomp.mso.db.catalog.beans.TempNetworkHeatTemplateLookup;
-
-/**
- */
-
-public class TempNetworkHeatTemplateLookupTest {
-
- @Test
- public final void tempNetworkHeatTemplateLookupDataTest() {
- TempNetworkHeatTemplateLookup tempNetworkHeatTemplateLookup = new TempNetworkHeatTemplateLookup();
- tempNetworkHeatTemplateLookup.setAicVersionMax("aicVersionMax");
- assertTrue(tempNetworkHeatTemplateLookup.getAicVersionMax().equalsIgnoreCase("aicVersionMax"));
- tempNetworkHeatTemplateLookup.setAicVersionMin("aicVersionMin");
- assertTrue(tempNetworkHeatTemplateLookup.getAicVersionMin().equalsIgnoreCase("aicVersionMin"));
- tempNetworkHeatTemplateLookup.setHeatTemplateArtifactUuid("heatTemplateArtifactUuid");
- assertTrue(tempNetworkHeatTemplateLookup.getHeatTemplateArtifactUuid()
- .equalsIgnoreCase("heatTemplateArtifactUuid"));
- tempNetworkHeatTemplateLookup.setNetworkResourceModelName("networkResourceModelName");
- assertTrue(tempNetworkHeatTemplateLookup.getNetworkResourceModelName()
- .equalsIgnoreCase("networkResourceModelName"));
-// assertTrue(tempNetworkHeatTemplateLookup.toString() != null);
-
- }
-
-}
+/*- + * ============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.db.catalog; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.onap.so.db.catalog.beans.TempNetworkHeatTemplateLookup; + +/** + */ + +public class TempNetworkHeatTemplateLookupTest { + + @Test + public final void tempNetworkHeatTemplateLookupDataTest() { + TempNetworkHeatTemplateLookup tempNetworkHeatTemplateLookup = new TempNetworkHeatTemplateLookup(); + tempNetworkHeatTemplateLookup.setAicVersionMax("aicVersionMax"); + assertTrue(tempNetworkHeatTemplateLookup.getAicVersionMax().equalsIgnoreCase("aicVersionMax")); + tempNetworkHeatTemplateLookup.setAicVersionMin("aicVersionMin"); + assertTrue(tempNetworkHeatTemplateLookup.getAicVersionMin().equalsIgnoreCase("aicVersionMin")); + tempNetworkHeatTemplateLookup.setHeatTemplateArtifactUuid("heatTemplateArtifactUuid"); + assertTrue(tempNetworkHeatTemplateLookup.getHeatTemplateArtifactUuid() + .equalsIgnoreCase("heatTemplateArtifactUuid")); + tempNetworkHeatTemplateLookup.setNetworkResourceModelName("networkResourceModelName"); + assertTrue(tempNetworkHeatTemplateLookup.getNetworkResourceModelName() + .equalsIgnoreCase("networkResourceModelName")); +// assertTrue(tempNetworkHeatTemplateLookup.toString() != null); + + } + +} diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/VFModuleTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/VFModuleTest.java new file mode 100644 index 0000000000..44e7a03855 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/VFModuleTest.java @@ -0,0 +1,57 @@ +/*- + * ============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.db.catalog; + +import static org.junit.Assert.assertEquals; + +import java.util.List; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.TestApplication; +import org.onap.so.db.catalog.beans.VfModule; +import org.onap.so.db.catalog.data.repository.VFModuleRepository; +import org.springframework.beans.factory.annotation.Autowired; +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 = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public class VFModuleTest { + @Autowired + private VFModuleRepository vfModuleRepo; + + @Test + public void VFModule_Versioned_LookUp() { + VfModule latestModule = vfModuleRepo.findFirstByModelNameOrderByModelVersionDesc("vSAMP10aDEV::PCM::module-1"); + assertEquals("066de97e-253e-11e7-93ae-92361f002675",latestModule.getModelUUID()); + } + + @Test + public void VFModule_Versioned_LookUp_LIst() { + List<VfModule> moduleList = vfModuleRepo.findByModelInvariantUUIDOrderByModelVersionDesc("64efd51a-2544-11e7-93ae-92361f002671"); + assertEquals("066de97e-253e-11e7-93ae-92361f002675",moduleList.get(0).getModelUUID()); + assertEquals("066de97e-253e-11e7-93ae-92361f002674",moduleList.get(1).getModelUUID()); + assertEquals("066de97e-253e-11e7-93ae-92361f002673",moduleList.get(2).getModelUUID()); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/BeansTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/BeansTest.java index 57bf292dd8..44439ede22 100644 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/BeansTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/BeansTest.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * 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. @@ -18,17 +18,23 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.db.catalog.beans; +package org.onap.so.db.catalog.beans; -import static org.hamcrest.CoreMatchers.isA; -import static org.mockito.Matchers.eq; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.onap.so.openpojo.rules.HasAnnotationMatcher.hasAnnotation; +import static org.onap.so.openpojo.rules.HasAnnotationPropertyWithValueMatcher.hasAnnotationPropertyWithValue; + +import javax.persistence.Column; +import javax.persistence.GeneratedValue; +import javax.persistence.Temporal; -import org.hamcrest.CoreMatchers; -import org.hamcrest.Matcher; import org.junit.Test; -import org.openecomp.mso.openpojo.rules.EqualsAndHashCodeTester; -import org.openecomp.mso.openpojo.rules.HasToStringRule; -import org.openecomp.mso.openpojo.rules.ToStringTester; +import org.onap.so.openpojo.rules.CustomSetterMustExistRule; +import org.onap.so.openpojo.rules.EqualsAndHashCodeTester; +import org.onap.so.openpojo.rules.HasEqualsAndHashCodeRule; +import org.onap.so.openpojo.rules.HasToStringRule; +import org.onap.so.openpojo.rules.ToStringTester; import com.openpojo.reflection.PojoClass; import com.openpojo.reflection.PojoClassFilter; @@ -37,8 +43,13 @@ import com.openpojo.reflection.filters.FilterNonConcrete; import com.openpojo.reflection.filters.FilterPackageInfo; import com.openpojo.validation.Validator; import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.BusinessKeyMustExistRule; import com.openpojo.validation.rule.impl.GetterMustExistRule; -import com.openpojo.validation.rule.impl.SetterMustExistRule; +import com.openpojo.validation.rule.impl.NoNestedClassRule; +import com.openpojo.validation.rule.impl.NoPrimitivesRule; +import com.openpojo.validation.rule.impl.NoPublicFieldsExceptStaticFinalRule; +import com.openpojo.validation.rule.impl.NoStaticExceptFinalRule; +import com.openpojo.validation.rule.impl.SerializableMustHaveSerialVersionUIDRule; import com.openpojo.validation.test.impl.GetterTester; import com.openpojo.validation.test.impl.SetterTester; @@ -53,20 +64,29 @@ public class BeansTest { @Test public void pojoStructure() { - test("org.openecomp.mso.db.catalog.beans"); + test("org.onap.so.db.catalog.beans"); + test("org.onap.so.db.catalog.beans.macro"); } private void test(String pojoPackage) { Validator validator = ValidatorBuilder.create() .with(new GetterMustExistRule()) - .with(new SetterMustExistRule()) + .with(new NoPrimitivesRule()) + .with(new NoNestedClassRule()) + .with(new NoStaticExceptFinalRule()) + .with(new SerializableMustHaveSerialVersionUIDRule()) .with(new HasToStringRule()) - + .with(new EqualsAndHashCodeTester()) + .with(new NoPublicFieldsExceptStaticFinalRule()) + .with(new CustomSetterMustExistRule().exclude( + allOf(hasAnnotationPropertyWithValue(Column.class, "updatable", equalTo(false)), hasAnnotation(GeneratedValue.class)), + hasAnnotation(Temporal.class))) .with(new SetterTester()) .with(new GetterTester()) .with(new ToStringTester()) - .with(new EqualsAndHashCodeTester().onlyDeclaredMethods()) + .with(new HasEqualsAndHashCodeRule()) + .build(); diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/RecordNotFoundExceptionTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/test/RecordNotFoundExceptionTest.java index dac5fb7f9e..506a6b73c9 100644 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/RecordNotFoundExceptionTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/test/RecordNotFoundExceptionTest.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,11 +18,11 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.db.catalog.test; +package org.onap.so.db.catalog.test; import org.junit.Test; -import org.openecomp.mso.db.catalog.beans.VfModule; -import org.openecomp.mso.db.catalog.utils.RecordNotFoundException; +import org.onap.so.db.catalog.beans.VfModule; +import org.onap.so.db.catalog.utils.RecordNotFoundException; import java.util.ArrayList; import java.util.List; diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/CatalogDbSessionFactoryManagerTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/CatalogDbSessionFactoryManagerTest.java deleted file mode 100644 index 42b93b1949..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/CatalogDbSessionFactoryManagerTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ============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; - -import org.junit.Test; -import org.mockito.Mock; -import org.openecomp.mso.db.catalog.CatalogDbSessionFactoryManager; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.mockito.Mockito.*; - - -public class CatalogDbSessionFactoryManagerTest { - @Test - public void testgetHibernateConfigFile() { - CatalogDbSessionFactoryManager catalogDbSessionFactoryManager = new CatalogDbSessionFactoryManager(); - System.setProperty("mso.db", "MYSQL"); - assertNotNull(catalogDbSessionFactoryManager.getHibernateConfigFile()); - } - - @Test - public void testgetHibernateConfigFileNonMSODB() { - CatalogDbSessionFactoryManager catalogDbSessionFactoryManager = new CatalogDbSessionFactoryManager(); - System.setProperty("mso.db", "test"); - assertNull(catalogDbSessionFactoryManager.getHibernateConfigFile()); - } -} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/AllottedResourceCustomizationTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/AllottedResourceCustomizationTest.java deleted file mode 100644 index 101cd5ed0a..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/AllottedResourceCustomizationTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * ============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 org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.db.catalog.beans.AllottedResource; -import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.sql.Timestamp; - -public class AllottedResourceCustomizationTest { - @Test - public void test(){ - AllottedResource allottedResource = new AllottedResource(); - allottedResource.setModelUuid("ModelUuid"); - allottedResource.setCreated(new Timestamp(System.currentTimeMillis())); - allottedResource.setModelVersion("ModelVersion"); - allottedResource.setDescription("Description"); - allottedResource.setModelInvariantUuid("ModelInvariantUuid"); - allottedResource.setModelName("ModelName"); - allottedResource.setSubcategory("Subcategory"); - allottedResource.setToscaNodeType("ToscaNodeType"); - allottedResource.setVersion("Version"); - - AllottedResourceCustomization allottedResourceCustomization = new AllottedResourceCustomization(); - allottedResourceCustomization.setCreated(new Timestamp(System.currentTimeMillis())); - allottedResourceCustomization.setAllottedResource(allottedResource); - allottedResourceCustomization.setVersion("Version"); - allottedResourceCustomization.setArModelUuid("ArModelUuid"); - allottedResourceCustomization.setMaxInstances(100); - allottedResourceCustomization.setMinInstances(1); - allottedResourceCustomization.setModelCustomizationUuid("ModelCustomizationUuid"); - allottedResourceCustomization.setModelInstanceName("ModelInstanceName"); - allottedResourceCustomization.setNfFunction("NfFunction"); - allottedResourceCustomization.setNfNamingCode("NfNamingCode"); - allottedResourceCustomization.setNfRole("NfRole"); - allottedResourceCustomization.setNfType("NfType"); - allottedResourceCustomization.setTargetNetworkRole("TargetNetworkRole"); - allottedResourceCustomization.setProvidingServiceModelUuid("ProvidingServiceModelUuid"); - allottedResourceCustomization.setProvidingServiceModelInvariantUuid("ProvidingServiceModelInvariantUuid"); - allottedResourceCustomization.setProvidingServiceModelName("ProvidingServiceModelName"); - - assertNotNull(allottedResource.getModelUuid()); - assertNotNull(allottedResource.getCreated()); - assertNotNull(allottedResource.getModelVersion()); - assertNotNull(allottedResource.getDescription()); - assertNotNull(allottedResource.getModelInvariantUuid()); - assertNotNull(allottedResource.getModelName()); - assertNotNull(allottedResource.getSubcategory()); - assertNotNull(allottedResource.getToscaNodeType()); - assertNotNull(allottedResource.getVersion()); - - assertNotNull(allottedResourceCustomization.getAllottedResource()); - assertNotNull(allottedResourceCustomization.getVersion()); - assertNotNull(allottedResourceCustomization.getCreated()); - assertNotNull(allottedResourceCustomization.getArModelUuid()); - assertNotNull(allottedResourceCustomization.getMaxInstances()); - assertNotNull(allottedResourceCustomization.getMinInstances()); - assertNotNull(allottedResourceCustomization.getModelCustomizationUuid()); - assertNotNull(allottedResourceCustomization.getModelInstanceName()); - assertNotNull(allottedResourceCustomization.getNfFunction()); - assertNotNull(allottedResourceCustomization.getNfNamingCode()); - assertNotNull(allottedResourceCustomization.getNfRole()); - assertNotNull(allottedResourceCustomization.getNfType()); - assertNotNull(allottedResourceCustomization.getTargetNetworkRole()); - assertNotNull(allottedResourceCustomization.getProvidingServiceModelUuid()); - assertNotNull(allottedResourceCustomization.getProvidingServiceModelInvariantUuid()); - assertNotNull(allottedResourceCustomization.getProvidingServiceModelName()); - } -} 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 deleted file mode 100644 index b98fb438dc..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java +++ /dev/null @@ -1,6155 +0,0 @@ -/*- - * ============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.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.hibernate.HibernateException; -import org.hibernate.NonUniqueResultException; -import org.hibernate.Query; -import org.hibernate.Session; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.openecomp.mso.db.catalog.CatalogDatabase; -import org.openecomp.mso.db.catalog.beans.*; -import org.openecomp.mso.db.catalog.utils.RecordNotFoundException; - -import mockit.Mock; -import mockit.MockUp; - -public class CatalogDatabaseTest { - - CatalogDatabase cd = null; - @Rule - public ExpectedException thrown = ExpectedException.none(); - private MockUp<CatalogDatabase> mockCd = null; - private MockUp<Session> mockedSession = null; - private MockUp<Query> mockUpQuery = null; - private MockUp<Query> mockUpQuery2 = null; - private MockUp<Query> mockUpQuery3 = null; - private MockUp<Query> mockUpQuery4 = null; - @Before - public void setup(){ - cd = CatalogDatabase.getInstance(); - } - - - @After - public void tearDown() { - if (mockCd!=null) { mockCd.tearDown(); mockCd = null; } - if (mockedSession!=null) { mockedSession.tearDown(); mockedSession = null; } - if (mockUpQuery!=null) { mockUpQuery.tearDown(); mockUpQuery = null; } - if (mockUpQuery2!=null) { mockUpQuery2.tearDown(); mockUpQuery2 = null; } - if (mockUpQuery3!=null) { mockUpQuery3.tearDown(); mockUpQuery3 = null; } - if (mockUpQuery4!=null) { mockUpQuery4.tearDown(); mockUpQuery4 = null; } - } - - - - @Test - public void getAllHeatTemplatesTest(){ - - mockUpQuery = new MockUp<Query>() { - @Mock - public List<HeatTemplate> list() { - HeatTemplate heatTemplate = new HeatTemplate(); - return Arrays.asList(heatTemplate); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - List <HeatTemplate> list = cd.getAllHeatTemplates(); - assertEquals(list.size(), 1); - - - } - - @Test - public void getHeatTemplateByIdTest(){ - - mockedSession = new MockUp<Session>() { - @Mock - public Object get(Class cls, Serializable id) { - HeatTemplate heatTemplate = new HeatTemplate(); - heatTemplate.setAsdcUuid("123-uuid"); - return heatTemplate; - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - HeatTemplate ht = cd.getHeatTemplate(10); - assertEquals("123-uuid", ht.getAsdcUuid()); - - - } - - @Test - public void getHeatTemplateByNameEmptyListTest(){ - - mockUpQuery = new MockUp<Query>() { - @Mock - public List<HeatTemplate> list() { - HeatTemplate heatTemplate = new HeatTemplate(); - return Arrays.asList(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - HeatTemplate ht = cd.getHeatTemplate("heat123"); - assertEquals(null, ht); - - - } - - @Test - public void getHeatTemplateByNameTest(){ - - mockUpQuery = new MockUp<Query>() { - @Mock - public List<HeatTemplate> list() { - HeatTemplate heatTemplate1 = new HeatTemplate(); - heatTemplate1.setAsdcUuid("123-uuid"); - heatTemplate1.setVersion("1.2"); - HeatTemplate heatTemplate2 = new HeatTemplate(); - heatTemplate2.setAsdcUuid("456-uuid"); - heatTemplate2.setVersion("1.3"); - return Arrays.asList(heatTemplate1, heatTemplate2); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - HeatTemplate ht = cd.getHeatTemplate("heat123"); - assertEquals("456-uuid", ht.getAsdcUuid()); - - - } - - @Test - public void getHeatTemplateByTemplateNameTest() { - - mockUpQuery = new MockUp<Query>() { - @Mock - public List<HeatTemplate> list() { - HeatTemplate heatTemplate = new HeatTemplate(); - heatTemplate.setAsdcUuid("1234-uuid"); - return Arrays.asList(heatTemplate); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - HeatTemplate ht = cd.getHeatTemplate("heat123","v2"); - assertEquals("1234-uuid", ht.getAsdcUuid()); - - - } - - @Test - public void getHeatTemplateByTemplateNameEmptyResultTest() { - - mockUpQuery = new MockUp<Query>() { - @Mock - public List<HeatTemplate> list() { - return Arrays.asList(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - HeatTemplate ht = cd.getHeatTemplate("heat123","v2"); - assertEquals(null, ht); - - - } - - @Test - public void getHeatTemplateByArtifactUuidException(){ - - mockedSession = new MockUp<Session>() { - @Mock - public Object get(Class cls, Serializable id) { - HeatTemplate heatTemplate = new HeatTemplate(); - heatTemplate.setAsdcUuid("123-uuid"); - return heatTemplate; - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - HeatTemplate ht = cd.getHeatTemplateByArtifactUuid("123"); - assertEquals("123-uuid", ht.getAsdcUuid()); - - - } - - @Test - public void getHeatTemplateByArtifactUuidTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() { - HeatTemplate heatTemplate = new HeatTemplate(); - heatTemplate.setAsdcUuid("123-uuid"); - return heatTemplate; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid"); - assertEquals("123-uuid", ht.getAsdcUuid()); - - - } - - @Test - public void getHeatTemplateByArtifactUuidNullTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() { - return null; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid"); - assertNull(ht); - - - } - - @Test - public void getHeatTemplateByArtifactUuidHibernateErrorTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() { - throw new HibernateException("hibernate exception"); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(HibernateException.class); - HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid"); - - - } - - @Test - public void getHeatTemplateByArtifactUuidNonUniqueResultTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() { - throw new NonUniqueResultException(2); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(NonUniqueResultException.class); - HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid"); - - - } - - @Test - public void getHeatTemplateByArtifactUuidGenericExceptionTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - throw new Exception(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(Exception.class); - HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid"); - - - } - - @Test - public void getParametersForHeatTemplateTest(){ - - mockUpQuery = new MockUp<Query>() { - @Mock - public List<HeatTemplate> list() { - HeatTemplate heatTemplate = new HeatTemplate(); - heatTemplate.setAsdcUuid("1234-uuid"); - return Arrays.asList(heatTemplate); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - List<HeatTemplateParam> htList = cd.getParametersForHeatTemplate("12l3"); - assertEquals(1, htList.size()); - - - } - - @Test - public void getParametersForHeatTemplateHibernateExceptionTest(){ - - mockUpQuery = new MockUp<Query>() { - @Mock - public List<HeatTemplate> list() { - throw new HibernateException("hibernate exception"); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(HibernateException.class); - List<HeatTemplateParam> htList = cd.getParametersForHeatTemplate("12l3"); - - - - } - - @Test - public void getParametersForHeatTemplateExceptionTest(){ - - mockUpQuery = new MockUp<Query>() { - @Mock - public List<HeatTemplate> list() throws Exception { - throw new Exception(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(Exception.class); - List<HeatTemplateParam> htList = cd.getParametersForHeatTemplate("12l3"); - - - } - - @Test - public void getHeatEnvironmentByArtifactUuidTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() { - HeatEnvironment heatEnvironment = new HeatEnvironment(); - heatEnvironment.setArtifactUuid("123-uuid"); - return heatEnvironment; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - HeatEnvironment he = cd.getHeatEnvironmentByArtifactUuid("123"); - assertEquals("123-uuid", he.getArtifactUuid()); - - - } - - @Test - public void getHeatEnvironmentByArtifactUuidHibernateExceptionTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() { - throw new HibernateException("hibernate exception"); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(HibernateException.class); - HeatEnvironment he = cd.getHeatEnvironmentByArtifactUuid("123"); - - - } - - @Test - public void getHeatEnvironmentByArtifactUuidExceptionTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - throw new Exception(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(Exception.class); - HeatEnvironment he = cd.getHeatEnvironmentByArtifactUuid("123"); - - - } - - @Test - public void getHeatEnvironmentByArtifactUuidNonUniqueTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - throw new org.hibernate.NonUniqueResultException(2); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - HeatEnvironment he = cd.getHeatEnvironmentByArtifactUuid("123"); - assertNull(he); - - } - - @Test - public void getServiceByInvariantUUIDTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<Service> list() { - Service service = new Service(); - service.setModelUUID("123-uuid"); - return Arrays.asList(service); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - Service service = cd.getServiceByInvariantUUID("123"); - assertEquals("123-uuid", service.getModelUUID()); - - - } - - @Test - public void getServiceByInvariantUUIDEmptyResultTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<Service> list() { - return Arrays.asList(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - Service service = cd.getServiceByInvariantUUID("123"); - assertEquals(null, service); - - - } - - @Test - public void getServiceTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - Service service = new Service(); - service.setModelUUID("123-uuid"); - return service; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - Service service = cd.getService("123"); - assertEquals("123-uuid", service.getModelUUID()); - - - } - - @Test - public void getServiceNullTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - return null; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - Service service = cd.getService("123"); - assertNull(service); - - - } - - @Test - public void getServiceNoUniqueResultTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - throw new NonUniqueResultException(-1); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(NonUniqueResultException.class); - Service service = cd.getService("123"); - - - } - - @Test - public void getServiceHibernateExceptionTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - throw new HibernateException("hibernate exception"); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(HibernateException.class); - Service service = cd.getService("123"); - - - } - - @Test - public void getServiceExceptionTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - throw new Exception("generic exception"); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(Exception.class); - Service service = cd.getService("123"); - - - } - - @Test - public void getServiceByModelUUIDTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - Service service = new Service(); - service.setModelUUID("123-uuid"); - return service; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - Service service = cd.getServiceByModelUUID("123"); - assertEquals("123-uuid", service.getModelUUID()); - - - } - - @Test - public void getService2Test(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - Service service = new Service(); - service.setModelUUID("123-uuid"); - return service; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - HashMap<String, String> map = new HashMap<>(); - map.put("serviceNameVersionId", "v2"); - Service service = cd.getService(map, "123"); - - assertEquals("123-uuid", service.getModelUUID()); - - map.remove("serviceNameVersionId"); - service = cd.getService(map, "123"); - assertNotNull(service); - } - - @Test - public void getService2NonUniqueTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - throw new org.hibernate.NonUniqueResultException(2); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - HashMap<String, String> map = new HashMap<>(); - map.put("serviceNameVersionId", "v2"); - - thrown.expect(org.hibernate.NonUniqueResultException.class); - Service service = cd.getService(map, "123"); - } - - @Test - public void getService2HibernateExceptionTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - throw new org.hibernate.HibernateException("test case"); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - HashMap<String, String> map = new HashMap<>(); - map.put("serviceNameVersionId", "v2"); - - thrown.expect(org.hibernate.HibernateException.class); - Service service = cd.getService(map, "123"); - } - - @Test - public void getService2ExceptionTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - throw new NullPointerException(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - HashMap<String, String> map = new HashMap<>(); - map.put("serviceNameVersionId", "v2"); - - thrown.expect(NullPointerException.class); - Service service = cd.getService(map, "123"); - } - - @Test - public void getService2NullTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - return null; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - HashMap<String, String> map = new HashMap<>(); - map.put("serviceNameVersionId", "v2"); - - Service service = cd.getService(map, "123"); - assertNull(service); - } - - @Test - public void getServiceByModelNameTest(){ - - mockUpQuery = new MockUp<Query>() { - @Mock - public List<Service> list() throws Exception { - Service service = new Service(); - service.setModelUUID("123-uuid"); - return Arrays.asList(service); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - Service service = cd.getServiceByModelName("123"); - assertEquals("123-uuid", service.getModelUUID()); - - - } - - @Test - public void getServiceByModelNameEmptyTest(){ - - mockUpQuery = new MockUp<Query>() { - @Mock - public List<Service> list() throws Exception { - return Arrays.asList(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - Service service = cd.getServiceByModelName("123"); - assertEquals(null, service); - - - } - - @Test - public void getServiceByVersionAndInvariantIdTest() throws Exception{ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - Service service = new Service(); - service.setModelUUID("123-uuid"); - return service; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - Service service = cd.getServiceByVersionAndInvariantId("123","tetwe"); - assertEquals("123-uuid", service.getModelUUID()); - - - } - - @Test - public void getServiceByVersionAndInvariantIdNullTest() throws Exception{ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - return null; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - Service service = cd.getServiceByVersionAndInvariantId("123","tetwe"); - assertNull(service); - - - } - - @Test - public void getServiceByVersionAndInvariantIdNonUniqueResultTest() throws Exception{ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - throw new NonUniqueResultException(-1); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(Exception.class); - Service service = cd.getServiceByVersionAndInvariantId("123","tetwe"); - - - } - - @Test - public void getServiceRecipeTestException() throws Exception{ - thrown.expect(Exception.class); - ServiceRecipe ht = cd.getServiceRecipe("123","tetwe"); - } - - @Test - public void getServiceRecipeByServiceModelUuidTest() { - mockUpQuery = new MockUp<Query>() { - @Mock - public List<ServiceRecipe> list() throws Exception { - ServiceRecipe serviceRecipe = new ServiceRecipe(); - serviceRecipe.setId(1); - return Arrays.asList(serviceRecipe); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - ServiceRecipe serviceRecipe = cd.getServiceRecipeByServiceModelUuid("123","tetwe"); - assertEquals(1, serviceRecipe.getId()); - - serviceRecipe = cd.getServiceRecipeByServiceModelUuid("123", null); - assertEquals(1, serviceRecipe.getId()); - } - - @Test - public void getServiceRecipeByServiceModelUuidEmptyTest() { - mockUpQuery = new MockUp<Query>() { - @Mock - public List<ServiceRecipe> list() throws Exception { - return Arrays.asList(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - ServiceRecipe serviceRecipe = cd.getServiceRecipeByServiceModelUuid("123","tetwe"); - assertEquals(null, serviceRecipe); - - - } - - @Test - public void getServiceRecipesTestException() throws Exception{ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<ServiceRecipe> list() { - ServiceRecipe serviceRecipe = new ServiceRecipe(); - serviceRecipe.setId(1); - return Arrays.asList(serviceRecipe); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - List<ServiceRecipe> serviceRecipes = cd.getServiceRecipes("123"); - assertEquals(1, serviceRecipes.size()); - - - } - - @Test - public void getServiceRecipesEmptyTest() throws Exception{ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<ServiceRecipe> list() { - return Arrays.asList(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - List<ServiceRecipe> serviceRecipes = cd.getServiceRecipes("123"); - assertEquals(0, serviceRecipes.size()); - - - } - - @Test - public void getVnfComponentTest() throws Exception{ - mockUpQuery = new MockUp<Query>() { - @Mock - public Object uniqueResult() { - VnfComponent vnfComponent = new VnfComponent(); - vnfComponent.setHeatTemplateId(1234); - return vnfComponent; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VnfComponent ht = cd.getVnfComponent(123,"vnf"); - assertEquals(new Integer(1234), ht.getHeatTemplateId()); - } - - @Test - public void getVnfComponentNullTest() throws Exception{ - mockUpQuery = new MockUp<Query>() { - @Mock - public Object uniqueResult() { - return null; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VnfComponent ht = cd.getVnfComponent(123,"vnf"); - assertNull(ht); - } - - @Test - public void getVnfComponentNonUniqueTest() throws Exception{ - mockUpQuery = new MockUp<Query>() { - @Mock - public Object uniqueResult() { - throw new org.hibernate.NonUniqueResultException(2); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - thrown.expect(org.hibernate.NonUniqueResultException.class); - VnfComponent ht = cd.getVnfComponent(123,"vnf"); - } - - @Test - public void getVnfComponentHibernateExceptionTest() throws Exception{ - mockUpQuery = new MockUp<Query>() { - @Mock - public Object uniqueResult() { - throw new org.hibernate.HibernateException("test case"); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - thrown.expect(org.hibernate.HibernateException.class); - VnfComponent ht = cd.getVnfComponent(123,"vnf"); - } - - @Test - public void getVnfComponentExceptionTest() throws Exception{ - mockUpQuery = new MockUp<Query>() { - @Mock - public Object uniqueResult() { - throw new NullPointerException(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - thrown.expect(NullPointerException.class); - VnfComponent ht = cd.getVnfComponent(123,"vnf"); - } - - @Test - public void getVnfResourceTest() throws Exception{ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<VnfResource> list() { - VnfResource vnfResource = new VnfResource(); - vnfResource.setModelUuid("123-uuid"); - return Arrays.asList(vnfResource); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - VnfResource vnfResource = cd.getVnfResourceByType("vnf"); - assertEquals("123-uuid", vnfResource.getModelUuid()); - - - } - - @Test - public void getVnfResourceEmptyTest() throws Exception{ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<VnfResource> list() { - return Arrays.asList(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - VnfResource vnfResource = cd.getVnfResourceByType("vnf"); - assertEquals(null, vnfResource); - - - } - - @Test - public void getVnfResourceByTypeTest() { - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() { - VnfResource vnfResource = new VnfResource(); - vnfResource.setModelUuid("123-uuid"); - return vnfResource; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - VnfResource vnfResource = cd.getVnfResource("vnf","3992"); - assertEquals("123-uuid", vnfResource.getModelUuid()); - - - } - - @Test - public void getVnfResourceNURExceptionTest() { - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() { - throw new NonUniqueResultException(-1); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(NonUniqueResultException.class); - VnfResource vnfResource = cd.getVnfResource("vnf","3992"); - - - } - - @Test - public void getVnfResourceHibernateExceptionTest() { - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() { - throw new HibernateException("hibernate exception"); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(HibernateException.class); - VnfResource vnfResource = cd.getVnfResource("vnf","3992"); - - - } - - @Test - public void getVnfResourceExceptionTest() { - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - throw new Exception(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(Exception.class); - VnfResource vnfResource = cd.getVnfResource("vnf","3992"); - - - } - - @Test - public void getVnfResourceByModelCustomizationIdTest() { - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - VnfResource vnfResource = new VnfResource(); - vnfResource.setModelUuid("123-uuid"); - return vnfResource; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992"); - assertEquals("123-uuid",vnfResource.getModelUuid()); - - - } - - @Test - public void getVnfResourceByModelCustomizationIdNullTest() { - mockUpQuery = new MockUp<Query>() { - @Mock - public Object uniqueResult() throws Exception { - return null; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992"); - assertNull(vnfResource); - } - - @Test - public void getVnfResourceByModelCustomizationIdNURExceptionTest() { - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - throw new NonUniqueResultException(-1); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(NonUniqueResultException.class); - VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992"); - - - } - - @Test - public void getVnfResourceByModelCustomizationIdHibernateExceptionTest() { - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - throw new HibernateException("hibernate exception"); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(HibernateException.class); - VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992"); - } - - @Test - public void getVnfResourceByModelCustomizationIdExceptionTest() { - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - throw new NullPointerException(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(NullPointerException.class); - VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992"); - } - - - @Test - public void getServiceRecipeTest2() throws Exception{ - mockUpQuery = new MockUp<Query>() { - @Mock - public List <ServiceRecipe> list() throws Exception { - ServiceRecipe serviceRecipe = new ServiceRecipe(); - serviceRecipe.setServiceModelUUID("123-uuid"); - return Arrays.asList(serviceRecipe); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - ServiceRecipe ht = cd.getServiceRecipe(1001,"3992"); - assertEquals("123-uuid", ht.getServiceModelUUID()); - - ht = cd.getServiceRecipe(1001, null); - assertEquals("123-uuid", ht.getServiceModelUUID()); - - } - - @Test - public void getServiceRecipeTest2Exception() throws Exception{ - thrown.expect(Exception.class); - ServiceRecipe ht = cd.getServiceRecipe(1001,"3992"); - } - - @Test - public void getVnfResourceCustomizationByModelCustomizationNameTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<VnfResourceCustomization> list() throws Exception { - VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); - vnfResourceCustomization.setVnfResourceModelUUID("123-uuid"); - return Arrays.asList(vnfResourceCustomization); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationName("test", "test234"); - assertEquals("123-uuid", vnf.getVnfResourceModelUUID()); - - - } - - @Test - public void getVnfResourceCustomizationByModelCustomizationNameEmptyTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<VnfResourceCustomization> list() throws Exception { - return Arrays.asList(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationName("test", "test234"); - assertEquals(null, vnf); - - - } - - @Test - public void getVnfResourceByModelInvariantIdTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult(){ - VnfResource vnfResource = new VnfResource(); - vnfResource.setModelUuid("123-uuid"); - return vnfResource; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234"); - assertEquals("123-uuid", vnf.getModelUuid()); - - - } - - @Test - public void getVnfResourceByModelInvariantIdNURExceptionTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult(){ - throw new NonUniqueResultException(-1); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(NonUniqueResultException.class); - VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234"); - - - } - - @Test - public void getVnfResourceByModelInvariantIdHibernateExceptionTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult(){ - throw new HibernateException("hibernate exception"); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(HibernateException.class); - VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234"); - - - } - - @Test - public void getVnfResourceByModelInvariantIdExceptionTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - throw new Exception(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(Exception.class); - VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234"); - - - } - - @Test - public void getVnfResourceByIdTestException(){ - mockUpQuery = new MockUp<Query>() { - int id = 0; - @Mock - public Query setParameter(String name, Object val) { - id = (Integer)val; - return this.getMockInstance(); - } - - @Mock - public List<VnfResource> list() throws Exception { - if (id==0) return new ArrayList<VnfResource>(); - VnfResource vm = new VnfResource(); - vm.setModelInvariantUuid(Integer.toString(id)); - return Arrays.asList(vm); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VnfResource vnf = cd.getVnfResourceById(19299); - assertEquals("19299", vnf.getModelInvariantUuid()); - - vnf = cd.getVnfResourceById(0); - assertNull(vnf); - } - - @Test - public void getVfModuleModelName(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<VfModule> list() throws Exception { - VfModule vfModule = new VfModule(); - vfModule.setModelUUID("123-uuid"); - return Arrays.asList(vfModule); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - VfModule vfModule = cd.getVfModuleModelName("vfmodule"); - assertEquals("123-uuid", vfModule.getModelUUID()); - - - } - - @Test - public void getVfModuleModelNameExceptionTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<VfModule> list() throws Exception { - return Arrays.asList(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - VfModule vfModule = cd.getVfModuleModelName("vfmodule"); - assertEquals(null, vfModule); - - - } - - @Test - public void getVfModuleModelNameTest() { - mockUpQuery = new MockUp<Query>() { - String modelVersion = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("model_version")) modelVersion = (String)val; - return this.getMockInstance(); - } - - @Mock - public Object uniqueResult() { - if (modelVersion==null || modelVersion.equals("nil")) { - return null; - } - VfModule vfModule = new VfModule(); - vfModule.setModelUUID("123-uuid"); - return vfModule; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl"); - assertEquals("123-uuid", vfModule.getModelUUID()); - - vfModule = cd.getVfModuleModelName("tetes","nil"); - assertNull(vfModule); - } - - @Test - public void getVfModuleModelNameNURExceptionTest() { - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() { - throw new NonUniqueResultException(-1); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(NonUniqueResultException.class); - VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl"); - - - } - - @Test - public void getVfModuleModelNameHibernateExceptionTest() { - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() { - throw new HibernateException("hibernate exception"); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(HibernateException.class); - VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl"); - - - } - - @Test - public void getVfModuleModelNameGenericExceptionTest() { - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - throw new Exception(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(Exception.class); - VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl"); - - - } - - @Test - public void ggetVfModuleCustomizationByModelNameTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<VfModuleCustomization> list() throws Exception { - VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); - vfModuleCustomization.setVfModuleModelUuid("123-uuid"); - return Arrays.asList(vfModuleCustomization); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - VfModuleCustomization vfModuleCustomization = cd.getVfModuleCustomizationByModelName("tetes"); - assertEquals("123-uuid", vfModuleCustomization.getVfModuleModelUuid()); - - - } - - @Test - public void ggetVfModuleCustomizationByModelNameEmptyTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<VfModuleCustomization> list() throws Exception { - return Arrays.asList(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - VfModuleCustomization vfModuleCustomization = cd.getVfModuleCustomizationByModelName("tetes"); - assertEquals(null, vfModuleCustomization); - - - } - - @Test - public void getNetworkResourceTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<NetworkResource> list() throws Exception { - NetworkResource networkResource = new NetworkResource(); - networkResource.setModelUUID("123-uuid"); - return Arrays.asList(networkResource); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - NetworkResource networkResource = cd.getNetworkResource("tetes"); - assertEquals("123-uuid", networkResource.getModelUUID()); - - - } - - @Test - public void getNetworkResourceTestEmptyException(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<NetworkResource> list() throws Exception { - return Arrays.asList(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - NetworkResource networkResource = cd.getNetworkResource("tetes"); - assertEquals(null, networkResource); - - - } - - @Test - public void getVnfRecipeTest(){ - - mockUpQuery = new MockUp<Query>() { - @Mock - public List<VnfRecipe> list() throws Exception { - VnfRecipe vnfRecipe = new VnfRecipe(); - vnfRecipe.setVfModuleId("123-id"); - return Arrays.asList(vnfRecipe); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","ergfedrf","4993493"); - assertEquals("123-id", vnfRecipe.getVfModuleId()); - - - } - - @Test - public void getVnfRecipeEmptyTest(){ - - mockUpQuery = new MockUp<Query>() { - @Mock - public List<VnfRecipe> list() throws Exception { - return Collections.emptyList(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","ergfedrf","4993493"); - assertEquals(null, vnfRecipe); - - - } - - @Test - public void getVnfRecipe2Test(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<VnfRecipe> list() throws Exception { - VnfRecipe vnfRecipe = new VnfRecipe(); - vnfRecipe.setId(1); - return Arrays.asList(vnfRecipe); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","4993493"); - assertEquals(1, vnfRecipe.getId()); - - - } - - @Test - public void getVnfRecipe2EmptyTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<VnfRecipe> list() throws Exception { - return Collections.emptyList(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","4993493"); - assertEquals(null, vnfRecipe); - - - } - - @Test - public void getVnfRecipeByVfModuleIdTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<VnfRecipe> list() throws Exception { - VnfRecipe vnfRecipe = new VnfRecipe(); - vnfRecipe.setId(1); - return Arrays.asList(vnfRecipe); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VnfRecipe vnfRecipe = cd.getVnfRecipeByVfModuleId("tetes","4993493","vnf"); - assertEquals(1, vnfRecipe.getId()); - - - } - - @Test - public void getVnfRecipeByVfModuleIdEmptyTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<VnfRecipe> list() throws Exception { - return Collections.emptyList(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VnfRecipe vnfRecipe = cd.getVnfRecipeByVfModuleId("tetes","4993493","vnf"); - assertEquals(null, vnfRecipe); - - - } - - @Test - public void getVfModuleTypeTestException(){ - mockUpQuery = new MockUp<Query>() { - String type = null; - @Mock - public Query setParameter(String name, Object val) { - type = (String)val; - return this.getMockInstance(); - } - - @Mock - public List<VfModule> list() { - if ("nil".equals(type)) return new ArrayList<VfModule>(); - - VfModule vm = new VfModule(); - vm.setModelUUID("123-uuid"); - return Arrays.asList(vm); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VfModule vnf = cd.getVfModuleType("4993493"); - assertEquals("123-uuid", vnf.getModelUUID()); - - vnf = cd.getVfModuleType("nil"); - assertNull(vnf); - } - - @Test - public void getVnfResourceByServiceUuidTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() { - VnfResource vnfResource = new VnfResource(); - vnfResource.setModelUuid("123-uuid"); - return vnfResource; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - VnfResource vnfResource = cd.getVnfResourceByServiceUuid("4993493"); - assertEquals("123-uuid", vnfResource.getModelUuid()); - - - } - - @Test - public void getVnfResourceByServiceUuidNURExceptionTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() { - throw new NonUniqueResultException(-1); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(NonUniqueResultException.class); - VnfResource vnfResource = cd.getVnfResourceByServiceUuid("4993493"); - - - } - - @Test - public void getVnfResourceByServiceUuidHibernateExceptionTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() { - throw new HibernateException("hibernate exception"); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(HibernateException.class); - VnfResource vnfResource = cd.getVnfResourceByServiceUuid("4993493"); - - - } - - @Test - public void getVnfResourceByServiceUuidExceptionTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - throw new Exception(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(Exception.class); - VnfResource vnfResource = cd.getVnfResourceByServiceUuid("4993493"); - - - } - - @Test - public void getVnfResourceByVnfUuidTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() { - VnfResource vnfResource = new VnfResource(); - vnfResource.setModelUuid("123-uuid"); - return vnfResource; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VnfResource vnfResource = cd.getVnfResourceByVnfUuid("4993493"); - assertEquals("123-uuid", vnfResource.getModelUuid()); - - - } - - @Test - public void getVnfResourceByVnfUuidNURExceptionTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() { - throw new NonUniqueResultException(-1); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(NonUniqueResultException.class); - VnfResource vnfResource = cd.getVnfResourceByVnfUuid("4993493"); - - - } - - @Test - public void getVnfResourceByVnfUuidHibernateExceptionTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() { - throw new HibernateException("hibernate exception"); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(HibernateException.class); - VnfResource vnfResource = cd.getVnfResourceByVnfUuid("4993493"); - - - } - - @Test - public void getVnfResourceByVnfUuidExceptionTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - throw new Exception(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - thrown.expect(Exception.class); - VnfResource vnfResource = cd.getVnfResourceByVnfUuid("4993493"); - - - } - - @Test - public void getVfModuleByModelInvariantUuidTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<VfModule> list() throws Exception { - VfModule vfModule = new VfModule(); - vfModule.setModelUUID("123-uuid"); - return Arrays.asList(vfModule); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VfModule vfModule = cd.getVfModuleByModelInvariantUuid("4993493"); - assertEquals("123-uuid", vfModule.getModelUUID()); - - - } - - @Test - public void getVfModuleByModelInvariantUuidEmptyTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<VfModule> list() throws Exception { - return Collections.emptyList(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VfModule vfModule = cd.getVfModuleByModelInvariantUuid("4993493"); - assertEquals(null, vfModule); - - - } - - @Test - public void getVfModuleByModelCustomizationUuidTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public Object uniqueResult() { - VfModuleCustomization vc = new VfModuleCustomization(); - vc.setModelCustomizationUuid("4993493"); - return vc; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VfModuleCustomization vnf = cd.getVfModuleByModelCustomizationUuid("4993493"); - assertEquals("4993493", vnf.getModelCustomizationUuid()); - } - - @Test - public void getVfModuleByModelCustomizationUuidNullTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public Object uniqueResult() { - return null; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VfModuleCustomization vnf = cd.getVfModuleByModelCustomizationUuid("4993493"); - assertNull(vnf); - } - - @Test - public void getVfModuleByModelCustomizationUuidNonUniqueExceptionTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public Object uniqueResult() { - throw new org.hibernate.NonUniqueResultException(2); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - thrown.expect(org.hibernate.NonUniqueResultException.class); - VfModuleCustomization vnf = cd.getVfModuleByModelCustomizationUuid("4993493"); - } - - @Test - public void getVfModuleByModelCustomizationUuidHibernateExceptionTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public Object uniqueResult() { - throw new org.hibernate.HibernateException("test case"); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - thrown.expect(org.hibernate.HibernateException.class); - VfModuleCustomization vnf = cd.getVfModuleByModelCustomizationUuid("4993493"); - } - - @Test - public void getVfModuleByModelCustomizationUuidExceptionTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public Object uniqueResult() { - throw new NullPointerException(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - thrown.expect(NullPointerException.class); - VfModuleCustomization vnf = cd.getVfModuleByModelCustomizationUuid("4993493"); - } - - @Test - public void getVfModuleCustomizationByModelCustomizationIdTest(){ - mockUpQuery = new MockUp<Query>() { - String modelCustomizationUuid = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("modelCustomizationUuid")) modelCustomizationUuid = (String)val; - return this.getMockInstance(); - } - - @Mock - public Object uniqueResult() { - if ("nil".equals(modelCustomizationUuid)) return null; - if ("multi".equals(modelCustomizationUuid)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(modelCustomizationUuid)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(modelCustomizationUuid)) throw new NullPointerException(); - - VfModuleCustomization vm = new VfModuleCustomization(); - vm.setModelCustomizationUuid("4993493"); - return vm; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VfModuleCustomization vnf = cd.getVfModuleCustomizationByModelCustomizationId("4993493"); - assertEquals("4993493", vnf.getModelCustomizationUuid()); - - vnf = cd.getVfModuleCustomizationByModelCustomizationId("nil"); - assertNull(vnf); - - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.NonUniqueResultException.class); - vnf = cd.getVfModuleCustomizationByModelCustomizationId("multi"); - } catch (org.hibernate.NonUniqueResultException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.HibernateException.class); - vnf = cd.getVfModuleCustomizationByModelCustomizationId("he"); - } catch (org.hibernate.HibernateException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(NullPointerException.class); - vnf = cd.getVfModuleCustomizationByModelCustomizationId("npe"); - } catch (NullPointerException e) { - // noop - } - - } - - @Test - public void getVfModuleByModelUuidTestException(){ - mockUpQuery = new MockUp<Query>() { - String modelUuidValue = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("modelUuidValue")) modelUuidValue = (String)val; - return this.getMockInstance(); - } - - @Mock - public List<VfModule> list() { - if ("nil".equals(modelUuidValue)) return null; - if ("multi".equals(modelUuidValue)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(modelUuidValue)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(modelUuidValue)) throw new NullPointerException(); - - VfModule vfModule = new VfModule(); - vfModule.setModelInvariantUuid(modelUuidValue); - return Arrays.asList(vfModule); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VfModule vnf = cd.getVfModuleByModelUuid("4993493"); - assertEquals("4993493", vnf.getModelInvariantUuid()); - - vnf = cd.getVfModuleByModelUuid("nil"); - assertNull(vnf); - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.NonUniqueResultException.class); - vnf = cd.getVfModuleByModelUuid("multi"); - } catch (org.hibernate.NonUniqueResultException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.HibernateException.class); - vnf = cd.getVfModuleByModelUuid("he"); - } catch (org.hibernate.HibernateException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(NullPointerException.class); - vnf = cd.getVfModuleByModelUuid("npe"); - } catch (NullPointerException e) { - // noop - } - } - - - @Test - public void getVnfResourceCustomizationByModelVersionIdTest(){ - mockUpQuery = new MockUp<Query>() { - String modelVersionId = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("modelVersionId")) modelVersionId = (String)val; - return this.getMockInstance(); - } - - @Mock - public Object uniqueResult() { - if ("nil".equals(modelVersionId)) return null; - if ("multi".equals(modelVersionId)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(modelVersionId)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(modelVersionId)) throw new NullPointerException(); - - VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); - vnfResourceCustomization.setVnfResourceModelUuid(modelVersionId); - return vnfResourceCustomization; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - public VnfResource getVnfResourceByModelUuid(String modelUuid) { - return new VnfResource(); - } - - @Mock - public ArrayList<VfModuleCustomization> getAllVfModuleCustomizations(String vnfResourceCustomizationMCU) { - ArrayList<VfModuleCustomization> toRet = new ArrayList<VfModuleCustomization>(); - VfModuleCustomization vmc = new VfModuleCustomization(); - toRet.add(vmc); - return toRet; - } - - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelVersionId("4993493"); - assertEquals("4993493", vnf.getVnfResourceModelUuid()); - - vnf = cd.getVnfResourceCustomizationByModelVersionId("nil"); - assertNull(vnf); - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.NonUniqueResultException.class); - vnf = cd.getVnfResourceCustomizationByModelVersionId("multi"); - } catch (org.hibernate.NonUniqueResultException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.HibernateException.class); - vnf = cd.getVnfResourceCustomizationByModelVersionId("he"); - } catch (org.hibernate.HibernateException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(NullPointerException.class); - vnf = cd.getVnfResourceCustomizationByModelVersionId("npe"); - } catch (NullPointerException e) { - // noop - } - } - - - @Test - public void getVfModuleByModelCustomizationIdAndVersionTestException(){ - mockUpQuery = new MockUp<Query>() { - String modelVersionId = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("modelVersionId")) modelVersionId = (String)val; - return this.getMockInstance(); - } - - @Mock - public Object uniqueResult() { - if ("nil".equals(modelVersionId)) return null; - if ("multi".equals(modelVersionId)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(modelVersionId)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(modelVersionId)) throw new NullPointerException(); - - VfModule vfModule = new VfModule(); - vfModule.setModelVersion(modelVersionId); - return vfModule; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VfModule vm = cd.getVfModuleByModelCustomizationIdAndVersion("4993493","test"); - assertEquals("test", vm.getModelVersion()); - - vm = cd.getVfModuleByModelCustomizationIdAndVersion("4993493", "nil"); - assertNull(vm); - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.NonUniqueResultException.class); - vm = cd.getVfModuleByModelCustomizationIdAndVersion("4993493", "multi"); - } catch (org.hibernate.NonUniqueResultException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.HibernateException.class); - vm = cd.getVfModuleByModelCustomizationIdAndVersion("4993493", "he"); - } catch (org.hibernate.HibernateException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(NullPointerException.class); - vm = cd.getVfModuleByModelCustomizationIdAndVersion("4993493", "npe"); - } catch (NullPointerException e) { - // noop - } - } - - @Test - public void getVfModuleCustomizationByVnfModuleCustomizationUuidTest(){ - mockUpQuery = new MockUp<Query>() { - String modelCustomizationUuid = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("modelCustomizationUuid")) modelCustomizationUuid = (String)val; - return this.getMockInstance(); - } - - @Mock - public List<VfModuleCustomization> list() { - if ("nil".equals(modelCustomizationUuid)) return null; - if ("multi".equals(modelCustomizationUuid)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(modelCustomizationUuid)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(modelCustomizationUuid)) throw new NullPointerException(); - - VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); - vfModuleCustomization.setVfModuleModelUuid(modelCustomizationUuid); - return Arrays.asList(vfModuleCustomization); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - - List<VfModuleCustomization> vmcl = cd.getVfModuleCustomizationByVnfModuleCustomizationUuid("4993493"); - assertEquals(1, vmcl.size()); - assertEquals("4993493", vmcl.get(0).getVfModuleModelUuid()); - - vmcl = cd.getVfModuleCustomizationByVnfModuleCustomizationUuid("nil"); - assertEquals(0, vmcl.size()); - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.HibernateException.class); - vmcl = cd.getVfModuleCustomizationByVnfModuleCustomizationUuid("he"); - } catch (org.hibernate.HibernateException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(NullPointerException.class); - vmcl = cd.getVfModuleCustomizationByVnfModuleCustomizationUuid("npe"); - } catch (NullPointerException e) { - // noop - } - } - - @Test - public void getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionIdTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<VnfResourceCustomization> list() { - VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); - return Arrays.asList(vnfResourceCustomization); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - assertTrue(hql.contains("SELECT vrc FROM VnfResourceCustomization as vrc WHERE vrc.vnfResourceModelUuid IN (SELECT vr.modelUuid FROM VnfResource vr WHERE vr.modelUuid = :modelVersionId)AND vrc.modelInstanceName = :modelCustomizationName")); - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - assertNotNull(cd.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId("modelCustomizationName","modelVersionId")); - - VnfResourceCustomization result = cd.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId("4993493", "test"); - assertNotNull(result); - } - - @Test - public void getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId_NullReturnTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<VnfResourceCustomization> list() { - return Arrays.asList(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - assertTrue(hql.contains("SELECT vrc FROM VnfResourceCustomization as vrc WHERE vrc.vnfResourceModelUuid IN (SELECT vr.modelUuid FROM VnfResource vr WHERE vr.modelUuid = :modelVersionId)AND vrc.modelInstanceName = :modelCustomizationName")); - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VnfResourceCustomization result = cd.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId("4993493", "test"); - assertNull(result); - } - @Test - public void getAllVfModuleCustomizationsStrTest(){ - mockUpQuery = new MockUp<Query>() { - String vrcMcu = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("vrc_mcu")) vrcMcu = (String)val; - return this.getMockInstance(); - } - - @Mock - public List<VnfResCustomToVfModuleCustom> list() { - if ("nil".equals(vrcMcu)) return null; - if ("multi".equals(vrcMcu)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(vrcMcu)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(vrcMcu)) throw new NullPointerException(); - - VnfResCustomToVfModuleCustom vnfResCustomToVfModuleCustom = new VnfResCustomToVfModuleCustom(); - vnfResCustomToVfModuleCustom.setVfModuleCustModelCustomizationUuid(vrcMcu); - return Arrays.asList(vnfResCustomToVfModuleCustom); - } - - @Mock - public Object uniqueResult() { - if ("nil".equals(vrcMcu)) return null; - if ("multi".equals(vrcMcu)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(vrcMcu)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(vrcMcu)) throw new NullPointerException(); - - VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); - vfModuleCustomization.setVfModuleModelUuid(vrcMcu); - return vfModuleCustomization; - } - - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - - @Mock - public VfModule getVfModuleByModelUuid(String modelUuid) { - return new VfModule(); - } - }; - - ArrayList<VfModuleCustomization> vmcl = cd.getAllVfModuleCustomizations("4993493"); - assertNotNull(vmcl); - assertEquals(1, vmcl.size()); - assertEquals("4993493", vmcl.get(0).getVfModuleModelUuid()); - - vmcl = cd.getAllVfModuleCustomizations("nil"); - assertNotNull(vmcl); - assertEquals(0, vmcl.size()); - - } - @Test - public void getVnfResourceByModelUuidTest(){ - mockUpQuery = new MockUp<Query>() { - String modelUuid = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("modelUuid")) modelUuid = (String)val; - return this.getMockInstance(); - } - - @Mock - public Object uniqueResult() { - if ("nil".equals(modelUuid)) return null; - if ("multi".equals(modelUuid)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(modelUuid)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(modelUuid)) throw new NullPointerException(); - - VnfResource vnfResource = new VnfResource(); - vnfResource.setModelUuid(modelUuid); - return vnfResource; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VnfResource vr = cd.getVnfResourceByModelUuid("4993493"); - assertEquals("4993493", vr.getModelUuid()); - - vr = cd.getVnfResourceByModelUuid("nil"); - assertNull(vr); - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.NonUniqueResultException.class); - vr = cd.getVnfResourceByModelUuid("multi"); - } catch (org.hibernate.NonUniqueResultException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.HibernateException.class); - vr = cd.getVnfResourceByModelUuid("he"); - } catch (org.hibernate.HibernateException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(NullPointerException.class); - vr = cd.getVnfResourceByModelUuid("npe"); - } catch (NullPointerException e) { - // noop - } - } - - @Test - public void getVnfResCustomToVfModuleTest(){ - mockUpQuery = new MockUp<Query>() { - String vfIdValue = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("vfIdValue")) vfIdValue = (String)val; - return this.getMockInstance(); - } - - @Mock - public Object uniqueResult() { - if ("nil".equals(vfIdValue)) return null; - if ("multi".equals(vfIdValue)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(vfIdValue)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(vfIdValue)) throw new NullPointerException(); - - VnfResCustomToVfModuleCustom vr = new VnfResCustomToVfModuleCustom(); - vr.setVfModuleCustModelCustomizationUuid(vfIdValue); - return vr; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VnfResCustomToVfModuleCustom vm = cd.getVnfResCustomToVfModule("4993493","test"); - assertEquals("test", vm.getVfModuleCustModelCustomizationUuid()); - - vm = vm = cd.getVnfResCustomToVfModule("4993493", "nil"); - assertNull(vm); - } - - @Test - public void getVfModulesForVnfResourceTest(){ - VnfResource vnfResource = new VnfResource(); - vnfResource.setModelUuid("48839"); - thrown.expect(Exception.class); - cd.getVfModulesForVnfResource(vnfResource); - } - @Test - public void getVfModulesForVnfResource2Test(){ - mockUpQuery = new MockUp<Query>() { - String vnfResourceModelUUId = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("vnfResourceModelUUId")) vnfResourceModelUUId = (String)val; - return this.getMockInstance(); - } - - @Mock - public List<VfModule> list() { - if ("nil".equals(vnfResourceModelUUId)) return null; - if ("multi".equals(vnfResourceModelUUId)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(vnfResourceModelUUId)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(vnfResourceModelUUId)) throw new NullPointerException(); - - VfModule vfModule = new VfModule(); - vfModule.setVnfResourceModelUUId(vnfResourceModelUUId); - return Arrays.asList(vfModule); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - List<VfModule> vm = cd.getVfModulesForVnfResource("4993493"); - assertNotNull(vm); - assertEquals(1, vm.size()); - assertEquals("4993493", vm.get(0).getVnfResourceModelUUId()); - - vm = cd.getVfModulesForVnfResource("nil"); - assertNotNull(vm); - assertEquals(0, vm.size()); - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.HibernateException.class); - cd.getVfModulesForVnfResource("he"); - } catch (org.hibernate.HibernateException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(NullPointerException.class); - cd.getVfModulesForVnfResource("npe"); - } catch (NullPointerException e) { - // noop - } - } - - @Test - public void getServiceByUuidTest(){ - mockUpQuery = new MockUp<Query>() { - String serviceModelInvariantUuid = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("serviceModelInvariantUuid")) serviceModelInvariantUuid = (String)val; - return this.getMockInstance(); - } - - @Mock - public Object uniqueResult() { - if ("nil".equals(serviceModelInvariantUuid)) return null; - if ("multi".equals(serviceModelInvariantUuid)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(serviceModelInvariantUuid)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(serviceModelInvariantUuid)) throw new NullPointerException(); - - Service service = new Service(); - service.setModelInvariantUUID(serviceModelInvariantUuid); - return service; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - Service s = cd.getServiceByUuid("4993493"); - assertEquals("4993493", s.getModelInvariantUUID()); - - s = cd.getServiceByUuid("nil"); - assertNull(s); - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.NonUniqueResultException.class); - s = cd.getServiceByUuid("multi"); - } catch (org.hibernate.NonUniqueResultException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.HibernateException.class); - s = cd.getServiceByUuid("he"); - } catch (org.hibernate.HibernateException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(NullPointerException.class); - s = cd.getServiceByUuid("npe"); - } catch (NullPointerException e) { - // noop - } - - - thrown.expect(Exception.class); - cd.getServiceByUuid("4993493"); - } - - @Test - public void getNetworkResourceById2Test(){ - mockUpQuery = new MockUp<Query>() { - Integer id = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("id")) id = (Integer)val; - return this.getMockInstance(); - } - - @Mock - public Object uniqueResult() { - if (id==null || -1 == id) return null; - if (-2 == id) throw new org.hibernate.NonUniqueResultException(2); - if (-3 == id) throw new org.hibernate.HibernateException("test case"); - if (-4 == id) throw new NullPointerException(); - - NetworkResource networkResource = new NetworkResource(); - networkResource.setModelUUID(Integer.toString(id)); - return networkResource; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - NetworkResource nr = cd.getNetworkResourceById(4993493); - assertEquals("4993493", nr.getModelUUID()); - - nr = cd.getNetworkResourceById(-1); - assertNull(nr); - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.NonUniqueResultException.class); - nr = cd.getNetworkResourceById(-2); - } catch (org.hibernate.NonUniqueResultException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.HibernateException.class); - nr = cd.getNetworkResourceById(-3); - } catch (org.hibernate.HibernateException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(NullPointerException.class); - nr = cd.getNetworkResourceById(-4); - } catch (NullPointerException e) { - // noop - } - } - - @Test - public void getNetworkResourceByIdTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public Object uniqueResult() { - VfModule vm = new VfModule(); - vm.setModelInvariantUuid("4993493"); - return vm; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VfModule vm = cd.getVfModuleTypeByUuid("4993493"); - assertEquals("4993493", vm.getModelInvariantUuid()); - } - - @Test - public void getNetworkResourceByIdNullTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public Object uniqueResult() { - return null; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VfModule vm = cd.getVfModuleTypeByUuid("4993493"); - assertNull(null); - } - - @Test - public void getNetworkResourceByIdNonUniqueTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public Object uniqueResult() { - throw new org.hibernate.NonUniqueResultException(2); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - thrown.expect(org.hibernate.NonUniqueResultException.class); - VfModule vm = cd.getVfModuleTypeByUuid("4993493"); - } - - @Test - public void getNetworkResourceByIdHibernateExceptionTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public Object uniqueResult() { - throw new org.hibernate.HibernateException("test case"); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - thrown.expect(org.hibernate.HibernateException.class); - VfModule vm = cd.getVfModuleTypeByUuid("4993493"); - } - - @Test - public void getNetworkResourceByIdExceptionTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public Object uniqueResult() { - throw new NullPointerException(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - thrown.expect(NullPointerException.class); - VfModule vm = cd.getVfModuleTypeByUuid("4993493"); - } - - @Test - public void isEmptyOrNullTest(){ - boolean is = cd.isEmptyOrNull("4993493"); - assertFalse(is); - } - @Test - public void getSTRTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<ServiceToResourceCustomization> list() { - ServiceToResourceCustomization vnfResourceCustomization = new ServiceToResourceCustomization(); - return Arrays.asList(vnfResourceCustomization); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - List<ServiceToResourceCustomization> str = cd.getSTR("4993493", "test", "vnf"); - assertFalse(str.isEmpty()); - - } - @Test - public void getVRCtoVFMCTest(){ - mockUpQuery = new MockUp<Query>() { - String vrcMcu = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("vrc_mcu")) vrcMcu = (String)val; - return this.getMockInstance(); - } - - @Mock - public List<VnfResCustomToVfModuleCustom> list() { - if ("nil".equals(vrcMcu)) return null; - if ("multi".equals(vrcMcu)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(vrcMcu)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(vrcMcu)) throw new NullPointerException(); - - VnfResCustomToVfModuleCustom vnfResCustomToVfModuleCustom = new VnfResCustomToVfModuleCustom(); - vnfResCustomToVfModuleCustom.setVfModuleCustModelCustomizationUuid(vrcMcu); - return Arrays.asList(vnfResCustomToVfModuleCustom); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - List<VnfResCustomToVfModuleCustom> vrCtoVFMC = cd.getVRCtoVFMC("", "null"); - assertNull(vrCtoVFMC); - - vrCtoVFMC = cd.getVRCtoVFMC("4993493", "388492"); - assertNotNull(vrCtoVFMC); - assertEquals(1, vrCtoVFMC.size()); - assertEquals("4993493", vrCtoVFMC.get(0).getVfModuleCustModelCustomizationUuid()); - - vrCtoVFMC = cd.getVRCtoVFMC("nil", "388492"); - assertNotNull(vrCtoVFMC); - assertEquals(0, vrCtoVFMC.size()); - - } - @Test - public void getTempNetworkHeatTemplateLookupTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<TempNetworkHeatTemplateLookup> list() { - TempNetworkHeatTemplateLookup vnfResourceCustomization = new TempNetworkHeatTemplateLookup(); - return Arrays.asList(vnfResourceCustomization); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - List<TempNetworkHeatTemplateLookup> tempNetworkHeatTemplateLookup = cd.getTempNetworkHeatTemplateLookup("4993493"); - assertFalse(tempNetworkHeatTemplateLookup.isEmpty()); - } - - @Test - public void getAllNetworksByServiceModelUuidTest(){ - mockUpQuery = new MockUp<Query>() { - String smu = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("smu")) smu = (String)val; - return this.getMockInstance(); - } - - @Mock - public List<ServiceToResourceCustomization> list() { - if ("nil".equals(smu)) return null; - if ("multi".equals(smu)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(smu)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(smu)) throw new NullPointerException(); - - ServiceToResourceCustomization src = new ServiceToResourceCustomization(); - src.setServiceModelUUID(smu); - return Arrays.asList(src); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - - @Mock - public List<NetworkResourceCustomization> getAllNetworksByNetworkModelCustomizationUuid(String networkModelCustomizationUuid) { - NetworkResourceCustomization nrc = new NetworkResourceCustomization(); - nrc.setNetworkResourceModelUuid(networkModelCustomizationUuid); - return Arrays.asList(nrc); - } - }; - - List<NetworkResourceCustomization> nrcl = cd.getAllNetworksByServiceModelUuid("4993493"); - assertNotNull(nrcl); - assertEquals(1, nrcl.size()); - - nrcl = cd.getAllNetworksByServiceModelUuid("nil"); - assertNotNull(nrcl); - assertEquals(0, nrcl.size()); -/* - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.NonUniqueResultException.class); - vm = cd.getVfModuleType("type", "multi"); - } catch (org.hibernate.NonUniqueResultException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.HibernateException.class); - vm = cd.getVfModuleType("type", "he"); - } catch (org.hibernate.HibernateException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(NullPointerException.class); - vm = cd.getVfModuleType("type", "npe"); - } catch (NullPointerException e) { - // noop - } - - assertEquals(cd.getAllNetworksByServiceModelUuid("4993493").size(), 0); - */ - } - - @Test - public void getAllNetworksByServiceModelInvariantUuidTest(){ - mockUpQuery = new MockUp<Query>() { - String serviceModelInvariantUuid = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("serviceModelInvariantUuid")) serviceModelInvariantUuid = (String)val; - return this.getMockInstance(); - } - - @Mock - public List<Service> list() { - if ("nil".equals(serviceModelInvariantUuid)) return new ArrayList<Service>(); - if ("multi".equals(serviceModelInvariantUuid)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(serviceModelInvariantUuid)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(serviceModelInvariantUuid)) throw new NullPointerException(); - - Service nrc = new Service(); - nrc.setModelInvariantUUID(serviceModelInvariantUuid); - nrc.setModelUUID(serviceModelInvariantUuid); - return Arrays.asList(nrc); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - - @Mock - public List<NetworkResourceCustomization> getAllNetworksByServiceModelUuid(String serviceModelUuid) { - NetworkResourceCustomization nrc = new NetworkResourceCustomization(); - nrc.setNetworkResourceModelUuid(serviceModelUuid); - return Arrays.asList(nrc); - } - }; - - List<NetworkResourceCustomization> nrcl = cd.getAllNetworksByServiceModelInvariantUuid("4993493"); - assertNotNull(nrcl); - assertEquals(1, nrcl.size()); - assertEquals("4993493", nrcl.get(0).getNetworkResourceModelUuid()); - - nrcl = cd.getAllNetworksByServiceModelInvariantUuid("nil"); - assertNotNull(nrcl); - assertEquals(0, nrcl.size()); - } - @Test - public void getAllNetworksByServiceModelInvariantUuid2Test(){ - mockUpQuery = new MockUp<Query>() { - String serviceModelInvariantUuid = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("serviceModelInvariantUuid")) serviceModelInvariantUuid = (String)val; - return this.getMockInstance(); - } - - @Mock - public List<Service> list() { - if ("nil".equals(serviceModelInvariantUuid)) return new ArrayList<Service>(); - if ("multi".equals(serviceModelInvariantUuid)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(serviceModelInvariantUuid)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(serviceModelInvariantUuid)) throw new NullPointerException(); - - Service service = new Service(); - service.setModelInvariantUUID(serviceModelInvariantUuid); - service.setModelUUID(serviceModelInvariantUuid); - return Arrays.asList(service); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - - @Mock - public List<NetworkResourceCustomization> getAllNetworksByServiceModelUuid(String serviceModelUuid) { - NetworkResourceCustomization nrc = new NetworkResourceCustomization(); - nrc.setModelCustomizationUuid(serviceModelUuid); - return Arrays.asList(nrc); - } - }; - - List<NetworkResourceCustomization> nrcl = cd.getAllNetworksByServiceModelInvariantUuid("4993493","test"); - assertNotNull(nrcl); - assertEquals(1, nrcl.size()); - assertEquals("4993493", nrcl.get(0).getModelCustomizationUuid()); - - nrcl = cd.getAllNetworksByServiceModelInvariantUuid("nil","test"); - assertNotNull(nrcl); - assertEquals(0, nrcl.size()); - } - - @Test - public void getAllNetworksByNetworkModelCustomizationUuidTest(){ - mockUpQuery = new MockUp<Query>() { - String networkModelCustomizationUuid = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("networkModelCustomizationUuid")) networkModelCustomizationUuid = (String)val; - return this.getMockInstance(); - } - - @Mock - public List<NetworkResourceCustomization> list() { - if ("nil".equals(networkModelCustomizationUuid)) return new ArrayList<NetworkResourceCustomization>(); - if ("multi".equals(networkModelCustomizationUuid)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(networkModelCustomizationUuid)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(networkModelCustomizationUuid)) throw new NullPointerException(); - - NetworkResourceCustomization nrc = new NetworkResourceCustomization(); - nrc.setNetworkResourceModelUuid(networkModelCustomizationUuid); - return Arrays.asList(nrc); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - - @Mock - public NetworkResource getNetworkResourceById(String id) { - NetworkResource nr = new NetworkResource (); - return nr; - } - }; - - List<NetworkResourceCustomization> nrcl = cd.getAllNetworksByNetworkModelCustomizationUuid("4993493"); - assertNotNull(nrcl); - assertEquals(1, nrcl.size()); - assertEquals("4993493", nrcl.get(0).getNetworkResourceModelUuid()); - - nrcl = cd.getAllNetworksByNetworkModelCustomizationUuid("nil"); - assertNotNull(nrcl); - assertEquals(0, nrcl.size()); - } - - @Test - public void getAllNetworksByNetworkTypeTest(){ - mockUpQuery = new MockUp<Query>() { - String networkResourceId = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("networkResourceId")) networkResourceId = (String)val; - return this.getMockInstance(); - } - - @Mock - public List<NetworkResourceCustomization> list() { - if ("nil".equals(networkResourceId)) return null; - if ("multi".equals(networkResourceId)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(networkResourceId)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(networkResourceId)) throw new NullPointerException(); - - NetworkResourceCustomization nrc = new NetworkResourceCustomization(); - nrc.setNetworkResourceModelUuid(networkResourceId); - return Arrays.asList(nrc); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - - @Mock - public NetworkResource getNetworkResource(String networkType) { - if ("nil".equals(networkType)) return null; - - NetworkResource nr = new NetworkResource(); - nr.setNeutronNetworkType(networkType); - return nr; - } - }; - - List<NetworkResourceCustomization> nrcl = cd.getAllNetworksByNetworkType("4993493"); - assertNotNull(nrcl); - assertEquals(1, nrcl.size()); - assertEquals("4993493", nrcl.get(0).getNetworkType()); - - nrcl = cd.getAllNetworksByNetworkType("nil"); - assertNotNull(nrcl); - assertEquals(0, nrcl.size()); - } - @Test - public void getAllVfmcForVrcTest(){ - VnfResourceCustomization re = new VnfResourceCustomization(); - re.setModelCustomizationUuid("377483"); - thrown.expect(Exception.class); - cd.getAllVfmcForVrc(re); - } - @Test - public void getAllVnfsByServiceModelUuidTest(){ - thrown.expect(Exception.class); - cd.getAllVnfsByServiceModelUuid("4993493"); - } - @Test - public void getAllVnfsByServiceModelInvariantUuidTest(){ - thrown.expect(Exception.class); - cd.getAllVnfsByServiceModelInvariantUuid("4993493"); - } - @Test - public void getAllVnfsByServiceModelInvariantUuid2Test(){ - thrown.expect(Exception.class); - cd.getAllVnfsByServiceModelInvariantUuid("4993493","test"); - } - @Test - public void getAllVnfsByServiceNameTest(){ - thrown.expect(Exception.class); - cd.getAllVnfsByServiceName("4993493","test"); - } - @Test - public void getAllVnfsByServiceName2Test(){ - thrown.expect(Exception.class); - cd.getAllVnfsByServiceName("4993493"); - } - @Test - public void getAllVnfsByVnfModelCustomizationUuidTest(){ - thrown.expect(Exception.class); - cd.getAllVnfsByVnfModelCustomizationUuid("4993493"); - } - @Test - public void getAllAllottedResourcesByServiceModelUuidTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<ServiceToResourceCustomization> list() { - ServiceToResourceCustomization vnfResourceCustomization = new ServiceToResourceCustomization(); - return Arrays.asList(vnfResourceCustomization); - } - }; - mockUpQuery2 = new MockUp<Query>() { - - @Mock - public List<AllottedResourceCustomization> list() { - AllottedResourceCustomization vnfResourceCustomization = new AllottedResourceCustomization(); - return Arrays.asList(vnfResourceCustomization); - } - }; - mockUpQuery3 = new MockUp<Query>() { - - @Mock - public List<AllottedResource> list() { - AllottedResource vnfResourceCustomization = new AllottedResource(); - return Arrays.asList(vnfResourceCustomization); - } - }; - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - if(hql.contains("ServiceToResourceCustomization")){ - return mockUpQuery.getMockInstance(); - - }else if(hql.contains("AllottedResource " )){ - return mockUpQuery3.getMockInstance(); - - } else{ - return mockUpQuery2.getMockInstance(); - } - - - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - List<AllottedResourceCustomization> allAllottedResourcesByServiceModelUuid = cd.getAllAllottedResourcesByServiceModelUuid("4993493"); - assertFalse(allAllottedResourcesByServiceModelUuid.isEmpty()); - } - @Test - public void getAllAllottedResourcesByServiceModelInvariantUuidTest(){ - thrown.expect(Exception.class); - cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493"); - } - @Test - public void getAllAllottedResourcesByServiceModelInvariantUuid2Test(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<ServiceToResourceCustomization> list() { - ServiceToResourceCustomization vnfResourceCustomization = new ServiceToResourceCustomization(); - return Arrays.asList(vnfResourceCustomization); - } - }; - mockUpQuery2 = new MockUp<Query>() { - - @Mock - public List<AllottedResourceCustomization> list() { - AllottedResourceCustomization vnfResourceCustomization = new AllottedResourceCustomization(); - return Arrays.asList(vnfResourceCustomization); - } - }; - mockUpQuery3 = new MockUp<Query>() { - - @Mock - public List<AllottedResource> list() { - AllottedResource vnfResourceCustomization = new AllottedResource(); - return Arrays.asList(vnfResourceCustomization); - } - }; - mockUpQuery4 = new MockUp<Query>() { - - @Mock - public List<Service> list() { - Service vnfResourceCustomization = new Service(); - return Arrays.asList(vnfResourceCustomization); - } - }; - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - if(hql.contains("ServiceToResourceCustomization")){ - return mockUpQuery.getMockInstance(); - - }else if(hql.contains("AllottedResource " )){ - return mockUpQuery3.getMockInstance(); - - } else if(hql.contains(" Service ")){ - return mockUpQuery4.getMockInstance(); - }else{ - return mockUpQuery2.getMockInstance(); - } - - - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - - List<AllottedResourceCustomization> allottedResourceCustomizations = cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493", "test"); - assertFalse(allottedResourceCustomizations.isEmpty()); - } - @Test - public void getAllAllottedResourcesByArModelCustomizationUuidTest(){ - thrown.expect(Exception.class); - cd.getAllAllottedResourcesByArModelCustomizationUuid("4993493"); - } - @Test - public void getAllottedResourceByModelUuidTest(){ - thrown.expect(Exception.class); - cd.getAllottedResourceByModelUuid("4993493"); - } - @Test - public void getAllResourcesByServiceModelUuidTest(){ - thrown.expect(Exception.class); - cd.getAllResourcesByServiceModelUuid("4993493"); - } - @Test - public void getAllResourcesByServiceModelInvariantUuidTest(){ - thrown.expect(Exception.class); - cd.getAllResourcesByServiceModelInvariantUuid("4993493"); - } - - @Test - public void getAllResourcesByServiceModelInvariantUuid2Test(){ - thrown.expect(Exception.class); - cd.getAllResourcesByServiceModelInvariantUuid("4993493","test"); - } - @Test - public void getSingleNetworkByModelCustomizationUuidTest(){ - thrown.expect(Exception.class); - cd.getSingleNetworkByModelCustomizationUuid("4993493"); - } - @Test - public void getSingleAllottedResourceByModelCustomizationUuidTest(){ - thrown.expect(Exception.class); - cd.getSingleAllottedResourceByModelCustomizationUuid("4993493"); - } - @Test - public void getVfModuleRecipeTest(){ - thrown.expect(Exception.class); - cd.getVfModuleRecipe("4993493","test","get"); - } - @Test - public void getVfModuleTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<VfModule> list() { - VfModule vnfResourceCustomization = new VfModule(); - return Arrays.asList(vnfResourceCustomization); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - List<VfModule> vfModule = cd.getVfModule("4993493", "test", "get", "v2", "vnf"); - assertFalse(vfModule.isEmpty()); - } - @Test - public void getVnfComponentsRecipeTest(){ - thrown.expect(Exception.class); - cd.getVnfComponentsRecipe("4993493","test","v2","vnf","get","3992"); - } - @Test - public void getVnfComponentsRecipeByVfModuleTest(){ - List <VfModule> resultList = new ArrayList<>(); - VfModule m = new VfModule(); - resultList.add(m); - thrown.expect(Exception.class); - cd.getVnfComponentsRecipeByVfModule(resultList,"4993493"); - } - @Test - public void getAllVnfResourcesTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<VnfResource> list() { - VnfResource vnfResourceCustomization = new VnfResource(); - return Arrays.asList(vnfResourceCustomization); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - assertTrue(hql.contains("FROM VnfResource")); - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - List<VnfResource> allVnfResources = cd.getAllVnfResources(); - assertFalse(allVnfResources.isEmpty()); - } - @Test - public void getVnfResourcesByRoleTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<VnfResource> list() { - VnfResource vnfResourceCustomization = new VnfResource(); - return Arrays.asList(vnfResourceCustomization); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - assertTrue(hql.contains("FROM VnfResource WHERE vnfRole = :vnfRole")); - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - List<VnfResource> vnfResourcesByRole = cd.getVnfResourcesByRole("4993493"); - assertFalse(vnfResourcesByRole.isEmpty()); - } - @Test - public void getVnfResourceCustomizationsByRoleTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<VnfResourceCustomization> list() { - VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); - return Arrays.asList(vnfResourceCustomization); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - assertTrue(hql.contains("FROM VnfResourceCustomization WHERE nfRole = :vnfRole")); - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - List<VnfResourceCustomization> vnfResourceCustomizationsByRole = cd.getVnfResourceCustomizationsByRole("4993493"); - assertFalse(vnfResourceCustomizationsByRole.isEmpty()); - } - @Test - public void getAllNetworkResourcesTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<NetworkResource> list() { - NetworkResource vnfResourceCustomization = new NetworkResource(); - return Arrays.asList(vnfResourceCustomization); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - assertTrue(hql.contains("FROM NetworkResource")); - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - List<NetworkResource> allNetworkResources = cd.getAllNetworkResources(); - assertFalse(allNetworkResources.isEmpty()); - } - @Test - public void getAllNetworkResourceCustomizationsTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<NetworkResourceCustomization> list() { - NetworkResourceCustomization vnfResourceCustomization = new NetworkResourceCustomization(); - return Arrays.asList(vnfResourceCustomization); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - assertTrue(hql.contains("FROM NetworkResourceCustomization")); - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - List<NetworkResourceCustomization> allNetworkResourceCustomizations = cd.getAllNetworkResourceCustomizations(); - assertFalse(allNetworkResourceCustomizations.isEmpty()); - } - @Test - public void getAllVfModulesTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<VfModule> list() { - VfModule vnfResourceCustomization = new VfModule(); - return Arrays.asList(vnfResourceCustomization); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - assertTrue(hql.contains("FROM VfModule")); - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - List<VfModule> allVfModules = cd.getAllVfModules(); - assertFalse(allVfModules.isEmpty()); - } - @Test - public void getAllVfModuleCustomizationsTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<VfModuleCustomization> list() { - VfModuleCustomization vnfResourceCustomization = new VfModuleCustomization(); - return Arrays.asList(vnfResourceCustomization); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - assertTrue(hql.contains("FROM VfModuleCustomization")); - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - List<VfModuleCustomization> allVfModuleCustomizations = cd.getAllVfModuleCustomizations(); - assertFalse(allVfModuleCustomizations.isEmpty()); - } - @Test - public void getAllHeatEnvironmentTest(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<HeatEnvironment> list() { - HeatEnvironment vnfResourceCustomization = new HeatEnvironment(); - return Arrays.asList(vnfResourceCustomization); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - assertTrue(hql.contains("FROM HeatEnvironment")); - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - List<HeatEnvironment> allHeatEnvironment = cd.getAllHeatEnvironment(); - assertFalse(allHeatEnvironment.isEmpty()); - } - @Test - public void getHeatEnvironment2Test(){ - thrown.expect(Exception.class); - cd.getHeatEnvironment(4993493); - } - @Test - public void getNestedTemplatesTest(){ - thrown.expect(Exception.class); - cd.getNestedTemplates(4993493); - } - @Test - public void getNestedTemplates2Test(){ - thrown.expect(Exception.class); - cd.getNestedTemplates("4993493"); - } - @Test - public void getHeatFilesTest(){ - thrown.expect(Exception.class); - cd.getHeatFiles(4993493); - } - @Test - public void getVfModuleToHeatFilesEntryTest(){ - thrown.expect(Exception.class); - cd.getVfModuleToHeatFilesEntry("4993493","49959499"); - } - @Test - public void getServiceToResourceCustomization(){ - thrown.expect(Exception.class); - cd.getServiceToResourceCustomization("4993493","599349","49900"); - } - @Test - public void getHeatFilesForVfModuleTest(){ - thrown.expect(Exception.class); - cd.getHeatFilesForVfModule("4993493"); - } - @Test - public void getHeatTemplateTest(){ - thrown.expect(Exception.class); - cd.getHeatTemplate("4993493","test","heat"); - } - - @Test - public void saveHeatTemplateTest(){ - HeatTemplate heat = new HeatTemplate(); - Set <HeatTemplateParam> paramSet = new HashSet<>(); - thrown.expect(Exception.class); - cd.saveHeatTemplate(heat,paramSet); - } - @Test - public void getHeatEnvironmentTest(){ - - mockUpQuery = new MockUp<Query>() { - - @Mock - public Object uniqueResult() throws Exception { - return null; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - assertEquals(cd.getHeatEnvironment("4993493","test","heat"), null); - } - @Test - public void getHeatEnvironment3Test(){ - thrown.expect(Exception.class); - cd.getHeatEnvironment("4993493","test"); - } - @Test - public void saveHeatEnvironmentTest(){ - HeatEnvironment en = new HeatEnvironment(); - thrown.expect(Exception.class); - cd.saveHeatEnvironment(en); - } - @Test - public void saveHeatTemplate2Test(){ - HeatTemplate heat = new HeatTemplate(); - thrown.expect(Exception.class); - cd.saveHeatTemplate(heat); - } - @Test - public void saveHeatFileTest(){ - HeatFiles hf = new HeatFiles(); - thrown.expect(Exception.class); - cd.saveHeatFile(hf); - } - @Test - public void saveVnfRecipeTest(){ - VnfRecipe vr = new VnfRecipe(); - thrown.expect(Exception.class); - cd.saveVnfRecipe(vr); - } - @Test - public void saveVnfComponentsRecipe(){ - VnfComponentsRecipe vr = new VnfComponentsRecipe(); - thrown.expect(Exception.class); - cd.saveVnfComponentsRecipe(vr); - } - @Test - public void saveOrUpdateVnfResourceTest(){ - VnfResource vr = new VnfResource(); - thrown.expect(Exception.class); - cd.saveOrUpdateVnfResource(vr); - } - @Test - public void saveVnfResourceCustomizationTest(){ - VnfResourceCustomization vr = new VnfResourceCustomization(); - thrown.expect(Exception.class); - cd.saveVnfResourceCustomization(vr); - } - @Test - public void saveAllottedResourceCustomizationTest(){ - AllottedResourceCustomization arc = new AllottedResourceCustomization(); - thrown.expect(Exception.class); - cd.saveAllottedResourceCustomization(arc); - } - @Test - public void saveAllottedResourceTest(){ - AllottedResource ar = new AllottedResource(); - thrown.expect(Exception.class); - cd.saveAllottedResource(ar); - } - @Test - public void saveNetworkResourceTest() throws RecordNotFoundException { - NetworkResource nr = new NetworkResource(); - thrown.expect(Exception.class); - cd.saveNetworkResource(nr); - } - @Test - public void saveToscaCsarTest()throws RecordNotFoundException { - ToscaCsar ts = new ToscaCsar(); - thrown.expect(Exception.class); - cd.saveToscaCsar(ts); - } - @Test - public void getToscaCsar(){ - thrown.expect(Exception.class); - cd.getToscaCsar("4993493"); - } - @Test - public void saveTempNetworkHeatTemplateLookupTest(){ - TempNetworkHeatTemplateLookup t = new TempNetworkHeatTemplateLookup(); - thrown.expect(Exception.class); - cd.saveTempNetworkHeatTemplateLookup(t); - } - @Test - public void saveVnfResourceToVfModuleCustomizationTest() throws RecordNotFoundException { - VnfResourceCustomization v =new VnfResourceCustomization(); - VfModuleCustomization vm = new VfModuleCustomization(); - thrown.expect(Exception.class); - cd.saveVnfResourceToVfModuleCustomization(v, vm); - } - @Test - public void saveNetworkResourceCustomizationTest() throws RecordNotFoundException { - NetworkResourceCustomization nrc = new NetworkResourceCustomization(); - thrown.expect(Exception.class); - cd.saveNetworkResourceCustomization(nrc); - } - - @Test - public void saveServiceToNetworksTest(){ - AllottedResource ar = new AllottedResource(); - thrown.expect(Exception.class); - cd.saveAllottedResource(ar); - } - @Test - public void saveServiceToResourceCustomizationTest(){ - ServiceToResourceCustomization ar = new ServiceToResourceCustomization(); - thrown.expect(Exception.class); - cd.saveServiceToResourceCustomization(ar); - } - @Test - public void saveServiceTest(){ - Service ar = new Service(); - thrown.expect(Exception.class); - cd.saveService(ar); - } - @Test - public void saveOrUpdateVfModuleTest(){ - VfModule ar = new VfModule(); - thrown.expect(Exception.class); - cd.saveOrUpdateVfModule(ar); - } - @Test - public void saveOrUpdateVfModuleCustomizationTest(){ - VfModuleCustomization ar = new VfModuleCustomization(); - thrown.expect(Exception.class); - cd.saveOrUpdateVfModuleCustomization(ar); - } - - @Test - public void getNestedHeatTemplateTest(){ - thrown.expect(Exception.class); - cd.getNestedHeatTemplate(101,201); - } - @Test - public void getNestedHeatTemplate2Test(){ - thrown.expect(Exception.class); - cd.getNestedHeatTemplate("1002","1002"); - } - @Test - public void saveNestedHeatTemplateTest(){ - HeatTemplate ar = new HeatTemplate(); - thrown.expect(Exception.class); - cd.saveNestedHeatTemplate("1001",ar,"test"); - } - @Test - public void getHeatFiles2Test(){ - VfModuleCustomization ar = new VfModuleCustomization(); - thrown.expect(Exception.class); - cd.getHeatFiles(101,"test","1001","v2"); - } - @Test - public void getHeatFiles3Test(){ - VfModuleCustomization ar = new VfModuleCustomization(); - thrown.expect(Exception.class); - cd.getHeatFiles("200192"); - } - @Test - public void saveHeatFilesTest(){ - HeatFiles ar = new HeatFiles(); - thrown.expect(Exception.class); - cd.saveHeatFiles(ar); - } - @Test - public void saveVfModuleToHeatFilesTest(){ - HeatFiles ar = new HeatFiles(); - thrown.expect(Exception.class); - cd.saveVfModuleToHeatFiles("3772893",ar); - } - @Test - public void getNetworkResourceByModelUuidTest(){ - - cd.getNetworkResourceByModelUuid("3899291"); - } - @Test - public void getNetworkRecipeTest(){ - thrown.expect(Exception.class); - cd.getNetworkRecipe("test","test1","test2"); - } - @Test - public void getNetworkRecipe2Test(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<NetworkRecipe> list() { - NetworkRecipe heatTemplate = new NetworkRecipe(); - return Arrays.asList(heatTemplate); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - NetworkRecipe networkRecipe = cd.getNetworkRecipe("test","test1");assertNotNull(networkRecipe); - assertNotNull(networkRecipe); - - } - @Test - public void getNetworkResourceByModelCustUuidTest(){ - - cd.getNetworkResourceByModelCustUuid("test"); - } - - @Test - public void getVnfComponentsRecipeByVfModuleModelUUIdTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<VnfComponentsRecipe> list() { - VnfComponentsRecipe heatTemplate = new VnfComponentsRecipe(); - return Arrays.asList(heatTemplate); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - VnfComponentsRecipe vnfComponentsRecipeByVfModuleModelUUId = cd.getVnfComponentsRecipeByVfModuleModelUUId("test1", "test2", "test3"); - assertNotNull(vnfComponentsRecipeByVfModuleModelUUId); - } - @Test - public void getVnfComponentRecipesTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<VnfComponentsRecipe> list() { - VnfComponentsRecipe heatTemplate = new VnfComponentsRecipe(); - return Arrays.asList(heatTemplate); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - List<VnfComponentsRecipe> test = cd.getVnfComponentRecipes("test"); - assertNotNull(test); - assertFalse(test.isEmpty()); - } - @Test - public void saveOrUpdateVnfComponentTest(){ - VnfComponent ar = new VnfComponent(); - thrown.expect(Exception.class); - cd.saveOrUpdateVnfComponent(ar); - } - - @Test - public void getVfModule2Test(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<VfModule> list() { - VfModule heatTemplate = new VfModule(); - return Arrays.asList(heatTemplate); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - VfModule test = cd.getVfModule("test"); - assertNotNull(test); - } - @Test - public void getVfModuleByModelUUIDTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<VfModule> list() { - VfModule heatTemplate = new VfModule(); - return Arrays.asList(heatTemplate); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VfModule test = cd.getVfModuleByModelUUID("test"); - assertNotNull(test); - } - @Test - public void getServiceRecipeByModelUUIDTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<ServiceRecipe> list() { - ServiceRecipe heatTemplate = new ServiceRecipe(); - return Arrays.asList(heatTemplate); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - Assert.assertNotNull(cd.getServiceRecipeByModelUUID("test1", "test2")); - } - @Test - public void getModelRecipeTest(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<Object> list() { - return new ArrayList(); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - Assert.assertNull(cd.getModelRecipe("test1", "test2", "test3")); - } - @Test - @Ignore - public void healthCheck(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<HeatTemplate> list() { - HeatTemplate heatTemplate = new HeatTemplate(); - return Arrays.asList(heatTemplate); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createSQLQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - assertNotNull(cd.healthCheck()); - } - @Test - public void executeQuerySingleRow(){ - VnfComponent ar = new VnfComponent(); - HashMap<String, String> variables = new HashMap<>(); - thrown.expect(Exception.class); - cd.executeQuerySingleRow("tets",variables,false); - } - - @Test - public void executeQueryMultipleRows(){ - HashMap<String, String> variables = new HashMap<>(); - - mockUpQuery = new MockUp<Query>() { - @Mock - public List<HeatTemplate> list() { - HeatTemplate heatTemplate = new HeatTemplate(); - return Arrays.asList(heatTemplate); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - - List<Object> select = cd.executeQueryMultipleRows("select", variables, false); - assertFalse(select.isEmpty()); - } - - @Test - public void getArRecipeByNameVersion(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<ArRecipe> list() { - ArRecipe arRecipe = new ArRecipe(); - return Arrays.asList(arRecipe); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - assertNotNull(cd.getArRecipeByNameVersion("select","variables","String")); - } - @Test - public void getVnfComponentsRecipe(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<VnfComponentsRecipe> list() { - VnfComponentsRecipe heatTemplate = new VnfComponentsRecipe(); - return Arrays.asList(heatTemplate); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - assertNotNull(cd.getVnfComponentsRecipe("vnfType","vnfComponentType","action","serviceType")); - } - @Test - public void getNetworkRecipeByNameVersion(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<NetworkRecipe> list() { - NetworkRecipe heatTemplate = new NetworkRecipe(); - return Arrays.asList(heatTemplate); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - assertNotNull(cd.getNetworkRecipeByNameVersion("modelName","modelVersion","action")); - } - @Test - public void saveOrUpdateVfModuleCustomization(){ - mockUpQuery = new MockUp<Query>() { - @Mock - public List<NetworkRecipe> list() { - NetworkRecipe heatTemplate = new NetworkRecipe(); - return Arrays.asList(heatTemplate); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); - vfModuleCustomization.setHeatEnvironmentArtifactUuid("HeatEnvironmentArtifactUuid"); - vfModuleCustomization.setVolEnvironmentArtifactUuid("VolEnvironmentArtifactUuid"); - vfModuleCustomization.setVfModuleModelUuid("VfModuleModelUuid"); - vfModuleCustomization.setModelCustomizationUuid("ModelCustomizationUuid"); - cd.saveOrUpdateVfModuleCustomization(vfModuleCustomization); - } - @Test - public void saveServiceToNetworks(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<Service> list() { - Service service = new Service(); - service.setModelUUID("123-uuid"); - return Arrays.asList(service); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - ServiceToNetworks serviceToNetworks = new ServiceToNetworks(); - cd.saveServiceToNetworks(serviceToNetworks); - } - @Test - public void saveVfModuleToHeatFiles() { - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<Service> list() { - Service service = new Service(); - service.setModelUUID("123-uuid"); - return Arrays.asList(service); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VfModuleToHeatFiles vfModuleToHeatFiles = new VfModuleToHeatFiles(); - - cd.saveVfModuleToHeatFiles(vfModuleToHeatFiles); - } - @Test - public void saveTempNetworkHeatTemplateLookup() { - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<Service> list() { - Service service = new Service(); - service.setModelUUID("123-uuid"); - return Arrays.asList(service); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - TempNetworkHeatTemplateLookup tempNetworkHeatTemplateLookup = new TempNetworkHeatTemplateLookup(); - - cd.saveTempNetworkHeatTemplateLookup(tempNetworkHeatTemplateLookup); - } - @Test - public void getToscaCsarByServiceModelUUID() { - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<Service> list() { - Service service = new Service(); - service.setModelUUID("123-uuid"); - return Arrays.asList(service); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - - assertNull(cd.getToscaCsarByServiceModelUUID("uuid-123")); - cd.close(); - } - @Test - public void getVnfRecipeByNameVersion(){ - mockUpQuery = new MockUp<Query>() { - String version = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("version")) version = (String)val; - return this.getMockInstance(); - } - - @Mock - public List<VnfRecipe> list() { - if ("nil".equals(version)) return new ArrayList<VnfRecipe>(); - - VnfRecipe vnfRecipe = new VnfRecipe(); - vnfRecipe.setVersion(version); - return Arrays.asList(vnfRecipe); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VnfRecipe vf = cd.getVnfRecipeByNameVersion("modelName","modelVersion","action"); - assertEquals("modelVersion", vf.getVersion()); - - vf = cd.getVnfRecipeByNameVersion("modelName","nil","action"); - assertNull(vf); - } - - @Test - public void getVnfRecipeByModuleUuid(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<VnfRecipe> list() { - VnfRecipe vnfRecipe = new VnfRecipe(); - return Arrays.asList(vnfRecipe); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - assertNull(cd.getVnfRecipeByModuleUuid("vnfModelUuid","action")); - } - - @Test - public void getVfModuleType(){ - mockUpQuery = new MockUp<Query>() { - String version = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("version")) version = (String)val; - return this.getMockInstance(); - } - - @Mock - public Object uniqueResult() { - if ("nil".equals(version)) return null; - if ("multi".equals(version)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(version)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(version)) throw new NullPointerException(); - - VfModule vfModule = new VfModule(); - vfModule.setVersion(version); - return vfModule; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VfModule vm = cd.getVfModuleType("type","version"); - assertEquals("version", vm.getVersion()); - - vm = cd.getVfModuleType("type", "nil"); - assertNull(vm); - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.NonUniqueResultException.class); - vm = cd.getVfModuleType("type", "multi"); - } catch (org.hibernate.NonUniqueResultException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.HibernateException.class); - vm = cd.getVfModuleType("type", "he"); - } catch (org.hibernate.HibernateException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(NullPointerException.class); - vm = cd.getVfModuleType("type", "npe"); - } catch (NullPointerException e) { - // noop - } - - } - @Test - public void getVfModuleByModelInvariantUuidAndModelVersion(){ - mockUpQuery = new MockUp<Query>() { - String version = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("modelVersion")) version = (String)val; - return this.getMockInstance(); - } - - @Mock - public Object uniqueResult() { - if ("nil".equals(version)) return null; - if ("multi".equals(version)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(version)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(version)) throw new NullPointerException(); - - VfModule vfModule = new VfModule(); - vfModule.setVersion(version); - return vfModule; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VfModule vm = cd.getVfModuleByModelInvariantUuidAndModelVersion("modelInvariantUuid","modelVersion"); - assertEquals("modelVersion", vm.getVersion()); - - vm = cd.getVfModuleByModelInvariantUuidAndModelVersion("modelInvariantUuid","nil"); - assertNull(vm); - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.NonUniqueResultException.class); - vm = cd.getVfModuleByModelInvariantUuidAndModelVersion("modelInvariantUuid","multi"); - } catch (org.hibernate.NonUniqueResultException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.HibernateException.class); - vm = cd.getVfModuleByModelInvariantUuidAndModelVersion("modelInvariantUuid","he"); - } catch (org.hibernate.HibernateException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(NullPointerException.class); - vm = cd.getVfModuleByModelInvariantUuidAndModelVersion("modelInvariantUuid","npe"); - } catch (NullPointerException e) { - // noop - } - - } - - @Test - public void getVnfResourceCustomizationByModelCustomizationUuid(){ - mockUpQuery = new MockUp<Query>() { - String modelCustomizationUuid = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("modelCustomizationUuid")) modelCustomizationUuid = (String)val; - return this.getMockInstance(); - } - - @Mock - public Object uniqueResult() { - if ("nil".equals(modelCustomizationUuid)) return null; - if ("multi".equals(modelCustomizationUuid)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(modelCustomizationUuid)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(modelCustomizationUuid)) throw new NullPointerException(); - - VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); - vnfResourceCustomization.setModelCustomizationUuid(modelCustomizationUuid); - return vnfResourceCustomization; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - - @Mock - public VnfResource getVnfResourceByModelUuid(String modelUuid) { - VnfResource vr = new VnfResource(); - return vr; - } - - @Mock - public ArrayList<VfModuleCustomization> getAllVfModuleCustomizations(String vnfResourceCustomizationMCU) { - VfModuleCustomization vmc = new VfModuleCustomization(); - ArrayList<VfModuleCustomization> toRet = new ArrayList<VfModuleCustomization>(); - toRet.add(vmc); - return toRet; - } - }; - - VnfResourceCustomization vrc = cd.getVnfResourceCustomizationByModelCustomizationUuid("modelCustomizationUuid"); - assertEquals("modelCustomizationUuid", vrc.getModelCustomizationUuid()); - - vrc = cd.getVnfResourceCustomizationByModelCustomizationUuid("nil"); - assertNull(vrc); - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.NonUniqueResultException.class); - vrc = cd.getVnfResourceCustomizationByModelCustomizationUuid("multi"); - } catch (org.hibernate.NonUniqueResultException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.HibernateException.class); - vrc = cd.getVnfResourceCustomizationByModelCustomizationUuid("he"); - } catch (org.hibernate.HibernateException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(NullPointerException.class); - vrc = cd.getVnfResourceCustomizationByModelCustomizationUuid("npe"); - } catch (NullPointerException e) { - // noop - } - - } - - @Test - public void getVfModuleByModelCustomizationIdAndVersion(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<VnfRecipe> list() { - VnfRecipe vnfRecipe = new VnfRecipe(); - return Arrays.asList(vnfRecipe); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - assertNull(cd.getVfModuleByModelCustomizationIdAndVersion("modelCustomizationUuid","modelVersionId")); - } - @Test - public void getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId(){ - mockUpQuery = new MockUp<Query>() { - String modelInvariantId = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("modelInvariantId")) modelInvariantId = (String)val; - return this.getMockInstance(); - } - - @Mock - public Object uniqueResult() { - if ("nil".equals(modelInvariantId)) return null; - if ("multi".equals(modelInvariantId)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(modelInvariantId)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(modelInvariantId)) throw new NullPointerException(); - - VfModule vfModule = new VfModule(); - vfModule.setModelInvariantUuid(modelInvariantId); - return vfModule; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VfModule vm = cd.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId("modelCustomizationUuid","modelVersion","modelInvariantId"); - assertEquals("modelInvariantId", vm.getModelInvariantUuid()); - - vm = cd.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId("modelCustomizationUuid","modelVersion","nil"); - assertNull(vm); - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.NonUniqueResultException.class); - vm = cd.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId("modelCustomizationUuid","modelVersion","multi"); - } catch (org.hibernate.NonUniqueResultException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.HibernateException.class); - vm = cd.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId("modelCustomizationUuid","modelVersion","he"); - } catch (org.hibernate.HibernateException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(NullPointerException.class); - vm = cd.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId("modelCustomizationUuid","modelVersion", "npe"); - } catch (NullPointerException e) { - // noop - } - - } - - @Test - public void getVnfResourceCustomizationByModelInvariantId(){ - mockUpQuery = new MockUp<Query>() { - String modelInvariantId = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("modelInvariantId")) modelInvariantId = (String)val; - return this.getMockInstance(); - } - - @Mock - public Object uniqueResult() { - if ("nil".equals(modelInvariantId)) return null; - if ("multi".equals(modelInvariantId)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(modelInvariantId)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(modelInvariantId)) throw new NullPointerException(); - - VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); - vnfResourceCustomization.setVnfResourceModelUuid(modelInvariantId); - return vnfResourceCustomization; - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - public VnfResource getVnfResourceByModelUuid(String modelUuid) { - return new VnfResource(); - } - - @Mock - public ArrayList<VfModuleCustomization> getAllVfModuleCustomizations(String vnfResourceCustomizationMCU) { - return new ArrayList<VfModuleCustomization>(); - } - - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - VnfResourceCustomization vrc = cd.getVnfResourceCustomizationByModelInvariantId("modelInvariantId","modelVersion","modelCustomizationName"); - assertEquals("modelInvariantId", vrc.getVnfResourceModelUuid()); - - vrc = cd.getVnfResourceCustomizationByModelInvariantId("nil","modelVersion","modelCustomizationName"); - assertNull(vrc); - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.NonUniqueResultException.class); - vrc = cd.getVnfResourceCustomizationByModelInvariantId("multi","modelVersion","modelCustomizationName"); - } catch (org.hibernate.NonUniqueResultException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.HibernateException.class); - vrc = cd.getVnfResourceCustomizationByModelInvariantId("he","modelVersion","modelCustomizationName"); - } catch (org.hibernate.HibernateException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(NullPointerException.class); - vrc = cd.getVnfResourceCustomizationByModelInvariantId("npe","modelVersion","modelCustomizationName"); - } catch (NullPointerException e) { - // noop - } - } - - @Test - public void getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<VnfResourceCustomization> list() { - VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); - return Arrays.asList(vnfResourceCustomization); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - assertNotNull(cd.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId("modelCustomizationName","modelVersionId")); - } - - @Test - public void getNetworkResourceById3Test() { - mockUpQuery = new MockUp<Query>() { - String modelUuid = null; - - @Mock - public Query setParameter(String name, Object val) { - if (name.equals("model_uuid")) modelUuid = (String)val; - return this.getMockInstance(); - } - - @Mock - public List<NetworkResource> list() { - if ("nil".equals(modelUuid)) return null; - if ("multi".equals(modelUuid)) throw new org.hibernate.NonUniqueResultException(2); - if ("he".equals(modelUuid)) throw new org.hibernate.HibernateException("test case"); - if ("npe".equals(modelUuid)) throw new NullPointerException(); - - NetworkResource networkResource = new NetworkResource(); - networkResource.setModelUUID(modelUuid); - return Arrays.asList(networkResource); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; - - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - - NetworkResource nr = cd.getNetworkResourceById("test"); - assertEquals("test", nr.getModelUUID()); - - nr = cd.getNetworkResourceById("nil"); - assertNull(nr); - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.NonUniqueResultException.class); - nr = cd.getNetworkResourceById("multi"); - } catch (org.hibernate.NonUniqueResultException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(org.hibernate.HibernateException.class); - nr = cd.getNetworkResourceById("he"); - } catch (org.hibernate.HibernateException e) { - // noop - } - - try { - thrown = ExpectedException.none(); - thrown.expect(NullPointerException.class); - nr = cd.getNetworkResourceById("npe"); - } catch (NullPointerException e) { - // noop - } - } - -} 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 deleted file mode 100644 index da4e87806c..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatFilesTest.java +++ /dev/null @@ -1,87 +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.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/HeatTemplateTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatTemplateTest.java deleted file mode 100644 index cf79d5b0d1..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatTemplateTest.java +++ /dev/null @@ -1,89 +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.db.catalog.test; - - -import static org.junit.Assert.*; - -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.HashSet; -import java.util.UUID; - -import org.junit.Test; - -import org.openecomp.mso.db.catalog.beans.HeatTemplate; -import org.openecomp.mso.db.catalog.beans.HeatTemplateParam; - -/** - */ - -public class HeatTemplateTest { - - @Test - public final void heatTemplateTest () { - HeatTemplate heatTemplate = new HeatTemplate (); - heatTemplate.setTemplateBody ("testBody"); - heatTemplate.setArtifactUuid(UUID.randomUUID().toString()); - assertTrue (heatTemplate.getHeatTemplate ().equals ("testBody")); - assertTrue (heatTemplate.toString ().contains ("8 chars")); - heatTemplate.setTemplateBody (null); - assertTrue (heatTemplate.toString ().contains ("Not defined")); - HashSet<HeatTemplateParam> set = new HashSet<> (); - HeatTemplateParam param = new HeatTemplateParam (); - param.setParamName ("param name"); - param.setParamType ("string"); - param.setRequired (false); - param.setHeatTemplateArtifactUuid(UUID.randomUUID().toString()); - set.add (param); - HeatTemplateParam param2 = new HeatTemplateParam (); - param2.setParamName ("param 2"); - param2.setParamType ("string"); - param2.setRequired (true); - param2.setHeatTemplateArtifactUuid(UUID.randomUUID().toString()); - set.add (param2); - heatTemplate.setParameters (set); - String heatStr = heatTemplate.toString (); - assertTrue (heatStr.contains ("param name")); - assertTrue (heatStr.contains ("param 2(reqd)")); - - File tempFile; - try { - tempFile = File.createTempFile ("heatTemplate", "test"); - tempFile.deleteOnExit (); - try (Writer writer = new BufferedWriter (new OutputStreamWriter (new FileOutputStream (tempFile), - "utf-8"))) { - writer.write ("something\n"); - writer.write ("something2\n"); - } - heatTemplate.setTemplateBody(tempFile.getAbsolutePath ()); - assertTrue (heatTemplate.getHeatTemplate ().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 deleted file mode 100644 index d70f267cc1..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelRecipeTest.java +++ /dev/null @@ -1,59 +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.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 deleted file mode 100644 index dcc9810042..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelTest.java +++ /dev/null @@ -1,69 +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.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 deleted file mode 100644 index c17b50e738..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkRecipeTest.java +++ /dev/null @@ -1,63 +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.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.setParamXSD("networkParamXSD"); - assertTrue(networkRecipe.getParamXSD().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 deleted file mode 100644 index 7b54854fd9..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceCustomizationTest.java +++ /dev/null @@ -1,62 +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.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 deleted file mode 100644 index 11ee57b86b..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceTest.java +++ /dev/null @@ -1,68 +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.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 deleted file mode 100644 index 49dc9b7079..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/RecipeTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============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 deleted file mode 100644 index c819079a40..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============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.addNetworkResourceCustomizations(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 deleted file mode 100644 index 4b4a5adf4a..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceRecipeTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * ============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/ServiceTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceTest.java deleted file mode 100644 index 12c55e7a48..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceTest.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.db.catalog.test;
-
-import static org.junit.Assert.assertTrue;
-
-import java.sql.Timestamp;
-
-import org.junit.Test;
-import org.openecomp.mso.db.catalog.beans.Service;
-
-/**
- */
-
-public class ServiceTest {
-
- @Test
- public final void recipeDataTest() {
- Service service = new Service();
- service.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(service.getCreated() != null);
- service.setDescription("description");
- assertTrue(service.getDescription().equalsIgnoreCase("description"));
-
- service.setModelInvariantUUID("action");
- assertTrue(service.getModelInvariantUUID().equalsIgnoreCase("action"));
-
- service.setModelName("modelName");
- assertTrue(service.getModelName().equalsIgnoreCase("modelName"));
-
- service.setModelUUID("modelUUID");
- assertTrue(service.getModelUUID().equalsIgnoreCase("modelUUID"));
- service.setModelVersion("modelVersion");
- assertTrue(service.getModelVersion().equalsIgnoreCase("modelVersion"));
- service.setServiceRole("serviceRole");
- assertTrue(service.getServiceRole().equalsIgnoreCase("serviceRole"));
- service.setToscaCsarArtifactUUID("toscaCsarArtifactUUID");
- assertTrue(service.getToscaCsarArtifactUUID().equalsIgnoreCase("toscaCsarArtifactUUID"));
-
- service.setServiceType("serviceType");
- assertTrue(service.getServiceType().equalsIgnoreCase("serviceType"));
- service.setRecipes(null);
- assertTrue(service.getRecipes() == null);
- service.setServiceResourceCustomizations(null);
- assertTrue(service.getServiceResourceCustomizations() == null);
-
- }
-
-}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceToAllottedResourcesTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceToAllottedResourcesTest.java deleted file mode 100644 index b2aaeeed4e..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceToAllottedResourcesTest.java +++ /dev/null @@ -1,49 +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.db.catalog.test;
-
-import static org.junit.Assert.assertTrue;
-
-import java.sql.Timestamp;
-
-import org.junit.Test;
-import org.openecomp.mso.db.catalog.beans.ServiceToAllottedResources;
-
-/**
- */
-
-public class ServiceToAllottedResourcesTest {
-
- @Test
- public final void serviceToAllottedResourcesDataTest() {
- ServiceToAllottedResources serviceToAllottedResources = new ServiceToAllottedResources();
- serviceToAllottedResources.setArModelCustomizationUuid("arModelCustomizationUuid");
- assertTrue(
- serviceToAllottedResources.getArModelCustomizationUuid().equalsIgnoreCase("arModelCustomizationUuid"));
- serviceToAllottedResources.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(serviceToAllottedResources.getCreated() != null);
- serviceToAllottedResources.setServiceModelUuid("serviceModelUuid");
- assertTrue(serviceToAllottedResources.getServiceModelUuid().equalsIgnoreCase("serviceModelUuid"));
-// assertTrue(serviceToAllottedResources.toString() != null);
-
- }
-
-}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceToResourceCustomizationTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceToResourceCustomizationTest.java deleted file mode 100644 index 337cf4b574..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceToResourceCustomizationTest.java +++ /dev/null @@ -1,49 +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.db.catalog.test;
-
-import static org.junit.Assert.assertTrue;
-
-import java.sql.Timestamp;
-
-import org.junit.Test;
-import org.openecomp.mso.db.catalog.beans.ServiceToAllottedResources;
-
-/**
- */
-
-public class ServiceToResourceCustomizationTest {
-
- @Test
- public final void serviceToResourceCustomizationDataTest() {
- ServiceToAllottedResources serviceToResourceCustomization = new ServiceToAllottedResources();
- serviceToResourceCustomization.setArModelCustomizationUuid("arModelCustomizationUuid");
- assertTrue(
- serviceToResourceCustomization.getArModelCustomizationUuid().equalsIgnoreCase("arModelCustomizationUuid"));
- serviceToResourceCustomization.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(serviceToResourceCustomization.getCreated() != null);
- serviceToResourceCustomization.setServiceModelUuid("serviceModelUuid");
- assertTrue(serviceToResourceCustomization.getServiceModelUuid().equalsIgnoreCase("serviceModelUuid"));
-// assertTrue(serviceToResourceCustomization.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 deleted file mode 100644 index 162073cc76..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java +++ /dev/null @@ -1,151 +0,0 @@ -/*- - * ============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.addNetworkResourceCustomizations(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/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToscaCsarTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToscaCsarTest.java deleted file mode 100644 index 9cbfaa4d2c..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToscaCsarTest.java +++ /dev/null @@ -1,57 +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.db.catalog.test;
-
-import static org.junit.Assert.assertTrue;
-
-import java.sql.Timestamp;
-
-import org.junit.Test;
-import org.openecomp.mso.db.catalog.beans.ToscaCsar;
-
-/**
- */
-
-public class ToscaCsarTest {
-
- @Test
- public final void toscaCsarDataTest() {
- ToscaCsar toscaCsar = new ToscaCsar();
- toscaCsar.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(toscaCsar.getCreated() != null);
- toscaCsar.setDescription("description");
- assertTrue(toscaCsar.getDescription().equalsIgnoreCase("description"));
-
- toscaCsar.setArtifactChecksum("artifactChecksum");
- assertTrue(toscaCsar.getArtifactChecksum().equalsIgnoreCase("artifactChecksum"));
-
- toscaCsar.setArtifactUUID("artifactUUID");
- assertTrue(toscaCsar.getArtifactUUID().equalsIgnoreCase("artifactUUID"));
-
- toscaCsar.setName("name");
- assertTrue(toscaCsar.getName().equalsIgnoreCase("name"));
- toscaCsar.setUrl("url");
- assertTrue(toscaCsar.getUrl().equalsIgnoreCase("url"));
-// assertTrue(toscaCsar.toString() != null);
-
- }
-
-}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleCustomizationTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleCustomizationTest.java deleted file mode 100644 index 52d15ee597..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleCustomizationTest.java +++ /dev/null @@ -1,70 +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.db.catalog.test;
-
-import static org.junit.Assert.assertTrue;
-
-import java.sql.Timestamp;
-
-import org.junit.Test;
-import org.openecomp.mso.db.catalog.beans.VfModule;
-import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;
-
-/**
- */
-
-public class VfModuleCustomizationTest {
-
- @Test
- public final void vfModuleCustomizationDataTest() {
- VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
- vfModuleCustomization.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(vfModuleCustomization.getCreated() != null);
- vfModuleCustomization.setAvailabilityZoneCount(1);
- assertTrue(vfModuleCustomization.getAvailabilityZoneCount() == 1);
- vfModuleCustomization.hashCode();
- vfModuleCustomization.setVolEnvironmentArtifactUuid("volEnvironmentArtifactUuid");
- assertTrue(
- vfModuleCustomization.getVolEnvironmentArtifactUuid().equalsIgnoreCase("volEnvironmentArtifactUuid"));
-
- vfModuleCustomization.setHeatEnvironmentArtifactUuid("heatEnvironmentArtifactUuid");
- assertTrue(
- vfModuleCustomization.getHeatEnvironmentArtifactUuid().equalsIgnoreCase("heatEnvironmentArtifactUuid"));
-
- vfModuleCustomization.setInitialCount(1);
- assertTrue(vfModuleCustomization.getInitialCount() == 1);
-
- vfModuleCustomization.setLabel("label");
- assertTrue(vfModuleCustomization.getLabel().equalsIgnoreCase("label"));
- vfModuleCustomization.setMaxInstances(2);
- assertTrue(vfModuleCustomization.getMaxInstances() == 2);
- vfModuleCustomization.setMinInstances(1);
- assertTrue(vfModuleCustomization.getMinInstances() == 1);
- vfModuleCustomization.setModelCustomizationUuid("modelCustomizationUuid");
- assertTrue(vfModuleCustomization.getModelCustomizationUuid().equalsIgnoreCase("modelCustomizationUuid"));
- vfModuleCustomization.setVfModule(new VfModule());
- assertTrue(vfModuleCustomization.getVfModule() != null);
-
-// assertTrue(vfModuleCustomization.toString() == null);
-
- }
-
-}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleTest.java deleted file mode 100644 index 9409a642ec..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleTest.java +++ /dev/null @@ -1,63 +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.db.catalog.test;
-
-import static org.junit.Assert.assertTrue;
-
-import java.sql.Timestamp;
-
-import org.junit.Test;
-import org.openecomp.mso.db.catalog.beans.VfModule;
-
-/**
- */
-
-public class VfModuleTest {
-
- @Test
- public final void vfModuleDataTest() {
- VfModule vfModule = new VfModule();
- vfModule.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(vfModule.getCreated() != null);
- vfModule.setDescription("description");
- assertTrue(vfModule.getDescription().equalsIgnoreCase("description"));
-
- vfModule.setModelInvariantUUID("action");
- assertTrue(vfModule.getModelInvariantUUID().equalsIgnoreCase("action"));
-
- vfModule.setModelName("modelName");
- assertTrue(vfModule.getModelName().equalsIgnoreCase("modelName"));
-
- vfModule.setModelUUID("modelUUID");
- assertTrue(vfModule.getModelUUID().equalsIgnoreCase("modelUUID"));
- vfModule.setModelVersion("modelVersion");
- assertTrue(vfModule.getModelVersion().equalsIgnoreCase("modelVersion"));
- vfModule.setHeatTemplateArtifactUUId("heatTemplateArtifactUUId");
- assertTrue(vfModule.getHeatTemplateArtifactUUId().equalsIgnoreCase("heatTemplateArtifactUUId"));
- vfModule.setVnfResourceModelUUId("vnfResourceModelUUId");
- assertTrue(vfModule.getVnfResourceModelUUId().equalsIgnoreCase("vnfResourceModelUUId"));
- vfModule.setIsBase(1);
- assertTrue(vfModule.isBase());
-// assertTrue(vfModule.toString() == null);
-
- }
-
-}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java deleted file mode 100644 index 3f707871a6..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java +++ /dev/null @@ -1,63 +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.db.catalog.test;
-
-import static org.junit.Assert.assertTrue;
-
-import java.sql.Timestamp;
-
-import org.junit.Test;
-import org.openecomp.mso.db.catalog.beans.VnfRecipe;
-
-/**
- */
-
-public class VnfRecipeTest {
-
- @Test
- public final void vnfRecipeDataTest() {
- VnfRecipe vnfRecipe = new VnfRecipe();
- vnfRecipe.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(vnfRecipe.getCreated() != null);
- vnfRecipe.setDescription("description");
- assertTrue(vnfRecipe.getDescription().equalsIgnoreCase("description"));
-
- vnfRecipe.setOrchestrationUri("orchestrationUri");
- assertTrue(vnfRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri"));
-
- vnfRecipe.setRecipeTimeout(1);
- assertTrue(vnfRecipe.getRecipeTimeout() == 1);
- vnfRecipe.setVnfType("vnfType");
- assertTrue(vnfRecipe.getVnfType().equalsIgnoreCase("vnfType"));
-
- vnfRecipe.setServiceType("serviceType");
- assertTrue(vnfRecipe.getServiceType().equalsIgnoreCase("serviceType"));
- vnfRecipe.setVersion("version");
- assertTrue(vnfRecipe.getVersion().equalsIgnoreCase("version"));
- vnfRecipe.setParamXSD("vnfParamXSD");
- assertTrue(vnfRecipe.getParamXSD().equalsIgnoreCase("vnfParamXSD"));
- vnfRecipe.setVfModuleId("vfModuleId");
- assertTrue(vnfRecipe.getVfModuleId().equalsIgnoreCase("vfModuleId"));
-// assertTrue(vnfRecipe.toString() == null);
-
- }
-
-}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfResourceCustomizationTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfResourceCustomizationTest.java deleted file mode 100644 index 816461f203..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfResourceCustomizationTest.java +++ /dev/null @@ -1,56 +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.db.catalog.test;
-
-
-import static org.junit.Assert.*;
-
-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.HashSet;
-import java.util.UUID;
-
-import org.junit.Test;
-
-import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
-
-/**
- */
-
-public class VnfResourceCustomizationTest {
-
- @Test
- public final void vnfResourceCustomizationTest () {
- VnfResourceCustomization vrc = new VnfResourceCustomization();
- vrc.setModelCustomizationUuid("004fccad-a9d1-4b34-b50b-ccb9800a178b");
- vrc.setModelInstanceName("testName");
- vrc.setMultiStageDesign("sampleDesign");
-
- assertTrue(vrc.getModelCustomizationUuid().equals("004fccad-a9d1-4b34-b50b-ccb9800a178b"));
- assertTrue(vrc.getModelInstanceName().equals("testName"));
- assertTrue(vrc.getMultiStageDesign().equals("sampleDesign"));
- }
-
-}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfResourceTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfResourceTest.java deleted file mode 100644 index 68749e397e..0000000000 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfResourceTest.java +++ /dev/null @@ -1,82 +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.db.catalog.test;
-
-import static org.junit.Assert.assertTrue;
-
-import java.sql.Timestamp;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.junit.Test;
-import org.openecomp.mso.db.catalog.beans.VfModule;
-import org.openecomp.mso.db.catalog.beans.VnfResource;
-import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
-
-/**
- */
-
-public class VnfResourceTest {
-
- @Test
- public final void vnfResourceDataTest() {
-
- VnfResource vnfResource = new VnfResource();
- vnfResource.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(vnfResource.getCreated() != null);
- vnfResource.setDescription("description");
- assertTrue(vnfResource.getDescription().equalsIgnoreCase("description"));
-
- vnfResource.setAicVersionMax("aicVersionMax");
- assertTrue(vnfResource.getAicVersionMax().equalsIgnoreCase("aicVersionMax"));
-
- vnfResource.setAicVersionMin("aicVersionMin");
- assertTrue(vnfResource.getAicVersionMin().equalsIgnoreCase("aicVersionMin"));
- vnfResource.setHeatTemplateArtifactUUId("heatTemplateArtifactUUId");
- assertTrue(vnfResource.getHeatTemplateArtifactUUId().equalsIgnoreCase("heatTemplateArtifactUUId"));
-
- vnfResource.setModelInvariantUuid("modelInvariantUuid");
- assertTrue(vnfResource.getModelInvariantUuid().equalsIgnoreCase("modelInvariantUuid"));
- vnfResource.setModelName("modelName");
- assertTrue(vnfResource.getModelName().equalsIgnoreCase("modelName"));
- vnfResource.setModelUuid("modelUuid");
- assertTrue(vnfResource.getModelUuid().equalsIgnoreCase("modelUuid"));
- vnfResource.setModelVersion("modelVersion");
- assertTrue(vnfResource.getModelVersion().equalsIgnoreCase("modelVersion"));
- vnfResource.setOrchestrationMode("orchestrationMode");
- assertTrue(vnfResource.getOrchestrationMode().equalsIgnoreCase("orchestrationMode"));
- vnfResource.setTemplateId("heatTemplateArtifactUUId");
- assertTrue(vnfResource.getHeatTemplateArtifactUUId().equalsIgnoreCase("heatTemplateArtifactUUId"));
- vnfResource.setModelInvariantUuid("modelInvariantUuid");
- assertTrue(vnfResource.getModelInvariantUuid().equalsIgnoreCase("modelInvariantUuid"));
- Set<VnfResourceCustomization> list = new HashSet<>();
- list.add(new VnfResourceCustomization());
- vnfResource.setVnfResourceCustomizations(list);
- assertTrue(vnfResource.getVfModuleCustomizations() != null);
- Set<VfModule> vfModules = new HashSet<>();
- vfModules.add(new VfModule());
- vnfResource.setVfModules(vfModules);
- assertTrue(vnfResource.getVfModules() != null);
-// assertTrue(vnfResource.toString() != null);
-
- }
-
-}
diff --git a/mso-catalog-db/src/test/resources/application-test.yaml b/mso-catalog-db/src/test/resources/application-test.yaml new file mode 100644 index 0000000000..dbff1c1d2f --- /dev/null +++ b/mso-catalog-db/src/test/resources/application-test.yaml @@ -0,0 +1,64 @@ +# TEST FILE +catalog.db.endpoint: "http://localhost:" + +ssl-enable: false +mso: + site-name: localDevEnv + logPath: logs + catalog: + db: + spring: + endpoint: "http://localhost:" + db: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + +spring: + datasource: + url: jdbc:mariadb://localhost:3307/ + username: root + password: password + driver-class-name: org.mariadb.jdbc.Driver + initialize: true + initialization-mode: never + jpa: + generate-ddl: false + show-sql: true + hibernate: + ddl-auto: none + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + security: + usercredentials: + - + username: test + password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu' + role: BPEL-Client + - + username: bpel + password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO' + role: BPEL-Client + - + username: mso_admin + password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa' + role: ACTUATOR +mariaDB4j: + dataDir: + port: 3307 + databaseName: catalog_db + +server: + port: 8080 + tomcat: + max-threads: 50 + + +#Actuator +management: + endpoints: + enabled-by-default: false + endpoint: + info: + enabled: true + + diff --git a/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql new file mode 100644 index 0000000000..604f493cf0 --- /dev/null +++ b/mso-catalog-db/src/test/resources/data.sql @@ -0,0 +1,643 @@ + +insert into heat_files(artifact_uuid, name, version, description, body, artifact_checksum, creation_timestamp) values +('00535bdd-0878-4478-b95a-c575c742bfb0', 'nimbus-ethernet-gw', '1', 'created from csar', 'DEVICE=$dev\nBOOTPROTO=none\nNM_CONTROLLED=no\nIPADDR=$ip\nNETMASK=$netmask\nGATEWAY=$gateway\n', 'MANUAL RECORD', '2017-01-21 23:56:43'); + + +insert into tosca_csar(artifact_uuid, name, version, description, artifact_checksum, url, creation_timestamp) values +('0513f839-459d-46b6-aa3d-2edfef89a079', 'service-Ciservicee3756aea561a-csar.csar', '1', 'TOSCA definition package of the asset', 'YTk1MmY2MGVlNzVhYTU4YjgzYjliMjNjMmM3NzU1NDc=', '/sdc/v1/catalog/services/Ciservicee3756aea561a/1.0/artifacts/service-Ciservicee3756aea561a-csar.csar', '2017-11-27 11:38:27'); + + +insert into service(model_uuid, model_name, model_invariant_uuid, model_version, description, creation_timestamp, tosca_csar_artifact_uuid, service_type, service_role, environment_context, workload_context) values +('5df8b6de-2083-11e7-93ae-92361f002671', 'MSOTADevInfra_vSAMP10a_Service', '9647dfc4-2083-11e7-93ae-92361f002671', '1.0', 'MSO aLaCarte Vfmodule with addon', '2017-04-14 13:42:39', '0513f839-459d-46b6-aa3d-2edfef89a079', 'NA', 'NA', 'Luna', 'Oxygen'); + +insert into service(model_uuid, model_name, model_invariant_uuid, model_version, description, creation_timestamp, tosca_csar_artifact_uuid, service_type, service_role, environment_context, workload_context) values +('5df8b6de-2083-11e7-93ae-92361f002672', 'MSOTADevInfra_vSAMP10a_Service', '9647dfc4-2083-11e7-93ae-92361f002671', '2.0', 'MSO aLaCarte Vfmodule with addon', '2017-04-14 13:42:39', null, 'NA', 'NA', 'Luna', 'Oxygen'); + +insert into service(model_uuid, model_name, model_invariant_uuid, model_version, description, creation_timestamp, tosca_csar_artifact_uuid, service_type, service_role, environment_context, workload_context) values +('5df8b6de-2083-11e7-93ae-92361f002673', 'MSOTADevInfra_vSAMP10a_Service', '9647dfc4-2083-11e7-93ae-92361f002671', '2.1', 'MSO aLaCarte Vfmodule with addon', '2017-04-14 13:42:39', null, 'NA', 'NA', 'Luna', 'Oxygen'); + + +insert into service(model_uuid, model_name, model_invariant_uuid, model_version, description, creation_timestamp, tosca_csar_artifact_uuid, service_type, service_role, environment_context, workload_context) values +('5df8b6de-2083-11e7-93ae-92361f002674', 'MSOTADevInfra_vSAMP10a_Service', '9647dfc4-2083-11e7-93ae-92361f002671', '2.1.1', 'MSO aLaCarte Vfmodule with addon', '2017-04-14 13:42:39', null, 'NA', 'NA', 'Luna', 'Oxygen'); +insert into service(model_uuid, model_name, model_invariant_uuid, model_version, description, creation_timestamp, tosca_csar_artifact_uuid, service_type, service_role, environment_context, workload_context) values +('5df8b6de-2083-11e7-93ae-92361f002675', 'MSOTADevInfra_vSAMP10a_Service', '9647dfc4-2083-11e7-93ae-92361f002671', '2.1.2', 'MSO aLaCarte Vfmodule with addon', '2017-04-14 13:42:39', null, 'NA', 'NA', 'Luna', 'Oxygen'); + + +insert into service_recipe(id, action, version_str, description, orchestration_uri, service_param_xsd, recipe_timeout, service_timeout_interim, creation_timestamp, service_model_uuid) values +('1', 'createInstance', '1', 'MSOTADevInfra aLaCarte', '/mso/async/services/CreateGenericALaCarteServiceInstance', null, '180', '0', '2017-04-14 19:18:20', '5df8b6de-2083-11e7-93ae-92361f002671'); + +insert into heat_template(artifact_uuid, name, version, description, body, timeout_minutes, artifact_checksum, creation_timestamp) values +('ff874603-4222-11e7-9252-005056850d2e', 'module_mns_zrdm3frwl01exn_01_rgvm_1.yml', '1', 'created from csar', 'heat_template_version: 2013-05-23 description: heat template that creates TEST VNF parameters: TEST_server_name: type: string label: TEST server name description: TEST server name TEST_image_name: type: string label: image name description: TEST image name TEST_flavor_name: type: string label: TEST flavor name description: flavor name of TEST instance TEST_Role_net_name: type: string label: TEST network name description: TEST network name TEST_vnf_id: type: string label: TEST VNF Id description: TEST VNF Id resources:TEST: type: OS::Nova::Server properties: name: { get_param: TEST_server_name } image: { get_param: TEST_image_name } flavor: { get_param: TEST_flavor_name } networks: - port: { get_resource: TEST_port_0} metadata: vnf_id: {get_param: TEST_vnf_id} TEST_port_0: type: OS::Neutron::Port properties: network: { get_param: TEST_Role_net_name }', '60', 'MANUAL RECORD', '2017-01-21 23:26:56'), +('ff87482f-4222-11e7-9252-005056850d2e', 'module_mns_zrdm3frwl01exn_01_rgvm_1.yml', '1', 'created from csar', 'heat_template_version: 2013-05-23 description: heat template that creates TEST VNF parameters: TEST_server_name: type: string label: TEST server name description: TEST server name TEST_image_name: type: string label: image name description: TEST image name TEST_flavor_name: type: string label: TEST flavor name description: flavor name of TEST instance TEST_Role_net_name: type: string label: TEST network name description: TEST network name TEST_vnf_id: type: string label: TEST VNF Id description: TEST VNF Id resources:TEST: type: OS::Nova::Server properties: name: { get_param: TEST_server_name } image: { get_param: TEST_image_name } flavor: { get_param: TEST_flavor_name } networks: - port: { get_resource: TEST_port_0} metadata: vnf_id: {get_param: TEST_vnf_id} TEST_port_0: type: OS::Neutron::Port properties: network: { get_param: TEST_Role_net_name }', '60', 'MANUAL RECORD', '2017-01-21 23:26:56'), +('aa874603-4222-11e7-9252-005056850d2e', 'module_mns_zrdm3frwl01exn_01_rgvm_1.yml', '1', 'created from csar', 'heat_template_version: 2013-05-23 description: heat template that creates TEST VNF parameters: TEST_server_name: type: string label: TEST server name description: TEST server name TEST_image_name: type: string label: image name description: TEST image name TEST_flavor_name: type: string label: TEST flavor name description: flavor name of TEST instance TEST_Role_net_name: type: string label: TEST network name description: TEST network name TEST_vnf_id: type: string label: TEST VNF Id description: TEST VNF Id resources:TEST: type: OS::Nova::Server properties: name: { get_param: TEST_server_name } image: { get_param: TEST_image_name } flavor: { get_param: TEST_flavor_name } networks: - port: { get_resource: TEST_port_0} metadata: vnf_id: {get_param: TEST_vnf_id} TEST_port_0: type: OS::Neutron::Port properties: network: { get_param: TEST_Role_net_name }', '60', 'MANUAL RECORD', '2017-01-21 23:26:56'); + + +insert into heat_template_params(heat_template_artifact_uuid, param_name, is_required, param_type, param_alias) values +('ff874603-4222-11e7-9252-005056850d2e', 'availability_zone_0', 1, 'string', ''), +('ff874603-4222-11e7-9252-005056850d2e', 'exn_direct_net_fqdn',1, 'string', ''), +('ff874603-4222-11e7-9252-005056850d2e', 'exn_hsl_net_fqdn', 1, 'string', ''); + +insert into heat_environment(artifact_uuid, name, version, description, body, artifact_checksum, creation_timestamp) values +('fefb1601-4222-11e7-9252-005056850d2e', 'module_nso.env', '2', 'Auto-generated HEAT Environment deployment artifact', 'parameters:\n availability_zone_0: \"alln-zone-1\"\n nso_flavor_name: \"citeis.1vCPUx2GB\"\n nso_image_name: \"RHEL-6.8-BASE-20160912\"\n nso_name_0: \"zrdm3vamp01nso001\"\n nso_oam_ip_0: \"172.18.25.175\"\n nso_oam_net_gw: \"172.18.25.1\"\n nso_oam_net_mask: \"255.255.255.0\"\n nso_sec_grp_id: \"36f48d82-f099-4437-bfbc-70d9e5d420d1\"\n nso_srv_grp_id: \"e431c477-5bd1-476a-bfa9-e4ce16b8356b\"\n oam_net_id: \"nso_oam\"\n vf_module_id: \"145cd730797234b4a40aa99335abc143\"\n vnf_id: \"730797234b4a40aa99335157b02871cd\"\n vnf_name: \"Mobisupport\"\n', 'MWI2ODY0Yjc1NDJjNWU1NjdkMTAyMjVkNzFmZDU0MzA=', '2017-11-27 08:42:58'), +('fefb1751-4333-11e7-9252-005056850d2e', 'module_nso.env', '2', 'Auto-generated HEAT Environment deployment artifact', 'parameters:\n availability_zone_0: \"alln-zone-1\"\n nso_flavor_name: \"citeis.1vCPUx2GB\"\n nso_image_name: \"RHEL-6.8-BASE-20160912\"\n nso_name_0: \"zrdm3vamp01nso001\"\n nso_oam_ip_0: \"172.18.25.175\"\n nso_oam_net_gw: \"172.18.25.1\"\n nso_oam_net_mask: \"255.255.255.0\"\n nso_sec_grp_id: \"36f48d82-f099-4437-bfbc-70d9e5d420d1\"\n nso_srv_grp_id: \"e431c477-5bd1-476a-bfa9-e4ce16b8356b\"\n oam_net_id: \"nso_oam\"\n vf_module_id: \"145cd730797234b4a40aa99335abc143\"\n vnf_id: \"730797234b4a40aa99335157b02871cd\"\n vnf_name: \"Mobisupport\"\n', 'MWI2ODY0Yjc1NDJjNWU1NjdkMTAyMjVkNzFmZDU0MzA=', '2017-11-27 08:42:58'); + +insert into vnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, aic_version_min, aic_version_max, model_invariant_uuid, model_version, model_name, tosca_node_type, heat_template_artifact_uuid) values +('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002671', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '1.0', 'vSAMP10a', 'VF', null); + +insert into vnf_resource_customization(model_customization_uuid, model_instance_name, min_instances, max_instances, availability_zone_max_count, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, vnf_resource_model_uuid, multi_stage_design) values +('68dc9a92-214c-11e7-93ae-92361f002671', 'vSAMP10a 1', '0', '0', '0', 'vSAMP', 'vSAMP', 'vSAMP', 'vSAMP', '2017-05-26 15:08:24', 'ff2ae348-214a-11e7-93ae-92361f002671', null); + + +insert into vf_module(model_uuid, model_invariant_uuid, model_version, model_name, description, is_base, heat_template_artifact_uuid, vol_heat_template_artifact_uuid, creation_timestamp, vnf_resource_model_uuid) values + +('20c4431c-246d-11e7-93ae-92361f002671', '78ca26d0-246d-11e7-93ae-92361f002671', '2', 'vSAMP10aDEV::base::module-0', 'vSAMP10a DEV Base', '1', 'ff874603-4222-11e7-9252-005056850d2e', null, '2016-09-14 18:19:56', 'ff2ae348-214a-11e7-93ae-92361f002671'), +('066de97e-253e-11e7-93ae-92361f002671', '64efd51a-2544-11e7-93ae-92361f002671', '2', 'vSAMP10aDEV::PCM::module-1', 'vSAMP10a DEV PCM', '0', 'ff87482f-4222-11e7-9252-005056850d2e', null, '2016-09-14 18:19:56', 'ff2ae348-214a-11e7-93ae-92361f002671'); + + +insert into vf_module_customization(model_customization_uuid, label, initial_count, min_instances, max_instances, availability_zone_count, heat_environment_artifact_uuid, vol_environment_artifact_uuid, creation_timestamp, vf_module_model_uuid) values +('cb82ffd8-252a-11e7-93ae-92361f002671', 'base', '1', '0', '0', '0', 'fefb1601-4222-11e7-9252-005056850d2e', null, '2017-05-26 15:08:23', '20c4431c-246d-11e7-93ae-92361f002671'), +('b4ea86b4-253f-11e7-93ae-92361f002671', 'PCM', '0', '0', '0', '0', 'fefb1751-4333-11e7-9252-005056850d2e', null, '2017-05-26 15:08:23', '066de97e-253e-11e7-93ae-92361f002671'); + + +insert into vnf_res_custom_to_vf_module_custom(vnf_resource_cust_model_customization_uuid, vf_module_cust_model_customization_uuid, creation_timestamp) values +('68dc9a92-214c-11e7-93ae-92361f002671', 'cb82ffd8-252a-11e7-93ae-92361f002671', '2017-05-26 15:08:24'), +('68dc9a92-214c-11e7-93ae-92361f002671', 'b4ea86b4-253f-11e7-93ae-92361f002671', '2017-05-26 15:08:24'); + +insert into allotted_resource(model_uuid, model_invariant_uuid, model_version, model_name, tosca_node_type, subcategory, description, creation_timestamp) values +('f6b7d4c6-e8a4-46e2-81bc-31cad5072842', 'b7a1b78e-6b6b-4b36-9698-8c9530da14af', '1.0', 'Tunnel_Xconn', '', '', '', '2017-05-26 15:08:24'); + +insert into allotted_resource_customization(model_customization_uuid, model_instance_name, providing_service_model_invariant_uuid, target_network_role, nf_type, nf_role, nf_function, nf_naming_code, min_instances, max_instances, ar_model_uuid, creation_timestamp) values +('367a8ba9-057a-4506-b106-fbae818597c6', 'Sec_Tunnel_Xconn 11', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'f6b7d4c6-e8a4-46e2-81bc-31cad5072842', TIMESTAMP '2017-01-20 16:14:20.0'); + + +insert into temp_network_heat_template_lookup(network_resource_model_name, heat_template_artifact_uuid, aic_version_min, aic_version_max) values +('CONTRAIL30_GNDIRECT', 'ff874603-4222-11e7-9252-005056850d2e', '3', '3'); + +insert into network_resource(model_uuid, model_name, model_invariant_uuid, description, heat_template_artifact_uuid, neutron_network_type, model_version, tosca_node_type, aic_version_min, aic_version_max, orchestration_mode, creation_timestamp) values +('10b36f65-f4e6-4be6-ae49-9596dc1c47fc', 'CONTRAIL30_GNDIRECT', 'ce4ff476-9641-4e60-b4d5-b4abbec1271d', 'Contrail 30 GNDIRECT NW', 'aa874603-4222-11e7-9252-005056850d2e', 'BASIC', '1.0', '', '3.0', '', 'HEAT', '2017-01-17 20:35:05'); +insert into network_resource(model_uuid, model_name, model_invariant_uuid, description, heat_template_artifact_uuid, neutron_network_type, model_version, tosca_node_type, aic_version_min, aic_version_max, orchestration_mode, creation_timestamp) values +('10b36f65-f4e6-4be6-ae49-9596dc1c47fy', 'CONTRAIL30_GNDIRECT', 'ce4ff476-9641-4e60-b4d5-b4abbec1271d', 'Contrail 30 GNDIRECT NW', 'aa874603-4222-11e7-9252-005056850d2e', 'BASIC', '2.0', '', '3.0', '', 'HEAT', '2017-01-17 20:35:05'); + +insert into network_resource(model_uuid, model_name, model_invariant_uuid, description, heat_template_artifact_uuid, neutron_network_type, model_version, tosca_node_type, aic_version_min, aic_version_max, orchestration_mode, creation_timestamp) values +('10b36f65-f4e6-4be6-ae49-9596dc1c47fx', 'CONTRAIL30_GNDIRECT', 'ce4ff476-9641-4e60-b4d5-b4abbec1271d', 'Contrail 30 GNDIRECT NW', 'aa874603-4222-11e7-9252-005056850d2e', 'BASIC', '3.0', '', '3.0', '', 'HEAT', '2017-01-17 20:35:05'); + +insert into network_resource(model_uuid, model_name, model_invariant_uuid, description, heat_template_artifact_uuid, neutron_network_type, model_version, tosca_node_type, aic_version_min, aic_version_max, orchestration_mode, creation_timestamp) values +('10b36f65-f4e6-4be6-ae49-9596dc1c47fz', 'CONTRAIL30_GNDIRECT', 'ce4ff476-9641-4e60-b4d5-b4abbec1271d', 'Contrail 30 GNDIRECT NW', 'aa874603-4222-11e7-9252-005056850d2e', 'BASIC', '3.1', '', '3.0', '', 'HEAT', '2017-01-17 20:35:05'); + + +insert into network_resource_customization(model_customization_uuid, model_instance_name, network_technology, network_type, network_role, network_scope, creation_timestamp, network_resource_model_uuid) values +('3bdbb104-476c-483e-9f8b-c095b3d308ac', 'CONTRAIL30_GNDIRECT 9', '', '', '', '', '2017-04-19 14:28:32', '10b36f65-f4e6-4be6-ae49-9596dc1c47fc'); + +insert into vnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, aic_version_min, aic_version_max, model_invariant_uuid, model_version, model_name, tosca_node_type, heat_template_artifact_uuid) values +('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002672', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '2.0', 'vSAMP10a', 'VF', null); + + +insert into vnf_resource_customization(model_customization_uuid, model_instance_name, min_instances, max_instances, availability_zone_max_count, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, vnf_resource_model_uuid, multi_stage_design) values +('68dc9a92-214c-11e7-93ae-92361f002672', 'vSAMP10a 2', '0', '0', '0', 'vSAMP', 'vSAMP', 'vSAMP', 'vSAMP', '2017-05-26 15:08:24', 'ff2ae348-214a-11e7-93ae-92361f002672', null); + + + + + +insert into vf_module(model_uuid, model_invariant_uuid, model_version, model_name, description, is_base, heat_template_artifact_uuid, vol_heat_template_artifact_uuid, creation_timestamp, vnf_resource_model_uuid) values + +('20c4431c-246d-11e7-93ae-92361f002672', '78ca26d0-246d-11e7-93ae-92361f002671', '2', 'vSAMP10aDEV::base::module-0', 'vSAMP10a DEV Base', '1', 'ff874603-4222-11e7-9252-005056850d2e', null, '2016-09-14 18:19:56', 'ff2ae348-214a-11e7-93ae-92361f002671'), +('066de97e-253e-11e7-93ae-92361f002672', '64efd51a-2544-11e7-93ae-92361f002671', '2', 'vSAMP10aDEV::PCM::module-1', 'vSAMP10a DEV PCM', '0', 'ff87482f-4222-11e7-9252-005056850d2e', null, '2016-09-14 18:19:56', 'ff2ae348-214a-11e7-93ae-92361f002671'), +('066de97e-253e-11e7-93ae-92361f002673', '64efd51a-2544-11e7-93ae-92361f002671', '3', 'vSAMP10aDEV::PCM::module-1', 'vSAMP10a DEV PCM', '0', 'ff87482f-4222-11e7-9252-005056850d2e', null, '2016-09-14 18:19:54', 'ff2ae348-214a-11e7-93ae-92361f002671'), +('066de97e-253e-11e7-93ae-92361f002674', '64efd51a-2544-11e7-93ae-92361f002671', '3.1', 'vSAMP10aDEV::PCM::module-1', 'vSAMP10a DEV PCM', '0', 'ff87482f-4222-11e7-9252-005056850d2e', null, '2016-09-14 18:19:56', 'ff2ae348-214a-11e7-93ae-92361f002671'), +('066de97e-253e-11e7-93ae-92361f002675', '64efd51a-2544-11e7-93ae-92361f002671', '3.1.1', 'vSAMP10aDEV::PCM::module-1', 'vSAMP10a DEV PCM', '0', 'ff87482f-4222-11e7-9252-005056850d2e', null, '2016-09-14 18:19:56', 'ff2ae348-214a-11e7-93ae-92361f002671'); + + + +insert into vf_module_customization(model_customization_uuid, label, initial_count, min_instances, max_instances, availability_zone_count, heat_environment_artifact_uuid, vol_environment_artifact_uuid, creation_timestamp, vf_module_model_uuid) values +('cb82ffd8-252a-11e7-93ae-92361f002672', 'base', '1', '0', '0', '0', 'fefb1601-4222-11e7-9252-005056850d2e', null, '2017-05-26 15:08:23', '20c4431c-246d-11e7-93ae-92361f002672'), +('b4ea86b4-253f-11e7-93ae-92361f002672', 'PCM', '0', '0', '0', '0', 'fefb1751-4333-11e7-9252-005056850d2e', null, '2017-05-26 15:08:23', '066de97e-253e-11e7-93ae-92361f002672'); + + +insert into vnf_res_custom_to_vf_module_custom(vnf_resource_cust_model_customization_uuid, vf_module_cust_model_customization_uuid, creation_timestamp) values +('68dc9a92-214c-11e7-93ae-92361f002672', 'cb82ffd8-252a-11e7-93ae-92361f002672', '2017-05-26 15:08:24'), +('68dc9a92-214c-11e7-93ae-92361f002672', 'b4ea86b4-253f-11e7-93ae-92361f002672', '2017-05-26 15:08:24'); + + + +insert into vf_module_to_heat_files(vf_module_model_uuid, heat_files_artifact_uuid) values +('20c4431c-246d-11e7-93ae-92361f002671', '00535bdd-0878-4478-b95a-c575c742bfb0'), +('066de97e-253e-11e7-93ae-92361f002671', '00535bdd-0878-4478-b95a-c575c742bfb0'); + + +insert into network_resource_customization_to_service(service_model_uuid, resource_model_customization_uuid) values +('5df8b6de-2083-11e7-93ae-92361f002671', '3bdbb104-476c-483e-9f8b-c095b3d308ac'), +('5df8b6de-2083-11e7-93ae-92361f002672', '3bdbb104-476c-483e-9f8b-c095b3d308ac'); + + +insert into vnf_resource_customization_to_service(service_model_uuid, resource_model_customization_uuid) values +('5df8b6de-2083-11e7-93ae-92361f002671', '68dc9a92-214c-11e7-93ae-92361f002671'), +('5df8b6de-2083-11e7-93ae-92361f002672', '68dc9a92-214c-11e7-93ae-92361f002672'); + +insert into allotted_resource_customization_to_service(service_model_uuid, resource_model_customization_uuid) values +('5df8b6de-2083-11e7-93ae-92361f002671', '367a8ba9-057a-4506-b106-fbae818597c6' ), +('5df8b6de-2083-11e7-93ae-92361f002672', '367a8ba9-057a-4506-b106-fbae818597c6'); + + + +insert into vnf_recipe(id, nf_role, action, service_type, version_str, description, orchestration_uri, vnf_param_xsd, recipe_timeout, creation_timestamp, vf_module_id) values +('61', '*', 'CREATE', '', '1', 'Recipe Match All for VNFs if no custom flow exists', '/mso/workflow/services/CreateGenericVNFV1', '', '180', '2016-06-03 10:14:10', ''), +('63', '*', 'DELETE', '', '1', 'Recipe Match All for VNFs if no custom flow exists', '/mso/async/services/deleteGenericVNFV1', '', '180', '2016-06-03 10:14:10', ''), +('65', '*', 'UPDATE', '', '1', 'Recipe Match All for VNFs if no custom flow exists', '/mso/workflow/services/updateGenericVNFV1', '', '180', '2016-06-03 10:14:10', ''), +('67', '*', 'CREATE_VF_MODULE', '', '1', 'Recipe Match All for VNFs if no custom flow exists', '/mso/async/services/CreateVfModule', '', '180', '2016-06-03 10:14:10', '*'), +('69', '*', 'DELETE_VF_MODULE', '', '1', 'Recipe Match All for VNFs if no custom flow exists', '/mso/async/services/DeleteVfModule', '', '180', '2016-06-03 10:14:10', '*'), +('71', '*', 'UPDATE_VF_MODULE', '', '1', 'Recipe Match All for VNFs if no custom flow exists', '/mso/async/services/UpdateVfModule', '', '180', '2016-06-03 10:14:10', '*'), +('77', 'VID_DEFAULT', 'createInstance', '', '1', 'VID_DEFAULT recipe to create VNF if no custom BPMN flow is found', '/mso/async/services/CreateVnfInfra', '', '180', '2016-09-14 19:18:20', ''), +('78', 'VID_DEFAULT', 'deleteInstance', '', '1', 'VID_DEFAULT recipe to delete VNF if no custom BPMN flow is found', '/mso/async/services/DeleteVnfInfra', '', '180', '2016-09-14 19:18:20', ''), +('81', 'VID_DEFAULT', 'updateInstance', '', '1', 'VID_DEFAULT update', '/mso/async/services/UpdateVnfInfra', '', '180', '2017-07-28 18:19:39', ''), +('85', 'VID_DEFAULT', 'replaceInstance', '', '1', 'VID_DEFAULT replace', '/mso/async/services/ReplaceVnfInfra', '', '180', '2017-07-28 18:19:45', ''), +('10000', 'VID_DEFAULT', 'inPlaceSoftwareUpdate', '', '1', 'VID_DEFAULT inPlaceSoftwareUpdate', '/mso/async/services/VnfInPlaceUpdate', '', '180', '2017-10-25 18:19:45', ''), +('10001', 'VID_DEFAULT', 'applyUpdatedConfig', '', '1', 'VID_DEFAULT applyUpdatedConfig', '/mso/async/services/VnfConfigUpdate', '', '180', '2017-10-25 18:19:45', ''); + + +insert into vnf_components(vnf_id, component_type, heat_template_id, heat_environment_id, creation_timestamp) values +('13961', 'VOLUME', '13843', '13961', '2016-05-19 20:22:02'); + +insert into vnf_components_recipe(id, vnf_type, vnf_component_type, action, service_type, version, description, orchestration_uri, vnf_component_param_xsd, recipe_timeout, creation_timestamp, vf_module_model_uuid) values +('5', '*', 'VOLUME_GROUP', 'CREATE', '', '1', 'Recipe Match All for VF Modules if no custom flow exists', '/mso/async/services/createCinderVolumeV1', '', '180', '2016-06-03 10:15:11', ''), +('7', '*', 'VOLUME_GROUP', 'DELETE', '', '1', 'Recipe Match All for VF Modules if no custom flow exists', '/mso/async/services/deleteCinderVolumeV1', '', '180', '2016-06-03 10:15:11', ''), +('9', '*', 'VOLUME_GROUP', 'UPDATE', '', '1', 'Recipe Match All for VF Modules if no custom flow exists', '/mso/async/services/updateCinderVolumeV1', '', '180', '2016-06-03 10:15:11', ''), +('13', '', 'VOLUME_GROUP', 'DELETE_VF_MODULE_VOL', '', '1', 'Recipe Match All for VF Modules if no custom flow exists', '/mso/async/services/DeleteVfModuleVolume', '', '180', '2016-06-03 10:15:11', '*'), +('15', '', 'VOLUME_GROUP', 'UPDATE_VF_MODULE_VOL', '', '1', 'Recipe Match All for VF Modules if no custom flow exists', '/mso/async/services/UpdateVfModuleVolume', '', '180', '2016-06-03 10:15:11', '*'), +('16', '', 'volumeGroup', 'createInstance', '', '1', 'VID_DEFAULT recipe to create volume-group if no custom BPMN flow is found', '/mso/async/services/CreateVfModuleVolumeInfraV1', '', '180', '2016-09-14 19:18:20', 'VID_DEFAULT'), +('17', '', 'volumeGroup', 'deleteInstance', '', '1', 'VID_DEFAULT recipe to delete volume-group if no custom BPMN flow is found', '/mso/async/services/DeleteVfModuleVolumeInfraV1', '', '180', '2016-09-14 19:18:20', 'VID_DEFAULT'), +('18', '', 'volumeGroup', 'updateInstance', '', '1', 'VID_DEFAULT recipe to update volume-group if no custom BPMN flow is found', '/mso/async/services/UpdateVfModuleVolumeInfraV1', '', '180', '2016-09-14 19:18:20', 'VID_DEFAULT'), +('19', '', 'vfModule', 'createInstance', '', '1', 'VID_DEFAULT recipe to create vf-module if no custom BPMN flow is found', '/mso/async/services/CreateVfModuleInfra', '', '180', '2016-09-14 19:18:20', 'VID_DEFAULT'), +('20', '', 'vfModule', 'deleteInstance', '', '1', 'VID_DEFAULT recipe to delete vf-module if no custom BPMN flow is found', '/mso/async/services/DeleteVfModuleInfra', '', '180', '2016-09-14 19:18:20', 'VID_DEFAULT'), +('21', '', 'vfModule', 'updateInstance', '', '1', 'VID_DEFAULT recipe to update vf-module if no custom BPMN flow is found', '/mso/async/services/UpdateVfModuleInfra', '', '180', '2016-09-14 19:18:20', 'VID_DEFAULT'), +('25', '', 'vfModule', 'replaceInstance', '', '1', 'VID_DEFAULT vfModule replace', '/mso/async/services/ReplaceVfModuleInfra', '', '180', '2017-07-28 18:25:06', 'VID_DEFAULT'); + +insert into network_recipe(id, model_name, action, description, orchestration_uri, network_param_xsd, recipe_timeout, service_type, creation_timestamp, version_str) values +('1', 'CONTRAIL_BASIC', 'CREATE', '', '/mso/async/services/CreateNetworkV2', '', '180', '', '2016-09-14 19:00:57', '1'), +('2', 'CONTRAIL_BASIC', 'DELETE', '', '/mso/async/services/DeleteNetworkV2', '', '180', '', '2016-09-14 19:00:57', '1'), +('3', 'CONTRAIL_BASIC', 'UPDATE', '', '/mso/async/services/UpdateNetworkV2', '', '180', '', '2016-09-14 19:00:57', '1'), +('4', 'CONTRAIL_SHARED', 'CREATE', '', '/mso/async/services/CreateNetworkV2', '', '180', '', '2016-09-14 19:00:57', '1'), +('5', 'CONTRAIL_SHARED', 'UPDATE', '', '/mso/async/services/UpdateNetworkV2', '', '180', '', '2016-09-14 19:00:57', '1'), +('6', 'CONTRAIL_SHARED', 'DELETE', '', '/mso/async/services/DeleteNetworkV2', '', '180', '', '2016-09-14 19:00:57', '1'), +('7', 'CONTRAIL_EXTERNAL', 'CREATE', '', '/mso/async/services/CreateNetworkV2', '', '180', '', '2016-09-14 19:00:57', '1'), +('8', 'CONTRAIL_EXTERNAL', 'UPDATE', '', '/mso/async/services/UpdateNetworkV2', '', '180', '', '2016-09-14 19:00:57', '1'), +('9', 'CONTRAIL_EXTERNAL', 'DELETE', '', '/mso/async/services/DeleteNetworkV2', '', '180', '', '2016-09-14 19:00:57', '1'), +('10', 'CONTRAIL30_BASIC', 'CREATE', '', '/mso/async/services/CreateNetworkV2', '', '180', '', '2016-05-26 14:48:13', '1'), +('11', 'CONTRAIL30_BASIC', 'UPDATE', '', '/mso/async/services/UpdateNetworkV2', '', '180', '', '2016-05-26 14:48:13', '1'), +('12', 'CONTRAIL30_BASIC', 'DELETE', '', '/mso/async/services/DeleteNetworkV2', '', '180', '', '2016-05-26 14:48:13', '1'), +('13', 'NEUTRON_BASIC', 'CREATE', '', '/mso/async/services/CreateNetworkV2', '', '180', '', '2016-06-01 19:54:51', '1'), +('17', 'VID_DEFAULT', 'createInstance', 'VID_DEFAULT recipe to create network if no custom BPMN flow is found', '/mso/async/services/CreateNetworkInstance', '', '180', '', '2016-09-14 19:18:20', '1.0'), +('18', 'VID_DEFAULT', 'updateInstance', 'VID_DEFAULT recipe to update network if no custom BPMN flow is found', '/mso/async/services/UpdateNetworkInstance', '', '180', '', '2016-09-14 19:18:20', '1.0'), +('19', 'VID_DEFAULT', 'deleteInstance', 'VID_DEFAULT recipe to delete network if no custom BPMN flow is found', '/mso/async/services/DeleteNetworkInstance', '', '180', '', '2016-09-14 19:18:20', '1.0'), +('124', 'CONTRAIL30_MPSCE', 'CREATE', '', '/mso/async/services/CreateNetworkV2', '', '180', '', '2016-10-18 18:47:52', '1'), +('126', 'CONTRAIL30_MPSCE', 'UPDATE', '', '/mso/async/services/UpdateNetworkV2', '', '180', '', '2016-10-18 18:47:52', '1'), +('128', 'CONTRAIL30_MPSCE', 'DELETE', '', '/mso/async/services/DeleteNetworkV2', '', '180', '', '2016-10-18 18:47:52', '1'), +('141', 'CONTRAIL30_L2NODHCP', 'CREATE', '', '/mso/async/services/CreateNetworkV2', '', '180', '', '2017-01-03 20:12:46', '1'), +('144', 'CONTRAIL30_L2NODHCP', 'UPDATE', '', '/mso/async/services/UpdateNetworkV2', '', '180', '', '2017-01-03 20:12:46', '1'), +('147', 'CONTRAIL30_L2NODHCP', 'DELETE', '', '/mso/async/services/DeleteNetworkV2', '', '180', '', '2017-01-03 20:12:46', '1'), +('169', 'CONTRAIL30_GNDIRECT', 'CREATE', '', '/mso/async/services/CreateNetworkV2', '', '180', '', '2017-01-17 20:25:34', '1'), +('172', 'CONTRAIL30_GNDIRECT', 'UPDATE', '', '/mso/async/services/UpdateNetworkV2', '', '180', '', '2017-01-17 20:25:34', '1'), +('175', 'CONTRAIL30_GNDIRECT', 'DELETE', '', '/mso/async/services/DeleteNetworkV2', '', '180', '', '2017-01-17 20:25:34', '1'), +('176', 'NEUTRON_BASIC', 'DELETE', '', '/mso/async/services/DeleteNetworkV2', '', '180', '', '2017-09-22 18:47:31', '1'), +('177', 'NEUTRON_BASIC', 'UPDATE', '', '/mso/async/services/UpdateNetworkV2', '', '180', '', '2017-09-22 18:47:31', '1'); + +INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, IS_TOPLEVELFLOW, MIN_API_VERSION, MAX_API_VERSION) VALUES +('Service-Create', 'createInstance', 'Service', true, true, '7','7'), +('Service-Delete', 'deleteInstance', 'Service', true, true, '7','7'), +('Service-Macro-Assign', 'assignInstance', 'Service', false, true, '7','7'), +('Service-Macro-Activate', 'activateInstance', 'Service', false, true, '7','7'), +('Service-Macro-Unassign', 'unassignInstance', 'Service', false, true, '7','7'), +('Service-Macro-Create', 'createInstance', 'Service', false, true, '7','7'), +('Service-Macro-Delete', 'deleteInstance', 'Service', false, true, '7','7'), +('Network-Create', 'createInstance', 'Network', true, true, '7','7'), +('Network-Delete', 'deleteInstance', 'Network', true, true, '7','7'), +('VNF-Macro-Recreate', 'replaceInstance', 'Vnf', false, false, '7','7'), +('VNF-Macro-Replace', 'internalReplace', 'Vnf', false, false, '7','7'), +('VNF-Create', 'createInstance', 'Vnf', true, true, '7', '7'), +('VNF-Delete', 'deleteInstance', 'Vnf', true, true, '7', '7'), +('VolumeGroup-Create', 'createInstance', 'VolumeGroup', true, true, '7','7'), +('VolumeGroup-Delete', 'deleteInstance', 'VolumeGroup', true, true, '7','7'), +('VFModule-Create', 'createInstance', 'VfModule', true, true, '7','7'), +('VFModule-Delete', 'deleteInstance', 'VfModule', true, true, '7','7'), +('VFModule-DeactivateAndCloudDelete', 'deactivateAndCloudDelete', 'VfModule', true, true, '7','7'), +('NetworkCollection-Macro-Create', 'createInstance', 'NetworkCollection', false, true, '7','7'), +('NetworkCollection-Macro-Delete', 'deleteInstance', 'NetworkCollection', false, true, '7','7'); + +INSERT INTO building_block_detail (BUILDING_BLOCK_NAME, RESOURCE_TYPE, TARGET_ACTION) +VALUES +('AssignServiceInstanceBB', 'SERVICE', 'ASSIGN'), +('AssignVnfBB', 'VNF', 'ASSIGN'), +('AssignVolumeGroupBB', 'VOLUME_GROUP', 'ASSIGN'), +('AssignVfModuleBB', 'VF_MODULE', 'ASSIGN'), +('AssignNetworkBB', 'NETWORK', 'ASSIGN'), +('AssignNetwork1802BB', 'NETWORK', 'ASSIGN'), +('UnassignServiceInstanceBB', 'SERVICE', 'UNASSIGN'), +('UnassignVnfBB', 'VNF', 'UNASSIGN'), +('UnassignVolumeGroupBB', 'VOLUME_GROUP', 'UNASSIGN'), +('UnassignVfModuleBB', 'VF_MODULE', 'UNASSIGN'), +('UnassignNetwork1802BB', 'NETWORK', 'UNASSIGN'), +('UnassignNetworkBB', 'NETWORK', 'UNASSIGN'), +('ActivateServiceInstanceBB', 'SERVICE', 'ACTIVATE'), +('ActivateVnfBB', 'VNF', 'ACTIVATE'), +('ActivateVolumeGroupBB', 'VOLUME_GROUP', 'ACTIVATE'), +('ActivateVfModuleBB', 'VF_MODULE', 'ACTIVATE'), +('ActivateNetworkBB', 'NETWORK', 'ACTIVATE'), +('ActivateNetworkCollectionBB', 'NETWORK', 'ACTIVATE'), +('DeactivateServiceInstanceBB', 'SERVICE', 'DEACTIVATE'), +('DeactivateVnfBB', 'VNF', 'DEACTIVATE'), +('DeactivateVolumeGroupBB', 'VOLUME_GROUP', 'DEACTIVATE'), +('DeactivateVfModuleBB', 'VF_MODULE', 'DEACTIVATE'), +('DeactivateNetworkBB', 'NETWORK', 'DEACTIVATE'), +('ChangeModelServiceInstanceBB', 'SERVICE', 'CHANGE_MODEL'), +('ChangeModelVnfBB', 'VNF', 'CHANGE_MODEL'), +('ChangeModelVfModuleBB', 'VF_MODULE', 'CHANGE_MODEL'), +('CreateVolumeGroupBB', 'VOLUME_GROUP', 'CREATE'), +('CreateVfModuleBB', 'VF_MODULE', 'CREATE'), +('CreateNetworkBB', 'NETWORK', 'CREATE'), +('CreateNetworkCollectionBB', 'NETWORK', 'CREATE'), +('DeleteVolumeGroupBB', 'VOLUME_GROUP', 'DELETE'), +('DeleteVfModuleBB', 'VF_MODULE', 'DELETE'), +('DeleteNetworkBB', 'NETWORK', 'DELETE'), +('DeleteNetworkCollectionBB', 'NETWORK', 'DELETE'), +('AssignAndActivateVpnBondingLinksBB', 'CUSTOM', 'CUSTOM'), +('AvpnAssignServiceInstanceBB', 'CUSTOM', 'CUSTOM'), +('CreateCustomerVpnBindingBB', 'CUSTOM', 'CUSTOM'), +('SniroHoming', 'CUSTOM', 'CUSTOM'), +('DeactivateAndUnassignVpnBondingLinksBB', 'CUSTOM', 'CUSTOM'), +('DeactivateNetworkCollectionBB', 'CUSTOM', 'CUSTOM'), +('AAICheckVnfInMaintBB', 'CUSTOM', 'CUSTOM'), +('AAISetVnfInMaintBB', 'CUSTOM', 'CUSTOM'), +('AAIUnsetVnfInMaintBB', 'CUSTOM', 'CUSTOM'), +('SDNOVnfHealthCheckBB', 'CUSTOM', 'CUSTOM'), +('VNF-Macro-Replace', 'CUSTOM', 'CUSTOM'), +('HomingV2', 'CUSTOM', 'CUSTOM'); + +INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES +('Service-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create')), +('Service-Create', '2', 'ActivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create')), +('Service-Delete', '1', 'DeactivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Delete')), +('Service-Delete', '2', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Delete')), +('Service-Macro-Assign', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign')), +('Service-Macro-Assign', '2', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign')), +('Service-Macro-Assign', '3', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign')), +('Service-Macro-Assign', '4', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign')), +('Service-Macro-Assign', '5', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign')), +('Service-Macro-Activate', '1', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate')), +('Service-Macro-Activate', '2', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate')), +('Service-Macro-Activate', '3', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate')), +('Service-Macro-Activate', '4', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate')), +('Service-Macro-Activate', '5', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate')), +('Service-Macro-Activate', '6', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate')), +('Service-Macro-Activate', '7', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate')), +('Service-Macro-Activate', '8', 'ActivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate')), +('Service-Macro-Unassign', '1', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign')), +('Service-Macro-Unassign', '2', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign')), +('Service-Macro-Unassign', '3', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign')), +('Service-Macro-Unassign', '4', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign')), +('Service-Macro-Unassign', '5', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign')), +('Service-Macro-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '2', 'CreateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '3', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '4', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '5', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '6', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '7', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '8', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '9', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '10', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '11', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '12', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '13', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '14', 'ActivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '15', 'ActivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Delete', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '3', 'DeactivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '4', 'DeleteVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '5', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '6', 'DeactivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '7', 'DeleteNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '8', 'DeleteNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '9', 'DeactivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '10', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '11', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '12', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '13', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '14', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Network-Create', '1', 'AssignNetwork1802BB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create')), +('Network-Create', '2', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create')), +('Network-Create', '3', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create')), +('Network-Delete', '1', 'DeactivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete')), +('Network-Delete', '2', 'DeleteNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete')), +('Network-Delete', '3', 'UnassignNetwork1802BB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete')), +('VNF-Create', '1', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Create')), +('VNF-Create', '2', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Create')), +('VNF-Delete', '1', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Delete')), +('VNF-Delete', '2', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Delete')), +('VNF-Macro-Recreate', '1', 'AAICheckVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate')), +('VNF-Macro-Recreate', '2', 'AAISetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate')), +('VNF-Macro-Recreate', '3', 'VNF-Macro-Replace', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate')), +('VNF-Macro-Recreate', '4', 'SDNOVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate')), +('VNF-Macro-Recreate', '5', 'AAIUnsetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate')), +('VNF-Macro-Replace', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace')), +('VNF-Macro-Replace', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace')), +('VNF-Macro-Replace', '3', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace')), +('VNF-Macro-Replace', '4', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace')), +('VNF-Macro-Replace', '5', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace')), +('VNF-Macro-Replace', '6', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace')), +('VolumeGroup-Create', '1', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create')), +('VolumeGroup-Create', '2', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create')), +('VolumeGroup-Create', '3', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create')), +('VolumeGroup-Delete', '1', 'DeactivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete')), +('VolumeGroup-Delete', '2', 'DeleteVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete')), +('VolumeGroup-Delete', '3', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete')), +('VFModule-Create', '1', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create')), +('VFModule-Create', '2', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create')), +('VFModule-Create', '3', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create')), +('VFModule-Delete', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete')), +('VFModule-Delete', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete')), +('VFModule-Delete', '3', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete')), +('VFModule-DeactivateAndCloudDelete', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-DeactivateAndCloudDelete')), +('VFModule-DeactivateAndCloudDelete', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-DeactivateAndCloudDelete')), +('NetworkCollection-Macro-Create', '1', 'CreateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create')), +('NetworkCollection-Macro-Create', '2', 'AssignNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create')), +('NetworkCollection-Macro-Create', '3', 'CreateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create')), +('NetworkCollection-Macro-Create', '4', 'ActivateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create')), +('NetworkCollection-Macro-Create', '5', 'ActivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create')), +('NetworkCollection-Macro-Delete', '1', 'DeactivateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete')), +('NetworkCollection-Macro-Delete', '2', 'DeleteNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete')), +('NetworkCollection-Macro-Delete', '3', 'UnassignNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete')), +('NetworkCollection-Macro-Delete', '4', 'DeleteNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete')); + +INSERT INTO orchestration_status_state_transition_directive (RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) +VALUES +('SERVICE', 'PRECREATED', 'ASSIGN', 'CONTINUE'), +('VNF', 'PRECREATED', 'ASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'PRECREATED', 'ASSIGN', 'CONTINUE'), +('VF_MODULE', 'PRECREATED', 'ASSIGN', 'CONTINUE'), +('NETWORK', 'PRECREATED', 'ASSIGN', 'CONTINUE'), +('SERVICE', 'INVENTORIED', 'ASSIGN', 'CONTINUE'), +('VNF', 'INVENTORIED', 'ASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'INVENTORIED', 'ASSIGN', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'ASSIGN', 'CONTINUE'), +('NETWORK', 'INVENTORIED', 'ASSIGN', 'CONTINUE'), +('SERVICE', 'ASSIGNED', 'ASSIGN', 'SILENT_SUCCESS'), +('VNF', 'ASSIGNED', 'ASSIGN', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'ASSIGNED', 'ASSIGN', 'SILENT_SUCCESS'), +('VF_MODULE', 'ASSIGNED', 'ASSIGN', 'SILENT_SUCCESS'), +('NETWORK', 'ASSIGNED', 'ASSIGN', 'SILENT_SUCCESS'), +('SERVICE', 'CREATED', 'ASSIGN', 'SILENT_SUCCESS'), +('VNF', 'CREATED', 'ASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'CREATED', 'ASSIGN', 'FAIL'), +('VF_MODULE', 'CREATED', 'ASSIGN', 'SILENT_SUCCESS'), +('NETWORK', 'CREATED', 'ASSIGN', 'SILENT_SUCCESS'), +('SERVICE', 'ACTIVE', 'ASSIGN', 'SILENT_SUCCESS'), +('VNF', 'ACTIVE', 'ASSIGN', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'ACTIVE', 'ASSIGN', 'SILENT_SUCCESS'), +('VF_MODULE', 'ACTIVE', 'ASSIGN', 'SILENT_SUCCESS'), +('NETWORK', 'ACTIVE', 'ASSIGN', 'SILENT_SUCCESS'), +('SERVICE', 'PENDING_CREATE', 'ASSIGN', 'FAIL'), +('VNF', 'PENDING_CREATE', 'ASSIGN', 'FAIL'), +('VOLUME_GROUP', 'PENDING_CREATE', 'ASSIGN', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'ASSIGN', 'CONTINUE'), +('NETWORK', 'PENDING_CREATE', 'ASSIGN', 'SILENT_SUCCESS'), +('SERVICE', 'PENDING_DELETE', 'ASSIGN', 'SILENT_SUCCESS'), +('VNF', 'PENDING_DELETE', 'ASSIGN', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'PENDING_DELETE', 'ASSIGN', 'FAIL'), +('VF_MODULE', 'PENDING_DELETE', 'ASSIGN', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_DELETE', 'ASSIGN', 'SILENT_SUCCESS'), +('SERVICE', 'PENDING_ACTIVATION', 'ASSIGN', 'FAIL'), +('VNF', 'PENDING_ACTIVATION', 'ASSIGN', 'FAIL'), +('VOLUME_GROUP', 'PENDING_ACTIVATION', 'ASSIGN', 'FAIL'), +('VF_MODULE', 'PENDING_ACTIVATION', 'ASSIGN', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_ACTIVATION', 'ASSIGN', 'FAIL'), +('SERVICE', 'PENDING', 'ASSIGN', 'FAIL'), +('VNF', 'PENDING', 'ASSIGN', 'FAIL'), +('VOLUME_GROUP', 'PENDING', 'ASSIGN', 'SILENT_SUCCESS'), +('VF_MODULE', 'PENDING', 'ASSIGN', 'FAIL'), +('NETWORK', 'PENDING', 'ASSIGN', 'FAIL'), +('SERVICE', 'PRECREATED', 'UNASSIGN', 'SILENT_SUCCESS'), +('VNF', 'PRECREATED', 'UNASSIGN', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'PRECREATED', 'UNASSIGN', 'SILENT_SUCCESS'), +('VF_MODULE', 'PRECREATED', 'UNASSIGN', 'SILENT_SUCCESS'), +('NETWORK', 'PRECREATED', 'UNASSIGN', 'SILENT_SUCCESS'), +('SERVICE', 'INVENTORIED', 'UNASSIGN', 'CONTINUE'), +('VNF', 'INVENTORIED', 'UNASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'INVENTORIED', 'UNASSIGN', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'UNASSIGN', 'CONTINUE'), +('NETWORK', 'INVENTORIED', 'UNASSIGN', 'CONTINUE'), +('SERVICE', 'ASSIGNED', 'UNASSIGN', 'CONTINUE'), +('VNF', 'ASSIGNED', 'UNASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'ASSIGNED', 'UNASSIGN', 'CONTINUE'), +('VF_MODULE', 'ASSIGNED', 'UNASSIGN', 'CONTINUE'), +('NETWORK', 'ASSIGNED', 'UNASSIGN', 'CONTINUE'), +('SERVICE', 'CREATED', 'UNASSIGN', 'CONTINUE'), +('VNF', 'CREATED', 'UNASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'CREATED', 'UNASSIGN', 'FAIL'), +('VF_MODULE', 'CREATED', 'UNASSIGN', 'FAIL'), +('NETWORK', 'CREATED', 'UNASSIGN', 'FAIL'), +('SERVICE', 'ACTIVE', 'UNASSIGN', 'FAIL'), +('VNF', 'ACTIVE', 'UNASSIGN', 'FAIL'), +('VOLUME_GROUP', 'ACTIVE', 'UNASSIGN', 'FAIL'), +('VF_MODULE', 'ACTIVE', 'UNASSIGN', 'FAIL'), +('NETWORK', 'ACTIVE', 'UNASSIGN', 'FAIL'), +('SERVICE', 'PENDING_CREATE', 'UNASSIGN', 'FAIL'), +('VNF', 'PENDING_CREATE', 'UNASSIGN', 'FAIL'), +('VOLUME_GROUP', 'PENDING_CREATE', 'UNASSIGN', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'UNASSIGN', 'CONTINUE'), +('NETWORK', 'PENDING_CREATE', 'UNASSIGN', 'CONTINUE'), +('SERVICE', 'PENDING_DELETE', 'UNASSIGN', 'CONTINUE'), +('VNF', 'PENDING_DELETE', 'UNASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'PENDING_DELETE', 'UNASSIGN', 'FAIL'), +('VF_MODULE', 'PENDING_DELETE', 'UNASSIGN', 'CONTINUE'), +('NETWORK', 'PENDING_DELETE', 'UNASSIGN', 'CONTINUE'), +('SERVICE', 'PENDING_ACTIVATION', 'UNASSIGN', 'FAIL'), +('VNF', 'PENDING_ACTIVATION', 'UNASSIGN', 'FAIL'), +('VOLUME_GROUP', 'PENDING_ACTIVATION', 'UNASSIGN', 'FAIL'), +('VF_MODULE', 'PENDING_ACTIVATION', 'UNASSIGN', 'CONTINUE'), +('NETWORK', 'PENDING_ACTIVATION', 'UNASSIGN', 'FAIL'), +('SERVICE', 'PENDING', 'UNASSIGN', 'FAIL'), +('VNF', 'PENDING', 'UNASSIGN', 'FAIL'), +('VOLUME_GROUP', 'PENDING', 'UNASSIGN', 'CONTINUE'), +('VF_MODULE', 'PENDING', 'UNASSIGN', 'FAIL'), +('NETWORK', 'PENDING', 'UNASSIGN', 'FAIL'), +('SERVICE', 'PRECREATED', 'ACTIVATE', 'FAIL'), +('VNF', 'PRECREATED', 'ACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PRECREATED', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'PRECREATED', 'ACTIVATE', 'FAIL'), +('NETWORK', 'PRECREATED', 'ACTIVATE', 'FAIL'), +('SERVICE', 'INVENTORIED', 'ACTIVATE', 'FAIL'), +('VNF', 'INVENTORIED', 'ACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'INVENTORIED', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'ACTIVATE', 'FAIL'), +('NETWORK', 'INVENTORIED', 'ACTIVATE', 'FAIL'), +('SERVICE', 'ASSIGNED', 'ACTIVATE', 'CONTINUE'), +('VNF', 'ASSIGNED', 'ACTIVATE', 'CONTINUE'), +('VOLUME_GROUP', 'ASSIGNED', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'ASSIGNED', 'ACTIVATE', 'FAIL'), +('NETWORK', 'ASSIGNED', 'ACTIVATE', 'FAIL'), +('SERVICE', 'CREATED', 'ACTIVATE', 'CONTINUE'), +('VNF', 'CREATED', 'ACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'CREATED', 'ACTIVATE', 'CONTINUE'), +('VF_MODULE', 'CREATED', 'ACTIVATE', 'CONTINUE'), +('NETWORK', 'CREATED', 'ACTIVATE', 'CONTINUE'), +('SERVICE', 'ACTIVE', 'ACTIVATE', 'SILENT_SUCCESS'), +('VNF', 'ACTIVE', 'ACTIVATE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'ACTIVE', 'ACTIVATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'ACTIVE', 'ACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'ACTIVE', 'ACTIVATE', 'SILENT_SUCCESS'), +('SERVICE', 'PENDING_CREATE', 'ACTIVATE', 'FAIL'), +('VNF', 'PENDING_CREATE', 'ACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PENDING_CREATE', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'ACTIVATE', 'FAIL'), +('NETWORK', 'PENDING_CREATE', 'ACTIVATE', 'FAIL'), +('SERVICE', 'PENDING_DELETE', 'ACTIVATE', 'CONTINUE'), +('VNF', 'PENDING_DELETE', 'ACTIVATE', 'CONTINUE'), +('VOLUME_GROUP', 'PENDING_DELETE', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING_DELETE', 'ACTIVATE', 'FAIL'), +('NETWORK', 'PENDING_DELETE', 'ACTIVATE', 'FAIL'), +('SERVICE', 'PENDING_ACTIVATION', 'ACTIVATE', 'FAIL'), +('VNF', 'PENDING_ACTIVATION', 'ACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PENDING_ACTIVATION', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING_ACTIVATION', 'ACTIVATE', 'FAIL'), +('NETWORK', 'PENDING_ACTIVATION', 'ACTIVATE', 'FAIL'), +('SERVICE', 'PENDING', 'ACTIVATE', 'FAIL'), +('VNF', 'PENDING', 'ACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PENDING', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING', 'ACTIVATE', 'FAIL'), +('NETWORK', 'PENDING', 'ACTIVATE', 'FAIL'), +('SERVICE', 'PRECREATED', 'DEACTIVATE', 'FAIL'), +('VNF', 'PRECREATED', 'DEACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PRECREATED', 'DEACTIVATE', 'FAIL'), +('VF_MODULE', 'PRECREATED', 'DEACTIVATE', 'FAIL'), +('NETWORK', 'PRECREATED', 'DEACTIVATE', 'FAIL'), +('SERVICE', 'INVENTORIED', 'DEACTIVATE', 'FAIL'), +('VNF', 'INVENTORIED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'INVENTORIED', 'DEACTIVATE', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'INVENTORIED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('SERVICE', 'ASSIGNED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VNF', 'ASSIGNED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'ASSIGNED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'ASSIGNED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'ASSIGNED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('SERVICE', 'CREATED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VNF', 'CREATED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'CREATED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'CREATED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'CREATED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('SERVICE', 'ACTIVE', 'DEACTIVATE', 'CONTINUE'), +('VNF', 'ACTIVE', 'DEACTIVATE', 'CONTINUE'), +('VOLUME_GROUP', 'ACTIVE', 'DEACTIVATE', 'CONTINUE'), +('VF_MODULE', 'ACTIVE', 'DEACTIVATE', 'CONTINUE'), +('NETWORK', 'ACTIVE', 'DEACTIVATE', 'CONTINUE'), +('SERVICE', 'PENDING_CREATE', 'DEACTIVATE', 'FAIL'), +('VNF', 'PENDING_CREATE', 'DEACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PENDING_CREATE', 'DEACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'DEACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_CREATE', 'DEACTIVATE', 'SILENT_SUCCESS'), +('SERVICE', 'PENDING_DELETE', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VNF', 'PENDING_DELETE', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'PENDING_DELETE', 'DEACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING_DELETE', 'DEACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_DELETE', 'DEACTIVATE', 'SILENT_SUCCESS'), +('SERVICE', 'PENDING_ACTIVATION', 'DEACTIVATE', 'FAIL'), +('VNF', 'PENDING_ACTIVATION', 'DEACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PENDING_ACTIVATION', 'DEACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING_ACTIVATION', 'DEACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_ACTIVATION', 'DEACTIVATE', 'FAIL'), +('SERVICE', 'PENDING', 'DEACTIVATE', 'FAIL'), +('VNF', 'PENDING', 'DEACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PENDING', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'PENDING', 'DEACTIVATE', 'FAIL'), +('NETWORK', 'PENDING', 'DEACTIVATE', 'FAIL'), +('SERVICE', 'PRECREATED', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'PRECREATED', 'CHANGE_MODEL', 'FAIL'), +('VF_MODULE', 'PRECREATED', 'CHANGE_MODEL', 'FAIL'), +('SERVICE', 'INVENTORIED', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'INVENTORIED', 'CHANGE_MODEL', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'CHANGE_MODEL', 'FAIL'), +('SERVICE', 'ASSIGNED', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'ASSIGNED', 'CHANGE_MODEL', 'CONTINUE'), +('VF_MODULE', 'ASSIGNED', 'CHANGE_MODEL', 'CONTINUE'), +('SERVICE', 'CREATED', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'CREATED', 'CHANGE_MODEL', 'FAIL'), +('VF_MODULE', 'CREATED', 'CHANGE_MODEL', 'FAIL'), +('SERVICE', 'ACTIVE', 'CHANGE_MODEL', 'CONTINUE'), +('VNF', 'ACTIVE', 'CHANGE_MODEL', 'CONTINUE'), +('VF_MODULE', 'ACTIVE', 'CHANGE_MODEL', 'CONTINUE'), +('SERVICE', 'PENDING_CREATE', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'PENDING_CREATE', 'CHANGE_MODEL', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'CHANGE_MODEL', 'FAIL'), +('SERVICE', 'PENDING_DELETE', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'PENDING_DELETE', 'CHANGE_MODEL', 'CONTINUE'), +('VF_MODULE', 'PENDING_DELETE', 'CHANGE_MODEL', 'CONTINUE'), +('SERVICE', 'PENDING_ACTIVATION', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'PENDING_ACTIVATION', 'CHANGE_MODEL', 'CONTINUE'), +('VF_MODULE', 'PENDING_ACTIVATION', 'CHANGE_MODEL', 'CONTINUE'), +('SERVICE', 'PENDING', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'PENDING', 'CHANGE_MODEL', 'FAIL'), +('VF_MODULE', 'PENDING', 'CHANGE_MODEL', 'FAIL'), +('VOLUME_GROUP', 'PRECREATED', 'CREATE', 'FAIL'), +('VF_MODULE', 'PRECREATED', 'CREATE', 'FAIL'), +('NETWORK', 'PRECREATED', 'CREATE', 'FAIL'), +('VOLUME_GROUP', 'INVENTORIED', 'CREATE', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'CREATE', 'FAIL'), +('NETWORK', 'INVENTORIED', 'CREATE', 'FAIL'), +('VOLUME_GROUP', 'ASSIGNED', 'CREATE', 'CONTINUE'), +('VF_MODULE', 'ASSIGNED', 'CREATE', 'CONTINUE'), +('NETWORK', 'ASSIGNED', 'CREATE', 'CONTINUE'), +('VOLUME_GROUP', 'CREATED', 'CREATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'CREATED', 'CREATE', 'SILENT_SUCCESS'), +('NETWORK', 'CREATED', 'CREATE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'ACTIVE', 'CREATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'ACTIVE', 'CREATE', 'SILENT_SUCCESS'), +('NETWORK', 'ACTIVE', 'CREATE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'PENDING_CREATE', 'CREATE', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'CREATE', 'FAIL'), +('NETWORK', 'PENDING_CREATE', 'CREATE', 'CONTINUE'), +('VOLUME_GROUP', 'PENDING_DELETE', 'CREATE', 'FAIL'), +('VF_MODULE', 'PENDING_DELETE', 'CREATE', 'CONTINUE'), +('NETWORK', 'PENDING_DELETE', 'CREATE', 'CONTINUE'), +('VOLUME_GROUP', 'PENDING_ACTIVATION', 'CREATE', 'FAIL'), +('VF_MODULE', 'PENDING_ACTIVATION', 'CREATE', 'FAIL'), +('NETWORK', 'PENDING_ACTIVATION', 'CREATE', 'FAIL'), +('VOLUME_GROUP', 'PENDING', 'CREATE', 'CONTINUE'), +('VF_MODULE', 'PENDING', 'CREATE', 'FAIL'), +('NETWORK', 'PENDING', 'CREATE', 'FAIL'), +('VOLUME_GROUP', 'PRECREATED', 'DELETE', 'FAIL'), +('VF_MODULE', 'PRECREATED', 'DELETE', 'FAIL'), +('NETWORK', 'PRECREATED', 'DELETE', 'FAIL'), +('VOLUME_GROUP', 'INVENTORIED', 'DELETE', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'DELETE', 'SILENT_SUCCESS'), +('NETWORK', 'INVENTORIED', 'DELETE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'ASSIGNED', 'DELETE', 'SILENT_SUCCESS'), +('VF_MODULE', 'ASSIGNED', 'DELETE', 'SILENT_SUCCESS'), +('NETWORK', 'ASSIGNED', 'DELETE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'CREATED', 'DELETE', 'CONTINUE'), +('VF_MODULE', 'CREATED', 'DELETE', 'CONTINUE'), +('NETWORK', 'CREATED', 'DELETE', 'CONTINUE'), +('VOLUME_GROUP', 'ACTIVE', 'DELETE', 'FAIL'), +('VF_MODULE', 'ACTIVE', 'DELETE', 'FAIL'), +('NETWORK', 'ACTIVE', 'DELETE', 'FAIL'), +('VOLUME_GROUP', 'PENDING_CREATE', 'DELETE', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'DELETE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_CREATE', 'DELETE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'PENDING_DELETE', 'DELETE', 'FAIL'), +('VF_MODULE', 'PENDING_DELETE', 'DELETE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_DELETE', 'DELETE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'PENDING_ACTIVATION', 'DELETE', 'FAIL'), +('VF_MODULE', 'PENDING_ACTIVATION', 'DELETE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_ACTIVATION', 'DELETE', 'FAIL'), +('VOLUME_GROUP', 'PENDING', 'DELETE', 'SILENT_SUCCESS'), +('VF_MODULE', 'PENDING', 'DELETE', 'FAIL'), +('NETWORK', 'PENDING', 'DELETE', 'FAIL'), +('CUSTOM', 'ACTIVE', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'ASSIGNED', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'CREATED', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'INVENTORIED', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'PENDING', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'PENDING_ACTIVATION', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'PENDING_CREATE', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'PENDING_DELETE', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'PRECREATED', 'CUSTOM', 'CONTINUE'); diff --git a/mso-catalog-db/src/test/resources/logback-test.xml b/mso-catalog-db/src/test/resources/logback-test.xml index a23395fe1b..0bf39bdad1 100644 --- a/mso-catalog-db/src/test/resources/logback-test.xml +++ b/mso-catalog-db/src/test/resources/logback-test.xml @@ -37,8 +37,11 @@ <logger name="com.att.eelf.error" level="trace" additivity="false"> <appender-ref ref="STDOUT" /> - </logger> - + </logger> + + <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> <root level="info"> <appender-ref ref="STDOUT" /> </root> diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql new file mode 100644 index 0000000000..b4b9c0d28b --- /dev/null +++ b/mso-catalog-db/src/test/resources/schema.sql @@ -0,0 +1,826 @@ + + +CREATE TABLE IF NOT EXISTS `northbound_request_ref_lookup` ( +`id` INT(11) NOT NULL AUTO_INCREMENT, +`REQUEST_SCOPE` VARCHAR(200) NOT NULL, +`MACRO_ACTION` VARCHAR(200) NOT NULL, +`ACTION` VARCHAR(200) NOT NULL, +`IS_ALACARTE` TINYINT(1) NOT NULL DEFAULT 0, +`IS_TOPLEVELFLOW` TINYINT(1) NOT NULL DEFAULT 0, +`MIN_API_VERSION` DOUBLE NOT NULL, +`MAX_API_VERSION` DOUBLE NULL, +PRIMARY KEY (`id`), +UNIQUE INDEX `UK_northbound_request_ref_lookup` (`MIN_API_VERSION` ASC, `REQUEST_SCOPE` ASC, `ACTION` ASC, `IS_ALACARTE` ASC, `MACRO_ACTION` ASC)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS building_block_detail ( +id INT(11) AUTO_INCREMENT, +BUILDING_BLOCK_NAME VARCHAR(200) NOT NULL, +RESOURCE_TYPE VARCHAR(25) NOT NULL, +TARGET_ACTION VARCHAR(25) NOT NULL, +PRIMARY KEY(`id`), +UNIQUE INDEX `UK_building_block_name`(`BUILDING_BLOCK_NAME`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS `orchestration_flow_reference` ( +`id` INT(11) NOT NULL AUTO_INCREMENT, +`COMPOSITE_ACTION` VARCHAR(200) NOT NULL, +`SEQ_NO` INT(11) NOT NULL, +`FLOW_NAME` VARCHAR(200) NOT NULL, +`FLOW_VERSION` DOUBLE NOT NULL, +`NB_REQ_REF_LOOKUP_ID` INT(11) NOT NULL, +PRIMARY KEY (`id`), +INDEX `fk_orchestration_flow_reference__northbound_req_ref_look_idx` (`NB_REQ_REF_LOOKUP_ID` ASC), +UNIQUE INDEX `UK_orchestration_flow_reference` (`COMPOSITE_ACTION` ASC, `FLOW_NAME` ASC, `SEQ_NO` ASC, `NB_REQ_REF_LOOKUP_ID` ASC), +CONSTRAINT `fk_orchestration_flow_reference__northbound_request_ref_look1` +FOREIGN KEY (`NB_REQ_REF_LOOKUP_ID`) REFERENCES `northbound_request_ref_lookup` (`id`) +ON DELETE CASCADE ON UPDATE CASCADE +) +ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; + +create table `allotted_resource` ( + `model_uuid` varchar(200) not null, + `model_invariant_uuid` varchar(200) not null, + `model_version` varchar(20) not null, + `model_name` varchar(200) not null, + `tosca_node_type` varchar(200) default null, + `subcategory` varchar(200) default null, + `description` varchar(1200) default null, + `creation_timestamp` datetime not null default current_timestamp, + primary key (`model_uuid`) +) engine=innodb default charset=latin1; + + + + +create table `allotted_resource_customization` ( + `model_customization_uuid` varchar(200) not null, + `model_instance_name` varchar(200) not null, + `providing_service_model_uuid` varchar(200) default null, + `providing_service_model_invariant_uuid` varchar(200) default null, + `providing_service_model_name` varchar(200) default null, + `target_network_role` varchar(200) default null, + `nf_type` varchar(200) default null, + `nf_role` varchar(200) default null, + `nf_function` varchar(200) default null, + `nf_naming_code` varchar(200) default null, + `min_instances` int(11) default null, + `max_instances` int(11) default null, + `ar_model_uuid` varchar(200) not null, + `creation_timestamp` datetime not null default current_timestamp, + primary key (`model_customization_uuid`), + key `fk_allotted_resource_customization__allotted_resource1_idx` (`ar_model_uuid`), + constraint `fk_allotted_resource_customization__allotted_resource1` foreign key (`ar_model_uuid`) references `allotted_resource` (`model_uuid`) on delete cascade on update cascade +) engine=innodb default charset=latin1; + + + + +create table `heat_environment` ( + `artifact_uuid` varchar(200) not null, + `name` varchar(100) not null, + `version` varchar(20) not null, + `description` varchar(1200) default null, + `body` longtext not null, + `artifact_checksum` varchar(200) not null default 'manual record', + `creation_timestamp` datetime not null default current_timestamp, + primary key (`artifact_uuid`) +) engine=innodb default charset=latin1; + + + +create table `heat_files` ( + `artifact_uuid` varchar(200) not null, + `name` varchar(200) not null, + `version` varchar(20) not null, + `description` varchar(1200) default null, + `body` longtext not null, + `artifact_checksum` varchar(200) not null default 'manual record', + `creation_timestamp` datetime not null default current_timestamp, + primary key (`artifact_uuid`) +) engine=innodb default charset=latin1; + + + + +create table `heat_template` ( + `artifact_uuid` varchar(200) not null, + `name` varchar(200) not null, + `version` varchar(20) not null, + `description` varchar(1200) default null, + `body` longtext not null, + `timeout_minutes` int(11) default null, + `artifact_checksum` varchar(200) not null default 'manual record', + `creation_timestamp` datetime not null default current_timestamp, + primary key (`artifact_uuid`) +) engine=innodb default charset=latin1; + + + +create table `heat_nested_template` ( + `parent_heat_template_uuid` varchar(200) not null, + `child_heat_template_uuid` varchar(200) not null, + `provider_resource_file` varchar(100) default null, + primary key (`parent_heat_template_uuid`,`child_heat_template_uuid`), + key `fk_heat_nested_template__heat_template2_idx` (`child_heat_template_uuid`), + constraint `fk_heat_nested_template__child_heat_temp_uuid__heat_template1` foreign key (`child_heat_template_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade, + constraint `fk_heat_nested_template__parent_heat_temp_uuid__heat_template1` foreign key (`parent_heat_template_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade +) engine=innodb default charset=latin1; + + + + +create table `heat_template_params` ( + `heat_template_artifact_uuid` varchar(200) not null, + `param_name` varchar(100) not null, + `is_required` bit(1) not null, + `param_type` varchar(20) default null, + `param_alias` varchar(45) default null, + primary key (`heat_template_artifact_uuid`,`param_name`), + constraint `fk_heat_template_params__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade +) engine=innodb default charset=latin1; + + + +create table `network_recipe` ( + `id` int(11) not null auto_increment, + `model_name` varchar(20) not null, + `action` varchar(50) not null, + `description` varchar(1200) default null, + `orchestration_uri` varchar(256) not null, + `network_param_xsd` varchar(2048) default null, + `recipe_timeout` int(11) default null, + `service_type` varchar(45) default null, + `creation_timestamp` datetime not null default current_timestamp, + `version_str` varchar(20) not null, + primary key (`id`), + unique key `uk_rl4f296i0p8lyokxveaiwkayi` (`model_name`,`action`,`version_str`) +) engine=innodb auto_increment=178 default charset=latin1; + + + + +create table `temp_network_heat_template_lookup` ( + `network_resource_model_name` varchar(200) not null, + `heat_template_artifact_uuid` varchar(200) not null, + `aic_version_min` varchar(20) not null, + `aic_version_max` varchar(20) default null, + primary key (`network_resource_model_name`), + key `fk_temp_network_heat_template_lookup__heat_template1_idx` (`heat_template_artifact_uuid`), + constraint `fk_temp_network_heat_template_lookup__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete no action on update cascade +) engine=innodb default charset=latin1; + + + +create table `network_resource` ( + `model_uuid` varchar(200) not null, + `model_name` varchar(200) not null, + `model_invariant_uuid` varchar(200) default null, + `description` varchar(1200) default null, + `heat_template_artifact_uuid` varchar(200) not null, + `neutron_network_type` varchar(20) default null, + `model_version` varchar(20) default null, + `tosca_node_type` varchar(200) default null, + `aic_version_min` varchar(20) not null, + `aic_version_max` varchar(20) default null, + `orchestration_mode` varchar(20) default 'heat', + `resource_category` varchar(20) default null, + `resource_sub_category` varchar(20) default null, + `creation_timestamp` datetime not null default current_timestamp, + primary key (`model_uuid`), + key `fk_network_resource__temp_network_heat_template_lookup1_idx` (`model_name`), + key `fk_network_resource__heat_template1_idx` (`heat_template_artifact_uuid`), + constraint `fk_network_resource__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete no action on update cascade, + constraint `fk_network_resource__temp_network_heat_template_lookup__mod_nm1` foreign key (`model_name`) references `temp_network_heat_template_lookup` (`network_resource_model_name`) on delete no action on update no action +) engine=innodb default charset=latin1; + + + + + +create table `network_resource_customization` ( + `model_customization_uuid` varchar(200) not null, + `model_instance_name` varchar(200) not null, + `network_technology` varchar(45) default null, + `network_type` varchar(45) default null, + `network_role` varchar(200) default null, + `network_scope` varchar(45) default null, + `creation_timestamp` datetime not null default current_timestamp, + `network_resource_model_uuid` varchar(200) not null, + primary key (`model_customization_uuid`), + key `fk_network_resource_customization__network_resource1_idx` (`network_resource_model_uuid`), + constraint `fk_network_resource_customization__network_resource1` foreign key (`network_resource_model_uuid`) references `network_resource` (`model_uuid`) on delete cascade on update cascade +) engine=innodb default charset=latin1; + + + + + +create table `tosca_csar` ( + `artifact_uuid` varchar(200) not null, + `name` varchar(200) not null, + `version` varchar(20) not null, + `description` varchar(1200) default null, + `artifact_checksum` varchar(200) not null, + `url` varchar(200) not null, + `creation_timestamp` datetime not null default current_timestamp, + primary key (`artifact_uuid`) +) engine=innodb default charset=latin1; + + + + +create table `service` ( + `model_uuid` varchar(200) not null, + `model_name` varchar(200) not null, + `model_invariant_uuid` varchar(200) not null, + `model_version` varchar(20) not null, + `description` varchar(1200) default null, + `creation_timestamp` datetime not null default current_timestamp, + `tosca_csar_artifact_uuid` varchar(200) default null, + `service_type` varchar(200) default null, + `service_role` varchar(200) default null, + `environment_context` varchar(200) default null, + `workload_context` varchar(200) default null, + `service_category` varchar(200) default null, + primary key (`model_uuid`), + key `fk_service__tosca_csar1_idx` (`tosca_csar_artifact_uuid`), + constraint `fk_service__tosca_csar1` foreign key (`tosca_csar_artifact_uuid`) references `tosca_csar` (`artifact_uuid`) on delete cascade on update cascade +) engine=innodb default charset=latin1; + + + +create table `service_recipe` ( + `id` int(11) not null auto_increment, + `action` varchar(50) not null, + `version_str` varchar(20) default null, + `description` varchar(1200) default null, + `orchestration_uri` varchar(256) not null, + `service_param_xsd` varchar(2048) default null, + `recipe_timeout` int(11) default null, + `service_timeout_interim` int(11) default null, + `creation_timestamp` datetime not null default current_timestamp, + `service_model_uuid` varchar(200) not null, + primary key (`id`), + unique key `uk_7fav5dkux2v8g9d2i5ymudlgc` (`service_model_uuid`,`action`), + key `fk_service_recipe__service1_idx` (`service_model_uuid`), + constraint `fk_service_recipe__service1` foreign key (`service_model_uuid`) references `service` (`model_uuid`) on delete cascade on update cascade +) engine=innodb auto_increment=86 default charset=latin1; + + + +create table `vnf_resource` ( + `orchestration_mode` varchar(20) not null default 'heat', + `description` varchar(1200) default null, + `creation_timestamp` datetime not null default current_timestamp, + `model_uuid` varchar(200) not null, + `aic_version_min` varchar(20) default null, + `aic_version_max` varchar(20) default null, + `model_invariant_uuid` varchar(200) default null, + `model_version` varchar(20) not null, + `model_name` varchar(200) default null, + `tosca_node_type` varchar(200) default null, + `resource_category` varchar(200) default null, + `resource_sub_category` varchar(200) default null, + `heat_template_artifact_uuid` varchar(200) default null, + primary key (`model_uuid`), + key `fk_vnf_resource__heat_template1` (`heat_template_artifact_uuid`), + constraint `fk_vnf_resource__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade +) engine=innodb default charset=latin1; + + + + +create table `vf_module` ( + `model_uuid` varchar(200) not null, + `model_invariant_uuid` varchar(200) default null, + `model_version` varchar(20) not null, + `model_name` varchar(200) not null, + `description` varchar(1200) default null, + `is_base` int(11) not null, + `heat_template_artifact_uuid` varchar(200) default null, + `vol_heat_template_artifact_uuid` varchar(200) default null, + `creation_timestamp` datetime not null default current_timestamp, + `vnf_resource_model_uuid` varchar(200) not null, + primary key (`model_uuid`,`vnf_resource_model_uuid`), + key `fk_vf_module__vnf_resource1_idx` (`vnf_resource_model_uuid`), + key `fk_vf_module__heat_template_art_uuid__heat_template1_idx` (`heat_template_artifact_uuid`), + key `fk_vf_module__vol_heat_template_art_uuid__heat_template2_idx` (`vol_heat_template_artifact_uuid`), + constraint `fk_vf_module__heat_template_art_uuid__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade, + constraint `fk_vf_module__vnf_resource1` foreign key (`vnf_resource_model_uuid`) references `vnf_resource` (`model_uuid`) on delete cascade on update cascade, + constraint `fk_vf_module__vol_heat_template_art_uuid__heat_template2` foreign key (`vol_heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade +) engine=innodb default charset=latin1; + + + +/*!40101 set @saved_cs_client = @@character_set_client */; +/*!40101 set character_set_client = utf8 */; +create table `vf_module_customization` ( + `model_customization_uuid` varchar(200) not null, + `label` varchar(200) default null, + `initial_count` int(11) default '0', + `min_instances` int(11) default '0', + `max_instances` int(11) default null, + `availability_zone_count` int(11) default null, + `heat_environment_artifact_uuid` varchar(200) default null, + `vol_environment_artifact_uuid` varchar(200) default null, + `creation_timestamp` datetime not null default current_timestamp, + `vf_module_model_uuid` varchar(200) not null, + primary key (`model_customization_uuid`), + key `fk_vf_module_customization__vf_module1_idx` (`vf_module_model_uuid`), + key `fk_vf_module_customization__heat_env__heat_environment1_idx` (`heat_environment_artifact_uuid`), + key `fk_vf_module_customization__vol_env__heat_environment2_idx` (`vol_environment_artifact_uuid`), + constraint `fk_vf_module_customization__heat_env__heat_environment1` foreign key (`heat_environment_artifact_uuid`) references `heat_environment` (`artifact_uuid`) on delete cascade on update cascade, + constraint `fk_vf_module_customization__vf_module1` foreign key (`vf_module_model_uuid`) references `vf_module` (`model_uuid`) on delete cascade on update cascade, + constraint `fk_vf_module_customization__vol_env__heat_environment2` foreign key (`vol_environment_artifact_uuid`) references `heat_environment` (`artifact_uuid`) on delete cascade on update cascade +) engine=innodb default charset=latin1; +/*!40101 set character_set_client = @saved_cs_client */; + +-- +-- table structure for table `vf_module_to_heat_files` +-- + + +/*!40101 set @saved_cs_client = @@character_set_client */; +/*!40101 set character_set_client = utf8 */; +create table `vf_module_to_heat_files` ( + `vf_module_model_uuid` varchar(200) not null, + `heat_files_artifact_uuid` varchar(200) not null, + primary key (`vf_module_model_uuid`,`heat_files_artifact_uuid`), + key `fk_vf_module_to_heat_files__heat_files__artifact_uuid1_idx` (`heat_files_artifact_uuid`), + constraint `fk_vf_module_to_heat_files__heat_files__artifact_uuid1` foreign key (`heat_files_artifact_uuid`) references `heat_files` (`artifact_uuid`) on delete cascade on update cascade, + constraint `fk_vf_module_to_heat_files__vf_module__model_uuid1` foreign key (`vf_module_model_uuid`) references `vf_module` (`model_uuid`) on delete cascade on update cascade +) engine=innodb default charset=latin1 comment='il fait ce qu''il dit'; +/*!40101 set character_set_client = @saved_cs_client */; + +-- +-- table structure for table `vnf_components` +-- + + +/*!40101 set @saved_cs_client = @@character_set_client */; +/*!40101 set character_set_client = utf8 */; +create table `vnf_components` ( + `vnf_id` int(11) not null, + `component_type` varchar(20) not null, + `heat_template_id` int(11) default null, + `heat_environment_id` int(11) default null, + `creation_timestamp` datetime not null default current_timestamp, + primary key (`vnf_id`,`component_type`) +) engine=innodb default charset=latin1; +/*!40101 set character_set_client = @saved_cs_client */; + +-- +-- table structure for table `vnf_components_recipe` +-- + + + +create table `vnf_components_recipe` ( + `id` int(11) not null auto_increment, + `vnf_type` varchar(200) default null, + `vnf_component_type` varchar(45) not null, + `action` varchar(50) not null, + `service_type` varchar(45) default null, + `version` varchar(20) not null, + `description` varchar(1200) default null, + `orchestration_uri` varchar(256) not null, + `vnf_component_param_xsd` varchar(2048) default null, + `recipe_timeout` int(11) default null, + `creation_timestamp` datetime default current_timestamp, + `vf_module_model_uuid` varchar(200) default null, + primary key (`id`), + unique key `uk_4dpdwddaaclhc11wxsb7h59ma` (`vf_module_model_uuid`,`vnf_component_type`,`action`,`version`) +) engine=innodb auto_increment=26 default charset=latin1; + + + + +create table `vnf_recipe` ( + `id` int(11) not null auto_increment, + `vnf_type` varchar(200) default null, + `action` varchar(50) not null, + `service_type` varchar(45) default null, + `version_str` varchar(20) not null, + `description` varchar(1200) default null, + `orchestration_uri` varchar(256) not null, + `vnf_param_xsd` varchar(2048) default null, + `recipe_timeout` int(11) default null, + `creation_timestamp` datetime default current_timestamp, + `vf_module_id` varchar(100) default null, + primary key (`id`), + unique key `uk_f3tvqau498vrifq3cr8qnigkr` (`vf_module_id`,`action`,`version_str`) +) engine=innodb auto_increment=10006 default charset=latin1; + + + + + + + + +create table `vnf_resource_customization` ( + `model_customization_uuid` varchar(200) not null, + `model_instance_name` varchar(200) not null, + `min_instances` int(11) default null, + `max_instances` int(11) default null, + `availability_zone_max_count` int(11) default null, + `nf_type` varchar(200) default null, + `nf_role` varchar(200) default null, + `nf_function` varchar(200) default null, + `nf_naming_code` varchar(200) default null, + `creation_timestamp` datetime not null default current_timestamp, + `vnf_resource_model_uuid` varchar(200) not null, + `multi_stage_design` varchar(20) default null, + primary key (`model_customization_uuid`), + key `fk_vnf_resource_customization__vnf_resource1_idx` (`vnf_resource_model_uuid`), + constraint `fk_vnf_resource_customization__vnf_resource1` foreign key (`vnf_resource_model_uuid`) references `vnf_resource` (`model_uuid`) on delete cascade on update cascade +) engine=innodb default charset=latin1; + + + + +create table `vnf_res_custom_to_vf_module_custom` ( + `vnf_resource_cust_model_customization_uuid` varchar(200) not null, + `vf_module_cust_model_customization_uuid` varchar(200) not null, + `creation_timestamp` datetime not null default current_timestamp, + primary key (`vnf_resource_cust_model_customization_uuid`,`vf_module_cust_model_customization_uuid`), + key `fk_vnf_res_custom_to_vf_module_custom__vf_module_customizat_idx` (`vf_module_cust_model_customization_uuid`), + constraint `fk_vnf_res_custom_to_vf_module_custom__vf_module_customization1` foreign key (`vf_module_cust_model_customization_uuid`) references `vf_module_customization` (`model_customization_uuid`) on delete cascade on update cascade, + constraint `fk_vnf_res_custom_to_vf_module_custom__vnf_resource_customiza1` foreign key (`vnf_resource_cust_model_customization_uuid`) references `vnf_resource_customization` (`model_customization_uuid`) on delete cascade on update cascade +) engine=innodb default charset=latin1; + + +create table if not exists external_service_to_internal_model_mapping ( +id int(11) not null, +service_name varchar(200) not null, +product_flavor varchar(200) null, +subscription_service_type varchar(200) not null, +service_model_uuid varchar(200) not null, +primary key (id), +unique index uk_external_service_to_internal_model_mapping +(service_name asc, product_flavor asc, service_model_uuid asc)); + +create table if not exists `collection_resource` ( + model_uuid varchar(200) not null, + model_name varchar(200) not null, + model_invariant_uuid varchar(200) not null, + model_version varchar(20) not null, + tosca_node_type varchar(200) not null, + description varchar(200), + creation_timestamp datetime not null default current_timestamp, + primary key (`model_uuid`) +)engine=innodb default charset=latin1; + +create table if not exists `collection_resource_customization` ( + model_customization_uuid varchar(200) not null, + model_instance_name varchar(200) not null, + role varchar(200) NULL, + object_type varchar(200) not null, + function varchar(200) NULL, + collection_resource_type varchar(200) NULL, + creation_timestamp datetime not null default current_timestamp, + cr_model_uuid varchar(200) not null, + primary key (`model_customization_uuid`) +)engine=innodb default charset=latin1; + +create table if not exists `instance_group` ( + model_uuid varchar(200) not null, + model_name varchar(200) not null, + model_invariant_uuid varchar(200) not null, + model_version varchar(20) not null, + tosca_node_type varchar(200) NULL, + role varchar(200) not null, + object_type varchar(200) not null, + creation_timestamp datetime not null default current_timestamp, + cr_model_uuid varchar(200) not null, + instance_group_type varchar(200) not null, + primary key (`model_uuid`) +)engine=innodb default charset=latin1; + +create table if not exists `collection_resource_instance_group_customization` ( + `collection_resource_customization_model_uuid` varchar(200) not null, + `instance_group_model_uuid` varchar(200) not null, + `function` varchar(200) null, + `description` varchar(1200) null, + `subinterface_network_quantity` int(11) null, + `creation_timestamp` datetime not null default current_timestamp, + primary key (`collection_resource_customization_model_uuid`, `instance_group_model_uuid`), + index `fk_collection_resource_instance_group_customization__instan_idx` (`instance_group_model_uuid` asc), + constraint `fk_collection_resource_instance_group_customization__collecti1` + foreign key (`collection_resource_customization_model_uuid`) + references `collection_resource_customization` (`model_customization_uuid`) + on delete cascade + on update cascade, + constraint `fk_collection_resource_instance_group_customization__instance1` + foreign key (`instance_group_model_uuid`) + references `instance_group` (`model_uuid`) + on delete cascade + on update cascade) +engine = innodb +default character set = latin1; + +create table if not exists `vnfc_instance_group_customization` ( + `vnf_resource_customization_model_uuid` varchar(200) not null, + `instance_group_model_uuid` varchar(200) not null, + `function` varchar(200) null, + `description` varchar(1200) null, + `creation_timestamp` datetime not null default current_timestamp, + primary key (`vnf_resource_customization_model_uuid`, `instance_group_model_uuid`), + index `fk_vnfc_instance_group_customization__instance_group1_idx` (`instance_group_model_uuid` asc), + constraint `fk_vnfc_instance_group_customization__vnf_resource_customizat1` + foreign key (`vnf_resource_customization_model_uuid`) + references `vnf_resource_customization` (`model_customization_uuid`) + on delete cascade + on update cascade, + constraint `fk_vnfc_instance_group_customization__instance_group1` + foreign key (`instance_group_model_uuid`) + references `instance_group` (`model_uuid`) + on delete cascade + on update cascade) +engine = innodb +default character set = latin1; + + create table if not exists `configuration` + ( `model_uuid` varchar(200) not null, + `model_invariant_uuid` varchar(200) not null, + `model_version` varchar(20) not null, + `model_name` varchar(200) not null, + `tosca_node_type` varchar(200) not null, + `description` varchar(1200) null, + `creation_timestamp` datetime not null default current_timestamp, + primary key (`model_uuid`)) + engine = innodb auto_increment = 20654 + default character set = latin1; + + create table if not exists `service_proxy` ( + `model_uuid` varchar(200) not null, + `model_invariant_uuid` varchar(200) not null, + `model_version` varchar(20) not null, + `model_name` varchar(200) not null, + `description` varchar(1200) null, + `creation_timestamp` datetime not null default current_timestamp, + primary key (`model_uuid`)) + engine = innodb auto_increment = 20654 + default character set = latin1; + +create table if not exists `service_proxy_customization` ( +`model_customization_uuid` varchar(200) not null, +`model_instance_name` varchar(200) not null, +`tosca_node_type` varchar(200) not null, +`source_service_model_uuid` varchar(200) not null, +`creation_timestamp` datetime not null default current_timestamp, +`service_proxy_model_uuid` varchar(200) not null, +primary key (`model_customization_uuid`), +index `fk_service_proxy_customization__service_proxy1_idx` (`service_proxy_model_uuid` asc), +index `fk_service_proxy_customization__service1_idx` (`source_service_model_uuid` asc), +constraint`fk_spr_customization__service_proxy_resource1` +foreign key (`service_proxy_model_uuid`) references `service_proxy` (`model_uuid`) +on delete cascade on update cascade, +constraint `fk_service_proxy_resource_customization__service1` +foreign key (`source_service_model_uuid`) references `service` +(`model_uuid`) on delete cascade on update cascade) +engine = innodb +auto_increment = 20654 +default character set = latin1; + +create table if not exists `configuration_customization` ( +`model_customization_uuid` varchar(200) not null, +`model_instance_name` varchar(200) not null, +`configuration_type` varchar(200) null, +`configuration_role` varchar(200) null, +`configuration_function` varchar(200) null, +`creation_timestamp` datetime not null default current_timestamp, +`configuration_model_uuid` varchar(200) not null, +`service_proxy_customization_model_customization_uuid` varchar(200) null, +`configuration_customization_model_customization_uuid` varchar(200) null, +primary key (`model_customization_uuid`), +index `fk_configuration_customization__configuration_idx` (`configuration_model_uuid` asc), +index `fk_configuration_customization__service_proxy_customization_idx` +(`service_proxy_customization_model_customization_uuid` asc), +index `fk_configuration_customization__configuration_customization_idx` +(`configuration_customization_model_customization_uuid` asc), +constraint `fk_configuration_resource_customization__configuration_resour1` +foreign key (`configuration_model_uuid`) references `configuration` (`model_uuid`) +on delete cascade on update cascade, +constraint `fk_configuration_customization__service_proxy_customization1` foreign +key (`service_proxy_customization_model_customization_uuid`) references +`service_proxy_customization` (`model_customization_uuid`) +on delete cascade on update cascade, constraint +`fk_configuration_customization__configuration_customization1` foreign +key (`configuration_customization_model_customization_uuid`) references +`configuration_customization` (`model_customization_uuid`) +on delete cascade on update cascade) +engine = innodb +auto_increment =20654 +default character set = latin1; + + +create table `service_proxy_customization_to_service` ( + `service_model_uuid` varchar(200) not null, + `resource_model_customization_uuid` varchar(200) not null, + primary key (`service_model_uuid`,`resource_model_customization_uuid`) +)engine=innodb default charset=latin1; + + +create table `configuration_customization_to_service` ( + `service_model_uuid` varchar(200) not null, + `resource_model_customization_uuid` varchar(200) not null, + primary key (`service_model_uuid`,`resource_model_customization_uuid`) +)engine=innodb default charset=latin1; + + +create table if not exists `collection_resource_customization_to_service` ( + `service_model_uuid` varchar(200) not null, + `resource_model_customization_uuid` varchar(200) not null, + primary key (`service_model_uuid`,`resource_model_customization_uuid`) +)engine=innodb default charset=latin1; + + +create table `network_resource_customization_to_service` ( + `service_model_uuid` varchar(200) not null, + `resource_model_customization_uuid` varchar(200) not null, + primary key (`service_model_uuid`,`resource_model_customization_uuid`) +)engine=innodb default charset=latin1; + +create table `vnf_resource_customization_to_service` ( + `service_model_uuid` varchar(200) not null, + `resource_model_customization_uuid` varchar(200) not null, + primary key (`service_model_uuid`,`resource_model_customization_uuid`) +)engine=innodb default charset=latin1; + +create table `allotted_resource_customization_to_service` ( + `service_model_uuid` varchar(200) not null, + `resource_model_customization_uuid` varchar(200) not null, + primary key (`service_model_uuid`,`resource_model_customization_uuid`) +)engine=innodb default charset=latin1; + + + +create table ar_recipe ( + ID INT(11) not null auto_increment, + MODEL_NAME VARCHAR(200) NOT NULL, + `ACTION` VARCHAR(200) NOT NULL, + VERSION_STR VARCHAR(200) NOT NULL, + SERVICE_TYPE VARCHAR(200), + DESCRIPTION VARCHAR(200), + ORCHESTRATION_URI VARCHAR(200) NOT NULL, + AR_PARAM_XSD VARCHAR(200), + RECIPE_TIMEOUT INT(10), + CREATION_TIMESTAMP DATETIME NOT NULL default current_timestamp, + primary key (ID), + unique key `uk_ar_recipe` (`model_name`,`action`,`version_str`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +alter table collection_resource_customization +add foreign key ( cr_model_uuid) +references collection_resource(model_uuid) +on delete cascade; + +alter table vnf_resource_customization +add column +instance_group_model_uuid varchar(200); + +alter table network_resource_customization +add column +instance_group_model_uuid varchar(200); + + +alter table network_resource_customization +add foreign key ( instance_group_model_uuid) +references instance_group(model_uuid) +on delete cascade; + +alter table collection_resource_customization_to_service +add foreign key (service_model_uuid) +references service(model_uuid) +on delete cascade; + +alter table allotted_resource_customization_to_service +add foreign key (service_model_uuid) +references service(model_uuid) +on delete cascade; + + +alter table vnf_resource_customization_to_service +add foreign key (service_model_uuid) +references service(model_uuid) +on delete cascade; + + +alter table network_resource_customization_to_service +add foreign key (service_model_uuid) +references service(model_uuid) +on delete cascade; + + +alter table network_resource_customization_to_service +add foreign key (resource_model_customization_uuid) +references network_resource_customization(model_customization_uuid) +on delete cascade; + +alter table vnf_resource_customization_to_service +add foreign key (resource_model_customization_uuid) +references vnf_resource_customization(model_customization_uuid) +on delete cascade; + +alter table allotted_resource_customization_to_service +add foreign key (resource_model_customization_uuid) +references allotted_resource_customization(model_customization_uuid) +on delete cascade; + +alter table collection_resource_customization_to_service +add foreign key (resource_model_customization_uuid) +references collection_resource_customization(model_customization_uuid) +on delete cascade; + + +create table if not exists `collection_network_resource_customization` ( +`model_customization_uuid` varchar(200) not null, +`model_instance_name` varchar(200) not null, +`network_technology` varchar(45) null, +`network_type` varchar(45) null, +`network_role` varchar(200) null, +`network_scope` varchar(45) null, +`creation_timestamp` datetime not null default current_timestamp, +`network_resource_model_uuid` varchar(200) not null, `instance_group_model_uuid` varchar(200) null, +`crc_model_customization_uuid` varchar(200) not null, primary key +(`model_customization_uuid`, `crc_model_customization_uuid`), +index `fk_collection_net_resource_customization__network_resource1_idx` +(`network_resource_model_uuid` asc), index +`fk_collection_net_resource_customization__instance_group1_idx` +(`instance_group_model_uuid` asc), index +`fk_col_net_res_customization__collection_res_customization_idx` +(`crc_model_customization_uuid` asc), constraint +`fk_collection_net_resource_customization__network_resource10` foreign +key (`network_resource_model_uuid`) references +`network_resource` (`model_uuid`) on delete cascade on +update cascade, constraint +`fk_collection_net_resource_customization__instance_group10` foreign key +(`instance_group_model_uuid`) references `instance_group` +(`model_uuid`) on delete cascade on update cascade, constraint +`fk_collection_network_resource_customization__collection_reso1` foreign +key (`crc_model_customization_uuid`) references +`collection_resource_customization` +(`model_customization_uuid`) on delete cascade on update cascade) engine += innodb default character set = latin1; + +CREATE TABLE IF NOT EXISTS `northbound_request_ref_lookup` ( +`id` INT(11) NOT NULL AUTO_INCREMENT, +`REQUEST_SCOPE` VARCHAR(200) NOT NULL, +`MACRO_ACTION` VARCHAR(200) NOT NULL, +`ACTION` VARCHAR(200) NOT NULL, +`IS_ALACARTE` TINYINT(1) NOT NULL DEFAULT 0, +`IS_TOPLEVELFLOW` TINYINT(1) NOT NULL DEFAULT 1, +`MIN_API_VERSION` DOUBLE NOT NULL, +`MAX_API_VERSION` DOUBLE NULL, +PRIMARY KEY (`id`), +UNIQUE INDEX `UK_northbound_request_ref_lookup` (`MIN_API_VERSION` ASC, `REQUEST_SCOPE` ASC, `ACTION` ASC, `IS_ALACARTE` ASC, `MACRO_ACTION` ASC)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS orchestration_status_state_transition_directive ( +id INT(11) AUTO_INCREMENT, +RESOURCE_TYPE VARCHAR(25) NOT NULL, +ORCHESTRATION_STATUS VARCHAR(25) NOT NULL, +TARGET_ACTION VARCHAR(25) NOT NULL, +FLOW_DIRECTIVE VARCHAR(25) NOT NULL, +PRIMARY KEY (id), +UNIQUE KEY UK_orchestration_status_state_transition_directive (RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +create table if not exists model_recipe ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `MODEL_ID` INT(11), + `ACTION` VARCHAR(40), + `SCHEMA_VERSION` VARCHAR(40), + `DESCRIPTION` VARCHAR(40), + `ORCHESTRATION_URI` VARCHAR(20), + `MODEL_PARAM_XSD` VARCHAR(20), + `RECIPE_TIMEOUT` INT(11), + `CREATION_TIMESTAMP` datetime not null default current_timestamp, + PRIMARY KEY (`ID`), + CONSTRAINT uk1_model_recipe UNIQUE (`MODEL_ID`, `ACTION`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +create table if not exists model ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_ID` VARCHAR(40), + `MODEL_CUSTOMIZATION_NAME` VARCHAR(40), + `MODEL_INVARIANT_ID` VARCHAR(40), + `MODEL_NAME` VARCHAR(40), + `MODEL_TYPE` VARCHAR(20), + `MODEL_VERSION` VARCHAR(20), + `MODEL_VERSION_ID` VARCHAR(40), + `CREATION_TIMESTAMP` datetime not null default current_timestamp, + `RECIPE` INT(11), + PRIMARY KEY (`ID`), + CONSTRAINT uk1_model UNIQUE (`MODEL_TYPE`, `MODEL_VERSION_ID`), + FOREIGN KEY (`RECIPE`) REFERENCES `model_recipe` (`MODEL_ID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +ALTER TABLE `vnf_recipe` +CHANGE COLUMN `VNF_TYPE` `NF_ROLE` VARCHAR(200) NULL DEFAULT NULL ;
\ No newline at end of file diff --git a/mso-catalog-db/src/test/resources/status-request.json b/mso-catalog-db/src/test/resources/status-request.json new file mode 100644 index 0000000000..b8714168eb --- /dev/null +++ b/mso-catalog-db/src/test/resources/status-request.json @@ -0,0 +1,82 @@ +{ + "requestInfo": { + "requestId": "random uuid", + "requestorId": "userid", + "sourceSystem": "VID", + "suppressRollback": false, + "seflLink":"http://getorchestrationrequest/request-id" + }, + "statusInfo": { + "result": "COMPLETED/FAILED/ManualFallout", + "statusMessage": "MESSSAGE", + "errorCode": "5000" + }, + "serviceInstance": { + "serviceInstanceId": "UUID", + "modelInfo": { + "modelInvariantId": "c8b07c20-02bc-4ecc-bd48-e27eab8617ae", + "modelInvariantUuid": "c8b07c20-02bc-4ecc-bd48-e27eab8617ae", + "modelName": "0503_Test", + "modelType": "service", + "modelUuid": "b6f8ed8f-a3be-4f38-8a60-c74fcaaea8ba", + "modelVersion": "1.0", + "modelVersionId": "b6f8ed8f-a3be-4f38-8a60-c74fcaaea8ba" + } + }, + "resourcesOrchestrated": { + "serviceInstance": { + "serviceInstanceId": "UUID", + "orchestrationStatus": "Active", + "modelInfo": { + "modelInvariantId": "c8b07c20-02bc-4ecc-bd48-e27eab8617ae", + "modelInvariantUuid": "c8b07c20-02bc-4ecc-bd48-e27eab8617ae", + "modelName": "0503_Test", + "modelType": "service", + "modelUuid": "b6f8ed8f-a3be-4f38-8a60-c74fcaaea8ba", + "modelVersion": "1.0", + "modelVersionId": "b6f8ed8f-a3be-4f38-8a60-c74fcaaea8ba" + }, + "actionsTaken": [ + "assign", + "create", + "activate" + ] + }, + "genericVnf": { + "genericVnfId": "UUID", + "orchestrationStatus": "Active", + "modelInfo": { + "modelInvariantId": "c8b07c20-02bc-4ecc-bd48-e27eab8617ae", + "modelInvariantUuid": "c8b07c20-02bc-4ecc-bd48-e27eab8617ae", + "modelName": "0503_Test", + "modelType": "service", + "modelUuid": "b6f8ed8f-a3be-4f38-8a60-c74fcaaea8ba", + "modelVersion": "1.0", + "modelVersionId": "b6f8ed8f-a3be-4f38-8a60-c74fcaaea8ba" + }, + "actionsTaken": [ + "assign", + "create", + "activate" + ] + }, + "vfModule": { + "vfModuleId": "UUID", + "orchestrationStatus": "Active", + "modelInfo": { + "modelInvariantId": "c8b07c20-02bc-4ecc-bd48-e27eab8617ae", + "modelInvariantUuid": "c8b07c20-02bc-4ecc-bd48-e27eab8617ae", + "modelName": "0503_Test", + "modelType": "service", + "modelUuid": "b6f8ed8f-a3be-4f38-8a60-c74fcaaea8ba", + "modelVersion": "1.0", + "modelVersionId": "b6f8ed8f-a3be-4f38-8a60-c74fcaaea8ba" + }, + "actionsTaken": [ + "assign", + "create", + "activate" + ] + } + } +}
\ No newline at end of file |