aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]docker_build.sh0
-rwxr-xr-x[-rw-r--r--]docker_merge.sh0
-rwxr-xr-x[-rw-r--r--]docker_verify.sh0
-rw-r--r--examples/examples-decisionmaker/pom.xml28
-rw-r--r--examples/examples-decisionmaker/src/main/resources/examples/config/DecisionMaker/ApexConfigHealthCheckRESTClient.json57
-rw-r--r--examples/examples-decisionmaker/src/main/resources/logic/HealthCheckTask.js26
-rw-r--r--examples/examples-decisionmaker/src/main/resources/policy/HealthCheckPolicyModel.apex58
-rw-r--r--model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/ClassBuilder.java6
-rw-r--r--packages/apex-pdp-package-full/pom.xml2
-rw-r--r--packages/apex-pdp-package-full/src/main/package/tarball/assembly.xml2
-rw-r--r--packages/apex-pdp-package-full/src/main/resources/ssl/ca-aaf.crt31
-rw-r--r--packages/apex-pdp-package-full/src/main/resources/ssl/policy-keystorebin0 -> 4223 bytes
-rw-r--r--packages/apex-pdp-package-full/src/main/resources/ssl/policy-truststorebin0 -> 124180 bytes
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java2
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java6
-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.java22
-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.java10
17 files changed, 225 insertions, 25 deletions
diff --git a/docker_build.sh b/docker_build.sh
index c2c7abdb0..c2c7abdb0 100644..100755
--- a/docker_build.sh
+++ b/docker_build.sh
diff --git a/docker_merge.sh b/docker_merge.sh
index bc7aac1de..bc7aac1de 100644..100755
--- a/docker_merge.sh
+++ b/docker_merge.sh
diff --git a/docker_verify.sh b/docker_verify.sh
index 0f77a61e7..0f77a61e7 100644..100755
--- a/docker_verify.sh
+++ b/docker_verify.sh
diff --git a/examples/examples-decisionmaker/pom.xml b/examples/examples-decisionmaker/pom.xml
index 245608ccf..1b25e20b5 100644
--- a/examples/examples-decisionmaker/pom.xml
+++ b/examples/examples-decisionmaker/pom.xml
@@ -30,7 +30,8 @@
<description>Specific code for the APEX Decision Maker Example</description>
<properties>
- <policymodel.name>DecisionMakerPolicyModel</policymodel.name>
+ <policymodel.decisionmaker.name>DecisionMakerPolicyModel</policymodel.decisionmaker.name>
+ <policymodel.healthcheck.name>HealthCheckPolicyModel</policymodel.healthcheck.name>
<apex-domains-decisionmaker-dir>${project.basedir}/src</apex-domains-decisionmaker-dir>
</properties>
@@ -50,7 +51,7 @@
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
- <id>generate-policy</id>
+ <id>generate-decisionmaker-policy</id>
<phase>compile</phase>
<goals>
<goal>java</goal>
@@ -59,9 +60,26 @@
<mainClass>org.onap.policy.apex.auth.clieditor.ApexCommandLineEditorMain</mainClass>
<classpathScope>compile</classpathScope>
<arguments>
- <argument>--command-file=${project.basedir}/src/main/resources/policy/${policymodel.name}.apex</argument>
- <argument>--output-model-file=${project.build.directory}/classes/${policymodel.name}.json</argument>
- <argument>--log-file=${project.build.directory}/${policymodel.name}_policygeneration.log</argument>
+ <argument>--command-file=${project.basedir}/src/main/resources/policy/${policymodel.decisionmaker.name}.apex</argument>
+ <argument>--output-model-file=${project.build.directory}/classes/${policymodel.decisionmaker.name}.json</argument>
+ <argument>--log-file=${project.build.directory}/${policymodel.decisionmaker.name}_policygeneration.log</argument>
+ <argument>--working-dir=${project.basedir}</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ <execution>
+ <id>generate-healthcheck-policy</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ <configuration>
+ <mainClass>org.onap.policy.apex.auth.clieditor.ApexCommandLineEditorMain</mainClass>
+ <classpathScope>compile</classpathScope>
+ <arguments>
+ <argument>--command-file=${project.basedir}/src/main/resources/policy/${policymodel.healthcheck.name}.apex</argument>
+ <argument>--output-model-file=${project.build.directory}/classes/${policymodel.healthcheck.name}.json</argument>
+ <argument>--log-file=${project.build.directory}/${policymodel.healthcheck.name}_policygeneration.log</argument>
<argument>--working-dir=${project.basedir}</argument>
</arguments>
</configuration>
diff --git a/examples/examples-decisionmaker/src/main/resources/examples/config/DecisionMaker/ApexConfigHealthCheckRESTClient.json b/examples/examples-decisionmaker/src/main/resources/examples/config/DecisionMaker/ApexConfigHealthCheckRESTClient.json
new file mode 100644
index 000000000..ec7391afe
--- /dev/null
+++ b/examples/examples-decisionmaker/src/main/resources/examples/config/DecisionMaker/ApexConfigHealthCheckRESTClient.json
@@ -0,0 +1,57 @@
+{
+ "javaProperties" : [
+ ["javax.net.ssl.trustStore", "/home/liam/tmp/distribution/etc/ssl/policy-truststore"],
+ ["javax.net.ssl.trustStorePassword", "UG9sMWN5XzBuYXA="]
+ ],
+ "engineServiceParameters": {
+ "name": "MyApexEngine",
+ "version": "0.0.1",
+ "id": 45,
+ "instanceCount": 4,
+ "deploymentPort": 12345,
+ "policyModelFileName": "/home/liam/git/onap/policy/apex-pdp/examples/examples-decisionmaker/target/classes/HealthCheckPolicyModel.json",
+ "engineParameters": {
+ "executorParameters": {
+ "JAVASCRIPT": {
+ "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"
+ }
+ }
+ }
+ },
+ "eventInputParameters": {
+ "HealthCheckConsumer": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "RESTCLIENT",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters",
+ "parameters": {
+ "url": "https://policy:6969/healthcheck",
+ "httpHeaders" : [
+ ["Authorization", "Basic aGVhbHRoY2hlY2s6emIhWHp0RzM0"]
+ ]
+ }
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON",
+ "parameters": {
+ "nameAlias": "none",
+ "versionAlias": "version",
+ "sourceAlias": "from"
+ }
+ },
+ "eventName": "HealthCheckEvent"
+ }
+ },
+ "eventOutputParameters": {
+ "logProducer": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "FILE",
+ "parameters": {
+ "fileName": "/tmp/EventsOut.json"
+ }
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ }
+ }
+ }
+}
diff --git a/examples/examples-decisionmaker/src/main/resources/logic/HealthCheckTask.js b/examples/examples-decisionmaker/src/main/resources/logic/HealthCheckTask.js
new file mode 100644
index 000000000..ebc0e6387
--- /dev/null
+++ b/examples/examples-decisionmaker/src/main/resources/logic/HealthCheckTask.js
@@ -0,0 +1,26 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+executor.logger.info(executor.outFields);
+
+var returnValue = executor.isTrue;
diff --git a/examples/examples-decisionmaker/src/main/resources/policy/HealthCheckPolicyModel.apex b/examples/examples-decisionmaker/src/main/resources/policy/HealthCheckPolicyModel.apex
new file mode 100644
index 000000000..c799a8f37
--- /dev/null
+++ b/examples/examples-decisionmaker/src/main/resources/policy/HealthCheckPolicyModel.apex
@@ -0,0 +1,58 @@
+#-------------------------------------------------------------------------------
+# ============LICENSE_START=======================================================
+# Copyright (C) 2016-2018 Ericsson. 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+#-------------------------------------------------------------------------------
+
+model create name=HealthCheckPolicyModel
+
+schema create name=SimpleStringType flavour=Java schema=java.lang.String
+schema create name=SimpleIntegerType flavour=Java schema=java.lang.Integer
+schema create name=SimpleBooleanType flavour=Java schema=java.lang.Boolean
+
+event create name=HealthCheckEvent nameSpace=org.onap.policy.apex.domains.HealthCheck source=Distribution target=Apex
+event parameter create name=HealthCheckEvent parName=name schemaName=SimpleStringType
+event parameter create name=HealthCheckEvent parName=url schemaName=SimpleStringType
+event parameter create name=HealthCheckEvent parName=healthy schemaName=SimpleBooleanType
+event parameter create name=HealthCheckEvent parName=code schemaName=SimpleIntegerType
+event parameter create name=HealthCheckEvent parName=message schemaName=SimpleStringType
+
+task create name=HealthCheckTask
+task inputfield create name=HealthCheckTask fieldName=name schemaName=SimpleStringType
+task inputfield create name=HealthCheckTask fieldName=url schemaName=SimpleStringType
+task inputfield create name=HealthCheckTask fieldName=healthy schemaName=SimpleBooleanType
+task inputfield create name=HealthCheckTask fieldName=code schemaName=SimpleIntegerType
+task inputfield create name=HealthCheckTask fieldName=message schemaName=SimpleStringType
+
+task outputfield create name=HealthCheckTask fieldName=name schemaName=SimpleStringType
+task outputfield create name=HealthCheckTask fieldName=url schemaName=SimpleStringType
+task outputfield create name=HealthCheckTask fieldName=healthy schemaName=SimpleBooleanType
+task outputfield create name=HealthCheckTask fieldName=code schemaName=SimpleIntegerType
+task outputfield create name=HealthCheckTask fieldName=message schemaName=SimpleStringType
+
+task logic create name=HealthCheckTask logicFlavour=JAVASCRIPT logic=LS
+#MACROFILE:"src/main/resources/logic/HealthCheckTask.js"
+LE
+
+policy create name=HealthCheckPolicy template=freestyle firstState=HealthCheckState
+
+policy state create name=HealthCheckPolicy stateName=HealthCheckState triggerName=HealthCheckEvent defaultTaskName=HealthCheckTask
+policy state output create name=HealthCheckPolicy stateName=HealthCheckState outputName=HealthCheckOutput eventName=HealthCheckEvent
+policy state taskref create name=HealthCheckPolicy stateName=HealthCheckState taskName=HealthCheckTask outputType=DIRECT outputName=HealthCheckOutput
+
+validate
+
diff --git a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/ClassBuilder.java b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/ClassBuilder.java
index 7070daad3..4c8bd1384 100644
--- a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/ClassBuilder.java
+++ b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/ClassBuilder.java
@@ -39,6 +39,7 @@ import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl;
* <a href="https://github.com/KetothXupack/stackoverflow-answers/tree/master/q39401083">
* https://github.com/KetothXupack/stackoverflow-answers/tree/master/q39401083</a><br>
*/
+@SuppressWarnings("restriction")
public class ClassBuilder {
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(ClassBuilder.class);
@@ -69,8 +70,9 @@ public class ClassBuilder {
return new ClassBuilder(Class.forName("java.lang." + className));
} catch (Exception classFindException) {
LOGGER.warn("class not found", classFindException);
- throw new IllegalArgumentException("Class '" + className
- + "' not found. Also looked for a class called 'java.lang." + className + "'", e);
+ throw new IllegalArgumentException(
+ "Class '" + className + "' not found. Also looked for a class called 'java.lang." + className + "'",
+ e);
}
}
}
diff --git a/packages/apex-pdp-package-full/pom.xml b/packages/apex-pdp-package-full/pom.xml
index a3ca91cc6..de2ccf773 100644
--- a/packages/apex-pdp-package-full/pom.xml
+++ b/packages/apex-pdp-package-full/pom.xml
@@ -357,7 +357,7 @@
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/examples/models/DecisionMaker</outputDirectory>
- <includes>DecisionMakerPolicyModel.json</includes>
+ <includes>*PolicyModel.json</includes>
</artifactItem>
<artifactItem>
<groupId>org.onap.policy.apex-pdp.examples</groupId>
diff --git a/packages/apex-pdp-package-full/src/main/package/tarball/assembly.xml b/packages/apex-pdp-package-full/src/main/package/tarball/assembly.xml
index 6dd024f2d..5101821ed 100644
--- a/packages/apex-pdp-package-full/src/main/package/tarball/assembly.xml
+++ b/packages/apex-pdp-package-full/src/main/package/tarball/assembly.xml
@@ -62,7 +62,7 @@
<include>**/*</include>
</includes>
<outputDirectory>etc</outputDirectory>
- <lineEnding>unix</lineEnding>
+ <lineEnding>keep</lineEnding>
<excludes>
<exclude>*.formatted</exclude>
</excludes>
diff --git a/packages/apex-pdp-package-full/src/main/resources/ssl/ca-aaf.crt b/packages/apex-pdp-package-full/src/main/resources/ssl/ca-aaf.crt
new file mode 100644
index 000000000..e9a50d7ea
--- /dev/null
+++ b/packages/apex-pdp-package-full/src/main/resources/ssl/ca-aaf.crt
@@ -0,0 +1,31 @@
+-----BEGIN CERTIFICATE-----
+MIIFPjCCAyagAwIBAgIJAJ6u7cCnzrWdMA0GCSqGSIb3DQEBCwUAMCwxDjAMBgNV
+BAsMBU9TQUFGMQ0wCwYDVQQKDARPTkFQMQswCQYDVQQGEwJVUzAeFw0xODA0MDUx
+NDE1MjhaFw0zODAzMzExNDE1MjhaMCwxDjAMBgNVBAsMBU9TQUFGMQ0wCwYDVQQK
+DARPTkFQMQswCQYDVQQGEwJVUzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
+ggIBAMA5pkgRs7NhGG4ew5JouhyYakgYUyFaG121+/h8qbSdt0hVQv56+EA41Yq7
+XGie7RYDQK9NmAFF3gruE+6X7wvJiChp+Cyd7sFMnb65uWhxEdxWTM2BJFrgfzUn
+H8ZCxgaCo3XH4PzlKRy2LQQJEJECwl/RZmRCXijMt5e9h8XoZY/fKkKcZZUsWNCM
+pTo266wjvA9MXLmdgReRj0+vrCjrNqy+htwJDztoiHWiYPqT6o8EvGcgjNqjlZx7
+NUNf8MfLDByqKF6+wRbHv1GKjn3/Vijd45Fv8riyRYROiFanvbV6jIfBkv8PZbXg
+2VDWsYsgp8NAvMxK+iV8cO+Ck3lBI2GOPZbCEqpPVTYbLUz6sczAlCXwQoPzDIZY
+wYa3eR/gYLY1gP2iEVHORag3bLPap9ZX5E8DZkzTNTjovvLk8KaCmfcaUMJsBtDd
+ApcUitz10cnRyZc1sX3gE1f3DpzQM6t9C5sOVyRhDcSrKqqwb9m0Ss04XAS9FsqM
+P3UWYQyqDXSxlUAYaX892u8mV1hxnt2gjb22RloXMM6TovM3sSrJS0wH+l1nznd6
+aFXftS/G4ZVIVZ/LfT1is4StoyPWZCwwwly1z8qJQ/zhip5NgZTxQw4mi7ww35DY
+PdAQOCoajfSvFjqslQ/cPRi/MRCu079heVb5fQnnzVtnpFQRAgMBAAGjYzBhMB0G
+A1UdDgQWBBRTVTPyS+vQUbHBeJrBKDF77+rtSTAfBgNVHSMEGDAWgBRTVTPyS+vQ
+UbHBeJrBKDF77+rtSTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAN
+BgkqhkiG9w0BAQsFAAOCAgEAPx/IaK94n02wPxpnYTy+LVLIxwdq/kawNd6IbiMz
+L87zmNMDmHcGbfoRCj8OkhuggX9Lx1/CkhpXimuYsZOFQi5blr/u+v4mIbsgbmi9
+7j+cUHDP0zLycvSvxKHty51LwmaX9a4wkJl5zBU4O1sd/H9tWcEmwJ39ltKoBKBx
+c94Zc3iMm5ytRWGj+0rKzLDAXEWpoZ5bE5PLJauA6UDCxDLfs3FwhbS7uDggxYvf
+jySF5FCNET94oJ+m8s7VeHvoa8iPGKvXrIqdd7XDHnqJJlVKr7m9S0fMbyEB8ci2
+RtOXDt93ifY1uhoEtEykn4dqBSp8ezvNMnwoXdYPDvTd9uCAFeWFLVreBAWxd25h
+PsBTkZA5hpa/rA+mKv6Af4VBViYr8cz4dZCsFChuioVebe9ighrfjB//qKepFjPF
+CyjzKN1u0JKm/2x/ORqxkTONG8p3uDwoIOyimUcTtTMv42bfYD88RKakqSFXE9G+
+Z0LlaKABqfjK49o/tsAp+c5LoNlYllKhnetO3QAdraHwdmC36BhoghzR1jpX751A
+cZn2VH3Q4XKyp01cJNCJIrua+A+bx6zh3RyW6zIIkbRCbET+UD+4mr8WIcSE3mtR
+ZVlnhUDO4z9//WKMVzwS9Rh8/kuszrGFI1KQozXCHLrce3YP6RYZfOed79LXaRwX
+dYY=
+-----END CERTIFICATE-----
diff --git a/packages/apex-pdp-package-full/src/main/resources/ssl/policy-keystore b/packages/apex-pdp-package-full/src/main/resources/ssl/policy-keystore
new file mode 100644
index 000000000..abd5fe88c
--- /dev/null
+++ b/packages/apex-pdp-package-full/src/main/resources/ssl/policy-keystore
Binary files differ
diff --git a/packages/apex-pdp-package-full/src/main/resources/ssl/policy-truststore b/packages/apex-pdp-package-full/src/main/resources/ssl/policy-truststore
new file mode 100644
index 000000000..8834ac257
--- /dev/null
+++ b/packages/apex-pdp-package-full/src/main/resources/ssl/policy-truststore
Binary files differ
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java
index 04397d688..5591777eb 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java
@@ -202,7 +202,7 @@ public class ApexRestClientConsumer implements ApexEventConsumer, Runnable {
public void run() {
try {
final Response response = client.target(restConsumerProperties.getUrl()).request("application/json")
- .get();
+ .headers(restConsumerProperties.getHttpHeadersAsMultivaluedMap()).get();
// Check that the event request worked
if (response.getStatus() != Response.Status.OK.getStatusCode()) {
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java
index a7e0ddd52..4113cea4b 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java
@@ -183,9 +183,11 @@ public class ApexRestClientProducer implements ApexEventProducer {
private Response sendEventAsRestRequest(final String event) {
// We have already checked that it is a PUT or POST request
if (RestClientCarrierTechnologyParameters.HttpMethod.POST.equals(restProducerProperties.getHttpMethod())) {
- return client.target(restProducerProperties.getUrl()).request("application/json").post(Entity.json(event));
+ return client.target(restProducerProperties.getUrl()).request("application/json")
+ .headers(restProducerProperties.getHttpHeadersAsMultivaluedMap()).post(Entity.json(event));
} else {
- return client.target(restProducerProperties.getUrl()).request("application/json").put(Entity.json(event));
+ return client.target(restProducerProperties.getUrl()).request("application/json")
+ .headers(restProducerProperties.getHttpHeadersAsMultivaluedMap()).put(Entity.json(event));
}
}
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 1498678e9..ae75dd7e5 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
@@ -147,7 +147,7 @@ public class ApexRestClientConusmerTest {
consumerParameters.setCarrierTechnologyParameters(rcctp);
rcctp.setUrl("http://some.place.that.does.not/exist");
SupportApexEventReceiver incomingEventReceiver = new SupportApexEventReceiver();
-
+
try {
arcc.init("RestClientConsumer", consumerParameters, incomingEventReceiver);
assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.GET, rcctp.getHttpMethod());
@@ -163,6 +163,7 @@ public class ApexRestClientConusmerTest {
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());
arcc.setClient(httpClientMock);
@@ -182,7 +183,7 @@ public class ApexRestClientConusmerTest {
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"));
}
@@ -215,6 +216,7 @@ public class ApexRestClientConusmerTest {
Mockito.doReturn(Response.Status.OK.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());
arcc.setClient(httpClientMock);
@@ -231,12 +233,11 @@ public class ApexRestClientConusmerTest {
} catch (Exception e) {
fail("test should not throw an exception");
}
-
+
final String outString = outContent.toString();
System.setOut(stdout);
-
- assertTrue(outString.contains(
- "received an empty event from URL \"http://some.place.that.does.not/exist\""));
+
+ assertTrue(outString.contains("received an empty event from URL \"http://some.place.that.does.not/exist\""));
}
@Test
@@ -268,6 +269,7 @@ public class ApexRestClientConusmerTest {
Mockito.doReturn("").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());
arcc.setClient(httpClientMock);
@@ -284,12 +286,11 @@ public class ApexRestClientConusmerTest {
} catch (Exception e) {
fail("test should not throw an exception");
}
-
+
final String outString = outContent.toString();
System.setOut(stdout);
-
- assertTrue(outString.contains(
- "received an empty event from URL \"http://some.place.that.does.not/exist\""));
+
+ assertTrue(outString.contains("received an empty event from URL \"http://some.place.that.does.not/exist\""));
}
@Test
@@ -321,6 +322,7 @@ public class ApexRestClientConusmerTest {
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());
arcc.setClient(httpClientMock);
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 3ef172427..8f0e0940b 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
@@ -161,13 +161,14 @@ public class ApexRestClientProducerTest {
Mockito.doReturn(Response.Status.OK.getStatusCode()).when(responseMock).getStatus();
Mockito.doReturn(responseMock).when(builderMock).put(Mockito.any());
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
+ Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
arcp.setClient(httpClientMock);
try {
arcp.sendEvent(123, "EventName", "This is an Event");
arcp.stop();
- } catch (Exception e) {
+ } catch (Exception ex) {
fail("test should not throw an exception");
}
}
@@ -197,6 +198,7 @@ public class ApexRestClientProducerTest {
Mockito.doReturn(Response.Status.OK.getStatusCode()).when(responseMock).getStatus();
Mockito.doReturn(responseMock).when(builderMock).post(Mockito.any());
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
+ Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
arcp.setClient(httpClientMock);
@@ -239,6 +241,7 @@ public class ApexRestClientProducerTest {
Mockito.doReturn(Response.Status.OK.getStatusCode()).when(responseMock).getStatus();
Mockito.doReturn(responseMock).when(builderMock).post(Mockito.any());
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
+ Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
arcp.setClient(httpClientMock);
@@ -250,14 +253,13 @@ public class ApexRestClientProducerTest {
}
}
-
@Test
public void testApexRestClientProducerPostEventCacheTrace() {
MockitoAnnotations.initMocks(this);
ch.qos.logback.classic.Logger classicLogger = (ch.qos.logback.classic.Logger) LOGGER;
classicLogger.setLevel(Level.TRACE);
-
+
ApexRestClientProducer arcp = new ApexRestClientProducer();
assertNotNull(arcp);
@@ -285,6 +287,7 @@ public class ApexRestClientProducerTest {
Mockito.doReturn(Response.Status.OK.getStatusCode()).when(responseMock).getStatus();
Mockito.doReturn(responseMock).when(builderMock).post(Mockito.any());
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
+ Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
arcp.setClient(httpClientMock);
@@ -321,6 +324,7 @@ public class ApexRestClientProducerTest {
Mockito.doReturn(Response.Status.BAD_REQUEST.getStatusCode()).when(responseMock).getStatus();
Mockito.doReturn(responseMock).when(builderMock).post(Mockito.any());
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
+ Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
arcp.setClient(httpClientMock);