aboutsummaryrefslogtreecommitdiffstats
path: root/testsuites/integration/integration-uservice-test
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/integration/integration-uservice-test')
-rw-r--r--testsuites/integration/integration-uservice-test/pom.xml4
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngineTestServer.java17
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java40
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java45
4 files changed, 54 insertions, 52 deletions
diff --git a/testsuites/integration/integration-uservice-test/pom.xml b/testsuites/integration/integration-uservice-test/pom.xml
index bfcfc4294..6de0f0cef 100644
--- a/testsuites/integration/integration-uservice-test/pom.xml
+++ b/testsuites/integration/integration-uservice-test/pom.xml
@@ -1,7 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. All rights reserved.
- Modifications Copyright (C) 2019 Nordix Foundation.
+ Modifications Copyright (C) 2019-2020 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId>
- <artifactId>integration</artifactId>
+ <artifactId>apex-integration</artifactId>
<version>2.3.0-SNAPSHOT</version>
</parent>
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngineTestServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngineTestServer.java
index 585787c28..103704df2 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngineTestServer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngineTestServer.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 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=========================================================
*/
@@ -200,10 +201,10 @@ public class EngineTestServer implements Runnable, EngineServiceEventInterface {
}
/**
- * The listener interface for receiving testApex events. The class that is interested in
- * processing a testApex event implements this interface, and the object created with that class
- * is registered with a component using the component's {@code addTestApexListener} method. When
- * the testApex event occurs, that object's appropriate method is invoked.
+ * The listener interface for receiving testApex events. The class that is interested in processing a testApex event
+ * implements this interface, and the object created with that class is registered with a component using the
+ * component's {@code addTestApexListener} method. When the testApex event occurs, that object's appropriate method
+ * is invoked.
*
* <p>This class listens for events from the Apex engine
*
@@ -245,7 +246,7 @@ public class EngineTestServer implements Runnable, EngineServiceEventInterface {
// CHECKSTYLE:OFF: checkstyle:magicNumber
assert result.get("TestSlogan").equals("This is a test slogan");
- assert result.get("TestMatchCase").equals(new Byte((byte) 123));
+ assert result.get("TestMatchCase").equals((byte) 123);
assert result.get("TestTemperature").equals(34.5445667);
assert ((byte) result.get("TestMatchCaseSelected") >= 0 && (byte) result.get("TestMatchCaseSelected") <= 3);
assert ((byte) result.get("TestEstablishCaseSelected") >= 0
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java
index 3ea4bde84..3a15b3906 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 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=========================================================
*/
@@ -165,7 +166,7 @@ public class ApexServiceModelUpdateTest {
} catch (final Exception e) {
e.printStackTrace();
assertEquals("start()<-Machine-1_process-1_engine-1-0:0.0.0,STOPPED, cannot start engine, "
- + "engine has not been initialized, its model is not loaded", e.getMessage());
+ + "engine has not been initialized, its model is not loaded", e.getMessage());
}
}
@@ -233,8 +234,8 @@ public class ApexServiceModelUpdateTest {
} catch (final Exception e) {
System.err.println(e.getMessage());
assertEquals("apex model update failed, supplied model with key \"INCOMPATIBLE:0.0.1\" is not a compatible "
- + "model update from the existing engine model "
- + "with key \"SamplePolicyModelJAVASCRIPT:0.0.1\"", e.getMessage());
+ + "model update from the existing engine model " + "with key \"SamplePolicyModelJAVASCRIPT:0.0.1\"",
+ e.getMessage());
}
// Still on old model
@@ -251,8 +252,8 @@ public class ApexServiceModelUpdateTest {
System.err.println(e.getMessage());
e.printStackTrace();
assertEquals("apex model update failed, supplied model with key \"SamplePolicyModelJAVASCRIPT:1.0.1\" "
- + "is not a compatible model update from the existing engine model with key "
- + "\"SamplePolicyModelJAVASCRIPT:0.0.1\"", e.getMessage());
+ + "is not a compatible model update from the existing engine model with key "
+ + "\"SamplePolicyModelJAVASCRIPT:0.0.1\"", e.getMessage());
}
// Still on old model
@@ -323,7 +324,7 @@ public class ApexServiceModelUpdateTest {
/**
* Utility method to send some events into the test engine.
- *
+ *
* @throws ApexEventException if there is an error
*/
private void sendEvents() throws ApexEventException {
@@ -337,13 +338,13 @@ public class ApexServiceModelUpdateTest {
eventDataMap.put("TestTimestamp", testStartTime.getTime());
eventDataMap.put("TestTemperature", 34.5445667);
- final ApexEvent event = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events",
- "test", "apex");
+ final ApexEvent event =
+ new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
event.putAll(eventDataMap);
engineServiceEventInterface.sendEvent(event);
- final ApexEvent event2 = new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events",
- "test", "apex");
+ final ApexEvent event2 =
+ new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
event2.putAll(eventDataMap);
engineServiceEventInterface.sendEvent(event2);
@@ -388,19 +389,18 @@ public class ApexServiceModelUpdateTest {
assertTrue(result.getName().startsWith("Event0004") || result.getName().startsWith("Event0104"));
assertTrue(result.get("TestSlogan").equals("This is a test slogan"));
- assertTrue(result.get("TestMatchCase").equals(new Byte((byte) 123)));
+ assertTrue(result.get("TestMatchCase").equals((byte) 123));
assertTrue(result.get("TestTemperature").equals(34.5445667));
assertTrue(((byte) result.get("TestMatchCaseSelected")) >= 0
- && ((byte) result.get("TestMatchCaseSelected") <= 3));
+ && ((byte) result.get("TestMatchCaseSelected") <= 3));
assertTrue(((byte) result.get("TestEstablishCaseSelected")) >= 0
- && ((byte) result.get("TestEstablishCaseSelected") <= 3));
+ && ((byte) result.get("TestEstablishCaseSelected") <= 3));
assertTrue(((byte) result.get("TestDecideCaseSelected")) >= 0
- && ((byte) result.get("TestDecideCaseSelected") <= 3));
- assertTrue(((byte) result.get("TestActCaseSelected")) >= 0
- && ((byte) result.get("TestActCaseSelected") <= 3));
+ && ((byte) result.get("TestDecideCaseSelected") <= 3));
+ assertTrue(
+ ((byte) result.get("TestActCaseSelected")) >= 0 && ((byte) result.get("TestActCaseSelected") <= 3));
}
}
-
/**
* Gets the model string.
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java
index 2377cfb91..052f6a2af 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -176,14 +177,14 @@ public class ApexServiceTest {
eventDataMap.put("TestTimestamp", testStartTime.getTime());
eventDataMap.put("TestTemperature", 34.5445667);
- final ApexEvent event = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events",
- "test", "apex");
+ final ApexEvent event =
+ new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
event.setExecutionId(System.nanoTime());
event.putAll(eventDataMap);
engineServiceEventInterface.sendEvent(event);
- final ApexEvent event2 = new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events",
- "test", "apex");
+ final ApexEvent event2 =
+ new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
event2.setExecutionId(System.nanoTime());
event2.putAll(eventDataMap);
engineServiceEventInterface.sendEvent(event2);
@@ -236,8 +237,8 @@ public class ApexServiceTest {
eventDataMap.put("TestTimestamp", testStartTime.getTime());
eventDataMap.put("TestTemperature", 34.5445667);
- final ApexEvent event1 = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events",
- "test", "apex");
+ final ApexEvent event1 =
+ new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
event1.putAll(eventDataMap);
event1.setExecutionId(System.nanoTime());
@@ -258,8 +259,8 @@ public class ApexServiceTest {
ThreadUtilities.sleep(100);
}
- final ApexEvent event2 = new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events",
- "test", "apex");
+ final ApexEvent event2 =
+ new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
event2.setExecutionId(System.nanoTime());
event2.putAll(eventDataMap);
@@ -326,14 +327,14 @@ public class ApexServiceTest {
eventDataMap.put("TestTimestamp", testStartTime.getTime());
eventDataMap.put("TestTemperature", 34.5445667);
- final ApexEvent event = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events",
- "test", "apex");
+ final ApexEvent event =
+ new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
event.setExecutionId(System.nanoTime());
event.putAll(eventDataMap);
engineServiceEventInterface.sendEvent(event);
- final ApexEvent event2 = new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events",
- "test", "apex");
+ final ApexEvent event2 =
+ new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
event2.setExecutionId(System.nanoTime());
event2.putAll(eventDataMap);
engineServiceEventInterface.sendEvent(event2);
@@ -386,8 +387,8 @@ public class ApexServiceTest {
eventDataMap.put("TestTimestamp", testStartTime.getTime());
eventDataMap.put("TestTemperature", 34.5445667);
- final ApexEvent event1 = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events",
- "test", "apex");
+ final ApexEvent event1 =
+ new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
event1.putAll(eventDataMap);
final ApexEventListener myEventListener1 = new ApexEventListener() {
@@ -407,8 +408,8 @@ public class ApexServiceTest {
ThreadUtilities.sleep(100);
}
- final ApexEvent event2 = new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events",
- "test", "apex");
+ final ApexEvent event2 =
+ new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
event2.putAll(eventDataMap);
final ApexEventListener myEventListener2 = new ApexEventListener() {
@@ -499,16 +500,16 @@ public class ApexServiceTest {
assertTrue(result.getName().startsWith("Event0004") || result.getName().startsWith("Event0104"));
assertTrue(result.get("TestSlogan").equals("This is a test slogan"));
- assertTrue(result.get("TestMatchCase").equals(new Byte((byte) 123)));
+ assertTrue(result.get("TestMatchCase").equals((byte) 123));
assertTrue(result.get("TestTemperature").equals(34.5445667));
assertTrue(((byte) result.get("TestMatchCaseSelected")) >= 0
- && ((byte) result.get("TestMatchCaseSelected") <= 3));
+ && ((byte) result.get("TestMatchCaseSelected") <= 3));
assertTrue(((byte) result.get("TestEstablishCaseSelected")) >= 0
- && ((byte) result.get("TestEstablishCaseSelected") <= 3));
+ && ((byte) result.get("TestEstablishCaseSelected") <= 3));
assertTrue(((byte) result.get("TestDecideCaseSelected")) >= 0
- && ((byte) result.get("TestDecideCaseSelected") <= 3));
- assertTrue(((byte) result.get("TestActCaseSelected")) >= 0
- && ((byte) result.get("TestActCaseSelected") <= 3));
+ && ((byte) result.get("TestDecideCaseSelected") <= 3));
+ assertTrue(
+ ((byte) result.get("TestActCaseSelected")) >= 0 && ((byte) result.get("TestActCaseSelected") <= 3));
}
}