[DMAAP-BC] Consolidate bus controller repos
[dmaap/buscontroller.git] / dmaap-bc / src / test / java / org / onap / dmaap / dbcapi / service / MR_ClusterServiceTest.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.service;
21
22 import  org.onap.dmaap.dbcapi.model.*;
23 import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
24
25 import static org.junit.Assert.*;
26
27 import org.junit.After;
28 import org.junit.Before;
29 import org.junit.Test;
30 import java.util.List;
31
32 public class MR_ClusterServiceTest {
33
34         private static final String  fmt = "%24s: %s%n";
35
36         ReflectionHarness rh = new ReflectionHarness();
37
38         MR_ClusterService ns;
39
40         @Before
41         public void setUp() throws Exception {
42                 ns = new MR_ClusterService();
43         }
44
45         @After
46         public void tearDown() throws Exception {
47         }
48
49
50         @Test
51         public void test1() {
52
53
54                 rh.reflect( "org.onap.dmaap.dbcapi.service.MR_ClusterService", "get", null );   
55         
56         }
57
58         @Test
59         public void test2() {
60                 String v = "Validate";
61                 rh.reflect( "org.onap.dmaap.dbcapi.service.MR_ClusterService", "set", v );
62
63         }
64
65         @Test
66         public void test3() {
67                 String f = "mrsn01.onap.org";
68                 String locname = "central-demo";
69
70                 DcaeLocationService dls = new DcaeLocationService();
71                 DcaeLocation loc = new DcaeLocation( "CLLI1234", "some-onap", locname, "aZone", "10.10.10.0/24" );
72                 dls.addDcaeLocation( loc );
73
74                 ApiError err = new ApiError();
75                 String[] h = { "zplvm009.onap.org", "zplvm007.onap.org", "zplvm008.onap.org" };
76                 MR_Cluster node = new MR_Cluster( locname, f,  "http", "3904");
77                 MR_Cluster n2 = ns.addMr_Cluster( node, err );  
78
79                 if ( n2 != null ) {
80                         n2 = ns.getMr_Cluster( f,  err );
81                 }
82
83                 List<MR_Cluster> l = ns.getAllMr_Clusters();
84                 if ( n2 != null ) {
85                         n2 = ns.updateMr_Cluster( n2, err );
86                 }
87
88                 n2 = ns.removeMr_Cluster( f,  err );
89                                 
90
91         }
92
93 /*
94         @Test
95         public void test4() {
96                 List<MR_Client> l = cls.getAllMr_Clients();
97
98                 ArrayList<MR_Client> al = cls.getAllMrClients( "foo" );
99
100                 ArrayList<MR_Client> al2 = cls.getClientsByLocation( "central" );
101         }
102
103         @Test
104         public void test5() {
105                 Topic topic = new Topic();
106                 ApiError err = new ApiError();
107                 topic.setTopicName( "test3" );
108                 topic.setFqtnStyle( FqtnType.Validator("none") );
109                 topic.getFqtn();
110                 Topic nTopic = ts.addTopic( topic, err );
111                 if ( nTopic != null ) {
112                         assertTrue( nTopic.getTopicName().equals( topic.getTopicName() ));
113                 }
114                 String[] actions = { "pub", "view" };
115                 MR_Client c = new MR_Client( "central-onap", "org.onap.dmaap.demo.interestingTopic2", "org.onap.clientApp.publisher", actions );
116
117                 c = cls.addMr_Client( c, topic, err );
118                 if ( c != null ) {
119                                 actions[0] = "sub";
120                                 c.setAction( actions );
121                                 c = cls.updateMr_Client( c, err );
122                                 assertTrue( err.getCode() == 200 );
123                 }
124         }
125 */
126
127 }