including missing files
[dmaap/dbcapi.git] / src / test / java / org / onap / dmaap / dbcapi / aaf / client / MrTopicConnectionTest.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.aaf.client;
21 import org.onap.dmaap.dbcapi.model.*;
22 import org.onap.dmaap.dbcapi.service.*;
23 import static org.junit.Assert.*;
24
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;
33
34 public class MrTopicConnectionTest {
35
36         private static final String  fmt = "%24s: %s%n";
37
38         ReflectionHarness rh = new ReflectionHarness();
39
40         MrTopicConnection ns;
41         MR_ClusterService mcs;
42         TopicService ts;
43
44         @Before
45         public void setUp() throws Exception {
46                 ns = new MrTopicConnection( "aUser", "aPwd" );
47                 ts = new TopicService();
48                 mcs = new MR_ClusterService();
49         }
50
51         @After
52         public void tearDown() throws Exception {
53         }
54
55
56         @Test
57         public void test1() {
58
59
60                 rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.MrTopicConnection", "get", "idNotSet@namespaceNotSet:pwdNotSet" );        
61         
62         }
63
64         @Test
65         public void test2() {
66                 String v = "Validate";
67                 rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.MrTopicConnection", "set", v );
68
69         }
70
71         @Test
72         public void test3() {
73                 String locname = "central-demo";
74
75                 DcaeLocationService dls = new DcaeLocationService();
76                 DcaeLocation loc = new DcaeLocation( "CLLI1234", "central-onap", locname, "aZone", "10.10.10.0/24" );
77                 dls.addDcaeLocation( loc );
78
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 );
86
87                 try {
88                         InputStream is = new FileInputStream( "./etc/dmaapbc.properties" );                             
89                         String body = ns.bodyToString( is );
90                 } catch ( FileNotFoundException fnfe ) {
91                 }
92
93         }
94
95
96
97 }
98