Update the license for 2017-2018 license
[aai/traversal.git] / aai-traversal / src / test / java / org / onap / aai / dbgraphmap / SearchGraphEdgeRuleTest.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017-2018 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 package org.onap.aai.dbgraphmap;
21
22 import static org.junit.Assert.assertEquals;
23
24 import org.junit.Ignore;
25 import org.junit.Rule;
26 import org.junit.Test;
27 import org.junit.rules.ExpectedException;
28
29 import org.onap.aai.exceptions.AAIException;
30
31 @Ignore
32 public class SearchGraphEdgeRuleTest {
33         @Rule
34         public ExpectedException expectedEx = ExpectedException.none();
35         
36         @Test
37         public void getEdgeLabelTest() throws AAIException {
38                 String[] label = SearchGraph.getEdgeLabel("customer", "service-subscription");
39                 
40                 assertEquals("subscribesTo", label[0]);
41         }
42         
43         @Test
44         public void getEdgeLabelThrowsExceptionWhenNoRuleExists() throws Exception {
45                 String nodeTypeA = "complex";
46                 String nodeTypeB = "service";
47                 expectedEx.expect(AAIException.class);
48                 expectedEx.expectMessage("No EdgeRule found for passed nodeTypes: complex, service.");
49             SearchGraph.getEdgeLabel(nodeTypeA, nodeTypeB);
50         }
51         
52         @Test
53         public void getEdgeLabelThrowsExceptionWhenNodeTypesDoNotExist() throws Exception {
54                 String nodeTypeA = "A";
55                 String nodeTypeB = "B";
56                 expectedEx.expect(AAIException.class);
57             expectedEx.expectMessage("No EdgeRule found for passed nodeTypes: A, B.");
58             SearchGraph.getEdgeLabel(nodeTypeA, nodeTypeB);    
59         }
60 }