diff options
author | a.sreekumar <ajith.sreekumar@bell.ca> | 2020-09-02 17:19:26 +0100 |
---|---|---|
committer | a.sreekumar <ajith.sreekumar@bell.ca> | 2020-09-09 10:18:02 +0100 |
commit | 4c5c31eb9a2513af080d60d0f537b8339856150d (patch) | |
tree | 79aaf0d50cc261f57ce77f2eeae927c3c264478f /testsuites/integration/integration-uservice-test/src/test/java | |
parent | d350fd659d716ca0b1678029230cc799cead2056 (diff) |
APEX standalone support for ToscaPolicy format
Legacy format support is removed, and Tosca format support is added.
Change-Id: I3cfc181ccb5471a5d224c0162af18c1fa0fdbc70
Issue-ID: POLICY-2812
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
Diffstat (limited to 'testsuites/integration/integration-uservice-test/src/test/java')
20 files changed, 236 insertions, 133 deletions
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventMimoTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventMimoTest.java index c77dbe074..07b63770d 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventMimoTest.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventMimoTest.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Bell Canada. 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========================================================= */ @@ -46,7 +47,7 @@ public class AsyncEventMimoTest extends BaseEventTest { final String[] args = { "-rfr", "target", - "-c", + "-p", "target/examples/config/SampleDomain/File2FileJsonEventAsyncMIMO.json" }; diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventMisoTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventMisoTest.java index 81d2e5254..d7a462290 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventMisoTest.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventMisoTest.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Bell Canada. 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========================================================= */ @@ -44,7 +45,7 @@ public class AsyncEventMisoTest extends BaseEventTest { final String[] args = { "-rfr", "target", - "-c", + "-p", "target/examples/config/SampleDomain/File2FileJsonEventAsyncMISO.json" }; diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventSimoTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventSimoTest.java index b115e8116..c176b69f2 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventSimoTest.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventSimoTest.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Bell Canada. 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========================================================= */ @@ -40,16 +41,16 @@ public class AsyncEventSimoTest extends BaseEventTest { new File(filePath).delete(); } } - + @Test public void testJsonFileAsyncSimo() throws Exception { final String[] args = { "-rfr", "target", - "-c", + "-p", "target/examples/config/SampleDomain/File2FileJsonEventAsyncSIMO.json" }; - + testFileEvents(args, outFilePaths, 100); } diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventSisoTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventSisoTest.java index a8ad78459..64b4b3850 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventSisoTest.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventSisoTest.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Bell Canada. 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========================================================= */ @@ -44,7 +45,7 @@ public class AsyncEventSisoTest extends BaseEventTest { final String[] args = { "-rfr", "target", - "-c", + "-p", "target/examples/config/SampleDomain/File2FileJsonEventAsyncSISO.json"}; testFileEvents(args, outFilePaths, 100); diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/SyncEventMimoTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/SyncEventMimoTest.java index 5c091d01b..95e589bf4 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/SyncEventMimoTest.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/SyncEventMimoTest.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Bell Canada. 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========================================================= */ @@ -30,7 +31,7 @@ public class SyncEventMimoTest extends BaseEventTest { "target/examples/events/SampleDomain/EventsOutMulti1.json", "target/examples/events/SampleDomain/EventsOutMulti2.json" }; - + /** * Delete output files. */ @@ -46,10 +47,10 @@ public class SyncEventMimoTest extends BaseEventTest { final String[] args = { "-rfr", "target", - "-c", + "-p", "target/examples/config/SampleDomain/File2FileJsonEventSyncMIMO.json" }; - + testFileEvents(args, outFilePaths, 300); } diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/SyncEventSisoTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/SyncEventSisoTest.java index df0435c57..1d536cea9 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/SyncEventSisoTest.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/SyncEventSisoTest.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Bell Canada. 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========================================================= */ @@ -28,7 +29,7 @@ public class SyncEventSisoTest extends BaseEventTest { private final String[] outFilePaths = { "target/examples/events/SampleDomain/EventsOutSingle.json" }; - + /** * Delete output files. */ @@ -44,7 +45,7 @@ public class SyncEventSisoTest extends BaseEventTest { final String[] args = { "-rfr", "target", - "-c", + "-p", "target/examples/config/SampleDomain/File2FileJsonEventSyncSISO.json"}; testFileEvents(args, outFilePaths, 100); diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2File.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2File.java index a59e21e8e..63565abdb 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2File.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2File.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -44,14 +45,14 @@ public class TestFile2File { @Test public void testJsonFileEvents() throws MessagingException, ApexException, IOException { - final String[] args = {"-rfr", "target", "-c", "target/examples/config/SampleDomain/File2FileJsonEvent.json"}; + final String[] args = {"-rfr", "target", "-p", "target/examples/config/SampleDomain/File2FileJsonEvent.json"}; testFileEvents(args, "target/examples/events/SampleDomain/EventsOut.json", 42200); } @Test public void testXmlFileEvents() throws MessagingException, ApexException, IOException { - final String[] args = {"-rfr", "target", "-c", "target/examples/config/SampleDomain/File2FileXmlEvent.json"}; + final String[] args = {"-rfr", "target", "-p", "target/examples/config/SampleDomain/File2FileXmlEvent.json"}; testFileEvents(args, "target/examples/events/SampleDomain/EventsOut.xmlfile", 100000); } diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileFiltered.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileFiltered.java index f99826a9c..a890b8e58 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileFiltered.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileFiltered.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -46,7 +47,7 @@ public class TestFile2FileFiltered { public void testJsonFilteredFileInOutEvents() throws MessagingException, ApexException, IOException { // @formatter:off final String[] args = - { "-rfr", "target", "-c", "target/examples/config/SampleDomain/File2FileFilteredInOutJsonEvent.json" }; + { "-rfr", "target", "-p", "target/examples/config/SampleDomain/File2FileFilteredInOutJsonEvent.json" }; final String[] outFilePaths = { "target/examples/events/SampleDomain/Events0004Out.json", @@ -63,7 +64,7 @@ public class TestFile2FileFiltered { public void testJsonFilteredFileOutEvents() throws MessagingException, ApexException, IOException { // @formatter:off final String[] args = - { "-rfr", "target", "-c", "target/examples/config/SampleDomain/File2FileFilteredOutJsonEvent.json" }; + { "-rfr", "target", "-p", "target/examples/config/SampleDomain/File2FileFilteredOutJsonEvent.json" }; final String[] outFilePaths = { "target/examples/events/SampleDomain/Events0004Out.json", @@ -80,7 +81,7 @@ public class TestFile2FileFiltered { public void testJsonFilteredFileInEvents() throws MessagingException, ApexException, IOException { // @formatter:off final String[] args = - { "-rfr", "target", "-c", "target/examples/config/SampleDomain/File2FileFilteredInJsonEvent.json" }; + { "-rfr", "target", "-p", "target/examples/config/SampleDomain/File2FileFilteredInJsonEvent.json" }; final String[] outFilePaths = { "target/examples/events/SampleDomain/Events0004Out.json" }; 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 6773fab02..b060179cb 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 @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -140,7 +141,7 @@ public class TestJms2Jms { */ @Test public void testJmsObjectEvents() throws ApexException, JMSException { - final String[] args = {"-rfr", "target", "-c", "target/examples/config/JMS/JMS2JMSObjectEvent.json"}; + final String[] args = {"-rfr", "target", "-p", "target/examples/config/JMS/JMS2JMSObjectEvent.json"}; testJmsEvents(args, true); } @@ -152,7 +153,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", "-p", "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/kafka/TestKafka2Kafka.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/TestKafka2Kafka.java index f5639a9b4..03db1798f 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/TestKafka2Kafka.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/TestKafka2Kafka.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -68,7 +69,7 @@ public class TestKafka2Kafka { public void testJsonKafkaEvents() throws Exception { final String conditionedConfigFile = getConditionedConfigFile( "target" + File.separator + "examples/config/SampleDomain/Kafka2KafkaJsonEvent.json"); - final String[] args = {"-rfr", "target", "-c", conditionedConfigFile}; + final String[] args = {"-rfr", "target", "-p", conditionedConfigFile}; testKafkaEvents(args, false, "json"); } @@ -81,7 +82,7 @@ public class TestKafka2Kafka { public void testXmlKafkaEvents() throws Exception { final String conditionedConfigFile = getConditionedConfigFile( "target" + File.separator + "examples/config/SampleDomain/Kafka2KafkaXmlEvent.json"); - final String[] args = {"-rfr", "target", "-c", conditionedConfigFile}; + final String[] args = {"-rfr", "target", "-p", conditionedConfigFile}; testKafkaEvents(args, true, "xml"); } 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 71c8833be..c25929974 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,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -31,7 +32,7 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.onap.policy.apex.auth.clieditor.ApexCommandLineEditorMain; +import org.onap.policy.apex.auth.clieditor.tosca.ApexCliToscaEditorMain; import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; import org.onap.policy.apex.service.engine.main.ApexMain; import org.onap.policy.common.endpoints.http.server.HttpServletServer; @@ -58,24 +59,6 @@ public class TestExecutionPropertyRest { private final PrintStream stderr = System.err; /** - * Compile the policy. - */ - @BeforeClass - public static void compilePolicy() { - // @formatter:off - final String[] cliArgs = { "-c", - "src/test/resources/policies/executionproperties/policy/ExecutionPropertiesRestTestPolicyModel.apex", - "-l", - "target/ExecutionPropertiesRestTestPolicyModel.log", - "-o", - "target/ExecutionPropertiesRestTestPolicyModel.json" - }; - // @formatter:on - - new ApexCommandLineEditorMain(cliArgs); - } - - /** * Sets the up. * * @throws Exception the exception @@ -125,10 +108,33 @@ public class TestExecutionPropertyRest { */ @Test public void testBadUrl() throws Exception { + // @formatter:off + final String[] cliArgs = new String[] { + "-c", + "src/test/resources/policies/executionproperties/policy/ExecutionPropertiesRestTestPolicyModel.apex", + "-o", + "target/ExecutionPropertiesRestTestPolicyModel.json", + "-ac", + "src/test/resources/testdata/executionproperties/RESTEventBadUrl.json", + "-t", + "src/test/resources/tosca/ToscaTemplate.json", + "-ot", + "target/classes/APEXPolicy.json" + }; + // @formatter:on + + new ApexCliToscaEditorMain(cliArgs); + + // @formatter:off + final String[] args = { + "-p", + "target/classes/APEXPolicy.json" + }; + // @formatter:on + System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = { "src/test/resources/testdata/executionproperties/RESTEventBadUrl.json" }; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(500); @@ -150,10 +156,33 @@ public class TestExecutionPropertyRest { */ @Test public void testNoValueSetForTagUrl() throws Exception { + // @formatter:off + final String[] cliArgs = new String[] { + "-c", + "src/test/resources/policies/executionproperties/policy/ExecutionPropertiesRestTestPolicyModel.apex", + "-o", + "target/ExecutionPropertiesRestTestPolicyModel.json", + "-ac", + "src/test/resources/testdata/executionproperties/RESTEventNoValueSetForTag.json", + "-t", + "src/test/resources/tosca/ToscaTemplate.json", + "-ot", + "target/classes/APEXPolicy.json" + }; + // @formatter:on + + new ApexCliToscaEditorMain(cliArgs); + + // @formatter:off + final String[] args = { + "-p", + "target/classes/APEXPolicy.json" + }; + // @formatter:on + System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = { "src/test/resources/testdata/executionproperties/RESTEventNoValueSetForTag.json" }; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(2000); @@ -175,10 +204,33 @@ public class TestExecutionPropertyRest { */ @Test public void testBadCodeFilter() throws Exception { + // @formatter:off + final String[] cliArgs = new String[] { + "-c", + "src/test/resources/policies/executionproperties/policy/ExecutionPropertiesRestTestPolicyModel.apex", + "-o", + "target/ExecutionPropertiesRestTestPolicyModel.json", + "-ac", + "src/test/resources/testdata/executionproperties/RESTEventBadHttpCodeFilter.json", + "-t", + "src/test/resources/tosca/ToscaTemplate.json", + "-ot", + "target/classes/APEXPolicy.json" + }; + // @formatter:on + + new ApexCliToscaEditorMain(cliArgs); + + // @formatter:off + final String[] args = { + "-p", + "target/classes/APEXPolicy.json" + }; + // @formatter:on + System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = { "src/test/resources/testdata/executionproperties/RESTEventBadHttpCodeFilter.json" }; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(500); @@ -200,9 +252,29 @@ public class TestExecutionPropertyRest { @Test public void testReplaceUrlTag() throws Exception { final Client client = ClientBuilder.newClient(); + // @formatter:off + final String[] cliArgs = new String[] { + "-c", + "src/test/resources/policies/executionproperties/policy/ExecutionPropertiesRestTestPolicyModel.apex", + "-o", + "target/ExecutionPropertiesRestTestPolicyModel.json", + "-ac", + "src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToTagUrlOK.json", + "-t", + "src/test/resources/tosca/ToscaTemplate.json", + "-ot", + "target/classes/APEXPolicy.json" + }; + // @formatter:on + new ApexCliToscaEditorMain(cliArgs); + + // @formatter:off final String[] args = { - "src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToTagUrlOK.json" }; + "-p", + "target/classes/APEXPolicy.json" + }; + // @formatter:on final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(1000); apexMain.shutdown(); @@ -227,8 +299,27 @@ public class TestExecutionPropertyRest { public void testReplaceUrlMultiTag() throws Exception { final Client client = ClientBuilder.newClient(); // @formatter:off + final String[] cliArgs = new String[] { + "-c", + "src/test/resources/policies/executionproperties/policy/ExecutionPropertiesRestTestPolicyModel.apex", + "-o", + "target/ExecutionPropertiesRestTestPolicyModel.json", + "-ac", + "src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToMultiTagUrlOK.json", + "-t", + "src/test/resources/tosca/ToscaTemplate.json", + "-ot", + "target/classes/APEXPolicy.json" + }; + // @formatter:on + + new ApexCliToscaEditorMain(cliArgs); + + // @formatter:off final String[] args = { - "src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToMultiTagUrlOK.json" }; + "-p", + "target/classes/APEXPolicy.json" + }; // @formatter:on final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(1500); 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 b0119afef..671172841 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 @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -105,7 +106,7 @@ public class TestRest2File { */ @Test public void testRestEventsIn() throws MessagingException, ApexException, IOException { - final String[] args = {"-rfr", "target", "-c", "target/examples/config/SampleDomain/REST2FileJsonEvent.json"}; + final String[] args = {"-rfr", "target", "-p", "target/examples/config/SampleDomain/REST2FileJsonEvent.json"}; final ApexMain apexMain = new ApexMain(args); diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServer.java index d21c3aa49..e3057ad2f 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServer.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServer.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -81,7 +82,7 @@ public class TestRestServer { public void testRestServerPut() throws MessagingException, ApexException, IOException, InterruptedException { LOGGER.debug("testRestServerPut start"); - final String[] args = {"-rfr", "target", "-c", "target/examples/config/SampleDomain/RESTServerJsonEvent.json"}; + final String[] args = {"-rfr", "target", "-p", "target/examples/config/SampleDomain/RESTServerJsonEvent.json"}; final ApexMain apexMain = new ApexMain(args); if (!NetworkUtil.isTcpPortOpen("localhost", 23324, 60, 500L)) { throw new IllegalStateException("cannot connect to Apex Rest Server"); @@ -126,7 +127,7 @@ public class TestRestServer { @Test public void testRestServerPost() throws MessagingException, ApexException, IOException, InterruptedException { LOGGER.debug("testRestServerPost start"); - final String[] args = {"-rfr", "target", "-c", "target/examples/config/SampleDomain/RESTServerJsonEvent.json"}; + final String[] args = {"-rfr", "target", "-p", "target/examples/config/SampleDomain/RESTServerJsonEvent.json"}; final ApexMain apexMain = new ApexMain(args); if (!NetworkUtil.isTcpPortOpen("localhost", 23324, 60, 500L)) { throw new IllegalStateException("cannot connect to Apex Rest Server"); @@ -170,7 +171,7 @@ public class TestRestServer { @Test public void testRestServerGetStatus() throws MessagingException, ApexException, IOException, InterruptedException { LOGGER.debug("testRestServerGetStatus start"); - final String[] args = {"-rfr", "target", "-c", "target/examples/config/SampleDomain/RESTServerJsonEvent.json"}; + final String[] args = {"-rfr", "target", "-p", "target/examples/config/SampleDomain/RESTServerJsonEvent.json"}; final ApexMain apexMain = new ApexMain(args); if (!NetworkUtil.isTcpPortOpen("localhost", 23324, 60, 500L)) { throw new IllegalStateException("cannot connect to Apex Rest Server"); @@ -231,7 +232,7 @@ public class TestRestServer { throws MessagingException, ApexException, IOException, InterruptedException { LOGGER.debug("testRestServerMultiInputs start"); final String[] args = - {"-rfr", "target", "-c", "target/examples/config/SampleDomain/RESTServerJsonEventMultiIn.json"}; + {"-rfr", "target", "-p", "target/examples/config/SampleDomain/RESTServerJsonEventMultiIn.json"}; final ApexMain apexMain = new ApexMain(args); if (!NetworkUtil.isTcpPortOpen("localhost", 23324, 60, 500L)) { throw new IllegalStateException("cannot connect to Apex Rest Server"); diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsClient.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsClient.java index 18c13dbfe..96f31e98d 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsClient.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsClient.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Bell Canada. 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========================================================= */ @@ -45,13 +46,13 @@ public class TestWs2WsClient { @Test public void testJsonWsEvents() throws MessagingException, ApexException { - final String[] args = {"-rfr", "target", "-c", "target/examples/config/SampleDomain/Ws2WsClientJsonEvent.json"}; + final String[] args = {"-rfr", "target", "-p", "target/examples/config/SampleDomain/Ws2WsClientJsonEvent.json"}; testWsEvents(args, false); } @Test public void testXmlWsEvents() throws MessagingException, ApexException { - final String[] args = {"-rfr", "target", "-c", "target/examples/config/SampleDomain/Ws2WsClientXMLEvent.json"}; + final String[] args = {"-rfr", "target", "-p", "target/examples/config/SampleDomain/Ws2WsClientXMLEvent.json"}; testWsEvents(args, true); } diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsServer.java index 07b51a8e3..870eb9ec7 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsServer.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsServer.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Bell Canada. 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========================================================= */ @@ -54,7 +55,7 @@ public class TestWs2WsServer { */ @Test public void testJsonWsEvents() throws MessagingException, ApexException { - final String[] args = {"-rfr", "target", "-c", "target/examples/config/SampleDomain/Ws2WsServerJsonEvent.json"}; + final String[] args = {"-rfr", "target", "-p", "target/examples/config/SampleDomain/Ws2WsServerJsonEvent.json"}; testWsEvents(args, false); } @@ -66,7 +67,7 @@ public class TestWs2WsServer { */ @Test public void testXmlWsEvents() throws MessagingException, ApexException { - final String[] args = {"-rfr", "target", "-c", "target/examples/config/SampleDomain/Ws2WsServerXMLEvent.json"}; + final String[] args = {"-rfr", "target", "-p", "target/examples/config/SampleDomain/Ws2WsServerXMLEvent.json"}; testWsEvents(args, true); } diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/context/EventAlbumContextTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/context/EventAlbumContextTest.java index 52fe1510e..b2ae68fb4 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/context/EventAlbumContextTest.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/context/EventAlbumContextTest.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -30,7 +31,7 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.onap.policy.apex.auth.clieditor.ApexCommandLineEditorMain; +import org.onap.policy.apex.auth.clieditor.tosca.ApexCliToscaEditorMain; import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.service.engine.main.ApexMain; @@ -40,7 +41,7 @@ import org.onap.policy.common.utils.resources.TextFileUtils; public class EventAlbumContextTest { private File tempCommandFile; private File tempLogFile; - private File tempModelFile; + private File tempPolicyFile; private String eventContextString; private String configFile; private String outputFile; @@ -61,7 +62,7 @@ public class EventAlbumContextTest { public void testJavaEventAlbumContextTest() throws IOException, ApexException { tempCommandFile = tempTestDir.newFile("TestPolicyJavaEventContext.apex"); tempLogFile = tempTestDir.newFile("TestPolicyJavaEventContext.log"); - tempModelFile = tempTestDir.newFile("TestPolicyJavaEventContext.json"); + tempPolicyFile = tempTestDir.newFile("TestPolicyJavaEventContext.json"); eventContextString = ResourceUtils.getResourceAsString("examples/scripts/TestPolicyJavaEventContext.apex"); @@ -76,7 +77,7 @@ public class EventAlbumContextTest { public void testAvroEventAlbumContextTest() throws IOException, ApexException { tempCommandFile = tempTestDir.newFile("TestPolicyAvroEventContext.apex"); tempLogFile = tempTestDir.newFile("TestPolicyAvroEventContext.log"); - tempModelFile = tempTestDir.newFile("TestPolicyAvroEventContext.json"); + tempPolicyFile = tempTestDir.newFile("TestPolicyAvroEventContext.json"); eventContextString = ResourceUtils.getResourceAsString("examples/scripts/TestPolicyAvroEventContext.apex"); @@ -91,11 +92,12 @@ public class EventAlbumContextTest { TextFileUtils.putStringAsFile(eventContextString, tempCommandFile); final String[] cliArgs = new String[] {"-c", tempCommandFile.getCanonicalPath(), "-l", - tempLogFile.getAbsolutePath(), "-o", tempModelFile.getAbsolutePath()}; + tempLogFile.getAbsolutePath(), "-ac", configFile, "-t", "src/test/resources/tosca/ToscaTemplate.json", + "-ot", tempPolicyFile.getAbsolutePath()}; - new ApexCommandLineEditorMain(cliArgs); + new ApexCliToscaEditorMain(cliArgs); - final String[] args = new String[] {"-m", tempModelFile.getAbsolutePath(), "-c", configFile}; + final String[] args = new String[] {"-p", tempPolicyFile.getAbsolutePath()}; final ApexMain apexMain = new ApexMain(args); // The output event will be in this file diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java index 22303a69a..fc9b8da96 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -127,15 +128,17 @@ public class ApexServiceModelUpdateTest { parameters.setVersion(engineServiceKey.getVersion()); parameters.setId(100); parameters.getEngineParameters().getExecutorParameterMap().put("MVEL", new MvelExecutorParameters()); - service = EngineServiceImpl.create(parameters); - - LOGGER.debug("Running TestApexEngine. . ."); apexSamplePolicyModel = new SampleDomainModelFactory().getSamplePolicyModel("JAVASCRIPT"); assertNotNull(apexSamplePolicyModel); apexSampleModelString = getModelString(apexSamplePolicyModel); + parameters.setPolicyModel(apexSampleModelString); + service = EngineServiceImpl.create(parameters); + + LOGGER.debug("Running TestApexEngine. . ."); + // create engine listener = new TestListener(); service.registerActionListener("MyListener", listener); diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java index 445c2df1f..e05825183 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java @@ -96,6 +96,7 @@ public class ApexServiceTest { parameters.setName(engineServiceKey.getName()); parameters.setVersion(engineServiceKey.getVersion()); parameters.setId(100); + parameters.setPolicyModel("policy model impl"); parameters.getEngineParameters().getExecutorParameterMap().put("MVEL", new MvelExecutorParameters()); service = EngineServiceImpl.create(parameters); diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/TestExecutionProperties.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/TestExecutionProperties.java index e30312af2..d4855f988 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/TestExecutionProperties.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/TestExecutionProperties.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -22,40 +23,20 @@ package org.onap.policy.apex.testsuites.integration.uservice.executionproperties import static org.awaitility.Awaitility.await; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import java.io.File; import java.io.FileInputStream; import java.util.Properties; import java.util.concurrent.TimeUnit; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; -import org.onap.policy.apex.auth.clieditor.ApexCommandLineEditorMain; +import org.onap.policy.apex.auth.clieditor.tosca.ApexCliToscaEditorMain; import org.onap.policy.apex.service.engine.main.ApexMain; /** * This class runs integration tests for execution properties. */ public class TestExecutionProperties { - /** - * Compile the policy. - */ - @BeforeClass - public static void compilePolicy() { - // @formatter:off - final String[] cliArgs = { - "-c", - "src/test/resources/policies/executionproperties/policy/ExecutionPropertiesTestPolicyModel.apex", - "-l", - "target/ExecutionPropertiesTestPolicyModel.log", - "-o", - "target/ExecutionPropertiesTestPolicyModel.json" - }; - // @formatter:on - - new ApexCommandLineEditorMain(cliArgs); - } /** * Clear relative file root environment variable. @@ -106,8 +87,22 @@ public class TestExecutionProperties { } private void testExecutionProperties(final String testName) throws Exception { - File compiledPolicyFile = new File("target/ExecutionPropertiesTestPolicyModel.json"); - assertTrue(compiledPolicyFile.exists()); + // @formatter:off + final String[] cliArgs = new String[] { + "-c", + "src/test/resources/policies/executionproperties/policy/ExecutionPropertiesTestPolicyModel.apex", + "-l", + "target/ExecutionPropertiesTestPolicyModel.log", + "-ac", + "src/test/resources/testdata/executionproperties/" + testName + "_conf.json", + "-t", + "src/test/resources/tosca/ToscaTemplate.json", + "-ot", + "target/classes/APEXPolicy.json" + }; + // @formatter:on + + new ApexCliToscaEditorMain(cliArgs); File outFile = new File("target/" + testName + "_out.properties"); outFile.deleteOnExit(); @@ -115,9 +110,9 @@ public class TestExecutionProperties { // @formatter:off final String[] args = { "-rfr", - "target", - "-c", - "src/test/resources/testdata/executionproperties/" + testName + "_conf.json" + "target/classes", + "-p", + "target/classes/APEXPolicy.json" }; // @formatter:on final ApexMain apexMain = new ApexMain(args); diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/taskparameters/TestTaskParameters.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/taskparameters/TestTaskParameters.java index 714cfba2c..9713bcb74 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/taskparameters/TestTaskParameters.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/taskparameters/TestTaskParameters.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -31,7 +32,7 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.onap.policy.apex.auth.clieditor.ApexCommandLineEditorMain; +import org.onap.policy.apex.auth.clieditor.tosca.ApexCliToscaEditorMain; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.service.engine.main.ApexMain; import org.onap.policy.common.endpoints.http.server.HttpServletServer; @@ -55,24 +56,6 @@ public class TestTaskParameters { private static final int PORT = 32801; private static final String HOST = "localhost"; - /** - * Compile the policy. - */ - @BeforeClass - public static void compilePolicy() { - // @formatter:off - final String[] cliArgs = { - "-c", - "src/test/resources/policies/taskparameters/TaskParametersTestPolicyModel.apex", - "-l", - "target/TaskParametersTestPolicyModel.log", - "-o", - "target/TaskParametersTestPolicyModel.json" - }; - // @formatter:on - - new ApexCommandLineEditorMain(cliArgs); - } /** * Sets up a server for testing. @@ -156,7 +139,21 @@ public class TestTaskParameters { private String testTaskParameters(String apexConfigPath) throws ApexException { final Client client = ClientBuilder.newClient(); - final String[] args = {apexConfigPath}; + // @formatter:off + final String[] cliArgs = new String[] { + "-c", + "src/test/resources/policies/taskparameters/TaskParametersTestPolicyModel.apex", + "-ac", + apexConfigPath, + "-t", + "src/test/resources/tosca/ToscaTemplate.json", + "-ot", + "target/classes/APEXPolicy.json" + }; + // @formatter:on + + new ApexCliToscaEditorMain(cliArgs); + final String[] args = {"target/classes/APEXPolicy.json"}; // clear the details set in server client.target("http://" + HOST + ":" + PORT + "/TestTaskParametersRest/apex/event/clearDetails") .request("application/json").get(); |