diff options
Diffstat (limited to 'testsuites/integration')
6 files changed, 33 insertions, 30 deletions
diff --git a/testsuites/integration/integration-executor-test/pom.xml b/testsuites/integration/integration-executor-test/pom.xml index bca011612..d6ef942b8 100644 --- a/testsuites/integration/integration-executor-test/pom.xml +++ b/testsuites/integration/integration-executor-test/pom.xml @@ -73,6 +73,11 @@ <version>${project.version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <scope>test</scope> + </dependency> </dependencies> <profiles> 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 cb51a8e9e..003f04f7c 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 @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 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========================================================= */ @@ -65,7 +66,7 @@ public class TestApexEngine { final ApexEngine apexEngine = new ApexEngineFactory().createApexEngine(key); final TestApexActionListener listener = new TestApexActionListener("Test"); apexEngine.addEventListener("listener", listener); - apexEngine.updateModel(apexPolicyModel); + apexEngine.updateModel(apexPolicyModel, false); apexEngine.start(); for (final AxEvent axEvent : apexPolicyModel.getEvents().getEventMap().values()) { diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java index 1ae258b01..fb5894656 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 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========================================================= */ @@ -125,7 +126,7 @@ public class TestEventInstantiation { assertNotNull(apexPolicyModel); final ApexEngine apexEngine = new ApexEngineFactory().createApexEngine(apexPolicyModel.getKey()); - apexEngine.updateModel(apexPolicyModel); + apexEngine.updateModel(apexPolicyModel, false); apexEngine.start(); final EnEvent event = apexEngine.createEvent(new AxArtifactKey("Event0000", "0.0.1")); diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java index e8c45b201..ccf8762ed 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java @@ -1,29 +1,30 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 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========================================================= */ package org.onap.policy.apex.testsuites.integration.executor.handling; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; import java.io.IOException; @@ -123,7 +124,7 @@ public class TestContextUpdateDifferentModels { (ApexEngineImpl) new ApexEngineFactory().createApexEngine(new AxArtifactKey("TestApexEngine", "0.0.1")); final TestApexActionListener listener = new TestApexActionListener("Test"); apexEngine.addEventListener("listener", listener); - apexEngine.updateModel(apexModelSample); + apexEngine.updateModel(apexModelSample, false); apexEngine.start(); apexEngine.stop(); @@ -131,13 +132,8 @@ public class TestContextUpdateDifferentModels { final AxPolicyModel someSpuriousModel = new AxPolicyModel(new AxArtifactKey("SomeSpuriousModel", "0.0.1")); assertNotNull(someSpuriousModel); - try { - apexEngine.updateModel(null); - fail("null model should throw an exception"); - } catch (final ApexException e) { - assertEquals("updateModel()<-TestApexEngine:0.0.1, Apex model is not defined, it has a null value", - e.getMessage()); - } + assertThatThrownBy(() -> apexEngine.updateModel(null, false)) + .hasMessage("updateModel()<-TestApexEngine:0.0.1, Apex model is not defined, it has a null value"); assertEquals(apexEngine.getInternalContext().getContextAlbums().size(), apexModelSample.getAlbums().getAlbumsMap().size()); for (final ContextAlbum contextAlbum : apexEngine.getInternalContext().getContextAlbums().values()) { @@ -145,7 +141,7 @@ public class TestContextUpdateDifferentModels { contextAlbum.getAlbumDefinition().equals(apexModelSample.getAlbums().get(contextAlbum.getKey()))); } - apexEngine.updateModel(someSpuriousModel); + apexEngine.updateModel(someSpuriousModel, false); assertEquals(apexEngine.getInternalContext().getContextAlbums().size(), someSpuriousModel.getAlbums().getAlbumsMap().size()); for (final ContextAlbum contextAlbum : apexEngine.getInternalContext().getContextAlbums().values()) { diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateModel.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateModel.java index 615781ab3..75f84b73c 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateModel.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateModel.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 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========================================================= */ @@ -127,7 +128,7 @@ public class TestContextUpdateModel { assertNotNull(model1); assertEquals(2, model1.getPolicies().getPolicyMap().size()); - apexEngine.updateModel(model1); + apexEngine.updateModel(model1, false); apexEngine.start(); sendEvent(apexEngine, listener, "Event0000", true); sendEvent(apexEngine, listener, "Event0100", true); @@ -137,7 +138,7 @@ public class TestContextUpdateModel { assertNotNull(model2); model2.getPolicies().getPolicyMap().remove(new AxArtifactKey("Policy0", "0.0.1")); assertEquals(1, model2.getPolicies().getPolicyMap().size()); - apexEngine.updateModel(model2); + apexEngine.updateModel(model2, false); apexEngine.start(); sendEvent(apexEngine, listener, "Event0000", false); sendEvent(apexEngine, listener, "Event0100", true); @@ -147,7 +148,7 @@ public class TestContextUpdateModel { assertNotNull(model3); model3.getPolicies().getPolicyMap().remove(new AxArtifactKey("Policy1", "0.0.1")); assertEquals(1, model3.getPolicies().getPolicyMap().size()); - apexEngine.updateModel(model3); + apexEngine.updateModel(model3, false); apexEngine.start(); sendEvent(apexEngine, listener, "Event0000", true); sendEvent(apexEngine, listener, "Event0100", false); @@ -156,7 +157,7 @@ public class TestContextUpdateModel { final AxPolicyModel model4 = new SampleDomainModelFactory().getSamplePolicyModel("MVEL"); assertNotNull(model4); assertEquals(2, model4.getPolicies().getPolicyMap().size()); - apexEngine.updateModel(model4); + apexEngine.updateModel(model4, false); apexEngine.start(); sendEvent(apexEngine, listener, "Event0100", true); sendEvent(apexEngine, listener, "Event0000", true); diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java index 3ad6f9881..6675d9f24 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java @@ -27,7 +27,6 @@ import java.io.PrintStream; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.Response; - import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -96,7 +95,7 @@ public class TestExecutionPropertyRest { server.start(); - if (!NetworkUtil.isTcpPortOpen("localHost", PORT, 2000, 1L)) { + if (!NetworkUtil.isTcpPortOpen("localHost", PORT, 60, 500L)) { throw new IllegalStateException("port " + PORT + " is still not in use"); } |