summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.1__WorkFlowDesignerTables.sql (renamed from adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__WorkFlowDesignerTables.sql)0
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__Use_ID_Configuration_Customization.sql75
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java71
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/schema.sql34
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java85
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java100
-rw-r--r--asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java64
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java56
-rw-r--r--asdc-controller/src/test/resources/ActivitySpec.json23
-rw-r--r--asdc-controller/src/test/resources/ActivitySpecFromCatalog.json41
-rw-r--r--asdc-controller/src/test/resources/ActivitySpecList.json398
-rw-r--r--asdc-controller/src/test/resources/data.sql192
-rw-r--r--asdc-controller/src/test/resources/schema.sql38
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql36
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java39
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java4
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ActivitySpecRepository.java32
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ConfigurationResourceCustomizationRepository.java2
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/ActivitySpecRepositoryTest.java35
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql34
23 files changed, 1195 insertions, 173 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__WorkFlowDesignerTables.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.1__WorkFlowDesignerTables.sql
index e44a6b97ba..e44a6b97ba 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__WorkFlowDesignerTables.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.1__WorkFlowDesignerTables.sql
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__Use_ID_Configuration_Customization.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__Use_ID_Configuration_Customization.sql
new file mode 100644
index 0000000000..b39331234d
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__Use_ID_Configuration_Customization.sql
@@ -0,0 +1,75 @@
+USE catalogdb;
+
+/* Drop existing foreign key */
+ALTER TABLE `catalogdb`.`configuration_customization`
+DROP FOREIGN KEY IF EXISTS `fk_configuration_customization__configuration_customization1`;
+
+ALTER TABLE `catalogdb`.`configuration_customization`
+DROP FOREIGN KEY IF EXISTS `fk_configuration_resource_customization__configuration_resour1`;
+/* Drop existing index */
+ALTER TABLE `catalogdb`.`configuration_customization`
+DROP INDEX IF EXISTS `fk_configuration_customization__configuration_customization_idx` ;
+
+/* Create a new table */
+CREATE TABLE `tmp_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,
+ `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_ID` int(11) DEFAULT NULL,
+ `SERVICE_MODEL_UUID` VARCHAR(200) NOT NULL,
+ PRIMARY KEY (`ID`) ,
+ KEY `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID`),
+ KEY `fk_configuration_customization__service_idx` (`SERVICE_MODEL_UUID`),
+ UNIQUE KEY `uk_configuration_customization` (`MODEL_CUSTOMIZATION_UUID` ASC, `SERVICE_MODEL_UUID` ASC),
+ CONSTRAINT `fk_configuration_customization__configuration1` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`)
+ REFERENCES `configuration` (`MODEL_UUID`)
+ ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_configuration_customization__service1` FOREIGN KEY (`SERVICE_MODEL_UUID`)
+ REFERENCES `service` (`MODEL_UUID`)
+ ON DELETE CASCADE ON UPDATE CASCADE
+
+) ENGINE=INNODB DEFAULT CHARSET=LATIN1;
+
+/* Migrate the existing data */
+INSERT INTO tmp_configuration_customization
+(`model_customization_uuid` ,
+ `model_instance_name`,
+ `configuration_type` ,
+ `configuration_role` ,
+ `configuration_function` ,
+ `creation_timestamp` ,
+ `configuration_model_uuid` ,
+ `service_proxy_customization_model_customization_uuid` ,
+ `service_model_uuid`)
+SELECT `config`.`model_customization_uuid`,
+ `config`.`model_instance_name`,
+ `config`.`configuration_type`,
+ `config`.`configuration_role`,
+ `config`.`configuration_function`,
+ `config`.`creation_timestamp`,
+ `config`.`configuration_model_uuid`,
+ `config`.`service_proxy_customization_model_customization_uuid`,
+ `svc`.`model_uuid` service_model_uuid FROM
+ configuration_customization config,
+ service svc,
+ configuration_customization_to_service config_svc
+WHERE
+ config_svc.service_model_uuid = svc.model_uuid
+ AND config_svc.resource_model_customization_uuid = config.model_customization_uuid;
+
+/* Drop the old tables */
+
+DROP TABLE `catalogdb`.`configuration_customization`;
+
+DROP TABLE `catalogdb`.`configuration_customization_to_service`;
+
+/* Rename the table */
+RENAME TABLE tmp_configuration_customization TO configuration_customization;
+
+ \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java
new file mode 100644
index 0000000000..701ed65d19
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java
@@ -0,0 +1,71 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Nokia.
+ * ================================================================================
+ * 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.heatbridge.factory;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.heatbridge.HeatBridgeException;
+import org.onap.so.heatbridge.openstack.api.OpenstackAccess;
+import org.onap.so.heatbridge.openstack.factory.OpenstackClientFactory;
+import org.onap.so.utils.CryptoUtils;
+
+public class MsoCloudClientFactoryImplTest {
+
+ private static final String URL_V2 = "http://localhost:8080/v2.0";
+ private static final String URL_V3 = "http://localhost:8080/v3";
+ private static final String URL_WITH_UNSUPPORTED_VERSION = "http://localhost:8080/v4";
+
+ private static final String MSO_ID = "testMsoId";
+ private static final String ENCRYPTED_PASSWORD = CryptoUtils.encryptCloudConfigPassword("testPassword");
+ private static final String CLOUD_REGION_ID = "testCloudRegionId";
+ private static final String TENANT_ID = "testTenantId";
+
+ private MsoCloudClientFactoryImpl testedObject;
+ private OpenstackClientFactory openstackClientFactoryMock;
+
+ @Before
+ public void setup() {
+ openstackClientFactoryMock = mock(OpenstackClientFactory.class);
+ testedObject = new MsoCloudClientFactoryImpl(openstackClientFactoryMock);
+ }
+
+ @Test
+ public void getOpenstackClientWithVersion2() throws Exception {
+ testedObject.getOpenstackClient(URL_V2, MSO_ID, ENCRYPTED_PASSWORD, CLOUD_REGION_ID, TENANT_ID);
+ verify(openstackClientFactoryMock).createOpenstackV2Client(any(OpenstackAccess.class));
+ }
+
+ @Test
+ public void getOpenstackClientWithVersion3() throws Exception {
+ testedObject.getOpenstackClient(URL_V3, MSO_ID, ENCRYPTED_PASSWORD, CLOUD_REGION_ID, TENANT_ID);
+ verify(openstackClientFactoryMock).createOpenstackV3Client(any(OpenstackAccess.class));
+ }
+
+ @Test(expected = HeatBridgeException.class)
+ public void getOpenstackClient_unsupportedVersion() throws Exception {
+ testedObject.getOpenstackClient(URL_WITH_UNSUPPORTED_VERSION, MSO_ID, ENCRYPTED_PASSWORD, CLOUD_REGION_ID,
+ TENANT_ID);
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
index 29a81e8fdf..dbb3469e77 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql
+++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
@@ -280,6 +280,7 @@ DROP TABLE IF EXISTS `configuration_customization`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `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,
@@ -288,27 +289,18 @@ CREATE TABLE `configuration_customization` (
`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`),
- 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`)
+ `CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_ID` int(11) DEFAULT NULL,
+ `SERVICE_MODEL_UUID` varchar(200),
+ PRIMARY KEY (`ID`),
+ KEY `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID`),
+ KEY `fk_configuration_customization__service_idx` (`SERVICE_MODEL_UUID`),
+ UNIQUE KEY `uk_configuration_customization` (`MODEL_CUSTOMIZATION_UUID` ASC, `SERVICE_MODEL_UUID` ASC),
+ CONSTRAINT `fk_configuration_customization__configuration1` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`)
+ REFERENCES `configuration` (`MODEL_UUID`)
+ ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_configuration_customization__service1` FOREIGN KEY (`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 */;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
index 46d0f78e35..87008f1d8f 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
@@ -20,14 +20,18 @@
package org.onap.so.asdc.activity;
-import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.onap.so.asdc.activity.beans.ActivitySpec;
-import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.asdc.activity.beans.Input;
+import org.onap.so.asdc.activity.beans.Output;
+import org.onap.so.db.catalog.beans.ActivitySpecActivitySpecCategories;
+import org.onap.so.db.catalog.beans.ActivitySpecActivitySpecParameters;
+import org.onap.so.db.catalog.beans.ActivitySpecParameters;
+import org.onap.so.db.catalog.data.repository.ActivitySpecRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,17 +43,24 @@ public class DeployActivitySpecs {
@Autowired
private Environment env;
+ @Autowired
+ private ActivitySpecRepository activitySpecRepository;
+
private static final String SDC_ENDPOINT = "mso.asdc.config.activity.endpoint";
+ private static final String DIRECTION_INPUT = "input";
+ private static final String DIRECTION_OUTPUT = "output";
protected static final Logger logger = LoggerFactory.getLogger(DeployActivitySpecs.class);
- public void deployActivities() throws Exception {
- String hostname = this.env.getProperty(SDC_ENDPOINT);
- List<ActivitySpec> activitySpecs = new ArrayList<ActivitySpec>();
- // Initialize activitySpecs from Catalog DB
-
- for (ActivitySpec activitySpec : activitySpecs) {
+ public void deployActivities() throws Exception {
+ String hostname = env.getProperty(SDC_ENDPOINT);
+ if (hostname == null || hostname.isEmpty()) {
+ return;
+ }
+ List<org.onap.so.db.catalog.beans.ActivitySpec> activitySpecsFromCatalog = activitySpecRepository.findAll();
+ for (org.onap.so.db.catalog.beans.ActivitySpec activitySpecFromCatalog : activitySpecsFromCatalog) {
+ ActivitySpec activitySpec = mapActivitySpecFromCatalogToSdc(activitySpecFromCatalog);
String activitySpecId = activitySpecsActions.createActivitySpec(hostname, activitySpec);
if (activitySpecId != null) {
logger.info("{} {}", "Successfully created activitySpec", activitySpec.getName());
@@ -64,4 +75,62 @@ public class DeployActivitySpecs {
}
}
}
+
+ public ActivitySpec mapActivitySpecFromCatalogToSdc(
+ org.onap.so.db.catalog.beans.ActivitySpec activitySpecFromCatalog) {
+ ActivitySpec activitySpec = new ActivitySpec();
+ activitySpec.setName(activitySpecFromCatalog.getName());
+ activitySpec.setDescription(activitySpecFromCatalog.getDescription());
+ mapCategoryList(activitySpecFromCatalog.getActivitySpecActivitySpecCategories(), activitySpec);
+ mapInputsAndOutputs(activitySpecFromCatalog.getActivitySpecActivitySpecParameters(), activitySpec);
+ return activitySpec;
+ }
+
+ private void mapCategoryList(List<ActivitySpecActivitySpecCategories> activitySpecActivitySpecCategories,
+ ActivitySpec activitySpec) {
+ if (activitySpecActivitySpecCategories == null || activitySpecActivitySpecCategories.size() == 0) {
+ return;
+ }
+ List<String> categoryList = new ArrayList<String>();
+ for (ActivitySpecActivitySpecCategories activitySpecCat : activitySpecActivitySpecCategories) {
+ if (activitySpecCat != null) {
+ if (activitySpecCat.getActivitySpecCategories() != null) {
+ categoryList.add(activitySpecCat.getActivitySpecCategories().getName());
+ }
+ }
+ }
+ activitySpec.setCategoryList(categoryList);
+ }
+
+ private void mapInputsAndOutputs(List<ActivitySpecActivitySpecParameters> activitySpecActivitySpecParameters,
+ ActivitySpec activitySpec) {
+ if (activitySpecActivitySpecParameters == null || activitySpecActivitySpecParameters.size() == 0) {
+ return;
+ }
+ List<Input> inputs = new ArrayList<Input>();
+ List<Output> outputs = new ArrayList<Output>();
+ for (ActivitySpecActivitySpecParameters activitySpecParam : activitySpecActivitySpecParameters) {
+ if (activitySpecParam != null) {
+ if (activitySpecParam.getActivitySpecParameters() != null) {
+ ActivitySpecParameters activitySpecParameters = activitySpecParam.getActivitySpecParameters();
+ if (activitySpecParameters != null) {
+ if (activitySpecParameters.getDirection().equals(DIRECTION_INPUT)) {
+ Input input = new Input();
+ input.setName(activitySpecParameters.getName());
+ input.setType(activitySpecParameters.getType());
+ inputs.add(input);
+ } else if (activitySpecParameters.getDirection().equals(DIRECTION_OUTPUT)) {
+ Output output = new Output();
+ output.setName(activitySpecParameters.getName());
+ output.setType(activitySpecParameters.getType());
+ outputs.add(output);
+ }
+ }
+ }
+ }
+ }
+ activitySpec.setInputs(inputs);
+ activitySpec.setOutputs(outputs);
+ return;
+ }
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index f3a495825c..d3eab9a3fd 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -35,6 +35,7 @@ import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
+import org.hibernate.StaleObjectStateException;
import org.hibernate.exception.ConstraintViolationException;
import org.hibernate.exception.LockAcquisitionException;
import org.onap.sdc.api.notification.IArtifactInfo;
@@ -55,7 +56,6 @@ import org.onap.sdc.toscaparser.api.Property;
import org.onap.sdc.toscaparser.api.RequirementAssignment;
import org.onap.sdc.toscaparser.api.RequirementAssignments;
import org.onap.sdc.toscaparser.api.elements.Metadata;
-import org.onap.sdc.toscaparser.api.elements.StatefulEntityType;
import org.onap.sdc.toscaparser.api.functions.GetInput;
import org.onap.sdc.toscaparser.api.parameters.Input;
import org.onap.sdc.utils.DistributionStatusEnum;
@@ -122,7 +122,6 @@ import org.onap.so.db.catalog.data.repository.ServiceRepository;
import org.onap.so.db.catalog.data.repository.TempNetworkHeatTemplateRepository;
import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
import org.onap.so.db.catalog.data.repository.VFModuleRepository;
-import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository;
import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
import org.onap.so.db.catalog.data.repository.VnfcCustomizationRepository;
import org.onap.so.db.catalog.data.repository.VnfcInstanceGroupCustomizationRepository;
@@ -308,6 +307,7 @@ public class ToscaResourceInstaller {
}
}
+
@Transactional(rollbackFor = {ArtifactInstallerException.class})
public void installTheResource(ToscaResourceStructure toscaResourceStruct, ResourceStructure resourceStruct)
throws ArtifactInstallerException {
@@ -408,8 +408,10 @@ public class ToscaResourceInstaller {
processNetworkCollections(toscaResourceStruct, service);
// Process Service Proxy & Configuration
processServiceProxyAndConfiguration(toscaResourceStruct, service);
+
logger.info("Saving Service: {} ", service.getModelName());
- serviceRepo.save(service);
+ service = serviceRepo.save(service);
+ correlateConfigCustomResources(service);
WatchdogComponentDistributionStatus status = new WatchdogComponentDistributionStatus(
vfResourceStruct.getNotification().getDistributionID(), MSO);
@@ -637,7 +639,8 @@ public class ToscaResourceInstaller {
}
protected ConfigurationResourceCustomization getConfigurationResourceCustomization(NodeTemplate nodeTemplate,
- ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization) {
+ ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization,
+ Service service) {
Metadata metadata = nodeTemplate.getMetaData();
ConfigurationResource configResource = getConfigurationResource(nodeTemplate);
@@ -660,31 +663,15 @@ public class ToscaResourceInstaller {
.setServiceProxyResourceCustomizationUUID(spResourceCustomization.getModelCustomizationUUID());
configCustomizationResource.setConfigurationResource(configResource);
+ configCustomizationResource.setService(service);
configResourceCustomizationSet.add(configCustomizationResource);
configResource.setConfigurationResourceCustomization(configResourceCustomizationSet);
+
return configCustomizationResource;
}
- protected Optional<ConfigurationResourceCustomization> getVnrNodeTemplate(
- List<NodeTemplate> configurationNodeTemplatesList, ToscaResourceStructure toscaResourceStructure,
- ServiceProxyResourceCustomization spResourceCustomization) {
- Optional<ConfigurationResourceCustomization> configurationResourceCust = Optional.empty();
- for (NodeTemplate nodeTemplate : configurationNodeTemplatesList) {
- StatefulEntityType entityType = nodeTemplate.getTypeDefinition();
- String type = entityType.getType();
-
- if (VLAN_NETWORK_RECEPTOR.equals(type)) {
- configurationResourceCust = Optional.of(getConfigurationResourceCustomization(nodeTemplate,
- toscaResourceStructure, spResourceCustomization));
- break;
- }
- }
-
- return configurationResourceCust;
- }
-
protected void processServiceProxyAndConfiguration(ToscaResourceStructure toscaResourceStruct, Service service) {
List<NodeTemplate> serviceProxyResourceList =
@@ -703,8 +690,6 @@ public class ToscaResourceInstaller {
for (NodeTemplate spNode : serviceProxyResourceList) {
serviceProxy = createServiceProxy(spNode, service, toscaResourceStruct);
serviceProxyList.add(serviceProxy);
- Optional<ConfigurationResourceCustomization> vnrResourceCustomization =
- getVnrNodeTemplate(configurationNodeTemplatesList, toscaResourceStruct, serviceProxy);
for (NodeTemplate configNode : configurationNodeTemplatesList) {
@@ -712,19 +697,21 @@ public class ToscaResourceInstaller {
toscaResourceStruct.getSdcCsarHelper().getRequirementsOf(configNode).getAll();
for (RequirementAssignment requirement : requirementsList) {
if (requirement.getNodeTemplateName().equals(spNode.getName())) {
- ConfigurationResourceCustomization configurationResource = createConfiguration(configNode,
- toscaResourceStruct, serviceProxy, vnrResourceCustomization);
-
- Optional<ConfigurationResourceCustomization> matchingObject = configurationResourceList
- .stream()
- .filter(configurationResourceCustomization -> configNode.getMetaData()
- .getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)
- .equals(configurationResource.getModelCustomizationUUID()))
- .findFirst();
+ ConfigurationResourceCustomization configurationResource =
+ createConfiguration(configNode, toscaResourceStruct, serviceProxy, service);
+
+ Optional<ConfigurationResourceCustomization> matchingObject =
+ configurationResourceList.stream()
+ .filter(configurationResourceCustomization -> configNode.getMetaData()
+ .getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)
+ .equals(configurationResource.getModelCustomizationUUID()))
+ .filter(configurationResourceCustomization -> configurationResourceCustomization
+ .getModelInstanceName()
+ .equals(configurationResource.getModelInstanceName()))
+ .findFirst();
if (!matchingObject.isPresent()) {
configurationResourceList.add(configurationResource);
}
-
break;
}
}
@@ -737,6 +724,37 @@ public class ToscaResourceInstaller {
service.setServiceProxyCustomizations(serviceProxyList);
}
+ /*
+ * ConfigurationResourceCustomization objects have their IDs auto incremented in the database. Unless we know their
+ * IDs we cannot possibly associate their related records. So these ConfigResourceCustomizations are persisted first
+ * and subsequently correlated.
+ */
+
+ protected void correlateConfigCustomResources(Service service) {
+ /* Assuming that we have only one pair of VRF-VNR */
+ ConfigurationResourceCustomization vrfConfigCustomResource = null;
+ ConfigurationResourceCustomization vnrConfigCustomResource = null;
+ List<ConfigurationResourceCustomization> configCustomList = service.getConfigurationCustomizations();
+ for (ConfigurationResourceCustomization configResource : configCustomList) {
+ String nodeType = configResource.getConfigurationResource().getToscaNodeType();
+ if (NODES_VRF_ENTRY.equalsIgnoreCase(nodeType)) {
+ vrfConfigCustomResource = configResource;
+ } else if (VLAN_NETWORK_RECEPTOR.equalsIgnoreCase(nodeType)) {
+ vnrConfigCustomResource = configResource;
+ }
+ }
+
+ if (vrfConfigCustomResource != null) {
+ vrfConfigCustomResource.setConfigResourceCustomization(vnrConfigCustomResource);
+ configCustomizationRepo.save(vrfConfigCustomResource);
+
+ }
+ if (vnrConfigCustomResource != null) {
+ vnrConfigCustomResource.setConfigResourceCustomization(vrfConfigCustomResource);
+ configCustomizationRepo.save(vnrConfigCustomResource);
+ }
+ }
+
protected void processNetworkCollections(ToscaResourceStructure toscaResourceStruct, Service service) {
List<NodeTemplate> networkCollectionList =
@@ -1229,22 +1247,15 @@ public class ToscaResourceInstaller {
protected ConfigurationResourceCustomization createConfiguration(NodeTemplate nodeTemplate,
ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization,
- Optional<ConfigurationResourceCustomization> vnrResourceCustomization) {
+ Service service) {
- ConfigurationResourceCustomization configCustomizationResource =
- getConfigurationResourceCustomization(nodeTemplate, toscaResourceStructure, spResourceCustomization);
+ ConfigurationResourceCustomization configCustomizationResource = getConfigurationResourceCustomization(
+ nodeTemplate, toscaResourceStructure, spResourceCustomization, service);
ConfigurationResource configResource = getConfigurationResource(nodeTemplate);
Set<ConfigurationResourceCustomization> configResourceCustomizationSet = new HashSet<>();
- StatefulEntityType entityType = nodeTemplate.getTypeDefinition();
- String type = entityType.getType();
-
- if (NODES_VRF_ENTRY.equals(type)) {
- configCustomizationResource.setConfigResourceCustomization(vnrResourceCustomization.orElse(null));
- }
-
configCustomizationResource.setConfigurationResource(configResource);
configResourceCustomizationSet.add(configCustomizationResource);
@@ -1353,6 +1364,7 @@ public class ToscaResourceInstaller {
networkCustomizationRepo.saveAndFlush(networkResourceCustomization);
+
} else if (networkResourceCustomization == null) {
networkResourceCustomization =
createNetworkResourceCustomization(networkNodeTemplate, toscaResourceStructure);
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
index 86f6a89af5..aae5e5dc53 100644
--- a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java
+++ b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java
@@ -19,20 +19,72 @@
*/
package org.onap.asdc.activity;
+import java.nio.file.Files;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.when;
import org.junit.Test;
-import org.onap.so.asdc.BaseTest;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.asdc.activity.ActivitySpecsActions;
import org.onap.so.asdc.activity.DeployActivitySpecs;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.onap.so.asdc.activity.beans.ActivitySpec;
+import org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse;
+import org.onap.so.db.catalog.data.repository.ActivitySpecRepository;
+import org.springframework.core.env.Environment;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+@RunWith(MockitoJUnitRunner.class)
+public class DeployActivitySpecsTest {
+ @Mock
+ protected Environment env;
-public class DeployActivitySpecsTest extends BaseTest {
+ @Mock
+ protected ActivitySpecRepository activitySpecRepository;
- @Autowired
+ @Mock
+ protected ActivitySpecsActions activitySpecsActions;
+
+ @InjectMocks
private DeployActivitySpecs deployActivitySpecs;
@Test
- public void DeployActivitySpecs_Test() throws Exception {
- // Mock catalog DB results
+ public void deployActivitySpecs_Test() throws Exception {
+ boolean deploymentSuccessful = true;
+ ActivitySpecCreateResponse activitySpecCreateResponse = new ActivitySpecCreateResponse();
+ activitySpecCreateResponse.setId("testActivityId");
+ ObjectMapper mapper = new ObjectMapper();
+ org.onap.so.db.catalog.beans.ActivitySpec catalogActivitySpec = mapper.readValue(
+ new String(Files.readAllBytes(Paths.get("src/test/resources/ActivitySpecFromCatalog.json"))),
+ org.onap.so.db.catalog.beans.ActivitySpec.class);
+ List<org.onap.so.db.catalog.beans.ActivitySpec> catalogActivitySpecList =
+ new ArrayList<org.onap.so.db.catalog.beans.ActivitySpec>();
+ catalogActivitySpecList.add(catalogActivitySpec);
+ when(env.getProperty("mso.asdc.config.activity.endpoint")).thenReturn("testEndpoint");
+ when(activitySpecRepository.findAll()).thenReturn(catalogActivitySpecList);
+ doReturn("testActivityId").when(activitySpecsActions).createActivitySpec(Mockito.any(), Mockito.any());
+ doReturn(true).when(activitySpecsActions).certifyActivitySpec(Mockito.any(), Mockito.any());
deployActivitySpecs.deployActivities();
+ assertTrue(deploymentSuccessful);
+ }
+
+ @Test
+ public void mapActivitySpecFromCatalogToSdc_Test() throws Exception {
+ ObjectMapper mapper = new ObjectMapper();
+ org.onap.so.db.catalog.beans.ActivitySpec catalogActivitySpec = mapper.readValue(
+ new String(Files.readAllBytes(Paths.get("src/test/resources/ActivitySpecFromCatalog.json"))),
+ org.onap.so.db.catalog.beans.ActivitySpec.class);
+ ActivitySpec activitySpec = deployActivitySpecs.mapActivitySpecFromCatalogToSdc(catalogActivitySpec);
+ ActivitySpec expected = mapper.readValue(
+ new String(Files.readAllBytes(Paths.get("src/test/resources/ActivitySpec.json"))), ActivitySpec.class);
+ assertThat(expected, sameBeanAs(activitySpec));
}
}
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 d3c0bdef66..ce70a252c9 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
@@ -20,26 +20,24 @@
package org.onap.so.asdc.installer.heat;
-import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
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.assertNotNull;
-import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
+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.util.ArrayList;
import java.util.List;
-import java.util.Optional;
import org.hibernate.exception.LockAcquisitionException;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.onap.sdc.api.notification.IResourceInstance;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
@@ -58,13 +56,17 @@ import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
import org.onap.so.asdc.installer.ToscaResourceStructure;
import org.onap.so.db.catalog.beans.ConfigurationResource;
import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
+import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.AllottedResourceRepository;
+import org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.util.ReflectionTestUtils;
+
public class ToscaResourceInstallerTest extends BaseTest {
@Autowired
@@ -99,6 +101,8 @@ public class ToscaResourceInstallerTest extends BaseTest {
private ISdcCsarHelper csarHelper;
@Mock
private StatefulEntityType entityType;
+ @Mock
+ private Service service;
private NotificationDataImpl notificationData;
private JsonStatusData statusData;
@@ -350,8 +354,9 @@ public class ToscaResourceInstallerTest extends BaseTest {
public void getConfigurationResourceCustomizationTest() {
prepareConfigurationResourceCustomization();
- ConfigurationResourceCustomization configurationResourceCustomization = toscaInstaller
- .getConfigurationResourceCustomization(nodeTemplate, toscaResourceStructure, spResourceCustomization);
+ ConfigurationResourceCustomization configurationResourceCustomization =
+ toscaInstaller.getConfigurationResourceCustomization(nodeTemplate, toscaResourceStructure,
+ spResourceCustomization, service);
assertNotNull(configurationResourceCustomization);
assertNotNull(configurationResourceCustomization.getConfigurationResource());
assertEquals(MockConstants.MODEL_CUSTOMIZATIONUUID,
@@ -359,16 +364,34 @@ public class ToscaResourceInstallerTest extends BaseTest {
}
@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());
+ public void correlateConfigCustomResourcesTest() {
+ ConfigurationResource vrfConfigResource = mock(ConfigurationResource.class);
+ ConfigurationResourceCustomization vrfConfigCustom = mock(ConfigurationResourceCustomization.class);
+ doReturn(ToscaResourceInstaller.NODES_VRF_ENTRY).when(vrfConfigResource).getToscaNodeType();
+ doReturn(vrfConfigResource).when(vrfConfigCustom).getConfigurationResource();
+
+ ConfigurationResource vnrConfigResource = mock(ConfigurationResource.class);
+ ConfigurationResourceCustomization vnrConfigCustom = mock(ConfigurationResourceCustomization.class);
+ doReturn(ToscaResourceInstaller.VLAN_NETWORK_RECEPTOR).when(vnrConfigResource).getToscaNodeType();
+ doReturn(vnrConfigResource).when(vnrConfigCustom).getConfigurationResource();
+
+ ConfigurationResourceCustomizationRepository configCustomizationRepo =
+ spy(ConfigurationResourceCustomizationRepository.class);
+ ReflectionTestUtils.setField(toscaInstaller, "configCustomizationRepo", configCustomizationRepo);
+ doReturn(vrfConfigCustom).when(configCustomizationRepo).save(vrfConfigCustom);
+ doReturn(vnrConfigCustom).when(configCustomizationRepo).save(vnrConfigCustom);
+
+ List<ConfigurationResourceCustomization> configList = new ArrayList<>();
+ configList.add(vrfConfigCustom);
+ configList.add(vnrConfigCustom);
+ doReturn(configList).when(service).getConfigurationCustomizations();
+
+ toscaInstaller.correlateConfigCustomResources(service);
+ verify(vrfConfigCustom, times(1)).getConfigurationResource();
+ verify(vrfConfigCustom, times(1)).setConfigResourceCustomization(vnrConfigCustom);
+ verify(service, times(1)).getConfigurationCustomizations();
+ verify(vnrConfigCustom, times(1)).getConfigurationResource();
+ verify(vnrConfigCustom, times(1)).setConfigResourceCustomization(vrfConfigCustom);
}
class MockConstants {
@@ -381,5 +404,6 @@ public class ToscaResourceInstallerTest extends BaseTest {
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/resources/ActivitySpec.json b/asdc-controller/src/test/resources/ActivitySpec.json
new file mode 100644
index 0000000000..66e1b1355f
--- /dev/null
+++ b/asdc-controller/src/test/resources/ActivitySpec.json
@@ -0,0 +1,23 @@
+{
+ "name": "VNFQuiesceTrafficActivity",
+ "description": "Activity to QuiesceTraffic on VNF",
+ "categoryList": [
+ "VNF"
+ ],
+ "inputs": [
+ {
+ "name": "parameter1",
+ "type": "string"
+ },
+ {
+ "name": "parameter2",
+ "type": "string"
+ }
+ ],
+ "outputs": [
+ {
+ "name": "parameter3",
+ "type": "string"
+ }
+ ]
+} \ No newline at end of file
diff --git a/asdc-controller/src/test/resources/ActivitySpecFromCatalog.json b/asdc-controller/src/test/resources/ActivitySpecFromCatalog.json
new file mode 100644
index 0000000000..0864a2cba9
--- /dev/null
+++ b/asdc-controller/src/test/resources/ActivitySpecFromCatalog.json
@@ -0,0 +1,41 @@
+{
+ "name": "VNFQuiesceTrafficActivity",
+ "description": "Activity to QuiesceTraffic on VNF",
+ "version": null,
+ "created": null,
+ "workflowActivitySpecSequence": null,
+ "activitySpecActivitySpecCategories": [
+ {
+ "activitySpecCategories": {
+ "name": "VNF"
+ }
+ }
+ ],
+ "activitySpecActivitySpecParameters": [
+ {
+ "activitySpecParameters": {
+ "name": "parameter1",
+ "type": "string",
+ "direction": "input",
+ "description": "Parameter 1"
+ }
+ },
+ {
+ "activitySpecParameters": {
+ "name": "parameter2",
+ "type": "string",
+ "direction": "input",
+ "description": "Parameter 2"
+ }
+ },
+ {
+ "activitySpecParameters": {
+ "name": "parameter3",
+ "type": "string",
+ "direction": "output",
+ "description": "Parameter 3"
+ }
+ }
+ ]
+
+} \ No newline at end of file
diff --git a/asdc-controller/src/test/resources/ActivitySpecList.json b/asdc-controller/src/test/resources/ActivitySpecList.json
new file mode 100644
index 0000000000..c3530a2e7e
--- /dev/null
+++ b/asdc-controller/src/test/resources/ActivitySpecList.json
@@ -0,0 +1,398 @@
+{
+ "activitySpecList": [
+ {
+ "activitySpec": {
+ "name": "VNFQuiesceTrafficActivity",
+ "description": "Activity to QuiesceTraffic on VNF",
+ "version": null,
+ "created": null,
+ "workflowActivitySpecSequence": null,
+ "activitySpecActivitySpecCategories": null,
+ "activitySpecUserParameters": [
+ {
+ "activitySpecId": null,
+ "userParametersId": null,
+ "activitySpec": null,
+ "userParameters": {
+ "name": "operations_timeout",
+ "payloadLocation": "userParams",
+ "label": "Operations Timeout",
+ "type": "text",
+ "description": null,
+ "isRequried": true,
+ "maxLength": 50,
+ "allowableChars": "someRegEx",
+ "created": null,
+ "activitySpecUserParameters": null,
+ "id": null
+ },
+ "id": null
+ },
+ {
+ "activitySpecId": null,
+ "userParametersId": null,
+ "activitySpec": null,
+ "userParameters": {
+ "name": "existing_software_version",
+ "payloadLocation": "userParams",
+ "label": "Existing Software Version",
+ "type": "text",
+ "description": null,
+ "isRequried": true,
+ "maxLength": 50,
+ "allowableChars": "someRegEx",
+ "created": null,
+ "activitySpecUserParameters": null,
+ "id": null
+ },
+ "id": null
+ },
+ {
+ "activitySpecId": null,
+ "userParametersId": null,
+ "activitySpec": null,
+ "userParameters": {
+ "name": "cloudOwner",
+ "payloadLocation": "cloudConfiguration",
+ "label": "Cloud Owner",
+ "type": "text",
+ "description": null,
+ "isRequried": true,
+ "maxLength": 7,
+ "allowableChars": "someRegEx",
+ "created": null,
+ "activitySpecUserParameters": null,
+ "id": null
+ },
+ "id": null
+ },
+ {
+ "activitySpecId": null,
+ "userParametersId": null,
+ "activitySpec": null,
+ "userParameters": {
+ "name": "tenantId",
+ "payloadLocation": "cloudConfiguration",
+ "label": "Tenant/Project ID",
+ "type": "text",
+ "description": null,
+ "isRequried": true,
+ "maxLength": 36,
+ "allowableChars": "someRegEx",
+ "created": null,
+ "activitySpecUserParameters": null,
+ "id": null
+ },
+ "id": null
+ },
+ {
+ "activitySpecId": null,
+ "userParametersId": null,
+ "activitySpec": null,
+ "userParameters": {
+ "name": "new_software_version",
+ "payloadLocation": "userParams",
+ "label": "New Software Version",
+ "type": "text",
+ "description": null,
+ "isRequried": true,
+ "maxLength": 50,
+ "allowableChars": "someRegEx",
+ "created": null,
+ "activitySpecUserParameters": null,
+ "id": null
+ },
+ "id": null
+ },
+ {
+ "activitySpecId": null,
+ "userParametersId": null,
+ "activitySpec": null,
+ "userParameters": {
+ "name": "lcpCloudRegionId",
+ "payloadLocation": "cloudConfiguration",
+ "label": "Cloud Region ID",
+ "type": "text",
+ "description": null,
+ "isRequried": true,
+ "maxLength": 7,
+ "allowableChars": "someRegEx",
+ "created": null,
+ "activitySpecUserParameters": null,
+ "id": null
+ },
+ "id": null
+ }
+ ],
+ "activitySpecActivitySpecParameters": null,
+ "id": null
+ },
+ "workflow": null,
+ "id": null
+ },
+ {
+ "activitySpecId": null,
+ "workflowId": null,
+ "activitySpec": {
+ "name": "VNFHealthCheckActivity",
+ "description": "Activity to HealthCheck VNF",
+ "version": null,
+ "created": null,
+ "workflowActivitySpecSequence": null,
+ "activitySpecActivitySpecCategories": null,
+ "activitySpecUserParameters": [
+ {
+ "activitySpecId": null,
+ "userParametersId": null,
+ "activitySpec": null,
+ "userParameters": {
+ "name": "operations_timeout",
+ "payloadLocation": "userParams",
+ "label": "Operations Timeout",
+ "type": "text",
+ "description": null,
+ "isRequried": true,
+ "maxLength": 50,
+ "allowableChars": "someRegEx",
+ "created": null,
+ "activitySpecUserParameters": null,
+ "id": null
+ },
+ "id": null
+ },
+ {
+ "activitySpecId": null,
+ "userParametersId": null,
+ "activitySpec": null,
+ "userParameters": {
+ "name": "existing_software_version",
+ "payloadLocation": "userParams",
+ "label": "Existing Software Version",
+ "type": "text",
+ "description": null,
+ "isRequried": true,
+ "maxLength": 50,
+ "allowableChars": "someRegEx",
+ "created": null,
+ "activitySpecUserParameters": null,
+ "id": null
+ },
+ "id": null
+ },
+ {
+ "activitySpecId": null,
+ "userParametersId": null,
+ "activitySpec": null,
+ "userParameters": {
+ "name": "cloudOwner",
+ "payloadLocation": "cloudConfiguration",
+ "label": "Cloud Owner",
+ "type": "text",
+ "description": null,
+ "isRequried": true,
+ "maxLength": 7,
+ "allowableChars": "someRegEx",
+ "created": null,
+ "activitySpecUserParameters": null,
+ "id": null
+ },
+ "id": null
+ },
+ {
+ "activitySpecId": null,
+ "userParametersId": null,
+ "activitySpec": null,
+ "userParameters": {
+ "name": "tenantId",
+ "payloadLocation": "cloudConfiguration",
+ "label": "Tenant/Project ID",
+ "type": "text",
+ "description": null,
+ "isRequried": true,
+ "maxLength": 36,
+ "allowableChars": "someRegEx",
+ "created": null,
+ "activitySpecUserParameters": null,
+ "id": null
+ },
+ "id": null
+ },
+ {
+ "activitySpecId": null,
+ "userParametersId": null,
+ "activitySpec": null,
+ "userParameters": {
+ "name": "new_software_version",
+ "payloadLocation": "userParams",
+ "label": "New Software Version",
+ "type": "text",
+ "description": null,
+ "isRequried": true,
+ "maxLength": 50,
+ "allowableChars": "someRegEx",
+ "created": null,
+ "activitySpecUserParameters": null,
+ "id": null
+ },
+ "id": null
+ },
+ {
+ "activitySpecId": null,
+ "userParametersId": null,
+ "activitySpec": null,
+ "userParameters": {
+ "name": "lcpCloudRegionId",
+ "payloadLocation": "cloudConfiguration",
+ "label": "Cloud Region ID",
+ "type": "text",
+ "description": null,
+ "isRequried": true,
+ "maxLength": 7,
+ "allowableChars": "someRegEx",
+ "created": null,
+ "activitySpecUserParameters": null,
+ "id": null
+ },
+ "id": null
+ }
+ ],
+ "activitySpecActivitySpecParameters": null,
+ "id": null
+ },
+ "workflow": null,
+ "id": null
+ },
+ {
+ "activitySpecId": null,
+ "workflowId": null,
+ "activitySpec": {
+ "name": "FlowCompleteActivity",
+ "description": "Activity to Complete the BPMN Flow",
+ "version": null,
+ "created": null,
+ "workflowActivitySpecSequence": null,
+ "activitySpecActivitySpecCategories": null,
+ "activitySpecUserParameters": [
+ {
+ "activitySpecId": null,
+ "userParametersId": null,
+ "activitySpec": null,
+ "userParameters": {
+ "name": "operations_timeout",
+ "payloadLocation": "userParams",
+ "label": "Operations Timeout",
+ "type": "text",
+ "description": null,
+ "isRequried": true,
+ "maxLength": 50,
+ "allowableChars": "someRegEx",
+ "created": null,
+ "activitySpecUserParameters": null,
+ "id": null
+ },
+ "id": null
+ },
+ {
+ "activitySpecId": null,
+ "userParametersId": null,
+ "activitySpec": null,
+ "userParameters": {
+ "name": "existing_software_version",
+ "payloadLocation": "userParams",
+ "label": "Existing Software Version",
+ "type": "text",
+ "description": null,
+ "isRequried": true,
+ "maxLength": 50,
+ "allowableChars": "someRegEx",
+ "created": null,
+ "activitySpecUserParameters": null,
+ "id": null
+ },
+ "id": null
+ },
+ {
+ "activitySpecId": null,
+ "userParametersId": null,
+ "activitySpec": null,
+ "userParameters": {
+ "name": "cloudOwner",
+ "payloadLocation": "cloudConfiguration",
+ "label": "Cloud Owner",
+ "type": "text",
+ "description": null,
+ "isRequried": true,
+ "maxLength": 7,
+ "allowableChars": "someRegEx",
+ "created": null,
+ "activitySpecUserParameters": null,
+ "id": null
+ },
+ "id": null
+ },
+ {
+ "activitySpecId": null,
+ "userParametersId": null,
+ "activitySpec": null,
+ "userParameters": {
+ "name": "tenantId",
+ "payloadLocation": "cloudConfiguration",
+ "label": "Tenant/Project ID",
+ "type": "text",
+ "description": null,
+ "isRequried": true,
+ "maxLength": 36,
+ "allowableChars": "someRegEx",
+ "created": null,
+ "activitySpecUserParameters": null,
+ "id": null
+ },
+ "id": null
+ },
+ {
+ "activitySpecId": null,
+ "userParametersId": null,
+ "activitySpec": null,
+ "userParameters": {
+ "name": "new_software_version",
+ "payloadLocation": "userParams",
+ "label": "New Software Version",
+ "type": "text",
+ "description": null,
+ "isRequried": true,
+ "maxLength": 50,
+ "allowableChars": "someRegEx",
+ "created": null,
+ "activitySpecUserParameters": null,
+ "id": null
+ },
+ "id": null
+ },
+ {
+ "activitySpecId": null,
+ "userParametersId": null,
+ "activitySpec": null,
+ "userParameters": {
+ "name": "lcpCloudRegionId",
+ "payloadLocation": "cloudConfiguration",
+ "label": "Cloud Region ID",
+ "type": "text",
+ "description": null,
+ "isRequried": true,
+ "maxLength": 7,
+ "allowableChars": "someRegEx",
+ "created": null,
+ "activitySpecUserParameters": null,
+ "id": null
+ },
+ "id": null
+ }
+ ],
+ "activitySpecActivitySpecParameters": null,
+ "id": null
+ },
+ "workflow": null,
+ "id": null
+ }
+ ]
+} \ No newline at end of file
diff --git a/asdc-controller/src/test/resources/data.sql b/asdc-controller/src/test/resources/data.sql
index 7cd972ca63..47e6c4c982 100644
--- a/asdc-controller/src/test/resources/data.sql
+++ b/asdc-controller/src/test/resources/data.sql
@@ -22,6 +22,196 @@ INSERT INTO temp_network_heat_template_lookup(NETWORK_RESOURCE_MODEL_NAME, HEAT_
INSERT INTO temp_network_heat_template_lookup(NETWORK_RESOURCE_MODEL_NAME, HEAT_TEMPLATE_ARTIFACT_UUID, AIC_VERSION_MIN, AIC_VERSION_MAX) VALUES
('SRIOV_PROVIDER_NETWORK', 'ff874603-4222-11e7-9252-005056850d2e', '3.0', NULL);
+insert into vnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, aic_version_min, aic_version_max, model_invariant_uuid, model_version, model_name, tosca_node_type, heat_template_artifact_uuid) values
+('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002671', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '1.0', 'vSAMP10a', 'VF', null);
+
+insert into workflow(artifact_uuid, artifact_name, name, operation_name, version, description, body, resource_target, source) values
+('5b0c4322-643d-4c9f-b184-4516049e99b1', 'testingWorkflow', 'testingWorkflow', 'create', 1, 'Test Workflow', null, 'vnf', 'sdc');
+
+insert into vnf_resource_to_workflow(vnf_resource_model_uuid, workflow_id) values
+('ff2ae348-214a-11e7-93ae-92361f002671', '1');
+
+insert into activity_spec(name, description, version) values
+('testActivity1', 'Test Activity 1', 1.0);
+
+insert into workflow_activity_spec_sequence(workflow_id, activity_spec_id, seq_no) values
+(1, 1, 1);
+
+INSERT INTO activity_spec (NAME, DESCRIPTION, VERSION)
+VALUES
+('VNFSetInMaintFlagActivity','Activity to Set InMaint Flag in A&AI',1.0),
+('VNFCheckPserversLockedFlagActivity','Activity Check Pservers Locked Flag VNF',1.0),
+('VNFCheckInMaintFlagActivity','Activity CheckIn Maint Flag on VNF',1.0),
+('VNFCheckClosedLoopDisabledFlagActivity','Activity Check Closed Loop Disabled Flag on VNF',1.0),
+('VNFSetClosedLoopDisabledFlagActivity','Activity Set Closed Loop Disabled Flag on VNF',1.0),
+('VNFUnsetClosedLoopDisabledFlagActivity','Activity Unset Closed Loop Disabled Flag on VNF',1.0),
+('VNFLockActivity','Activity Lock on VNF',1.0),
+('VNFUnlockActivity','Activity UnLock on VNF',1.0),
+('VNFStopActivity','Activity Stop on VNF',1.0),
+('VNFStartActivity','Activity Start on VNF',1.0),
+('VNFSnapShotActivity','Activity Snap Shot on VNF',1.0),
+('FlowCompleteActivity','Activity Complete on VNF',1.0),
+('PauseForManualTaskActivity','Activity Pause For Manual Task on VNF',1.0),
+('DistributeTrafficActivity','Activity Distribute Traffic on VNF',1.0),
+('DistributeTrafficCheckActivity','Activity Distribute Traffic Check on VNF',1.0),
+('VNFHealthCheckActivity','Activity Health Check on VNF',1.0),
+('VNFQuiesceTrafficActivity','Activity Quiesce Traffic on VNF',1.0),
+('VNFResumeTrafficActivity','Activity Resume Traffic on VNF',1.0),
+('VNFUnsetInMaintFlagActivity','Activity Unset InMaint Flag on VNF',1.0),
+('VNFUpgradeBackupActivity','Activity Upgrade Backup on VNF',1.0),
+('VNFUpgradePostCheckActivity','Activity Upgrade Post Check on VNF',1.0),
+('VNFUpgradePreCheckActivity','Activity Upgrade PreCheck on VNF',1.0),
+('VNFUpgradeSoftwareActivity','Activity UpgradeS oftware on VNF',1.0),
+('VnfInPlaceSoftwareUpdate','Activity InPlace Software Update on VNF',1.0);
+
+INSERT INTO activity_spec_categories (NAME)
+VALUES ('VNF');
+
+INSERT INTO activity_spec_to_activity_spec_categories(ACTIVITY_SPEC_ID, ACTIVITY_SPEC_CATEGORIES_ID)
+VALUES
+((select ID from activity_spec where NAME='VNFSetInMaintFlagActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='VNFCheckPserversLockedFlagActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='VNFCheckInMaintFlagActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='VNFCheckClosedLoopDisabledFlagActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='VNFSetClosedLoopDisabledFlagActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='VNFUnsetClosedLoopDisabledFlagActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='VNFLockActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='VNFUnlockActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='VNFStopActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='VNFStartActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='VNFSnapShotActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='FlowCompleteActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='PauseForManualTaskActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='DistributeTrafficActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='DistributeTrafficCheckActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='VNFHealthCheckActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='VNFQuiesceTrafficActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='VNFResumeTrafficActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='VNFUnsetInMaintFlagActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='VNFUpgradePostCheckActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='VNFUpgradePreCheckActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF')),
+((select ID from activity_spec where NAME='VnfInPlaceSoftwareUpdate' and VERSION=1.0),
+(select ID from activity_spec_categories where NAME='VNF'));
+
+INSERT INTO activity_spec_parameters (NAME, TYPE, DIRECTION, DESCRIPTION)
+VALUES('WorkflowException','WorkflowException','output','Description');
+
+INSERT INTO activity_spec_to_activity_spec_parameters( ACTIVITY_SPEC_ID, ACTIVITY_SPEC_PARAMETERS_ID)
+VALUES
+((select ID from activity_spec where NAME='VNFSetInMaintFlagActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='VNFCheckPserversLockedFlagActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='VNFCheckInMaintFlagActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='VNFCheckClosedLoopDisabledFlagActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='VNFSetClosedLoopDisabledFlagActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='VNFUnsetClosedLoopDisabledFlagActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='VNFLockActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='VNFUnlockActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='VNFStopActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='VNFStartActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='VNFSnapShotActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='FlowCompleteActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='PauseForManualTaskActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='DistributeTrafficActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='DistributeTrafficCheckActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='VNFHealthCheckActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='VNFQuiesceTrafficActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='VNFResumeTrafficActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='VNFUnsetInMaintFlagActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='VNFUpgradePostCheckActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='VNFUpgradePreCheckActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')),
+((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0),
+(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output'));
+
+INSERT INTO `user_parameters`(`NAME`,`PAYLOAD_LOCATION`,`LABEL`,`TYPE`,`DESCRIPTION`,`IS_REQUIRED`,`MAX_LENGTH`,`ALLOWABLE_CHARS`)
+VALUES
+('cloudOwner','cloudConfiguration','Cloud Owner','text','',1,7,''),
+('operations_timeout','userParams','Operations Timeout','text','',1,50,''),
+('existing_software_version','userParams','Existing Software Version','text','',1,50,''),
+('tenantId','cloudConfiguration','Tenant/Project ID','text','',1,36,''),
+('new_software_version','userParams','New Software Version','text','',1,50,''),
+('lcpCloudRegionId','cloudConfiguration','Cloud Region ID','text','',1,7,'');
+
+INSERT INTO `activity_spec_to_user_parameters`(`ACTIVITY_SPEC_ID`,`USER_PARAMETERS_ID`)
+VALUES
+((select ID from activity_spec where NAME='VNFStopActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='lcpCloudRegionId')),
+((select ID from activity_spec where NAME='VNFStopActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='tenantId')),
+((select ID from activity_spec where NAME='VNFStartActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='lcpCloudRegionId')),
+((select ID from activity_spec where NAME='VNFStartActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='tenantId')),
+((select ID from activity_spec where NAME='VNFSnapShotActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='lcpCloudRegionId')),
+((select ID from activity_spec where NAME='VNFSnapShotActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='tenantId')),
+((select ID from activity_spec where NAME='VNFQuiesceTrafficActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='operations_timeout')),
+((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='existing_software_version')),
+((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='new_software_version')),
+((select ID from activity_spec where NAME='VNFUpgradePostCheckActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='existing_software_version')),
+((select ID from activity_spec where NAME='VNFUpgradePostCheckActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='new_software_version')),
+((select ID from activity_spec where NAME='VNFUpgradePreCheckActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='existing_software_version')),
+((select ID from activity_spec where NAME='VNFUpgradePreCheckActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='new_software_version')),
+((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='existing_software_version')),
+((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='new_software_version'));
+
--------START Request DB INSERTS --------
insert into requestdb.watchdog_distributionid_status(DISTRIBUTION_ID, DISTRIBUTION_ID_STATUS,LOCK_VERSION) values
@@ -61,4 +251,4 @@ insert into requestdb.watchdog_per_component_distribution_status(DISTRIBUTION_ID
insert into requestdb.watchdog_service_mod_ver_id_lookup(DISTRIBUTION_ID, SERVICE_MODEL_VERSION_ID, DISTRIBUTION_NOTIFICATION, CONSUMER_ID) values
('watchdogTestStatusSuccess', '5df8b6de-2083-11e7-93ae-92361f002671', NULL, NULL),
-('watchdogTestStatusNull', '00000000-0000-0000-0000-000000000000', NULL, NULL);
+('watchdogTestStatusNull', '00000000-0000-0000-0000-000000000000', NULL, NULL); \ No newline at end of file
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index 0b48b2e35f..8cc5ee9d49 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -283,6 +283,7 @@ DROP TABLE IF EXISTS `configuration_customization`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `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,
@@ -291,27 +292,18 @@ CREATE TABLE `configuration_customization` (
`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`),
- 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`)
+ `CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_ID` int(11) DEFAULT NULL,
+ `SERVICE_MODEL_UUID` varchar(200),
+ PRIMARY KEY (`ID`),
+ KEY `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID`),
+ KEY `fk_configuration_customization__service_idx` (`SERVICE_MODEL_UUID`),
+ UNIQUE KEY `uk_configuration_customization` (`MODEL_CUSTOMIZATION_UUID` ASC, `SERVICE_MODEL_UUID` ASC),
+ CONSTRAINT `fk_configuration_customization__configuration1` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`)
+ REFERENCES `configuration` (`MODEL_UUID`)
+ ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_configuration_customization__service1` FOREIGN KEY (`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 */;
@@ -1204,9 +1196,10 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization` (
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`)
+ PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
CREATE TABLE IF NOT EXISTS `workflow` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ARTIFACT_UUID` varchar(200) NOT NULL,
@@ -1370,7 +1363,6 @@ ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;
-
--------START Request DB SCHEMA --------
CREATE DATABASE requestdb;
USE requestdb;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
index 29037980cc..2f898b6697 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
@@ -531,7 +531,7 @@ public class SniroHomingV2 {
si.setServiceInstanceId(identifierValue);
si.setOrchestrationStatus(OrchestrationStatus.CREATED);
cloud.setLcpCloudRegionId(assignmentsMap.get("cloudRegionId"));
- if (assignmentsMap.containsKey("vnfHostName")) {
+ if (assignmentsMap.containsKey("vnfHostName") && !assignmentsMap.get("vnfHostName").isEmpty()) {
logger.debug("Resources has been homed to a vnf");
GenericVnf vnf = setVnf(assignmentsMap);
vnf.setCloudRegion(cloud);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java
index da37be98b2..5da16f4326 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java
@@ -28,10 +28,12 @@ import javax.transaction.Transactional;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
+import org.onap.so.db.request.client.RequestsDbClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
@@ -52,6 +54,9 @@ public abstract class BaseTest {
protected Logger logger = LoggerFactory.getLogger(BaseTest.class);
protected TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
+ @SpyBean
+ protected RequestsDbClient requestsDbClient;
+
@Autowired
protected Environment env;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
index 1bb3932cff..db6273dc4a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
@@ -55,6 +55,7 @@ import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.Mockito;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceRecipe;
@@ -124,6 +125,7 @@ public class ServiceInstancesTest extends BaseTest {
}
wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests.*")).willReturn(aResponse()
.withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_OK)));
+ Mockito.doReturn(null).when(requestsDbClient).getInfraActiveRequestbyRequestId(Mockito.any());
}
public String inputStream(String JsonInput) throws IOException {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
index 2c03173b16..bc9003f5d0 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
@@ -283,6 +283,7 @@ DROP TABLE IF EXISTS `configuration_customization`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `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,
@@ -291,29 +292,20 @@ CREATE TABLE `configuration_customization` (
`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`),
- 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`)
+ `CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_ID` int(11) DEFAULT NULL,
+ `SERVICE_MODEL_UUID` varchar(200),
+ PRIMARY KEY (`ID`),
+ KEY `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID`),
+ KEY `fk_configuration_customization__service_idx` (`SERVICE_MODEL_UUID`),
+ UNIQUE KEY `uk_configuration_customization` (`MODEL_CUSTOMIZATION_UUID` ASC, `SERVICE_MODEL_UUID` ASC),
+ CONSTRAINT `fk_configuration_customization__configuration1` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`)
+ REFERENCES `configuration` (`MODEL_UUID`)
+ ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_configuration_customization__service1` FOREIGN KEY (`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 */;
+/*!40101 SET character_set_client = @saved_cs_client */;/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `controller_selection_reference`
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java
index 059935fff3..1117648a7f 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java
@@ -27,6 +27,8 @@ import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
@@ -52,8 +54,12 @@ public class ConfigurationResourceCustomization implements Serializable {
*/
private static final long serialVersionUID = 1230671937560638856L;
- @BusinessKey
@Id
+ @BusinessKey
+ @Column(name = "ID")
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Integer id;
+
@Column(name = "MODEL_CUSTOMIZATION_UUID")
private String modelCustomizationUUID;
@@ -77,18 +83,30 @@ public class ConfigurationResourceCustomization implements Serializable {
private String serviceProxyResourceCustomizationUUID;
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
- @JoinColumn(name = "CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID")
+ @JoinColumn(name = "CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_ID")
private ConfigurationResourceCustomization configResourceCustomization;
@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "CONFIGURATION_MODEL_UUID")
private ConfigurationResource configurationResource;
+ @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @JoinColumn(name = "SERVICE_MODEL_UUID")
+ private Service service;
+
@PrePersist
protected void onCreate() {
this.created = new Date();
}
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
public String getModelCustomizationUUID() {
return modelCustomizationUUID;
}
@@ -141,6 +159,7 @@ public class ConfigurationResourceCustomization implements Serializable {
this.serviceProxyResourceCustomizationUUID = serviceProxyResourceCustomizationUUID;
}
+
@LinkedResource
public ConfigurationResourceCustomization getConfigResourceCustomization() {
return configResourceCustomization;
@@ -159,14 +178,22 @@ public class ConfigurationResourceCustomization implements Serializable {
this.configurationResource = configurationResource;
}
+ public Service getService() {
+ return service;
+ }
+
+ public void setService(Service service) {
+ this.service = service;
+ }
+
@Override
public String toString() {
- return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
+ return new ToStringBuilder(this).append("id", id).append("modelCustomizationUUID", modelCustomizationUUID)
.append("modelInstanceName", modelInstanceName).append("nfFunction", nfFunction)
.append("nfType", nfType).append("nfRole", nfRole).append("created", created)
// .append("serviceProxyResourceCustomization", serviceProxyResourceCustomization)
.append("configResourceCustomization", configResourceCustomization)
- .append("configurationResource", configurationResource).toString();
+ .append("configurationResource", configurationResource).append("service", service).toString();
}
@Override
@@ -175,12 +202,12 @@ public class ConfigurationResourceCustomization implements Serializable {
return false;
}
ConfigurationResourceCustomization castOther = (ConfigurationResourceCustomization) other;
- return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
+ return new EqualsBuilder().append(id, castOther.id).isEquals();
}
@Override
public int hashCode() {
- return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
+ return new HashCodeBuilder().append(id).toHashCode();
}
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
index c333033ba2..ffcc8e9717 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
@@ -119,9 +119,7 @@ public class Service implements Serializable {
inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
private List<ServiceProxyResourceCustomization> serviceProxyCustomizations;
- @OneToMany(cascade = CascadeType.ALL)
- @JoinTable(name = "configuration_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"),
- inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "service")
private List<ConfigurationResourceCustomization> configurationCustomizations;
@OneToMany(cascade = CascadeType.ALL)
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ActivitySpecRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ActivitySpecRepository.java
new file mode 100644
index 0000000000..aa474238fd
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ActivitySpecRepository.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.data.repository;
+
+import org.onap.so.db.catalog.beans.ActivitySpec;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+@RepositoryRestResource(collectionResourceRel = "activitySpec", path = "activitySpec")
+public interface ActivitySpecRepository extends JpaRepository<ActivitySpec, String> {
+
+ ActivitySpec findByName(String name);
+
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ConfigurationResourceCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ConfigurationResourceCustomizationRepository.java
index 43104986ff..74c4c8cb04 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ConfigurationResourceCustomizationRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ConfigurationResourceCustomizationRepository.java
@@ -26,6 +26,6 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "configurationResourceCustomization",
path = "configurationResourceCustomization")
public interface ConfigurationResourceCustomizationRepository
- extends JpaRepository<ConfigurationResourceCustomization, String> {
+ extends JpaRepository<ConfigurationResourceCustomization, Integer> {
}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/ActivitySpecRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/ActivitySpecRepositoryTest.java
new file mode 100644
index 0000000000..024940f68d
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/ActivitySpecRepositoryTest.java
@@ -0,0 +1,35 @@
+/*
+ * ============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.db.catalog.data.repository;
+
+import java.util.List;
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.db.catalog.BaseTest;
+import org.onap.so.db.catalog.beans.ActivitySpec;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+
+public class ActivitySpecRepositoryTest extends BaseTest {
+
+ @Autowired
+ private ActivitySpecRepository activitySpecRepository;
+
+ @Test
+ public void findAllTest() throws Exception {
+ List<ActivitySpec> activitySpecList = activitySpecRepository.findAll();
+ Assert.assertFalse(CollectionUtils.isEmpty(activitySpecList));
+ }
+}
diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql
index 5e43f8f3e2..f5e7d52ba4 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -280,6 +280,7 @@ DROP TABLE IF EXISTS `configuration_customization`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `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,
@@ -288,27 +289,18 @@ CREATE TABLE `configuration_customization` (
`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`),
- 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`)
+ `CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_ID` int(11) DEFAULT NULL,
+ `SERVICE_MODEL_UUID` varchar(200),
+ PRIMARY KEY (`ID`),
+ KEY `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID`),
+ KEY `fk_configuration_customization__service_idx` (`SERVICE_MODEL_UUID`),
+ UNIQUE KEY `uk_configuration_customization` (`MODEL_CUSTOMIZATION_UUID` ASC, `SERVICE_MODEL_UUID` ASC),
+ CONSTRAINT `fk_configuration_customization__configuration1` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`)
+ REFERENCES `configuration` (`MODEL_UUID`)
+ ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_configuration_customization__service1` FOREIGN KEY (`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 */;