2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
20 package org.onap.dmaap.dbcapi.model;
22 import static org.junit.Assert.assertTrue;
24 import org.junit.After;
25 import org.junit.Before;
26 import org.junit.Test;
28 public class DmaapTest {
29 private String ver, tnr, dn, dpu, lu, bat, nk, ako;
32 public void setUp() throws Exception {
34 tnr = "org.onap.dmaap";
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";
44 public void tearDown() throws Exception {
49 public void testDmaapClassDefaultConstructor() {
51 Dmaap t = new Dmaap.DmaapBuilder().createDmaap();
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 );
65 public void testDmaapClassConstructor() {
67 Dmaap t = new Dmaap.DmaapBuilder().setVer(ver).setTnr(tnr).setDn(dn).setDpu(dpu).setLu(lu).setBat(bat).setNk(nk).setAko(ako).createDmaap();
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() ));
81 public void testDmaapClassSetters() {
83 Dmaap t = new Dmaap.DmaapBuilder().createDmaap();
86 assertTrue( ver.equals( t.getVersion() ));
87 t.setTopicNsRoot( tnr );
88 assertTrue( tnr.equals( t.getTopicNsRoot() ));
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() ));
98 assertTrue( nk.equals( t.getNodeKey() ));
99 t.setAccessKeyOwner( ako );
100 assertTrue( ako.equals( t.getAccessKeyOwner() ));