Created Ref Data tbl for controllerSelection

RD: I rebased this and fixed the unit tests.

Issue-ID: SO-763
Change-Id: Ie5f6a708cffbc70a9481afd35db3047fe44cb088
Signed-off-by: Prema Bhatt <pb6115@att.com>
Signed-off-by: Rob Daugherty <rd472p@att.com>
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 0000000..f793fd7
--- /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 e16ca0f..58bde0e 100644
--- a/mso-catalog-db/src/test/resources/data.sql
+++ b/mso-catalog-db/src/test/resources/data.sql
@@ -642,9 +642,11 @@
 ('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 8ff04ea..8a4b1f2 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -822,6 +822,13 @@
 	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 @@
   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 @@
   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 @@
   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
+) ;