diff options
Diffstat (limited to 'asdc-controller/src/test')
47 files changed, 3649 insertions, 2635 deletions
diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/ActivitySpecsActionsTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/ActivitySpecsActionsTest.java new file mode 100644 index 0000000000..438120924a --- /dev/null +++ b/asdc-controller/src/test/java/org/onap/asdc/activity/ActivitySpecsActionsTest.java @@ -0,0 +1,76 @@ +/*- + * ============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.asdc.activity; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; +import static org.junit.Assert.*; +import org.junit.Test; +import org.onap.so.asdc.BaseTest; +import org.onap.so.asdc.activity.ActivitySpecsActions; +import org.onap.so.asdc.activity.beans.ActivitySpec; +import org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse; +import org.springframework.beans.factory.annotation.Autowired; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class ActivitySpecsActionsTest extends BaseTest { + @Autowired + ActivitySpecsActions activitySpecsActions; + + @Test + public void CreateActivitySpec_Test() throws Exception { + String HOSTNAME = createURLWithPort(""); + + ActivitySpec activitySpec = new ActivitySpec(); + activitySpec.setName("testActivitySpec"); + activitySpec.setDescription("Test Activity Spec"); + ActivitySpecCreateResponse activitySpecCreateResponse = new ActivitySpecCreateResponse(); + activitySpecCreateResponse.setId("testActivityId"); + ObjectMapper mapper = new ObjectMapper(); + String body = mapper.writeValueAsString(activitySpecCreateResponse); + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.OK.value()).withBody(body))); + + String activitySpecId = activitySpecsActions.createActivitySpec(HOSTNAME, activitySpec); + assertEquals("testActivityId", activitySpecId); + } + + @Test + public void CertifyActivitySpec_Test() throws Exception { + String HOSTNAME = createURLWithPort(""); + + String activitySpecId = "testActivitySpec"; + String urlPath = "/v1.0/activity-spec/testActivitySpec/versions/latest/actions"; + + wireMockServer.stubFor( + put(urlPathMatching(urlPath)).willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.OK.value()))); + + boolean certificationResult = activitySpecsActions.certifyActivitySpec(HOSTNAME, activitySpecId); + assertTrue(certificationResult); + } + + private String createURLWithPort(String uri) { + return "http://localhost:" + wireMockPort + uri; + } +} diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java new file mode 100644 index 0000000000..86f6a89af5 --- /dev/null +++ b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java @@ -0,0 +1,38 @@ +/*- + * ============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.asdc.activity; + +import org.junit.Test; +import org.onap.so.asdc.BaseTest; +import org.onap.so.asdc.activity.DeployActivitySpecs; +import org.springframework.beans.factory.annotation.Autowired; + + +public class DeployActivitySpecsTest extends BaseTest { + + @Autowired + private DeployActivitySpecs deployActivitySpecs; + + @Test + public void DeployActivitySpecs_Test() throws Exception { + // Mock catalog DB results + deployActivitySpecs.deployActivities(); + } +} diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/ASDCPojoTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/ASDCPojoTest.java index 354b6dac3c..dc51d46888 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/ASDCPojoTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/ASDCPojoTest.java @@ -29,7 +29,6 @@ import org.onap.so.asdc.client.test.emulators.JsonVfModuleMetaData; import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; import org.onap.so.asdc.client.test.emulators.ResourceInfoImpl; import org.onap.so.asdc.installer.VfResourceStructure; - import com.openpojo.reflection.PojoClass; import com.openpojo.reflection.impl.PojoClassFactory; import com.openpojo.validation.Validator; @@ -38,23 +37,20 @@ import com.openpojo.validation.test.impl.GetterTester; import com.openpojo.validation.test.impl.SetterTester; public class ASDCPojoTest { - @Test - public void pojoStructure() { - test(PojoClassFactory.getPojoClass(FinalDistributionStatusMessage.class)); - test(PojoClassFactory.getPojoClass(ArtifactInfoImpl.class)); - test(PojoClassFactory.getPojoClass(NotificationDataImpl.class)); - test(PojoClassFactory.getPojoClass(JsonVfModuleMetaData.class)); - test(PojoClassFactory.getPojoClass(ResourceInfoImpl.class)); - test(PojoClassFactory.getPojoClass(DistributionClientEmulator.class)); - test(PojoClassFactory.getPojoClass(JsonStatusData.class)); - test(PojoClassFactory.getPojoClass(VfResourceStructure.class)); - } - - private void test(PojoClass pojoClass) { - Validator validator = ValidatorBuilder.create() - .with(new SetterTester()) - .with(new GetterTester()) - .build(); - validator.validate(pojoClass); - } + @Test + public void pojoStructure() { + test(PojoClassFactory.getPojoClass(FinalDistributionStatusMessage.class)); + test(PojoClassFactory.getPojoClass(ArtifactInfoImpl.class)); + test(PojoClassFactory.getPojoClass(NotificationDataImpl.class)); + test(PojoClassFactory.getPojoClass(JsonVfModuleMetaData.class)); + test(PojoClassFactory.getPojoClass(ResourceInfoImpl.class)); + test(PojoClassFactory.getPojoClass(DistributionClientEmulator.class)); + test(PojoClassFactory.getPojoClass(JsonStatusData.class)); + test(PojoClassFactory.getPojoClass(VfResourceStructure.class)); + } + + private void test(PojoClass pojoClass) { + Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); + validator.validate(pojoClass); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/AllTestsTestSuite.java b/asdc-controller/src/test/java/org/onap/so/asdc/AllTestsTestSuite.java new file mode 100644 index 0000000000..fb8e5bbc2f --- /dev/null +++ b/asdc-controller/src/test/java/org/onap/so/asdc/AllTestsTestSuite.java @@ -0,0 +1,32 @@ +/*- + * ============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.asdc; + +import org.junit.runner.RunWith; +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses("**/*Test.class") +public class AllTestsTestSuite { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java index 74f0d60596..7ecd472c50 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java @@ -21,7 +21,6 @@ package org.onap.so.asdc; import static org.mockito.Mockito.reset; - import org.junit.After; import org.junit.runner.RunWith; import org.onap.so.asdc.installer.ToscaResourceStructure; @@ -29,6 +28,7 @@ import org.onap.so.asdc.installer.VfResourceStructure; import org.onap.so.asdc.installer.heat.ToscaResourceInstaller; import org.onap.so.asdc.tenantIsolation.WatchdogDistribution; import org.onap.so.spring.SpringContextHelper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.ConfigFileApplicationContextInitializer; import org.springframework.boot.test.context.SpringBootTest; @@ -38,28 +38,32 @@ import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; +import com.github.tomakehurst.wiremock.WireMockServer; @RunWith(SpringRunner.class) @SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") @ContextConfiguration(classes = SpringContextHelper.class, initializers = ConfigFileApplicationContextInitializer.class) @AutoConfigureWireMock(port = 0) + public abstract class BaseTest { - @MockBean - protected VfResourceStructure vfResourceStructure; - @MockBean - protected ToscaResourceStructure toscaResourceStruct; - @SpyBean - protected WatchdogDistribution watchdogDistributionSpy; - @SpyBean - protected ToscaResourceInstaller toscaInstaller; - - @Value("${wiremock.server.port}") + @MockBean + protected VfResourceStructure vfResourceStructure; + @MockBean + protected ToscaResourceStructure toscaResourceStruct; + @SpyBean + protected WatchdogDistribution watchdogDistributionSpy; + @SpyBean + protected ToscaResourceInstaller toscaInstaller; + @Autowired + protected WireMockServer wireMockServer; + + @Value("${wiremock.server.port}") protected String wireMockPort; - @After - public void after() { - reset(vfResourceStructure); - reset(toscaResourceStruct); - } + @After + public void after() { + reset(vfResourceStructure); + reset(toscaResourceStruct); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/BeansTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/BeansTest.java new file mode 100644 index 0000000000..86e4d27a1e --- /dev/null +++ b/asdc-controller/src/test/java/org/onap/so/asdc/BeansTest.java @@ -0,0 +1,70 @@ +/*- + * ============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.asdc; + +import org.junit.Test; +import org.onap.so.openpojo.rules.ToStringTester; +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.PojoClassFilter; +import com.openpojo.reflection.filters.FilterEnum; +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.GetterMustExistRule; +import com.openpojo.validation.rule.impl.SetterMustExistRule; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + +public class BeansTest { + + + private PojoClassFilter filterTestClasses = new FilterTestClasses(); + + private PojoClassFilter enumFilter = new FilterEnum(); + + + @Test + public void pojoStructure() { + test("org.onap.so.asdc.activity.beans"); + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create().with(new GetterMustExistRule()).with(new SetterMustExistRule()) + + .with(new SetterTester()).with(new GetterTester()) + + .with(new SetterTester()).with(new GetterTester()).with(new ToStringTester()) + + .build(); + + + validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses, enumFilter, + new FilterNonConcrete()); + } + + private static class FilterTestClasses implements PojoClassFilter { + @Override + public boolean include(PojoClass pojoClass) { + return !pojoClass.getSourcePath().contains("/test-classes/"); + } + } +} diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java b/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java index 27b6c0ab53..e81a318e68 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java @@ -19,10 +19,10 @@ */ package org.onap.so.asdc; + import ch.vorburger.exec.ManagedProcessException; import ch.vorburger.mariadb4j.DBConfigurationBuilder; import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; - import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.jdbc.DataSourceBuilder; @@ -36,17 +36,14 @@ import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; - import javax.persistence.EntityManagerFactory; import javax.sql.DataSource; @Configuration @Profile({"test"}) @EnableTransactionManagement -@EnableJpaRepositories( - entityManagerFactoryRef = "entityManagerFactory", - basePackages = {"org.onap.so.db.catalog.data.repository"} - ) +@EnableJpaRepositories(entityManagerFactoryRef = "entityManagerFactory", + basePackages = {"org.onap.so.db.catalog.data.repository"}) public class EmbeddedCatalogDbConfig { @Bean @@ -54,49 +51,36 @@ public class EmbeddedCatalogDbConfig { return new MariaDB4jSpringService(); } - @Primary - @Bean(name = "dataSource") + @Primary + @Bean(name = "dataSource") 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 + @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(); + return DataSourceBuilder.create().username(datasourceUsername).password(datasourcePassword) + .url(config.getURL(databaseName)).driverClassName(datasourceDriver).build(); } - - @Primary - @Bean(name = "entityManagerFactory") - public LocalContainerEntityManagerFactoryBean - entityManagerFactory( - EntityManagerFactoryBuilder builder, - @Qualifier("dataSource") DataSource dataSource - ) { - return builder - .dataSource(dataSource) - .packages("org.onap.so.db.catalog.beans") - .persistenceUnit("catalogDB") - .build(); - } - @Primary - @Bean(name = "transactionManager") - public PlatformTransactionManager transactionManager( - @Qualifier("entityManagerFactory") EntityManagerFactory - entityManagerFactory - ) { - return new JpaTransactionManager(entityManagerFactory); - } + @Primary + @Bean(name = "entityManagerFactory") + public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder, + @Qualifier("dataSource") DataSource dataSource) { + return builder.dataSource(dataSource).packages("org.onap.so.db.catalog.beans").persistenceUnit("catalogDB") + .build(); + } + + @Primary + @Bean(name = "transactionManager") + public PlatformTransactionManager transactionManager( + @Qualifier("entityManagerFactory") EntityManagerFactory entityManagerFactory) { + return new JpaTransactionManager(entityManagerFactory); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java b/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java index 2827f8721e..e60b8fe238 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java @@ -19,10 +19,10 @@ */ package org.onap.so.asdc; + import ch.vorburger.exec.ManagedProcessException; import ch.vorburger.mariadb4j.DBConfigurationBuilder; import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; - import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.jdbc.DataSourceBuilder; @@ -37,17 +37,14 @@ import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; - import javax.persistence.EntityManagerFactory; import javax.sql.DataSource; @Configuration @Profile({"test"}) @EnableTransactionManagement -@EnableJpaRepositories( - entityManagerFactoryRef = "requestEntityManagerFactory",transactionManagerRef = "requestTransactionManager", - basePackages = { "org.onap.so.db.request.data.repository" } - ) +@EnableJpaRepositories(entityManagerFactoryRef = "requestEntityManagerFactory", + transactionManagerRef = "requestTransactionManager", basePackages = {"org.onap.so.db.request.data.repository"}) public class EmbeddedRequestDbConfig { @Bean @@ -56,47 +53,34 @@ public class EmbeddedRequestDbConfig { } - @Bean(name = "requestDataSource") - @ConfigurationProperties(prefix = "request.datasource") + @Bean(name = "requestDataSource") + @ConfigurationProperties(prefix = "request.datasource") DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService, - @Value("${mariaDB4j.databaseName2}") 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 + @Value("${mariaDB4j.databaseName2}") 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(); + return DataSourceBuilder.create().username(datasourceUsername).password(datasourcePassword) + .url(config.getURL(databaseName)).driverClassName(datasourceDriver).build(); } - @Bean(name = "requestEntityManagerFactory") - public LocalContainerEntityManagerFactoryBean - entityManagerFactory( - EntityManagerFactoryBuilder builder, - @Qualifier("requestDataSource") DataSource dataSource - ) { - return builder - .dataSource(dataSource) - .packages("org.onap.so.db.request.beans") - .persistenceUnit("requestDB") - .build(); - } + @Bean(name = "requestEntityManagerFactory") + public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder, + @Qualifier("requestDataSource") DataSource dataSource) { + return builder.dataSource(dataSource).packages("org.onap.so.db.request.beans").persistenceUnit("requestDB") + .build(); + } - @Bean(name = "requestTransactionManager") - public PlatformTransactionManager transactionManager( - @Qualifier("requestEntityManagerFactory") EntityManagerFactory - entityManagerFactory - ) { - return new JpaTransactionManager(entityManagerFactory); - } + @Bean(name = "requestTransactionManager") + public PlatformTransactionManager transactionManager( + @Qualifier("requestEntityManagerFactory") EntityManagerFactory entityManagerFactory) { + return new JpaTransactionManager(entityManagerFactory); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java b/asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java index 4298f9c5b5..c35e8e34d6 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java @@ -31,15 +31,15 @@ import org.springframework.context.annotation.Profile; @SpringBootApplication @Profile("test") -@ComponentScan(basePackages = {"org.onap.so.asdc"}, excludeFilters = { - @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), - @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), - @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) }) +@ComponentScan(basePackages = {"org.onap.so.asdc"}, + excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class)}) public class TestApplication { - public static void main(String... args) { - SpringApplication.run(TestApplication.class, args); - System.getProperties().setProperty("mso.db", "MARIADB"); - System.getProperties().setProperty("server.name", "Springboot"); - System.getProperties().setProperty("mso.config.path", "src/test/resources/"); - } + public static void main(String... args) { + SpringApplication.run(TestApplication.class, args); + System.getProperties().setProperty("mso.db", "MARIADB"); + System.getProperties().setProperty("server.name", "Springboot"); + System.getProperties().setProperty("mso.config.path", "src/test/resources/"); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java index 16bd97b409..40c403fd72 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java @@ -23,9 +23,7 @@ package org.onap.so.asdc.client; import static org.junit.Assert.assertTrue; - import javax.transaction.Transactional; - import org.junit.Test; import org.onap.so.asdc.BaseTest; import org.springframework.beans.factory.annotation.Autowired; @@ -36,24 +34,24 @@ import org.springframework.beans.factory.annotation.Autowired; * */ public class ASDCConfigurationTest extends BaseTest { - + @Autowired private ASDCConfiguration config; - + @Test - @Transactional - public void testInitASDCConfiguration() throws Exception { - assertTrue("msopreist".equals(config.getUser())); - assertTrue("msoasdc-id-local".equals(config.getConsumerGroup())); - assertTrue("msoasdc-id-local".equals(config.getConsumerID())); - assertTrue("Pre-IST".equals(config.getEnvironmentName())); - assertTrue("localhost:8443".equals(config.getAsdcAddress())); - assertTrue("msopreist".equals(config.getPassword())); - assertTrue(config.getPollingInterval() == 30); - assertTrue(config.getPollingTimeout() == 30); - assertTrue(config.getRelevantArtifactTypes().size() == config.SUPPORTED_ARTIFACT_TYPES_LIST.size()); - assertTrue(config.getWatchDogTimeout() == 1); - assertTrue(config.isUseHttpsWithDmaap() == true); + @Transactional + public void testInitASDCConfiguration() throws Exception { + assertTrue("msopreist".equals(config.getUser())); + assertTrue("msoasdc-id-local".equals(config.getConsumerGroup())); + assertTrue("msoasdc-id-local".equals(config.getConsumerID())); + assertTrue("Pre-IST".equals(config.getEnvironmentName())); + assertTrue("localhost:8443".equals(config.getAsdcAddress())); + assertTrue("msopreist".equals(config.getPassword())); + assertTrue(config.getPollingInterval() == 30); + assertTrue(config.getPollingTimeout() == 30); + assertTrue(config.getRelevantArtifactTypes().size() == config.SUPPORTED_ARTIFACT_TYPES_LIST.size()); + assertTrue(config.getWatchDogTimeout() == 1); + assertTrue(config.isUseHttpsWithDmaap() == true); } - + } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java new file mode 100644 index 0000000000..0681cd8aed --- /dev/null +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java @@ -0,0 +1,462 @@ +/* + * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix + * Foundation. ================================================================================ 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. + * + * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END========================================================= + */ + +package org.onap.so.asdc.client; + +import static com.github.tomakehurst.wiremock.client.WireMock.ok; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import java.util.UUID; +import javax.persistence.EntityNotFoundException; +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import org.onap.so.asdc.BaseTest; +import org.onap.so.asdc.client.exceptions.ASDCControllerException; +import org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl; +import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator; +import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; +import org.onap.so.asdc.client.test.emulators.ResourceInfoImpl; +import org.onap.so.db.catalog.beans.PnfResource; +import org.onap.so.db.catalog.beans.PnfResourceCustomization; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.ToscaCsar; +import org.onap.so.db.catalog.beans.VnfResource; +import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.data.repository.PnfCustomizationRepository; +import org.onap.so.db.catalog.data.repository.PnfResourceRepository; +import org.onap.so.db.catalog.data.repository.ServiceRepository; +import org.onap.so.db.catalog.data.repository.ToscaCsarRepository; +import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository; +import org.onap.so.db.catalog.data.repository.VnfResourceRepository; +import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus; +import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +/** + * This is used to run some basic integration test(BIT) for ASDC controller. It will test the csar install and all the + * testing csar files are located underneath src/main/resources/download folder, + * + * PNF csar: service-Testservice140-csar.csar VNF csar: service-Svc140-VF-csar.csar + */ +@Transactional +public class ASDCControllerITTest extends BaseTest { + + private Logger logger = LoggerFactory.getLogger(ASDCControllerITTest.class); + + @Rule + public TestName testName = new TestName(); + + private String serviceUuid; + private String serviceInvariantUuid; + + /** + * Random UUID served as distribution UUID. + */ + private String distributionId; + private String artifactUuid; + + @Autowired + private ASDCController asdcController; + + @Autowired + private PnfResourceRepository pnfResourceRepository; + + @Autowired + private PnfCustomizationRepository pnfCustomizationRepository; + + @Autowired + private VnfResourceRepository vnfResourceRepository; + + @Autowired + private VnfCustomizationRepository vnfCustomizationRepository; + + @Autowired + private ToscaCsarRepository toscaCsarRepository; + + @Autowired + private ServiceRepository serviceRepository; + + @Autowired + protected WatchdogComponentDistributionStatusRepository watchdogCDStatusRepository; + + private DistributionClientEmulator distributionClient; + + @Before + public void setUp() { + distributionId = UUID.randomUUID().toString(); + artifactUuid = UUID.randomUUID().toString(); + logger.info("Using distributionId: {}, artifactUUID: {} for testcase: {}", distributionId, artifactUuid, + testName.getMethodName()); + + distributionClient = new DistributionClientEmulator(); + distributionClient.setResourcePath("src/test/resources"); + asdcController.setDistributionClient(distributionClient); + try { + asdcController.initASDC(); + } catch (ASDCControllerException e) { + logger.error(e.getMessage(), e); + fail(e.getMessage()); + } + } + + @After + public void shutDown() { + try { + asdcController.closeASDC(); + } catch (ASDCControllerException e) { + logger.error(e.getMessage(), e); + fail(e.getMessage()); + } + } + + /** + * Mock the AAI using wireshark. + */ + private void initMockAaiServer(final String serviceUuid, final String serviceInvariantUuid) { + String modelEndpoint = "/aai/v15/service-design-and-creation/models/model/" + serviceInvariantUuid + + "/model-vers/model-ver/" + serviceUuid + "?depth=0"; + + wireMockServer.stubFor(post(urlEqualTo(modelEndpoint)).willReturn(ok())); + } + + /** + * Test with service-Testservice140-csar.csar. + */ + @Test + public void treatNotification_ValidPnfResource_ExpectedOutput() { + + /** + * service UUID/invariantUUID from global metadata in service-Testservice140-template.yml. + */ + String serviceUuid = "efaea486-561f-4159-9191-a8d3cb346728"; + String serviceInvariantUuid = "f2edfbf4-bb0a-4fe7-a57a-71362d4b0b23"; + + initMockAaiServer(serviceUuid, serviceInvariantUuid); + + NotificationDataImpl notificationData = new NotificationDataImpl(); + notificationData.setServiceUUID(serviceUuid); + notificationData.setDistributionID(distributionId); + notificationData.setServiceInvariantUUID(serviceInvariantUuid); + notificationData.setServiceVersion("1.0"); + + ResourceInfoImpl resourceInfo = constructPnfResourceInfo(); + List<ResourceInfoImpl> resourceInfoList = new ArrayList<>(); + resourceInfoList.add(resourceInfo); + notificationData.setResources(resourceInfoList); + + ArtifactInfoImpl artifactInfo = constructPnfServiceArtifact(); + List<ArtifactInfoImpl> artifactInfoList = new ArrayList<>(); + artifactInfoList.add(artifactInfo); + notificationData.setServiceArtifacts(artifactInfoList); + + try { + asdcController.treatNotification(notificationData); + logger.info("Checking the database for PNF ingestion"); + + /** + * Check the tosca csar entity, it should be the same as provided from NotficationData. + */ + ToscaCsar toscaCsar = toscaCsarRepository.findById(artifactUuid) + .orElseThrow(() -> new EntityNotFoundException("Tosca csar: " + artifactUuid + " not found")); + assertEquals("tosca csar UUID", artifactUuid, toscaCsar.getArtifactUUID()); + assertEquals("tosca csar name", "service-Testservice140-csar.csar", toscaCsar.getName()); + assertEquals("tosca csar version", "1.0", toscaCsar.getVersion()); + assertNull("tosca csar descrption", toscaCsar.getDescription()); + assertEquals("tosca csar checksum", "MANUAL_RECORD", toscaCsar.getArtifactChecksum()); + assertEquals("toscar csar URL", "/download/service-Testservice140-csar.csar", toscaCsar.getUrl()); + + /** + * Check the service entity, it should be the same as global metadata information in + * service-Testservice140-template.yml inside csar. + */ + Service service = serviceRepository.findById(serviceUuid) + .orElseThrow(() -> new EntityNotFoundException("Service: " + serviceUuid + " not found")); + assertEquals("model UUID", "efaea486-561f-4159-9191-a8d3cb346728", service.getModelUUID()); + assertEquals("model name", "TestService140", service.getModelName()); + assertEquals("model invariantUUID", "f2edfbf4-bb0a-4fe7-a57a-71362d4b0b23", + service.getModelInvariantUUID()); + assertEquals("model version", "1.0", service.getModelVersion()); + assertEquals("description", "Test Service for extended attributes of PNF resource", + service.getDescription().trim()); + assertEquals("tosca csar artifact UUID", artifactUuid, service.getCsar().getArtifactUUID()); + assertEquals("service type", "Network", service.getServiceType()); + assertEquals("service role", "nfv", service.getServiceRole()); + assertEquals("environment context", "General_Revenue-Bearing", service.getEnvironmentContext()); + assertEquals("service category", "Network Service", service.getCategory()); + assertNull("workload context", service.getWorkloadContext()); + assertEquals("resource order", "Test140PNF", service.getResourceOrder()); + + /** + * Check PNF resource, it should be the same as metadata in the topology template in + * service-Testservice140-template.yml OR global metadata in the resource-Test140pnf-template.yml + */ + String pnfResourceKey = "9c54e269-122b-4e8a-8b2a-6eac849b441a"; + PnfResource pnfResource = pnfResourceRepository.findById(pnfResourceKey) + .orElseThrow(() -> new EntityNotFoundException("PNF resource:" + pnfResourceKey + " not found")); + assertNull("orchestration mode", pnfResource.getOrchestrationMode()); + assertEquals("Description", "Oracle", pnfResource.getDescription().trim()); + assertEquals("model UUID", pnfResourceKey, pnfResource.getModelUUID()); + assertEquals("model invariant UUID", "d832a027-75f3-455d-9de4-f02fcdee7e7e", + pnfResource.getModelInvariantUUID()); + assertEquals("model version", "1.0", pnfResource.getModelVersion()); + assertEquals("model name", "Test140PNF", pnfResource.getModelName()); + assertEquals("tosca node type", "org.openecomp.resource.pnf.Test140pnf", pnfResource.getToscaNodeType()); + assertEquals("resource category", "Application L4+", pnfResource.getCategory()); + assertEquals("resource sub category", "Call Control", pnfResource.getSubCategory()); + + /** + * Check PNF resource customization, it should be the same as metadata in the topology template in + * service-Testservice140-template.yml OR global metadata in the resource-Test140pnf-template.yml + */ + String pnfCustomizationKey = "428a3d73-f962-4cc2-ba62-2483c45d6b12"; + PnfResourceCustomization pnfCustomization = pnfCustomizationRepository.findById(pnfCustomizationKey) + .orElseThrow(() -> new EntityNotFoundException( + "PNF resource customization: " + pnfCustomizationKey + " not found")); + assertEquals("model customizationUUID", pnfCustomizationKey, pnfCustomization.getModelCustomizationUUID()); + assertEquals("model instance name", "Test140PNF 0", pnfCustomization.getModelInstanceName()); + assertEquals("NF type", "", pnfCustomization.getNfType()); + assertEquals("NF Role", "nf", pnfCustomization.getNfRole()); + assertEquals("NF function", "nf", pnfCustomization.getNfFunction()); + assertEquals("NF naming code", "", pnfCustomization.getNfNamingCode()); + assertEquals("PNF resource model UUID", pnfResourceKey, pnfCustomization.getPnfResources().getModelUUID()); + assertEquals("Multi stage design", "", pnfCustomization.getMultiStageDesign()); + assertNull("resource input", pnfCustomization.getResourceInput()); + assertEquals("cds blueprint name(sdnc_model_name property)", pnfCustomization.getBlueprintName(), + pnfCustomization.getBlueprintName()); + assertEquals("cds blueprint version(sdnc_model_version property)", pnfCustomization.getBlueprintVersion(), + pnfCustomization.getBlueprintVersion()); + + /** + * Check the pnf resource customization with service mapping + */ + List<PnfResourceCustomization> pnfCustList = service.getPnfCustomizations(); + assertEquals("PNF resource customization entity", 1, pnfCustList.size()); + assertEquals(pnfCustomizationKey, pnfCustList.get(0).getModelCustomizationUUID()); + + /** + * Check the watchdog for component distribution status + */ + List<WatchdogComponentDistributionStatus> distributionList = + watchdogCDStatusRepository.findByDistributionId(this.distributionId); + assertNotNull(distributionList); + assertEquals(1, distributionList.size()); + WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0); + assertEquals("COMPONENT_DONE_OK", distributionStatus.getComponentDistributionStatus()); + assertEquals("SO", distributionStatus.getComponentName()); + + + } catch (Exception e) { + logger.info(e.getMessage(), e); + fail(e.getMessage()); + } + } + + private ArtifactInfoImpl constructPnfServiceArtifact() { + ArtifactInfoImpl artifactInfo = new ArtifactInfoImpl(); + artifactInfo.setArtifactType(ASDCConfiguration.TOSCA_CSAR); + artifactInfo.setArtifactURL("/download/service-Testservice140-csar.csar"); + artifactInfo.setArtifactName("service-Testservice140-csar.csar"); + artifactInfo.setArtifactVersion("1.0"); + artifactInfo.setArtifactUUID(artifactUuid); + return artifactInfo; + } + + /** + * Construct the PnfResourceInfo based on the resource-Test140Pnf-template.yml from + * service-Testservice140-csar.csar. + */ + private ResourceInfoImpl constructPnfResourceInfo() { + ResourceInfoImpl resourceInfo = new ResourceInfoImpl(); + resourceInfo.setResourceInstanceName("Test140PNF"); + resourceInfo.setResourceInvariantUUID("d832a027-75f3-455d-9de4-f02fcdee7e7e"); + resourceInfo.setResoucreType("PNF"); + resourceInfo.setCategory("Application L4+"); + resourceInfo.setSubcategory("Call Control"); + resourceInfo.setResourceUUID("9c54e269-122b-4e8a-8b2a-6eac849b441a"); + resourceInfo.setResourceCustomizationUUID("428a3d73-f962-4cc2-ba62-2483c45d6b12"); + resourceInfo.setResourceVersion("1.0"); + return resourceInfo; + } + + /** + * Testing with the service-Svc140-VF-csar.csar. + */ + @Test + @Ignore + public void treatNotification_ValidVnfResource_ExpectedOutput() { + + /** + * service UUID/invariantUUID from global metadata in resource-Testvf140-template.yml. + */ + String serviceUuid = "28944a37-de3f-46ec-9c60-b57036fbd26d"; + String serviceInvariantUuid = "9e900d3e-1e2e-4124-a5c2-4345734dc9de"; + + initMockAaiServer(serviceUuid, serviceInvariantUuid); + + NotificationDataImpl notificationData = new NotificationDataImpl(); + notificationData.setServiceUUID(serviceUuid); + notificationData.setDistributionID(distributionId); + notificationData.setServiceInvariantUUID(serviceInvariantUuid); + notificationData.setServiceVersion("1.0"); + + ResourceInfoImpl resourceInfo = constructVnfResourceInfo(); + List<ResourceInfoImpl> resourceInfoList = new ArrayList<>(); + resourceInfoList.add(resourceInfo); + notificationData.setResources(resourceInfoList); + + ArtifactInfoImpl artifactInfo = constructVnfServiceArtifact(); + List<ArtifactInfoImpl> artifactInfoList = new ArrayList<>(); + artifactInfoList.add(artifactInfo); + notificationData.setServiceArtifacts(artifactInfoList); + + try { + asdcController.treatNotification(notificationData); + logger.info("Checking the database for VNF ingestion"); + + /** + * Check the tosca csar entity, it should be the same as provided from NotficationData. + */ + ToscaCsar toscaCsar = toscaCsarRepository.findById(artifactUuid) + .orElseThrow(() -> new EntityNotFoundException("Tosca csar: " + artifactUuid + " not found")); + assertEquals("tosca csar UUID", artifactUuid, toscaCsar.getArtifactUUID()); + assertEquals("tosca csar name", "service-Svc140-VF-csar.csar", toscaCsar.getName()); + assertEquals("tosca csar version", "1.0", toscaCsar.getVersion()); + assertNull("tosca csar descrption", toscaCsar.getDescription()); + assertEquals("tosca csar checksum", "MANUAL_RECORD", toscaCsar.getArtifactChecksum()); + assertEquals("toscar csar URL", "/download/service-Svc140-VF-csar.csar", toscaCsar.getUrl()); + + /** + * Check the service entity, it should be the same as global metadata information in + * service-Testservice140-template.yml inside csar. + */ + Service service = serviceRepository.findById(serviceUuid) + .orElseThrow(() -> new EntityNotFoundException("Service: " + serviceUuid + " not found")); + assertEquals("model UUID", serviceUuid, service.getModelUUID()); + assertEquals("model name", "SVC140", service.getModelName()); + assertEquals("model invariantUUID", serviceInvariantUuid, service.getModelInvariantUUID()); + assertEquals("model version", "1.0", service.getModelVersion()); + assertEquals("description", "SVC140", service.getDescription().trim()); + assertEquals("tosca csar artifact UUID", artifactUuid, service.getCsar().getArtifactUUID()); + assertEquals("service type", "ST", service.getServiceType()); + assertEquals("service role", "Sr", service.getServiceRole()); + assertEquals("environment context", "General_Revenue-Bearing", service.getEnvironmentContext()); + assertEquals("service category", "Network Service", service.getCategory()); + assertNull("workload context", service.getWorkloadContext()); + assertEquals("resource order", "TestVF140", service.getResourceOrder()); + + /** + * Check VNF resource, it should be the same as metadata in the topology template in + * service-Testservice140-template.yml OR global metadata in the resource-Testservice140-template.yml + */ + String vnfResourceKey = "d20d3ea9-2f54-4071-8b5c-fd746dde245e"; + VnfResource vnfResource = vnfResourceRepository.findById(vnfResourceKey) + .orElseThrow(() -> new EntityNotFoundException("VNF resource:" + vnfResourceKey + " not found")); + assertEquals("orchestration mode", "HEAT", vnfResource.getOrchestrationMode()); + assertEquals("Description", "TestPNF140", vnfResource.getDescription().trim()); + assertEquals("model UUID", vnfResourceKey, vnfResource.getModelUUID()); + assertEquals("model invariant UUID", "7a4bffa2-fac5-4b8b-b348-0bdf313a1aeb", + vnfResource.getModelInvariantUUID()); + assertEquals("model version", "1.0", vnfResource.getModelVersion()); + assertEquals("model name", "TestVF140", vnfResource.getModelName()); + assertEquals("tosca node type", "org.openecomp.resource.vf.Testvf140", vnfResource.getToscaNodeType()); + assertEquals("resource category", "Application L4+", vnfResource.getCategory()); + assertEquals("resource sub category", "Database", vnfResource.getSubCategory()); + + /** + * Check VNF resource customization, it should be the same as metadata in the topology template in + * service-Testservice140-template.yml OR global metadata in the resource-Testservice140-template.yml + */ + String vnfCustomizationKey = "ca1c8455-8ce2-4a76-a037-3f4cf01cffa0"; + VnfResourceCustomization vnfCustomization = + Optional.ofNullable(vnfCustomizationRepository.findOneByModelCustomizationUUID(vnfCustomizationKey)) + .orElseThrow(() -> new EntityNotFoundException( + "VNF resource customization: " + vnfCustomizationKey + " not found")); + assertEquals("model customizationUUID", vnfCustomizationKey, vnfCustomization.getModelCustomizationUUID()); + assertEquals("model instance name", "TestVF140 0", vnfCustomization.getModelInstanceName()); + assertNull("NF type", vnfCustomization.getNfType()); + assertNull("NF Role", vnfCustomization.getNfRole()); + assertNull("NF function", vnfCustomization.getNfFunction()); + assertNull("NF naming code", vnfCustomization.getNfNamingCode()); + assertEquals("VNF resource model UUID", vnfResourceKey, vnfCustomization.getVnfResources().getModelUUID()); + assertEquals("Multi stage design", "false", vnfCustomization.getMultiStageDesign()); + assertNull("resource input", vnfCustomization.getResourceInput()); + assertEquals("cds blueprint name(sdnc_model_name property)", vnfCustomization.getBlueprintName(), + vnfCustomization.getBlueprintName()); + assertEquals("cds blueprint version(sdnc_model_version property)", vnfCustomization.getBlueprintVersion(), + vnfCustomization.getBlueprintVersion()); + /** + * Check the vnf resource customization with service mapping + */ + List<VnfResourceCustomization> vnfCustList = service.getVnfCustomizations(); + assertEquals("VNF resource customization entity", 1, vnfCustList.size()); + assertEquals(vnfCustomizationKey, vnfCustList.get(0).getModelCustomizationUUID()); + + /** + * Check the watchdog for component distribution status + */ + List<WatchdogComponentDistributionStatus> distributionList = + watchdogCDStatusRepository.findByDistributionId(this.distributionId); + assertNotNull(distributionList); + assertEquals(1, distributionList.size()); + WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0); + assertEquals("COMPONENT_DONE_OK", distributionStatus.getComponentDistributionStatus()); + assertEquals("SO", distributionStatus.getComponentName()); + } catch (Exception e) { + logger.info(e.getMessage(), e); + fail(e.getMessage()); + } + } + + private ArtifactInfoImpl constructVnfServiceArtifact() { + ArtifactInfoImpl artifactInfo = new ArtifactInfoImpl(); + artifactInfo.setArtifactType(ASDCConfiguration.TOSCA_CSAR); + artifactInfo.setArtifactURL("/download/service-Svc140-VF-csar.csar"); + artifactInfo.setArtifactName("service-Svc140-VF-csar.csar"); + artifactInfo.setArtifactVersion("1.0"); + artifactInfo.setArtifactUUID(artifactUuid); + return artifactInfo; + } + + /** + * Construct the PnfResourceInfo based on the resource-Testvf140-template.yml from service-Svc140-VF-csar.csar. + */ + private ResourceInfoImpl constructVnfResourceInfo() { + ResourceInfoImpl resourceInfo = new ResourceInfoImpl(); + resourceInfo.setResourceInstanceName("TestVF140"); + resourceInfo.setResourceInvariantUUID("7a4bffa2-fac5-4b8b-b348-0bdf313a1aeb"); + resourceInfo.setResoucreType("VF"); + resourceInfo.setCategory("Application L4+"); + resourceInfo.setSubcategory("Database"); + resourceInfo.setResourceUUID("d20d3ea9-2f54-4071-8b5c-fd746dde245e"); + resourceInfo.setResourceCustomizationUUID("ca1c8455-8ce2-4a76-a037-3f4cf01cffa0"); + resourceInfo.setResourceVersion("1.0"); + resourceInfo.setArtifacts(Collections.EMPTY_LIST); + return resourceInfo; + } +} diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerTest.java index 580220aabb..104eed7c90 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerTest.java @@ -28,21 +28,21 @@ import org.onap.so.asdc.client.exceptions.ASDCControllerException; import org.springframework.beans.factory.annotation.Autowired; public class ASDCControllerTest extends BaseTest { - @Autowired - private ASDCController asdcController; - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - @Test - public void initASDCExceptionTest() throws Exception { - expectedException.expect(ASDCControllerException.class); - - asdcController.changeControllerStatus(ASDCControllerStatus.IDLE); - - try { - asdcController.initASDC(); - } finally { - asdcController.closeASDC(); - } - } + @Autowired + private ASDCController asdcController; + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Test + public void initASDCExceptionTest() throws Exception { + expectedException.expect(ASDCControllerException.class); + + asdcController.changeControllerStatus(ASDCControllerStatus.IDLE); + + try { + asdcController.initASDC(); + } finally { + asdcController.closeASDC(); + } + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCElementInfoTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCElementInfoTest.java index fec3ae6362..6196691807 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCElementInfoTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCElementInfoTest.java @@ -27,10 +27,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; - import java.util.Collections; import java.util.UUID; - import org.junit.Test; import org.mockito.Mockito; import org.onap.sdc.api.notification.IArtifactInfo; @@ -46,129 +44,132 @@ import org.onap.so.asdc.installer.IVfModuleData; public class ASDCElementInfoTest { - @Test - public void createASDCElementInfoWithNullParameterTest() { - ASDCElementInfo elementInfoFromNullVfArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(null); - ASDCElementInfo elementInfoFromNullVfModuleStructure = ASDCElementInfo.createElementFromVfModuleStructure(null); - ASDCElementInfo elementInfoFromNullVfResourceStructure = ASDCElementInfo.createElementFromVfResourceStructure(null); + @Test + public void createASDCElementInfoWithNullParameterTest() { + ASDCElementInfo elementInfoFromNullVfArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(null); + ASDCElementInfo elementInfoFromNullVfModuleStructure = ASDCElementInfo.createElementFromVfModuleStructure(null); + ASDCElementInfo elementInfoFromNullVfResourceStructure = + ASDCElementInfo.createElementFromVfResourceStructure(null); - elementInfoFromNullVfArtifact.addElementInfo(null, null); - elementInfoFromNullVfModuleStructure.addElementInfo(null, "someValue"); - elementInfoFromNullVfResourceStructure.addElementInfo("someKey", null); + elementInfoFromNullVfArtifact.addElementInfo(null, null); + elementInfoFromNullVfModuleStructure.addElementInfo(null, "someValue"); + elementInfoFromNullVfResourceStructure.addElementInfo("someKey", null); - assertEquals(elementInfoFromNullVfArtifact.toString(), ""); - assertEquals(elementInfoFromNullVfModuleStructure.toString(), ""); - assertEquals(elementInfoFromNullVfResourceStructure.toString(), ""); + assertEquals(elementInfoFromNullVfArtifact.toString(), ""); + assertEquals(elementInfoFromNullVfModuleStructure.toString(), ""); + assertEquals(elementInfoFromNullVfResourceStructure.toString(), ""); - assertNotNull(elementInfoFromNullVfArtifact); - assertNotNull(elementInfoFromNullVfModuleStructure); - assertNotNull(elementInfoFromNullVfResourceStructure); + assertNotNull(elementInfoFromNullVfArtifact); + assertNotNull(elementInfoFromNullVfModuleStructure); + assertNotNull(elementInfoFromNullVfResourceStructure); - assertNotNull(ASDCElementInfo.EMPTY_INSTANCE); + assertNotNull(ASDCElementInfo.EMPTY_INSTANCE); - assertEquals(elementInfoFromNullVfArtifact, ASDCElementInfo.EMPTY_INSTANCE); - assertEquals(elementInfoFromNullVfModuleStructure, ASDCElementInfo.EMPTY_INSTANCE); - assertEquals(elementInfoFromNullVfResourceStructure, ASDCElementInfo.EMPTY_INSTANCE); + assertEquals(elementInfoFromNullVfArtifact, ASDCElementInfo.EMPTY_INSTANCE); + assertEquals(elementInfoFromNullVfModuleStructure, ASDCElementInfo.EMPTY_INSTANCE); + assertEquals(elementInfoFromNullVfResourceStructure, ASDCElementInfo.EMPTY_INSTANCE); - assertEquals(ASDCElementInfo.EMPTY_INSTANCE.getType(), ""); - assertEquals(ASDCElementInfo.EMPTY_INSTANCE.toString(), ""); + assertEquals(ASDCElementInfo.EMPTY_INSTANCE.getType(), ""); + assertEquals(ASDCElementInfo.EMPTY_INSTANCE.toString(), ""); - assertEquals(elementInfoFromNullVfArtifact.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType()); - assertEquals(elementInfoFromNullVfModuleStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType()); - assertEquals(elementInfoFromNullVfResourceStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType()); - } + assertEquals(elementInfoFromNullVfArtifact.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType()); + assertEquals(elementInfoFromNullVfModuleStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType()); + assertEquals(elementInfoFromNullVfResourceStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType()); + } - @Test - public void createASDCElementInfoFromVfResourceTest() { + @Test + public void createASDCElementInfoFromVfResourceTest() { - String resourceInstanceName = "Resource 1"; + String resourceInstanceName = "Resource 1"; - UUID generatedUUID = UUID.randomUUID(); + UUID generatedUUID = UUID.randomUUID(); - INotificationData notificationData = Mockito.mock(INotificationData.class); - IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class); + INotificationData notificationData = Mockito.mock(INotificationData.class); + IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class); - Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName); - Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString()); + Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName); + Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString()); - VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance); + VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance); - ASDCElementInfo elementInfoFromVfResource = ASDCElementInfo.createElementFromVfResourceStructure(vfResourceStructure); + ASDCElementInfo elementInfoFromVfResource = + ASDCElementInfo.createElementFromVfResourceStructure(vfResourceStructure); - assertTrue(elementInfoFromVfResource.toString().contains(resourceInstanceName)); - assertTrue(elementInfoFromVfResource.toString().contains(generatedUUID.toString())); + assertTrue(elementInfoFromVfResource.toString().contains(resourceInstanceName)); + assertTrue(elementInfoFromVfResource.toString().contains(generatedUUID.toString())); - assertFalse(ASDCConfiguration.VF_MODULES_METADATA.equals(elementInfoFromVfResource.getType())); - assertEquals(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name(), elementInfoFromVfResource.getType()); + assertFalse(ASDCConfiguration.VF_MODULES_METADATA.equals(elementInfoFromVfResource.getType())); + assertEquals(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name(), elementInfoFromVfResource.getType()); - assertFalse(elementInfoFromVfResource.toString().contains("MyInfo1: someValue")); - elementInfoFromVfResource.addElementInfo("MyInfo1", "someValue"); - assertTrue(elementInfoFromVfResource.toString().contains("MyInfo1: someValue")); - } + assertFalse(elementInfoFromVfResource.toString().contains("MyInfo1: someValue")); + elementInfoFromVfResource.addElementInfo("MyInfo1", "someValue"); + assertTrue(elementInfoFromVfResource.toString().contains("MyInfo1: someValue")); + } - @Test - public void createASDCElementInfoFromVfModuleTest() throws ArtifactInstallerException { + @Test + public void createASDCElementInfoFromVfModuleTest() throws ArtifactInstallerException { - String resourceInstanceName = "Resource 1"; + String resourceInstanceName = "Resource 1"; - UUID generatedUUID = UUID.randomUUID(); + UUID generatedUUID = UUID.randomUUID(); - INotificationData notificationData = Mockito.mock(INotificationData.class); - IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class); + INotificationData notificationData = Mockito.mock(INotificationData.class); + IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class); - Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName); - Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString()); + Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName); + Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString()); - VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance); + VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance); - // Create module structure now + // Create module structure now - String vfModuleModelName = "Module Model XYZ"; + String vfModuleModelName = "Module Model XYZ"; - UUID generatedUUIDForModule = UUID.randomUUID(); + UUID generatedUUIDForModule = UUID.randomUUID(); - IVfModuleData moduleMetadata = Mockito.mock(IVfModuleData.class); - Mockito.when(moduleMetadata.getVfModuleModelName()).thenReturn(vfModuleModelName); - Mockito.when(moduleMetadata.getVfModuleModelInvariantUUID()).thenReturn(generatedUUIDForModule.toString()); - Mockito.when(moduleMetadata.getArtifacts()).thenReturn(Collections.<String> emptyList()); + IVfModuleData moduleMetadata = Mockito.mock(IVfModuleData.class); + Mockito.when(moduleMetadata.getVfModuleModelName()).thenReturn(vfModuleModelName); + Mockito.when(moduleMetadata.getVfModuleModelInvariantUUID()).thenReturn(generatedUUIDForModule.toString()); + Mockito.when(moduleMetadata.getArtifacts()).thenReturn(Collections.<String>emptyList()); - VfModuleStructure vfModuleStructure = new VfModuleStructure(vfResourceStructure, moduleMetadata); + VfModuleStructure vfModuleStructure = new VfModuleStructure(vfResourceStructure, moduleMetadata); - ASDCElementInfo elementInfoFromVfModule = ASDCElementInfo.createElementFromVfModuleStructure(vfModuleStructure); + ASDCElementInfo elementInfoFromVfModule = ASDCElementInfo.createElementFromVfModuleStructure(vfModuleStructure); - assertTrue(elementInfoFromVfModule.toString().contains(vfModuleModelName)); - assertTrue(elementInfoFromVfModule.toString().contains(generatedUUIDForModule.toString())); + assertTrue(elementInfoFromVfModule.toString().contains(vfModuleModelName)); + assertTrue(elementInfoFromVfModule.toString().contains(generatedUUIDForModule.toString())); - assertFalse(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromVfModule.getType())); - assertEquals(ASDCConfiguration.VF_MODULES_METADATA, elementInfoFromVfModule.getType()); + assertFalse(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromVfModule.getType())); + assertEquals(ASDCConfiguration.VF_MODULES_METADATA, elementInfoFromVfModule.getType()); - assertFalse(elementInfoFromVfModule.toString().contains("MyInfo2: someValue")); - elementInfoFromVfModule.addElementInfo("MyInfo2", "someValue"); - assertTrue(elementInfoFromVfModule.toString().contains("MyInfo2: someValue")); - } + assertFalse(elementInfoFromVfModule.toString().contains("MyInfo2: someValue")); + elementInfoFromVfModule.addElementInfo("MyInfo2", "someValue"); + assertTrue(elementInfoFromVfModule.toString().contains("MyInfo2: someValue")); + } - @Test - public void createASDCElementInfoFromArtifact() { - for (String eVal : ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST) { - String generatedArtifactName = eVal + " 1"; - UUID generatedUUIDForArtifact = UUID.randomUUID(); + @Test + public void createASDCElementInfoFromArtifact() { + for (String eVal : ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST) { + String generatedArtifactName = eVal + " 1"; + UUID generatedUUIDForArtifact = UUID.randomUUID(); - IArtifactInfo artifactInfo = Mockito.mock(IArtifactInfo.class); - Mockito.when(artifactInfo.getArtifactType()).thenReturn(eVal); - Mockito.when(artifactInfo.getArtifactName()).thenReturn(generatedArtifactName); - Mockito.when(artifactInfo.getArtifactUUID()).thenReturn(generatedUUIDForArtifact.toString()); + IArtifactInfo artifactInfo = Mockito.mock(IArtifactInfo.class); + Mockito.when(artifactInfo.getArtifactType()).thenReturn(eVal); + Mockito.when(artifactInfo.getArtifactName()).thenReturn(generatedArtifactName); + Mockito.when(artifactInfo.getArtifactUUID()).thenReturn(generatedUUIDForArtifact.toString()); - ASDCElementInfo elementInfoFromArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(artifactInfo); + ASDCElementInfo elementInfoFromArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(artifactInfo); - assertTrue(elementInfoFromArtifact.toString().contains(generatedArtifactName)); - assertTrue(elementInfoFromArtifact.toString().contains(generatedUUIDForArtifact.toString())); + assertTrue(elementInfoFromArtifact.toString().contains(generatedArtifactName)); + assertTrue(elementInfoFromArtifact.toString().contains(generatedUUIDForArtifact.toString())); - assertFalse(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromArtifact.getType())); - assertEquals(eVal, elementInfoFromArtifact.getType()); + assertFalse( + ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromArtifact.getType())); + assertEquals(eVal, elementInfoFromArtifact.getType()); - assertFalse(elementInfoFromArtifact.toString().contains("MyInfo3: someValue")); - elementInfoFromArtifact.addElementInfo("MyInfo3", "someValue"); - assertTrue(elementInfoFromArtifact.toString().contains("MyInfo3: someValue")); - } - } + assertFalse(elementInfoFromArtifact.toString().contains("MyInfo3: someValue")); + elementInfoFromArtifact.addElementInfo("MyInfo3", "someValue"); + assertTrue(elementInfoFromArtifact.toString().contains("MyInfo3: someValue")); + } + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCStatusCallBackTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCStatusCallBackTest.java index ba95a6ea24..24b1736fad 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCStatusCallBackTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCStatusCallBackTest.java @@ -27,7 +27,6 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; - import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -41,51 +40,52 @@ import org.onap.so.asdc.client.test.emulators.JsonStatusData; import org.springframework.beans.factory.annotation.Autowired; public class ASDCStatusCallBackTest extends BaseTest { - @Autowired - private ASDCStatusCallBack statusCallback; - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - @Before - public void before() { - MockitoAnnotations.initMocks(this); - } - - @Test - public void activateCallbackTest() throws Exception { - JsonStatusData statusData = new JsonStatusData(); - - doNothing().when(toscaInstaller).installTheComponentStatus(isA(JsonStatusData.class)); - - statusCallback.activateCallback(statusData); - - verify(toscaInstaller, times(1)).installTheComponentStatus(statusData); - } - - @Test - public void activateCallbackDoneErrorStatusTest() throws Exception { - IStatusData statusData = mock(IStatusData.class); - - doReturn("distributionId").when(statusData).getDistributionID(); - doReturn("componentName").when(statusData).getComponentName(); - doReturn(DistributionStatusEnum.COMPONENT_DONE_ERROR).when(statusData).getStatus(); - doNothing().when(toscaInstaller).installTheComponentStatus(isA(IStatusData.class)); - - statusCallback.activateCallback(statusData); - - verify(toscaInstaller, times(1)).installTheComponentStatus(statusData); - } - - @Test - public void activateCallbackExceptionTest() throws Exception { - IStatusData statusData = mock(IStatusData.class); - - doReturn("distributionId").when(statusData).getDistributionID(); - doReturn("componentName").when(statusData).getComponentName(); - doReturn(DistributionStatusEnum.COMPONENT_DONE_OK).when(statusData).getStatus(); - doThrow(ArtifactInstallerException.class).when(toscaInstaller).installTheComponentStatus(isA(IStatusData.class)); - - statusCallback.activateCallback(statusData); - } + @Autowired + private ASDCStatusCallBack statusCallback; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Before + public void before() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void activateCallbackTest() throws Exception { + JsonStatusData statusData = new JsonStatusData(); + + doNothing().when(toscaInstaller).installTheComponentStatus(isA(JsonStatusData.class)); + + statusCallback.activateCallback(statusData); + + verify(toscaInstaller, times(1)).installTheComponentStatus(statusData); + } + + @Test + public void activateCallbackDoneErrorStatusTest() throws Exception { + IStatusData statusData = mock(IStatusData.class); + + doReturn("distributionId").when(statusData).getDistributionID(); + doReturn("componentName").when(statusData).getComponentName(); + doReturn(DistributionStatusEnum.COMPONENT_DONE_ERROR).when(statusData).getStatus(); + doNothing().when(toscaInstaller).installTheComponentStatus(isA(IStatusData.class)); + + statusCallback.activateCallback(statusData); + + verify(toscaInstaller, times(1)).installTheComponentStatus(statusData); + } + + @Test + public void activateCallbackExceptionTest() throws Exception { + IStatusData statusData = mock(IStatusData.class); + + doReturn("distributionId").when(statusData).getDistributionID(); + doReturn("componentName").when(statusData).getComponentName(); + doReturn(DistributionStatusEnum.COMPONENT_DONE_OK).when(statusData).getStatus(); + doThrow(ArtifactInstallerException.class).when(toscaInstaller) + .installTheComponentStatus(isA(IStatusData.class)); + + statusCallback.activateCallback(statusData); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/BigDecimalVersionTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/BigDecimalVersionTest.java index 4eb9ed5619..090f2e8968 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/BigDecimalVersionTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/BigDecimalVersionTest.java @@ -24,30 +24,29 @@ package org.onap.so.asdc.client; import static org.junit.Assert.assertTrue; import java.math.BigDecimal; import org.junit.Test; - import org.onap.so.asdc.installer.BigDecimalVersion; public class BigDecimalVersionTest { @Test - public final void versionCastTest () { + public final void versionCastTest() { - BigDecimal versionDecimal = BigDecimalVersion.castAndCheckNotificationVersion("12.0"); - assertTrue(versionDecimal.equals(new BigDecimal("12.0"))); - assertTrue("12.0".equals(BigDecimalVersion.castAndCheckNotificationVersionToString("12.0"))); + BigDecimal versionDecimal = BigDecimalVersion.castAndCheckNotificationVersion("12.0"); + assertTrue(versionDecimal.equals(new BigDecimal("12.0"))); + assertTrue("12.0".equals(BigDecimalVersion.castAndCheckNotificationVersionToString("12.0"))); - versionDecimal = BigDecimalVersion.castAndCheckNotificationVersion("12.0.2"); - assertTrue(versionDecimal.equals(new BigDecimal("12.02"))); - assertTrue("12.02".equals(BigDecimalVersion.castAndCheckNotificationVersionToString("12.0.2"))); + versionDecimal = BigDecimalVersion.castAndCheckNotificationVersion("12.0.2"); + assertTrue(versionDecimal.equals(new BigDecimal("12.02"))); + assertTrue("12.02".equals(BigDecimalVersion.castAndCheckNotificationVersionToString("12.0.2"))); - versionDecimal = BigDecimalVersion.castAndCheckNotificationVersion("10"); - assertTrue(versionDecimal.equals(new BigDecimal("10"))); - assertTrue("10".equals(BigDecimalVersion.castAndCheckNotificationVersionToString("10"))); + versionDecimal = BigDecimalVersion.castAndCheckNotificationVersion("10"); + assertTrue(versionDecimal.equals(new BigDecimal("10"))); + assertTrue("10".equals(BigDecimalVersion.castAndCheckNotificationVersionToString("10"))); - versionDecimal = BigDecimalVersion.castAndCheckNotificationVersion("10.1.2.6"); - assertTrue(versionDecimal.equals(new BigDecimal("10.126"))); - assertTrue("10.126".equals(BigDecimalVersion.castAndCheckNotificationVersionToString("10.1.2.6"))); + versionDecimal = BigDecimalVersion.castAndCheckNotificationVersion("10.1.2.6"); + assertTrue(versionDecimal.equals(new BigDecimal("10.126"))); + assertTrue("10.126".equals(BigDecimalVersion.castAndCheckNotificationVersionToString("10.1.2.6"))); } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/DistributionStatusMessageTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/DistributionStatusMessageTest.java index 0c6476ddef..9c8929b76a 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/DistributionStatusMessageTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/DistributionStatusMessageTest.java @@ -21,25 +21,24 @@ package org.onap.so.asdc.client; import static org.junit.Assert.assertEquals; - import org.junit.Test; import org.onap.sdc.utils.DistributionStatusEnum; public class DistributionStatusMessageTest { - - @Test - public void distributionStatusMessageTest() { - String artifactUrl = "artifactUrl"; - String consumerId = "consumerId"; - String distributionId = "distributionId"; - Long timestamp = 123L; - DistributionStatusMessage distributionStatusMessage = new DistributionStatusMessage( - artifactUrl, consumerId, distributionId, DistributionStatusEnum.DEPLOY_OK, timestamp); - - assertEquals(artifactUrl, distributionStatusMessage.getArtifactURL()); - assertEquals(consumerId, distributionStatusMessage.getConsumerID()); - assertEquals(distributionId, distributionStatusMessage.getDistributionID()); - assertEquals(DistributionStatusEnum.DEPLOY_OK, distributionStatusMessage.getStatus()); - assertEquals(123L, distributionStatusMessage.getTimestamp()); - } + + @Test + public void distributionStatusMessageTest() { + String artifactUrl = "artifactUrl"; + String consumerId = "consumerId"; + String distributionId = "distributionId"; + Long timestamp = 123L; + DistributionStatusMessage distributionStatusMessage = new DistributionStatusMessage(artifactUrl, consumerId, + distributionId, DistributionStatusEnum.DEPLOY_OK, timestamp); + + assertEquals(artifactUrl, distributionStatusMessage.getArtifactURL()); + assertEquals(consumerId, distributionStatusMessage.getConsumerID()); + assertEquals(distributionId, distributionStatusMessage.getDistributionID()); + assertEquals(DistributionStatusEnum.DEPLOY_OK, distributionStatusMessage.getStatus()); + assertEquals(123L, distributionStatusMessage.getTimestamp()); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/YamlTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/YamlTest.java index ed761c7f4d..d7316e57bd 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/YamlTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/YamlTest.java @@ -22,7 +22,6 @@ package org.onap.so.asdc.client; import static org.junit.Assert.*; - import java.io.File; import java.io.FileInputStream; import java.io.InputStream; @@ -36,118 +35,123 @@ import org.onap.so.db.catalog.beans.HeatTemplateParam; public class YamlTest { - @Test - public void getYamlResourceTypeTestList() throws Exception { - - InputStream input = new FileInputStream(new File("src/test/resources/resource-examples/simpleTest.yaml")); - YamlEditor decoder = new YamlEditor (IOUtils.toByteArray(input)); - List<String> typeList = decoder.getYamlNestedFileResourceTypeList(); - - assertTrue(typeList.size() == 1 && typeList.get(0).equals("file:///my_test.yaml")); - } - - @Test - public void getParameterListTest() throws Exception { - - InputStream input = new FileInputStream(new File("src/test/resources/resource-examples/simpleTest.yaml")); - YamlEditor decoder = new YamlEditor (IOUtils.toByteArray(input)); - Set <HeatTemplateParam> paramSet = decoder.getParameterList("123456"); - - assertTrue(paramSet.size() == 5); - - for (HeatTemplateParam param : paramSet) { - if ("ip_port_snmp_manager".equals(param.getParamName()) || "cor_direct_net_name".equals(param.getParamName()) || "cor_direct_net_RT".equals(param.getParamName())) { - - assertTrue(param.isRequired()==false); - } else { - - assertTrue(param.isRequired()==true); - } - - assertTrue("string".equals(param.getParamType())); - } - } - - @Test - public void addParameterListWhenEmptyTest() throws Exception { - - InputStream input = new FileInputStream(new File("src/test/resources/resource-examples/simpleTestWithoutParam.yaml")); - YamlEditor decoder = new YamlEditor (IOUtils.toByteArray(input)); - - Set <HeatTemplateParam> newParamSet = new HashSet<>(); - - HeatTemplateParam heatParam1 = new HeatTemplateParam(); - heatParam1.setHeatTemplateArtifactUuid("1"); - heatParam1.setParamName("testos1"); - heatParam1.setParamType("string"); - - HeatTemplateParam heatParam2 = new HeatTemplateParam(); - heatParam2.setHeatTemplateArtifactUuid("2"); - heatParam2.setParamName("testos2"); - heatParam2.setParamType("number"); - - newParamSet.add(heatParam1); - newParamSet.add(heatParam2); - - decoder.addParameterList(newParamSet); - - Set <HeatTemplateParam> paramSet = decoder.getParameterList("123456"); - assertTrue(paramSet.size() == 2); - - assertTrue(decoder.encode().contains("testos1")); - assertTrue(decoder.encode().contains("string")); - assertTrue(decoder.encode().contains("testos2")); - assertTrue(decoder.encode().contains("number")); - } - - @Test - public void addParameterListTest() throws Exception { - - InputStream input = new FileInputStream(new File("src/test/resources/resource-examples/simpleTest.yaml")); - YamlEditor decoder = new YamlEditor (IOUtils.toByteArray(input)); - - Set <HeatTemplateParam> newParamSet = new HashSet<>(); - - HeatTemplateParam heatParam1 = new HeatTemplateParam(); - heatParam1.setHeatTemplateArtifactUuid("1"); - heatParam1.setParamName("testos1"); - heatParam1.setParamType("string"); - - HeatTemplateParam heatParam2 = new HeatTemplateParam(); - heatParam2.setHeatTemplateArtifactUuid("2"); - heatParam2.setParamName("testos2"); - heatParam2.setParamType("number"); - - newParamSet.add(heatParam1); - newParamSet.add(heatParam2); - - decoder.addParameterList(newParamSet); - - Set <HeatTemplateParam> paramSet = decoder.getParameterList("123456"); - - assertTrue(paramSet.size() == 7); - - Boolean check1 = Boolean.FALSE; - Boolean check2 = Boolean.FALSE; - - for (HeatTemplateParam param : paramSet) { - if ("ip_port_snmp_manager".equals(param.getParamName()) || "cor_direct_net_name".equals(param.getParamName()) || "cor_direct_net_RT".equals(param.getParamName())) { - assertFalse(param.isRequired()); - } else { - assertTrue(param.isRequired()); - } - - if ("testos1".equals(param.getParamName()) && "string".equals(param.getParamType())) { - check1=Boolean.TRUE; - } - - if ("testos2".equals(param.getParamName()) && "number".equals(param.getParamType())) { - check2=Boolean.TRUE; - } - - } - - assertTrue(check1); - assertTrue(check2); - } + @Test + public void getYamlResourceTypeTestList() throws Exception { + + InputStream input = new FileInputStream(new File("src/test/resources/resource-examples/simpleTest.yaml")); + YamlEditor decoder = new YamlEditor(IOUtils.toByteArray(input)); + List<String> typeList = decoder.getYamlNestedFileResourceTypeList(); + + assertTrue(typeList.size() == 1 && typeList.get(0).equals("file:///my_test.yaml")); + } + + @Test + public void getParameterListTest() throws Exception { + + InputStream input = new FileInputStream(new File("src/test/resources/resource-examples/simpleTest.yaml")); + YamlEditor decoder = new YamlEditor(IOUtils.toByteArray(input)); + Set<HeatTemplateParam> paramSet = decoder.getParameterList("123456"); + + assertTrue(paramSet.size() == 5); + + for (HeatTemplateParam param : paramSet) { + if ("ip_port_snmp_manager".equals(param.getParamName()) + || "cor_direct_net_name".equals(param.getParamName()) + || "cor_direct_net_RT".equals(param.getParamName())) { + + assertTrue(param.isRequired() == false); + } else { + + assertTrue(param.isRequired() == true); + } + + assertTrue("string".equals(param.getParamType())); + } + } + + @Test + public void addParameterListWhenEmptyTest() throws Exception { + + InputStream input = + new FileInputStream(new File("src/test/resources/resource-examples/simpleTestWithoutParam.yaml")); + YamlEditor decoder = new YamlEditor(IOUtils.toByteArray(input)); + + Set<HeatTemplateParam> newParamSet = new HashSet<>(); + + HeatTemplateParam heatParam1 = new HeatTemplateParam(); + heatParam1.setHeatTemplateArtifactUuid("1"); + heatParam1.setParamName("testos1"); + heatParam1.setParamType("string"); + + HeatTemplateParam heatParam2 = new HeatTemplateParam(); + heatParam2.setHeatTemplateArtifactUuid("2"); + heatParam2.setParamName("testos2"); + heatParam2.setParamType("number"); + + newParamSet.add(heatParam1); + newParamSet.add(heatParam2); + + decoder.addParameterList(newParamSet); + + Set<HeatTemplateParam> paramSet = decoder.getParameterList("123456"); + assertTrue(paramSet.size() == 2); + + assertTrue(decoder.encode().contains("testos1")); + assertTrue(decoder.encode().contains("string")); + assertTrue(decoder.encode().contains("testos2")); + assertTrue(decoder.encode().contains("number")); + } + + @Test + public void addParameterListTest() throws Exception { + + InputStream input = new FileInputStream(new File("src/test/resources/resource-examples/simpleTest.yaml")); + YamlEditor decoder = new YamlEditor(IOUtils.toByteArray(input)); + + Set<HeatTemplateParam> newParamSet = new HashSet<>(); + + HeatTemplateParam heatParam1 = new HeatTemplateParam(); + heatParam1.setHeatTemplateArtifactUuid("1"); + heatParam1.setParamName("testos1"); + heatParam1.setParamType("string"); + + HeatTemplateParam heatParam2 = new HeatTemplateParam(); + heatParam2.setHeatTemplateArtifactUuid("2"); + heatParam2.setParamName("testos2"); + heatParam2.setParamType("number"); + + newParamSet.add(heatParam1); + newParamSet.add(heatParam2); + + decoder.addParameterList(newParamSet); + + Set<HeatTemplateParam> paramSet = decoder.getParameterList("123456"); + + assertTrue(paramSet.size() == 7); + + Boolean check1 = Boolean.FALSE; + Boolean check2 = Boolean.FALSE; + + for (HeatTemplateParam param : paramSet) { + if ("ip_port_snmp_manager".equals(param.getParamName()) + || "cor_direct_net_name".equals(param.getParamName()) + || "cor_direct_net_RT".equals(param.getParamName())) { + assertFalse(param.isRequired()); + } else { + assertTrue(param.isRequired()); + } + + if ("testos1".equals(param.getParamName()) && "string".equals(param.getParamType())) { + check1 = Boolean.TRUE; + } + + if ("testos2".equals(param.getParamName()) && "number".equals(param.getParamType())) { + check2 = Boolean.TRUE; + } + + } + + assertTrue(check1); + assertTrue(check2); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCControllerExceptionTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCControllerExceptionTest.java index e2aee6080e..927779c485 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCControllerExceptionTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCControllerExceptionTest.java @@ -22,29 +22,28 @@ package org.onap.so.asdc.client.exceptions; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; - import org.junit.Test; public class ASDCControllerExceptionTest { - private String exceptionMessage = "test message for exception"; - private String throwableMessage = "separate throwable that caused asdcDownloadException"; - - @Test - public void asdcParametersExceptionTest() { - ASDCControllerException asdcDownloadException = new ASDCControllerException(exceptionMessage); - - Exception expectedException = new Exception(exceptionMessage); - - assertThat(asdcDownloadException, sameBeanAs(expectedException)); - } - - @Test - public void asdcParametersExceptionThrowableTest() { - Throwable throwableCause = new Throwable(throwableMessage); - ASDCControllerException asdcDownloadException = new ASDCControllerException(exceptionMessage, throwableCause); - - Exception expectedException = new Exception(exceptionMessage, new Throwable(throwableMessage)); - - assertThat(asdcDownloadException, sameBeanAs(expectedException)); - } + private String exceptionMessage = "test message for exception"; + private String throwableMessage = "separate throwable that caused asdcDownloadException"; + + @Test + public void asdcParametersExceptionTest() { + ASDCControllerException asdcDownloadException = new ASDCControllerException(exceptionMessage); + + Exception expectedException = new Exception(exceptionMessage); + + assertThat(asdcDownloadException, sameBeanAs(expectedException)); + } + + @Test + public void asdcParametersExceptionThrowableTest() { + Throwable throwableCause = new Throwable(throwableMessage); + ASDCControllerException asdcDownloadException = new ASDCControllerException(exceptionMessage, throwableCause); + + Exception expectedException = new Exception(exceptionMessage, new Throwable(throwableMessage)); + + assertThat(asdcDownloadException, sameBeanAs(expectedException)); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCDownloadExceptionTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCDownloadExceptionTest.java index 98deb52a08..b022ed91d7 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCDownloadExceptionTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCDownloadExceptionTest.java @@ -22,29 +22,28 @@ package org.onap.so.asdc.client.exceptions; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; - import org.junit.Test; public class ASDCDownloadExceptionTest { - private String exceptionMessage = "test message for exception"; - private String throwableMessage = "separate throwable that caused asdcDownloadException"; - - @Test - public void asdcDownloadExceptionTest() { - ASDCDownloadException asdcDownloadException = new ASDCDownloadException(exceptionMessage); - - Exception expectedException = new Exception(exceptionMessage); - - assertThat(asdcDownloadException, sameBeanAs(expectedException)); - } - - @Test - public void asdcDownloadExceptionThrowableTest() { - Throwable throwableCause = new Throwable(throwableMessage); - ASDCDownloadException asdcDownloadException = new ASDCDownloadException(exceptionMessage, throwableCause); - - Exception expectedException = new Exception(exceptionMessage, new Throwable(throwableMessage)); - - assertThat(asdcDownloadException, sameBeanAs(expectedException)); - } + private String exceptionMessage = "test message for exception"; + private String throwableMessage = "separate throwable that caused asdcDownloadException"; + + @Test + public void asdcDownloadExceptionTest() { + ASDCDownloadException asdcDownloadException = new ASDCDownloadException(exceptionMessage); + + Exception expectedException = new Exception(exceptionMessage); + + assertThat(asdcDownloadException, sameBeanAs(expectedException)); + } + + @Test + public void asdcDownloadExceptionThrowableTest() { + Throwable throwableCause = new Throwable(throwableMessage); + ASDCDownloadException asdcDownloadException = new ASDCDownloadException(exceptionMessage, throwableCause); + + Exception expectedException = new Exception(exceptionMessage, new Throwable(throwableMessage)); + + assertThat(asdcDownloadException, sameBeanAs(expectedException)); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCParametersExceptionTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCParametersExceptionTest.java index bac05bd47c..2b4a0c956e 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCParametersExceptionTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCParametersExceptionTest.java @@ -22,29 +22,28 @@ package org.onap.so.asdc.client.exceptions; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; - import org.junit.Test; public class ASDCParametersExceptionTest { - private String exceptionMessage = "test message for exception"; - private String throwableMessage = "separate throwable that caused asdcDownloadException"; - - @Test - public void asdcParametersExceptionTest() { - ASDCParametersException asdcDownloadException = new ASDCParametersException(exceptionMessage); - - Exception expectedException = new Exception(exceptionMessage); - - assertThat(asdcDownloadException, sameBeanAs(expectedException)); - } - - @Test - public void asdcParametersExceptionThrowableTest() { - Throwable throwableCause = new Throwable(throwableMessage); - ASDCParametersException asdcDownloadException = new ASDCParametersException(exceptionMessage, throwableCause); - - Exception expectedException = new Exception(exceptionMessage, new Throwable(throwableMessage)); - - assertThat(asdcDownloadException, sameBeanAs(expectedException)); - } + private String exceptionMessage = "test message for exception"; + private String throwableMessage = "separate throwable that caused asdcDownloadException"; + + @Test + public void asdcParametersExceptionTest() { + ASDCParametersException asdcDownloadException = new ASDCParametersException(exceptionMessage); + + Exception expectedException = new Exception(exceptionMessage); + + assertThat(asdcDownloadException, sameBeanAs(expectedException)); + } + + @Test + public void asdcParametersExceptionThrowableTest() { + Throwable throwableCause = new Throwable(throwableMessage); + ASDCParametersException asdcDownloadException = new ASDCParametersException(exceptionMessage, throwableCause); + + Exception expectedException = new Exception(exceptionMessage, new Throwable(throwableMessage)); + + assertThat(asdcDownloadException, sameBeanAs(expectedException)); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ArtifactInstallerExceptionTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ArtifactInstallerExceptionTest.java index f2227908f5..3e0dd27d07 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ArtifactInstallerExceptionTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ArtifactInstallerExceptionTest.java @@ -22,29 +22,29 @@ package org.onap.so.asdc.client.exceptions; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; - import org.junit.Test; public class ArtifactInstallerExceptionTest { - private String exceptionMessage = "test message for exception"; - private String throwableMessage = "separate throwable that caused asdcDownloadException"; - - @Test - public void asdcParametersExceptionTest() { - ArtifactInstallerException asdcDownloadException = new ArtifactInstallerException(exceptionMessage); - - Exception expectedException = new Exception(exceptionMessage); - - assertThat(asdcDownloadException, sameBeanAs(expectedException)); - } - - @Test - public void asdcParametersExceptionThrowableTest() { - Throwable throwableCause = new Throwable(throwableMessage); - ArtifactInstallerException asdcDownloadException = new ArtifactInstallerException(exceptionMessage, throwableCause); - - Exception expectedException = new Exception(exceptionMessage, new Throwable(throwableMessage)); - - assertThat(asdcDownloadException, sameBeanAs(expectedException)); - } + private String exceptionMessage = "test message for exception"; + private String throwableMessage = "separate throwable that caused asdcDownloadException"; + + @Test + public void asdcParametersExceptionTest() { + ArtifactInstallerException asdcDownloadException = new ArtifactInstallerException(exceptionMessage); + + Exception expectedException = new Exception(exceptionMessage); + + assertThat(asdcDownloadException, sameBeanAs(expectedException)); + } + + @Test + public void asdcParametersExceptionThrowableTest() { + Throwable throwableCause = new Throwable(throwableMessage); + ArtifactInstallerException asdcDownloadException = + new ArtifactInstallerException(exceptionMessage, throwableCause); + + Exception expectedException = new Exception(exceptionMessage, new Throwable(throwableMessage)); + + assertThat(asdcDownloadException, sameBeanAs(expectedException)); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImplTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImplTest.java index 3dc323559d..69d3fd103d 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImplTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImplTest.java @@ -22,28 +22,26 @@ package org.onap.so.asdc.client.test.emulators; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; - import java.util.ArrayList; import java.util.List; - import org.junit.Test; import org.mockito.Mock; import org.onap.sdc.api.notification.IArtifactInfo; import org.onap.so.asdc.BaseTest; -public class ArtifactInfoImplTest extends BaseTest { - @Mock - private IArtifactInfo iArtifactInfo; - - @Test - public void convertToArtifactInfoImplTest() { - List<IArtifactInfo> list = new ArrayList<IArtifactInfo>(); - list.add(iArtifactInfo); - assertEquals(1, ArtifactInfoImpl.convertToArtifactInfoImpl(list).size()); - } - - @Test - public void convertToArtifactInfoImplNullListTest() { - assertTrue(ArtifactInfoImpl.convertToArtifactInfoImpl(null).isEmpty()); - } +public class ArtifactInfoImplTest extends BaseTest { + @Mock + private IArtifactInfo iArtifactInfo; + + @Test + public void convertToArtifactInfoImplTest() { + List<IArtifactInfo> list = new ArrayList<IArtifactInfo>(); + list.add(iArtifactInfo); + assertEquals(1, ArtifactInfoImpl.convertToArtifactInfoImpl(list).size()); + } + + @Test + public void convertToArtifactInfoImplNullListTest() { + assertTrue(ArtifactInfoImpl.convertToArtifactInfoImpl(null).isEmpty()); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulatorTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulatorTest.java index 38c2564241..cfbf7724cc 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulatorTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulatorTest.java @@ -21,13 +21,11 @@ package org.onap.so.asdc.client.test.emulators; import static org.junit.Assert.assertEquals; - import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.LinkedList; import java.util.List; - import org.junit.Before; import org.junit.Test; import org.onap.sdc.api.consumer.IDistributionStatusMessage; @@ -43,136 +41,156 @@ import org.onap.so.asdc.client.ASDCStatusCallBack; import org.onap.so.asdc.client.DistributionStatusMessage; public class DistributionClientEmulatorTest { - - private DistributionClientEmulator distClientEmulator; - - @Before - public void before() { - distClientEmulator = new DistributionClientEmulator(); - } - - @Test - public void getDistributionMessageReceived() { - List<IDistributionStatusMessage> receivedMessages = distClientEmulator.getDistributionMessageReceived(); - assertEquals(new LinkedList<>(), receivedMessages); - - IDistributionStatusMessage message = new DistributionStatusMessage("testArtifactUrl", "testConsumerId", "testDistributionId", DistributionStatusEnum.DOWNLOAD_OK, 123456); - distClientEmulator.sendDeploymentStatus(message); - assertEquals(message, receivedMessages.get(0)); - - IDistributionStatusMessage message2 = new DistributionStatusMessage("testArtifactUrl2", "testConsumerId2", "testDistributionId2", DistributionStatusEnum.DOWNLOAD_OK, 1234567); - distClientEmulator.sendDeploymentStatus(message2); - assertEquals(message2, receivedMessages.get(1)); - } - - @Test - public void sendDeploymentStatusPrimary() { - IDistributionStatusMessage message = new DistributionStatusMessage("testArtifactUrl", "testConsumerId", "testDistributionId", DistributionStatusEnum.DOWNLOAD_OK, 123456); - IDistributionClientResult result = distClientEmulator.sendDeploymentStatus(message); - IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name()); - assertEquals(message, distClientEmulator.getDistributionMessageReceived().get(0)); - assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); - assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); - } - - @Test - public void sendDeploymentStatusSecondary() { - IDistributionStatusMessage message = new DistributionStatusMessage("testArtifactUrl", "testConsumerId", "testDistributionId", DistributionStatusEnum.DOWNLOAD_OK, 123456); - IDistributionClientResult result = distClientEmulator.sendDeploymentStatus(message, "test"); - IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name()); - assertEquals(message, distClientEmulator.getDistributionMessageReceived().get(0)); - assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); - assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); - } - - @Test - public void sendDownloadStatusPrimary() { - IDistributionStatusMessage message = new DistributionStatusMessage("testArtifactUrl", "testConsumerId", "testDistributionId", DistributionStatusEnum.DOWNLOAD_OK, 123456); - IDistributionClientResult result = distClientEmulator.sendDownloadStatus(message); - IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name()); - assertEquals(message, distClientEmulator.getDistributionMessageReceived().get(0)); - assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); - assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); - } - - @Test - public void sendDownloadStatusSecondary() { - IDistributionStatusMessage message = new DistributionStatusMessage("testArtifactUrl", "testConsumerId", "testDistributionId", DistributionStatusEnum.DOWNLOAD_OK, 123456); - IDistributionClientResult result = distClientEmulator.sendDownloadStatus(message, "test"); - IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name()); - assertEquals(message, distClientEmulator.getDistributionMessageReceived().get(0)); - assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); - assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); - } - - @Test - public void initPrimary() { - IDistributionClientResult result = distClientEmulator.init(new ASDCConfiguration(), new ASDCNotificationCallBack()); - IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name()); - assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); - assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); - } - - @Test - public void initSecondary() { - IDistributionClientResult result = distClientEmulator.init(new ASDCConfiguration(), new ASDCNotificationCallBack(), new ASDCStatusCallBack()); - IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name()); - assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); - assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); - } - - @Test - public void start() { - IDistributionClientResult result = distClientEmulator.start(); - IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name()); - assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); - assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); - } - - @Test - public void stop() { - IDistributionClientResult result = distClientEmulator.stop(); - IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name()); - assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); - assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); - } - - @Test - public void updateConfiguration() { - IDistributionClientResult result = distClientEmulator.updateConfiguration(new ASDCConfiguration()); - IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name()); - assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); - assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); - } - - @Test - public void getResourcePath() { - String testResourcePath = "testResourcePath"; - distClientEmulator = new DistributionClientEmulator(testResourcePath); - assertEquals(testResourcePath, distClientEmulator.getResourcePath()); - } - - @Test - public void setResourcePath() { - String testResourcePath = "testResourcePath"; - distClientEmulator.setResourcePath(testResourcePath); - assertEquals(testResourcePath, distClientEmulator.getResourcePath()); - } - - @Test - public void downloadSuccess() throws IOException { - ArtifactInfoImpl info = new ArtifactInfoImpl(); - info.setArtifactURL("mso.json"); - info.setArtifactName("testArtifactName"); - - distClientEmulator.setResourcePath("src/test/resources/"); - - IDistributionClientDownloadResult result = distClientEmulator.download(info); - - byte[] expectedInputStream = Files.readAllBytes(Paths.get(distClientEmulator.getResourcePath() + info.getArtifactURL())); - IDistributionClientDownloadResult expectedResult = new DistributionClientDownloadResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name(), info.getArtifactName(), expectedInputStream); - - assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); - assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); - } + + private DistributionClientEmulator distClientEmulator; + + @Before + public void before() { + distClientEmulator = new DistributionClientEmulator(); + } + + @Test + public void getDistributionMessageReceived() { + List<IDistributionStatusMessage> receivedMessages = distClientEmulator.getDistributionMessageReceived(); + assertEquals(new LinkedList<>(), receivedMessages); + + IDistributionStatusMessage message = new DistributionStatusMessage("testArtifactUrl", "testConsumerId", + "testDistributionId", DistributionStatusEnum.DOWNLOAD_OK, 123456); + distClientEmulator.sendDeploymentStatus(message); + assertEquals(message, receivedMessages.get(0)); + + IDistributionStatusMessage message2 = new DistributionStatusMessage("testArtifactUrl2", "testConsumerId2", + "testDistributionId2", DistributionStatusEnum.DOWNLOAD_OK, 1234567); + distClientEmulator.sendDeploymentStatus(message2); + assertEquals(message2, receivedMessages.get(1)); + } + + @Test + public void sendDeploymentStatusPrimary() { + IDistributionStatusMessage message = new DistributionStatusMessage("testArtifactUrl", "testConsumerId", + "testDistributionId", DistributionStatusEnum.DOWNLOAD_OK, 123456); + IDistributionClientResult result = distClientEmulator.sendDeploymentStatus(message); + IDistributionClientResult expectedResult = new DistributionClientResultImpl( + DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name()); + assertEquals(message, distClientEmulator.getDistributionMessageReceived().get(0)); + assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); + assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); + } + + @Test + public void sendDeploymentStatusSecondary() { + IDistributionStatusMessage message = new DistributionStatusMessage("testArtifactUrl", "testConsumerId", + "testDistributionId", DistributionStatusEnum.DOWNLOAD_OK, 123456); + IDistributionClientResult result = distClientEmulator.sendDeploymentStatus(message, "test"); + IDistributionClientResult expectedResult = new DistributionClientResultImpl( + DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name()); + assertEquals(message, distClientEmulator.getDistributionMessageReceived().get(0)); + assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); + assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); + } + + @Test + public void sendDownloadStatusPrimary() { + IDistributionStatusMessage message = new DistributionStatusMessage("testArtifactUrl", "testConsumerId", + "testDistributionId", DistributionStatusEnum.DOWNLOAD_OK, 123456); + IDistributionClientResult result = distClientEmulator.sendDownloadStatus(message); + IDistributionClientResult expectedResult = new DistributionClientResultImpl( + DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name()); + assertEquals(message, distClientEmulator.getDistributionMessageReceived().get(0)); + assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); + assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); + } + + @Test + public void sendDownloadStatusSecondary() { + IDistributionStatusMessage message = new DistributionStatusMessage("testArtifactUrl", "testConsumerId", + "testDistributionId", DistributionStatusEnum.DOWNLOAD_OK, 123456); + IDistributionClientResult result = distClientEmulator.sendDownloadStatus(message, "test"); + IDistributionClientResult expectedResult = new DistributionClientResultImpl( + DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name()); + assertEquals(message, distClientEmulator.getDistributionMessageReceived().get(0)); + assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); + assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); + } + + @Test + public void initPrimary() { + IDistributionClientResult result = + distClientEmulator.init(new ASDCConfiguration(), new ASDCNotificationCallBack()); + IDistributionClientResult expectedResult = new DistributionClientResultImpl( + DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name()); + assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); + assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); + } + + @Test + public void initSecondary() { + IDistributionClientResult result = distClientEmulator.init(new ASDCConfiguration(), + new ASDCNotificationCallBack(), new ASDCStatusCallBack()); + IDistributionClientResult expectedResult = new DistributionClientResultImpl( + DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name()); + assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); + assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); + } + + @Test + public void start() { + IDistributionClientResult result = distClientEmulator.start(); + IDistributionClientResult expectedResult = new DistributionClientResultImpl( + DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name()); + assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); + assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); + } + + @Test + public void stop() { + IDistributionClientResult result = distClientEmulator.stop(); + IDistributionClientResult expectedResult = new DistributionClientResultImpl( + DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name()); + assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); + assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); + } + + @Test + public void updateConfiguration() { + IDistributionClientResult result = distClientEmulator.updateConfiguration(new ASDCConfiguration()); + IDistributionClientResult expectedResult = new DistributionClientResultImpl( + DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name()); + assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); + assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); + } + + @Test + public void getResourcePath() { + String testResourcePath = "testResourcePath"; + distClientEmulator = new DistributionClientEmulator(testResourcePath); + assertEquals(testResourcePath, distClientEmulator.getResourcePath()); + } + + @Test + public void setResourcePath() { + String testResourcePath = "testResourcePath"; + distClientEmulator.setResourcePath(testResourcePath); + assertEquals(testResourcePath, distClientEmulator.getResourcePath()); + } + + @Test + public void downloadSuccess() throws IOException { + ArtifactInfoImpl info = new ArtifactInfoImpl(); + info.setArtifactURL("mso.json"); + info.setArtifactName("testArtifactName"); + + distClientEmulator.setResourcePath("src/test/resources/"); + + IDistributionClientDownloadResult result = distClientEmulator.download(info); + + byte[] expectedInputStream = + Files.readAllBytes(Paths.get(distClientEmulator.getResourcePath() + info.getArtifactURL())); + IDistributionClientDownloadResult expectedResult = + new DistributionClientDownloadResultImpl(DistributionActionResultEnum.SUCCESS, + DistributionActionResultEnum.SUCCESS.name(), info.getArtifactName(), expectedInputStream); + + assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult()); + assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult()); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/JsonStatusDataTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/JsonStatusDataTest.java index 5e2f1ad828..cf54656271 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/JsonStatusDataTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/JsonStatusDataTest.java @@ -21,7 +21,6 @@ package org.onap.so.asdc.client.test.emulators; import org.junit.Test; - import static org.junit.Assert.assertEquals; public class JsonStatusDataTest { @@ -39,17 +38,16 @@ public class JsonStatusDataTest { } @Test - public void setGetAttributes() - { + public void setGetAttributes() { JsonStatusData jsonStatusData = new JsonStatusData(); - jsonStatusData.setAttribute("test","test"); + jsonStatusData.setAttribute("test", "test"); jsonStatusData.getStatus(); jsonStatusData.getTimestamp(); jsonStatusData.getComponentName(); jsonStatusData.getConsumerID(); jsonStatusData.getDistributionID(); String errReason = jsonStatusData.getErrorReason(); - assertEquals(errReason,"MSO FAILURE"); + assertEquals(errReason, "MSO FAILURE"); } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaDataTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaDataTest.java index 6da3a2c18c..bcef94336b 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaDataTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaDataTest.java @@ -21,32 +21,30 @@ package org.onap.so.asdc.client.test.emulators; import static org.junit.Assert.assertEquals; - import java.util.HashMap; - import org.junit.Test; public class JsonVfModuleMetaDataTest { - - @Test - public void attributesMapTest() { - JsonVfModuleMetaData vfModuleMetadata = new JsonVfModuleMetaData(); - vfModuleMetadata.setAttribute("vfModuleModelDescription", "vfModuleModelDescription"); - vfModuleMetadata.setAttribute("vfModuleModelInvariantUUID", "vfModuleModelInvariantUUID"); - vfModuleMetadata.setAttribute("vfModuleModelCustomizationUUID", "vfModuleModelCustomizationUUID"); - vfModuleMetadata.setAttribute("vfModuleModelName", "vfModuleModelName"); - vfModuleMetadata.setAttribute("vfModuleModelUUID", "vfModuleModelUUID"); - vfModuleMetadata.setAttribute("vfModuleModelVersion", "vfModuleModelVersion"); - vfModuleMetadata.setAttribute("isBase", true); - - assertEquals("vfModuleModelDescription", vfModuleMetadata.getVfModuleModelDescription()); - assertEquals("vfModuleModelInvariantUUID", vfModuleMetadata.getVfModuleModelInvariantUUID()); - assertEquals("vfModuleModelCustomizationUUID", vfModuleMetadata.getVfModuleModelCustomizationUUID()); - assertEquals("vfModuleModelName", vfModuleMetadata.getVfModuleModelName()); - assertEquals("vfModuleModelUUID", vfModuleMetadata.getVfModuleModelUUID()); - assertEquals("vfModuleModelVersion", vfModuleMetadata.getVfModuleModelVersion()); - assertEquals(true, vfModuleMetadata.isBase()); - assertEquals(null, vfModuleMetadata.getArtifacts()); - assertEquals(new HashMap<String, String>(), vfModuleMetadata.getProperties()); - } + + @Test + public void attributesMapTest() { + JsonVfModuleMetaData vfModuleMetadata = new JsonVfModuleMetaData(); + vfModuleMetadata.setAttribute("vfModuleModelDescription", "vfModuleModelDescription"); + vfModuleMetadata.setAttribute("vfModuleModelInvariantUUID", "vfModuleModelInvariantUUID"); + vfModuleMetadata.setAttribute("vfModuleModelCustomizationUUID", "vfModuleModelCustomizationUUID"); + vfModuleMetadata.setAttribute("vfModuleModelName", "vfModuleModelName"); + vfModuleMetadata.setAttribute("vfModuleModelUUID", "vfModuleModelUUID"); + vfModuleMetadata.setAttribute("vfModuleModelVersion", "vfModuleModelVersion"); + vfModuleMetadata.setAttribute("isBase", true); + + assertEquals("vfModuleModelDescription", vfModuleMetadata.getVfModuleModelDescription()); + assertEquals("vfModuleModelInvariantUUID", vfModuleMetadata.getVfModuleModelInvariantUUID()); + assertEquals("vfModuleModelCustomizationUUID", vfModuleMetadata.getVfModuleModelCustomizationUUID()); + assertEquals("vfModuleModelName", vfModuleMetadata.getVfModuleModelName()); + assertEquals("vfModuleModelUUID", vfModuleMetadata.getVfModuleModelUUID()); + assertEquals("vfModuleModelVersion", vfModuleMetadata.getVfModuleModelVersion()); + assertEquals(true, vfModuleMetadata.isBase()); + assertEquals(null, vfModuleMetadata.getArtifacts()); + assertEquals(new HashMap<String, String>(), vfModuleMetadata.getProperties()); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/NotificationDataImplTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/NotificationDataImplTest.java index b1524e015f..94ba54db29 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/NotificationDataImplTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/NotificationDataImplTest.java @@ -21,39 +21,38 @@ package org.onap.so.asdc.client.test.emulators; import static org.junit.Assert.assertEquals; - import java.util.ArrayList; import java.util.List; - import org.junit.Test; import org.mockito.Mock; import org.onap.so.asdc.BaseTest; import org.springframework.beans.factory.annotation.Autowired; public class NotificationDataImplTest extends BaseTest { - @Autowired - private NotificationDataImpl notificationDataImpl; - - @Mock - private ArtifactInfoImpl artifactInfoImpl; - - private static final String NOTIFICATION_DATA_IMPL_STRING = "NotificationDataImpl [distributionID=distributionID, serviceName=serviceName, " - + "serviceVersion=serviceVersion, serviceUUID=serviceUUID, serviceDescription=serviceDescription, " - + "serviceInvariantUUID=serviceInvariantUUID, resources=null, serviceArtifacts=[artifactInfoImpl], workloadContext=workloadContext]"; - - @Test - public void toStringTest() { - List<ArtifactInfoImpl> relevantServiceArtifacts = new ArrayList<ArtifactInfoImpl>(); - relevantServiceArtifacts.add(artifactInfoImpl); - notificationDataImpl.setDistributionID("distributionID"); - notificationDataImpl.setServiceName("serviceName"); - notificationDataImpl.setServiceVersion("serviceVersion"); - notificationDataImpl.setServiceDescription("serviceDescription"); - notificationDataImpl.setServiceUUID("serviceUUID"); - notificationDataImpl.setServiceInvariantUUID("serviceInvariantUUID"); - notificationDataImpl.setWorkloadContext("workloadContext"); - notificationDataImpl.setServiceArtifacts(relevantServiceArtifacts); - - assertEquals(NOTIFICATION_DATA_IMPL_STRING, notificationDataImpl.toString()); - } + @Autowired + private NotificationDataImpl notificationDataImpl; + + @Mock + private ArtifactInfoImpl artifactInfoImpl; + + private static final String NOTIFICATION_DATA_IMPL_STRING = + "NotificationDataImpl [distributionID=distributionID, serviceName=serviceName, " + + "serviceVersion=serviceVersion, serviceUUID=serviceUUID, serviceDescription=serviceDescription, " + + "serviceInvariantUUID=serviceInvariantUUID, resources=null, serviceArtifacts=[artifactInfoImpl], workloadContext=workloadContext]"; + + @Test + public void toStringTest() { + List<ArtifactInfoImpl> relevantServiceArtifacts = new ArrayList<ArtifactInfoImpl>(); + relevantServiceArtifacts.add(artifactInfoImpl); + notificationDataImpl.setDistributionID("distributionID"); + notificationDataImpl.setServiceName("serviceName"); + notificationDataImpl.setServiceVersion("serviceVersion"); + notificationDataImpl.setServiceDescription("serviceDescription"); + notificationDataImpl.setServiceUUID("serviceUUID"); + notificationDataImpl.setServiceInvariantUUID("serviceInvariantUUID"); + notificationDataImpl.setWorkloadContext("workloadContext"); + notificationDataImpl.setServiceArtifacts(relevantServiceArtifacts); + + assertEquals(NOTIFICATION_DATA_IMPL_STRING, notificationDataImpl.toString()); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImplTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImplTest.java index 423661770b..47662daab7 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImplTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImplTest.java @@ -22,30 +22,28 @@ package org.onap.so.asdc.client.test.emulators; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; - import java.util.ArrayList; import java.util.List; - import org.junit.Test; import org.mockito.Mock; import org.onap.sdc.api.notification.IResourceInstance; import org.onap.so.asdc.BaseTest; public class ResourceInfoImplTest extends BaseTest { - @Mock - private IResourceInstance iResourceInstance; - - @Test - public void convertToJsonContainerTest() { - List<IResourceInstance> resources = new ArrayList<IResourceInstance>(); - resources.add(iResourceInstance); - ResourceInfoImpl.convertToJsonContainer(resources); - - assertEquals(1, ResourceInfoImpl.convertToJsonContainer(resources).size()); - } - - @Test - public void convertToJsonContainerNullListTest() { - assertTrue(ResourceInfoImpl.convertToJsonContainer(null).isEmpty()); - } + @Mock + private IResourceInstance iResourceInstance; + + @Test + public void convertToJsonContainerTest() { + List<IResourceInstance> resources = new ArrayList<IResourceInstance>(); + resources.add(iResourceInstance); + ResourceInfoImpl.convertToJsonContainer(resources); + + assertEquals(1, ResourceInfoImpl.convertToJsonContainer(resources).size()); + } + + @Test + public void convertToJsonContainerNullListTest() { + assertTrue(ResourceInfoImpl.convertToJsonContainer(null).isEmpty()); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java index 546c4e2458..815f419c40 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java @@ -22,20 +22,16 @@ package org.onap.so.asdc.client.test.rest; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; - import java.io.File; import java.util.HashSet; import java.util.Set; - import javax.transaction.Transactional; import javax.ws.rs.core.Response; - import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -56,105 +52,103 @@ import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; - import com.fasterxml.jackson.databind.ObjectMapper; public class ASDCRestInterfaceTest extends BaseTest { - @Autowired - private AllottedResourceRepository allottedRepo; - - @Autowired - private ServiceRepository serviceRepo; - - @Autowired - private NetworkResourceRepository networkRepo; - - @Autowired - private ASDCRestInterface asdcRestInterface; - - private TestRestTemplate restTemplate = new TestRestTemplate("test", "test"); - - private HttpHeaders headers = new HttpHeaders(); - - @Spy - DistributionClientEmulator spyClient = new DistributionClientEmulator(); - - @LocalServerPort - private int port; - - - @Rule - public TemporaryFolder folder= new TemporaryFolder(); - - - @Before - public void setUp() { - //ASDC Controller writes to this path - System.setProperty("mso.config.path", folder.getRoot().toString()); - } - - @Test - @Transactional - public void testAllottedResourceService() throws Exception { - - stubFor(post(urlPathMatching("/aai/.*")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json"))); - - ObjectMapper mapper = new ObjectMapper(); - NotificationDataImpl request = mapper.readValue(new File("src/test/resources/resource-examples/allottedresource/notif-portm.json"), NotificationDataImpl.class); - headers.add("resource-location", "src/test/resources/resource-examples/allottedresource/"); - HttpEntity<NotificationDataImpl> entity = new HttpEntity<NotificationDataImpl>(request, headers); - - ResponseEntity<String> response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"), HttpMethod.POST, - entity, String.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - - AllottedResource expectedService = new AllottedResource(); - expectedService.setDescription("rege1802pnf"); - expectedService.setModelInvariantUUID("b8f83c3f-077c-4e2c-b489-c66382060436"); - expectedService.setModelName("rege1802pnf"); - expectedService.setModelUUID("5b18c75e-2d08-4bf2-ad58-4ea704ec648d"); - expectedService.setModelVersion("1.0"); - expectedService.setSubcategory("Contrail Route"); - expectedService.setToscaNodeType("org.openecomp.resource.pnf.Rege1802pnf"); - Set<AllottedResourceCustomization> arCustomizationSet = new HashSet<AllottedResourceCustomization>(); - AllottedResourceCustomization arCustomization = new AllottedResourceCustomization(); - arCustomization.setModelCustomizationUUID("f62bb612-c5d4-4406-865c-0abec30631ba"); - arCustomization.setModelInstanceName("rege1802pnf 0"); - arCustomizationSet.add(arCustomization); - - arCustomization.setAllottedResource(expectedService); - - - expectedService.setAllotedResourceCustomization(arCustomizationSet); - - AllottedResource actualResponse = allottedRepo.findResourceByModelUUID("5b18c75e-2d08-4bf2-ad58-4ea704ec648d"); - - - if(actualResponse == null) - throw new Exception("No Allotted Resource Written to database"); - - - assertThat(actualResponse, sameBeanAs(expectedService).ignoring("0x1.created").ignoring("0x1.allotedResourceCustomization.created")); - } - - @Test - public void invokeASDCStatusDataNullTest() { - String request = ""; - Response response = asdcRestInterface.invokeASDCStatusData(request); - assertNull(response); - - } - - - - - - protected String createURLWithPort(String uri) { - return "http://localhost:" + port + uri; - } + @Autowired + private AllottedResourceRepository allottedRepo; + + @Autowired + private ServiceRepository serviceRepo; + + @Autowired + private NetworkResourceRepository networkRepo; + + @Autowired + private ASDCRestInterface asdcRestInterface; + + private TestRestTemplate restTemplate = new TestRestTemplate("test", "test"); + + private HttpHeaders headers = new HttpHeaders(); + + @Spy + DistributionClientEmulator spyClient = new DistributionClientEmulator(); + + @LocalServerPort + private int port; + + + @Rule + public TemporaryFolder folder = new TemporaryFolder(); + + + @Before + public void setUp() { + // ASDC Controller writes to this path + System.setProperty("mso.config.path", folder.getRoot().toString()); + } + + @Test + @Transactional + public void testAllottedResourceService() throws Exception { + + wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) + .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json"))); + + ObjectMapper mapper = new ObjectMapper(); + NotificationDataImpl request = + mapper.readValue(new File("src/test/resources/resource-examples/allottedresource/notif-portm.json"), + NotificationDataImpl.class); + headers.add("resource-location", "src/test/resources/resource-examples/allottedresource/"); + HttpEntity<NotificationDataImpl> entity = new HttpEntity<NotificationDataImpl>(request, headers); + + ResponseEntity<String> response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"), + HttpMethod.POST, entity, String.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + AllottedResource expectedService = new AllottedResource(); + expectedService.setDescription("rege1802pnf"); + expectedService.setModelInvariantUUID("b8f83c3f-077c-4e2c-b489-c66382060436"); + expectedService.setModelName("rege1802pnf"); + expectedService.setModelUUID("5b18c75e-2d08-4bf2-ad58-4ea704ec648d"); + expectedService.setModelVersion("1.0"); + expectedService.setSubcategory("Contrail Route"); + expectedService.setToscaNodeType("org.openecomp.resource.pnf.Rege1802pnf"); + Set<AllottedResourceCustomization> arCustomizationSet = new HashSet<AllottedResourceCustomization>(); + AllottedResourceCustomization arCustomization = new AllottedResourceCustomization(); + arCustomization.setModelCustomizationUUID("f62bb612-c5d4-4406-865c-0abec30631ba"); + arCustomization.setModelInstanceName("rege1802pnf 0"); + arCustomizationSet.add(arCustomization); + + arCustomization.setAllottedResource(expectedService); + + + expectedService.setAllotedResourceCustomization(arCustomizationSet); + + AllottedResource actualResponse = allottedRepo.findResourceByModelUUID("5b18c75e-2d08-4bf2-ad58-4ea704ec648d"); + + + if (actualResponse == null) + throw new Exception("No Allotted Resource Written to database"); + + + assertThat(actualResponse, sameBeanAs(expectedService).ignoring("0x1.created") + .ignoring("0x1.allotedResourceCustomization.created")); + } + + @Test + public void invokeASDCStatusDataNullTest() { + String request = ""; + Response response = asdcRestInterface.invokeASDCStatusData(request); + assertNull(response); + + } + + + + protected String createURLWithPort(String uri) { + return "http://localhost:" + port + uri; + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/HealthCheckTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/HealthCheckTest.java index cd2c3ee7e6..adc55937b6 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/HealthCheckTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/HealthCheckTest.java @@ -38,28 +38,27 @@ import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; public class HealthCheckTest extends BaseTest { - - @LocalServerPort - private int port; - TestRestTemplate restTemplate = new TestRestTemplate(); + @LocalServerPort + private int port; - HttpHeaders headers = new HttpHeaders(); - - @Test - public void testHealthcheck() throws JSONException { + TestRestTemplate restTemplate = new TestRestTemplate(); - HttpEntity<String> entity = new HttpEntity<String>(null, headers); + HttpHeaders headers = new HttpHeaders(); - ResponseEntity<String> response = restTemplate.exchange( - createURLWithPort("/manage/health"), - HttpMethod.GET, entity, String.class); - - assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value()); - } - - private String createURLWithPort(String uri) { - return "http://localhost:" + port + uri; - } + @Test + public void testHealthcheck() throws JSONException { + + HttpEntity<String> entity = new HttpEntity<String>(null, headers); + + ResponseEntity<String> response = + restTemplate.exchange(createURLWithPort("/manage/health"), HttpMethod.GET, entity, String.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + } + + private String createURLWithPort(String uri) { + return "http://localhost:" + port + uri; + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java index db797cff29..992d495369 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java @@ -24,12 +24,9 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; - import java.util.ArrayList; import java.util.List; - import javax.transaction.Transactional; - import org.junit.Test; import org.onap.so.asdc.BaseTest; import org.onap.so.asdc.client.ASDCConfiguration; @@ -42,111 +39,111 @@ import org.springframework.beans.factory.annotation.Autowired; */ @Transactional public class ASDCConfigurationTest extends BaseTest { - + @Autowired private ASDCConfiguration config; - + private List<String> msgBusAddressList = new ArrayList<String>(); - + private static final String MSO_PRE_IST = "msopreist"; private static final String MSO_ASDC_ID_LOCAL = "msoasdc-id-local"; private static final String PRE_IST = "Pre-IST"; private static final String ASDC_ADDRESS = "localhost:8443"; - + @Test public void isUseHttpsWithDmaapTest() { - assertTrue(config.isUseHttpsWithDmaap()); + assertTrue(config.isUseHttpsWithDmaap()); } - + @Test public void isConsumeProduceStatusTopicTest() { - assertTrue(config.isConsumeProduceStatusTopic()); + assertTrue(config.isConsumeProduceStatusTopic()); } - + @Test public void getUserTest() { - assertTrue(MSO_PRE_IST.equals(config.getUser())); + assertTrue(MSO_PRE_IST.equals(config.getUser())); } - + @Test public void getConsumerGroupTest() { - assertTrue(MSO_ASDC_ID_LOCAL.equals(config.getConsumerGroup())); + assertTrue(MSO_ASDC_ID_LOCAL.equals(config.getConsumerGroup())); } - + @Test public void getConsumerIDTest() { - assertTrue(MSO_ASDC_ID_LOCAL.equals(config.getConsumerID())); + assertTrue(MSO_ASDC_ID_LOCAL.equals(config.getConsumerID())); } - + @Test public void getEnvironmentNameTest() { - assertTrue(PRE_IST.equals(config.getEnvironmentName())); + assertTrue(PRE_IST.equals(config.getEnvironmentName())); } - + @Test public void getAsdcAddress() { - assertTrue(ASDC_ADDRESS.equals(config.getAsdcAddress())); + assertTrue(ASDC_ADDRESS.equals(config.getAsdcAddress())); } - + @Test public void getPasswordTest() { - assertTrue(MSO_PRE_IST.equals(config.getPassword())); + assertTrue(MSO_PRE_IST.equals(config.getPassword())); } - + @Test public void getPollingIntervalTest() { - assertTrue(config.getPollingInterval() == 30); + assertTrue(config.getPollingInterval() == 30); } - + @Test public void getPollingTimeoutTest() { - assertTrue(config.getPollingTimeout() == 30); + assertTrue(config.getPollingTimeout() == 30); } - + @Test public void getRelevantArtifactTypesTest() { - assertTrue(config.getRelevantArtifactTypes().size() == ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size()); + assertTrue(config.getRelevantArtifactTypes().size() == ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size()); } - + @Test public void getWatchDogTimeoutTest() { - assertTrue(config.getWatchDogTimeout() == 1); + assertTrue(config.getWatchDogTimeout() == 1); } - + @Test public void activateServerTLSAuthTest() { - assertFalse(config.activateServerTLSAuth()); + assertFalse(config.activateServerTLSAuth()); } - + @Test public void getKeyStorePasswordTest() { - assertNull(config.getKeyStorePassword()); + assertNull(config.getKeyStorePassword()); } - + @Test public void getKeyStorePathTest() { - assertNull(config.getKeyStorePath()); + assertNull(config.getKeyStorePath()); } - + @Test public void isFilterInEmptyResourcesTest() { - assertTrue(config.isFilterInEmptyResources()); + assertTrue(config.isFilterInEmptyResources()); } - + @Test public void setGetAsdcControllerNameTest() { - String asdcControllerName = "testAsdcControllerName"; - config.setAsdcControllerName(asdcControllerName); - String actualAsdcControllerName = config.getAsdcControllerName(); - assertEquals(asdcControllerName, actualAsdcControllerName); + String asdcControllerName = "testAsdcControllerName"; + config.setAsdcControllerName(asdcControllerName); + String actualAsdcControllerName = config.getAsdcControllerName(); + assertEquals(asdcControllerName, actualAsdcControllerName); } - + @Test public void getMsgBusAddressTest() { - msgBusAddressList.add("localhost"); - msgBusAddressList.add("localhost"); - - List<String> actualMsgBusAddress = config.getMsgBusAddress(); - assertEquals(msgBusAddressList, actualMsgBusAddress); + msgBusAddressList.add("localhost"); + msgBusAddressList.add("localhost"); + + List<String> actualMsgBusAddress = config.getMsgBusAddress(); + assertEquals(msgBusAddressList, actualMsgBusAddress); } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/ToscaResourceStructureTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/ToscaResourceStructureTest.java index 1e8b72d145..d3990b9e7d 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/ToscaResourceStructureTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/ToscaResourceStructureTest.java @@ -26,10 +26,8 @@ import static org.junit.Assert.assertThat; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; - import java.util.ArrayList; import java.util.HashMap; - import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -50,84 +48,89 @@ import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; public class ToscaResourceStructureTest { - private ArtifactInfoImpl artifactInfo; - private SdcCsarHelperImpl sdcCsarHelper; - - private ToscaResourceStructure toscaResourceStructure; - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - @Test - public void toscaResourceStructureBeanTest() { - artifactInfo = mock(ArtifactInfoImpl.class); - sdcCsarHelper = mock(SdcCsarHelperImpl.class); - - toscaResourceStructure = new ToscaResourceStructure(); - toscaResourceStructure.setHeatTemplateUUID("heatTemplateUUID"); - toscaResourceStructure.setAllottedList(new ArrayList<NodeTemplate>()); - toscaResourceStructure.setSdcCsarHelper(sdcCsarHelper); - toscaResourceStructure.setServiceMetadata(new Metadata(new HashMap<>())); - toscaResourceStructure.setCatalogService(new Service()); - toscaResourceStructure.setNetworkTypes(new ArrayList<>()); - toscaResourceStructure.setVfTypes(new ArrayList<>()); - toscaResourceStructure.setCatalogResourceCustomization(new AllottedResourceCustomization()); - toscaResourceStructure.setCatalogNetworkResourceCustomization(new NetworkResourceCustomization()); - toscaResourceStructure.setCatalogNetworkResource(new NetworkResource()); - toscaResourceStructure.setCatalogVfModule(new VfModule()); - toscaResourceStructure.setVnfResourceCustomization(new VnfResourceCustomization()); - toscaResourceStructure.setVfModuleCustomization(new VfModuleCustomization()); - toscaResourceStructure.setAllottedResource(new AllottedResource()); - toscaResourceStructure.setAllottedResourceCustomization(new AllottedResourceCustomization()); - toscaResourceStructure.setCatalogTempNetworkHeatTemplateLookup(new TempNetworkHeatTemplateLookup()); - toscaResourceStructure.setHeatFilesUUID("heatFilesUUID"); - toscaResourceStructure.setToscaArtifact(artifactInfo); - toscaResourceStructure.setToscaCsar(new ToscaCsar()); - toscaResourceStructure.setVolHeatTemplateUUID("volHeatTemplateUUID"); - toscaResourceStructure.setEnvHeatTemplateUUID("envHeatTemplateUUID"); - toscaResourceStructure.setServiceVersion("serviceVersion"); - toscaResourceStructure.setWorkloadPerformance("workloadPerformance"); - toscaResourceStructure.setVfModule(new VfModule()); - toscaResourceStructure.setTempNetworkHeatTemplateLookup(new TempNetworkHeatTemplateLookup()); - toscaResourceStructure.setSuccessfulDeployment(); - - assertEquals("heatTemplateUUID", toscaResourceStructure.getHeatTemplateUUID()); - assertThat(toscaResourceStructure.getAllottedList(), sameBeanAs(new ArrayList<NodeTemplate>())); - assertEquals(sdcCsarHelper, toscaResourceStructure.getSdcCsarHelper()); - assertThat(toscaResourceStructure.getServiceMetadata(), sameBeanAs(new Metadata(new HashMap<>()))); - assertThat(toscaResourceStructure.getCatalogService(), sameBeanAs(new Service())); - assertThat(toscaResourceStructure.getNetworkTypes(), sameBeanAs(new ArrayList<>())); - assertThat(toscaResourceStructure.getVfTypes(), sameBeanAs(new ArrayList<>())); - assertThat(toscaResourceStructure.getCatalogResourceCustomization(), sameBeanAs(new AllottedResourceCustomization())); - assertThat(toscaResourceStructure.getCatalogNetworkResourceCustomization(), sameBeanAs(new NetworkResourceCustomization())); - assertThat(toscaResourceStructure.getCatalogNetworkResource(), sameBeanAs(new NetworkResource())); - assertThat(toscaResourceStructure.getCatalogVfModule(), sameBeanAs(new VfModule())); - assertThat(toscaResourceStructure.getVnfResourceCustomization(), sameBeanAs(new VnfResourceCustomization())); - assertThat(toscaResourceStructure.getVfModuleCustomization(), sameBeanAs(new VfModuleCustomization())); - assertThat(toscaResourceStructure.getAllottedResource(), sameBeanAs(new AllottedResource())); - assertThat(toscaResourceStructure.getAllottedResourceCustomization(), sameBeanAs(new AllottedResourceCustomization())); - assertThat(toscaResourceStructure.getCatalogTempNetworkHeatTemplateLookup(), sameBeanAs(new TempNetworkHeatTemplateLookup())); - assertEquals("heatFilesUUID", toscaResourceStructure.getHeatFilesUUID()); - assertEquals(artifactInfo, toscaResourceStructure.getToscaArtifact()); - assertThat(toscaResourceStructure.getToscaCsar(), sameBeanAs(new ToscaCsar())); - assertEquals("volHeatTemplateUUID", toscaResourceStructure.getVolHeatTemplateUUID()); - assertEquals("envHeatTemplateUUID", toscaResourceStructure.getEnvHeatTemplateUUID()); - assertEquals("serviceVersion", toscaResourceStructure.getServiceVersion()); - assertEquals("workloadPerformance", toscaResourceStructure.getWorkloadPerformance()); - assertThat(toscaResourceStructure.getVfModule(), sameBeanAs(new VfModule())); - assertThat(toscaResourceStructure.getTempNetworkHeatTemplateLookup(), sameBeanAs(new TempNetworkHeatTemplateLookup())); - assertEquals(true, toscaResourceStructure.isDeployedSuccessfully()); - } - - @Test - public void updateResourceStructureExceptionTest() throws Exception { - expectedException.expect(ASDCDownloadException.class); - - artifactInfo = mock(ArtifactInfoImpl.class); - toscaResourceStructure = new ToscaResourceStructure(); + private ArtifactInfoImpl artifactInfo; + private SdcCsarHelperImpl sdcCsarHelper; + + private ToscaResourceStructure toscaResourceStructure; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Test + public void toscaResourceStructureBeanTest() { + artifactInfo = mock(ArtifactInfoImpl.class); + sdcCsarHelper = mock(SdcCsarHelperImpl.class); + + toscaResourceStructure = new ToscaResourceStructure(); + toscaResourceStructure.setHeatTemplateUUID("heatTemplateUUID"); + toscaResourceStructure.setAllottedList(new ArrayList<NodeTemplate>()); + toscaResourceStructure.setSdcCsarHelper(sdcCsarHelper); + toscaResourceStructure.setServiceMetadata(new Metadata(new HashMap<>())); + toscaResourceStructure.setCatalogService(new Service()); + toscaResourceStructure.setNetworkTypes(new ArrayList<>()); + toscaResourceStructure.setVfTypes(new ArrayList<>()); + toscaResourceStructure.setCatalogResourceCustomization(new AllottedResourceCustomization()); + toscaResourceStructure.setCatalogNetworkResourceCustomization(new NetworkResourceCustomization()); + toscaResourceStructure.setCatalogNetworkResource(new NetworkResource()); + toscaResourceStructure.setCatalogVfModule(new VfModule()); + toscaResourceStructure.setVnfResourceCustomization(new VnfResourceCustomization()); + toscaResourceStructure.setVfModuleCustomization(new VfModuleCustomization()); + toscaResourceStructure.setAllottedResource(new AllottedResource()); + toscaResourceStructure.setAllottedResourceCustomization(new AllottedResourceCustomization()); + toscaResourceStructure.setCatalogTempNetworkHeatTemplateLookup(new TempNetworkHeatTemplateLookup()); + toscaResourceStructure.setHeatFilesUUID("heatFilesUUID"); + toscaResourceStructure.setToscaArtifact(artifactInfo); + toscaResourceStructure.setToscaCsar(new ToscaCsar()); + toscaResourceStructure.setVolHeatTemplateUUID("volHeatTemplateUUID"); + toscaResourceStructure.setEnvHeatTemplateUUID("envHeatTemplateUUID"); + toscaResourceStructure.setServiceVersion("serviceVersion"); + toscaResourceStructure.setWorkloadPerformance("workloadPerformance"); + toscaResourceStructure.setVfModule(new VfModule()); + toscaResourceStructure.setTempNetworkHeatTemplateLookup(new TempNetworkHeatTemplateLookup()); + toscaResourceStructure.setSuccessfulDeployment(); + + assertEquals("heatTemplateUUID", toscaResourceStructure.getHeatTemplateUUID()); + assertThat(toscaResourceStructure.getAllottedList(), sameBeanAs(new ArrayList<NodeTemplate>())); + assertEquals(sdcCsarHelper, toscaResourceStructure.getSdcCsarHelper()); + assertThat(toscaResourceStructure.getServiceMetadata(), sameBeanAs(new Metadata(new HashMap<>()))); + assertThat(toscaResourceStructure.getCatalogService(), sameBeanAs(new Service())); + assertThat(toscaResourceStructure.getNetworkTypes(), sameBeanAs(new ArrayList<>())); + assertThat(toscaResourceStructure.getVfTypes(), sameBeanAs(new ArrayList<>())); + assertThat(toscaResourceStructure.getCatalogResourceCustomization(), + sameBeanAs(new AllottedResourceCustomization())); + assertThat(toscaResourceStructure.getCatalogNetworkResourceCustomization(), + sameBeanAs(new NetworkResourceCustomization())); + assertThat(toscaResourceStructure.getCatalogNetworkResource(), sameBeanAs(new NetworkResource())); + assertThat(toscaResourceStructure.getCatalogVfModule(), sameBeanAs(new VfModule())); + assertThat(toscaResourceStructure.getVnfResourceCustomization(), sameBeanAs(new VnfResourceCustomization())); + assertThat(toscaResourceStructure.getVfModuleCustomization(), sameBeanAs(new VfModuleCustomization())); + assertThat(toscaResourceStructure.getAllottedResource(), sameBeanAs(new AllottedResource())); + assertThat(toscaResourceStructure.getAllottedResourceCustomization(), + sameBeanAs(new AllottedResourceCustomization())); + assertThat(toscaResourceStructure.getCatalogTempNetworkHeatTemplateLookup(), + sameBeanAs(new TempNetworkHeatTemplateLookup())); + assertEquals("heatFilesUUID", toscaResourceStructure.getHeatFilesUUID()); + assertEquals(artifactInfo, toscaResourceStructure.getToscaArtifact()); + assertThat(toscaResourceStructure.getToscaCsar(), sameBeanAs(new ToscaCsar())); + assertEquals("volHeatTemplateUUID", toscaResourceStructure.getVolHeatTemplateUUID()); + assertEquals("envHeatTemplateUUID", toscaResourceStructure.getEnvHeatTemplateUUID()); + assertEquals("serviceVersion", toscaResourceStructure.getServiceVersion()); + assertEquals("workloadPerformance", toscaResourceStructure.getWorkloadPerformance()); + assertThat(toscaResourceStructure.getVfModule(), sameBeanAs(new VfModule())); + assertThat(toscaResourceStructure.getTempNetworkHeatTemplateLookup(), + sameBeanAs(new TempNetworkHeatTemplateLookup())); + assertEquals(true, toscaResourceStructure.isDeployedSuccessfully()); + } + + @Test + public void updateResourceStructureExceptionTest() throws Exception { + expectedException.expect(ASDCDownloadException.class); + + artifactInfo = mock(ArtifactInfoImpl.class); + toscaResourceStructure = new ToscaResourceStructure(); + + doReturn("artifactName").when(artifactInfo).getArtifactName(); - doReturn("artifactName").when(artifactInfo).getArtifactName(); - - toscaResourceStructure.updateResourceStructure(artifactInfo); - } + toscaResourceStructure.updateResourceStructure(artifactInfo); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java index e780a259ea..6efb04fc35 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java @@ -32,7 +32,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; - import java.io.File; import java.io.FileInputStream; import java.io.InputStream; @@ -77,27 +76,26 @@ public class BpmnInstallerTest { public static void cleanup() { System.clearProperty("mso.config.path"); } - + @Test public void buildMimeMultiPart_Test() throws Exception { - Path tempFilePath = Paths.get(tempDirectoryPath.toAbsolutePath().toString(), "TestBB.bpmn"); - Files.createFile(tempFilePath); - HttpEntity entity = bpmnInstaller.buildMimeMultipart("TestBB.bpmn"); - String mimeMultipartBodyFilePath = "src/test/resources" + "/mime-multipart-body.txt"; - - File mimeMultipartBody = new File(mimeMultipartBodyFilePath); - InputStream expectedContent = new FileInputStream(mimeMultipartBody); - - assertThat(IOUtils.contentEquals(expectedContent, entity.getContent())); - - IOUtils.closeQuietly(expectedContent); + Path tempFilePath = Paths.get(tempDirectoryPath.toAbsolutePath().toString(), "TestBB.bpmn"); + Files.createFile(tempFilePath); + HttpEntity entity = bpmnInstaller.buildMimeMultipart("TestBB.bpmn"); + String mimeMultipartBodyFilePath = "src/test/resources" + "/mime-multipart-body.txt"; + + File mimeMultipartBody = new File(mimeMultipartBodyFilePath); + InputStream expectedContent = new FileInputStream(mimeMultipartBody); + + assertThat(IOUtils.contentEquals(expectedContent, entity.getContent())); + + IOUtils.closeQuietly(expectedContent); } @Test public void installBpmn_Test() throws Exception { BpmnInstaller bpmnInstallerSpy = spy(bpmnInstaller); - HttpResponse response = new BasicHttpResponse( - new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "")); + HttpResponse response = new BasicHttpResponse(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "")); HttpClient httpClient = mock(HttpClient.class); doReturn(response).when(httpClient).execute(any(HttpPost.class)); bpmnInstallerSpy.installBpmn(TEST_CSAR); diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java index bc9275bb51..844adeede2 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java @@ -33,12 +33,10 @@ import org.onap.sdc.toscaparser.api.parameters.Input; import org.onap.so.asdc.client.exceptions.ArtifactInstallerException; import org.onap.so.asdc.installer.ToscaResourceStructure; import org.onap.so.db.catalog.beans.Service; - import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.LinkedHashMap; - import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.any; import static org.mockito.Mockito.when; diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java index e4eb09782a..d3c0bdef66 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java @@ -30,11 +30,9 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; - import java.util.ArrayList; import java.util.List; import java.util.Optional; - import org.hibernate.exception.LockAcquisitionException; import org.junit.Before; import org.junit.Rule; @@ -69,310 +67,319 @@ import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatu import org.springframework.beans.factory.annotation.Autowired; public class ToscaResourceInstallerTest extends BaseTest { - @Autowired - private ToscaResourceInstaller toscaInstaller; - @Autowired - private WatchdogComponentDistributionStatusRepository watchdogCDStatusRepository; - @Autowired - private AllottedResourceRepository allottedRepo; - @Autowired - private AllottedResourceCustomizationRepository allottedCustomizationRepo; - @Autowired - private ServiceRepository serviceRepo; - @Mock - private SdcCsarHelperImpl sdcCsarHelper; - @Mock - private Metadata metadata; - @Mock - private ArtifactInfoImpl artifactInfo; - @Mock - private List<Group> vfGroups; - @Mock - private IResourceInstance resourceInstance; - @Rule - public ExpectedException expectedException = ExpectedException.none(); - @Mock - private NodeTemplate nodeTemplate; - @Mock - private ToscaResourceStructure toscaResourceStructure; - @Mock - private ServiceProxyResourceCustomization spResourceCustomization; - @Mock - private ISdcCsarHelper csarHelper; - @Mock - private StatefulEntityType entityType; - - private NotificationDataImpl notificationData; - private JsonStatusData statusData; - private static final String MSO = "SO"; - - @Before - public void before() { - MockitoAnnotations.initMocks(this); - - notificationData = new NotificationDataImpl(); - statusData = new JsonStatusData(); - } - - @Test - public void isResourceAlreadyDeployedTest() throws Exception { - notificationData.setServiceName("serviceName"); - notificationData.setServiceVersion("123456"); - notificationData.setServiceUUID("serviceUUID"); - notificationData.setDistributionID("testStatusSuccessTosca"); - - WatchdogComponentDistributionStatus expectedComponentDistributionStatus = - new WatchdogComponentDistributionStatus(notificationData.getDistributionID(), MSO); - expectedComponentDistributionStatus.setComponentDistributionStatus(DistributionStatusEnum.COMPONENT_DONE_OK.name()); - - doReturn(true).when(vfResourceStructure).isDeployedSuccessfully(); - doReturn(notificationData).when(vfResourceStructure).getNotification(); - doReturn(resourceInstance).when(vfResourceStructure).getResourceInstance(); - doReturn("resourceInstanceName").when(resourceInstance).getResourceInstanceName(); - doReturn("resourceCustomizationUUID").when(resourceInstance).getResourceCustomizationUUID(); - doReturn("resourceName").when(resourceInstance).getResourceName(); - - toscaInstaller.isResourceAlreadyDeployed(vfResourceStructure); - - WatchdogComponentDistributionStatus actualWatchdogComponentDistributionStatus = getWatchdogCDStatusWithName(watchdogCDStatusRepository.findByDistributionId(notificationData.getDistributionID()), MSO); - - verify(vfResourceStructure, times(3)).getResourceInstance(); - verify(vfResourceStructure, times(5)).getNotification(); - assertThat(actualWatchdogComponentDistributionStatus, sameBeanAs(expectedComponentDistributionStatus) - .ignoring("createTime") - .ignoring("modifyTime")); - } - - @Test - public void isResourceAlreadyDeployedFalseTest() throws Exception { - notificationData.setServiceName("serviceName"); - notificationData.setServiceVersion("123456"); - notificationData.setServiceUUID("serviceUUID"); - notificationData.setDistributionID("testStatusSuccess"); - - doThrow(RuntimeException.class).when(vfResourceStructure).isDeployedSuccessfully(); - doReturn(notificationData).when(vfResourceStructure).getNotification(); - doReturn(resourceInstance).when(vfResourceStructure).getResourceInstance(); - doReturn("resourceInstanceName").when(resourceInstance).getResourceInstanceName(); - doReturn("resourceCustomizationUUID").when(resourceInstance).getResourceCustomizationUUID(); - doReturn("resourceName").when(resourceInstance).getResourceName(); - - toscaInstaller.isResourceAlreadyDeployed(vfResourceStructure); - - verify(vfResourceStructure, times(3)).getResourceInstance(); - verify(vfResourceStructure, times(4)).getNotification(); - } - - @Test - public void isResourceAlreadyDeployedExceptionTest() throws ArtifactInstallerException { - expectedException.expect(ArtifactInstallerException.class); - - toscaInstaller.isResourceAlreadyDeployed(vfResourceStructure); - } - - @Test - public void installTheComponentStatusTest() throws Exception { - String distributionId = "testStatusSuccessTosca"; - String componentName = "testComponentName"; - - statusData = spy(JsonStatusData.class); - doReturn(distributionId).when(statusData).getDistributionID(); - doReturn(componentName).when(statusData).getComponentName(); - - WatchdogComponentDistributionStatus expectedWatchdogComponentDistributionStatus = - new WatchdogComponentDistributionStatus(distributionId, componentName); - expectedWatchdogComponentDistributionStatus.setComponentDistributionStatus(statusData.getStatus().toString()); - - WatchdogComponentDistributionStatus cdStatus = new WatchdogComponentDistributionStatus(statusData.getDistributionID(), - statusData.getComponentName()); - - toscaInstaller.installTheComponentStatus(statusData); - - WatchdogComponentDistributionStatus actualWatchdogComponentDistributionStatus = getWatchdogCDStatusWithName(watchdogCDStatusRepository.findByDistributionId("testStatusSuccessTosca"), statusData.getComponentName()); - - assertEquals(statusData.getDistributionID(), cdStatus.getDistributionId()); - assertEquals(statusData.getComponentName(), cdStatus.getComponentName()); - assertThat(actualWatchdogComponentDistributionStatus, sameBeanAs(expectedWatchdogComponentDistributionStatus) - .ignoring("createTime") - .ignoring("modifyTime")); - } - - @Test - public void installTheComponentStatusExceptionTest() throws ArtifactInstallerException { - expectedException.expect(ArtifactInstallerException.class); - - statusData = spy(JsonStatusData.class); - doReturn(null).when(statusData).getStatus(); - - toscaInstaller.installTheComponentStatus(statusData); - } - - @Test - public void installTheResourceExceptionTest() throws Exception { - expectedException.expect(ArtifactInstallerException.class); - - notificationData.setDistributionID("testStatusFailureTosca"); - notificationData.setServiceVersion("123456"); - notificationData.setServiceUUID("serviceUUID"); - notificationData.setWorkloadContext("workloadContext"); - - doReturn(notificationData).when(vfResourceStructure).getNotification(); - doReturn(resourceInstance).when(vfResourceStructure).getResourceInstance(); - - toscaInstaller.installTheResource(toscaResourceStruct, vfResourceStructure); - } - - @Test - public void installTheResourceDBExceptionTest() throws Exception { - notificationData.setDistributionID("testStatusSuccessTosca"); - notificationData.setServiceVersion("123456"); - notificationData.setServiceUUID("serviceUUID"); - notificationData.setWorkloadContext("workloadContext"); - - doReturn(notificationData).when(vfResourceStructure).getNotification(); - doReturn(resourceInstance).when(vfResourceStructure).getResourceInstance(); - doThrow(LockAcquisitionException.class).when(toscaResourceStruct).getToscaArtifact(); - - toscaInstaller.installTheResource(toscaResourceStruct, vfResourceStructure); - } - - @Test - public void verifyTheFilePrefixInStringTest() { - String body = "abcabcabcfile:///testfile.txtabcbabacbcabc"; - String filenameToVerify = "testfile.txt"; - String expectedFileBody = "abcabcabctestfile.txtabcbabacbcabc"; - - String newFileBody = toscaInstaller.verifyTheFilePrefixInString(body, filenameToVerify); - - assertEquals(expectedFileBody, newFileBody); - } - - @Test - public void verifyTheFilePrefixInStringNullBodyTest() { - String body = null; - String filenameToVerify = "testfile.txt"; - - String newFileBody = toscaInstaller.verifyTheFilePrefixInString(body, filenameToVerify); - - assertEquals(body, newFileBody); - } - - @Test - public void verifyTheFilePrefixInStringEmptyBodyTest() { - String body = ""; - String filenameToVerify = "testfile.txt"; - - String newFileBody = toscaInstaller.verifyTheFilePrefixInString(body, filenameToVerify); - - assertEquals(body, newFileBody); - } - - @Test - public void verifyTheFilePrefixInStringNullFilenameTest() { - String body = "abcabcabcfile:///testfile.txtabcbabacbcabc"; - String filenameToVerify = null; - - String newFileBody = toscaInstaller.verifyTheFilePrefixInString(body, filenameToVerify); - - assertEquals(body, newFileBody); - } - - @Test - public void verifyTheFilePrefixInStringEmptyFilenameTest() { - String body = "abcabcabcfile:///testfile.txtabcbabacbcabc"; - String filenameToVerify = ""; - - String newFileBody = toscaInstaller.verifyTheFilePrefixInString(body, filenameToVerify); - - assertEquals(body, newFileBody); - } - - private WatchdogComponentDistributionStatus getWatchdogCDStatusWithName(List<WatchdogComponentDistributionStatus> watchdogComponentDistributionStatuses, String componentName) { - WatchdogComponentDistributionStatus actualWatchdogComponentDistributionStatus = new WatchdogComponentDistributionStatus(); - for(WatchdogComponentDistributionStatus watchdogComponentDistributionStatus : watchdogComponentDistributionStatuses) { - if(componentName.equals(watchdogComponentDistributionStatus.getComponentName())) { - actualWatchdogComponentDistributionStatus = watchdogComponentDistributionStatus; - break; - } - } - return actualWatchdogComponentDistributionStatus; - } - - - - - private void prepareConfigurationResource() { - doReturn(metadata).when(nodeTemplate).getMetaData(); - doReturn(MockConstants.TEMPLATE_TYPE).when(nodeTemplate).getType(); - - doReturn(MockConstants.MODEL_NAME).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME); - doReturn(MockConstants.MODEL_INVARIANT_UUID).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID); - doReturn(MockConstants.MODEL_UUID).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_UUID); - doReturn(MockConstants.MODEL_VERSION).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_VERSION); - doReturn(MockConstants.MODEL_DESCRIPTION).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION); - doReturn(MockConstants.MODEL_NAME).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME); - doReturn(MockConstants.MODEL_NAME).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME); - } - - @Test - public void getConfigurationResourceTest() { - prepareConfigurationResource(); - - ConfigurationResource configResource=toscaInstaller.getConfigurationResource(nodeTemplate); - - assertNotNull(configResource); - assertEquals(MockConstants.MODEL_NAME, configResource.getModelName()); - assertEquals(MockConstants.MODEL_INVARIANT_UUID, configResource.getModelInvariantUUID()); - assertEquals(MockConstants.MODEL_UUID, configResource.getModelUUID()); - assertEquals(MockConstants.MODEL_VERSION, configResource.getModelVersion()); - assertEquals(MockConstants.MODEL_DESCRIPTION, configResource.getDescription()); - assertEquals(MockConstants.TEMPLATE_TYPE, nodeTemplate.getType()); - } - - private void prepareConfigurationResourceCustomization() { - prepareConfigurationResource(); - doReturn(MockConstants.MODEL_CUSTOMIZATIONUUID).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); - doReturn(csarHelper).when(toscaResourceStructure).getSdcCsarHelper(); - doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION); - doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE); - doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE); - doReturn(MockConstants.MODEL_CUSTOMIZATIONUUID).when(spResourceCustomization).getModelCustomizationUUID(); - } - - - @Test - public void getConfigurationResourceCustomizationTest() { - prepareConfigurationResourceCustomization(); - - ConfigurationResourceCustomization configurationResourceCustomization = toscaInstaller.getConfigurationResourceCustomization( - nodeTemplate, toscaResourceStructure, spResourceCustomization); - assertNotNull(configurationResourceCustomization); - assertNotNull(configurationResourceCustomization.getConfigurationResource()); - assertEquals(MockConstants.MODEL_CUSTOMIZATIONUUID, configurationResourceCustomization.getServiceProxyResourceCustomizationUUID()); - } - - @Test - public void getVnrNodeTemplateTest() { - prepareConfigurationResourceCustomization(); - List<NodeTemplate> nodeTemplateList = new ArrayList<>(); - doReturn(ToscaResourceInstaller.VLAN_NETWORK_RECEPTOR).when(entityType).getType(); - doReturn(entityType).when(nodeTemplate).getTypeDefinition(); - nodeTemplateList.add(nodeTemplate); - Optional<ConfigurationResourceCustomization> vnrResourceCustomization= - toscaInstaller.getVnrNodeTemplate(nodeTemplateList, toscaResourceStructure, spResourceCustomization); - assertTrue(vnrResourceCustomization.isPresent()); - assertEquals(ToscaResourceInstaller.VLAN_NETWORK_RECEPTOR, entityType.getType()); - } - - class MockConstants{ - public final static String MODEL_NAME = "VLAN Network Receptor Configuration"; - public final static String MODEL_INVARIANT_UUID = "1608eef4-de53-4334-a8d2-ba79cab4bde0"; - public final static String MODEL_UUID = "212ca27b-554c-474c-96b9-ddc2f1b1ddba"; - public final static String MODEL_VERSION = "30.0"; - public final static String MODEL_DESCRIPTION = "VLAN network receptor configuration object"; - public final static String MODEL_CUSTOMIZATIONUUID = "2db953e8-679d-437b-bff7-cb262638a8cd"; - public final static String TEMPLATE_TYPE = "org.openecomp.nodes.VLANNetworkReceptor"; - public final static String TEMPLATE_NAME = "VLAN Network Receptor Configuration 0"; - - } + @Autowired + private ToscaResourceInstaller toscaInstaller; + @Autowired + private WatchdogComponentDistributionStatusRepository watchdogCDStatusRepository; + @Autowired + private AllottedResourceRepository allottedRepo; + @Autowired + private AllottedResourceCustomizationRepository allottedCustomizationRepo; + @Autowired + private ServiceRepository serviceRepo; + @Mock + private SdcCsarHelperImpl sdcCsarHelper; + @Mock + private Metadata metadata; + @Mock + private ArtifactInfoImpl artifactInfo; + @Mock + private List<Group> vfGroups; + @Mock + private IResourceInstance resourceInstance; + @Rule + public ExpectedException expectedException = ExpectedException.none(); + @Mock + private NodeTemplate nodeTemplate; + @Mock + private ToscaResourceStructure toscaResourceStructure; + @Mock + private ServiceProxyResourceCustomization spResourceCustomization; + @Mock + private ISdcCsarHelper csarHelper; + @Mock + private StatefulEntityType entityType; + + private NotificationDataImpl notificationData; + private JsonStatusData statusData; + private static final String MSO = "SO"; + + @Before + public void before() { + MockitoAnnotations.initMocks(this); + + notificationData = new NotificationDataImpl(); + statusData = new JsonStatusData(); + } + + @Test + public void isResourceAlreadyDeployedTest() throws Exception { + notificationData.setServiceName("serviceName"); + notificationData.setServiceVersion("123456"); + notificationData.setServiceUUID("serviceUUID"); + notificationData.setDistributionID("testStatusSuccessTosca"); + + WatchdogComponentDistributionStatus expectedComponentDistributionStatus = + new WatchdogComponentDistributionStatus(notificationData.getDistributionID(), MSO); + expectedComponentDistributionStatus + .setComponentDistributionStatus(DistributionStatusEnum.COMPONENT_DONE_OK.name()); + + doReturn(true).when(vfResourceStructure).isDeployedSuccessfully(); + doReturn(notificationData).when(vfResourceStructure).getNotification(); + doReturn(resourceInstance).when(vfResourceStructure).getResourceInstance(); + doReturn("resourceInstanceName").when(resourceInstance).getResourceInstanceName(); + doReturn("resourceCustomizationUUID").when(resourceInstance).getResourceCustomizationUUID(); + doReturn("resourceName").when(resourceInstance).getResourceName(); + + toscaInstaller.isResourceAlreadyDeployed(vfResourceStructure, false); + + WatchdogComponentDistributionStatus actualWatchdogComponentDistributionStatus = getWatchdogCDStatusWithName( + watchdogCDStatusRepository.findByDistributionId(notificationData.getDistributionID()), MSO); + + verify(vfResourceStructure, times(3)).getResourceInstance(); + verify(vfResourceStructure, times(5)).getNotification(); + assertThat(actualWatchdogComponentDistributionStatus, + sameBeanAs(expectedComponentDistributionStatus).ignoring("createTime").ignoring("modifyTime")); + } + + @Test + public void isResourceAlreadyDeployedFalseTest() throws Exception { + notificationData.setServiceName("serviceName"); + notificationData.setServiceVersion("123456"); + notificationData.setServiceUUID("serviceUUID"); + notificationData.setDistributionID("testStatusSuccess"); + + doThrow(RuntimeException.class).when(vfResourceStructure).isDeployedSuccessfully(); + doReturn(notificationData).when(vfResourceStructure).getNotification(); + doReturn(resourceInstance).when(vfResourceStructure).getResourceInstance(); + doReturn("resourceInstanceName").when(resourceInstance).getResourceInstanceName(); + doReturn("resourceCustomizationUUID").when(resourceInstance).getResourceCustomizationUUID(); + doReturn("resourceName").when(resourceInstance).getResourceName(); + + toscaInstaller.isResourceAlreadyDeployed(vfResourceStructure, false); + + verify(vfResourceStructure, times(3)).getResourceInstance(); + verify(vfResourceStructure, times(4)).getNotification(); + } + + @Test + public void isResourceAlreadyDeployedExceptionTest() throws ArtifactInstallerException { + expectedException.expect(ArtifactInstallerException.class); + + toscaInstaller.isResourceAlreadyDeployed(vfResourceStructure, false); + } + + @Test + public void installTheComponentStatusTest() throws Exception { + String distributionId = "testStatusSuccessTosca"; + String componentName = "testComponentName"; + + statusData = spy(JsonStatusData.class); + doReturn(distributionId).when(statusData).getDistributionID(); + doReturn(componentName).when(statusData).getComponentName(); + + WatchdogComponentDistributionStatus expectedWatchdogComponentDistributionStatus = + new WatchdogComponentDistributionStatus(distributionId, componentName); + expectedWatchdogComponentDistributionStatus.setComponentDistributionStatus(statusData.getStatus().toString()); + + WatchdogComponentDistributionStatus cdStatus = + new WatchdogComponentDistributionStatus(statusData.getDistributionID(), statusData.getComponentName()); + + toscaInstaller.installTheComponentStatus(statusData); + + WatchdogComponentDistributionStatus actualWatchdogComponentDistributionStatus = + getWatchdogCDStatusWithName(watchdogCDStatusRepository.findByDistributionId("testStatusSuccessTosca"), + statusData.getComponentName()); + + assertEquals(statusData.getDistributionID(), cdStatus.getDistributionId()); + assertEquals(statusData.getComponentName(), cdStatus.getComponentName()); + assertThat(actualWatchdogComponentDistributionStatus, + sameBeanAs(expectedWatchdogComponentDistributionStatus).ignoring("createTime").ignoring("modifyTime")); + } + + @Test + public void installTheComponentStatusExceptionTest() throws ArtifactInstallerException { + expectedException.expect(ArtifactInstallerException.class); + + statusData = spy(JsonStatusData.class); + doReturn(null).when(statusData).getStatus(); + + toscaInstaller.installTheComponentStatus(statusData); + } + + @Test + public void installTheResourceExceptionTest() throws Exception { + expectedException.expect(ArtifactInstallerException.class); + + notificationData.setDistributionID("testStatusFailureTosca"); + notificationData.setServiceVersion("123456"); + notificationData.setServiceUUID("serviceUUID"); + notificationData.setWorkloadContext("workloadContext"); + + doReturn(notificationData).when(vfResourceStructure).getNotification(); + doReturn(resourceInstance).when(vfResourceStructure).getResourceInstance(); + + toscaInstaller.installTheResource(toscaResourceStruct, vfResourceStructure); + } + + @Test + public void installTheResourceDBExceptionTest() throws Exception { + notificationData.setDistributionID("testStatusSuccessTosca"); + notificationData.setServiceVersion("123456"); + notificationData.setServiceUUID("serviceUUID"); + notificationData.setWorkloadContext("workloadContext"); + + doReturn(notificationData).when(vfResourceStructure).getNotification(); + doReturn(resourceInstance).when(vfResourceStructure).getResourceInstance(); + doThrow(LockAcquisitionException.class).when(toscaResourceStruct).getToscaArtifact(); + + toscaInstaller.installTheResource(toscaResourceStruct, vfResourceStructure); + } + + @Test + public void verifyTheFilePrefixInStringTest() { + String body = "abcabcabcfile:///testfile.txtabcbabacbcabc"; + String filenameToVerify = "testfile.txt"; + String expectedFileBody = "abcabcabctestfile.txtabcbabacbcabc"; + + String newFileBody = toscaInstaller.verifyTheFilePrefixInString(body, filenameToVerify); + + assertEquals(expectedFileBody, newFileBody); + } + + @Test + public void verifyTheFilePrefixInStringNullBodyTest() { + String body = null; + String filenameToVerify = "testfile.txt"; + + String newFileBody = toscaInstaller.verifyTheFilePrefixInString(body, filenameToVerify); + + assertEquals(body, newFileBody); + } + + @Test + public void verifyTheFilePrefixInStringEmptyBodyTest() { + String body = ""; + String filenameToVerify = "testfile.txt"; + + String newFileBody = toscaInstaller.verifyTheFilePrefixInString(body, filenameToVerify); + + assertEquals(body, newFileBody); + } + + @Test + public void verifyTheFilePrefixInStringNullFilenameTest() { + String body = "abcabcabcfile:///testfile.txtabcbabacbcabc"; + String filenameToVerify = null; + + String newFileBody = toscaInstaller.verifyTheFilePrefixInString(body, filenameToVerify); + + assertEquals(body, newFileBody); + } + + @Test + public void verifyTheFilePrefixInStringEmptyFilenameTest() { + String body = "abcabcabcfile:///testfile.txtabcbabacbcabc"; + String filenameToVerify = ""; + + String newFileBody = toscaInstaller.verifyTheFilePrefixInString(body, filenameToVerify); + + assertEquals(body, newFileBody); + } + + private WatchdogComponentDistributionStatus getWatchdogCDStatusWithName( + List<WatchdogComponentDistributionStatus> watchdogComponentDistributionStatuses, String componentName) { + WatchdogComponentDistributionStatus actualWatchdogComponentDistributionStatus = + new WatchdogComponentDistributionStatus(); + for (WatchdogComponentDistributionStatus watchdogComponentDistributionStatus : watchdogComponentDistributionStatuses) { + if (componentName.equals(watchdogComponentDistributionStatus.getComponentName())) { + actualWatchdogComponentDistributionStatus = watchdogComponentDistributionStatus; + break; + } + } + return actualWatchdogComponentDistributionStatus; + } + + + + private void prepareConfigurationResource() { + doReturn(metadata).when(nodeTemplate).getMetaData(); + doReturn(MockConstants.TEMPLATE_TYPE).when(nodeTemplate).getType(); + + doReturn(MockConstants.MODEL_NAME).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME); + doReturn(MockConstants.MODEL_INVARIANT_UUID).when(metadata) + .getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID); + doReturn(MockConstants.MODEL_UUID).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_UUID); + doReturn(MockConstants.MODEL_VERSION).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_VERSION); + doReturn(MockConstants.MODEL_DESCRIPTION).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION); + doReturn(MockConstants.MODEL_NAME).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME); + doReturn(MockConstants.MODEL_NAME).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME); + } + + @Test + public void getConfigurationResourceTest() { + prepareConfigurationResource(); + + ConfigurationResource configResource = toscaInstaller.getConfigurationResource(nodeTemplate); + + assertNotNull(configResource); + assertEquals(MockConstants.MODEL_NAME, configResource.getModelName()); + assertEquals(MockConstants.MODEL_INVARIANT_UUID, configResource.getModelInvariantUUID()); + assertEquals(MockConstants.MODEL_UUID, configResource.getModelUUID()); + assertEquals(MockConstants.MODEL_VERSION, configResource.getModelVersion()); + assertEquals(MockConstants.MODEL_DESCRIPTION, configResource.getDescription()); + assertEquals(MockConstants.TEMPLATE_TYPE, nodeTemplate.getType()); + } + + private void prepareConfigurationResourceCustomization() { + prepareConfigurationResource(); + doReturn(MockConstants.MODEL_CUSTOMIZATIONUUID).when(metadata) + .getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); + doReturn(csarHelper).when(toscaResourceStructure).getSdcCsarHelper(); + doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, + SdcPropertyNames.PROPERTY_NAME_NFFUNCTION); + doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, + SdcPropertyNames.PROPERTY_NAME_NFROLE); + doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, + SdcPropertyNames.PROPERTY_NAME_NFTYPE); + doReturn(MockConstants.MODEL_CUSTOMIZATIONUUID).when(spResourceCustomization).getModelCustomizationUUID(); + } + + + @Test + public void getConfigurationResourceCustomizationTest() { + prepareConfigurationResourceCustomization(); + + ConfigurationResourceCustomization configurationResourceCustomization = toscaInstaller + .getConfigurationResourceCustomization(nodeTemplate, toscaResourceStructure, spResourceCustomization); + assertNotNull(configurationResourceCustomization); + assertNotNull(configurationResourceCustomization.getConfigurationResource()); + assertEquals(MockConstants.MODEL_CUSTOMIZATIONUUID, + configurationResourceCustomization.getServiceProxyResourceCustomizationUUID()); + } + + @Test + public void getVnrNodeTemplateTest() { + prepareConfigurationResourceCustomization(); + List<NodeTemplate> nodeTemplateList = new ArrayList<>(); + doReturn(ToscaResourceInstaller.VLAN_NETWORK_RECEPTOR).when(entityType).getType(); + doReturn(entityType).when(nodeTemplate).getTypeDefinition(); + nodeTemplateList.add(nodeTemplate); + Optional<ConfigurationResourceCustomization> vnrResourceCustomization = + toscaInstaller.getVnrNodeTemplate(nodeTemplateList, toscaResourceStructure, spResourceCustomization); + assertTrue(vnrResourceCustomization.isPresent()); + assertEquals(ToscaResourceInstaller.VLAN_NETWORK_RECEPTOR, entityType.getType()); + } + + class MockConstants { + public final static String MODEL_NAME = "VLAN Network Receptor Configuration"; + public final static String MODEL_INVARIANT_UUID = "1608eef4-de53-4334-a8d2-ba79cab4bde0"; + public final static String MODEL_UUID = "212ca27b-554c-474c-96b9-ddc2f1b1ddba"; + public final static String MODEL_VERSION = "30.0"; + public final static String MODEL_DESCRIPTION = "VLAN network receptor configuration object"; + public final static String MODEL_CUSTOMIZATIONUUID = "2db953e8-679d-437b-bff7-cb262638a8cd"; + public final static String TEMPLATE_TYPE = "org.openecomp.nodes.VLANNetworkReceptor"; + public final static String TEMPLATE_NAME = "VLAN Network Receptor Configuration 0"; + + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImplTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImplTest.java index a20f6de579..9aad96cbc4 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImplTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImplTest.java @@ -21,38 +21,37 @@ package org.onap.so.asdc.tenantIsolation; import static org.junit.Assert.assertEquals; - import org.junit.BeforeClass; import org.junit.Test; import org.onap.so.asdc.BaseTest; import org.onap.so.client.aai.AAIVersion; public class AaiClientPropertiesImplTest extends BaseTest { - - private static final String SYSTEM_NAME = "MSO"; - private static final String LOCAL_HOST = "http://localhost:"; - - @BeforeClass - public static void setup() throws Exception { - System.setProperty("mso.config.path", "src/test/resources"); - } - - @Test - public void getEndpointTest() throws Exception { - AaiClientPropertiesImpl aaiClientPropertiesImpl = new AaiClientPropertiesImpl(); - String aaiEndpoint = aaiClientPropertiesImpl.getEndpoint().toString(); - assertEquals(LOCAL_HOST + wireMockPort, aaiEndpoint); - } - - @Test - public void getSystemNameTest() { - AaiClientPropertiesImpl aaiClientPropertiesImpl = new AaiClientPropertiesImpl(); - assertEquals(SYSTEM_NAME, aaiClientPropertiesImpl.getSystemName()); - } - - @Test - public void getDefaultVersionTest() { - AaiClientPropertiesImpl aaiClientPropertiesImpl = new AaiClientPropertiesImpl(); - assertEquals(AAIVersion.LATEST, aaiClientPropertiesImpl.getDefaultVersion()); - } + + private static final String SYSTEM_NAME = "MSO"; + private static final String LOCAL_HOST = "http://localhost:"; + + @BeforeClass + public static void setup() throws Exception { + System.setProperty("mso.config.path", "src/test/resources"); + } + + @Test + public void getEndpointTest() throws Exception { + AaiClientPropertiesImpl aaiClientPropertiesImpl = new AaiClientPropertiesImpl(); + String aaiEndpoint = aaiClientPropertiesImpl.getEndpoint().toString(); + assertEquals(LOCAL_HOST + wireMockPort, aaiEndpoint); + } + + @Test + public void getSystemNameTest() { + AaiClientPropertiesImpl aaiClientPropertiesImpl = new AaiClientPropertiesImpl(); + assertEquals(SYSTEM_NAME, aaiClientPropertiesImpl.getSystemName()); + } + + @Test + public void getDefaultVersionTest() { + AaiClientPropertiesImpl aaiClientPropertiesImpl = new AaiClientPropertiesImpl(); + assertEquals(AAIVersion.LATEST, aaiClientPropertiesImpl.getDefaultVersion()); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java index cfce0f6a17..9ef41c7cbf 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java @@ -27,9 +27,7 @@ import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; - import java.util.HashMap; - import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -43,99 +41,100 @@ import org.onap.so.db.catalog.beans.Service; import org.springframework.beans.factory.annotation.Autowired; public class WatchdogDistributionTest extends BaseTest { - @Autowired - private WatchdogDistribution watchdogDistribution; - - @Mock - private AAIResourcesClient aaiResourceClient; - - private static final String SUCCESS_TEST = "watchdogTestStatusSuccess"; - private static final String FAILURE_TEST = "watchdogTestStatusFailure"; - private static final String TIMEOUT_TEST = "watchdogTestStatusTimeout"; - private static final String INCOMPLETE_TEST = "watchdogTestStatusIncomplete"; - private static final String EXCEPTION_TEST = "watchdogTestStatusException"; - private static final String NULL_TEST = "watchdogTestStatusNull"; - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - @Before - public void before() { - MockitoAnnotations.initMocks(this); - } - - @Test - public void getOverallDistributionStatusTimeoutTest() throws Exception { - String status = watchdogDistribution.getOverallDistributionStatus(TIMEOUT_TEST); - assertEquals(DistributionStatus.TIMEOUT.toString(), status); - } - - @Test - public void getOverallDistributionStatusSuccessTest() throws Exception { - String status = watchdogDistribution.getOverallDistributionStatus(SUCCESS_TEST); - assertEquals(DistributionStatus.SUCCESS.toString(), status); - } - - @Test - public void getOverallDistributionStatusFailureTest() throws Exception { - String status = watchdogDistribution.getOverallDistributionStatus(FAILURE_TEST); - assertEquals(DistributionStatus.FAILURE.toString(), status); - } - - @Test - public void getOverallDistributionStatusIncompleteTest() throws Exception { - String status = watchdogDistribution.getOverallDistributionStatus(INCOMPLETE_TEST); - assertEquals(DistributionStatus.INCOMPLETE.toString(), status); - } - - @Test - public void getOverallDistributionStatusInvalidComponentExceptionTest() throws Exception { - expectedException.expect(Exception.class); - watchdogDistribution.getOverallDistributionStatus(EXCEPTION_TEST); - } - - @Test - public void getOverallDistributionStatusNewStatusTest() throws Exception { - String status = watchdogDistribution.getOverallDistributionStatus("newDistrubutionStatus"); - assertEquals(DistributionStatus.INCOMPLETE.toString(), status); - } - - @Test - public void getOverallDistributionStatusExceptionTest() throws Exception { - expectedException.expect(Exception.class); - watchdogDistribution.getOverallDistributionStatus(null); - } - - @Test - public void executePatchAAITest() throws Exception { - Service service = new Service(); - service.setModelInvariantUUID("9647dfc4-2083-11e7-93ae-92361f002671"); - - doReturn(aaiResourceClient).when(watchdogDistributionSpy).getAaiClient(); - doNothing().when(aaiResourceClient).update(isA(AAIResourceUri.class), isA(HashMap.class)); - - watchdogDistribution.executePatchAAI(SUCCESS_TEST, service.getModelInvariantUUID(), DistributionStatus.SUCCESS.toString()); - - verify(aaiResourceClient, times(1)).update(any(AAIResourceUri.class), any(HashMap.class)); - } - - @Test - public void executePatchAAINullDistrubutionIdTest() throws Exception { - expectedException.expect(Exception.class); - watchdogDistribution.executePatchAAI(null, "", DistributionStatus.SUCCESS.toString()); - } - - @Test - public void executePatchAAINullServiceTest() throws Exception { - expectedException.expect(Exception.class); - watchdogDistribution.executePatchAAI(NULL_TEST, null, DistributionStatus.SUCCESS.toString()); - } - - @Test - public void getSetAaiClientTest() { - aaiResourceClient = watchdogDistribution.getAaiClient(); - watchdogDistribution.setAaiClient(aaiResourceClient); - AAIResourcesClient aaiResourceClient2 = watchdogDistribution.getAaiClient(); - assertEquals(aaiResourceClient, aaiResourceClient2); - } + @Autowired + private WatchdogDistribution watchdogDistribution; + + @Mock + private AAIResourcesClient aaiResourceClient; + + private static final String SUCCESS_TEST = "watchdogTestStatusSuccess"; + private static final String FAILURE_TEST = "watchdogTestStatusFailure"; + private static final String TIMEOUT_TEST = "watchdogTestStatusTimeout"; + private static final String INCOMPLETE_TEST = "watchdogTestStatusIncomplete"; + private static final String EXCEPTION_TEST = "watchdogTestStatusException"; + private static final String NULL_TEST = "watchdogTestStatusNull"; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Before + public void before() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void getOverallDistributionStatusTimeoutTest() throws Exception { + String status = watchdogDistribution.getOverallDistributionStatus(TIMEOUT_TEST); + assertEquals(DistributionStatus.TIMEOUT.toString(), status); + } + + @Test + public void getOverallDistributionStatusSuccessTest() throws Exception { + String status = watchdogDistribution.getOverallDistributionStatus(SUCCESS_TEST); + assertEquals(DistributionStatus.SUCCESS.toString(), status); + } + + @Test + public void getOverallDistributionStatusFailureTest() throws Exception { + String status = watchdogDistribution.getOverallDistributionStatus(FAILURE_TEST); + assertEquals(DistributionStatus.FAILURE.toString(), status); + } + + @Test + public void getOverallDistributionStatusIncompleteTest() throws Exception { + String status = watchdogDistribution.getOverallDistributionStatus(INCOMPLETE_TEST); + assertEquals(DistributionStatus.INCOMPLETE.toString(), status); + } + + @Test + public void getOverallDistributionStatusInvalidComponentExceptionTest() throws Exception { + expectedException.expect(Exception.class); + watchdogDistribution.getOverallDistributionStatus(EXCEPTION_TEST); + } + + @Test + public void getOverallDistributionStatusNewStatusTest() throws Exception { + String status = watchdogDistribution.getOverallDistributionStatus("newDistrubutionStatus"); + assertEquals(DistributionStatus.INCOMPLETE.toString(), status); + } + + @Test + public void getOverallDistributionStatusExceptionTest() throws Exception { + expectedException.expect(Exception.class); + watchdogDistribution.getOverallDistributionStatus(null); + } + + @Test + public void executePatchAAITest() throws Exception { + Service service = new Service(); + service.setModelInvariantUUID("9647dfc4-2083-11e7-93ae-92361f002671"); + + doReturn(aaiResourceClient).when(watchdogDistributionSpy).getAaiClient(); + doNothing().when(aaiResourceClient).update(isA(AAIResourceUri.class), isA(HashMap.class)); + + watchdogDistribution.executePatchAAI(SUCCESS_TEST, service.getModelInvariantUUID(), + DistributionStatus.SUCCESS.toString()); + + verify(aaiResourceClient, times(1)).update(any(AAIResourceUri.class), any(HashMap.class)); + } + + @Test + public void executePatchAAINullDistrubutionIdTest() throws Exception { + expectedException.expect(Exception.class); + watchdogDistribution.executePatchAAI(null, "", DistributionStatus.SUCCESS.toString()); + } + + @Test + public void executePatchAAINullServiceTest() throws Exception { + expectedException.expect(Exception.class); + watchdogDistribution.executePatchAAI(NULL_TEST, null, DistributionStatus.SUCCESS.toString()); + } + + @Test + public void getSetAaiClientTest() { + aaiResourceClient = watchdogDistribution.getAaiClient(); + watchdogDistribution.setAaiClient(aaiResourceClient); + AAIResourcesClient aaiResourceClient2 = watchdogDistribution.getAaiClient(); + assertEquals(aaiResourceClient, aaiResourceClient2); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/util/ASDCNotificationLoggingTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/util/ASDCNotificationLoggingTest.java index 3abc2e7a62..6fd853915e 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/util/ASDCNotificationLoggingTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/util/ASDCNotificationLoggingTest.java @@ -21,10 +21,8 @@ package org.onap.so.asdc.util; import static org.junit.Assert.assertTrue; - import java.util.ArrayList; import java.util.List; - import org.junit.Test; import org.onap.sdc.api.notification.IArtifactInfo; import org.onap.sdc.api.notification.INotificationData; @@ -34,153 +32,153 @@ import org.onap.so.asdc.installer.VfModuleMetaData; import org.onap.so.asdc.util.ASDCNotificationLogging; public class ASDCNotificationLoggingTest { - @Test - public void dumpASDCNotificationTestForNull() throws Exception { - INotificationData asdcNotification = iNotificationDataObject(); - - String result = ASDCNotificationLogging.dumpASDCNotification(asdcNotification); - - assertTrue(!result.equalsIgnoreCase("NULL")); - } - - private INotificationData iNotificationDataObject() { - INotificationData iNotification = new INotificationData() { - - @Override - public String getServiceVersion() { - return "DistributionID"; - } - - @Override - public String getServiceUUID() { - return "12343254"; - } - - @Override - public String getServiceName() { - return "servername"; - } - - @Override - public String getServiceInvariantUUID() { - return "ServiceInvariantUUID"; - } - - @Override - public String getServiceDescription() { - return "Description"; - } - - @Override - public List<IArtifactInfo> getServiceArtifacts() { - return new ArrayList(); - } - - @Override - public List<IResourceInstance> getResources() { - return new ArrayList(); - } - - @Override - public String getDistributionID() { - return "23434"; - } - - @Override - public IArtifactInfo getArtifactMetadataByUUID(String arg0) { - return null; - } - - @Override - public String getWorkloadContext() { - // TODO Auto-generated method stub - return null; - } - - @Override - public void setWorkloadContext(String arg0) { - // TODO Auto-generated method stub - - } - }; - return iNotification; - } - - @Test - public void dumpASDCNotificationTest() throws Exception { - INotificationData asdcNotification = iNotificationDataObject(); - String result = ASDCNotificationLogging.dumpASDCNotification(asdcNotification); - - assertTrue(!result.equalsIgnoreCase("NULL")); - } - - @Test - public void dumpVfModuleMetaDataListTest() { - INotificationData asdcNotification = iNotificationDataObject(); - List<IVfModuleData> list = new ArrayList<>(); - list.add(new VfModuleMetaData()); - String result = null; - try { - result = ASDCNotificationLogging.dumpVfModuleMetaDataList(list); - } catch (Exception e) { - } - - assertTrue(result == null); - - } - - public IArtifactInfo getIArtifactInfo() { - return new IArtifactInfo() { - - @Override - public List<IArtifactInfo> getRelatedArtifacts() { - return null; - } - - @Override - public IArtifactInfo getGeneratedArtifact() { - return null; - } - - @Override - public String getArtifactVersion() { - return "version"; - } - - @Override - public String getArtifactUUID() { - return "123"; - } - - @Override - public String getArtifactURL() { - return "url"; - } - - @Override - public String getArtifactType() { - return "type"; - } - - @Override - public Integer getArtifactTimeout() { - return 12; - } - - @Override - public String getArtifactName() { - return "name"; - } - - @Override - public String getArtifactDescription() { - return "desc"; - } - - @Override - public String getArtifactChecksum() { - return "true"; - } - }; - } + @Test + public void dumpASDCNotificationTestForNull() throws Exception { + INotificationData asdcNotification = iNotificationDataObject(); + + String result = ASDCNotificationLogging.dumpASDCNotification(asdcNotification); + + assertTrue(!result.equalsIgnoreCase("NULL")); + } + + private INotificationData iNotificationDataObject() { + INotificationData iNotification = new INotificationData() { + + @Override + public String getServiceVersion() { + return "DistributionID"; + } + + @Override + public String getServiceUUID() { + return "12343254"; + } + + @Override + public String getServiceName() { + return "servername"; + } + + @Override + public String getServiceInvariantUUID() { + return "ServiceInvariantUUID"; + } + + @Override + public String getServiceDescription() { + return "Description"; + } + + @Override + public List<IArtifactInfo> getServiceArtifacts() { + return new ArrayList(); + } + + @Override + public List<IResourceInstance> getResources() { + return new ArrayList(); + } + + @Override + public String getDistributionID() { + return "23434"; + } + + @Override + public IArtifactInfo getArtifactMetadataByUUID(String arg0) { + return null; + } + + @Override + public String getWorkloadContext() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void setWorkloadContext(String arg0) { + // TODO Auto-generated method stub + + } + }; + return iNotification; + } + + @Test + public void dumpASDCNotificationTest() throws Exception { + INotificationData asdcNotification = iNotificationDataObject(); + String result = ASDCNotificationLogging.dumpASDCNotification(asdcNotification); + + assertTrue(!result.equalsIgnoreCase("NULL")); + } + + @Test + public void dumpVfModuleMetaDataListTest() { + INotificationData asdcNotification = iNotificationDataObject(); + List<IVfModuleData> list = new ArrayList<>(); + list.add(new VfModuleMetaData()); + String result = null; + try { + result = ASDCNotificationLogging.dumpVfModuleMetaDataList(list); + } catch (Exception e) { + } + + assertTrue(result == null); + + } + + public IArtifactInfo getIArtifactInfo() { + return new IArtifactInfo() { + + @Override + public List<IArtifactInfo> getRelatedArtifacts() { + return null; + } + + @Override + public IArtifactInfo getGeneratedArtifact() { + return null; + } + + @Override + public String getArtifactVersion() { + return "version"; + } + + @Override + public String getArtifactUUID() { + return "123"; + } + + @Override + public String getArtifactURL() { + return "url"; + } + + @Override + public String getArtifactType() { + return "type"; + } + + @Override + public Integer getArtifactTimeout() { + return 12; + } + + @Override + public String getArtifactName() { + return "name"; + } + + @Override + public String getArtifactDescription() { + return "desc"; + } + + @Override + public String getArtifactChecksum() { + return "true"; + } + }; + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/util/NotificationLoggingTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/util/NotificationLoggingTest.java index 8bd11d9f52..0bdb3a8bab 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/util/NotificationLoggingTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/util/NotificationLoggingTest.java @@ -22,46 +22,45 @@ package org.onap.so.asdc.util; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; - import org.junit.Before; import org.junit.Test; import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; public class NotificationLoggingTest { - private NotificationDataImpl notificationData; - - @Before - public void before() { - notificationData = new NotificationDataImpl(); - } - - @Test - public void logNotificationTest() { - notificationData.setDistributionID("distributionID"); - notificationData.setServiceVersion("123456"); - notificationData.setServiceUUID("serviceUUID"); - notificationData.setWorkloadContext("workloadContext"); - - String response = NotificationLogging.logNotification(notificationData); + private NotificationDataImpl notificationData; + + @Before + public void before() { + notificationData = new NotificationDataImpl(); + } + + @Test + public void logNotificationTest() { + notificationData.setDistributionID("distributionID"); + notificationData.setServiceVersion("123456"); + notificationData.setServiceUUID("serviceUUID"); + notificationData.setWorkloadContext("workloadContext"); + + String response = NotificationLogging.logNotification(notificationData); + + assertTrue(response.contains("ASDC Notification")); + assertTrue(response.contains("ResourcesType not recognized")); + assertTrue(response.contains("ServiceNameNULL")); + assertTrue(response.contains("ServiceUUIDserviceUUID")); + assertTrue(response.contains("ResourcesImplNULL")); + assertTrue(response.contains("ServiceArtifactsType not recognized")); + assertTrue(response.contains("ServiceDescriptionNULL")); + assertTrue(response.contains("DistributionIDdistributionID")); + assertTrue(response.contains("ServiceInvariantUUIDNULL")); + assertTrue(response.contains("WorkloadContextworkloadContext")); + } + + @Test + public void logNotificationNullTest() { + notificationData = null; + + String response = NotificationLogging.logNotification(notificationData); - assertTrue(response.contains("ASDC Notification")); - assertTrue(response.contains("ResourcesType not recognized")); - assertTrue(response.contains("ServiceNameNULL")); - assertTrue(response.contains("ServiceUUIDserviceUUID")); - assertTrue(response.contains("ResourcesImplNULL")); - assertTrue(response.contains("ServiceArtifactsType not recognized")); - assertTrue(response.contains("ServiceDescriptionNULL")); - assertTrue(response.contains("DistributionIDdistributionID")); - assertTrue(response.contains("ServiceInvariantUUIDNULL")); - assertTrue(response.contains("WorkloadContextworkloadContext")); - } - - @Test - public void logNotificationNullTest() { - notificationData = null; - - String response = NotificationLogging.logNotification(notificationData); - - assertEquals("NULL", response); - } + assertEquals("NULL", response); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingRunner.java b/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingRunner.java index 2a77664714..b344f6230a 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingRunner.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingRunner.java @@ -22,35 +22,31 @@ package org.onap.so.asdc.utils; import java.nio.file.Files; import java.nio.file.Paths; - import org.antlr.v4.runtime.CharStreams; import org.antlr.v4.runtime.CommonTokenStream; import org.antlr.v4.runtime.tree.ParseTree; - import com.fasterxml.jackson.databind.JsonNode; -public class ASDCLoggingRunner -{ - public static void main( String[] args) throws Exception - { +public class ASDCLoggingRunner { + public static void main(String[] args) throws Exception { String content = new String(Files.readAllBytes(Paths.get("src/test/resources/Heat_Nested_Notification.txt"))); ASDCLoggingLexer lexer = new ASDCLoggingLexer(CharStreams.fromString(content)); - CommonTokenStream tokens = new CommonTokenStream(lexer); + CommonTokenStream tokens = new CommonTokenStream(lexer); + + ASDCLoggingParser parser = new ASDCLoggingParser(tokens); + + ParseTree tree = parser.doc(); + + System.out.println(TreeUtils.printTree(tree, parser)); // print LISP-style tree + + ASDCLoggingVisitorImpl v = new ASDCLoggingVisitorImpl(); - ASDCLoggingParser parser = new ASDCLoggingParser(tokens); - - ParseTree tree = parser.doc(); + JsonNode node = v.visit(tree); - System.out.println(TreeUtils.printTree(tree, parser)); // print LISP-style tree - - ASDCLoggingVisitorImpl v = new ASDCLoggingVisitorImpl(); - - JsonNode node = v.visit(tree); - - System.out.println(node.toString()); + System.out.println(node.toString()); - } + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingVisitorImpl.java b/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingVisitorImpl.java index 51036e2a18..53d163a5bc 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingVisitorImpl.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingVisitorImpl.java @@ -22,7 +22,6 @@ package org.onap.so.asdc.utils; import java.util.ArrayDeque; import java.util.Deque; - import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ContainerNode; @@ -32,73 +31,74 @@ import com.google.common.base.CaseFormat; public class ASDCLoggingVisitorImpl extends ASDCLoggingBaseVisitor<ContainerNode> { - private final ObjectMapper mapper = new ObjectMapper(); - private ObjectNode doc; - private Deque<ContainerNode> nodeStore = new ArrayDeque<>(); - - @Override - public ContainerNode visitDoc(ASDCLoggingParser.DocContext ctx) { - doc = mapper.createObjectNode(); - nodeStore.addFirst(doc); - this.visitChildren(ctx); - return doc; - } - - @Override - public ContainerNode visitValue(ASDCLoggingParser.ValueContext ctx) { - - return this.visitChildren(ctx); - - } - @Override - public ContainerNode visitSimplePair(ASDCLoggingParser.SimplePairContext ctx) { - ObjectNode node = mapper.createObjectNode(); - ((ObjectNode)nodeStore.peekFirst()).put(this.toLowerCamel(ctx.key().getText()), ctx.keyValue().getText()); - - return node; - } - - @Override - public ContainerNode visitComplexPair(ASDCLoggingParser.ComplexPairContext ctx) { - ContainerNode container = nodeStore.peekFirst(); - if (container.isArray()) { - ArrayNode array = (ArrayNode) container; - ObjectNode node = mapper.createObjectNode(); - array.add(node); - nodeStore.addFirst(node); - } else { - nodeStore.addFirst(((ObjectNode)nodeStore.peekFirst()).putObject(this.toLowerCamel(ctx.key().getText()))); - } - this.visitChildren(ctx); - return nodeStore.removeFirst(); - - - } - - @Override - public ContainerNode visitList(ASDCLoggingParser.ListContext ctx) { - nodeStore.addFirst(((ObjectNode)nodeStore.peekFirst()).putArray(this.keyMapper(ctx.listName().getText()))); - this.visitChildren(ctx); - return nodeStore.removeFirst(); - } - - private String keyMapper(String key) { - if ("Service Artifacts List".equals(key)) { - return "serviceArtifacts"; - } else if ("Resource Instances List".equals(key)) { - return "resources"; - } else if ("Resource Artifacts List".equals(key)) { - return "artifacts"; - } else { - return key; - } - } - - private String toLowerCamel(String key) { - String result = key.replaceAll("\\s", ""); - if ("ServiceArtifactsInfo".equals(result)) { - return "artifactInfo"; - } - return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, result); - } + private final ObjectMapper mapper = new ObjectMapper(); + private ObjectNode doc; + private Deque<ContainerNode> nodeStore = new ArrayDeque<>(); + + @Override + public ContainerNode visitDoc(ASDCLoggingParser.DocContext ctx) { + doc = mapper.createObjectNode(); + nodeStore.addFirst(doc); + this.visitChildren(ctx); + return doc; + } + + @Override + public ContainerNode visitValue(ASDCLoggingParser.ValueContext ctx) { + + return this.visitChildren(ctx); + + } + + @Override + public ContainerNode visitSimplePair(ASDCLoggingParser.SimplePairContext ctx) { + ObjectNode node = mapper.createObjectNode(); + ((ObjectNode) nodeStore.peekFirst()).put(this.toLowerCamel(ctx.key().getText()), ctx.keyValue().getText()); + + return node; + } + + @Override + public ContainerNode visitComplexPair(ASDCLoggingParser.ComplexPairContext ctx) { + ContainerNode container = nodeStore.peekFirst(); + if (container.isArray()) { + ArrayNode array = (ArrayNode) container; + ObjectNode node = mapper.createObjectNode(); + array.add(node); + nodeStore.addFirst(node); + } else { + nodeStore.addFirst(((ObjectNode) nodeStore.peekFirst()).putObject(this.toLowerCamel(ctx.key().getText()))); + } + this.visitChildren(ctx); + return nodeStore.removeFirst(); + + + } + + @Override + public ContainerNode visitList(ASDCLoggingParser.ListContext ctx) { + nodeStore.addFirst(((ObjectNode) nodeStore.peekFirst()).putArray(this.keyMapper(ctx.listName().getText()))); + this.visitChildren(ctx); + return nodeStore.removeFirst(); + } + + private String keyMapper(String key) { + if ("Service Artifacts List".equals(key)) { + return "serviceArtifacts"; + } else if ("Resource Instances List".equals(key)) { + return "resources"; + } else if ("Resource Artifacts List".equals(key)) { + return "artifacts"; + } else { + return key; + } + } + + private String toLowerCamel(String key) { + String result = key.replaceAll("\\s", ""); + if ("ServiceArtifactsInfo".equals(result)) { + return "artifactInfo"; + } + return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, result); + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/utils/TreePrinterListener.java b/asdc-controller/src/test/java/org/onap/so/asdc/utils/TreePrinterListener.java index c4a84c0540..39119c7dca 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/utils/TreePrinterListener.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/utils/TreePrinterListener.java @@ -25,7 +25,6 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; - import org.antlr.v4.runtime.Parser; import org.antlr.v4.runtime.ParserRuleContext; import org.antlr.v4.runtime.RuleContext; @@ -38,7 +37,7 @@ import org.antlr.v4.runtime.tree.Trees; public class TreePrinterListener implements ParseTreeListener { private final List<String> ruleNames; private final StringBuilder builder = new StringBuilder(); - Map<RuleContext,ArrayList<String>> stack = new HashMap<RuleContext,ArrayList<String>>(); + Map<RuleContext, ArrayList<String>> stack = new HashMap<RuleContext, ArrayList<String>>(); public TreePrinterListener(Parser parser) { this.ruleNames = Arrays.asList(parser.getRuleNames()); @@ -50,10 +49,10 @@ public class TreePrinterListener implements ParseTreeListener { @Override public void visitTerminal(TerminalNode node) { - String text = Utils.escapeWhitespace(Trees.getNodeText(node, ruleNames), false); - if(text.startsWith(" ") || text.endsWith(" ")){ - text = "'" + text + "'"; - } + String text = Utils.escapeWhitespace(Trees.getNodeText(node, ruleNames), false); + if (text.startsWith(" ") || text.endsWith(" ")) { + text = "'" + text + "'"; + } stack.get(node.getParent()).add(text); } @@ -64,20 +63,19 @@ public class TreePrinterListener implements ParseTreeListener { @Override public void enterEveryRule(ParserRuleContext ctx) { - if(!stack.containsKey(ctx.parent)){ - stack.put(ctx.parent, new ArrayList<String>()); - } - if(!stack.containsKey(ctx)){ - stack.put(ctx, new ArrayList<String>()); - } + if (!stack.containsKey(ctx.parent)) { + stack.put(ctx.parent, new ArrayList<String>()); + } + if (!stack.containsKey(ctx)) { + stack.put(ctx, new ArrayList<String>()); + } - final StringBuilder sb = new StringBuilder(); - int ruleIndex = ctx.getRuleIndex(); + final StringBuilder sb = new StringBuilder(); + int ruleIndex = ctx.getRuleIndex(); String ruleName; if (ruleIndex >= 0 && ruleIndex < ruleNames.size()) { ruleName = ruleNames.get(ruleIndex); - } - else { + } else { ruleName = Integer.toString(ruleIndex); } sb.append(ruleName); @@ -86,52 +84,52 @@ public class TreePrinterListener implements ParseTreeListener { @Override public void exitEveryRule(ParserRuleContext ctx) { - ArrayList<String> ruleStack = stack.remove(ctx); - StringBuilder sb = new StringBuilder(); - boolean brackit =ruleStack.size()>1; - if(brackit){ - sb.append("("); - } - sb.append(ruleStack.get(0)); - for(int i=1; i<ruleStack.size(); i++){ - sb.append(" "); - sb.append(ruleStack.get(i)); - } - if(brackit){ - sb.append(")"); - } - if(sb.length() < 80){ - stack.get(ctx.parent).add(sb.toString()); - }else{ - // Current line is too long, regenerate it using 1 line per item. - sb.setLength(0); - if(brackit){ - sb.append("("); - } - if(!ruleStack.isEmpty()){ - sb.append(ruleStack.remove(0)).append("\r\n"); - } - while(!ruleStack.isEmpty()){ - sb.append(indent(ruleStack.remove(0))).append("\r\n"); - } - if(brackit){ - sb.append(")"); - } - stack.get(ctx.parent).add(sb.toString()); - } - if(ctx.parent == null){ - builder.append(sb.toString()); - } + ArrayList<String> ruleStack = stack.remove(ctx); + StringBuilder sb = new StringBuilder(); + boolean brackit = ruleStack.size() > 1; + if (brackit) { + sb.append("("); + } + sb.append(ruleStack.get(0)); + for (int i = 1; i < ruleStack.size(); i++) { + sb.append(" "); + sb.append(ruleStack.get(i)); + } + if (brackit) { + sb.append(")"); + } + if (sb.length() < 80) { + stack.get(ctx.parent).add(sb.toString()); + } else { + // Current line is too long, regenerate it using 1 line per item. + sb.setLength(0); + if (brackit) { + sb.append("("); + } + if (!ruleStack.isEmpty()) { + sb.append(ruleStack.remove(0)).append("\r\n"); + } + while (!ruleStack.isEmpty()) { + sb.append(indent(ruleStack.remove(0))).append("\r\n"); + } + if (brackit) { + sb.append(")"); + } + stack.get(ctx.parent).add(sb.toString()); + } + if (ctx.parent == null) { + builder.append(sb.toString()); + } } - - static String indent(String input){ - return " " + input.replaceAll("\r\n(.)","\r\n $1"); + + static String indent(String input) { + return " " + input.replaceAll("\r\n(.)", "\r\n $1"); } @Override public String toString() { return builder.toString(); } - - + + } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/utils/TreeUtils.java b/asdc-controller/src/test/java/org/onap/so/asdc/utils/TreeUtils.java index 8de9f362b7..5a03b91959 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/utils/TreeUtils.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/utils/TreeUtils.java @@ -21,7 +21,6 @@ package org.onap.so.asdc.utils; import java.util.Arrays; - import org.antlr.v4.runtime.Parser; import org.antlr.v4.runtime.tree.ParseTree; import org.antlr.v4.runtime.tree.ParseTreeWalker; @@ -29,19 +28,20 @@ import org.antlr.v4.runtime.tree.ParseTreeWalker; public class TreeUtils { - /** - * Print the tree, splitting at appropriate points, instead of rendering a single long line. - * @param parseTree - * @param parser - * @return - */ - public static String printTree(final ParseTree parseTree, final Parser parser){ - final TreePrinterListener listener = new TreePrinterListener(Arrays.asList(parser.getRuleNames())); + /** + * Print the tree, splitting at appropriate points, instead of rendering a single long line. + * + * @param parseTree + * @param parser + * @return + */ + public static String printTree(final ParseTree parseTree, final Parser parser) { + final TreePrinterListener listener = new TreePrinterListener(Arrays.asList(parser.getRuleNames())); ParseTreeWalker.DEFAULT.walk(listener, parseTree); return listener.toString(); - } - - public static String normalizeWhiteSpace(String input){ - return input.replaceAll("\\s+", " ").replaceAll("([^\\w])\\s+", "$1"); + } + + public static String normalizeWhiteSpace(String input) { + return input.replaceAll("\\s+", " ").replaceAll("([^\\w])\\s+", "$1"); } } diff --git a/asdc-controller/src/test/resources/ASDC/.gitignore b/asdc-controller/src/test/resources/ASDC/.gitignore index e54786bc77..836e68d117 100644 --- a/asdc-controller/src/test/resources/ASDC/.gitignore +++ b/asdc-controller/src/test/resources/ASDC/.gitignore @@ -1 +1 @@ -/*.csar +*.*/*.csar diff --git a/asdc-controller/src/test/resources/application-test.yaml b/asdc-controller/src/test/resources/application-test.yaml index caaa5dd3b4..ec536491a1 100644 --- a/asdc-controller/src/test/resources/application-test.yaml +++ b/asdc-controller/src/test/resources/application-test.yaml @@ -14,7 +14,7 @@ spring: initialization-mode: always jpa: generate-ddl: false - show-sql: false + show-sql: true hibernate: ddl-auto: none naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy @@ -89,6 +89,8 @@ mso: messageBusAddress: localhost,localhost asdc: config: + activity: + endpoint: http://localhost:${wiremock.server.port} key: 566B754875657232314F5548556D3665 components: count: 3, @@ -97,3 +99,5 @@ mso: enabled: false aai: endpoint: http://localhost:${wiremock.server.port} + config: + defaultpath: src/test/resources diff --git a/asdc-controller/src/test/resources/download/service-Svc140-VF-csar.csar b/asdc-controller/src/test/resources/download/service-Svc140-VF-csar.csar Binary files differnew file mode 100644 index 0000000000..0de1b0b0a0 --- /dev/null +++ b/asdc-controller/src/test/resources/download/service-Svc140-VF-csar.csar diff --git a/asdc-controller/src/test/resources/download/service-Testservice140-csar.csar b/asdc-controller/src/test/resources/download/service-Testservice140-csar.csar Binary files differnew file mode 100644 index 0000000000..bd9a1dc775 --- /dev/null +++ b/asdc-controller/src/test/resources/download/service-Testservice140-csar.csar diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql index 5f78c85c98..2db2dfb5bf 100644 --- a/asdc-controller/src/test/resources/schema.sql +++ b/asdc-controller/src/test/resources/schema.sql @@ -2,836 +2,1211 @@ --------START Catalog DB SCHEMA -------- use catalogdb; -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, - `resource_input` varchar(20000) default 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) 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) 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 -) 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, - `resource_input` varchar(20000) default 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, - `resource_order` 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, - `resource_input` varchar(20000) 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 auto_increment, -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) 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_customization` ( - `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, - `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, - `SOURCE_SERVICE_MODEL_UUID` VARCHAR(200) NOT NULL, - `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, +set foreign_key_checks=0; +DROP TABLE IF EXISTS `allotted_resource`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `allotted_resource_customization` +-- + +DROP TABLE IF EXISTS `allotted_resource_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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, + `RESOURCE_INPUT` varchar(20000) 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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `allotted_resource_customization_to_service` +-- + +DROP TABLE IF EXISTS `allotted_resource_customization_to_service`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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`), + KEY `RESOURCE_MODEL_CUSTOMIZATION_UUID` (`RESOURCE_MODEL_CUSTOMIZATION_UUID`), + CONSTRAINT `allotted_resource_customization_to_service_ibfk_1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE, + CONSTRAINT `allotted_resource_customization_to_service_ibfk_2` FOREIGN KEY (`RESOURCE_MODEL_CUSTOMIZATION_UUID`) REFERENCES `allotted_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ar_recipe` +-- + +DROP TABLE IF EXISTS `ar_recipe`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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) DEFAULT NULL, + `DESCRIPTION` varchar(200) DEFAULT NULL, + `ORCHESTRATION_URI` varchar(200) NOT NULL, + `AR_PARAM_XSD` varchar(200) DEFAULT NULL, + `RECIPE_TIMEOUT` int(11) DEFAULT NULL, + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `building_block_detail` +-- + +DROP TABLE IF EXISTS `building_block_detail`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `building_block_detail` ( + `id` int(11) NOT NULL 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 KEY `UK_building_block_name` (`BUILDING_BLOCK_NAME`) +) ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `cloud_sites` +-- + +DROP TABLE IF EXISTS `cloud_sites`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `cloud_sites` ( + `ID` varchar(50) NOT NULL, + `REGION_ID` varchar(11) DEFAULT NULL, + `IDENTITY_SERVICE_ID` varchar(50) DEFAULT NULL, + `CLOUD_VERSION` varchar(20) DEFAULT NULL, + `CLLI` varchar(11) DEFAULT NULL, + `CLOUDIFY_ID` varchar(50) DEFAULT NULL, + `PLATFORM` varchar(50) DEFAULT NULL, + `ORCHESTRATOR` varchar(50) DEFAULT NULL, + `LAST_UPDATED_BY` varchar(120) DEFAULT NULL, + `CREATION_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `UPDATE_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ID`), + KEY `FK_cloud_sites_identity_services` (`IDENTITY_SERVICE_ID`), + CONSTRAINT `FK_cloud_sites_identity_services` FOREIGN KEY (`IDENTITY_SERVICE_ID`) REFERENCES `identity_services` (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `cloudify_managers` +-- + +DROP TABLE IF EXISTS `cloudify_managers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `cloudify_managers` ( + `ID` varchar(50) NOT NULL, + `CLOUDIFY_URL` varchar(200) DEFAULT NULL, + `USERNAME` varchar(255) DEFAULT NULL, + `PASSWORD` varchar(255) DEFAULT NULL, + `VERSION` varchar(20) DEFAULT NULL, + `LAST_UPDATED_BY` varchar(120) DEFAULT NULL, + `CREATION_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `UPDATE_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `collection_network_resource_customization` +-- + +DROP TABLE IF EXISTS `collection_network_resource_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `collection_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, + `INSTANCE_GROUP_MODEL_UUID` varchar(200) DEFAULT NULL, + `CRC_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`,`CRC_MODEL_CUSTOMIZATION_UUID`), + KEY `fk_collection_net_resource_customization__network_resource1_idx` (`NETWORK_RESOURCE_MODEL_UUID`), + KEY `fk_collection_net_resource_customization__instance_group1_idx` (`INSTANCE_GROUP_MODEL_UUID`), + KEY `fk_col_net_res_customization__collection_res_customization_idx` (`CRC_MODEL_CUSTOMIZATION_UUID`), + 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_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_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 CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `collection_resource` +-- + +DROP TABLE IF EXISTS `collection_resource`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `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(1200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`MODEL_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `collection_resource_customization` +-- + +DROP TABLE IF EXISTS `collection_resource_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `collection_resource_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `role` varchar(200) DEFAULT NULL, + `object_type` varchar(200) NOT NULL, + `function` varchar(200) DEFAULT NULL, + `collection_resource_type` varchar(200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `CR_MODEL_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), + KEY `CR_MODEL_UUID` (`CR_MODEL_UUID`), + CONSTRAINT `collection_resource_customization_ibfk_1` FOREIGN KEY (`CR_MODEL_UUID`) REFERENCES `collection_resource` (`MODEL_UUID`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `collection_resource_customization_to_service` +-- + +DROP TABLE IF EXISTS `collection_resource_customization_to_service`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `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`), + KEY `RESOURCE_MODEL_CUSTOMIZATION_UUID` (`RESOURCE_MODEL_CUSTOMIZATION_UUID`), + CONSTRAINT `collection_resource_customization_to_service_ibfk_1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE, + CONSTRAINT `collection_resource_customization_to_service_ibfk_2` FOREIGN KEY (`RESOURCE_MODEL_CUSTOMIZATION_UUID`) REFERENCES `collection_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `collection_resource_instance_group_customization` +-- + +DROP TABLE IF EXISTS `collection_resource_instance_group_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `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) DEFAULT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `SUBINTERFACE_NETWORK_QUANTITY` int(11) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`COLLECTION_RESOURCE_CUSTOMIZATION_MODEL_UUID`,`INSTANCE_GROUP_MODEL_UUID`), + KEY `fk_collection_resource_instance_group_customization__instan_idx` (`INSTANCE_GROUP_MODEL_UUID`), + 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 CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `configuration` +-- + +DROP TABLE IF EXISTS `configuration`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `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) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`MODEL_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `configuration_customization` +-- + +DROP TABLE IF EXISTS `configuration_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `configuration_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `CONFIGURATION_TYPE` varchar(200) DEFAULT NULL, + `CONFIGURATION_ROLE` varchar(200) DEFAULT NULL, + `CONFIGURATION_FUNCTION` varchar(200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `CONFIGURATION_MODEL_UUID` varchar(200) NOT NULL, + `SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` varchar(200) DEFAULT NULL, + `CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` varchar(200) DEFAULT NULL, PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), - INDEX `fk_service_proxy_customization__service1_idx` (`SOURCE_SERVICE_MODEL_UUID` ASC), - UNIQUE INDEX `UK_service_proxy_customization` (`MODEL_CUSTOMIZATION_UUID` ASC), - INDEX `fk_service_proxy_customization__serv_prox_to_serv` (`MODEL_CUSTOMIZATION_UUID` ASC), - 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__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__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`) + KEY `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID`), + KEY `fk_configuration_customization__service_proxy_customization_idx` (`SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`), + KEY `fk_configuration_customization__configuration_customization_idx` (`CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`), + 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, + CONSTRAINT `fk_configuration_resource_customization__configuration_resour1` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `configuration_customization_to_service` +-- + +DROP TABLE IF EXISTS `configuration_customization_to_service`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `controller_selection_reference` +-- -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 `rainy_day_handler_macro` ( -`id` INT(11) NOT NULL AUTO_INCREMENT, -`FLOW_NAME` VARCHAR(200) NOT NULL, -`SERVICE_TYPE` VARCHAR(200) NOT NULL, -`VNF_TYPE` VARCHAR(200) NOT NULL, -`ERROR_CODE` VARCHAR(200) NOT NULL, -`WORK_STEP` VARCHAR(200) NOT NULL, -`POLICY` VARCHAR(200) NOT NULL, -PRIMARY KEY (`id`)) -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, -`ACTION` VARCHAR(200) NOT NULL, -`MACRO_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)) -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 IF NOT EXISTS vnfc_customization ( -`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, -`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, -`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 DEFAULT NULL, -`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`)) -ENGINE = InnoDB -AUTO_INCREMENT = 20654 -DEFAULT CHARACTER SET = latin1; - -CREATE TABLE IF NOT EXISTS cvnfc_customization ( -`ID` INT(11) NOT NULL AUTO_INCREMENT, -`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, -`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, -`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 DEFAULT NULL, -`NFC_FUNCTION` VARCHAR(200) NULL, -`NFC_NAMING_CODE` VARCHAR(200) NULL, -`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, -`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, -`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, PRIMARY KEY (`ID`), INDEX `fk_cvnfc_customization__vf_module_customization1_idx` (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnfc_customization1_idx` (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), UNIQUE INDEX `UK_cvnfc_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC), CONSTRAINT `fk_cvnfc_customization__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_cvnfc_customization__vnfc_customization1` FOREIGN KEY (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON -DELETE CASCADE ON -UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON -DELETE CASCADE ON -UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1; - - -CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization ( - `ID` INT(11) NOT NULL AUTO_INCREMENT, - `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `CVNFC_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, - `POLICY_NAME` VARCHAR(200) NULL, - `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL, - PRIMARY KEY (`ID`), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC), - UNIQUE INDEX `UK_vnf_vfmodule_cvnfc_configuration_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC , `VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC , `CVNFC_MODEL_CUSTOMIZATION_UUID` ASC , `MODEL_CUSTOMIZATION_UUID` ASC), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__cvnfc_cust1_idx` (`CVNFC_MODEL_CUSTOMIZATION_UUID` ASC), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vf_module_cust_idx` (`VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vnf_res_cust_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), - CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) - REFERENCES `configuration` (`MODEL_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_cvnfc_configuration_customization__cvnfc_customization1` FOREIGN KEY (`CVNFC_MODEL_CUSTOMIZATION_UUID`) - REFERENCES `cvnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_vnf_configuration_cvnfc_customization__vf_module_customiza1` FOREIGN KEY (`VF_MODULE_MODEL_CUSTOMIZATION_UUID`) - REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_vfmodule_cvnfc_configuration_customization__vnf_resource_c1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) - REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=INNODB AUTO_INCREMENT=20654 DEFAULT CHARACTER SET=LATIN1; +DROP TABLE IF EXISTS `controller_selection_reference`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `controller_selection_reference` ( + `VNF_TYPE` varchar(50) NOT NULL, + `CONTROLLER_NAME` varchar(100) NOT NULL, + `ACTION_CATEGORY` varchar(15) NOT NULL, + PRIMARY KEY (`VNF_TYPE`,`CONTROLLER_NAME`,`ACTION_CATEGORY`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `cvnfc_configuration_customization` +-- + +DROP TABLE IF EXISTS `cvnfc_configuration_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `cvnfc_configuration_customization` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `CONFIGURATION_TYPE` varchar(200) DEFAULT NULL, + `CONFIGURATION_ROLE` varchar(200) DEFAULT NULL, + `CONFIGURATION_FUNCTION` varchar(200) DEFAULT NULL, + `POLICY_NAME` varchar(200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `CONFIGURATION_MODEL_UUID` varchar(200) NOT NULL, + `CVNFC_CUSTOMIZATION_ID` int(11) DEFAULT NULL, + PRIMARY KEY (`ID`), + KEY `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID`), + CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=20655 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `cvnfc_customization` +-- + +DROP TABLE IF EXISTS `cvnfc_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `cvnfc_customization` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `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) DEFAULT NULL, + `NFC_FUNCTION` varchar(200) DEFAULT NULL, + `NFC_NAMING_CODE` varchar(200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` varchar(200) DEFAULT NULL, + `VF_MODULE_CUSTOMIZATION_ID` int(13) DEFAULT NULL, + PRIMARY KEY (`ID`), + KEY `fk_cvnfc_customization__vnfc_customization1_idx` (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID`), + KEY `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID`), + KEY `fk_cvnfc_customization_to_vf_module_resource_customization` (`VF_MODULE_CUSTOMIZATION_ID`), + CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_cvnfc_customization_to_vf_module_resource_customization` FOREIGN KEY (`VF_MODULE_CUSTOMIZATION_ID`) REFERENCES `vf_module_customization` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=20655 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `external_service_to_internal_model_mapping` +-- + +DROP TABLE IF EXISTS `external_service_to_internal_model_mapping`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `external_service_to_internal_model_mapping` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `SERVICE_NAME` varchar(200) NOT NULL, + `PRODUCT_FLAVOR` varchar(200) DEFAULT NULL, + `SUBSCRIPTION_SERVICE_TYPE` varchar(200) NOT NULL, + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `UK_external_service_to_internal_model_mapping` (`SERVICE_NAME`,`PRODUCT_FLAVOR`,`SERVICE_MODEL_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `flyway_schema_history` +-- + +DROP TABLE IF EXISTS `flyway_schema_history`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `flyway_schema_history` ( + `installed_rank` int(11) NOT NULL, + `version` varchar(50) DEFAULT NULL, + `description` varchar(200) NOT NULL, + `type` varchar(20) NOT NULL, + `script` varchar(1000) NOT NULL, + `checksum` int(11) DEFAULT NULL, + `installed_by` varchar(100) NOT NULL, + `installed_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `execution_time` int(11) NOT NULL, + `success` tinyint(1) NOT NULL, + PRIMARY KEY (`installed_rank`), + KEY `flyway_schema_history_s_idx` (`success`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `heat_environment` +-- + +DROP TABLE IF EXISTS `heat_environment`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `heat_files` +-- + +DROP TABLE IF EXISTS `heat_files`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `heat_nested_template` +-- + +DROP TABLE IF EXISTS `heat_nested_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `heat_template` +-- + +DROP TABLE IF EXISTS `heat_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `heat_template_params` +-- + +DROP TABLE IF EXISTS `heat_template_params`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `identity_services` +-- + +DROP TABLE IF EXISTS `identity_services`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `identity_services` ( + `ID` varchar(50) NOT NULL, + `IDENTITY_URL` varchar(200) DEFAULT NULL, + `MSO_ID` varchar(255) DEFAULT NULL, + `MSO_PASS` varchar(255) DEFAULT NULL, + `ADMIN_TENANT` varchar(50) DEFAULT NULL, + `MEMBER_ROLE` varchar(50) DEFAULT NULL, + `TENANT_METADATA` tinyint(1) DEFAULT '0', + `IDENTITY_SERVER_TYPE` varchar(50) DEFAULT NULL, + `IDENTITY_AUTHENTICATION_TYPE` varchar(50) DEFAULT NULL, + `LAST_UPDATED_BY` varchar(120) DEFAULT NULL, + `CREATION_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `UPDATE_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `PROJECT_DOMAIN_NAME` varchar(255) DEFAULT NULL, + `USER_DOMAIN_NAME` varchar(255) DEFAULT NULL, + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `instance_group` +-- + +DROP TABLE IF EXISTS `instance_group`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `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) DEFAULT 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) DEFAULT NULL, + `INSTANCE_GROUP_TYPE` varchar(200) NOT NULL, + PRIMARY KEY (`MODEL_UUID`), + KEY `CR_MODEL_UUID` (`CR_MODEL_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `model` +-- + +DROP TABLE IF EXISTS `model`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `model` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_ID` varchar(40) DEFAULT NULL, + `MODEL_CUSTOMIZATION_NAME` varchar(40) DEFAULT NULL, + `MODEL_INVARIANT_ID` varchar(40) DEFAULT NULL, + `MODEL_NAME` varchar(40) DEFAULT NULL, + `MODEL_TYPE` varchar(20) DEFAULT NULL, + `MODEL_VERSION` varchar(20) DEFAULT NULL, + `MODEL_VERSION_ID` varchar(40) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `RECIPE` int(11) DEFAULT NULL, + PRIMARY KEY (`ID`), + UNIQUE KEY `uk1_model` (`MODEL_TYPE`,`MODEL_VERSION_ID`), + KEY `RECIPE` (`RECIPE`), + CONSTRAINT `model_ibfk_1` FOREIGN KEY (`RECIPE`) REFERENCES `model_recipe` (`MODEL_ID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `model_recipe` +-- + +DROP TABLE IF EXISTS `model_recipe`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `model_recipe` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, + `MODEL_ID` int(11) DEFAULT NULL, + `ACTION` varchar(40) DEFAULT NULL, + `SCHEMA_VERSION` varchar(40) DEFAULT NULL, + `DESCRIPTION` varchar(40) DEFAULT NULL, + `ORCHESTRATION_URI` varchar(20) DEFAULT NULL, + `MODEL_PARAM_XSD` varchar(20) DEFAULT NULL, + `RECIPE_TIMEOUT` int(11) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ID`), + UNIQUE KEY `uk1_model_recipe` (`MODEL_ID`,`ACTION`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `network_recipe` +-- + +DROP TABLE IF EXISTS `network_recipe`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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, + `RESOURCE_CATEGORY` varchar(200) DEFAULT NULL, + `RESOURCE_SUB_CATEGORY` varchar(200) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `UK_rl4f296i0p8lyokxveaiwkayi` (`MODEL_NAME`,`ACTION`,`VERSION_STR`) +) ENGINE=InnoDB AUTO_INCREMENT=181 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `network_resource` +-- + +DROP TABLE IF EXISTS `network_resource`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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) 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) NULL, + `AIC_VERSION_MAX` varchar(20) DEFAULT NULL, + `ORCHESTRATION_MODE` varchar(20) DEFAULT 'HEAT', + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `RESOURCE_CATEGORY` varchar(200) DEFAULT NULL, + `RESOURCE_SUB_CATEGORY` varchar(200) DEFAULT NULL, + 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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `network_resource_customization` +-- + +DROP TABLE IF EXISTS `network_resource_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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, + `RESOURCE_INPUT` varchar(20000) 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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `network_resource_customization_to_service` +-- + +DROP TABLE IF EXISTS `network_resource_customization_to_service`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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`), + KEY `RESOURCE_MODEL_CUSTOMIZATION_UUID` (`RESOURCE_MODEL_CUSTOMIZATION_UUID`), + CONSTRAINT `network_resource_customization_to_service_ibfk_1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE, + CONSTRAINT `network_resource_customization_to_service_ibfk_2` FOREIGN KEY (`RESOURCE_MODEL_CUSTOMIZATION_UUID`) REFERENCES `network_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `northbound_request_ref_lookup` +-- + +DROP TABLE IF EXISTS `northbound_request_ref_lookup`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `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', + `MIN_API_VERSION` double NOT NULL, + `MAX_API_VERSION` double DEFAULT NULL, + `IS_TOPLEVELFLOW` tinyint(1) DEFAULT NULL, + `CLOUD_OWNER` varchar(200) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `UK_northbound_request_ref_lookup` (`MIN_API_VERSION`,`REQUEST_SCOPE`,`ACTION`,`IS_ALACARTE`,`MACRO_ACTION`,`CLOUD_OWNER`) +) ENGINE=InnoDB AUTO_INCREMENT=86 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `orchestration_flow_reference` +-- + +DROP TABLE IF EXISTS `orchestration_flow_reference`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `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`), + UNIQUE KEY `UK_orchestration_flow_reference` (`COMPOSITE_ACTION`,`FLOW_NAME`,`SEQ_NO`,`NB_REQ_REF_LOOKUP_ID`), + KEY `fk_orchestration_flow_reference__northbound_req_ref_look_idx` (`NB_REQ_REF_LOOKUP_ID`), + KEY `fk_orchestration_flow_reference__building_block_detail` (`FLOW_NAME`), + 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 AUTO_INCREMENT=398 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `orchestration_status_state_transition_directive` +-- + +DROP TABLE IF EXISTS `orchestration_status_state_transition_directive`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `orchestration_status_state_transition_directive` ( + `id` int(11) NOT NULL 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 AUTO_INCREMENT=686 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `rainy_day_handler_macro` +-- + +DROP TABLE IF EXISTS `rainy_day_handler_macro`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `rainy_day_handler_macro` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `FLOW_NAME` varchar(200) NOT NULL, + `SERVICE_TYPE` varchar(200) NOT NULL, + `VNF_TYPE` varchar(200) NOT NULL, + `ERROR_CODE` varchar(200) NOT NULL, + `WORK_STEP` varchar(200) NOT NULL, + `POLICY` varchar(200) NOT NULL, + `SECONDARY_POLICY` varchar(200) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=93 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `service` +-- + +DROP TABLE IF EXISTS `service`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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, + `RESOURCE_ORDER` 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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `service_proxy_customization` +-- + +DROP TABLE IF EXISTS `service_proxy_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `service_proxy_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `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) DEFAULT NULL, + `SOURCE_SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), + KEY `fk_service_proxy_customization__service1_idx` (`SOURCE_SERVICE_MODEL_UUID`), + 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 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `service_proxy_customization_to_service` +-- + +DROP TABLE IF EXISTS `service_proxy_customization_to_service`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `service_recipe` +-- + +DROP TABLE IF EXISTS `service_recipe`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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=93 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `temp_network_heat_template_lookup` +-- + +DROP TABLE IF EXISTS `temp_network_heat_template_lookup`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `temp_network_heat_template_lookup` ( + `NETWORK_RESOURCE_MODEL_NAME` varchar(200) NOT NULL, + `HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) NULL, + `AIC_VERSION_MIN` varchar(20) 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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `tosca_csar` +-- + +DROP TABLE IF EXISTS `tosca_csar`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vf_module` +-- + +DROP TABLE IF EXISTS `vf_module`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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` tinyint(1) 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 character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vf_module_customization` +-- + +DROP TABLE IF EXISTS `vf_module_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vf_module_customization` ( + `ID` int(13) NOT NULL AUTO_INCREMENT, + `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, + `VNF_RESOURCE_CUSTOMIZATION_ID` int(13) DEFAULT NULL, + PRIMARY KEY (`ID`), + 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`), + KEY `fk_vf_module_customization_to_vnf_resource_customization` (`VNF_RESOURCE_CUSTOMIZATION_ID`), + KEY `vf_module_customization_model_cust_uuid_idx` (`MODEL_CUSTOMIZATION_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, + CONSTRAINT `fk_vf_module_customization_to_vnf_resource_customization` FOREIGN KEY (`VNF_RESOURCE_CUSTOMIZATION_ID`) REFERENCES `vnf_resource_customization` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vf_module_to_heat_files` +-- + +DROP TABLE IF EXISTS `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` +-- + +DROP TABLE IF EXISTS `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` +-- + +DROP TABLE IF EXISTS `vnf_components_recipe`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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=38 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vnf_recipe` +-- + +DROP TABLE IF EXISTS `vnf_recipe`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vnf_recipe` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `NF_ROLE` 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=10015 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vnf_resource` +-- + +DROP TABLE IF EXISTS `vnf_resource`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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, + `HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) DEFAULT NULL, + `RESOURCE_CATEGORY` varchar(200) DEFAULT NULL, + `RESOURCE_SUB_CATEGORY` 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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vnf_resource_customization` +-- + +DROP TABLE IF EXISTS `vnf_resource_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vnf_resource_customization` ( + `ID` int(13) NOT NULL AUTO_INCREMENT, + `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, + `MULTI_STAGE_DESIGN` varchar(20) DEFAULT NULL, + `RESOURCE_INPUT` varchar(20000) DEFAULT NULL, + `CDS_BLUEPRINT_NAME` varchar(200) default null, + `CDS_BLUEPRINT_VERSION` varchar(20) default null, + `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`ID`), + UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`), + KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`), + KEY `fk_vnf_resource_customization_to_service` (`SERVICE_MODEL_UUID`), + KEY `vnf_resource_customization_mod_cust_uuid_idx` (`MODEL_CUSTOMIZATION_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, + CONSTRAINT `fk_vnf_resource_customization_to_service` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vnfc_customization` +-- + +DROP TABLE IF EXISTS `vnfc_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vnfc_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `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) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vnfc_instance_group_customization` +-- + +DROP TABLE IF EXISTS `vnfc_instance_group_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vnfc_instance_group_customization` ( + `ID` int(13) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `VNF_RESOURCE_CUSTOMIZATION_ID` int(13) NOT NULL, + `INSTANCE_GROUP_MODEL_UUID` varchar(200) NOT NULL, + `FUNCTION` varchar(200) DEFAULT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + KEY `fk_vnfc_instance_group_customization__instance_group1_idx` (`INSTANCE_GROUP_MODEL_UUID`), + 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, + CONSTRAINT `fk_vnfc_instance_group_customization_vnf_customization` FOREIGN KEY (`VNF_RESOURCE_CUSTOMIZATION_ID`) REFERENCES `vnf_resource_customization` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +set foreign_key_checks=1; + +CREATE TABLE IF NOT EXISTS `pnf_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, + `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, + PRIMARY KEY (`MODEL_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `pnf_resource_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT 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, + `PNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, + `MULTI_STAGE_DESIGN` varchar(20) DEFAULT NULL, + `RESOURCE_INPUT` varchar(2000) DEFAULT NULL, + `CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL, + `CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL, + `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), + KEY `fk_pnf_resource_customization__pnf_resource1_idx` (`PNF_RESOURCE_MODEL_UUID`), + CONSTRAINT `fk_pnf_resource_customization__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `pnf_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; --------START Request DB SCHEMA -------- CREATE DATABASE requestdb; @@ -1102,6 +1477,3 @@ create table if not exists model ( 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 `catalogdb`.`vnf_recipe` -CHANGE COLUMN `VNF_TYPE` `NF_ROLE` VARCHAR(200) NULL DEFAULT NULL ; |