Created Ref Data tbl for controllerSelection
[so.git] / mso-catalog-db / src / test / java / org / onap / so / db / catalog / ControllerSelectionReferenceTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.so.db.catalog;
22
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertTrue;
25
26 import org.junit.Ignore;
27 import org.junit.Test;
28 import org.junit.runner.RunWith;
29 import org.onap.so.TestApplication;
30 import org.onap.so.db.catalog.beans.ControllerSelectionReference;
31 import org.onap.so.db.catalog.data.repository.ControllerSelectionReferenceRepository;
32 import org.springframework.beans.factory.annotation.Autowired;
33 import org.springframework.boot.test.context.SpringBootTest;
34 import org.springframework.test.context.ActiveProfiles;
35 import org.springframework.test.context.junit4.SpringRunner;
36
37 @RunWith(SpringRunner.class)
38 @SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
39 @ActiveProfiles("test")
40 public class ControllerSelectionReferenceTest {
41
42         @Autowired
43         private ControllerSelectionReferenceRepository controllerSelectionReferenceRepository;
44         
45         
46         @Test
47         public void Find_ControllerNameByVnfType_Test() {
48                 String vnfType = "vLoadBalancerMS/vLoadBalancerMS 0";
49                 String controllerName = "APPC";
50                 ControllerSelectionReference controller = controllerSelectionReferenceRepository.findControllerSelectionReferenceByVnfType(vnfType);
51                 assertEquals(vnfType, controller.getVnfType());
52                 assertEquals(controllerName, controller.getControllerName());
53         }
54         
55         @Test
56         public void Find_ControllerNameByVnfTypeAndAction_Test() {
57                 String vnfType = "vLoadBalancerMS/vLoadBalancerMS 0";
58                 String controllerName = "APPC";
59                 String actionCategory = "ConfigScaleOut";
60                 ControllerSelectionReference controller = 
61                                 controllerSelectionReferenceRepository.findControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, actionCategory);
62                 assertEquals(vnfType, controller.getVnfType());
63                 assertEquals(controllerName, controller.getControllerName());
64                 assertEquals(actionCategory, controller.getActionCategory());
65         }
66         
67         @Test
68         public final void controllerDataTest() {
69                 ControllerSelectionReference controller = new ControllerSelectionReference();
70
71                 controller.setVnfType("vnfType");
72                 assertTrue(controller.getVnfType().equalsIgnoreCase("vnfType"));
73
74                 controller.setControllerName("controllerName");
75                 assertTrue(controller.getControllerName().equalsIgnoreCase("controllerName"));
76
77                 controller.setActionCategory("actionCategory");
78                 assertTrue(controller.getActionCategory().equalsIgnoreCase("actionCategory"));
79         }
80 }