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.aaf.client;
21 import org.onap.dmaap.dbcapi.model.*;
22 import org.onap.dmaap.dbcapi.service.*;
23 import static org.junit.Assert.*;
25 import org.junit.After;
26 import org.junit.Before;
27 import org.junit.Test;
28 import java.util.List;
29 import java.util.ArrayList;
30 import java.io.InputStream;
31 import java.io.FileInputStream;
32 import java.io.FileNotFoundException;
34 public class MrTopicConnectionTest {
36 private static final String fmt = "%24s: %s%n";
38 ReflectionHarness rh = new ReflectionHarness();
41 MR_ClusterService mcs;
45 public void setUp() throws Exception {
46 ns = new MrTopicConnection( "aUser", "aPwd" );
47 ts = new TopicService();
48 mcs = new MR_ClusterService();
52 public void tearDown() throws Exception {
60 rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.MrTopicConnection", "get", "idNotSet@namespaceNotSet:pwdNotSet" );
66 String v = "Validate";
67 rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.MrTopicConnection", "set", v );
73 String locname = "central-demo";
75 DcaeLocationService dls = new DcaeLocationService();
76 DcaeLocation loc = new DcaeLocation( "CLLI1234", "central-onap", locname, "aZone", "10.10.10.0/24" );
77 dls.addDcaeLocation( loc );
79 ApiError err = new ApiError();
80 String[] hl = { "host1", "host2", "host3" };
81 MR_Cluster cluster = new MR_Cluster( locname, "localhost", "", hl );
82 mcs.addMr_Cluster( cluster, err );
83 ns.makeTopicConnection( cluster, "org.onap.dmaap.anInterestingTopic", "" );
84 String msg = "{ 'key': '1234', 'val': 'hello world' }";
85 ApiError e2 = ns.doPostMessage( msg );
88 InputStream is = new FileInputStream( "./etc/dmaapbc.properties" );
89 String body = ns.bodyToString( is );
90 } catch ( FileNotFoundException fnfe ) {