From 9e5c4b882728ebf3330568d068f109965d599410 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Mon, 2 Mar 2020 17:08:47 +0000 Subject: Preparing integration tests for Graal Javascript Graal enforces Javascript more strictly than Nashorn does. This review changes the tests in apex-pdp to comply with the stricter -Javascript checking, re-enabling the integration test module. - All log calls must be passed as strings, using toString() - Byte/Float/Long Java types not supported in Javascript Disable integration tests so that other changes can be brought in. JMS integration test is disabled for now, it will be re-enabled in a review shortly. Issue-ID: POLICY-2106 Change-Id: I14bdb930eff735e862b51802cf72e4793cec3699 Signed-off-by: liamfallon --- .../uservice/adapt/jms/TestJms2Jms.java | 7 ++- .../restclient/TestExecutionPropertyRest.java | 30 +++++++----- .../uservice/adapt/restclient/TestFile2Rest.java | 57 +++++++++++++--------- .../uservice/adapt/restclient/TestRest2File.java | 2 +- .../Context_AvroEventAlbum_EventOutCompare.json | 4 +- .../Context_JavaEventAlbum_EventOutCompare.json | 8 +-- .../executionproperties/logic/AddPropertyTask.js | 7 +-- .../logic/DefinedToEmptyTask.js | 7 +-- .../logic/EmptyToDefinedTask.js | 7 +-- .../executionproperties/logic/EmptyToEmptyTask.js | 7 +-- .../executionproperties/logic/ReadOnlyTask.js | 7 +-- .../logic/RemovePropertyTask.js | 7 +-- .../executionproperties/logic/RunTestStateTSL.js | 5 +- .../executionproperties/logic/TaskFetchHttpCode.js | 13 +++-- .../executionproperties/logic/TaskTagUrl.js | 7 +-- .../ExecutionPropertiesRestTestPolicyModel.apex | 6 +-- .../taskparameters/SetControlLoopNameForTest.js | 14 +++--- .../policies/taskparameters/SetServiceIdForTest.js | 14 +++--- 18 files changed, 99 insertions(+), 110 deletions(-) (limited to 'testsuites/integration/integration-uservice-test/src/test') diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestJms2Jms.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestJms2Jms.java index ca2d3ecc0..60b9711c9 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestJms2Jms.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestJms2Jms.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. @@ -38,6 +39,7 @@ import org.apache.activemq.security.SimpleAuthenticationPlugin; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; @@ -141,8 +143,9 @@ public class TestJms2Jms { * @throws JMSException the JMS exception */ @Test + @Ignore public void testJmsObjectEvents() throws ApexException, JMSException { - final String[] args = { "-rfr", "target", "-c", "target/examples/config/JMS/JMS2JMSObjectEvent.json" }; + final String[] args = {"-rfr", "target", "-c", "target/examples/config/JMS/JMS2JMSObjectEvent.json"}; testJmsEvents(args, true); } @@ -154,7 +157,7 @@ public class TestJms2Jms { */ @Test public void testJmsJsonEvents() throws ApexException, JMSException { - final String[] args = { "-rfr", "target", "-c", "target/examples/config/JMS/JMS2JMSJsonEvent.json" }; + final String[] args = {"-rfr", "target", "-c", "target/examples/config/JMS/JMS2JMSJsonEvent.json"}; testJmsEvents(args, false); } 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 6675d9f24..298a56be6 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 @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-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. @@ -24,9 +24,11 @@ import static org.junit.Assert.assertTrue; import java.io.ByteArrayOutputStream; 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; @@ -87,8 +89,8 @@ public class TestExecutionPropertyRest { throw new IllegalStateException("port " + PORT + " is still in use"); } - server = HttpServletServerFactoryInstance.getServerFactory().build( - "TestExecutionPropertyRest", false, null, PORT, "/TestExecutionRest", false, false); + server = HttpServletServerFactoryInstance.getServerFactory().build("TestExecutionPropertyRest", false, null, + PORT, "/TestExecutionRest", false, false); server.addServletClass(null, TestRestClientEndpoint.class.getName()); server.setSerializationProvider(GsonMessageBodyHandler.class.getName()); @@ -129,7 +131,7 @@ public class TestExecutionPropertyRest { System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = { "src/test/resources/testdata/executionproperties/RESTEventBadUrl.json" }; + final String[] args = {"src/test/resources/testdata/executionproperties/RESTEventBadUrl.json"}; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(500); @@ -142,7 +144,7 @@ public class TestExecutionPropertyRest { System.setErr(stderr); LOGGER.info("testReplaceUrlTag-OUTSTRING=\n" + outString + "\nEnd-TagUrl"); - assertTrue(outString.contains("no proper URL has been set for event sending on REST client")); + assertTrue(outString.contains("no URL has been set for event sending on RESTCLIENT")); } /** @@ -153,7 +155,7 @@ public class TestExecutionPropertyRest { System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = { "src/test/resources/testdata/executionproperties/RESTEventNoValueSetForTag.json" }; + final String[] args = {"src/test/resources/testdata/executionproperties/RESTEventNoValueSetForTag.json"}; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(2000); @@ -166,8 +168,8 @@ public class TestExecutionPropertyRest { System.setErr(stderr); LOGGER.info("testReplaceUrlTag-OUTSTRING=\n" + outString + "\nEnd-TagUrl"); - assertTrue(outString.contains("key\"Number\"specified on url \"http://localhost:32801/TestExecutionRest/apex" - + "/event/{tagId}/{Number}\"not found in execution properties passed by the current policy")); + assertTrue(outString.contains("key \"Number\" specified on url \"http://localhost:32801/TestExecutionRest/apex" + + "/event/{tagId}/{Number}\" not found in execution properties passed by the current policy")); } /** @@ -178,7 +180,7 @@ public class TestExecutionPropertyRest { System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = { "src/test/resources/testdata/executionproperties/RESTEventBadHttpCodeFilter.json" }; + final String[] args = {"src/test/resources/testdata/executionproperties/RESTEventBadHttpCodeFilter.json"}; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(500); @@ -201,8 +203,7 @@ public class TestExecutionPropertyRest { public void testReplaceUrlTag() throws Exception { final Client client = ClientBuilder.newClient(); - final String[] args = - { "src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToTagUrlOK.json" }; + final String[] args = {"src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToTagUrlOK.json"}; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(1000); apexMain.shutdown(); @@ -226,8 +227,11 @@ public class TestExecutionPropertyRest { @Test public void testReplaceUrlMultiTag() throws Exception { final Client client = ClientBuilder.newClient(); - final String[] args = - { "src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToMultiTagUrlOK.json" }; + // @formatter:off + final String[] args = { + "src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToMultiTagUrlOK.json" + }; + // @formatter:on final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(1500); apexMain.shutdown(); diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestFile2Rest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestFile2Rest.java index 0ae8f703d..e433771f8 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestFile2Rest.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestFile2Rest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-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,6 +30,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintStream; import java.util.Map; + import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.Response; @@ -71,8 +72,8 @@ public class TestFile2Rest { */ @BeforeClass public static void setUp() throws Exception { - server = HttpServletServerFactoryInstance.getServerFactory().build( - "TestFile2Rest", false, null, PORT, "/TestFile2Rest", false, false); + server = HttpServletServerFactoryInstance.getServerFactory().build("TestFile2Rest", false, null, PORT, + "/TestFile2Rest", false, false); server.addServletClass(null, TestRestClientEndpoint.class.getName()); server.setSerializationProvider(GsonMessageBodyHandler.class.getName()); @@ -115,8 +116,14 @@ public class TestFile2Rest { public void testFileEventsPost() throws MessagingException, ApexException, IOException { final Client client = ClientBuilder.newClient(); - final String[] args = - { "-rfr", "target", "-c", "target/examples/config/SampleDomain/File2RESTJsonEventPost.json" }; + // @formatter:off + final String[] args = { + "-rfr", + "target", + "-c", + "target/examples/config/SampleDomain/File2RESTJsonEventPost.json" + }; + // @formatter:on final ApexMain apexMain = new ApexMain(args); Response response = null; @@ -125,7 +132,7 @@ public class TestFile2Rest { for (int i = 0; i < 100; i++) { ThreadUtilities.sleep(100); response = client.target("http://localhost:32801/TestFile2Rest/apex/event/Stats") - .request("application/json").get(); + .request("application/json").get(); if (Response.Status.OK.getStatusCode() != response.getStatus()) { break; @@ -154,8 +161,14 @@ public class TestFile2Rest { */ @Test public void testFileEventsPut() throws MessagingException, ApexException, IOException { - final String[] args = - { "-rfr", "target", "-c", "target/examples/config/SampleDomain/File2RESTJsonEventPut.json" }; + // @formatter:off + final String[] args = { + "-rfr", + "target", + "-c", + "target/examples/config/SampleDomain/File2RESTJsonEventPut.json" + }; + // @formatter:on final ApexMain apexMain = new ApexMain(args); final Client client = ClientBuilder.newClient(); @@ -166,7 +179,7 @@ public class TestFile2Rest { for (int i = 0; i < 20; i++) { ThreadUtilities.sleep(300); response = client.target("http://localhost:32801/TestFile2Rest/apex/event/Stats") - .request("application/json").get(); + .request("application/json").get(); if (Response.Status.OK.getStatusCode() != response.getStatus()) { break; @@ -198,8 +211,7 @@ public class TestFile2Rest { System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = - { "src/test/resources/prodcons/File2RESTJsonEventNoURL.json" }; + final String[] args = {"src/test/resources/prodcons/File2RESTJsonEventNoURL.json"}; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(200); @@ -211,7 +223,7 @@ public class TestFile2Rest { System.setErr(stderr); LOGGER.info("NoUrl-OUTSTRING=\n" + outString + "\nEnd-NoUrl"); - assertTrue(outString.contains(" no URL has been set for event sending on REST client")); + assertTrue(outString.contains(" no URL has been set for event sending on RESTCLIENT")); } /** @@ -226,8 +238,7 @@ public class TestFile2Rest { System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = - { "src/test/resources/prodcons/File2RESTJsonEventBadURL.json" }; + final String[] args = {"src/test/resources/prodcons/File2RESTJsonEventBadURL.json"}; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(2000); @@ -240,7 +251,7 @@ public class TestFile2Rest { LOGGER.info("BadUrl-OUTSTRING=\n" + outString + "\nEnd-BadUrl"); assertTrue(outString.contains( - "send of event to URL \"http://localhost:32801/TestFile2Rest/apex/event/Bad\" using HTTP \"POST\" failed with status code 404")); + "send of event to URL \"http://localhost:32801/TestFile2Rest/apex/event/Bad\" using HTTP \"POST\" failed with status code 404")); } /** @@ -255,8 +266,7 @@ public class TestFile2Rest { System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = - { "src/test/resources/prodcons/File2RESTJsonEventBadHTTPMethod.json" }; + final String[] args = {"src/test/resources/prodcons/File2RESTJsonEventBadHTTPMethod.json"}; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(200); @@ -268,9 +278,9 @@ public class TestFile2Rest { System.setErr(stderr); LOGGER.info("BadHttpMethod-OUTSTRING=\n" + outString + "\nEnd-BadHttpMethod"); - assertTrue(outString.contains( - "specified HTTP method of \"DELETE\" is invalid, only HTTP methods \"POST\" and \"PUT\" " - + "are supproted for event sending on REST client producer")); + assertTrue(outString + .contains("specified HTTP method of \"DELETE\" is invalid, only HTTP methods \"POST\" and \"PUT\" " + + "are supported for event sending on REST client producer")); } /** @@ -285,8 +295,7 @@ public class TestFile2Rest { System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = - { "src/test/resources/prodcons/File2RESTJsonEventPostBadResponse.json" }; + final String[] args = {"src/test/resources/prodcons/File2RESTJsonEventPostBadResponse.json"}; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(2000); @@ -299,7 +308,7 @@ public class TestFile2Rest { LOGGER.info("BadResponse-OUTSTRING=\n" + outString + "\nEnd-BadResponse"); assertTrue(outString.contains( - "send of event to URL \"http://localhost:32801/TestFile2Rest/apex/event/PostEventBadResponse\"" - + " using HTTP \"POST\" failed with status code 400")); + "send of event to URL \"http://localhost:32801/TestFile2Rest/apex/event/PostEventBadResponse\"" + + " using HTTP \"POST\" failed with status code 400")); } } diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRest2File.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRest2File.java index e799f5973..3243cd772 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRest2File.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRest2File.java @@ -180,7 +180,7 @@ public class TestRest2File { System.setOut(stdout); System.setErr(stderr); - checkRequiredString(outString, " no URL has been set for event sending on REST client"); + checkRequiredString(outString, " no URL has been set for event sending on RESTCLIENT"); } /** diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_AvroEventAlbum_EventOutCompare.json b/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_AvroEventAlbum_EventOutCompare.json index 1c30984e7..9b3481890 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_AvroEventAlbum_EventOutCompare.json +++ b/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_AvroEventAlbum_EventOutCompare.json @@ -15,7 +15,7 @@ "AvroBoolean": true, "AvroByte": -127.0, "AvroDouble": 1.2345E67, - "AvroFloat": 1.9999999999999998E23, + "AvroFloat": 1.9999999556392617E23, "AvroInteger": 1234568.0, "AvroLong": 1.234567890124E12, "AvroMap": { @@ -80,7 +80,7 @@ "doubleValue": 6.71000001E8 }, "CustomFloat": { - "floatValue": 3000001.0 + "floatValue": 3000000.0 }, "CustomInteger": { "intValue": -9876542.0 diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_JavaEventAlbum_EventOutCompare.json b/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_JavaEventAlbum_EventOutCompare.json index fc7b04a12..a0f8549e6 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_JavaEventAlbum_EventOutCompare.json +++ b/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_JavaEventAlbum_EventOutCompare.json @@ -31,7 +31,7 @@ "second": 48, "milliSecond": 391 }, - "timeZoneString": "Greenwich Mean Time", + "tzValue": "Greenwich Mean Time", "dst": true }, "CustomDate2": { @@ -45,7 +45,7 @@ "second": 48, "milliSecond": 391 }, - "timeZoneString": "Greenwich Mean Time", + "tzValue": "Greenwich Mean Time", "dst": false, "utcOffset": 0, "locale": "en" @@ -60,10 +60,10 @@ "intValue": -9876542 }, "CustomJLong": { - "longValue": 9223372036854775807 + "longValue": -9223372036854775808 }, "CustomLong": { - "longValue": 9223372036854775807 + "longValue": -9223372036854775808 }, "CustomMap": { "mapValue": { diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js index af0db4e3e..54826ce7a 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-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. @@ -18,10 +18,7 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); - -executor.logger.info(executor.outFields); +executor.logger.info(executor.getSubject().getId()); executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js index dce37cc3e..4596dd4b4 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-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. @@ -18,10 +18,7 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); - -executor.logger.info(executor.outFields); +executor.logger.info(executor.getSubject().getId()); executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js index 090b7a00c..ba807cf73 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-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. @@ -18,10 +18,7 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); - -executor.logger.info(executor.outFields); +executor.logger.info(executor.getSubject().getId()); executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js index 62af4e97b..6cae0ceb1 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-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. @@ -18,10 +18,7 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); - -executor.logger.info(executor.outFields); +executor.logger.info(executor.getSubject().getId()); executor.logger.info("executionProperties:" + executor.getExecutionProperties()); diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js index 62af4e97b..6cae0ceb1 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-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. @@ -18,10 +18,7 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); - -executor.logger.info(executor.outFields); +executor.logger.info(executor.getSubject().getId()); executor.logger.info("executionProperties:" + executor.getExecutionProperties()); diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js index f08b718e4..2d934636a 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-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. @@ -18,10 +18,7 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); - -executor.logger.info(executor.outFields); +executor.logger.info(executor.getSubject().getId()); executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js index b527fc1f1..f41c7c02a 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-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. @@ -18,8 +18,7 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); +executor.logger.info(executor.getSubject().getId()); var returnValue = executor.isTrue; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js index 5916a23b2..3bf129bf8 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-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. @@ -18,16 +18,15 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); +executor.logger.info(executor.getSubject().getId()); -executor.logger.info(executor.outFields); +executor.logger.info("executionProperties: " + executor.getExecutionProperties()); -executor.logger.info("executionProperties:" + executor.getExecutionProperties()); - -if (executor.getExecutionProperties() == "{HTTP_CODE_STATUS=500}" ) +if (executor.getExecutionProperties().get("HTTP_CODE_STATUS") == "500") executor.outFields.put("testToRun", "CodeFilterSet"); else executor.outFields.put("testToRun", "CodeFilterDefault"); +executor.logger.info("testToRun: " + executor.outFields.get("testToRun")); + var returnValue = executor.isTrue; \ No newline at end of file diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskTagUrl.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskTagUrl.js index 4a8ff30f1..b584ec464 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskTagUrl.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskTagUrl.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-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. @@ -18,10 +18,7 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); - -executor.logger.info(executor.outFields); +executor.logger.info(executor.getSubject().getId()); executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/policy/ExecutionPropertiesRestTestPolicyModel.apex b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/policy/ExecutionPropertiesRestTestPolicyModel.apex index 053e05349..6e0f4f2f8 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/policy/ExecutionPropertiesRestTestPolicyModel.apex +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/policy/ExecutionPropertiesRestTestPolicyModel.apex @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------- # ============LICENSE_START======================================================= -# Copyright (C) 2019 Nordix Foundation. +# Copyright (C) 2019-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. @@ -47,7 +47,6 @@ task logic create name=TaskTagUrl logicFlavour=JAVASCRIPT logic=LS #MACROFILE:"src/test/resources/policies/executionproperties/logic/TaskTagUrl.js" LE - policy create name=Policy2 template=freestyle firstState=Junit policy state create name=Policy2 stateName=Decide triggerName=Event0201 defaultTaskName=TaskTagUrl @@ -58,7 +57,4 @@ policy state create name=Policy2 stateName=Junit triggerName=Event0200 defaultTa policy state output create name=Policy2 stateName=Junit outputName=HttpCodeOut eventName=Event0201 nextState=Decide policy state taskref create name=Policy2 stateName=Junit taskLocalName=check taskName=TaskFetchHttpCode outputType=DIRECT outputName=HttpCodeOut - - validate - diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js index a4ab0360f..9d02b0228 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js @@ -18,20 +18,20 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); -executor.logger.info(executor.outFields); -executor.logger.info(executor.parameters); +executor.logger.info(executor.getSubject().getId()); +executor.logger.info(executor.getInFields().toString()); +executor.logger.info(executor.getOutFields().toString()); +executor.logger.info(executor.getParameters().toString()); -executor.logger.info("executionProperties in: {}", executor.getExecutionProperties()); +executor.logger.info("executionProperties in: {}", executor.getExecutionProperties().toString()); executor.getExecutionProperties().setProperty("tagId", "doActionForCL"); -var closedLoopId = executor.parameters.get("closedLoopId") +var closedLoopId = executor.getParameters().get("closedLoopId") if (null == closedLoopId) { closedLoopId = "INVALID - closedLoopId not available in TaskParameters" } executor.getExecutionProperties().setProperty("value", closedLoopId); -executor.logger.info("executionProperties out: {}", executor.getExecutionProperties()); +executor.logger.info("executionProperties out: {}", executor.getExecutionProperties().toString()); var returnValue = executor.isTrue; \ No newline at end of file diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js index 6d56616d8..814e30217 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js @@ -18,19 +18,19 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); -executor.logger.info(executor.outFields); -executor.logger.info(executor.parameters); +executor.logger.info(executor.getSubject().getId()); +executor.logger.info(executor.getInFields().toString()); +executor.logger.info(executor.getOutFields().toString()); +executor.logger.info(executor.getParameters().toString()); -executor.logger.info("executionProperties in: {}", executor.getExecutionProperties()); +executor.logger.info("executionProperties in: {}", executor.getExecutionProperties().toString()); executor.getExecutionProperties().setProperty("tagId", "getInfoForServiceId"); -var svcId = executor.parameters.get("serviceId") +var svcId = executor.getParameters().get("serviceId") if (null == svcId) { svcId = "INVALID - serviceId not available in TaskParameters" } executor.getExecutionProperties().setProperty("value", svcId); -executor.logger.info("executionProperties out: {}", executor.getExecutionProperties()); +executor.logger.info("executionProperties out: {}", executor.getExecutionProperties().toString()); var returnValue = executor.isTrue; \ No newline at end of file -- cgit 1.2.3-korg