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