2 * ============LICENSE_START=======================================================
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
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=========================================================
20 package org.onap.dmaap.dbcapi.util;
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;
33 public class GraphTest {
35 ReflectionHarness rh = new ReflectionHarness();
40 public void setUp() throws Exception {
41 System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
42 HashMap<String, String> hm = new HashMap<>();
48 rh.reflect( "org.onap.dmaap.dbcapi.util.Graph", "get", "idNotSet@namespaceNotSet:pwdNotSet" );
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>();
62 cl.add( new MR_Client( loc, "aTopic", "ignore", actions ) );
64 g = new Graph( cl, true );
66 HashMap<String, String> hm = new HashMap<String, String>();
68 String s = g.put( "aKey", "aVal" );
71 s = g.getCentralLoc();
72 g.setHasCentral( true );
77 Collection<String> k = g.getKeys();