summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test
diff options
context:
space:
mode:
authorHenry.Sun <henry.a.sun@est.tech>2019-07-12 15:49:30 +0000
committerHenry.Sun <henry.a.sun@est.tech>2019-07-12 15:49:30 +0000
commit9e4e4474ee079176b26ed0af7105a4b23540d585 (patch)
tree80d7ad4b1172447a7703af4f27fd2b7ed5293548 /plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test
parent8916bd3e643daeba1b09f6b04f831ac92962537d (diff)
add status filter in restclient and restrequestor
Issue-ID: POLICY-1742 Change-Id: Ib4984b18c0353cddb12c13c352277728be691bf5 Signed-off-by: Henry.Sun <henry.a.sun@est.tech>
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test')
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConusmerTest.java223
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java176
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParametersTest.java81
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPFilterInvalid.json75
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderBadList.json6
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderNotKvPairs.json6
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderNulls.json6
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderOK.json12
8 files changed, 325 insertions, 260 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConusmerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConusmerTest.java
index ae75dd7e5..6face9e50 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConusmerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConusmerTest.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* 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.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -33,6 +34,7 @@ import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Response;
+import org.junit.After;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
@@ -61,8 +63,13 @@ public class ApexRestClientConusmerTest {
@Mock
private Response responseMock;
+ @After
+ public void after() {
+ System.setOut(stdout);
+ }
+
@Test
- public void testApexRestClientConusmerErrors() {
+ public void testApexRestClientConsumerErrors() throws ApexEventException {
MockitoAnnotations.initMocks(this);
ApexRestClientConsumer arcc = new ApexRestClientConsumer();
@@ -92,51 +99,41 @@ public class ApexRestClientConusmerTest {
}
rcctp.setHttpMethod(null);
- try {
- arcc.init("RestClientConsumer", consumerParameters, incomingEventReceiver);
- assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.GET, rcctp.getHttpMethod());
+ rcctp.setHttpCodeFilter("zzz");
- assertEquals("RestClientConsumer", arcc.getName());
+ arcc.init("RestClientConsumer", consumerParameters, incomingEventReceiver);
+ assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.GET, rcctp.getHttpMethod());
- arcc.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, null);
- assertEquals(null, arcc.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
- } catch (ApexEventException e) {
- fail("test should not throw an exception");
- }
+ assertEquals("RestClientConsumer", arcc.getName());
+
+ arcc.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, null);
+ assertEquals(null, arcc.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
rcctp.setUrl("http://some.place.that.does.not/exist");
Mockito.doReturn(Response.Status.BAD_REQUEST.getStatusCode()).when(responseMock).getStatus();
Mockito.doReturn(responseMock).when(builderMock).get();
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
+ Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getHttpCodeFilter());
arcc.setClient(httpClientMock);
- try {
- // We have not set the URL, this test should not receive any events
- arcc.start();
- ThreadUtilities.sleep(200);
- arcc.stop();
-
- assertEquals(0, incomingEventReceiver.getEventCount());
- } catch (Exception e) {
- fail("test should not throw an exception");
- }
+ // We have not set the URL, this test should not receive any events
+ arcc.start();
+ ThreadUtilities.sleep(200);
+ arcc.stop();
+ assertEquals(0, incomingEventReceiver.getEventCount());
Mockito.doReturn(Response.Status.OK.getStatusCode()).when(responseMock).getStatus();
- try {
- // We have not set the URL, this test should not receive any events
- arcc.start();
- ThreadUtilities.sleep(200);
- arcc.stop();
- assertEquals(0, incomingEventReceiver.getEventCount());
- } catch (Exception e) {
- fail("test should not throw an exception");
- }
+ // We have not set the URL, this test should not receive any events
+ arcc.start();
+ ThreadUtilities.sleep(200);
+ arcc.stop();
+ assertEquals(0, incomingEventReceiver.getEventCount());
}
@Test
- public void testApexRestClientConusmerHttpError() {
+ public void testApexRestClientConsumerHttpError() throws ApexEventException {
MockitoAnnotations.initMocks(this);
ApexRestClientConsumer arcc = new ApexRestClientConsumer();
@@ -146,50 +143,39 @@ public class ApexRestClientConusmerTest {
RestClientCarrierTechnologyParameters rcctp = new RestClientCarrierTechnologyParameters();
consumerParameters.setCarrierTechnologyParameters(rcctp);
rcctp.setUrl("http://some.place.that.does.not/exist");
+ rcctp.setHttpCodeFilter("[1-5][0][0-5]");
SupportApexEventReceiver incomingEventReceiver = new SupportApexEventReceiver();
- try {
- arcc.init("RestClientConsumer", consumerParameters, incomingEventReceiver);
- assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.GET, rcctp.getHttpMethod());
+ arcc.init("RestClientConsumer", consumerParameters, incomingEventReceiver);
+ assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.GET, rcctp.getHttpMethod());
- assertEquals("RestClientConsumer", arcc.getName());
+ assertEquals("[1-5][0][0-5]", rcctp.getHttpCodeFilter());
- arcc.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, null);
- assertEquals(null, arcc.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
- } catch (ApexEventException e) {
- fail("test should not throw an exception");
- }
+ assertEquals("RestClientConsumer", arcc.getName());
+
+ arcc.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, null);
+ assertEquals(null, arcc.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
Mockito.doReturn(Response.Status.BAD_REQUEST.getStatusCode()).when(responseMock).getStatus();
Mockito.doReturn(responseMock).when(builderMock).get();
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
+ Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getHttpCodeFilter());
arcc.setClient(httpClientMock);
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
System.setOut(new PrintStream(outContent));
- try {
- // We have not set the URL, this test should not receive any events
- arcc.start();
- ThreadUtilities.sleep(200);
- arcc.stop();
-
- assertEquals(0, incomingEventReceiver.getEventCount());
- } catch (Exception e) {
- fail("test should not throw an exception");
- }
-
- final String outString = outContent.toString();
- System.setOut(stdout);
-
- assertTrue(outString.contains(
- "reception of event from URL \"http://some.place.that.does.not/exist\" failed with status code 400"));
+ // We have not set the URL, this test should not receive any events
+ arcc.start();
+ ThreadUtilities.sleep(200);
+ arcc.stop();
+ assertEquals(0, incomingEventReceiver.getEventCount());
}
@Test
- public void testApexRestClientConusmerJsonError() {
+ public void testApexRestClientConsumerJsonError() {
MockitoAnnotations.initMocks(this);
ApexRestClientConsumer arcc = new ApexRestClientConsumer();
@@ -199,6 +185,7 @@ public class ApexRestClientConusmerTest {
SupportApexEventReceiver incomingEventReceiver = new SupportApexEventReceiver();
RestClientCarrierTechnologyParameters rcctp = new RestClientCarrierTechnologyParameters();
consumerParameters.setCarrierTechnologyParameters(rcctp);
+ rcctp.setHttpCodeFilter("[1-5][0][0-5]");
try {
arcc.init("RestClientConsumer", consumerParameters, incomingEventReceiver);
@@ -207,6 +194,7 @@ public class ApexRestClientConusmerTest {
assertEquals("RestClientConsumer", arcc.getName());
arcc.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, null);
+
assertEquals(null, arcc.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
} catch (ApexEventException e) {
fail("test should not throw an exception");
@@ -218,30 +206,26 @@ public class ApexRestClientConusmerTest {
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
+ Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getHttpCodeFilter());
arcc.setClient(httpClientMock);
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
System.setOut(new PrintStream(outContent));
- try {
- // We have not set the URL, this test should not receive any events
- arcc.start();
- ThreadUtilities.sleep(200);
- arcc.stop();
+ // We have not set the URL, this test should not receive any events
+ arcc.start();
+ ThreadUtilities.sleep(200);
+ arcc.stop();
- assertEquals(0, incomingEventReceiver.getEventCount());
- } catch (Exception e) {
- fail("test should not throw an exception");
- }
+ assertEquals(0, incomingEventReceiver.getEventCount());
final String outString = outContent.toString();
- System.setOut(stdout);
assertTrue(outString.contains("received an empty event from URL \"http://some.place.that.does.not/exist\""));
}
@Test
- public void testApexRestClientConusmerJsonEmpty() {
+ public void testApexRestClientConsumerJsonEmpty() throws ApexEventException {
MockitoAnnotations.initMocks(this);
ApexRestClientConsumer arcc = new ApexRestClientConsumer();
@@ -251,18 +235,16 @@ public class ApexRestClientConusmerTest {
SupportApexEventReceiver incomingEventReceiver = new SupportApexEventReceiver();
RestClientCarrierTechnologyParameters rcctp = new RestClientCarrierTechnologyParameters();
consumerParameters.setCarrierTechnologyParameters(rcctp);
+ rcctp.setHttpCodeFilter("[1-5][0][0-5]");
- try {
- arcc.init("RestClientConsumer", consumerParameters, incomingEventReceiver);
- assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.GET, rcctp.getHttpMethod());
+ arcc.init("RestClientConsumer", consumerParameters, incomingEventReceiver);
+ assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.GET, rcctp.getHttpMethod());
- assertEquals("RestClientConsumer", arcc.getName());
+ assertEquals("RestClientConsumer", arcc.getName());
- arcc.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, null);
- assertEquals(null, arcc.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
- } catch (ApexEventException e) {
- fail("test should not throw an exception");
- }
+ arcc.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, null);
+
+ assertEquals(null, arcc.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
rcctp.setUrl("http://some.place.that.does.not/exist");
Mockito.doReturn(Response.Status.OK.getStatusCode()).when(responseMock).getStatus();
@@ -271,30 +253,26 @@ public class ApexRestClientConusmerTest {
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
+ Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getHttpCodeFilter());
arcc.setClient(httpClientMock);
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
System.setOut(new PrintStream(outContent));
- try {
- // We have not set the URL, this test should not receive any events
- arcc.start();
- ThreadUtilities.sleep(200);
- arcc.stop();
+ // We have not set the URL, this test should not receive any events
+ arcc.start();
+ ThreadUtilities.sleep(200);
+ arcc.stop();
- assertEquals(0, incomingEventReceiver.getEventCount());
- } catch (Exception e) {
- fail("test should not throw an exception");
- }
+ assertEquals(0, incomingEventReceiver.getEventCount());
final String outString = outContent.toString();
- System.setOut(stdout);
assertTrue(outString.contains("received an empty event from URL \"http://some.place.that.does.not/exist\""));
}
@Test
- public void testApexRestClientConusmerJsonOk() {
+ public void testApexRestClientConsumerJsonOk() throws ApexEventException {
MockitoAnnotations.initMocks(this);
ApexRestClientConsumer arcc = new ApexRestClientConsumer();
@@ -304,18 +282,16 @@ public class ApexRestClientConusmerTest {
SupportApexEventReceiver incomingEventReceiver = new SupportApexEventReceiver();
RestClientCarrierTechnologyParameters rcctp = new RestClientCarrierTechnologyParameters();
consumerParameters.setCarrierTechnologyParameters(rcctp);
+ rcctp.setHttpCodeFilter("[1-5][0][0-5]");
- try {
- arcc.init("RestClientConsumer", consumerParameters, incomingEventReceiver);
- assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.GET, rcctp.getHttpMethod());
+ arcc.init("RestClientConsumer", consumerParameters, incomingEventReceiver);
+ assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.GET, rcctp.getHttpMethod());
- assertEquals("RestClientConsumer", arcc.getName());
+ assertEquals("RestClientConsumer", arcc.getName());
- arcc.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, null);
- assertEquals(null, arcc.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
- } catch (ApexEventException e) {
- fail("test should not throw an exception");
- }
+ arcc.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, null);
+
+ assertEquals(null, arcc.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
rcctp.setUrl("http://some.place.that.does.not/exist");
Mockito.doReturn(Response.Status.OK.getStatusCode()).when(responseMock).getStatus();
@@ -324,17 +300,60 @@ public class ApexRestClientConusmerTest {
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
+ Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getHttpCodeFilter());
arcc.setClient(httpClientMock);
+ // We have not set the URL, this test should not receive any events
+ arcc.start();
+ ThreadUtilities.sleep(200);
+ arcc.stop();
+
+ assertEquals("This is an event", incomingEventReceiver.getLastEvent());
+ }
+
+ @Test
+ public void testApexRestClientConsumerInvalidStatusCode() throws ApexEventException {
+ MockitoAnnotations.initMocks(this);
+
+ ApexRestClientConsumer arcc = new ApexRestClientConsumer();
+ assertNotNull(arcc);
+
+ EventHandlerParameters consumerParameters = new EventHandlerParameters();
+ SupportApexEventReceiver incomingEventReceiver = new SupportApexEventReceiver();
+ RestClientCarrierTechnologyParameters rcctp = new RestClientCarrierTechnologyParameters();
+ consumerParameters.setCarrierTechnologyParameters(rcctp);
+ rcctp.setHttpCodeFilter("zzz");
+
+ arcc.init("RestClientConsumer", consumerParameters, incomingEventReceiver);
+ assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.GET, rcctp.getHttpMethod());
+
+ assertEquals("RestClientConsumer", arcc.getName());
+
+ arcc.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, null);
+
+ assertEquals(null, arcc.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
+
+ rcctp.setUrl("http://some.place.that.does.not/exist");
+ Mockito.doReturn(Response.Status.OK.getStatusCode()).when(responseMock).getStatus();
+ Mockito.doReturn("This is an event").when(responseMock).readEntity(String.class);
+ Mockito.doReturn(responseMock).when(builderMock).get();
+ Mockito.doReturn(builderMock).when(targetMock).request("application/json");
+ Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
+ Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
+ Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getHttpCodeFilter());
+ arcc.setClient(httpClientMock);
+
+ ByteArrayOutputStream outContent = new ByteArrayOutputStream();
+ System.setOut(new PrintStream(outContent));
+
try {
// We have not set the URL, this test should not receive any events
arcc.start();
ThreadUtilities.sleep(200);
arcc.stop();
-
- assertEquals("This is an event", incomingEventReceiver.getLastEvent());
} catch (Exception e) {
- fail("test should not throw an exception");
+ // test invalid status code
+ assertEquals("received an invalid status code \"200\"", e.getMessage());
}
}
}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java
index d57bdd769..b67a339aa 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java
@@ -27,6 +27,8 @@ import static org.junit.Assert.fail;
import ch.qos.logback.classic.Level;
+import java.util.Properties;
+
import javax.ws.rs.client.Client;
import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.client.WebTarget;
@@ -42,13 +44,9 @@ import org.onap.policy.apex.service.engine.event.SynchronousEventCache;
import org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.consumer.ApexFileEventConsumer;
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode;
-import org.onap.policy.common.parameters.GroupValidationResult;
-import org.onap.policy.common.parameters.ParameterException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.Properties;
-
/**
* Test the ApexRestClientProducer class.
*
@@ -69,7 +67,7 @@ public class ApexRestClientProducerTest {
private Response responseMock;
@Test
- public void testApexRestClientProducerErrors() {
+ public void testApexRestClientProducerErrors() throws ApexEventException {
ApexRestClientProducer arcp = new ApexRestClientProducer();
assertNotNull(arcp);
@@ -96,53 +94,33 @@ public class ApexRestClientProducerTest {
}
rcctp.setHttpMethod(null);
- try {
- arcp.init("RestClientConsumer", producerParameters);
- assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.POST, rcctp.getHttpMethod());
-
- assertEquals("RestClientConsumer", arcp.getName());
-
- arcp.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, null);
- assertEquals(null, arcp.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
-
- arcp.stop();
- } catch (ApexEventException e) {
- fail("test should not throw an exception");
- }
+ arcp.init("RestClientConsumer", producerParameters);
+ assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.POST, rcctp.getHttpMethod());
+ assertEquals("RestClientConsumer", arcp.getName());
+ arcp.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, null);
+ assertEquals(null, arcp.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
+ arcp.stop();
rcctp.setHttpMethod(RestClientCarrierTechnologyParameters.HttpMethod.POST);
- try {
- arcp.init("RestClientConsumer", producerParameters);
- assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.POST, rcctp.getHttpMethod());
-
- assertEquals("RestClientConsumer", arcp.getName());
+ arcp.init("RestClientConsumer", producerParameters);
+ assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.POST, rcctp.getHttpMethod());
+ assertEquals("RestClientConsumer", arcp.getName());
+ arcp.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, null);
+ assertEquals(null, arcp.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
+ arcp.stop();
- arcp.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, null);
- assertEquals(null, arcp.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
-
- arcp.stop();
- } catch (ApexEventException e) {
- fail("test should not throw an exception");
- }
rcctp.setHttpMethod(RestClientCarrierTechnologyParameters.HttpMethod.PUT);
- try {
- arcp.init("RestClientConsumer", producerParameters);
- assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.PUT, rcctp.getHttpMethod());
-
- assertEquals("RestClientConsumer", arcp.getName());
-
- arcp.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, null);
- assertEquals(null, arcp.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
-
- arcp.stop();
- } catch (ApexEventException e) {
- fail("test should not throw an exception");
- }
+ arcp.init("RestClientConsumer", producerParameters);
+ assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.PUT, rcctp.getHttpMethod());
+ assertEquals("RestClientConsumer", arcp.getName());
+ arcp.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, null);
+ assertEquals(null, arcp.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
+ arcp.stop();
}
@Test
- public void testApexRestClientProducerPutEvent() {
+ public void testApexRestClientProducerPutEvent() throws ApexEventException {
MockitoAnnotations.initMocks(this);
ApexRestClientProducer arcp = new ApexRestClientProducer();
@@ -153,14 +131,9 @@ public class ApexRestClientProducerTest {
producerParameters.setCarrierTechnologyParameters(rcctp);
rcctp.setHttpMethod(RestClientCarrierTechnologyParameters.HttpMethod.PUT);
- try {
- arcp.init("RestClientConsumer", producerParameters);
- assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.PUT, rcctp.getHttpMethod());
-
- assertEquals("RestClientConsumer", arcp.getName());
- } catch (ApexEventException e) {
- fail("test should not throw an exception");
- }
+ arcp.init("RestClientConsumer", producerParameters);
+ assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.PUT, rcctp.getHttpMethod());
+ assertEquals("RestClientConsumer", arcp.getName());
rcctp.setUrl("http://some.place.that.does.not/exist");
Mockito.doReturn(Response.Status.OK.getStatusCode()).when(responseMock).getStatus();
@@ -170,16 +143,12 @@ public class ApexRestClientProducerTest {
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
arcp.setClient(httpClientMock);
- try {
- arcp.sendEvent(123, null, "EventName", "This is an Event");
- arcp.stop();
- } catch (Exception ex) {
- fail("test should not throw an exception");
- }
+ arcp.sendEvent(123, null, "EventName", "This is an Event");
+ arcp.stop();
}
@Test
- public void testApexRestClientProducerPostEventFail() {
+ public void testApexRestClientProducerPostEventFail() throws ApexEventException {
MockitoAnnotations.initMocks(this);
ApexRestClientProducer arcp = new ApexRestClientProducer();
@@ -190,14 +159,9 @@ public class ApexRestClientProducerTest {
producerParameters.setCarrierTechnologyParameters(rcctp);
rcctp.setHttpMethod(RestClientCarrierTechnologyParameters.HttpMethod.POST);
- try {
- arcp.init("RestClientConsumer", producerParameters);
- assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.POST, rcctp.getHttpMethod());
-
- assertEquals("RestClientConsumer", arcp.getName());
- } catch (ApexEventException e) {
- fail("test should not throw an exception");
- }
+ arcp.init("RestClientConsumer", producerParameters);
+ assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.POST, rcctp.getHttpMethod());
+ assertEquals("RestClientConsumer", arcp.getName());
rcctp.setUrl("http://some.place.that.does.not/exist");
Mockito.doReturn(Response.Status.OK.getStatusCode()).when(responseMock).getStatus();
@@ -225,7 +189,7 @@ public class ApexRestClientProducerTest {
}
@Test
- public void testApexRestClientProducerPostEventOK() {
+ public void testApexRestClientProducerPostEventOK() throws ApexEventException {
MockitoAnnotations.initMocks(this);
ApexRestClientProducer arcp = new ApexRestClientProducer();
@@ -236,14 +200,9 @@ public class ApexRestClientProducerTest {
producerParameters.setCarrierTechnologyParameters(rcctp);
rcctp.setHttpMethod(RestClientCarrierTechnologyParameters.HttpMethod.PUT);
- try {
- arcp.init("RestClientConsumer", producerParameters);
- assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.PUT, rcctp.getHttpMethod());
-
- assertEquals("RestClientConsumer", arcp.getName());
- } catch (ApexEventException e) {
- fail("test should not throw an exception");
- }
+ arcp.init("RestClientConsumer", producerParameters);
+ assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.PUT, rcctp.getHttpMethod());
+ assertEquals("RestClientConsumer", arcp.getName());
System.out.println("fail test");
rcctp.setUrl("http://some.place.{key}.does.not/{tag}");
@@ -257,16 +216,12 @@ public class ApexRestClientProducerTest {
Mockito.doReturn(targetMock).when(httpClientMock).target("http://some.place.that.does.not/exist");
arcp.setClient(httpClientMock);
- try {
- arcp.sendEvent(123, properties, "EventName", "This is an Event");
- arcp.stop();
- } catch (Exception ex) {
- fail("test should not throw an exception");
- }
+ arcp.sendEvent(123, properties, "EventName", "This is an Event");
+ arcp.stop();
}
@Test
- public void testApexRestClientProducerPostEventCache() {
+ public void testApexRestClientProducerPostEventCache() throws ApexEventException {
MockitoAnnotations.initMocks(this);
ApexRestClientProducer arcp = new ApexRestClientProducer();
@@ -283,14 +238,9 @@ public class ApexRestClientProducerTest {
1000);
arcp.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, cache);
assertEquals(cache, arcp.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
- try {
- arcp.init("RestClientConsumer", producerParameters);
- assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.POST, rcctp.getHttpMethod());
-
- assertEquals("RestClientConsumer", arcp.getName());
- } catch (ApexEventException e) {
- fail("test should not throw an exception");
- }
+ arcp.init("RestClientConsumer", producerParameters);
+ assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.POST, rcctp.getHttpMethod());
+ assertEquals("RestClientConsumer", arcp.getName());
rcctp.setUrl("http://some.place.that.does.not/exist");
Mockito.doReturn(Response.Status.OK.getStatusCode()).when(responseMock).getStatus();
@@ -300,16 +250,12 @@ public class ApexRestClientProducerTest {
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
arcp.setClient(httpClientMock);
- try {
- arcp.sendEvent(123, null, "EventName", "This is an Event");
- arcp.stop();
- } catch (Exception e) {
- fail("test should not throw an exception");
- }
+ arcp.sendEvent(123, null, "EventName", "This is an Event");
+ arcp.stop();
}
@Test
- public void testApexRestClientProducerPostEventCacheTrace() {
+ public void testApexRestClientProducerPostEventCacheTrace() throws ApexEventException {
MockitoAnnotations.initMocks(this);
ch.qos.logback.classic.Logger classicLogger = (ch.qos.logback.classic.Logger) LOGGER;
@@ -329,14 +275,9 @@ public class ApexRestClientProducerTest {
1000);
arcp.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, cache);
assertEquals(cache, arcp.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
- try {
- arcp.init("RestClientConsumer", producerParameters);
- assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.POST, rcctp.getHttpMethod());
-
- assertEquals("RestClientConsumer", arcp.getName());
- } catch (ApexEventException e) {
- fail("test should not throw an exception");
- }
+ arcp.init("RestClientConsumer", producerParameters);
+ assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.POST, rcctp.getHttpMethod());
+ assertEquals("RestClientConsumer", arcp.getName());
rcctp.setUrl("http://some.place.that.does.not/exist");
Mockito.doReturn(Response.Status.OK.getStatusCode()).when(responseMock).getStatus();
@@ -346,16 +287,12 @@ public class ApexRestClientProducerTest {
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
arcp.setClient(httpClientMock);
- try {
- arcp.sendEvent(123, null, "EventName", "This is an Event");
- arcp.stop();
- } catch (Exception e) {
- fail("test should not throw an exception");
- }
+ arcp.sendEvent(123, null, "EventName", "This is an Event");
+ arcp.stop();
}
@Test
- public void testApexRestClientProducerHttpError() {
+ public void testApexRestClientProducerHttpError() throws ApexEventException {
MockitoAnnotations.initMocks(this);
ApexRestClientProducer arcp = new ApexRestClientProducer();
@@ -366,14 +303,9 @@ public class ApexRestClientProducerTest {
producerParameters.setCarrierTechnologyParameters(rcctp);
rcctp.setHttpMethod(RestClientCarrierTechnologyParameters.HttpMethod.POST);
- try {
- arcp.init("RestClientConsumer", producerParameters);
- assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.POST, rcctp.getHttpMethod());
-
- assertEquals("RestClientConsumer", arcp.getName());
- } catch (ApexEventException e) {
- fail("test should not throw an exception");
- }
+ arcp.init("RestClientConsumer", producerParameters);
+ assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.POST, rcctp.getHttpMethod());
+ assertEquals("RestClientConsumer", arcp.getName());
rcctp.setUrl("http://some.place.that.does.not/exist");
Mockito.doReturn(Response.Status.BAD_REQUEST.getStatusCode()).when(responseMock).getStatus();
@@ -393,4 +325,4 @@ public class ApexRestClientProducerTest {
e.getMessage());
}
}
-}
+} \ No newline at end of file
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParametersTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParametersTest.java
index f982059f7..9db565ba8 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParametersTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParametersTest.java
@@ -87,39 +87,69 @@ public class RestClientCarrierTechnologyParametersTest {
}
@Test
- public void testRestClientCarrierTechnologyParametersOk() {
+ public void testRestClientCarrierTechnologyParameterFilterInvalid() {
ApexCommandLineArguments arguments = new ApexCommandLineArguments();
- arguments.setConfigurationFilePath("src/test/resources/prodcons/RESTClientWithHTTPHeaderOK.json");
+ arguments.setConfigurationFilePath("src/test/resources/prodcons/RESTClientWithHTTPFilterInvalid.json");
arguments.setRelativeFileRoot(".");
try {
+ new ApexParameterHandler().getParameters(arguments);
ApexParameters parameters = new ApexParameterHandler().getParameters(arguments);
RestClientCarrierTechnologyParameters rrctp0 = (RestClientCarrierTechnologyParameters) parameters
.getEventInputParameters().get("RestClientConsumer0").getCarrierTechnologyParameters();
- assertEquals(0, rrctp0.getHttpHeaders().length);
-
- RestClientCarrierTechnologyParameters rrctp1 = (RestClientCarrierTechnologyParameters) parameters
- .getEventInputParameters().get("RestClientConsumer1").getCarrierTechnologyParameters();
- assertEquals(3, rrctp1.getHttpHeaders().length);
- assertEquals("bbb", rrctp1.getHttpHeadersAsMultivaluedMap().get("aaa").get(0));
- assertEquals("ddd", rrctp1.getHttpHeadersAsMultivaluedMap().get("ccc").get(0));
- assertEquals("fff", rrctp1.getHttpHeadersAsMultivaluedMap().get("eee").get(0));
-
- rrctp1.setHttpHeaders(null);
- assertEquals(null, rrctp1.getHttpHeadersAsMultivaluedMap());
+ fail("test should throw an exception here");
} catch (ParameterException pe) {
- fail("test should not throw an exception");
+ assertTrue(pe.getMessage().contains("Invalid HTTP code filter, the filter must be specified as a three digit regular expression: "));
}
}
@Test
+ public void testRestClientCarrierTechnologyParametersOk() throws ParameterException {
+ ApexCommandLineArguments arguments = new ApexCommandLineArguments();
+ arguments.setConfigurationFilePath("src/test/resources/prodcons/RESTClientWithHTTPHeaderOK.json");
+ arguments.setRelativeFileRoot(".");
+
+ ApexParameters parameters = new ApexParameterHandler().getParameters(arguments);
+
+ RestClientCarrierTechnologyParameters rrctp0 = (RestClientCarrierTechnologyParameters) parameters
+ .getEventInputParameters().get("RestClientConsumer0").getCarrierTechnologyParameters();
+ assertEquals(0, rrctp0.getHttpHeaders().length);
+
+ RestClientCarrierTechnologyParameters rrctp1 = (RestClientCarrierTechnologyParameters) parameters
+ .getEventInputParameters().get("RestClientConsumer1").getCarrierTechnologyParameters();
+ assertEquals(3, rrctp1.getHttpHeaders().length);
+ assertEquals("bbb", rrctp1.getHttpHeadersAsMultivaluedMap().get("aaa").get(0));
+ assertEquals("ddd", rrctp1.getHttpHeadersAsMultivaluedMap().get("ccc").get(0));
+ assertEquals("fff", rrctp1.getHttpHeadersAsMultivaluedMap().get("eee").get(0));
+
+ rrctp1.setHttpHeaders(null);
+ assertEquals(null, rrctp1.getHttpHeadersAsMultivaluedMap());
+ }
+
+ @Test
+ public void testRestClientCarrierTechnologyHttpCodeFilterOk() throws ParameterException {
+ ApexCommandLineArguments arguments = new ApexCommandLineArguments();
+ arguments.setConfigurationFilePath("src/test/resources/prodcons/RESTClientWithHTTPHeaderOK.json");
+ arguments.setRelativeFileRoot(".");
+
+ ApexParameters parameters = new ApexParameterHandler().getParameters(arguments);
+
+ RestClientCarrierTechnologyParameters rrctp1 = (RestClientCarrierTechnologyParameters) parameters
+ .getEventInputParameters().get("RestClientConsumer1").getCarrierTechnologyParameters();
+ assertEquals("[1-5][0][0-5]", rrctp1.getHttpCodeFilter());
+ }
+
+ @Test
public void testGettersAndSetters() {
RestClientCarrierTechnologyParameters rrctp = new RestClientCarrierTechnologyParameters();
rrctp.setUrl("http://some.where");
assertEquals("http://some.where", rrctp.getUrl());
+ rrctp.setHttpCodeFilter("[1-5][0][0-5]");
+ assertEquals("[1-5][0][0-5]", rrctp.getHttpCodeFilter());
+
String[][] httpHeaders = new String[2][2];
httpHeaders[0][0] = "aaa";
httpHeaders[0][1] = "bbb";
@@ -146,8 +176,8 @@ public class RestClientCarrierTechnologyParametersTest {
assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.DELETE, rrctp.getHttpMethod());
assertEquals("RestClientCarrierTechnologyParameters "
- + "[url=http://some.where, httpMethod=DELETE, httpHeaders=[[aaa, bbb], [ccc, ddd]]]",
- rrctp.toString());
+ + "[url=http://some.where, httpMethod=DELETE, httpHeaders=[[aaa, bbb], [ccc, ddd]], "
+ + "httpCodeFilter=[1-5][0][0-5]]", rrctp.toString());
}
@Test
@@ -170,10 +200,10 @@ public class RestClientCarrierTechnologyParametersTest {
assertEquals("ccc", rrctp.getHttpHeaders()[1][0]);
assertEquals("ddd", rrctp.getHttpHeaders()[1][1]);
- assertEquals(true, rrctp.validateTagInUrl());
+ assertEquals(true, rrctp.validate().isValid());
rrctp.setUrl("http://{place}.{that}/is{that}.{one}");
- assertEquals(true, rrctp.validateTagInUrl());
+ assertEquals(true, rrctp.validate().isValid());
Set<String> keymap = rrctp.getKeysFromUrl();
assertEquals(true, keymap.contains("place"));
@@ -181,19 +211,18 @@ public class RestClientCarrierTechnologyParametersTest {
assertEquals(true, keymap.contains("one"));
rrctp.setUrl("http://{place.{that}/{is}.{not}/{what}.{exist}");
- assertEquals(false, rrctp.validateTagInUrl());
+ assertEquals(false, rrctp.validate().isValid());
rrctp.setUrl("http://{place}.{that}/{is}.{not}/{what}.{exist");
- assertEquals(false, rrctp.validateTagInUrl());
+ assertEquals(false, rrctp.validate().isValid());
rrctp.setUrl("http://place.that/is.not/what.{exist");
- assertEquals(false, rrctp.validateTagInUrl());
+ assertEquals(false, rrctp.validate().isValid());
rrctp.setUrl("http://place}.{that}/{is}.{not}/{what}.{exist}");
- assertEquals(false, rrctp.validateTagInUrl());
+ assertEquals(false, rrctp.validate().isValid());
rrctp.setUrl("http://{place}.{that}/is}.{not}/{what}.{exist}");
- assertEquals(false, rrctp.validateTagInUrl());
+ assertEquals(false, rrctp.validate().isValid());
rrctp.setUrl("http://{place}.{that}/{}.{not}/{what}.{exist}");
- assertEquals(false, rrctp.validateTagInUrl());
+ assertEquals(false, rrctp.validate().isValid());
rrctp.setUrl("http://{place}.{that}/{ }.{not}/{what}.{exist}");
- assertEquals(false, rrctp.validateTagInUrl());
-
+ assertEquals(false, rrctp.validate().isValid());
}
}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPFilterInvalid.json b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPFilterInvalid.json
new file mode 100644
index 000000000..490767186
--- /dev/null
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPFilterInvalid.json
@@ -0,0 +1,75 @@
+{
+ "engineServiceParameters": {
+ "name": "MyApexEngine",
+ "version": "0.0.1",
+ "id": 45,
+ "instanceCount": 4,
+ "deploymentPort": 12561,
+ "policyModelFileName": "src/test/resources/policymodels/RequestorModel.json",
+ "engineParameters": {
+ "executorParameters": {
+ "JAVASCRIPT": {
+ "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"
+ }
+ }
+ }
+ },
+ "eventInputParameters": {
+ "RestClientConsumer0": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "RESTCLIENT",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters",
+ "parameters": {
+ "url": "http://localhost:32801/TestRESTRequestor/apex/event/GetEvent",
+ "httpMethod": "GET",
+ "httpHeaders" : [
+ ["aaa", "bbb"],
+ ["ccc", "ddd"]
+ ],
+ "httpCodeFilter" : "*\\.*"
+ }
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ }
+ },
+ "RestClientConsumer1": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "RESTCLIENT",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters",
+ "parameters": {
+ "url": "http://localhost:32801/TestRESTRequestor/apex/event/GetEvent",
+ "httpMethod": "GET",
+ "httpHeaders" : [
+ ["aaa", "bbb"],
+ ["ccc", "ddd"]
+ ],
+ "httpCodeFilter" : " "
+ }
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ }
+ }
+ },
+ "eventOutputParameters": {
+ "RestClientProducer0": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "RESTCLIENT",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters"
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ }
+ },
+ "RestClientProducer1": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "RESTCLIENT",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters"
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ }
+ }
+ }
+}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderBadList.json b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderBadList.json
index a3969aead..be0729f6c 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderBadList.json
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderBadList.json
@@ -25,7 +25,8 @@
"httpHeaders" : [
["aaa", "bbb"],
["ccc", "ddd"],
- ]
+ ],
+ "httpCodeFilter" : "[1-5][0][0-5]"
}
},
"eventProtocolParameters": {
@@ -41,7 +42,8 @@
"httpMethod": "GET",
"httpHeaders" : [
,
- ]
+ ],
+ "httpCodeFilter" : "[1-5][0][0-5]"
}
},
"eventProtocolParameters": {
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderNotKvPairs.json b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderNotKvPairs.json
index 790a9bc38..c41ff1cb4 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderNotKvPairs.json
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderNotKvPairs.json
@@ -24,7 +24,8 @@
"httpMethod": "GET",
"httpHeaders" : [
["aaa", "bbb", "ccc"]
- ]
+ ],
+ "httpCodeFilter" : "[1-5][0][0-5]"
}
},
"eventProtocolParameters": {
@@ -40,7 +41,8 @@
"httpMethod": "GET",
"httpHeaders" : [
["aaa"]
- ]
+ ],
+ "httpCodeFilter" : "[1-5][0][0-5]"
}
},
"eventProtocolParameters": {
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderNulls.json b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderNulls.json
index 4b99ca0c2..bc9988633 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderNulls.json
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderNulls.json
@@ -25,7 +25,8 @@
"httpHeaders" : [
[null, "bbb"],
["ccc", "ddd"]
- ]
+ ],
+ "httpCodeFilter" : "[1-5][0][0-5]"
}
}
},
@@ -40,7 +41,8 @@
["aaa", "bbb"],
["ccc", null],
["eee", "fff"]
- ]
+ ],
+ "httpCodeFilter" : "[1-5][0][0-5]"
}
},
"eventProtocolParameters": {
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderOK.json b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderOK.json
index 1c4a39d99..3586b4481 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderOK.json
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/resources/prodcons/RESTClientWithHTTPHeaderOK.json
@@ -23,7 +23,8 @@
"url": "http://localhost:32801/TestRESTRequestor/apex/event/GetEvent",
"httpMethod": "GET",
"httpHeaders" : [
- ]
+ ],
+ "httpCodeFilter" : "[1-5][0][0-5]"
}
},
"eventProtocolParameters": {
@@ -41,7 +42,8 @@
["aaa", "bbb"],
["ccc", "ddd"],
["eee", "fff"]
- ]
+ ],
+ "httpCodeFilter" : "[1-5][0][0-5]"
}
},
"eventProtocolParameters": {
@@ -58,7 +60,8 @@
"url": "http://localhost:32801/TestRESTRequestor/apex/event/GetEvent",
"httpMethod": "GET",
"httpHeaders" : [
- ]
+ ],
+ "httpCodeFilter" : "[1-5][0][0-5]"
}
},
"eventProtocolParameters": {
@@ -76,7 +79,8 @@
["aaa", "bbb"],
["ccc", "ddd"],
["eee", "fff"]
- ]
+ ],
+ "httpCodeFilter" : "[1-5][0][0-5]"
}
},
"eventProtocolParameters": {