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