aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorasgar <sammoham@in.ibm.com>2018-10-03 14:17:38 +0530
committerasgar <sammoham@in.ibm.com>2018-10-03 14:17:44 +0530
commit52a67e4f8b5d131d5eac1f351caebbaf2d088929 (patch)
tree06747da73fe2ef73a2a631704d446a283fe771df
parentea2aecd64138743183bd33217ce915b0ebd1c6e6 (diff)
added some more test cases for ValidatorUtil.java
Change-Id: I5b64b56f4d1cb713547d4c8ac121188932eaf4c2 Issue-ID: DMAAP-809 Signed-off-by: Mohamed Asgar Samiulla <sammoham@in.ibm.com>
-rw-r--r--src/test/java/com/att/nsa/mr/tools/ValidatorUtilTest.java69
1 files changed, 68 insertions, 1 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 b50ddc4..544506f 100644
--- a/src/test/java/com/att/nsa/mr/tools/ValidatorUtilTest.java
+++ b/src/test/java/com/att/nsa/mr/tools/ValidatorUtilTest.java
@@ -184,7 +184,7 @@ public class ValidatorUtilTest {
}
@Test
- public void testValidateForNonDME2WithAuthDate() {
+ public void testValidateForNonDME2WithOutAuthDate() {
Properties props = new Properties();
props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue());
props.setProperty("host", "ServiceName");
@@ -194,11 +194,78 @@ public class ValidatorUtilTest {
props.setProperty("password", "password");
props.setProperty("authKey", "authKey");
+
try{
ValidatorUtil.validatePublisher(props);
} catch(IllegalArgumentException e) {
assertEquals(e.getMessage(), "authDate is needed");
}
+ }
+
+ @Test
+ public void testValidateForNonDME2WithAuthDate() {
+ 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");
+
+ try{
+ ValidatorUtil.validatePublisher(props);
+ } catch(IllegalArgumentException e) {
+ assertEquals(e.getMessage(), "maxBatchSize is needed");
+ }
+ }
+
+
+ @Test
+ public void testValidateForNonDME2WithMaxAgeMs() {
+ 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");
+
+ try{
+ ValidatorUtil.validatePublisher(props);
+ } catch(IllegalArgumentException e) {
+ assertEquals(e.getMessage(), "maxAgeMs is needed");
+ }
+
+
+
+ }
+
+ @Test
+ public void testValidateForNonDME2WithMessageSentThreadOccurance() {
+ 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.validatePublisher(props);
+ } catch(IllegalArgumentException e) {
+ assertEquals(e.getMessage(), "MessageSentThreadOccurance is needed");
+ }
+
+
}