[DMAAP-BC] Fix failing jenkins
[dmaap/buscontroller.git] / dmaap-bc / src / test / java / org / onap / dmaap / dbcapi / util / GraphTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * org.onap.dmaap
4  * ================================================================================
5  * Copyright (C) 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.dmaap.dbcapi.util;
21
22 import java.util.ArrayList;
23 import java.util.Collection;
24 import java.util.HashMap;
25 import java.util.List;
26 import org.junit.Before;
27 import org.junit.Test;
28 import org.onap.dmaap.dbcapi.model.DcaeLocation;
29 import org.onap.dmaap.dbcapi.model.MR_Client;
30 import org.onap.dmaap.dbcapi.service.DcaeLocationService;
31 import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
32
33 public class GraphTest {
34
35         ReflectionHarness rh = new ReflectionHarness();
36
37         Graph g;
38
39         @Before
40         public void setUp() throws Exception {
41                 System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
42                 HashMap<String, String> hm = new HashMap<>();
43                 g = new Graph( hm );
44         }
45
46         @Test
47         public void test1() {
48                 rh.reflect( "org.onap.dmaap.dbcapi.util.Graph", "get", "idNotSet@namespaceNotSet:pwdNotSet" );
49         }
50
51         @Test
52         public void test3() {
53                 String loc = "central-onap";
54                 String[] actions = { "pub", "sub" };
55                 DcaeLocationService dls = new DcaeLocationService();
56                 DcaeLocation dl = new DcaeLocation( "CLLI123", "central-layer", loc, "aZone", "10.10.10.10" );
57                 dls.addDcaeLocation( dl );
58                 MR_Client mrc = new MR_Client();
59                 mrc.setAction( actions );
60                 List<MR_Client> cl = new ArrayList<MR_Client>();
61                 cl.add( mrc );
62                 cl.add( new MR_Client( loc, "aTopic", "ignore", actions ) );
63                 
64                 g = new Graph( cl, true );
65
66                 HashMap<String, String> hm = new HashMap<String, String>();
67
68                 String s = g.put( "aKey", "aVal" );
69                 s = g.get( "aKey" );
70
71                 s = g.getCentralLoc();          
72                 g.setHasCentral( true );
73                 g.hasCentral();
74
75                 hm = g.getGraph();
76
77                 Collection<String> k = g.getKeys();
78         }
79
80 }
81