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 DrProvConnectionTest {
36 private static final String fmt = "%24s: %s%n";
37 private static DmaapObjectFactory factory = new DmaapObjectFactory();
39 ReflectionHarness rh = new ReflectionHarness();
42 MR_ClusterService mcs;
46 public void setUp() throws Exception {
47 ns = new DrProvConnection();
51 public void tearDown() throws Exception {
59 rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.DrProvConnection", "get", "idNotSet@namespaceNotSet:pwdNotSet" );
65 String v = "Validate";
66 rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.DrProvConnection", "set", v );
72 String locname = "central-demo";
74 DcaeLocationService dls = new DcaeLocationService();
75 DcaeLocation loc = factory.genDcaeLocation( "central" );
76 dls.addDcaeLocation( loc );
78 ApiError err = new ApiError();
79 String[] hl = { "host1", "host2", "host3" };
80 ns.makeFeedConnection( );
81 ns.makeFeedConnection( "01" );
82 ns.makeSubPostConnection( "part0/part1/part2/part3/part4" );
83 ns.makeSubPutConnection( "44" );
84 ns.makeIngressConnection( "01", "aUser", "10.10.10.10", "aNode" );
85 ns.makeEgressConnection( "01", "aNode" );
86 ns.makeNodesConnection( "someVar" );
87 Feed feed = new Feed( "dgl feed 1" ,
89 "dgl feed 1 for testing",
93 ArrayList<DR_Pub> pubs = new ArrayList<DR_Pub>();
94 pubs.add( new DR_Pub( "central-demo" ) );
97 String resp = ns.doPostFeed( feed, err );
98 resp = ns.doPutFeed( feed, err );
99 resp = ns.doDeleteFeed( feed, err );
101 int i = ns.doXgressPost( err );
103 DR_Sub sub = factory.genDrSub( "central", feed.getFeedId() );
104 assertTrue( sub != null );
105 String sr = ns.doPostDr_Sub( sub, err );
108 - create a new DR_Sub based on a simulated response
109 - update using ns.doPutDr_Sub( sub, err );
114 public void test4() {
115 ApiError err = new ApiError();
116 String resp = ns.doGetNodes( err );
117 ns.makeNodesConnection( "someVar", "host1|host2" );
118 resp = ns.doPutNodes( err );
120 InputStream is = new FileInputStream( "./etc/dmaapbc.properties" );
121 String body = ns.bodyToString( is );
122 } catch ( FileNotFoundException fnfe ) {