diff options
109 files changed, 363 insertions, 727 deletions
diff --git a/auth/cli-codegen/pom.xml b/auth/cli-codegen/pom.xml index f14624031..777a7766e 100644 --- a/auth/cli-codegen/pom.xml +++ b/auth/cli-codegen/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.auth</groupId> <artifactId>auth</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>cli-codegen</artifactId> diff --git a/auth/cli-editor/pom.xml b/auth/cli-editor/pom.xml index 011c741d7..25d6c91a5 100644 --- a/auth/cli-editor/pom.xml +++ b/auth/cli-editor/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.auth</groupId> <artifactId>auth</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>cli-editor</artifactId> diff --git a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineCommandTest.java b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineCommandTest.java index 5c541e14a..f05757fc8 100644 --- a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineCommandTest.java +++ b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineCommandTest.java @@ -21,7 +21,6 @@ package org.onap.policy.apex.auth.clieditor; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; @@ -127,13 +126,13 @@ public class CommandLineCommandTest { @Test public void testEquals() { - assertFalse(commandLineCommand.equals(new Object())); - assertTrue(commandLineCommand.equals(commandLineCommand)); - assertFalse(commandLineCommand.equals(null)); + assertNotEquals(commandLineCommand, new Object()); + assertEquals(commandLineCommand, commandLineCommand); + assertNotEquals(commandLineCommand, null); CommandLineCommand otherCommand = new CommandLineCommand(); - assertTrue(commandLineCommand.equals(otherCommand)); + assertEquals(commandLineCommand, otherCommand); otherCommand.getKeywordlist().add("TestKeyword"); - assertFalse(commandLineCommand.equals(otherCommand)); + assertNotEquals(commandLineCommand, otherCommand); } } diff --git a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorScriptingTest.java b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorScriptingTest.java index c863461ef..b41cd49b2 100644 --- a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorScriptingTest.java +++ b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorScriptingTest.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. @@ -106,9 +106,9 @@ public class CommandLineEditorScriptingTest { compareModel.getKeyInformation().getKeyInfoMap().clear(); compareNoAlbumsModel.getKeyInformation().getKeyInfoMap().clear(); - assertTrue(writtenModel.equals(compareModel)); - assertTrue(writtenModel.equals(compareNoAlbumsModel)); - assertTrue(compareModel.equals(compareNoAlbumsModel)); + assertEquals(writtenModel, compareModel); + assertEquals(writtenModel, compareNoAlbumsModel); + assertEquals(compareModel, compareNoAlbumsModel); } /** diff --git a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/ContextAlbumsTest.java b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/ContextAlbumsTest.java index f82453b95..db44bbb9a 100644 --- a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/ContextAlbumsTest.java +++ b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/ContextAlbumsTest.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -22,7 +23,6 @@ package org.onap.policy.apex.auth.clieditor; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import java.io.File; import java.io.IOException; @@ -91,6 +91,6 @@ public class ContextAlbumsTest { writtenModel.getKeyInformation().getKeyInfoMap().clear(); compareModel.getKeyInformation().getKeyInfoMap().clear(); - assertTrue(writtenModel.equals(compareModel)); + assertEquals(writtenModel, compareModel); } } diff --git a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/FileMacroTest.java b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/FileMacroTest.java index 44bdc798a..7acf2ab89 100644 --- a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/FileMacroTest.java +++ b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/FileMacroTest.java @@ -22,7 +22,6 @@ package org.onap.policy.apex.auth.clieditor; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import java.io.File; import java.io.IOException; @@ -95,7 +94,7 @@ public class FileMacroTest { writtenModel.getKeyInformation().getKeyInfoMap().clear(); compareModel.getKeyInformation().getKeyInfoMap().clear(); - assertTrue(writtenModel.equals(compareModel)); + assertEquals(writtenModel, compareModel); // The output event is in this file final File outputLogFile = new File(tempLogFile.getCanonicalPath()); diff --git a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/LogicBlockTest.java b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/LogicBlockTest.java index caaa12925..702013945 100644 --- a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/LogicBlockTest.java +++ b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/LogicBlockTest.java @@ -1,26 +1,27 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ package org.onap.policy.apex.auth.clieditor; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertEquals; import java.io.File; import java.io.IOException; @@ -95,7 +96,7 @@ public class LogicBlockTest { writtenModel.getKeyInformation().getKeyInfoMap().clear(); compareModel.getKeyInformation().getKeyInfoMap().clear(); - assertTrue(writtenModel.equals(compareModel)); + assertEquals(writtenModel, compareModel); } /** @@ -123,6 +124,6 @@ public class LogicBlockTest { writtenModel.getKeyInformation().getKeyInfoMap().clear(); compareModel.getKeyInformation().getKeyInfoMap().clear(); - assertTrue(writtenModel.equals(compareModel)); + assertEquals(writtenModel, compareModel); } } diff --git a/auth/pom.xml b/auth/pom.xml index 73d7460db..a60bb6dba 100644 --- a/auth/pom.xml +++ b/auth/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp</groupId> <artifactId>apex-pdp</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.auth</groupId> diff --git a/client/client-common/pom.xml b/client/client-common/pom.xml index 8ba6a03dc..beff6c57b 100644 --- a/client/client-common/pom.xml +++ b/client/client-common/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.client</groupId> <artifactId>apex-client</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>apex-client-common</artifactId> diff --git a/client/client-deployment/pom.xml b/client/client-deployment/pom.xml index b352a05f3..91d8f56fc 100644 --- a/client/client-deployment/pom.xml +++ b/client/client-deployment/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.client</groupId> <artifactId>apex-client</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>apex-client-deployment</artifactId> diff --git a/client/client-editor/pom.xml b/client/client-editor/pom.xml index 4057969ad..ace0c1042 100644 --- a/client/client-editor/pom.xml +++ b/client/client-editor/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.client</groupId> <artifactId>apex-client</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>apex-client-editor</artifactId> diff --git a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/ApexEditorStartupTest.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/ApexEditorStartupTest.java index fdf1e804a..4d6c93222 100644 --- a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/ApexEditorStartupTest.java +++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/ApexEditorStartupTest.java @@ -21,6 +21,7 @@ package org.onap.policy.apex.client.editor.rest; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.awaitility.Awaitility.await; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -70,14 +71,9 @@ public class ApexEditorStartupTest { public void testBadArg0() throws IOException, InterruptedException { final String[] args = new String[] { "12321" }; - try { - runEditor(args); - fail("test should throw an exception here"); - } catch (final Exception e) { - assertTrue(e.getLocalizedMessage().startsWith( - "Apex Editor REST endpoint (ApexEditorMain: Config=[null], State=STOPPED) parameter error," - + " too many command line arguments specified : [12321]")); - } + assertThatThrownBy(() -> runEditor(args)).isInstanceOf(ApexEditorParameterException.class) + .hasMessageContaining("Apex Editor REST endpoint (ApexEditorMain: Config=[null], State=STOPPED)" + + " parameter error, too many command line arguments specified : [12321]"); } /** @@ -90,14 +86,9 @@ public class ApexEditorStartupTest { public void testBadArg1() throws IOException, InterruptedException { final String[] args = new String[] { "12321 12322 12323" }; - try { - runEditor(args); - fail("test should throw an exception here"); - } catch (final Exception e) { - assertTrue(e.getLocalizedMessage().startsWith( - "Apex Editor REST endpoint (ApexEditorMain: Config=[null], State=STOPPED) parameter error," - + " too many command line arguments specified : [12321 12322 12323]")); - } + assertThatThrownBy(() -> runEditor(args)).isInstanceOf(ApexEditorParameterException.class) + .hasMessageContaining("Apex Editor REST endpoint (ApexEditorMain: Config=[null], State=STOPPED)" + + " parameter error, too many command line arguments specified : [12321 12322 12323]"); } /** @@ -110,14 +101,9 @@ public class ApexEditorStartupTest { public void testBadArg2() throws IOException, InterruptedException { final String[] args = new String[] { "-z" }; - try { - runEditor(args); - fail("test should throw an exception here"); - } catch (final Exception e) { - assertTrue(e.getLocalizedMessage().startsWith( - "Apex Editor REST endpoint (ApexEditorMain: Config=[null], State=STOPPED) parameter error," - + " invalid command line arguments specified : Unrecognized option: -z")); - } + assertThatThrownBy(() -> runEditor(args)).isInstanceOf(ApexEditorParameterException.class) + .hasMessageContaining("Apex Editor REST endpoint (ApexEditorMain: Config=[null], State=STOPPED)" + + " parameter error, invalid command line arguments specified : Unrecognized option: -z"); } /** @@ -130,14 +116,9 @@ public class ApexEditorStartupTest { public void testBadArg3() throws IOException, InterruptedException { final String[] args = new String[] { "--hello" }; - try { - runEditor(args); - fail("test should throw an exception here"); - } catch (final Exception e) { - assertTrue(e.getLocalizedMessage().startsWith( - "Apex Editor REST endpoint (ApexEditorMain: Config=[null], State=STOPPED) parameter error," - + " invalid command line arguments specified : Unrecognized option: --hello")); - } + assertThatThrownBy(() -> runEditor(args)).isInstanceOf(ApexEditorParameterException.class) + .hasMessageContaining("Apex Editor REST endpoint (ApexEditorMain: Config=[null], State=STOPPED)" + + " parameter error, invalid command line arguments specified : Unrecognized option: --hello"); } @@ -151,16 +132,11 @@ public class ApexEditorStartupTest { public void testBadArg4() throws IOException, InterruptedException { final String[] args = new String[] { "-l", "+++++" }; - try { - runEditor(args); - fail("test should throw an exception here"); - } catch (final Exception e) { - assertTrue(e.getLocalizedMessage() - .startsWith("Apex Editor REST endpoint (ApexEditorMain: " + assertThatThrownBy(() -> runEditor(args)).isInstanceOf(ApexEditorParameterException.class) + .hasMessageContaining("Apex Editor REST endpoint (ApexEditorMain: " + "Config=[ApexEditorParameters: URI=http://+++++:18989/apexservices/, TTL=-1sec], " + "State=STOPPED) parameters invalid, listen address is not valid. " - + "Illegal character in hostname at index 7: http://+++++:18989/apexservices/")); - } + + "Illegal character in hostname at index 7: http://+++++:18989/apexservices/"); } /** @@ -173,13 +149,8 @@ public class ApexEditorStartupTest { public void testHelp0() throws IOException, InterruptedException { final String[] args = new String[] { "--help" }; - try { - runEditor(args); - fail("test should throw an exception here"); - } catch (final Exception e) { - assertTrue(e.getMessage() - .startsWith("usage: org.onap.policy.apex.client.editor.rest.ApexEditorMain [options...]")); - } + assertThatThrownBy(() -> runEditor(args)).isInstanceOf(ApexEditorParameterException.class) + .hasMessageContaining("usage: org.onap.policy.apex.client.editor.rest.ApexEditorMain [options...]"); } /** @@ -192,13 +163,8 @@ public class ApexEditorStartupTest { public void testHelp1() throws IOException, InterruptedException { final String[] args = new String[] { "-h" }; - try { - runEditor(args); - fail("test should throw an exception here"); - } catch (final Exception e) { - assertTrue(e.getMessage() - .startsWith("usage: org.onap.policy.apex.client.editor.rest.ApexEditorMain [options...]")); - } + assertThatThrownBy(() -> runEditor(args)).isInstanceOf(ApexEditorParameterException.class) + .hasMessageContaining("usage: org.onap.policy.apex.client.editor.rest.ApexEditorMain [options...]"); } /** @@ -258,14 +224,9 @@ public class ApexEditorStartupTest { public void testPortArgSpace() throws IOException, InterruptedException { final String[] args = new String[] { "-p 12321" }; - try { - runEditor(args); - fail("test should throw an exception here"); - } catch (final Exception e) { - assertTrue(e.getMessage().startsWith( - "Apex Editor REST endpoint (ApexEditorMain: Config=[null], State=STOPPED) parameter error," - + " error parsing argument \"port\" :For input string: \" 12321\"")); - } + assertThatThrownBy(() -> runEditor(args)).isInstanceOf(ApexEditorParameterException.class) + .hasMessageContaining("Apex Editor REST endpoint (ApexEditorMain: Config=[null], State=STOPPED)" + + " parameter error, error parsing argument \"port\" :For input string: \" 12321\""); } /** @@ -278,15 +239,10 @@ public class ApexEditorStartupTest { public void testBadPortArgs0() throws IOException, InterruptedException { final String[] args = new String[] { "-p0" }; - try { - runEditor(args); - fail("test should throw an exception here"); - } catch (final Exception e) { - assertTrue(e.getMessage() - .startsWith("Apex Editor REST endpoint (ApexEditorMain: " + assertThatThrownBy(() -> runEditor(args)).isInstanceOf(ApexEditorParameterException.class) + .hasMessageContaining("Apex Editor REST endpoint (ApexEditorMain: " + "Config=[ApexEditorParameters: URI=http://localhost:0/apexservices/, TTL=-1sec], " - + "State=STOPPED) parameters invalid, port must be between 1024 and 65535")); - } + + "State=STOPPED) parameters invalid, port must be between 1024 and 65535"); } /** @@ -299,15 +255,10 @@ public class ApexEditorStartupTest { public void testBadPortArgs1023() throws IOException, InterruptedException { final String[] args = new String[] { "-p1023" }; - try { - runEditor(args); - fail("test should throw an exception here"); - } catch (final Exception e) { - assertTrue(e.getMessage() - .startsWith("Apex Editor REST endpoint (ApexEditorMain: " + assertThatThrownBy(() -> runEditor(args)).isInstanceOf(ApexEditorParameterException.class) + .hasMessageContaining("Apex Editor REST endpoint (ApexEditorMain: " + "Config=[ApexEditorParameters: URI=http://localhost:1023/apexservices/, TTL=-1sec], " - + "State=STOPPED) parameters invalid, port must be between 1024 and 65535")); - } + + "State=STOPPED) parameters invalid, port must be between 1024 and 65535"); } /** @@ -320,15 +271,10 @@ public class ApexEditorStartupTest { public void testBadPortArgs65536() throws IOException, InterruptedException { final String[] args = new String[] { "-p65536" }; - try { - runEditor(args); - fail("test should throw an exception here"); - } catch (final Exception e) { - assertTrue(e.getMessage() - .startsWith("Apex Editor REST endpoint (ApexEditorMain: " + assertThatThrownBy(() -> runEditor(args)).isInstanceOf(ApexEditorParameterException.class) + .hasMessageContaining("Apex Editor REST endpoint (ApexEditorMain: " + "Config=[ApexEditorParameters: URI=http://localhost:65536/apexservices/, TTL=-1sec], " - + "State=STOPPED) parameters invalid, port must be between 1024 and 65535")); - } + + "State=STOPPED) parameters invalid, port must be between 1024 and 65535"); } /** diff --git a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/handling/ApexEditorRestResourceTest.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/handling/ApexEditorRestResourceTest.java index 642628f97..ace427052 100644 --- a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/handling/ApexEditorRestResourceTest.java +++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/handling/ApexEditorRestResourceTest.java @@ -21,6 +21,7 @@ package org.onap.policy.apex.client.editor.rest.handling; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -60,11 +61,7 @@ public class ApexEditorRestResourceTest extends JerseyTest { final int corruptSessionId = ApexEditorRestResource.createCorruptSession(); - try { - target("editor/" + corruptSessionId + "/Model/Analyse").request().get(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + target("editor/" + corruptSessionId + "/Model/Analyse").request().get(ApexApiResult.class); result = target("editor/" + sessionId + "/Model/Analyse").request().get(ApexApiResult.class); assertEquals(Result.SUCCESS, result.getResult()); @@ -73,11 +70,7 @@ public class ApexEditorRestResourceTest extends JerseyTest { result = target("editor/12345/Model/Analyse").request().get(ApexApiResult.class); assertEquals(Result.FAILED, result.getResult()); - try { - target("editor/" + corruptSessionId + "/Model/Validate").request().get(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + target("editor/" + corruptSessionId + "/Model/Validate").request().get(ApexApiResult.class); result = target("editor/" + sessionId + "/Model/Validate").request().get(ApexApiResult.class); assertEquals(Result.FAILED, result.getResult()); @@ -99,11 +92,7 @@ public class ApexEditorRestResourceTest extends JerseyTest { result = target("editor/" + sessionId + "/Model/Create").request().post(csEntity, ApexApiResult.class); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - try { - target("editor/" + corruptSessionId + "/Model/Create").request().post(csEntity, ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + target("editor/" + corruptSessionId + "/Model/Create").request().post(csEntity, ApexApiResult.class); result = target("editor/-12345/Model/Update").request().put(csEntity, ApexApiResult.class); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); @@ -114,17 +103,9 @@ public class ApexEditorRestResourceTest extends JerseyTest { result = target("editor/" + sessionId + "/Model/Update").request().put(csEntity, ApexApiResult.class); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - try { - target("editor/" + corruptSessionId + "/Model/Update").request().put(csEntity, ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + target("editor/" + corruptSessionId + "/Model/Update").request().put(csEntity, ApexApiResult.class); - try { - result = target("editor/" + corruptSessionId + "/Model/GetKey").request().get(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + result = target("editor/" + corruptSessionId + "/Model/GetKey").request().get(ApexApiResult.class); result = target("editor/" + sessionId + "/Model/GetKey").request().get(ApexApiResult.class); assertEquals(Result.SUCCESS, result.getResult()); @@ -133,11 +114,7 @@ public class ApexEditorRestResourceTest extends JerseyTest { result = target("editor/12345/Model/GetKey").request().get(ApexApiResult.class); assertEquals(Result.FAILED, result.getResult()); - try { - result = target("editor/" + corruptSessionId + "/Model/Get").request().get(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + result = target("editor/" + corruptSessionId + "/Model/Get").request().get(ApexApiResult.class); result = target("editor/" + sessionId + "/Model/Get").request().get(ApexApiResult.class); assertEquals(Result.SUCCESS, result.getResult()); @@ -158,11 +135,7 @@ public class ApexEditorRestResourceTest extends JerseyTest { resultString = target("editor/12345/Model/Download").request().get(String.class); assertEquals("", resultString); - try { - result = target("editor/" + corruptSessionId + "/KeyInformation/Get").request().get(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + result = target("editor/" + corruptSessionId + "/KeyInformation/Get").request().get(ApexApiResult.class); result = target("editor/" + sessionId + "/KeyInformation/Get").request().get(ApexApiResult.class); assertEquals(Result.SUCCESS, result.getResult()); @@ -171,11 +144,7 @@ public class ApexEditorRestResourceTest extends JerseyTest { result = target("editor/12345/KeyInformation/Get").request().get(ApexApiResult.class); assertEquals(Result.FAILED, result.getResult()); - try { - result = target("editor/" + corruptSessionId + "/Model/Delete").request().delete(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + result = target("editor/" + corruptSessionId + "/Model/Delete").request().delete(ApexApiResult.class); result = target("editor/" + sessionId + "/Model/Delete").request().delete(ApexApiResult.class); assertEquals(Result.SUCCESS, result.getResult()); @@ -196,11 +165,7 @@ public class ApexEditorRestResourceTest extends JerseyTest { result = target("editor/-12345/Validate/ContextSchema").request().get(ApexApiResult.class); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - try { - target("editor/" + corruptSessionId + "/Validate/ContextSchema").request().get(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + target("editor/" + corruptSessionId + "/Validate/ContextSchema").request().get(ApexApiResult.class); result = target("editor/" + sessionId + "/Validate/ContextSchema").request().get(ApexApiResult.class); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); @@ -232,12 +197,8 @@ public class ApexEditorRestResourceTest extends JerseyTest { .queryParam("version", (String) null).request().get(ApexApiResult.class); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - try { - target("editor/" + corruptSessionId + "/ContextSchema/Get").queryParam("name", (String) null) + target("editor/" + corruptSessionId + "/ContextSchema/Get").queryParam("name", (String) null) .queryParam("version", (String) null).request().get(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } String csString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\"," + "\"schemaFlavour\" : \"Java\"," + "\"schemaDefinition\" : \"java.lang.String\"," @@ -251,12 +212,9 @@ public class ApexEditorRestResourceTest extends JerseyTest { result = target("editor/" + sessionId + "/ContextSchema/Create").request().post(csEntity, ApexApiResult.class); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - try { - target("editor/" + corruptSessionId + "/ContextSchema/Create").request().post(csEntity, + target("editor/" + corruptSessionId + "/ContextSchema/Create").request().post(csEntity, ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + csString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\"," + "\"schemaFlavour\" : \"Java\"," + "\"schemaDefinition\" : \"my.perfect.String\"," @@ -270,11 +228,7 @@ public class ApexEditorRestResourceTest extends JerseyTest { result = target("editor/" + sessionId + "/ContextSchema/Update").request().put(csEntity, ApexApiResult.class); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - try { - target("editor/" + corruptSessionId + "/ContextSchema/Update").request().put(csEntity, ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + target("editor/" + corruptSessionId + "/ContextSchema/Update").request().put(csEntity, ApexApiResult.class); result = target("editor/" + sessionId + "/ContextSchema/Get").queryParam("name", "Hello") .queryParam("version", (String) null).request().get(ApexApiResult.class); @@ -289,23 +243,15 @@ public class ApexEditorRestResourceTest extends JerseyTest { .queryParam("version", (String) null).request().get(ApexApiResult.class); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - try { - target("editor/" + corruptSessionId + "/ContextSchema/Get").queryParam("name", "Hello") + target("editor/" + corruptSessionId + "/ContextSchema/Get").queryParam("name", "Hello") .queryParam("version", (String) null).request().get(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } result = target("editor/" + sessionId + "/Validate/ContextSchema").queryParam("name", (String) null) .queryParam("version", (String) null).request().get(ApexApiResult.class); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - try { - target("editor/" + corruptSessionId + "/ContextSchema/Delete").queryParam("name", "Hello") + target("editor/" + corruptSessionId + "/ContextSchema/Delete").queryParam("name", "Hello") .queryParam("version", "0.0.2").request().delete(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } result = target("editor/-123345/ContextSchema/Delete").queryParam("name", (String) null) .queryParam("version", (String) null).request().delete(ApexApiResult.class); @@ -331,11 +277,7 @@ public class ApexEditorRestResourceTest extends JerseyTest { result = target("editor/-12345/Validate/ContextAlbum").request().get(ApexApiResult.class); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - try { - target("editor/" + corruptSessionId + "/Validate/ContextAlbum").request().get(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + target("editor/" + corruptSessionId + "/Validate/ContextAlbum").request().get(ApexApiResult.class); result = target("editor/" + sessionId + "/Validate/ContextAlbum").request().get(ApexApiResult.class); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); @@ -380,11 +322,7 @@ public class ApexEditorRestResourceTest extends JerseyTest { result = target("editor/" + sessionId + "/ContextAlbum/Create").request().post(caEntity, ApexApiResult.class); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - try { - target("editor/" + corruptSessionId + "/ContextAlbum/Create").request().post(caEntity, ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + target("editor/" + corruptSessionId + "/ContextAlbum/Create").request().post(caEntity, ApexApiResult.class); caString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\"," + "\"scope\" : \"Global\"," + "\"writeable\" : false," @@ -399,18 +337,10 @@ public class ApexEditorRestResourceTest extends JerseyTest { result = target("editor/" + sessionId + "/ContextAlbum/Update").request().put(caEntity, ApexApiResult.class); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - try { - target("editor/" + corruptSessionId + "/ContextAlbum/Update").request().put(caEntity, ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + target("editor/" + corruptSessionId + "/ContextAlbum/Update").request().put(caEntity, ApexApiResult.class); - try { - target("editor/" + corruptSessionId + "/ContextAlbum/Get").queryParam("name", "Hello") + target("editor/" + corruptSessionId + "/ContextAlbum/Get").queryParam("name", "Hello") .queryParam("version", (String) null).request().get(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } result = target("editor/" + sessionId + "/ContextAlbum/Get").queryParam("name", "Hello") .queryParam("version", (String) null).request().get(ApexApiResult.class); @@ -429,12 +359,8 @@ public class ApexEditorRestResourceTest extends JerseyTest { .queryParam("version", (String) null).request().get(ApexApiResult.class); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - try { - target("editor/" + corruptSessionId + "/ContextAlbum/Delete").queryParam("name", (String) null) + target("editor/" + corruptSessionId + "/ContextAlbum/Delete").queryParam("name", (String) null) .queryParam("version", (String) null).request().delete(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } result = target("editor/-123345/ContextAlbum/Delete").queryParam("name", (String) null) .queryParam("version", (String) null).request().delete(ApexApiResult.class); @@ -464,11 +390,7 @@ public class ApexEditorRestResourceTest extends JerseyTest { result = target("editor/" + sessionId + "/Validate/Event").request().get(ApexApiResult.class); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - try { - target("editor/" + corruptSessionId + "/Validate/Event").request().get(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + target("editor/" + corruptSessionId + "/Validate/Event").request().get(ApexApiResult.class); result = target("editor/" + sessionId + "/Validate/Event").queryParam("name", (String) null) .queryParam("version", (String) null).request().get(ApexApiResult.class); @@ -511,11 +433,7 @@ public class ApexEditorRestResourceTest extends JerseyTest { result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexApiResult.class); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); - try { - target("editor/" + corruptSessionId + "/Event/Create").request().post(entity, ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + target("editor/" + corruptSessionId + "/Event/Create").request().post(entity, ApexApiResult.class); entityString = "{" + "\"name\" : \"Hiya\"," + "\"version\" : \"0.0.2\"," + "\"namespace\" : \"somewhere.over.the.rainbow\"," + "\"source\" : \"beginning\"," @@ -570,11 +488,7 @@ public class ApexEditorRestResourceTest extends JerseyTest { result = target("editor/" + sessionId + "/Event/Update").request().put(entity, ApexApiResult.class); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - try { - target("editor/" + corruptSessionId + "/Event/Update").request().put(entity, ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + target("editor/" + corruptSessionId + "/Event/Update").request().put(entity, ApexApiResult.class); entityString = "{" + "\"name\" : null," + "\"version\" : \"0.0.2\"," + "\"namespace\" : \"somewhere.over.someone.elses.rainbow\"," @@ -607,12 +521,8 @@ public class ApexEditorRestResourceTest extends JerseyTest { .queryParam("version", (String) null).request().get(ApexApiResult.class); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - try { - target("editor/" + corruptSessionId + "/Event/Get").queryParam("name", "Hello") + target("editor/" + corruptSessionId + "/Event/Get").queryParam("name", "Hello") .queryParam("version", (String) null).request().get(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } result = target("editor/" + sessionId + "/Validate/Event").queryParam("name", (String) null) .queryParam("version", (String) null).request().get(ApexApiResult.class); @@ -624,12 +534,8 @@ public class ApexEditorRestResourceTest extends JerseyTest { .queryParam("version", (String) null).request().get(ApexApiResult.class); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - try { - target("editor/" + corruptSessionId + "/Event/Delete").queryParam("name", (String) null) + target("editor/" + corruptSessionId + "/Event/Delete").queryParam("name", (String) null) .queryParam("version", (String) null).request().delete(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } result = target("editor/-123345/Event/Delete").queryParam("name", (String) null) .queryParam("version", (String) null).request().delete(ApexApiResult.class); @@ -705,11 +611,7 @@ public class ApexEditorRestResourceTest extends JerseyTest { result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); - try { - target("editor/" + corruptSessionId + "/Task/Create").request().post(entity, ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + target("editor/" + corruptSessionId + "/Task/Create").request().post(entity, ApexApiResult.class); entityString = "{" + "\"name\" : \"Hiya\"," + "\"version\" : \"0.0.2\"," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," @@ -896,11 +798,7 @@ public class ApexEditorRestResourceTest extends JerseyTest { result = target("editor/" + sessionId + "/Task/Update").request().put(entity, ApexApiResult.class); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - try { - target("editor/" + corruptSessionId + "/Task/Update").request().put(entity, ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + target("editor/" + corruptSessionId + "/Task/Update").request().put(entity, ApexApiResult.class); entityString = "{" + "\"name\" : null," + "\"version\" : \"0.0.2\"," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," @@ -932,12 +830,8 @@ public class ApexEditorRestResourceTest extends JerseyTest { .request().get(ApexApiResult.class); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - try { - target("editor/" + corruptSessionId + "/Task/Get").queryParam("name", "Hello") + target("editor/" + corruptSessionId + "/Task/Get").queryParam("name", "Hello") .queryParam("version", (String) null).request().get(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } result = target("editor/" + sessionId + "/Validate/Event").queryParam("name", (String) null) .queryParam("version", (String) null).request().get(ApexApiResult.class); @@ -949,12 +843,8 @@ public class ApexEditorRestResourceTest extends JerseyTest { .queryParam("version", (String) null).request().get(ApexApiResult.class); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - try { - target("editor/" + corruptSessionId + "/Task/Delete").queryParam("name", (String) null) + target("editor/" + corruptSessionId + "/Task/Delete").queryParam("name", (String) null) .queryParam("version", (String) null).request().delete(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } result = target("editor/-123345/Task/Delete").queryParam("name", (String) null) .queryParam("version", (String) null).request().delete(ApexApiResult.class); @@ -984,12 +874,7 @@ public class ApexEditorRestResourceTest extends JerseyTest { result = target("editor/" + sessionId + "/Model/Validate").request().get(ApexApiResult.class); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - try { - target("editor/" + corruptSessionId + "/Model/Validate").request().get(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } - + target("editor/" + corruptSessionId + "/Model/Validate").request().get(ApexApiResult.class); result = target("editor/" + sessionId + "/Model/Validate").queryParam("name", (String) null) .queryParam("version", (String) null).request().get(ApexApiResult.class); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); @@ -1039,11 +924,7 @@ public class ApexEditorRestResourceTest extends JerseyTest { result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); - try { - target("editor/" + corruptSessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + target("editor/" + corruptSessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); entityString = "{" + "\"name\" : \"GoodTaSeeYa\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1411,11 +1292,7 @@ public class ApexEditorRestResourceTest extends JerseyTest { .put(entity, ApexApiResult.class); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - try { - target("editor/" + corruptSessionId + "/Policy/Update").request().put(entity, ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } + target("editor/" + corruptSessionId + "/Policy/Update").request().put(entity, ApexApiResult.class); entityString = "{" + "\"name\" : null," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1465,12 +1342,8 @@ public class ApexEditorRestResourceTest extends JerseyTest { .queryParam("version", (String) null).request().get(ApexApiResult.class); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - try { - target("editor/" + corruptSessionId + "/Policy/Get").queryParam("name", "Hello") + target("editor/" + corruptSessionId + "/Policy/Get").queryParam("name", "Hello") .queryParam("version", (String) null).request().get(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } result = target("editor/" + sessionId + "/Validate/Event").queryParam("name", (String) null) .queryParam("version", (String) null).request().get(ApexApiResult.class); @@ -1482,12 +1355,8 @@ public class ApexEditorRestResourceTest extends JerseyTest { .queryParam("version", (String) null).request().get(ApexApiResult.class); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - try { - target("editor/" + corruptSessionId + "/Policy/Delete").queryParam("name", (String) null) + target("editor/" + corruptSessionId + "/Policy/Delete").queryParam("name", (String) null) .queryParam("version", (String) null).request().delete(ApexApiResult.class); - } catch (final Exception e) { - assertEquals("HTTP 500 Request failed.", e.getMessage()); - } result = target("editor/-123345/Policy/Delete").queryParam("name", (String) null) .queryParam("version", (String) null).request().delete(ApexApiResult.class); diff --git a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/handling/bean/BeansTest.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/handling/bean/BeansTest.java index ba773b1ac..bdf47fedc 100644 --- a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/handling/bean/BeansTest.java +++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/handling/bean/BeansTest.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. @@ -20,9 +21,9 @@ package org.onap.policy.apex.client.editor.rest.handling.bean; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; import org.junit.Test; @@ -60,29 +61,9 @@ public class BeansTest { assertNull(beanFake.get("name")); assertNull(beanFake.get("field1")); - try { - beanFake.get("iDontExist"); - fail("test should throw an exception here"); - } catch (final IllegalArgumentException e) { - assertNotNull(e); - } - try { - beanFake.get("nome"); - fail("test should throw an exception here"); - } catch (final IllegalArgumentException e) { - assertNotNull(e); - } - try { - beanFake.get("field2"); - fail("test should throw an exception here"); - } catch (final IllegalArgumentException e) { - assertNotNull(e); - } - try { - beanFake.get("field3"); - fail("test should throw an exception here"); - } catch (final IllegalArgumentException e) { - assertNotNull(e); - } + assertThatThrownBy(() -> beanFake.get("iDontExist")).isInstanceOf(IllegalArgumentException.class); + assertThatThrownBy(() -> beanFake.get("nome")).isInstanceOf(IllegalArgumentException.class); + assertThatThrownBy(() -> beanFake.get("field2")).isInstanceOf(IllegalArgumentException.class); + assertThatThrownBy(() -> beanFake.get("field3")).isInstanceOf(IllegalArgumentException.class); } } diff --git a/client/client-full/pom.xml b/client/client-full/pom.xml index 2d303a7f2..1a623d84f 100644 --- a/client/client-full/pom.xml +++ b/client/client-full/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.client</groupId> <artifactId>apex-client</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>apex-client-full</artifactId> diff --git a/client/client-monitoring/pom.xml b/client/client-monitoring/pom.xml index 85b7f01f2..7ac59ee56 100644 --- a/client/client-monitoring/pom.xml +++ b/client/client-monitoring/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.client</groupId> <artifactId>apex-client</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>apex-client-monitoring</artifactId> diff --git a/client/client-monitoring/src/test/java/org/onap/policy/apex/client/monitoring/rest/MonitoringRestMainTest.java b/client/client-monitoring/src/test/java/org/onap/policy/apex/client/monitoring/rest/MonitoringRestMainTest.java index 688d29b37..b376c9bfa 100644 --- a/client/client-monitoring/src/test/java/org/onap/policy/apex/client/monitoring/rest/MonitoringRestMainTest.java +++ b/client/client-monitoring/src/test/java/org/onap/policy/apex/client/monitoring/rest/MonitoringRestMainTest.java @@ -21,9 +21,11 @@ package org.onap.policy.apex.client.monitoring.rest; +import static org.assertj.core.api.Assertions.assertThatCode; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.awaitility.Awaitility.await; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import static org.junit.Assert.assertNotNull; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -38,24 +40,14 @@ import org.junit.Test; public class MonitoringRestMainTest { @Test public void testMonitoringClientBad() { - try { - final String[] eventArgs = {"-z"}; - - ApexMonitoringRestMain.main(eventArgs); - } catch (Exception exc) { - fail("test should not throw an exception"); - } + final String[] eventArgs = {"-z"}; + assertThatCode(() -> ApexMonitoringRestMain.main(eventArgs)).doesNotThrowAnyException(); } @Test public void testMonitoringClientOk() { - try { - final String[] eventArgs = {"-t", "1"}; - - ApexMonitoringRestMain.main(eventArgs); - } catch (Exception exc) { - fail("test should not throw an exception"); - } + final String[] eventArgs = {"-t", "1"}; + assertThatCode(() -> ApexMonitoringRestMain.main(eventArgs)).doesNotThrowAnyException(); } @Test @@ -72,142 +64,93 @@ public class MonitoringRestMainTest { public void testMonitoringClientBadOptions() { final String[] eventArgs = {"-zabbu"}; - try { - new ApexMonitoringRestMain(eventArgs, System.out); - fail("test should throw an exception"); - } catch (Exception ex) { - assertEquals( - "Apex Services REST endpoint (ApexMonitoringRestMain: Config=[null], State=STOPPED) " - + "parameter error, invalid command line arguments specified " + ": Unrecognized option: -zabbu", - ex.getMessage().substring(0, 170)); - } + assertThatThrownBy(() -> new ApexMonitoringRestMain(eventArgs, System.out)) + .hasMessageContaining("Apex Services REST endpoint (ApexMonitoringRestMain: Config=[null], State=STOPPED) " + + "parameter error, invalid command line arguments specified " + ": Unrecognized option: -zabbu"); } @Test public void testMonitoringClientHelp() { final String[] eventArgs = {"-h"}; - try { - new ApexMonitoringRestMain(eventArgs, System.out); - fail("test should throw an exception"); - } catch (Exception ex) { - assertEquals("usage: org.onap.policy.apex.client.monitoring.rest.ApexMonitoringRestMain [options...]", - ex.getMessage().substring(0, 86)); - } + assertThatThrownBy(() -> new ApexMonitoringRestMain(eventArgs, System.out)) + .hasMessageContaining("usage: org.onap.policy.apex.client.monitoring.rest." + + "ApexMonitoringRestMain [options...]"); } @Test public void testMonitoringClientPortBad() { final String[] eventArgs = {"-p", "hello"}; - try { - new ApexMonitoringRestMain(eventArgs, System.out); - fail("test should throw an exception"); - } catch (Exception ex) { - assertEquals( - "Apex Services REST endpoint (ApexMonitoringRestMain: Config=[null], State=STOPPED) " - + "parameter error, error parsing argument \"port\" :For input string: \"hello\"", - ex.getMessage().substring(0, 156)); - } + assertThatThrownBy(() -> new ApexMonitoringRestMain(eventArgs, System.out)) + .hasMessageContaining("Apex Services REST endpoint (ApexMonitoringRestMain: Config=[null], State=STOPPED) " + + "parameter error, error parsing argument \"port\" :For input string: \"hello\""); } @Test public void testMonitoringClientPortNegative() { final String[] eventArgs = {"-p", "-1"}; - try { - new ApexMonitoringRestMain(eventArgs, System.out); - fail("test should throw an exception"); - } catch (Exception ex) { - assertEquals("Apex Services REST endpoint (ApexMonitoringRestMain: Config=[ApexMonitoringRestParameters: " - + "URI=http://localhost:-1/apexservices/, TTL=-1sec], State=STOPPED) parameters invalid, " - + "port must be greater than 1023 and less than 65536", ex.getMessage().substring(0, 227)); - } + assertThatThrownBy(() -> new ApexMonitoringRestMain(eventArgs, System.out)) + .hasMessageContaining("Apex Services REST endpoint (ApexMonitoringRestMain: Config=[ApexMonitoringRest" + + "Parameters: URI=http://localhost:-1/apexservices/, TTL=-1sec], State=STOPPED) parameters invalid, " + + "port must be greater than 1023 and less than 65536"); } @Test public void testMonitoringClientTtlTooSmall() { final String[] eventArgs = {"-t", "-2"}; - try { - new ApexMonitoringRestMain(eventArgs, System.out); - fail("test should throw an exception"); - } catch (Exception ex) { - assertEquals( - "Apex Services REST endpoint (ApexMonitoringRestMain: Config=[ApexMonitoringRestParameters: " - + "URI=http://localhost:18989/apexservices/, TTL=-2sec], State=STOPPED) parameters invalid, " - + "time to live must be greater than -1 (set to -1 to wait forever)", - ex.getMessage().substring(0, 244)); - } + assertThatThrownBy(() -> new ApexMonitoringRestMain(eventArgs, System.out)) + .hasMessageContaining("Apex Services REST endpoint (ApexMonitoringRestMain: Config=[ApexMonitoringRest" + + "Parameters: URI=http://localhost:18989/apexservices/, TTL=-2sec], State=STOPPED) parameters invalid, " + + "time to live must be greater than -1 (set to -1 to wait forever)"); } @Test public void testMonitoringClientTooManyPars() { final String[] eventArgs = {"-t", "10", "-p", "12344", "aaa", "bbb"}; - try { - new ApexMonitoringRestMain(eventArgs, System.out); - fail("test should throw an exception"); - } catch (Exception ex) { - assertEquals( - "Apex Services REST endpoint (ApexMonitoringRestMain: Config=[null], State=STOPPED) " - + "parameter error, too many command line arguments specified : [aaa, bbb]", - ex.getMessage().substring(0, 154)); - } + assertThatThrownBy(() -> new ApexMonitoringRestMain(eventArgs, System.out)) + .hasMessageContaining("Apex Services REST endpoint (ApexMonitoringRestMain: Config=[null], State=STOPPED) " + + "parameter error, too many command line arguments specified : [aaa, bbb]"); } @Test public void testMonitoringClientTtlNotNumber() { final String[] eventArgs = {"-t", "timetolive"}; - try { - new ApexMonitoringRestMain(eventArgs, System.out); - fail("test should throw an exception"); - } catch (Exception ex) { - assertEquals( - "Apex Services REST endpoint (ApexMonitoringRestMain: Config=[null], State=STOPPED) " - + "parameter error, error parsing argument \"time-to-live\" :" + "For input string: \"timetolive\"", - ex.getMessage().substring(0, 169)); - } + assertThatThrownBy(() -> new ApexMonitoringRestMain(eventArgs, System.out)) + .hasMessageContaining("Apex Services REST endpoint (ApexMonitoringRestMain: Config=[null], State=STOPPED) " + + "parameter error, error parsing argument \"time-to-live\" :" + "For input string: \"" + + "timetolive\""); } @Test public void testMonitoringClientPortTooBig() { final String[] eventArgs = {"-p", "65536"}; - try { - new ApexMonitoringRestMain(eventArgs, System.out); - fail("test should throw an exception"); - } catch (Exception ex) { - assertEquals("Apex Services REST endpoint (ApexMonitoringRestMain: Config=[ApexMonitoringRestParameters: " - + "URI=http://localhost:65536/apexservices/, TTL=-1sec], State=STOPPED) parameters invalid, " - + "port must be greater than 1023 and less than 65536", ex.getMessage().substring(0, 230)); - } + assertThatThrownBy(() -> new ApexMonitoringRestMain(eventArgs, System.out)) + .hasMessageContaining("Apex Services REST endpoint (ApexMonitoringRestMain: Config=[ApexMonitoring" + + "RestParameters: URI=http://localhost:65536/apexservices/, TTL=-1sec], State=STOPPED) parameters invalid, " + + "port must be greater than 1023 and less than 65536"); } @Test public void testMonitoringClientDefaultPars() { - try { - ApexMonitoringRest monRest = new ApexMonitoringRest(); - monRest.shutdown(); - - } catch (Exception ex) { - fail("test should not throw an exception"); - } + ApexMonitoringRest monRest = new ApexMonitoringRest(); + assertNotNull(monRest); + assertThatCode(() -> monRest.shutdown()).isNull(); } @Test public void testMonitoringOneSecStart() { final String[] eventArgs = {"-t", "1"}; - try { - ApexMonitoringRestMain monRestMain = new ApexMonitoringRestMain(eventArgs, System.out); - monRestMain.init(); - monRestMain.shutdown(); - - } catch (Exception ex) { - fail("test should not throw an exception"); - } + ApexMonitoringRestMain monRestMain = new ApexMonitoringRestMain(eventArgs, System.out); + assertNotNull(monRestMain); + monRestMain.init(); + assertThatCode(() -> monRestMain.shutdown()).isNull(); } @Test @@ -222,15 +165,12 @@ public class MonitoringRestMainTest { monRestMain.init(); } }; - - try { + assertThatCode(() -> { monThread.start(); await().atMost(6, TimeUnit.SECONDS) .until(() -> monRestMain.getState().equals(ApexMonitoringRestMain.ServicesState.RUNNING)); monRestMain.shutdown(); - } catch (Exception ex) { - fail("test should not throw an exception"); - } + }).doesNotThrowAnyException(); } /** diff --git a/client/pom.xml b/client/pom.xml index 30dac8203..16dee1158 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp</groupId> <artifactId>apex-pdp</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.client</groupId> diff --git a/context/context-management/pom.xml b/context/context-management/pom.xml index 3c4486206..71765f944 100644 --- a/context/context-management/pom.xml +++ b/context/context-management/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.context</groupId> <artifactId>context</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>context-management</artifactId> diff --git a/context/pom.xml b/context/pom.xml index a6f21fe85..bdfa3e4b7 100644 --- a/context/pom.xml +++ b/context/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp</groupId> <artifactId>apex-pdp</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.context</groupId> diff --git a/core/core-deployment/pom.xml b/core/core-deployment/pom.xml index aa93a0333..713eed13b 100644 --- a/core/core-deployment/pom.xml +++ b/core/core-deployment/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.core</groupId> <artifactId>core</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>core-deployment</artifactId> diff --git a/core/core-engine/pom.xml b/core/core-engine/pom.xml index e17a36cb7..0248c44c6 100644 --- a/core/core-engine/pom.xml +++ b/core/core-engine/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.core</groupId> <artifactId>core</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>core-engine</artifactId> diff --git a/core/core-infrastructure/pom.xml b/core/core-infrastructure/pom.xml index ae8740fba..df4b19edd 100644 --- a/core/core-infrastructure/pom.xml +++ b/core/core-infrastructure/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.core</groupId> <artifactId>core</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>core-infrastructure</artifactId> diff --git a/core/core-protocols/pom.xml b/core/core-protocols/pom.xml index 43b64c202..db40268e8 100644 --- a/core/core-protocols/pom.xml +++ b/core/core-protocols/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.core</groupId> <artifactId>core</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>core-protocols</artifactId> diff --git a/core/pom.xml b/core/pom.xml index 2018b5d27..4782f5a5c 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp</groupId> <artifactId>apex-pdp</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.core</groupId> diff --git a/examples/examples-aadm/pom.xml b/examples/examples-aadm/pom.xml index 333802471..27a8509d6 100644 --- a/examples/examples-aadm/pom.xml +++ b/examples/examples-aadm/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.examples</groupId> <artifactId>examples</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>examples-aadm</artifactId> diff --git a/examples/examples-adaptive/pom.xml b/examples/examples-adaptive/pom.xml index ade620b1d..c936d09ea 100644 --- a/examples/examples-adaptive/pom.xml +++ b/examples/examples-adaptive/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.examples</groupId> <artifactId>examples</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>examples-adaptive</artifactId> diff --git a/examples/examples-decisionmaker/pom.xml b/examples/examples-decisionmaker/pom.xml index 279dbd50c..8fd66959a 100644 --- a/examples/examples-decisionmaker/pom.xml +++ b/examples/examples-decisionmaker/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.examples</groupId> <artifactId>examples</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>examples-decisionmaker</artifactId> diff --git a/examples/examples-grpc/pom.xml b/examples/examples-grpc/pom.xml index de581203b..3e0b699c0 100644 --- a/examples/examples-grpc/pom.xml +++ b/examples/examples-grpc/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.examples</groupId> <artifactId>examples</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>examples-grpc</artifactId> <name>examples-grpc</name> diff --git a/examples/examples-myfirstpolicy/pom.xml b/examples/examples-myfirstpolicy/pom.xml index 9be6be74a..ead8803bb 100644 --- a/examples/examples-myfirstpolicy/pom.xml +++ b/examples/examples-myfirstpolicy/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.examples</groupId> <artifactId>examples</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>examples-myfirstpolicy</artifactId> diff --git a/examples/examples-onap-bbs/pom.xml b/examples/examples-onap-bbs/pom.xml index ca82d6af7..ccee03b7a 100644 --- a/examples/examples-onap-bbs/pom.xml +++ b/examples/examples-onap-bbs/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.examples</groupId> <artifactId>examples</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>examples-onap-bbs</artifactId> diff --git a/examples/examples-onap-vcpe/pom.xml b/examples/examples-onap-vcpe/pom.xml index 172773627..b6a1876a2 100644 --- a/examples/examples-onap-vcpe/pom.xml +++ b/examples/examples-onap-vcpe/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.examples</groupId> <artifactId>examples</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>examples-onap-vcpe</artifactId> diff --git a/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfig.json b/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfig.json index 5208767b0..01269c6ba 100644 --- a/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfig.json +++ b/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfig.json @@ -40,7 +40,9 @@ "url": "http://172.18.0.6:8081/pdp/api/getDecision", "httpMethod": "POST", "restRequestTimeout": 2000, - "httpHeader": "Authorization:dGVzdHBkcDphbHBoYTEyMw== ClientAuth:cHl0aG9uOnRlc3Q=" + "httpHeaders": [ + ["Authorization:dGVzdHBkcDphbHBoYTEyMw== ClientAuth:cHl0aG9uOnRlc3Q="] + ] } }, "eventProtocolParameters": { diff --git a/examples/examples-pcvs/pom.xml b/examples/examples-pcvs/pom.xml index e62056e3a..61ed93c15 100644 --- a/examples/examples-pcvs/pom.xml +++ b/examples/examples-pcvs/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.examples</groupId> <artifactId>examples</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>examples-pcvs</artifactId> diff --git a/examples/examples-periodic/pom.xml b/examples/examples-periodic/pom.xml index b3528f5c4..b4b591e71 100644 --- a/examples/examples-periodic/pom.xml +++ b/examples/examples-periodic/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.examples</groupId> <artifactId>examples</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>examples-periodic</artifactId> diff --git a/examples/examples-servlet/pom.xml b/examples/examples-servlet/pom.xml index 0f6a49275..606876aa9 100644 --- a/examples/examples-servlet/pom.xml +++ b/examples/examples-servlet/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.examples</groupId> <artifactId>examples</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>examples-servlet</artifactId> diff --git a/examples/pom.xml b/examples/pom.xml index b457a7ec9..5c7c482e3 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp</groupId> <artifactId>apex-pdp</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.examples</groupId> diff --git a/model/basic-model/pom.xml b/model/basic-model/pom.xml index a7e9d1df9..d12f223a2 100644 --- a/model/basic-model/pom.xml +++ b/model/basic-model/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.model</groupId> <artifactId>model</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>basic-model</artifactId> diff --git a/model/context-model/pom.xml b/model/context-model/pom.xml index 93cc466fc..366516f72 100644 --- a/model/context-model/pom.xml +++ b/model/context-model/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.model</groupId> <artifactId>model</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>context-model</artifactId> diff --git a/model/engine-model/pom.xml b/model/engine-model/pom.xml index de1de9bae..de0b7135c 100644 --- a/model/engine-model/pom.xml +++ b/model/engine-model/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.model</groupId> <artifactId>model</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>engine-model</artifactId> diff --git a/model/event-model/pom.xml b/model/event-model/pom.xml index 14a58d937..81ac93426 100644 --- a/model/event-model/pom.xml +++ b/model/event-model/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.model</groupId> <artifactId>model</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>event-model</artifactId> diff --git a/model/model-api/pom.xml b/model/model-api/pom.xml index aa41cd656..69137ca2d 100644 --- a/model/model-api/pom.xml +++ b/model/model-api/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.model</groupId> <artifactId>model</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>model-api</artifactId> diff --git a/model/policy-model/pom.xml b/model/policy-model/pom.xml index 34cc85a33..ff89069a0 100644 --- a/model/policy-model/pom.xml +++ b/model/policy-model/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.model</groupId> <artifactId>model</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>policy-model</artifactId> diff --git a/model/pom.xml b/model/pom.xml index 6312584ec..aa9032444 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp</groupId> <artifactId>apex-pdp</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.model</groupId> diff --git a/model/utilities/pom.xml b/model/utilities/pom.xml index 4bc39e6e7..a2988584d 100644 --- a/model/utilities/pom.xml +++ b/model/utilities/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.model</groupId> <artifactId>model</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>utilities</artifactId> diff --git a/packages/apex-pdp-docker/pom.xml b/packages/apex-pdp-docker/pom.xml index 295ff95ee..99d739f79 100644 --- a/packages/apex-pdp-docker/pom.xml +++ b/packages/apex-pdp-docker/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.packages</groupId> <artifactId>apex-packages</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>apex-pdp-docker</artifactId> diff --git a/packages/apex-pdp-package-full/pom.xml b/packages/apex-pdp-package-full/pom.xml index da88664aa..efa2d44a3 100644 --- a/packages/apex-pdp-package-full/pom.xml +++ b/packages/apex-pdp-package-full/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.packages</groupId> <artifactId>apex-packages</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>apex-pdp-package-full</artifactId> diff --git a/packages/apex-pdp-package-full/src/main/package/scripts/apexApps.bat b/packages/apex-pdp-package-full/src/main/package/scripts/apexApps.bat index 6610c109e..b5a92fd5a 100644..100755 --- a/packages/apex-pdp-package-full/src/main/package/scripts/apexApps.bat +++ b/packages/apex-pdp-package-full/src/main/package/scripts/apexApps.bat @@ -32,6 +32,13 @@ @echo off setlocal enableDelayedExpansion +if not defined KEYSTORE_PASSWD ( + set KEYSTORE_PASSWD=Pol1cy_0nap +) + +if not defined TRUSTSTORE_PASSWD ( + set TRUSTSTORE_PASSWD=Pol1cy_0nap +) if defined APEX_HOME ( if exist "%APEX_HOME%\" ( @@ -53,9 +60,7 @@ if defined APEX_HOME ( :: Environment variables for HTTPS set KEYSTORE=%APEX_HOME%/etc/ssl/policy-keystore" -set KEYSTORE_PASSWD="Pol1cy_0nap" set TRUSTSTORE=%APEX_HOME%/etc/ssl/policy-truststore" -set TRUSTSTORE_PASSWD="Pol1cy_0nap" :: HTTPS parameters set HTTPS_PARAMETERS=-Djavax.net.ssl.keyStore=%KEYSTORE% -Djavax.net.ssl.keyStorePassword=%KEYSTORE_PASSWD% -Djavax.net.ssl.trustStore=%TRUSTSTORE% -Djavax.net.ssl.trustStorePassword=%TRUSTSTORE_PASSWD% diff --git a/packages/apex-pdp-package-full/src/main/package/scripts/apexApps.sh b/packages/apex-pdp-package-full/src/main/package/scripts/apexApps.sh index 5b6350a81..8f966369d 100755 --- a/packages/apex-pdp-package-full/src/main/package/scripts/apexApps.sh +++ b/packages/apex-pdp-package-full/src/main/package/scripts/apexApps.sh @@ -49,12 +49,10 @@ fi ## Environment variables for HTTPS KEYSTORE="${APEX_HOME}/etc/ssl/policy-keystore" -KEYSTORE_PASSWD="Pol1cy_0nap" TRUSTSTORE="${APEX_HOME}/etc/ssl/policy-truststore" -TRUSTSTORE_PASSWD="Pol1cy_0nap" ## HTTPS parameters -HTTPS_PARAMETERS="-Djavax.net.ssl.keyStore=${KEYSTORE} -Djavax.net.ssl.keyStorePassword=${KEYSTORE_PASSWD} -Djavax.net.ssl.trustStore=${TRUSTSTORE} -Djavax.net.ssl.trustStorePassword=${TRUSTSTORE_PASSWD}" +HTTPS_PARAMETERS="-Djavax.net.ssl.keyStore=${KEYSTORE} -Djavax.net.ssl.keyStorePassword=${KEYSTORE_PASSWD:-Pol1cy_0nap} -Djavax.net.ssl.trustStore=$TRUSTSTORE -Djavax.net.ssl.trustStorePassword=${TRUSTSTORE_PASSWD:-Pol1cy_0nap}" ## script name for output MOD_SCRIPT_NAME=`basename $0` @@ -71,7 +69,7 @@ fi _config="${HTTPS_PARAMETERS} -Dlogback.configurationFile=$APEX_HOME/etc/logback.xml -Dhazelcast.config=$APEX_HOME/etc/hazelcast.xml -Dhazelcast.mancenter.enabled=false" ## jmx test config -_jmxconfig="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9911 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false" +_jmxconfig="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9911 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false " ## Maven/APEX version _version=`cat $APEX_HOME/etc/app-version.txt` diff --git a/packages/pom.xml b/packages/pom.xml index 12502c4a1..919efa5eb 100644 --- a/packages/pom.xml +++ b/packages/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp</groupId> <artifactId>apex-pdp</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.packages</groupId> diff --git a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/pom.xml b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/pom.xml index ab1dd9b7e..2a0e5ba55 100644 --- a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/pom.xml +++ b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-distribution</groupId> <artifactId>plugins-context-distribution</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-context-distribution-hazelcast</artifactId> diff --git a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/pom.xml b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/pom.xml index 519515076..bf37f7b04 100644 --- a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/pom.xml +++ b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-distribution</groupId> <artifactId>plugins-context-distribution</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-context-distribution-infinispan</artifactId> diff --git a/plugins/plugins-context/plugins-context-distribution/pom.xml b/plugins/plugins-context/plugins-context-distribution/pom.xml index b5652c900..eb67a27ce 100644 --- a/plugins/plugins-context/plugins-context-distribution/pom.xml +++ b/plugins/plugins-context/plugins-context-distribution/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-context</groupId> <artifactId>plugins-context</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-distribution</groupId> diff --git a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/pom.xml b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/pom.xml index 9e711941b..21a6a2be7 100644 --- a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/pom.xml +++ b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-locking</groupId> <artifactId>plugins-context-locking</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-context-locking-curator</artifactId> diff --git a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-hazelcast/pom.xml b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-hazelcast/pom.xml index b9ec0c115..f58fc5faf 100644 --- a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-hazelcast/pom.xml +++ b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-hazelcast/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-locking</groupId> <artifactId>plugins-context-locking</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-context-locking-hazelcast</artifactId> diff --git a/plugins/plugins-context/plugins-context-locking/pom.xml b/plugins/plugins-context/plugins-context-locking/pom.xml index e0e01527c..f3e40cd69 100644 --- a/plugins/plugins-context/plugins-context-locking/pom.xml +++ b/plugins/plugins-context/plugins-context-locking/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-context</groupId> <artifactId>plugins-context</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-locking</groupId> diff --git a/plugins/plugins-context/plugins-context-persistence/pom.xml b/plugins/plugins-context/plugins-context-persistence/pom.xml index 0f00cf8b4..b9d15bd5d 100644 --- a/plugins/plugins-context/plugins-context-persistence/pom.xml +++ b/plugins/plugins-context/plugins-context-persistence/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-context</groupId> <artifactId>plugins-context</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-persistence</groupId> diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/pom.xml b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/pom.xml index 775b620a6..c5cfae846 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/pom.xml +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-schema</groupId> <artifactId>plugins-context-schema</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-context-schema-avro</artifactId> diff --git a/plugins/plugins-context/plugins-context-schema/pom.xml b/plugins/plugins-context/plugins-context-schema/pom.xml index 8cb4f4fd5..50bc82828 100644 --- a/plugins/plugins-context/plugins-context-schema/pom.xml +++ b/plugins/plugins-context/plugins-context-schema/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-context</groupId> <artifactId>plugins-context</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-schema</groupId> diff --git a/plugins/plugins-context/pom.xml b/plugins/plugins-context/pom.xml index 234ceb7d2..9079c969f 100644 --- a/plugins/plugins-context/pom.xml +++ b/plugins/plugins-context/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins</groupId> <artifactId>plugins</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-context</groupId> diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/pom.xml index ec62303ed..1cad1d699 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/pom.xml +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId> <artifactId>plugins-event-carrier</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-event-carrier-grpc</artifactId> diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/pom.xml index 578cf7202..a3e8c910a 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/pom.xml +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId> <artifactId>plugins-event-carrier</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-event-carrier-jms</artifactId> diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/pom.xml index 381510e8e..1b228a421 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/pom.xml +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId> <artifactId>plugins-event-carrier</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-event-carrier-kafka</artifactId> diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/pom.xml index 0ef0cfe73..d2b4625cf 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/pom.xml +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId> <artifactId>plugins-event-carrier</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-event-carrier-restclient</artifactId> diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParameters.java index 47e94ff51..d5bca3f5a 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParameters.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParameters.java @@ -24,6 +24,8 @@ package org.onap.policy.apex.plugins.event.carrier.restclient; import lombok.Getter; import lombok.Setter; import org.onap.policy.apex.service.parameters.carriertechnology.RestPluginCarrierTechnologyParameters; +import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ValidationStatus; // @formatter:off /** @@ -59,4 +61,19 @@ public class RestClientCarrierTechnologyParameters extends RestPluginCarrierTech this.setEventProducerPluginClass(ApexRestClientProducer.class.getName()); this.setEventConsumerPluginClass(ApexRestClientConsumer.class.getName()); } + + /** + * {@inheritDoc} + */ + @Override + public GroupValidationResult validateUrl(final GroupValidationResult result) { + // Check if the URL has been set for event output + final String urlNullMessage = "no URL has been set for event sending on " + getLabel(); + if (getUrl() == null) { + result.setResult("url", ValidationStatus.INVALID, urlNullMessage); + return result; + } + + return super.validateUrl(result); + } } diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/pom.xml index b70760174..0aceada2b 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/pom.xml +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId> <artifactId>plugins-event-carrier</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-event-carrier-restrequestor</artifactId> diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorCarrierTechnologyParameters.java index 9f3a631e1..9e55e22d6 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorCarrierTechnologyParameters.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorCarrierTechnologyParameters.java @@ -21,12 +21,9 @@ package org.onap.policy.apex.plugins.event.carrier.restrequestor; -import java.util.regex.Matcher; import lombok.Getter; import lombok.Setter; import org.onap.policy.apex.service.parameters.carriertechnology.RestPluginCarrierTechnologyParameters; -import org.onap.policy.common.parameters.GroupValidationResult; -import org.onap.policy.common.parameters.ValidationStatus; // @formatter:off /** @@ -70,33 +67,4 @@ public class RestRequestorCarrierTechnologyParameters extends RestPluginCarrierT this.setEventProducerPluginClass(ApexRestRequestorProducer.class.getName()); this.setEventConsumerPluginClass(ApexRestRequestorConsumer.class.getName()); } - - // @formatter:off - /** - * Validate the URL. - * - * <p>Checks: - * http://www.blah.com/{par1/somethingelse (Missing end tag) use {[^\\{}]*$ - * http://www.blah.com/{par1/{some}thingelse (Nested tag) use {[^}]*{ - * http://www.blah.com/{par1}/some}thingelse (Missing start tag1) use }[^{}]*.} - * http://www.blah.com/par1}/somethingelse (Missing start tag2) use }[^{}]*} - * http://www.blah.com/{}/somethingelse (Empty tag) use {[\s]*} - * @param result the result of the validation - */ - // @formatter:on - @Override - public GroupValidationResult validateUrl(final GroupValidationResult result) { - // URL is only set on Requestor consumers - if (getUrl() == null) { - return result; - } - - Matcher matcher = patternErrorKey.matcher(getUrl()); - if (matcher.find()) { - result.setResult("url", ValidationStatus.INVALID, - "no proper URL has been set for event sending on REST requestor"); - } - - return result; - } } diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/pom.xml index ebd6faa18..387a37400 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/pom.xml +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId> <artifactId>plugins-event-carrier</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-event-carrier-restserver</artifactId> diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/pom.xml index ac155911b..85240a745 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/pom.xml +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId> <artifactId>plugins-event-carrier</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-event-carrier-websocket</artifactId> diff --git a/plugins/plugins-event/plugins-event-carrier/pom.xml b/plugins/plugins-event/plugins-event-carrier/pom.xml index ce55984f0..91d7222c0 100644 --- a/plugins/plugins-event/plugins-event-carrier/pom.xml +++ b/plugins/plugins-event/plugins-event-carrier/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event</groupId> <artifactId>plugins-event</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId> diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/pom.xml b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/pom.xml index d6b8c2a7b..3402f38b3 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/pom.xml +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-protocol</groupId> <artifactId>plugins-event-protocol</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-event-protocol-jms</artifactId> diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/pom.xml b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/pom.xml index 651bd1ec5..49c40a64d 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/pom.xml +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-protocol</groupId> <artifactId>plugins-event-protocol</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-event-protocol-xml</artifactId> diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/pom.xml b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/pom.xml index cd40dd181..739582e94 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/pom.xml +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-protocol</groupId> <artifactId>plugins-event-protocol</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-event-protocol-yaml</artifactId> diff --git a/plugins/plugins-event/plugins-event-protocol/pom.xml b/plugins/plugins-event/plugins-event-protocol/pom.xml index 4a972de9e..154773e6e 100644 --- a/plugins/plugins-event/plugins-event-protocol/pom.xml +++ b/plugins/plugins-event/plugins-event-protocol/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event</groupId> <artifactId>plugins-event</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-protocol</groupId> diff --git a/plugins/plugins-event/pom.xml b/plugins/plugins-event/pom.xml index 2c73e08fc..686c07c03 100644 --- a/plugins/plugins-event/pom.xml +++ b/plugins/plugins-event/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins</groupId> <artifactId>plugins</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event</groupId> diff --git a/plugins/plugins-executor/plugins-executor-java/pom.xml b/plugins/plugins-executor/plugins-executor-java/pom.xml index 243988075..ef56204ad 100644 --- a/plugins/plugins-executor/plugins-executor-java/pom.xml +++ b/plugins/plugins-executor/plugins-executor-java/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-executor</groupId> <artifactId>plugins-executor</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-executor-java</artifactId> diff --git a/plugins/plugins-executor/plugins-executor-javascript/pom.xml b/plugins/plugins-executor/plugins-executor-javascript/pom.xml index e97803363..e55838c4c 100644 --- a/plugins/plugins-executor/plugins-executor-javascript/pom.xml +++ b/plugins/plugins-executor/plugins-executor-javascript/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-executor</groupId> <artifactId>plugins-executor</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-executor-javascript</artifactId> diff --git a/plugins/plugins-executor/plugins-executor-jruby/pom.xml b/plugins/plugins-executor/plugins-executor-jruby/pom.xml index 2d26e41fa..b70c3c141 100644 --- a/plugins/plugins-executor/plugins-executor-jruby/pom.xml +++ b/plugins/plugins-executor/plugins-executor-jruby/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-executor</groupId> <artifactId>plugins-executor</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-executor-jruby</artifactId> diff --git a/plugins/plugins-executor/plugins-executor-mvel/pom.xml b/plugins/plugins-executor/plugins-executor-mvel/pom.xml index 5a4f86c8b..083baf586 100644 --- a/plugins/plugins-executor/plugins-executor-mvel/pom.xml +++ b/plugins/plugins-executor/plugins-executor-mvel/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-executor</groupId> <artifactId>plugins-executor</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-executor-mvel</artifactId> diff --git a/plugins/plugins-executor/pom.xml b/plugins/plugins-executor/pom.xml index ac68ab5f8..cb7fed587 100644 --- a/plugins/plugins-executor/pom.xml +++ b/plugins/plugins-executor/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins</groupId> <artifactId>plugins</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-executor</groupId> diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/pom.xml b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/pom.xml index e49ad6dc9..880db11a0 100644 --- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/pom.xml +++ b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-persistence.plugins-persistence-jpa</groupId> <artifactId>plugins-persistence-jpa</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>plugins-persistence-jpa-eclipselink</artifactId> <name>${project.artifactId}</name> diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/pom.xml b/plugins/plugins-persistence/plugins-persistence-jpa/pom.xml index 3866f5711..b39d79b7f 100644 --- a/plugins/plugins-persistence/plugins-persistence-jpa/pom.xml +++ b/plugins/plugins-persistence/plugins-persistence-jpa/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-persistence</groupId> <artifactId>plugins-persistence</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-persistence.plugins-persistence-jpa</groupId> diff --git a/plugins/plugins-persistence/pom.xml b/plugins/plugins-persistence/pom.xml index f3e8f92b2..2c7bc6fd8 100644 --- a/plugins/plugins-persistence/pom.xml +++ b/plugins/plugins-persistence/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins</groupId> <artifactId>plugins</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-persistence</groupId> diff --git a/plugins/pom.xml b/plugins/pom.xml index c1990080d..9f301465f 100644 --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp</groupId> <artifactId>apex-pdp</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.plugins</groupId> @@ -27,13 +27,13 @@ <parent> <groupId>org.onap.policy.parent</groupId> <artifactId>integration</artifactId> - <version>3.2.0-SNAPSHOT</version> + <version>3.2.0</version> <relativePath /> </parent> <groupId>org.onap.policy.apex-pdp</groupId> <artifactId>apex-pdp</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> <packaging>pom</packaging> <name>policy-apex-pdp</name> @@ -45,8 +45,8 @@ <version.commons-cli>1.4</version.commons-cli> <version.kafka>2.3.0</version.kafka> <version.hibernate>5.3.7.Final</version.hibernate> - <version.policy.common>1.7.0-SNAPSHOT</version.policy.common> - <version.policy.models>2.3.0-SNAPSHOT</version.policy.models> + <version.policy.common>1.7.0</version.policy.common> + <version.policy.models>2.3.0</version.policy.models> <version.jgroups>4.1.5.Final</version.jgroups> <version.commons-codec>20041127.091804</version.commons-codec> <version.caffeine>2.8.0</version.caffeine> @@ -66,6 +66,11 @@ <scope>test</scope> </dependency> <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.awaitility</groupId> <artifactId>awaitility</artifactId> <scope>test</scope> diff --git a/releases/2.4.0-container.yaml b/releases/2.4.0-container.yaml new file mode 100644 index 000000000..3159c6877 --- /dev/null +++ b/releases/2.4.0-container.yaml @@ -0,0 +1,8 @@ +distribution_type: 'container' +container_release_tag: '2.4.0' +project: 'policy-apex-pdp' +log_dir: 'policy-apex-pdp-maven-docker-stage-master/393/' +ref: 4352b26f58b202052560f85370c02c2b86da3422 +containers: + - name: 'policy-apex-pdp' + version: '2.4.0-20200710T1611' diff --git a/releases/2.4.0.yaml b/releases/2.4.0.yaml new file mode 100644 index 000000000..beaac1833 --- /dev/null +++ b/releases/2.4.0.yaml @@ -0,0 +1,5 @@ +distribution_type: 'maven' +version: '2.4.0' +project: 'policy-apex-pdp' +tag_release: false +log_dir: 'policy-apex-pdp-maven-stage-master/394/'
\ No newline at end of file diff --git a/services/pom.xml b/services/pom.xml index 7851693c2..ccc482bc0 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp</groupId> <artifactId>apex-pdp</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.services</groupId> diff --git a/services/services-engine/pom.xml b/services/services-engine/pom.xml index 0ba012952..f34142782 100644 --- a/services/services-engine/pom.xml +++ b/services/services-engine/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.services</groupId> <artifactId>services</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>services-engine</artifactId> diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/RestPluginCarrierTechnologyParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/RestPluginCarrierTechnologyParameters.java index 9a3311905..eab936edc 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/RestPluginCarrierTechnologyParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/RestPluginCarrierTechnologyParameters.java @@ -64,12 +64,14 @@ public class RestPluginCarrierTechnologyParameters extends CarrierTechnologyPara private static final Logger LOGGER = LoggerFactory.getLogger(RestPluginCarrierTechnologyParameters.class); /** The supported HTTP methods. */ + // @formatter:off public enum HttpMethod { GET, PUT, POST, DELETE } + // @formatter:on /** The default HTTP code filter, allows 2xx HTTP codes through. */ public static final String DEFAULT_HTTP_CODE_FILTER = "[2][0-9][0-9]"; @@ -80,8 +82,8 @@ public class RestPluginCarrierTechnologyParameters extends CarrierTechnologyPara // Regular expression patterns for finding and checking keys in URLs private static final Pattern patternProperKey = Pattern.compile("(?<=\\{)[^}]*(?=\\})"); - protected static final Pattern patternErrorKey = - Pattern.compile("(\\{[^\\{}]*.?\\{)|(\\{[^\\{}]*$)|(\\}[^\\{}]*.?\\})|(^[^\\{}]*.?\\})|\\{\\s*\\}"); + protected static final Pattern patternErrorKey = Pattern + .compile("(\\{[^\\{}]*.?\\{)|(\\{[^\\{}]*$)|(\\}[^\\{}]*.?\\})|(^[^\\{}]*.?\\})|\\{\\s*\\}"); // variable protected String url = null; @@ -90,8 +92,8 @@ public class RestPluginCarrierTechnologyParameters extends CarrierTechnologyPara protected String httpCodeFilter = DEFAULT_HTTP_CODE_FILTER; /** - * Constructor to create a REST carrier technology parameters instance and register the instance with the parameter - * service. + * Constructor to create a REST carrier technology parameters instance and + * register the instance with the parameter service. */ public RestPluginCarrierTechnologyParameters() { super(); @@ -176,16 +178,16 @@ public class RestPluginCarrierTechnologyParameters extends CarrierTechnologyPara */ // @formatter:on public GroupValidationResult validateUrl(final GroupValidationResult result) { - // Check if the URL has been set for event output - String urlErrorMessage = "no URL has been set for event sending on " + getLabel(); + // The URL may be optional so existence must be checked in the plugin code if (getUrl() == null) { - result.setResult("url", ValidationStatus.INVALID, urlErrorMessage); return result; } Matcher matcher = patternErrorKey.matcher(getUrl()); if (matcher.find()) { - result.setResult("url", ValidationStatus.INVALID, urlErrorMessage); + final String urlInvalidMessage = "invalid URL " + getUrl() + " has been set for event sending on " + + getLabel(); + result.setResult("url", ValidationStatus.INVALID, urlInvalidMessage); } return result; @@ -206,14 +208,13 @@ public class RestPluginCarrierTechnologyParameters extends CarrierTechnologyPara result.setResult(HTTP_HEADERS, ValidationStatus.INVALID, "HTTP header array entry is null"); } else if (httpHeader.length != 2) { result.setResult(HTTP_HEADERS, ValidationStatus.INVALID, - "HTTP header array entries must have one key and one value: " - + Arrays.deepToString(httpHeader)); + "HTTP header array entries must have one key and one value: " + Arrays.deepToString(httpHeader)); } else if (!ParameterValidationUtils.validateStringParameter(httpHeader[0])) { result.setResult(HTTP_HEADERS, ValidationStatus.INVALID, - "HTTP header key is null or blank: " + Arrays.deepToString(httpHeader)); + "HTTP header key is null or blank: " + Arrays.deepToString(httpHeader)); } else if (!ParameterValidationUtils.validateStringParameter(httpHeader[1])) { result.setResult(HTTP_HEADERS, ValidationStatus.INVALID, - "HTTP header value is null or blank: " + Arrays.deepToString(httpHeader)); + "HTTP header value is null or blank: " + Arrays.deepToString(httpHeader)); } } @@ -231,14 +232,13 @@ public class RestPluginCarrierTechnologyParameters extends CarrierTechnologyPara } else if (StringUtils.isBlank(httpCodeFilter)) { result.setResult(HTTP_CODE_FILTER, ValidationStatus.INVALID, - "HTTP code filter must be specified as a three digit regular expression"); + "HTTP code filter must be specified as a three digit regular expression"); } else { try { Pattern.compile(httpCodeFilter); } catch (PatternSyntaxException pse) { - String message = - "Invalid HTTP code filter, the filter must be specified as a three digit regular expression: " - + pse.getMessage(); + String message = "Invalid HTTP code filter, the filter must be specified as a three digit " + + "regular expression: " + pse.getMessage(); result.setResult(HTTP_CODE_FILTER, ValidationStatus.INVALID, message); LOGGER.debug(message, pse); } @@ -253,6 +253,6 @@ public class RestPluginCarrierTechnologyParameters extends CarrierTechnologyPara @Override public String toString() { return getLabel() + "CarrierTechnologyParameters [url=" + url + ", httpMethod=" + httpMethod + ", httpHeaders=" - + Arrays.deepToString(httpHeaders) + ", httpCodeFilter=" + httpCodeFilter + "]"; + + Arrays.deepToString(httpHeaders) + ", httpCodeFilter=" + httpCodeFilter + "]"; } } diff --git a/services/services-onappf/pom.xml b/services/services-onappf/pom.xml index bc446c46a..279c2b4eb 100644 --- a/services/services-onappf/pom.xml +++ b/services/services-onappf/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.services</groupId> <artifactId>services</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>services-onappf</artifactId> diff --git a/testsuites/apex-pdp-stability/pom.xml b/testsuites/apex-pdp-stability/pom.xml index 1a9613450..e6dc04db9 100644 --- a/testsuites/apex-pdp-stability/pom.xml +++ b/testsuites/apex-pdp-stability/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.testsuites</groupId> <artifactId>apex-testsuites</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.testsuites.stability</groupId> diff --git a/testsuites/integration/integration-common/pom.xml b/testsuites/integration/integration-common/pom.xml index c77536981..987d7fc1b 100644 --- a/testsuites/integration/integration-common/pom.xml +++ b/testsuites/integration/integration-common/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId> <artifactId>apex-integration</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>integration-common</artifactId> diff --git a/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelSaverTest.java b/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelSaverTest.java index 241f69dc0..c7ab1d9a0 100644 --- a/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelSaverTest.java +++ b/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelSaverTest.java @@ -1,28 +1,29 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ package org.onap.policy.apex.testsuites.integration.common.model; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; import java.io.File; import java.io.IOException; @@ -30,6 +31,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.Comparator; import org.junit.Test; +import org.onap.policy.apex.model.basicmodel.concepts.ApexException; /** * Test the sample domain model saver. @@ -37,32 +39,19 @@ import org.junit.Test; public class SampleDomainModelSaverTest { @Test - public void testSampleDomainModelSaver() throws IOException { - try { - SampleDomainModelSaver.main(null); - fail("test should throw an exception"); - } catch (Exception exc) { - assertEquals("java.lang.NullPointerException", exc.getClass().getName()); - } + public void testSampleDomainModelSaver() throws IOException, ApexException { + assertThatThrownBy(() -> SampleDomainModelSaver.main(null)).isInstanceOf(NullPointerException.class); String[] args0 = { "two", "arguments" }; - try { - SampleDomainModelSaver.main(args0); - } catch (Exception exc) { - fail("test should not throw an exception"); - } + SampleDomainModelSaver.main(args0); Path tempDirectory = Files.createTempDirectory("ApexModelTempDir"); String[] args1 = { tempDirectory.toString() }; - try { - SampleDomainModelSaver.main(args1); - } catch (Exception exc) { - fail("test should not throw an exception"); - } + SampleDomainModelSaver.main(args1); File tempDir = new File(tempDirectory.toString()); assertTrue(tempDir.isDirectory()); diff --git a/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/testclasses/TestPingClassTest.java b/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/testclasses/TestPingClassTest.java index 82f46c04a..92f86f434 100644 --- a/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/testclasses/TestPingClassTest.java +++ b/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/testclasses/TestPingClassTest.java @@ -21,8 +21,8 @@ package org.onap.policy.apex.testsuites.integration.common.testclasses; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; @@ -32,7 +32,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException; */ public class TestPingClassTest { @Test - public void testPingClass() { + public void testPingClass() throws ApexException { PingTestClass ptc = new PingTestClass(); ptc.setName("Hello"); @@ -46,84 +46,43 @@ public class TestPingClassTest { ptc.setPongTime(-1); assertEquals(-1, ptc.getPongTime()); - - try { - ptc.verify(); - fail("test should throw an exception"); - } catch (ApexException ae) { - assertEquals("TestPing is not valid, name does not start with \"Rose\"", ae.getMessage()); - } + assertThatThrownBy(() -> ptc.verify()).isInstanceOf(ApexException.class) + .hasMessageContaining("TestPing is not valid, name does not start with \"Rose\""); ptc.setName(null); - try { - ptc.verify(); - fail("test should throw an exception"); - } catch (ApexException ae) { - assertEquals("TestPing is not valid, name length null or less than 4", ae.getMessage()); - } + assertThatThrownBy(() -> ptc.verify()).isInstanceOf(ApexException.class) + .hasMessageContaining("TestPing is not valid, name length null or less than 4"); ptc.setName("Ros"); - try { - ptc.verify(); - fail("test should throw an exception"); - } catch (ApexException ae) { - assertEquals("TestPing is not valid, name length null or less than 4", ae.getMessage()); - } + assertThatThrownBy(() -> ptc.verify()).isInstanceOf(ApexException.class) + .hasMessageContaining("TestPing is not valid, name length null or less than 4"); ptc.setName("Rose"); - try { - ptc.verify(); - fail("test should throw an exception"); - } catch (ApexException ae) { - assertEquals("TestPing is not valid, description length null or less than 44", ae.getMessage()); - } + assertThatThrownBy(() -> ptc.verify()).isInstanceOf(ApexException.class) + .hasMessageContaining("TestPing is not valid, description length null or less than 44"); ptc.setDescription(null); - try { - ptc.verify(); - fail("test should throw an exception"); - } catch (ApexException ae) { - assertEquals("TestPing is not valid, description length null or less than 44", ae.getMessage()); - } + assertThatThrownBy(() -> ptc.verify()).isInstanceOf(ApexException.class) + .hasMessageContaining("TestPing is not valid, description length null or less than 44"); ptc.setDescription("A rose by any other name would smell as swee"); - try { - ptc.verify(); - fail("test should throw an exception"); - } catch (ApexException ae) { - assertEquals("TestPing is not valid, description length null or less than 44", ae.getMessage()); - } + assertThatThrownBy(() -> ptc.verify()).isInstanceOf(ApexException.class) + .hasMessageContaining("TestPing is not valid, description length null or less than 44"); ptc.setDescription("A rose by any other name would smell as swell"); - try { - ptc.verify(); - fail("test should throw an exception"); - } catch (ApexException ae) { - assertEquals("TestPing is not valid, description is incorrect", ae.getMessage()); - } + assertThatThrownBy(() -> ptc.verify()).isInstanceOf(ApexException.class) + .hasMessageContaining("TestPing is not valid, description is incorrect"); ptc.setDescription("A rose by any other name would smell as sweet"); - try { - ptc.verify(); - fail("test should throw an exception"); - } catch (ApexException ae) { - assertEquals("TestPing is not valid, pong time -1 is less than ping time 0", ae.getMessage()); - } + assertThatThrownBy(() -> ptc.verify()).isInstanceOf(ApexException.class) + .hasMessageContaining("TestPing is not valid, pong time -1 is less than ping time 0"); ptc.setPongTime(-2); - try { - ptc.verify(); - fail("test should throw an exception"); - } catch (ApexException ae) { - assertEquals("TestPing is not valid, pong time -2 is less than ping time 0", ae.getMessage()); - } + assertThatThrownBy(() -> ptc.verify()).isInstanceOf(ApexException.class) + .hasMessageContaining("TestPing is not valid, pong time -2 is less than ping time 0"); ptc.setPongTime(1); - try { - ptc.verify(); - } catch (ApexException ae) { - fail("test should not throw an exception"); - } + ptc.verify(); assertEquals( "PingTestClass(id=0, name=Rose, " diff --git a/testsuites/integration/integration-context-test/pom.xml b/testsuites/integration/integration-context-test/pom.xml index 0cd1ae35a..a117e0553 100644 --- a/testsuites/integration/integration-context-test/pom.xml +++ b/testsuites/integration/integration-context-test/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId> <artifactId>apex-integration</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>integration-context-test</artifactId> diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java index 475316a4d..9e9e4626e 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java @@ -21,6 +21,7 @@ package org.onap.policy.apex.testsuites.integration.context.distribution; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -242,15 +243,8 @@ public class ContextInstantiation { assertTrue(externalContextAlbum.values().containsAll(mapValues)); // Check that clearing does not work - try { - externalContextAlbum.clear(); - fail(EXCEPTION_MESSAGE); - } catch (final ContextRuntimeException e) { - assertEquals("album \"ExternalContextAlbum:0.0.1\" clear() not allowed on read only albums", - e.getMessage()); - LOGGER.trace(NORMAL_TEST_EXCEPTION, e); - } - + assertThatThrownBy(() -> externalContextAlbum.clear()).isInstanceOf(ContextRuntimeException.class) + .hasMessageContaining("album \"ExternalContextAlbum:0.0.1\" clear() not allowed on read only albums"); assertEquals(1, externalContextAlbum.size()); assertContextAlbumContains(externalContext, externalContextAlbum); @@ -258,32 +252,16 @@ public class ContextInstantiation { final Set<Entry<String, Object>> entrySet = externalContextAlbum.entrySet(); assertEquals(1, entrySet.size()); - try { - externalContextAlbum.get(null); - } catch (final ContextRuntimeException e) { - assertEquals("album \"ExternalContextAlbum:0.0.1\" null keys are illegal on keys for get()", - e.getMessage()); - LOGGER.trace(NORMAL_TEST_EXCEPTION, e); - } - + assertThatThrownBy(() -> externalContextAlbum.get(null)).isInstanceOf(ContextRuntimeException.class) + .hasMessageContaining("album \"ExternalContextAlbum:0.0.1\" null keys are illegal on keys for get()"); final Object aObject = externalContextAlbum.get(EXTERNAL_CONTEXT); assertEquals(aObject, externalContext); // put null keys should fail, throws a runtime exception - try { - externalContextAlbum.put(null, null); - } catch (final ContextRuntimeException e) { - assertEquals("album \"ExternalContextAlbum:0.0.1\" null keys are illegal on keys for put()", - e.getMessage()); - LOGGER.trace(NORMAL_TEST_EXCEPTION, e); - } - - try { - externalContextAlbum.put("TestExternalContextItem00A", null); - } catch (final ContextRuntimeException e) { - assertEquals(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItem00A\" for put()", e.getMessage()); - LOGGER.trace(NORMAL_TEST_EXCEPTION, e); - } + assertThatThrownBy(() -> externalContextAlbum.put(null, null)) + .hasMessageContaining("album \"ExternalContextAlbum:0.0.1\" null keys are illegal on keys for put()"); + assertThatThrownBy(() -> externalContextAlbum.put("TestExternalContextItem00A", null)) + .hasMessageContaining(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItem00A\" for put()"); assertEquals(tciAa, externalContextItem.getTestExternalContextItem00A()); // Should return the hash set @@ -305,29 +283,17 @@ public class ContextInstantiation { assertTrue(externalContextAlbum.put(EXTERNAL_CONTEXT, externalContext).equals(externalContextOther)); externalContextItem = (TestExternalContextItem) externalContextAlbum.get(EXTERNAL_CONTEXT); assertEquals(INT_VAL_3, externalContextItem.getTestExternalContextItem002().getIntValue()); + assertThatThrownBy(() -> externalContextAlbum.put("TestExternalContextItem00A", null)) + .hasMessageContaining(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItem00A\" for put()"); - try { - externalContextAlbum.put("TestExternalContextItem00A", null); - } catch (final ContextRuntimeException e) { - assert (e.getMessage().equals(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItem00A\" for put()")); - LOGGER.trace(NORMAL_TEST_EXCEPTION, e); - } assertTrue(externalContextAlbum.get(EXTERNAL_CONTEXT).equals(externalContext)); - try { - externalContextAlbum.put("TestExternalContextItemFFF", null); - } catch (final ContextRuntimeException e) { - assert (e.getMessage().equals(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItemFFF\" for put()")); - LOGGER.trace(NORMAL_TEST_EXCEPTION, e); - } + assertThatThrownBy(() -> externalContextAlbum.put("TestExternalContextItemFFF", null)) + .hasMessageContaining(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItemFFF\" for put()"); assertEquals(1, externalContextAlbum.size()); - try { - externalContextAlbum.put("TestExternalContextItemFFF", null); - } catch (final ContextRuntimeException e) { - assertEquals(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItemFFF\" for put()", e.getMessage()); - LOGGER.trace(NORMAL_TEST_EXCEPTION, e); - } + assertThatThrownBy(() -> externalContextAlbum.put("TestExternalContextItemFFF", null)) + .hasMessageContaining(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItemFFF\" for put()"); assertEquals(1, externalContextAlbum.size()); // Should ignore remove @@ -341,23 +307,13 @@ public class ContextInstantiation { private void assertContextAlbumContains(final TestExternalContextItem externalContext, final ContextAlbum externalContextAlbum) { - try { - externalContextAlbum.containsKey(null); - } catch (final ContextRuntimeException e) { - assertEquals("null values are illegal on method parameter \"key\"", e.getMessage()); - LOGGER.trace(NORMAL_TEST_EXCEPTION, e); - } - + assertThatThrownBy(() -> externalContextAlbum.containsKey(null)) + .hasMessageContaining("null values are illegal on method parameter \"key\""); assertTrue(externalContextAlbum.containsKey(EXTERNAL_CONTEXT)); assertTrue(!externalContextAlbum.containsKey(GLOBAL_CONTEXT_KEY)); - try { - externalContextAlbum.containsValue(null); - } catch (final ContextRuntimeException e) { - assertEquals("null values are illegal on method parameter \"value\"", e.getMessage()); - LOGGER.trace(NORMAL_TEST_EXCEPTION, e); - } - + assertThatThrownBy(() -> externalContextAlbum.containsValue(null)) + .hasMessageContaining("null values are illegal on method parameter \"value\""); assertTrue(externalContextAlbum.containsValue(externalContext)); assertFalse(externalContextAlbum.containsValue("Hello")); } @@ -444,23 +400,12 @@ public class ContextInstantiation { private void assertPutMethods(final ContextAlbum policyContextAlbum, final TestContextStringItem contextStringItem, final Map<String, Object> valueMapA) { - try { - policyContextAlbum.put(TEST_POLICY_CONTEXT_ITEM000, contextStringItem); - fail(EXCEPTION_MESSAGE); - } catch (final ContextRuntimeException e) { - assertEquals(getMessage(TEST_POLICY_CONTEXT_ITEM000, "TestContextItem006", - TestContextStringItem.class.getName(), "stringValue=" + STRING_VAL), e.getMessage()); - LOGGER.trace(NORMAL_TEST_EXCEPTION, e); - } - - try { - policyContextAlbum.putAll(valueMapA); - fail(EXCEPTION_MESSAGE); - } catch (final ContextRuntimeException e) { - assertEquals(getMessage(TEST_POLICY_CONTEXT_ITEM001, "TestContextItem003", - TestContextLongItem.class.getName(), "longValue=" + INT_VAL_3), e.getMessage()); - LOGGER.trace(NORMAL_TEST_EXCEPTION, e); - } + assertThatThrownBy(() -> policyContextAlbum.put(TEST_POLICY_CONTEXT_ITEM000, contextStringItem)) + .hasMessageContaining(getMessage(TEST_POLICY_CONTEXT_ITEM000, "TestContextItem006", + TestContextStringItem.class.getName(), "stringValue=" + STRING_VAL)); + assertThatThrownBy(() -> policyContextAlbum.putAll(valueMapA)) + .hasMessageContaining(getMessage(TEST_POLICY_CONTEXT_ITEM001, "TestContextItem003", + TestContextLongItem.class.getName(), "longValue=" + INT_VAL_3)); } private AxContextModel getAxContextModel() { diff --git a/testsuites/integration/integration-executor-test/pom.xml b/testsuites/integration/integration-executor-test/pom.xml index 0ab27328e..bfb178a24 100644 --- a/testsuites/integration/integration-executor-test/pom.xml +++ b/testsuites/integration/integration-executor-test/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId> <artifactId>apex-integration</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>integration-executor-test</artifactId> diff --git a/testsuites/integration/integration-uservice-test/pom.xml b/testsuites/integration/integration-uservice-test/pom.xml index 2b447adc2..048a2ab7a 100644 --- a/testsuites/integration/integration-uservice-test/pom.xml +++ b/testsuites/integration/integration-uservice-test/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId> <artifactId>apex-integration</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>integration-uservice-test</artifactId> 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 e483597d0..71c8833be 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 @@ -63,8 +63,7 @@ public class TestExecutionPropertyRest { @BeforeClass public static void compilePolicy() { // @formatter:off - final String[] cliArgs = { - "-c", + final String[] cliArgs = { "-c", "src/test/resources/policies/executionproperties/policy/ExecutionPropertiesRestTestPolicyModel.apex", "-l", "target/ExecutionPropertiesRestTestPolicyModel.log", @@ -88,7 +87,7 @@ public class TestExecutionPropertyRest { } server = HttpServletServerFactoryInstance.getServerFactory().build("TestExecutionPropertyRest", false, null, - PORT, "/TestExecutionRest", false, false); + PORT, "/TestExecutionRest", false, false); server.addServletClass(null, TestRestClientEndpoint.class.getName()); server.setSerializationProvider(GsonMessageBodyHandler.class.getName()); @@ -129,7 +128,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 +141,8 @@ public class TestExecutionPropertyRest { System.setErr(stderr); LOGGER.info("testReplaceUrlTag-OUTSTRING=\n" + outString + "\nEnd-TagUrl"); - assertTrue(outString.contains("no URL has been set for event sending on RESTCLIENT")); + assertTrue(outString.contains("invalid URL http://localhost:32801/TestExecutionRest/apex/event/tagId}" + + " has been set for event sending on RESTCLIENT")); } /** @@ -153,7 +153,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); @@ -167,7 +167,7 @@ public class TestExecutionPropertyRest { 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")); + + "/event/{tagId}/{Number}\" not found in execution properties passed by the current policy")); } /** @@ -178,7 +178,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,7 +201,8 @@ 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(); @@ -212,7 +213,7 @@ public class TestExecutionPropertyRest { Response response = null; response = client.target("http://localhost:32801/TestExecutionRest/apex/event/GetProperUrl") - .request("application/json").get(); + .request("application/json").get(); LOGGER.info("testReplaceUrlTag-OUTSTRING=\n" + outString + "\nEnd-TagUrl"); final String responseEntity = response.readEntity(String.class); @@ -227,8 +228,7 @@ public class TestExecutionPropertyRest { final Client client = ClientBuilder.newClient(); // @formatter:off final String[] args = { - "src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToMultiTagUrlOK.json" - }; + "src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToMultiTagUrlOK.json" }; // @formatter:on final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(1500); @@ -238,7 +238,7 @@ public class TestExecutionPropertyRest { System.setErr(stderr); Response response = null; response = client.target("http://localhost:32801/TestExecutionRest/apex/event/GetProperUrl") - .request("application/json").get(); + .request("application/json").get(); final String responseEntity = response.readEntity(String.class); LOGGER.info("testReplaceUrlMultiTag-OUTSTRING=\n" + responseEntity + "\nEnd-MultiTagUrl"); assertTrue(responseEntity.contains("\"PostProperUrl\": 3")); diff --git a/testsuites/integration/pom.xml b/testsuites/integration/pom.xml index 685f8e1f9..a96d219e1 100644 --- a/testsuites/integration/pom.xml +++ b/testsuites/integration/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.testsuites</groupId> <artifactId>apex-testsuites</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId> diff --git a/testsuites/performance/performance-benchmark-test/pom.xml b/testsuites/performance/performance-benchmark-test/pom.xml index d97bc06cd..e34ac84a4 100644 --- a/testsuites/performance/performance-benchmark-test/pom.xml +++ b/testsuites/performance/performance-benchmark-test/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.testsuites.performance</groupId> <artifactId>apex-performance</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>performance-benchmark-test</artifactId> diff --git a/testsuites/performance/pom.xml b/testsuites/performance/pom.xml index 2b38efc9b..19aa28807 100644 --- a/testsuites/performance/pom.xml +++ b/testsuites/performance/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.testsuites</groupId> <artifactId>apex-testsuites</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.testsuites.performance</groupId> diff --git a/testsuites/pom.xml b/testsuites/pom.xml index c00ff3a87..e5ab27c3e 100644 --- a/testsuites/pom.xml +++ b/testsuites/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp</groupId> <artifactId>apex-pdp</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.testsuites</groupId> diff --git a/tools/model-generator/pom.xml b/tools/model-generator/pom.xml index 166251397..47fd60903 100644 --- a/tools/model-generator/pom.xml +++ b/tools/model-generator/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.tools</groupId> <artifactId>tools</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>model-generator</artifactId> diff --git a/tools/pom.xml b/tools/pom.xml index 62eb455b0..7cef66de3 100644 --- a/tools/pom.xml +++ b/tools/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp</groupId> <artifactId>apex-pdp</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.tools</groupId> diff --git a/tools/simple-wsclient/pom.xml b/tools/simple-wsclient/pom.xml index 072a396f2..edbfdec57 100644 --- a/tools/simple-wsclient/pom.xml +++ b/tools/simple-wsclient/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.tools</groupId> <artifactId>tools</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>simple-wsclient</artifactId> diff --git a/tools/tools-common/pom.xml b/tools/tools-common/pom.xml index 0e164e523..aec342fbe 100644 --- a/tools/tools-common/pom.xml +++ b/tools/tools-common/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.tools</groupId> <artifactId>tools</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.4.1-SNAPSHOT</version> </parent> <artifactId>tools-common</artifactId> diff --git a/version.properties b/version.properties index ee5d4d0e3..858e03bd3 100644 --- a/version.properties +++ b/version.properties @@ -4,7 +4,7 @@ major=2 minor=4 -patch=0 +patch=1 base_version=${major}.${minor}.${patch} |