Automated test coverage code
[dmaap/dbcapi.git] / src / test / java / org / onap / dmaap / dbcapi / model / DcaeLocationTest.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 DcaeLocationTest {
32         String c, dl, dln, osz, s, edge;
33
34         @Before
35         public void setUp() throws Exception {
36                 c = "ABCDE888NJ";
37                 dl = "central-node";
38                 edge = "local-node";
39                 dln = "hollywood";
40                 osz = "california";
41                 s = "10.10.10.1";
42         }
43
44         @After
45         public void tearDown() throws Exception {
46         }
47
48
49         @Test
50         public void testDcaeLocationDefaultConstructor() {
51
52                 DcaeLocation t = new DcaeLocation();
53         
54                 assertTrue( t.getClli() == null  );
55                 assertTrue( t.getDcaeLayer() == null  );
56                 assertTrue( t.getDcaeLocationName() == null  );
57                 assertTrue( t.getOpenStackAvailabilityZone() == null  );
58                 assertTrue( t.getSubnet() == null  );
59         
60         }
61
62         @Test
63         public void testDcaeLocationClassConstructor() {
64
65                 DcaeLocation t = new DcaeLocation( c, dl, dln, osz, s );
66         
67                 assertTrue( c.equals( t.getClli() ));
68                 assertTrue( dl.equals( t.getDcaeLayer() ));
69                 assertTrue( dln.equals( t.getDcaeLocationName() ));
70                 assertTrue( osz.equals( t.getOpenStackAvailabilityZone() ));
71                 assertTrue( s.equals( t.getSubnet() ));
72         }
73
74         @Test
75         public void testDmaapClassSetters() {
76
77                 DcaeLocation t = new DcaeLocation();
78
79                 t.setClli( c );
80                 assertTrue( c.equals( t.getClli() ));
81                 t.setDcaeLayer( dl );
82                 assertTrue( dl.equals( t.getDcaeLayer() ));
83                 assertTrue( t.isCentral() );
84                 t.setDcaeLayer( edge );
85                 assertTrue( edge.equals( t.getDcaeLayer() ));
86                 assertTrue( t.isLocal() );
87                 t.setDcaeLocationName( dln );
88                 assertTrue( dln.equals( t.getDcaeLocationName() ));
89                 t.setOpenStackAvailabilityZone( osz );
90                 assertTrue( osz.equals( t.getOpenStackAvailabilityZone() ));
91                 t.setSubnet( s );
92                 assertTrue( s.equals( t.getSubnet() ));
93         }
94 }