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());
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));
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());
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));
--- /dev/null
+/*-
+ * ============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());
+ }
+}
--- /dev/null
+/*-
+ * ============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());
+ }
+}
--- /dev/null
+/*-
+ * ============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);
+ }
+}