aboutsummaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java8
-rw-r--r--testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactoryTest.java45
-rw-r--r--testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelFactoryTest.java54
-rw-r--r--testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelSaverTest.java74
4 files changed, 177 insertions, 4 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 70d723567..db214636b 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
@@ -215,7 +215,7 @@ public class EvalDomainModelFactory {
final AxTasks tasks = new AxTasks(new AxArtifactKey("Tasks", DEFAULT_VERSION));
final AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(PACKAGE)
- .setDefaultLogic("EvalTask_Logic");
+ .setDefaultLogic("EvalTaskLogic");
final AxTask obTask = new AxTask(new AxArtifactKey("Task_Observe_0", DEFAULT_VERSION));
obTask.duplicateInputFields(event0000.getParameterMap());
@@ -382,7 +382,7 @@ public class EvalDomainModelFactory {
final List<String> axLogicExecutorTypeList, final List<AxArtifactKey> defaultTaskList,
final List<Set<AxArtifactKey>> taskKeySetList) {
final AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(PACKAGE)
- .setDefaultLogic("EvalState_Logic");
+ .setDefaultLogic("EvalStateLogic");
final AxState actState = new AxState(new AxReferenceKey(policyKey, "Act"));
actState.setTrigger(inEventKeyList.get(THIRD_MEMBER));
@@ -459,7 +459,7 @@ public class EvalDomainModelFactory {
final AxTasks tasks = new AxTasks(new AxArtifactKey("Tasks", DEFAULT_VERSION));
final AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(PACKAGE)
- .setDefaultLogic("EvalTask_Logic");
+ .setDefaultLogic("EvalTaskLogic");
final AxTask eTask = new AxTask(new AxArtifactKey("Task_Event_0", DEFAULT_VERSION));
eTask.duplicateInputFields(event0000.getParameterMap());
@@ -584,7 +584,7 @@ public class EvalDomainModelFactory {
final List<AxArtifactKey> outEventKeyList, final List<String> axLogicExecutorTypeList,
final List<AxArtifactKey> defaultTaskList, final List<Set<AxArtifactKey>> taskKeySetList) {
final AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(PACKAGE)
- .setDefaultLogic("EvalState_Logic");
+ .setDefaultLogic("EvalStateLogic");
final AxState actionState = new AxState(new AxReferenceKey(policyKey, ACTION));
actionState.setTrigger(inEventKeyList.get(2));
diff --git a/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactoryTest.java b/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactoryTest.java
new file mode 100644
index 000000000..5149c8675
--- /dev/null
+++ b/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactoryTest.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 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.model;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
+
+/**
+ * Test the evaluation domain model factory.
+ */
+public class EvalDomainModelFactoryTest {
+
+ @Test
+ public void testEvalDomainModelFactory() {
+ EvalDomainModelFactory edmf = new EvalDomainModelFactory();
+ assertNotNull(edmf);
+
+ AxPolicyModel ecaPolicyModel = edmf.getEcaPolicyModel();
+ assertEquals("EvaluationPolicyModel_ECA:0.0.1", ecaPolicyModel.getId());
+
+ AxPolicyModel oodaPolicyModel = edmf.getOodaPolicyModel();
+ assertEquals("EvaluationPolicyModel_OODA:0.0.1", oodaPolicyModel.getId());
+ }
+}
diff --git a/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelFactoryTest.java b/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelFactoryTest.java
new file mode 100644
index 000000000..406bec11f
--- /dev/null
+++ b/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelFactoryTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 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.model;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
+
+/**
+ * Test the evaluation domain model factory.
+ */
+public class SampleDomainModelFactoryTest {
+
+ @Test
+ public void testSampleDomainModelFactory() {
+ SampleDomainModelFactory sdmf = new SampleDomainModelFactory();
+ assertNotNull(sdmf);
+
+ AxPolicyModel samplePolicyModel = sdmf.getSamplePolicyModel("JAVASCRIPT");
+ assertEquals("SamplePolicyModelJAVASCRIPT:0.0.1", samplePolicyModel.getId());
+
+ samplePolicyModel = sdmf.getSamplePolicyModel("JAVA");
+ assertEquals("SamplePolicyModelJAVA:0.0.1", samplePolicyModel.getId());
+
+ samplePolicyModel = sdmf.getSamplePolicyModel("JYTHON");
+ assertEquals("SamplePolicyModelJYTHON:0.0.1", samplePolicyModel.getId());
+
+ samplePolicyModel = sdmf.getSamplePolicyModel("JRUBY");
+ assertEquals("SamplePolicyModelJRUBY:0.0.1", samplePolicyModel.getId());
+
+ samplePolicyModel = sdmf.getSamplePolicyModel("MVEL");
+ assertEquals("SamplePolicyModelMVEL:0.0.1", samplePolicyModel.getId());
+ }
+}
diff --git a/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelSaverTest.java b/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelSaverTest.java
new file mode 100644
index 000000000..744f47db8
--- /dev/null
+++ b/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelSaverTest.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 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.model;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Comparator;
+
+import org.junit.Test;
+
+/**
+ * Test the sample domain model saver.
+ */
+public class SampleDomainModelSaverTest {
+
+ @Test
+ public void testSampleDomainModelSaver() throws IOException {
+ try {
+ SampleDomainModelSaver.main(null);
+ fail("test should throw an exception");
+ } catch (Exception exc) {
+ assertEquals("java.lang.NullPointerException", exc.getClass().getCanonicalName());
+ }
+
+ String[] args0 =
+ { "two", "arguments" };
+
+ try {
+ SampleDomainModelSaver.main(args0);
+ } catch (Exception exc) {
+ fail("test should not throw an exception");
+ }
+
+ Path tempDirectory = Files.createTempDirectory("ApexModelTempDir");
+ String[] args1 =
+ { tempDirectory.toString() };
+
+ try {
+ SampleDomainModelSaver.main(args1);
+ } catch (Exception exc) {
+ fail("test should not throw an exception");
+ }
+
+ File tempDir = new File(tempDirectory.toString());
+ assertTrue(tempDir.isDirectory());
+ assertEquals(10, tempDir.listFiles().length);
+
+ Files.walk(tempDirectory).sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
+ }
+}