From 79f657619d0af685d68fb6515ec9f59c308bf255 Mon Sep 17 00:00:00 2001 From: asgar Date: Thu, 4 Oct 2018 16:06:43 +0530 Subject: few more cases added to validatorutil.java Change-Id: I544bec8b1da6f3fcc601eed109af923d0d97a3de Issue-ID: DMAAP-809 Signed-off-by: Mohamed Asgar Samiulla --- .../com/att/nsa/mr/tools/ValidatorUtilTest.java | 92 ++++++++++++++++------ 1 file changed, 66 insertions(+), 26 deletions(-) diff --git a/src/test/java/com/att/nsa/mr/tools/ValidatorUtilTest.java b/src/test/java/com/att/nsa/mr/tools/ValidatorUtilTest.java index 544506f..ec382f4 100644 --- a/src/test/java/com/att/nsa/mr/tools/ValidatorUtilTest.java +++ b/src/test/java/com/att/nsa/mr/tools/ValidatorUtilTest.java @@ -1,28 +1,25 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP Policy Engine - * ================================================================================ - * Copyright (C) 2018 Nokia - * ================================================================================ - * Modifications Copyright © 2018 IBM. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2018 IBM Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ -/** - * @author marcin.migdal@nokia.com - */ package com.att.nsa.mr.tools; import static org.junit.Assert.assertEquals; @@ -265,9 +262,52 @@ public class ValidatorUtilTest { assertEquals(e.getMessage(), "MessageSentThreadOccurance is needed"); } - - - } + } + + + @Test + public void testValidateSubscriberWithoutGroup() { + Properties props = new Properties(); + props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue()); + props.setProperty("host", "ServiceName"); + props.setProperty("topic", "topic"); + props.setProperty("username", "username"); + props.setProperty("contenttype", "contenttype"); + props.setProperty("password", "password"); + props.setProperty("authKey", "authKey"); + props.setProperty("authDate", "authDate"); + props.setProperty("maxBatchSize", "maxBatchSize"); + props.setProperty("maxAgeMs", "maxAgeMs"); + + try{ + ValidatorUtil.validateSubscriber(props); + } catch(IllegalArgumentException e) { + assertEquals(e.getMessage(), "group is needed"); + } + } + + @Test + public void testValidateSubscriberWithoutCustomer() { + Properties props = new Properties(); + props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue()); + props.setProperty("host", "ServiceName"); + props.setProperty("topic", "topic"); + props.setProperty("username", "username"); + props.setProperty("contenttype", "contenttype"); + props.setProperty("password", "password"); + props.setProperty("authKey", "authKey"); + props.setProperty("authDate", "authDate"); + props.setProperty("maxBatchSize", "maxBatchSize"); + props.setProperty("maxAgeMs", "maxAgeMs"); + props.setProperty("group", "group"); + + try{ + ValidatorUtil.validateSubscriber(props); + } catch(IllegalArgumentException e) { + assertEquals(e.getMessage(), "Consumer (Id) is needed"); + } + } + -- cgit 1.2.3-korg