diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/test/java/com/att/nsa/mr/tools/ValidatorUtilTest.java | 92 |
1 files 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"); + } + } + |