aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/test
diff options
context:
space:
mode:
authorzm330 <zhangminyj@chinamobile.com>2020-03-02 00:41:19 +0800
committerzm330 <zhangminyj@chinamobile.com>2020-03-02 14:52:41 +0800
commit1e0bac83b2d1ee5c66a476f85ee2cbc0fd2ec2bb (patch)
tree84cd2bee176f25b85f954ec7c43d1475a9e663f1 /asdc-controller/src/test
parentab9eb6aba42457ed9adb21d7239c7729bb26bd15 (diff)
Add Query ServiceProxyCustomization
Issue-ID: SO-2368 Signed-off-by: zm330 <zhangminyj@chinamobile.com> Change-Id: I12fc81ea5f0fc3975b5913b56b48ecb4cb3ebff5
Diffstat (limited to 'asdc-controller/src/test')
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java22
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingVisitorImpl.java4
-rw-r--r--asdc-controller/src/test/resources/schema.sql28
3 files changed, 37 insertions, 17 deletions
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 c25c4c2828..b8a2d01b49 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
@@ -75,19 +75,8 @@ import org.onap.so.asdc.installer.ToscaResourceStructure;
import org.onap.so.asdc.installer.VfModuleStructure;
import org.onap.so.asdc.installer.VfResourceStructure;
import org.onap.so.asdc.installer.bpmn.WorkflowResource;
-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.beans.ToscaCsar;
-import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
-import org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.InstanceGroupRepository;
-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.VFModuleRepository;
-import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
-import org.onap.so.db.catalog.data.repository.VnfcInstanceGroupCustomizationRepository;
+import org.onap.so.db.catalog.beans.*;
+import org.onap.so.db.catalog.data.repository.*;
import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
import org.springframework.beans.factory.annotation.Autowired;
@@ -325,8 +314,6 @@ public class ToscaResourceInstallerTest extends BaseTest {
notificationData.setServiceUUID("serviceUUID1");
notificationData.setWorkloadContext("workloadContext1");
-
-
String serviceType = "test-type1";
String serviceRole = "test-role1";
String category = "Network L3+";
@@ -356,6 +343,7 @@ public class ToscaResourceInstallerTest extends BaseTest {
doReturn(resourceCustomizationUUID).when(metadata).getValue("vfModuleModelCustomizationUUID");
ServiceRepository serviceRepo = spy(ServiceRepository.class);
+ ServiceInfoRepository serviceInfoRepo = spy(ServiceInfoRepository.class);
VnfResourceRepository vnfRepo = spy(VnfResourceRepository.class);
doReturn(null).when(vnfRepo).findResourceByModelUUID(uuid);
@@ -366,6 +354,7 @@ public class ToscaResourceInstallerTest extends BaseTest {
WorkflowResource workflowResource = spy(WorkflowResource.class);
ReflectionTestUtils.setField(toscaInstaller, "serviceRepo", serviceRepo);
+ ReflectionTestUtils.setField(toscaInstaller, "serviceInfoRepository", serviceInfoRepo);
ReflectionTestUtils.setField(toscaInstaller, "vnfRepo", vnfRepo);
ReflectionTestUtils.setField(toscaInstaller, "vfModuleRepo", vfModuleRepo);
ReflectionTestUtils.setField(toscaInstaller, "instanceGroupRepo", instanceGroupRepo);
@@ -436,7 +425,10 @@ public class ToscaResourceInstallerTest extends BaseTest {
assertNotNull(service);
service.setModelVersion("1.0");
+ ServiceInfo serviceInfo = new ServiceInfo();
+ serviceInfo.setService(service);
doReturn(service).when(serviceRepo).save(service);
+ doReturn(serviceInfo).when(serviceInfoRepo).save(any(ServiceInfo.class));
WatchdogComponentDistributionStatusRepository watchdogCDStatusRepository =
spy(WatchdogComponentDistributionStatusRepository.class);
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 53d163a5bc..02c0f2dbf7 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
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index 0821ebc97c..d051d1a56c 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -1378,6 +1378,34 @@ CREATE TABLE IF NOT EXISTS `activity_spec_to_user_parameters` (
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;
+CREATE TABLE IF NOT EXISTS `service_info` (
+ `ID` int (11) AUTO_INCREMENT,
+ `SERVICE_INPUT` varchar (5000),
+ `SERVICE_PROPERTIES` varchar (5000),
+ PRIMARY KEY (`ID`)
+)ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE IF NOT EXISTS `service_artifact`(
+ `ARTIFACT_UUID` varchar (200) NOT NULL,
+ `TYPE` varchar (200) NOT NULL,
+ `NAME` varchar (200) NOT NULL,
+ `VERSION` varchar (200) NOT NULL,
+ `DESCRIPTION` varchar (200) DEFAULT NULL,
+ `CONTENT` LONGTEXT DEFAULT NULL,
+ `CHECKSUM` varchar (200) DEFAULT NULL,
+ `CREATION_TIMESTAMP` DATETIME DEFAULT CURRENT_TIMESTAMP,
+ `SERVICE_MODEL_UUID` varchar (200) NOT NULL,
+ PRIMARY KEY (`ARTIFACT_UUID`),
+ CONSTRAINT `fk_service_artifact_service_info1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
+)ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE IF NOT EXISTS `service_to_service_info` (
+ `SERVICE_MODEL_UUID` varchar (200) NOT NULL,
+ `SERVICE_INFO_ID` INT (11) NOT NULL,
+ PRIMARY KEY (`SERVICE_MODEL_UUID`,`SERVICE_INFO_ID`),
+ CONSTRAINT `fk_service_to_service_info__service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_service_to_service_info__service_info1` FOREIGN KEY (`SERVICE_INFO_ID`) REFERENCES `service_info` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE
+)ENGINE=InnoDB DEFAULT CHARSET=latin1;
--------START Request DB SCHEMA --------
CREATE DATABASE requestdb;