few more cases added to validatorutil.java 09/69809/2
authorasgar <sammoham@in.ibm.com>
Thu, 4 Oct 2018 10:36:43 +0000 (16:06 +0530)
committerMohamed Asgar Samiulla <sammoham@in.ibm.com>
Mon, 8 Oct 2018 08:31:01 +0000 (08:31 +0000)
Change-Id: I544bec8b1da6f3fcc601eed109af923d0d97a3de
Issue-ID: DMAAP-809
Signed-off-by: Mohamed Asgar Samiulla <sammoham@in.ibm.com>
src/test/java/com/att/nsa/mr/tools/ValidatorUtilTest.java

index 544506f..ec382f4 100644 (file)
@@ -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");
+                }
+     }
+