1 /*******************************************************************************
2 * ============LICENSE_START==================================================
4 * * ===========================================================================
5 * * Copyright © 2017 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 * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 ******************************************************************************/
24 package org.onap.dmaap.datarouter.provisioning.beans;
26 import org.junit.Assert;
27 import org.junit.Test;
28 import org.junit.runner.RunWith;
29 import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
30 import org.powermock.modules.junit4.PowerMockRunner;
33 @RunWith(PowerMockRunner.class)
34 @SuppressStaticInitializationFor({"org.onap.dmaap.datarouter.provisioning.beans.Subscription"})
35 public class SubscriptionTest {
37 private Subscription subscription;
40 public void validate_Subscription_Created_With_Default_Constructor() {
41 subscription = new Subscription();
42 Assert.assertEquals(subscription.getSubid(), -1);
43 Assert.assertEquals(subscription.getGroupid(), -1);
44 Assert.assertEquals(subscription.getSubscriber(), "");
48 public void validate_Getters_And_Setters() {
49 String url = "1.2.3.4";
50 String user = "myUser";
51 String password = "myPass";
52 String subscriber = "mySubscriber";
53 SubDelivery subDelivery = new SubDelivery(url, user, password, false);
54 SubLinks subLinks = new SubLinks();
55 subLinks.setFeed("feed");
56 subLinks.setLog("log");
57 subLinks.setSelf("self");
59 subscription = new Subscription();
60 subscription.setGroupid(2);
61 subscription.setDelivery(subDelivery);
62 subscription.setMetadataOnly(false);
63 subscription.setSubscriber(subscriber);
64 subscription.setSuspended(false);
65 subscription.setPrivilegedSubscriber(false);
66 subscription.setLinks(subLinks);
67 subscription.setDecompress(false);
69 Assert.assertEquals(2, subscription.getGroupid());
70 Assert.assertEquals(subDelivery, subscription.getDelivery());
71 Assert.assertEquals(subLinks, subscription.getLinks());
72 Assert.assertFalse(subscription.isMetadataOnly());
73 Assert.assertFalse(subscription.isSuspended());
74 Assert.assertFalse(subscription.isPrivilegedSubscriber());
75 Assert.assertFalse(subscription.isDecompress());