2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.aai.dbgraphmap;
23 import static org.junit.Assert.assertEquals;
25 import org.junit.Ignore;
26 import org.junit.Rule;
27 import org.junit.Test;
28 import org.junit.rules.ExpectedException;
30 import org.onap.aai.exceptions.AAIException;
33 public class SearchGraphEdgeRuleTest {
35 public ExpectedException expectedEx = ExpectedException.none();
38 public void getEdgeLabelTest() throws AAIException {
39 String[] label = SearchGraph.getEdgeLabel("customer", "service-subscription");
41 assertEquals("subscribesTo", label[0]);
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);
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);