2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.dmaap.datarouter.node;
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertFalse;
25 import static org.junit.Assert.assertNotEquals;
26 import static org.junit.Assert.assertTrue;
28 import org.junit.Before;
29 import org.junit.Test;
31 public class DestInfoTest {
33 private DestInfo destInfo;
37 destInfo = getDestInfo("/src/test/resources");
41 public void Validate_Getters_And_Setters() {
42 assertEquals("n:dmaap-dr-node", destInfo.getName());
43 assertEquals("/src/test/resources", destInfo.getSpool());
44 assertEquals("1", destInfo.getSubId());
45 assertEquals("n2n-dmaap-dr-node", destInfo.getLogData());
46 assertEquals("https://dmaap-dr-node:8443/internal/publish", destInfo.getURL());
47 assertEquals("dmaap-dr-node", destInfo.getAuthUser());
48 assertEquals("Auth", destInfo.getAuth());
49 assertFalse(destInfo.isMetaDataOnly());
50 assertTrue(destInfo.isUsing100());
51 assertFalse(destInfo.isPrivilegedSubscriber());
52 assertFalse(destInfo.isFollowRedirects());
53 assertFalse(destInfo.isDecompress());
57 public void Validate_DestInfo_Objects_Are_Equal() {
58 DestInfo destInfo2 = getDestInfo("/src/test/resources");
59 assertEquals(destInfo, destInfo2);
60 assertEquals(destInfo.hashCode(), destInfo2.hashCode());
64 public void Validate_DestInfo_Objects_Are_Not_Equal() {
65 DestInfo destInfo2 = getDestInfo("notEqual");
66 assertNotEquals(destInfo, destInfo2);
67 assertNotEquals(destInfo.hashCode(), destInfo2.hashCode());
70 private DestInfo getDestInfo(String spool) {
71 return new DestInfoBuilder().setName("n:" + "dmaap-dr-node").setSpool(spool)
72 .setSubid("1").setLogdata("n2n-dmaap-dr-node").setUrl("https://dmaap-dr-node:8443/internal/publish")
73 .setAuthuser("dmaap-dr-node").setAuthentication("Auth").setMetaonly(false).setUse100(true)
74 .setPrivilegedSubscriber(false).setFollowRedirects(false).setDecompress(false).createDestInfo();