[DMAAP-BC] Fix failing jenkins
[dmaap/buscontroller.git] / dmaap-bc / src / test / java / org / onap / dmaap / dbcapi / client / MrProvConnectionTest.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.client;
21
22 import java.io.File;
23 import java.io.FileInputStream;
24 import java.io.FileNotFoundException;
25 import java.io.InputStream;
26 import org.junit.After;
27 import org.junit.Before;
28 import org.junit.Test;
29 import org.onap.dmaap.dbcapi.model.ApiError;
30 import org.onap.dmaap.dbcapi.model.DcaeLocation;
31 import org.onap.dmaap.dbcapi.model.MR_Cluster;
32 import org.onap.dmaap.dbcapi.model.Topic;
33 import org.onap.dmaap.dbcapi.service.DcaeLocationService;
34 import org.onap.dmaap.dbcapi.service.MR_ClusterService;
35 import org.onap.dmaap.dbcapi.service.TopicService;
36 import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
37
38 public class MrProvConnectionTest {
39
40         private static final String  fmt = "%24s: %s%n";
41
42         ReflectionHarness rh = new ReflectionHarness();
43
44         MrProvConnection ns;
45         MR_ClusterService mcs;
46         TopicService ts;
47
48         @Before
49         public void setUp() throws Exception {
50                 System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
51                 ns = new MrProvConnection();
52                 ts = new TopicService();
53                 mcs = new MR_ClusterService();
54         }
55
56         @After
57         public void tearDown() throws Exception {
58         }
59
60
61         @Test
62         public void test1() {
63
64
65                 rh.reflect( "org.onap.dmaap.dbcapi.client.MrProvConnection", "get", "idNotSet@namespaceNotSet:pwdNotSet" );
66         
67         }
68
69         @Test
70         public void test2() {
71                 String v = "Validate";
72                 rh.reflect( "org.onap.dmaap.dbcapi.client.MrProvConnection", "set", v );
73
74         }
75
76         @Test
77         public void test3() {
78                 String locname = "central-demo";
79
80                 DcaeLocationService dls = new DcaeLocationService();
81                 DcaeLocation loc = new DcaeLocation( "CLLI1234", "central-onap", locname, "aZone", "10.10.10.0/24" );
82                 dls.addDcaeLocation( loc );
83
84                 ApiError err = new ApiError();
85                 
86                 MR_Cluster cluster = new MR_Cluster( locname, "localhost", "http", "3904" );
87                 mcs.addMr_Cluster( cluster, err );
88                 ns.makeTopicConnection( cluster );
89                 Topic topic = new Topic();
90                 topic.setTopicName( "test5" );
91                 String resp = ns.doPostTopic( topic, err );
92
93                 try {
94                         InputStream is = new FileInputStream(new File("/src/test/resources/dmaapbc.properties"));
95                         String body = ns.bodyToString( is );
96                 } catch ( FileNotFoundException fnfe ) {
97                 }
98
99         }
100
101
102
103 }
104