aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test')
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumerTest.java2
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/RestServerCarrierTechnologyParametersTest.java61
2 files changed, 62 insertions, 1 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumerTest.java
index 02daed02e..07f705cc6 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumerTest.java
@@ -93,7 +93,7 @@ public class ApexRestServerConsumerTest {
incomingEventReceiver);
}
- @Test(expected = IllegalStateException.class)
+ @Test(expected = IllegalArgumentException.class)
public void testInitWithSynchronousModeAndProperValues()
throws ApexEventException, NoSuchFieldException, SecurityException,
IllegalArgumentException, IllegalAccessException {
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/RestServerCarrierTechnologyParametersTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/RestServerCarrierTechnologyParametersTest.java
index dbe20c960..2c8a764e8 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/RestServerCarrierTechnologyParametersTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/RestServerCarrierTechnologyParametersTest.java
@@ -86,4 +86,65 @@ public class RestServerCarrierTechnologyParametersTest {
assertFalse(result.isValid());
}
+ @Test
+ public void testValidateWithValidValues() throws NoSuchFieldException, SecurityException,
+ IllegalArgumentException, IllegalAccessException {
+
+ Field field = RestServerCarrierTechnologyParameters.class.getDeclaredField("standalone");
+ field.setAccessible(true);
+ field.set(restServerCarrierTechnologyParameters, true);
+ field = RestServerCarrierTechnologyParameters.class.getDeclaredField("host");
+ field.setAccessible(true);
+ field.set(restServerCarrierTechnologyParameters, "localhost");
+ field = RestServerCarrierTechnologyParameters.class.getDeclaredField("port");
+ field.setAccessible(true);
+ field.set(restServerCarrierTechnologyParameters, 6969);
+ field = RestServerCarrierTechnologyParameters.class.getDeclaredField("userName");
+ field.setAccessible(true);
+ field.set(restServerCarrierTechnologyParameters, "username");
+ field = RestServerCarrierTechnologyParameters.class.getDeclaredField("password");
+ field.setAccessible(true);
+ field.set(restServerCarrierTechnologyParameters, "password");
+ field = RestServerCarrierTechnologyParameters.class.getDeclaredField("https");
+ field.setAccessible(true);
+ field.set(restServerCarrierTechnologyParameters, true);
+ field = RestServerCarrierTechnologyParameters.class.getDeclaredField("aaf");
+ field.setAccessible(true);
+ field.set(restServerCarrierTechnologyParameters, true);
+ result = restServerCarrierTechnologyParameters.validate();
+ assertNotNull(result);
+ assertTrue(result.isValid());
+ }
+
+ @Test
+ public void testValidateWithInvalidValues() throws NoSuchFieldException, SecurityException,
+ IllegalArgumentException, IllegalAccessException {
+
+ Field field = RestServerCarrierTechnologyParameters.class.getDeclaredField("standalone");
+ field.setAccessible(true);
+ field.set(restServerCarrierTechnologyParameters, false);
+ field = RestServerCarrierTechnologyParameters.class.getDeclaredField("host");
+ field.setAccessible(true);
+ field.set(restServerCarrierTechnologyParameters, "localhost");
+ field = RestServerCarrierTechnologyParameters.class.getDeclaredField("port");
+ field.setAccessible(true);
+ field.set(restServerCarrierTechnologyParameters, 6969);
+ field = RestServerCarrierTechnologyParameters.class.getDeclaredField("userName");
+ field.setAccessible(true);
+ field.set(restServerCarrierTechnologyParameters, "username");
+ field = RestServerCarrierTechnologyParameters.class.getDeclaredField("password");
+ field.setAccessible(true);
+ field.set(restServerCarrierTechnologyParameters, "password");
+ field = RestServerCarrierTechnologyParameters.class.getDeclaredField("https");
+ field.setAccessible(true);
+ field.set(restServerCarrierTechnologyParameters, true);
+ field = RestServerCarrierTechnologyParameters.class.getDeclaredField("aaf");
+ field.setAccessible(true);
+ field.set(restServerCarrierTechnologyParameters, true);
+ result = restServerCarrierTechnologyParameters.validate();
+ assertNotNull(result);
+ assertFalse(result.isValid());
+ assertTrue(result.getResult().contains("host is specified only in standalone mode"));
+ assertTrue(result.getResult().contains("port is specified only in standalone mode"));
+ }
}