aboutsummaryrefslogtreecommitdiffstats
path: root/testsuites/integration/integration-common/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/integration/integration-common/src/main/java')
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java4
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java10
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalTaskLogic.java5
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/testclasses/PingTestClass.java147
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/testclasses/package-info.java26
5 files changed, 179 insertions, 13 deletions
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java
index db214636b..05829e452 100644
--- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java
@@ -65,7 +65,6 @@ public class EvalDomainModelFactory {
private static final String EVENT = "Event";
private static final String TASK_SELECTION_LOGIC = "TaskSelectionLogic";
private static final String JYTHON = "JYTHON";
- private static final String JRUBY = "JRUBY";
private static final String MVEL = "MVEL";
private static final String ORIENT = "Orient";
private static final String STATE_NAME = "<STATE_NAME>";
@@ -221,7 +220,7 @@ public class EvalDomainModelFactory {
obTask.duplicateInputFields(event0000.getParameterMap());
obTask.duplicateOutputFields(event0001.getParameterMap());
final AxTaskLogic obAxLogic = new AxTaskLogic(obTask.getKey(), TASK_LOGIC,
- (justOneLang == null ? JRUBY : justOneLang), logicReader);
+ (justOneLang == null ? JAVASCRIPT : justOneLang), logicReader);
obAxLogic.setLogic(obAxLogic.getLogic().replaceAll(STATE_NAME, OBSERVE)
.replaceAll(TASK_NAME, obTask.getKey().getName()).replaceAll(STATE_NUMBER, "1"));
obTask.setTaskLogic(obAxLogic);
@@ -361,7 +360,6 @@ public class EvalDomainModelFactory {
axLogicExecutorTypeList.add(JYTHON);
axLogicExecutorTypeList.add(JYTHON);
axLogicExecutorTypeList.add(MVEL);
- axLogicExecutorTypeList.add(JRUBY);
}
return axLogicExecutorTypeList;
}
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java
index 854a9bb3c..0dd59ed86 100644
--- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java
@@ -20,7 +20,6 @@
package org.onap.policy.apex.testsuites.integration.common.model.java;
-import java.util.Date;
import java.util.Random;
import org.onap.policy.apex.core.engine.executor.context.TaskExecutionContext;
@@ -49,24 +48,23 @@ public class DefaultTaskLogic {
String inFieldsString = executor.inFields.toString();
executor.logger.debug(inFieldsString);
- final Date timeNow = new Date();
final Random rand = new Random();
if (executor.inFields.containsKey("TestDecideCaseSelected")) {
executor.outFields.put("TestActCaseSelected", (byte) rand.nextInt(BOUND_FOR_RANDOM_INT));
- executor.outFields.put("TestActStateTime", timeNow.getTime());
+ executor.outFields.put("TestActStateTime", java.lang.System.nanoTime());
}
else if (executor.inFields.containsKey("TestEstablishCaseSelected")) {
executor.outFields.put("TestDecideCaseSelected", (byte) rand.nextInt(BOUND_FOR_RANDOM_INT));
- executor.outFields.put("TestDecideStateTime", timeNow.getTime());
+ executor.outFields.put("TestDecideStateTime", java.lang.System.nanoTime());
}
else if (executor.inFields.containsKey("TestMatchCaseSelected")) {
executor.outFields.put("TestEstablishCaseSelected", (byte) rand.nextInt(BOUND_FOR_RANDOM_INT));
- executor.outFields.put("TestEstablishStateTime", timeNow.getTime());
+ executor.outFields.put("TestEstablishStateTime", java.lang.System.nanoTime());
}
else {
executor.outFields.put("TestMatchCaseSelected", (byte) rand.nextInt(BOUND_FOR_RANDOM_INT));
- executor.outFields.put("TestMatchStateTime", timeNow.getTime());
+ executor.outFields.put("TestMatchStateTime", java.lang.System.nanoTime());
}
return true;
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalTaskLogic.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalTaskLogic.java
index 2d60926f6..29c58f148 100644
--- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalTaskLogic.java
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalTaskLogic.java
@@ -20,8 +20,6 @@
package org.onap.policy.apex.testsuites.integration.common.model.java;
-import java.util.Date;
-
import org.onap.policy.apex.core.engine.executor.context.TaskExecutionContext;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
@@ -46,8 +44,7 @@ public class EvalTaskLogic {
executor.outFields.putAll(executor.inFields);
- final Date timeNow = new Date();
- executor.outFields.put("State3Timestamp", timeNow.getTime());
+ executor.outFields.put("State3Timestamp", java.lang.System.nanoTime());
String outFieldString = executor.outFields.toString();
executor.logger.debug(outFieldString);
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/testclasses/PingTestClass.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/testclasses/PingTestClass.java
new file mode 100644
index 000000000..31e0f3978
--- /dev/null
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/testclasses/PingTestClass.java
@@ -0,0 +1,147 @@
+/*-
+ * ============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=========================================================
+ */
+
+package org.onap.policy.apex.testsuites.integration.common.testclasses;
+
+import java.io.Serializable;
+
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+
+/**
+ * The Class TestPing.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class PingTestClass implements Serializable {
+ private static final long serialVersionUID = -3400711508992955886L;
+
+ private String name = "Rose";
+ private String description = "A rose by any other name would smell as sweet";
+ private long pingTime = System.currentTimeMillis();
+ private long pongTime = -1;
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(final String description) {
+ this.description = description;
+ }
+
+ /**
+ * Gets the ping time.
+ *
+ * @return the ping time
+ */
+ public long getPingTime() {
+ return pingTime;
+ }
+
+ /**
+ * Sets the ping time.
+ *
+ * @param pingTime the new ping time
+ */
+ public void setPingTime(final long pingTime) {
+ this.pingTime = pingTime;
+ }
+
+ /**
+ * Gets the pong time.
+ *
+ * @return the pong time
+ */
+ public long getPongTime() {
+ return pongTime;
+ }
+
+ /**
+ * Sets the pong time.
+ *
+ * @param pongTime the new pong time
+ */
+ public void setPongTime(final long pongTime) {
+ this.pongTime = pongTime;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "TestPing [name=" + name + ", description=" + description + ", pingTime=" + pingTime + ", pongTime="
+ + pongTime + "]";
+ }
+
+ /**
+ * Verify the class.
+ *
+ * @throws ApexException the apex event exception
+ */
+ public void verify() throws ApexException {
+ if (name == null || name.length() < 4) {
+ throw new ApexException("TestPing is not valid, name length null or less than 4");
+ }
+
+ if (!name.startsWith("Rose")) {
+ throw new ApexException("TestPing is not valid, name does not start with \"Rose\"");
+ }
+
+ if (description == null || description.length() <= 44) {
+ throw new ApexException("TestPing is not valid, description length null or less than 44");
+ }
+
+ if (!description.startsWith("A rose by any other name would smell as sweet")) {
+ throw new ApexException("TestPing is not valid, description is incorrect");
+ }
+
+ if (pongTime <= pingTime) {
+ throw new ApexException("TestPing is not valid, pong time is not greater than ping time");
+ }
+ }
+}
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/testclasses/package-info.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/testclasses/package-info.java
new file mode 100644
index 000000000..320b36467
--- /dev/null
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/testclasses/package-info.java
@@ -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=========================================================
+ */
+
+/**
+ * Package for common test classes for Apex.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+package org.onap.policy.apex.testsuites.integration.common.testclasses;