[DMAAP-BC] Consolidate bus controller repos
[dmaap/buscontroller.git] / dmaap-bc / src / test / java / org / onap / dmaap / dbcapi / model / DmaapTest.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.model;
21
22 import static org.junit.Assert.assertTrue;
23
24 import org.junit.After;
25 import org.junit.Before;
26 import org.junit.Test;
27
28 public class DmaapTest {
29         private String ver, tnr, dn, dpu, lu, bat, nk, ako;
30
31         @Before
32         public void setUp() throws Exception {
33                 ver = "1";
34                 tnr = "org.onap.dmaap";
35                 dn = "onap";
36                 dpu = "https://drps.dmaap.onap.org:8081";
37                 lu = "http://drps.dmaap.onap.org:8080/feedlog";
38                 bat = "org.onap.dcae.dmaap.MM_AGENT_TOPIC";
39                 nk = "foo";
40                 ako = "bar";
41         }
42
43         @After
44         public void tearDown() throws Exception {
45         }
46
47
48         @Test
49         public void testDmaapClassDefaultConstructor() {
50
51                 Dmaap t = new Dmaap.DmaapBuilder().createDmaap();
52         
53                 assertTrue( t.getVersion() == null  );
54                 assertTrue( t.getTopicNsRoot() == null  );
55                 assertTrue( t.getDmaapName() == null  );
56                 assertTrue( t.getDrProvUrl() == null  );
57                 assertTrue( t.getLoggingUrl() == null  );
58                 assertTrue( t.getBridgeAdminTopic() == null  );
59                 assertTrue( t.getNodeKey() == null  );
60                 assertTrue( t.getAccessKeyOwner() == null  );
61         
62         }
63
64         @Test
65         public void testDmaapClassConstructor() {
66
67                 Dmaap t = new Dmaap.DmaapBuilder().setVer(ver).setTnr(tnr).setDn(dn).setDpu(dpu).setLu(lu).setBat(bat).setNk(nk).setAko(ako).createDmaap();
68         
69                 assertTrue( ver.equals( t.getVersion() ));
70                 assertTrue( tnr.equals( t.getTopicNsRoot() ));
71                 assertTrue( dn.equals( t.getDmaapName() ));
72                 assertTrue( dpu.equals( t.getDrProvUrl() ));
73                 assertTrue( lu.equals( t.getLoggingUrl() ));
74                 assertTrue( bat.equals( t.getBridgeAdminTopic() ));
75                 assertTrue( nk.equals( t.getNodeKey() ));
76                 assertTrue( ako.equals( t.getAccessKeyOwner() ));
77         
78         }
79
80         @Test
81         public void testDmaapClassSetters() {
82
83                 Dmaap t = new Dmaap.DmaapBuilder().createDmaap();
84
85                 t.setVersion( ver );
86                 assertTrue( ver.equals( t.getVersion() ));
87                 t.setTopicNsRoot( tnr );
88                 assertTrue( tnr.equals( t.getTopicNsRoot() ));
89                 t.setDmaapName( dn );
90                 assertTrue( dn.equals( t.getDmaapName() ));
91                 t.setDrProvUrl( dpu );
92                 assertTrue( dpu.equals( t.getDrProvUrl() ));
93                 t.setLoggingUrl( lu );  
94                 assertTrue( lu.equals( t.getLoggingUrl() ));
95                 t.setBridgeAdminTopic( bat );
96                 assertTrue( bat.equals( t.getBridgeAdminTopic() ));
97                 t.setNodeKey( nk );
98                 assertTrue( nk.equals( t.getNodeKey() ));
99                 t.setAccessKeyOwner( ako );
100                 assertTrue( ako.equals( t.getAccessKeyOwner() ));
101         
102         }
103 }