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