aboutsummaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'mso-catalog-db/src/test')
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/ControllerSelectionReferenceTest.java80
-rw-r--r--mso-catalog-db/src/test/resources/data.sql6
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql13
3 files changed, 92 insertions, 7 deletions
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ControllerSelectionReferenceTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ControllerSelectionReferenceTest.java
new file mode 100644
index 0000000000..f793fd79e3
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ControllerSelectionReferenceTest.java
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.TestApplication;
+import org.onap.so.db.catalog.beans.ControllerSelectionReference;
+import org.onap.so.db.catalog.data.repository.ControllerSelectionReferenceRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class ControllerSelectionReferenceTest {
+
+ @Autowired
+ private ControllerSelectionReferenceRepository controllerSelectionReferenceRepository;
+
+
+ @Test
+ public void Find_ControllerNameByVnfType_Test() {
+ String vnfType = "vLoadBalancerMS/vLoadBalancerMS 0";
+ String controllerName = "APPC";
+ ControllerSelectionReference controller = controllerSelectionReferenceRepository.findControllerSelectionReferenceByVnfType(vnfType);
+ assertEquals(vnfType, controller.getVnfType());
+ assertEquals(controllerName, controller.getControllerName());
+ }
+
+ @Test
+ public void Find_ControllerNameByVnfTypeAndAction_Test() {
+ String vnfType = "vLoadBalancerMS/vLoadBalancerMS 0";
+ String controllerName = "APPC";
+ String actionCategory = "ConfigScaleOut";
+ ControllerSelectionReference controller =
+ controllerSelectionReferenceRepository.findControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, actionCategory);
+ assertEquals(vnfType, controller.getVnfType());
+ assertEquals(controllerName, controller.getControllerName());
+ assertEquals(actionCategory, controller.getActionCategory());
+ }
+
+ @Test
+ public final void controllerDataTest() {
+ ControllerSelectionReference controller = new ControllerSelectionReference();
+
+ controller.setVnfType("vnfType");
+ assertTrue(controller.getVnfType().equalsIgnoreCase("vnfType"));
+
+ controller.setControllerName("controllerName");
+ assertTrue(controller.getControllerName().equalsIgnoreCase("controllerName"));
+
+ controller.setActionCategory("actionCategory");
+ assertTrue(controller.getActionCategory().equalsIgnoreCase("actionCategory"));
+ }
+}
diff --git a/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql
index e16ca0fe8f..58bde0e532 100644
--- a/mso-catalog-db/src/test/resources/data.sql
+++ b/mso-catalog-db/src/test/resources/data.sql
@@ -642,9 +642,11 @@ VALUES
('CUSTOM', 'PENDING_DELETE', 'CUSTOM', 'CONTINUE'),
('CUSTOM', 'PRECREATED', 'CUSTOM', 'CONTINUE');
-
INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `VERSION`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', NULL, 'MSO_USER', '2018-07-17 14:05:08', '2018-07-17 14:05:08');
INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('MTN13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', 'admin', 'admin', 1, 'KEYSTONE', 'USERNAME_PASSWORD', 'MSO_USER', '2018-07-17 14:02:33', '2018-07-17 14:02:33');
-INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'mtn13', 'MTN13', '2.5', 'MDT13', 'mtn13', NULL, 'orchestrator', 'MSO_USER', '2018-07-17 14:06:28', '2018-07-17 14:06:28'); \ No newline at end of file
+INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'mtn13', 'MTN13', '2.5', 'MDT13', 'mtn13', NULL, 'orchestrator', 'MSO_USER', '2018-07-17 14:06:28', '2018-07-17 14:06:28');
+
+INSERT INTO `controller_selection_reference` (`VNF_TYPE`, `CONTROLLER_NAME`, `ACTION_CATEGORY`) VALUES
+('vLoadBalancerMS/vLoadBalancerMS 0', 'APPC', 'ConfigScaleOut');
diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql
index 8ff04ea038..8a4b1f2103 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -822,6 +822,13 @@ create table if not exists model (
FOREIGN KEY (`RECIPE`) REFERENCES `model_recipe` (`MODEL_ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+CREATE TABLE IF NOT EXISTS `controller_selection_reference` (
+ `VNF_TYPE` VARCHAR(50) NOT NULL,
+ `CONTROLLER_NAME` VARCHAR(100) NOT NULL,
+ `ACTION_CATEGORY` VARCHAR(15) NOT NULL,
+ PRIMARY KEY (`VNF_TYPE`, `CONTROLLER_NAME`, `ACTION_CATEGORY`)
+) ;
+
ALTER TABLE `vnf_recipe`
CHANGE COLUMN `VNF_TYPE` `NF_ROLE` VARCHAR(200) NULL DEFAULT NULL ;
@@ -841,7 +848,6 @@ CREATE TABLE IF NOT EXISTS `identity_services` (
PRIMARY KEY (`ID`)
) ;
-
CREATE TABLE IF NOT EXISTS `cloudify_managers` (
`ID` varchar(50) NOT NULL,
`CLOUDIFY_URL` varchar(200) DEFAULT NULL,
@@ -854,9 +860,6 @@ CREATE TABLE IF NOT EXISTS `cloudify_managers` (
PRIMARY KEY (`ID`)
) ;
-
-
-
CREATE TABLE IF NOT EXISTS `cloud_sites` (
`ID` varchar(50) NOT NULL,
`REGION_ID` varchar(11) DEFAULT NULL,
@@ -872,4 +875,4 @@ CREATE TABLE IF NOT EXISTS `cloud_sites` (
PRIMARY KEY (`ID`),
KEY `FK_cloud_sites_identity_services` (`IDENTITY_SERVICE_ID`),
CONSTRAINT `FK_cloud_sites_identity_services` FOREIGN KEY (`IDENTITY_SERVICE_ID`) REFERENCES `identity_services` (`ID`)
-) ; \ No newline at end of file
+) ;