[DMAAP-BC] Fix failing jenkins
[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 java.util.List;
23 import org.junit.Before;
24 import org.junit.Test;
25 import org.onap.dmaap.dbcapi.model.ApiError;
26 import org.onap.dmaap.dbcapi.model.DcaeLocation;
27 import org.onap.dmaap.dbcapi.model.MR_Cluster;
28 import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
29
30 public class MR_ClusterServiceTest {
31
32         ReflectionHarness rh = new ReflectionHarness();
33
34         MR_ClusterService ns;
35
36         @Before
37         public void setUp() throws Exception {
38                 System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
39                 ns = new MR_ClusterService();
40         }
41
42         @Test
43         public void test1() {
44                 rh.reflect( "org.onap.dmaap.dbcapi.service.MR_ClusterService", "get", null );
45         }
46
47         @Test
48         public void test2() {
49                 String v = "Validate";
50                 rh.reflect( "org.onap.dmaap.dbcapi.service.MR_ClusterService", "set", v );
51         }
52
53         @Test
54         public void test3() {
55                 String f = "mrsn01.onap.org";
56                 String locname = "central-demo";
57
58                 DcaeLocationService dls = new DcaeLocationService();
59                 DcaeLocation loc = new DcaeLocation( "CLLI1234", "some-onap", locname, "aZone", "10.10.10.0/24" );
60                 dls.addDcaeLocation( loc );
61
62                 ApiError err = new ApiError();
63                 String[] h = { "zplvm009.onap.org", "zplvm007.onap.org", "zplvm008.onap.org" };
64                 MR_Cluster node = new MR_Cluster( locname, f,  "http", "3904");
65                 MR_Cluster n2 = ns.addMr_Cluster( node, err );  
66
67                 if ( n2 != null ) {
68                         n2 = ns.getMr_Cluster( f,  err );
69                 }
70
71                 List<MR_Cluster> l = ns.getAllMr_Clusters();
72                 if ( n2 != null ) {
73                         n2 = ns.updateMr_Cluster( n2, err );
74                 }
75                 n2 = ns.removeMr_Cluster( f,  err );
76         }
77
78 }