diff options
Diffstat (limited to 'testsuites/integration/integration-executor-test')
7 files changed, 39 insertions, 79 deletions
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngine.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngine.java index 01107e968..b3e68b2be 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngine.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngine.java @@ -21,6 +21,7 @@ package org.onap.policy.apex.testsuites.integration.executor.engine; +import static org.awaitility.Awaitility.await; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -29,6 +30,7 @@ import java.io.IOException; import java.util.Date; import java.util.HashMap; import java.util.Map; +import java.util.concurrent.TimeUnit; import org.onap.policy.apex.core.engine.EngineParameters; import org.onap.policy.apex.core.engine.engine.ApexEngine; @@ -36,6 +38,7 @@ import org.onap.policy.apex.core.engine.engine.impl.ApexEngineFactory; import org.onap.policy.apex.core.engine.event.EnEvent; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; +import org.onap.policy.apex.model.enginemodel.concepts.AxEngineState; import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; import org.onap.policy.apex.testsuites.integration.common.model.SampleDomainModelFactory; @@ -93,6 +96,8 @@ public class TestApexEngine { final Map<AxArtifactKey, Map<String, Object>> apexContext = apexEngine.getEngineContext(); assertNotNull(apexContext); apexEngine.stop(); + + await().atMost(3L, TimeUnit.SECONDS).until(() -> AxEngineState.STOPPED.equals(apexEngine.getState())); } /** diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJRuby.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJRuby.java index 108e73ac1..f344add45 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJRuby.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJRuby.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========================================================= */ @@ -30,7 +31,6 @@ import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.ContextParameters; import org.onap.policy.apex.context.parameters.SchemaParameters; import org.onap.policy.apex.core.engine.EngineParameters; -import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.plugins.executor.jruby.JrubyExecutorParameters; import org.onap.policy.common.parameters.ParameterService; @@ -49,12 +49,12 @@ public class TestApexEngineJRuby { @Before public void beforeTest() { schemaParameters = new SchemaParameters(); - + schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME); schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters()); ParameterService.register(schemaParameters); - + contextParameters = new ContextParameters(); contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME); @@ -66,7 +66,7 @@ public class TestApexEngineJRuby { ParameterService.register(contextParameters.getDistributorParameters()); ParameterService.register(contextParameters.getLockManagerParameters()); ParameterService.register(contextParameters.getPersistorParameters()); - + engineParameters = new EngineParameters(); engineParameters.getExecutorParameterMap().put("JRUBY", new JrubyExecutorParameters()); ParameterService.register(engineParameters); @@ -78,7 +78,7 @@ public class TestApexEngineJRuby { @After public void afterTest() { ParameterService.deregister(engineParameters); - + ParameterService.deregister(contextParameters.getDistributorParameters()); ParameterService.deregister(contextParameters.getLockManagerParameters()); ParameterService.deregister(contextParameters.getPersistorParameters()); @@ -97,7 +97,6 @@ public class TestApexEngineJRuby { @Test public void testApexEngineJRuby() throws ApexException, InterruptedException, IOException { new TestApexEngine("JRUBY", engineParameters); - ThreadUtilities.sleep(5000); new TestApexEngine("JRUBY", engineParameters); } } diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJava.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJava.java index bfdd08255..48bb897e4 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJava.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJava.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========================================================= */ @@ -30,7 +31,6 @@ import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.ContextParameters; import org.onap.policy.apex.context.parameters.SchemaParameters; import org.onap.policy.apex.core.engine.EngineParameters; -import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.plugins.executor.java.JavaExecutorParameters; import org.onap.policy.common.parameters.ParameterService; @@ -51,12 +51,12 @@ public class TestApexEngineJava { @Before public void beforeTest() { schemaParameters = new SchemaParameters(); - + schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME); schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters()); ParameterService.register(schemaParameters); - + contextParameters = new ContextParameters(); contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME); @@ -68,7 +68,7 @@ public class TestApexEngineJava { ParameterService.register(contextParameters.getDistributorParameters()); ParameterService.register(contextParameters.getLockManagerParameters()); ParameterService.register(contextParameters.getPersistorParameters()); - + engineParameters = new EngineParameters(); engineParameters.getExecutorParameterMap().put("JAVA", new JavaExecutorParameters()); ParameterService.register(engineParameters); @@ -80,7 +80,7 @@ public class TestApexEngineJava { @After public void afterTest() { ParameterService.deregister(engineParameters); - + ParameterService.deregister(contextParameters.getDistributorParameters()); ParameterService.deregister(contextParameters.getLockManagerParameters()); ParameterService.deregister(contextParameters.getPersistorParameters()); @@ -99,7 +99,6 @@ public class TestApexEngineJava { @Test public void testApexEngineJava() throws InterruptedException, IOException, ApexException { new TestApexEngine("JAVA", engineParameters); - ThreadUtilities.sleep(5000); new TestApexEngine("JAVA", engineParameters); } } diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJavascript.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJavascript.java index 05068fcb0..4ace53f31 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJavascript.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJavascript.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========================================================= */ @@ -30,7 +31,6 @@ import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.ContextParameters; import org.onap.policy.apex.context.parameters.SchemaParameters; import org.onap.policy.apex.core.engine.EngineParameters; -import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters; import org.onap.policy.common.parameters.ParameterService; @@ -49,12 +49,12 @@ public class TestApexEngineJavascript { @Before public void beforeTest() { schemaParameters = new SchemaParameters(); - + schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME); schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters()); ParameterService.register(schemaParameters); - + contextParameters = new ContextParameters(); contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME); @@ -66,7 +66,7 @@ public class TestApexEngineJavascript { ParameterService.register(contextParameters.getDistributorParameters()); ParameterService.register(contextParameters.getLockManagerParameters()); ParameterService.register(contextParameters.getPersistorParameters()); - + engineParameters = new EngineParameters(); engineParameters.getExecutorParameterMap().put("JAVASCRIPT", new JavascriptExecutorParameters()); ParameterService.register(engineParameters); @@ -78,7 +78,7 @@ public class TestApexEngineJavascript { @After public void afterTest() { ParameterService.deregister(engineParameters); - + ParameterService.deregister(contextParameters.getDistributorParameters()); ParameterService.deregister(contextParameters.getLockManagerParameters()); ParameterService.deregister(contextParameters.getPersistorParameters()); @@ -98,7 +98,6 @@ public class TestApexEngineJavascript { public void testApexEngineJavascript() throws ApexException, InterruptedException, IOException { new TestApexEngine("JAVASCRIPT", engineParameters); - ThreadUtilities.sleep(5000); new TestApexEngine("JAVASCRIPT", engineParameters); } } diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.java index 088d04fd7..a394e5bca 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.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. @@ -30,7 +31,6 @@ import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.ContextParameters; import org.onap.policy.apex.context.parameters.SchemaParameters; import org.onap.policy.apex.core.engine.EngineParameters; -import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters; import org.onap.policy.common.parameters.ParameterService; @@ -100,7 +100,6 @@ public class TestApexEngineJython { @Test public void testApexEngineJython() throws ApexException, InterruptedException, IOException { new TestApexEngine("JAVASCRIPT", engineParameters); - ThreadUtilities.sleep(5000); new TestApexEngine("JAVASCRIPT", engineParameters); } } diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineMvel.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineMvel.java index 7b4d05a5f..9b4d15ef5 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineMvel.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineMvel.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========================================================= */ @@ -30,7 +31,6 @@ import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.ContextParameters; import org.onap.policy.apex.context.parameters.SchemaParameters; import org.onap.policy.apex.core.engine.EngineParameters; -import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters; import org.onap.policy.common.parameters.ParameterService; @@ -97,7 +97,6 @@ public class TestApexEngineMvel { @Test public void testApexEngineMvel() throws ApexException, InterruptedException, IOException { new TestApexEngine("MVEL", engineParameters); - ThreadUtilities.sleep(5000); new TestApexEngine("MVEL", engineParameters); } } diff --git a/testsuites/integration/integration-executor-test/src/test/resources/logback-test.xml b/testsuites/integration/integration-executor-test/src/test/resources/logback-test.xml index 006555e78..755608346 100644 --- a/testsuites/integration/integration-executor-test/src/test/resources/logback-test.xml +++ b/testsuites/integration/integration-executor-test/src/test/resources/logback-test.xml @@ -2,28 +2,27 @@ <!-- ============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========================================================= --> <configuration> - <contextName>Apex</contextName> <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" /> - <property name="LOG_DIR" value="${java.io.tmpdir}/apex_logging/" /> <!-- USE FOR STD OUT ONLY --> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> @@ -32,47 +31,8 @@ </encoder> </appender> - <root level="INFO"> + <root level="OFF"> <appender-ref ref="STDOUT" /> </root> - <logger name="org.infinispan" level="INFO" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <logger name="org.apache.zookeeper.ClientCnxn" level="OFF" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <appender name="FILE" class="ch.qos.logback.core.FileAppender"> - <file>${LOG_DIR}/apex.log</file> - <encoder> - <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level - %logger{26} - %msg %n %ex{full}</pattern> - </encoder> - </appender> - - <appender name="CTXT_FILE" class="ch.qos.logback.core.FileAppender"> - <file>${LOG_DIR}/apex_ctxt.log</file> - <encoder> - <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level - %logger{26} - %msg %n %ex{full}</pattern> - </encoder> - </appender> - - <logger name="org.onap.policy.apex.core.context.monitoring" level="INFO" additivity="false"> - <appender-ref ref="CTXT_FILE" /> - </logger> - - <logger name="org.onap.policy.apex.core.engine.monitoring" level="INFO" additivity="false"> - <appender-ref ref="CTXT_FILE" /> - </logger> - - <logger name="org.onap.policy.apex.executionlogging" level="INFO" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <logger name="org.onap.policy.apex" level="INFO" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> </configuration> |