diff options
15 files changed, 156 insertions, 145 deletions
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/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java index a1d0a7b3f..a5ba0f44b 100644 --- a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java +++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java @@ -140,7 +140,7 @@ public class RestInterfaceTest { private static int createNewSession() { final ApexApiResult responseMsg = target.path("editor/-1/Session/Create").request().get(ApexApiResult.class); assertEquals(ApexApiResult.Result.SUCCESS, responseMsg.getResult()); - assertTrue(responseMsg.getMessages().size() == 1); + assertEquals(1, responseMsg.getMessages().size()); return Integer.parseInt(responseMsg.getMessages().get(0)); } diff --git a/client/client-monitoring/src/test/java/org/onap/policy/apex/client/monitoring/rest/RestResourceTest.java b/client/client-monitoring/src/test/java/org/onap/policy/apex/client/monitoring/rest/RestResourceTest.java index a63224590..469f09586 100644 --- a/client/client-monitoring/src/test/java/org/onap/policy/apex/client/monitoring/rest/RestResourceTest.java +++ b/client/client-monitoring/src/test/java/org/onap/policy/apex/client/monitoring/rest/RestResourceTest.java @@ -1,19 +1,20 @@ /*- * ============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========================================================= */ @@ -21,7 +22,8 @@ package org.onap.policy.apex.client.monitoring.rest; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import javax.ws.rs.core.Response; @@ -46,7 +48,7 @@ public class RestResourceTest { /** * Set up mocking of the engine service facade. - * + * * @throws ApexException on engine service facade setup errors */ @Before @@ -228,30 +230,30 @@ public class RestResourceTest { ApexMonitoringRestResource.SlidingWindowList<String> slidingWindowList0 = restResource.new SlidingWindowList<>( 2); - assertFalse(slidingWindowList0.hashCode() == 0); - + assertNotEquals(0, slidingWindowList0.hashCode()); + assertTrue(slidingWindowList0.add("Hello")); assertTrue(slidingWindowList0.add("Hi")); assertTrue(slidingWindowList0.add("Howdy")); - - assertFalse(slidingWindowList0.equals(null)); - assertTrue(slidingWindowList0.equals(slidingWindowList0)); + + assertNotNull(slidingWindowList0); + assertEquals(slidingWindowList0, slidingWindowList0); ApexMonitoringRestResource.SlidingWindowList<String> slidingWindowList1 = restResource.new SlidingWindowList<>( 2); ApexMonitoringRestResource.SlidingWindowList<String> slidingWindowList2 = restResource.new SlidingWindowList<>( 2); - assertFalse(slidingWindowList0.equals(slidingWindowList1)); - assertFalse(slidingWindowList0.equals(slidingWindowList2)); - assertTrue(slidingWindowList1.equals(slidingWindowList2)); + assertNotEquals(slidingWindowList0, slidingWindowList1); + assertNotEquals(slidingWindowList0, slidingWindowList2); + assertEquals(slidingWindowList1, slidingWindowList2); ApexMonitoringRestResource.SlidingWindowList<String> slidingWindowList3 = restResource.new SlidingWindowList<>( 3); - assertFalse(slidingWindowList1.equals(slidingWindowList3)); + assertNotEquals(slidingWindowList1, slidingWindowList3); ApexMonitoringRestResource.SlidingWindowList<Integer> slidingWindowList4 = restResource.new SlidingWindowList<>( 3); assertTrue(slidingWindowList3.add("Hello")); assertTrue(slidingWindowList4.add(10)); - assertFalse(slidingWindowList3.equals(slidingWindowList4)); + assertNotEquals(slidingWindowList3, slidingWindowList4); } @Test diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java index ad165c3c5..51802919c 100644 --- a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java +++ b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java @@ -1,6 +1,7 @@ /*- * ============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. @@ -21,7 +22,7 @@ package org.onap.policy.apex.context.impl; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -337,20 +338,20 @@ public class ContextAlbumImplTest { distributor.init(axContextAlbum.getKey()); ContextAlbumImpl album = new ContextAlbumImpl(axContextAlbum, distributor, new LinkedHashMap<String, Object>()); - assertTrue(album.hashCode() != 0); + assertNotEquals(0, album.hashCode()); assertEquals(0, album.compareTo(album)); assertEquals(1, album.compareTo(null)); - assertTrue(album.equals(album)); - assertFalse(album.equals(new DummyContextAlbumImpl())); + assertEquals(album, album); + assertNotEquals(album, new DummyContextAlbumImpl()); ContextAlbumImpl otherAlbum = new ContextAlbumImpl(axContextAlbum, distributor, new LinkedHashMap<String, Object>()); - assertTrue(album.equals(otherAlbum)); + assertEquals(album, otherAlbum); otherAlbum.put("Key", 123); - assertFalse(album.equals(otherAlbum)); + assertNotEquals(album, otherAlbum); try { otherAlbum.put("Key", "BadValue"); @@ -366,7 +367,7 @@ public class ContextAlbumImplTest { otherAxContextAlbum.setItemSchema(simpleStringSchema.getKey()); otherAlbum = new ContextAlbumImpl(otherAxContextAlbum, distributor, new LinkedHashMap<String, Object>()); - assertFalse(album.equals(otherAlbum)); + assertNotEquals(album, otherAlbum); try { album.flush(); @@ -379,7 +380,7 @@ public class ContextAlbumImplTest { ModelService.registerModel(AxContextAlbums.class, albums); albums.getAlbumsMap().put(axContextAlbum.getKey(), axContextAlbum); distributor.createContextAlbum(album.getKey()); - + album.flush(); ModelService.clear(); diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/event/EnEventTest.java b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/event/EnEventTest.java index e3d0b32b8..225e1853f 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/event/EnEventTest.java +++ b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/event/EnEventTest.java @@ -1,19 +1,20 @@ /*- * ============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========================================================= */ @@ -21,7 +22,8 @@ package org.onap.policy.apex.core.engine.event; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -195,14 +197,14 @@ public class EnEventTest { event.clear(); assertNull(event.get("MyField")); - assertTrue(event.hashCode() != 0); + assertNotEquals(0, event.hashCode()); - assertTrue(event.equals(event)); - assertFalse(event.equals(null)); + assertEquals(event, event); + assertNotNull(event); Map<String, Object> hashMap = new HashMap<>(); - assertFalse(event.equals(hashMap)); + assertNotEquals(event, hashMap); EnEvent otherEvent = new EnEvent(eventKey); - assertTrue(event.equals(otherEvent)); + assertEquals(event, otherEvent); } } diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java index 233a1c2ac..925884534 100644 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java +++ b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java @@ -1,19 +1,20 @@ /*- * ============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========================================================= */ @@ -21,9 +22,8 @@ package org.onap.policy.apex.core.protocols; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import org.junit.Test; import org.onap.policy.apex.core.protocols.engdep.messages.StartEngine; @@ -58,44 +58,44 @@ public class SupportMessageTester { assertEquals(new AxArtifactKey("Target:0.0.1"), dummyMessage.getTarget()); assertEquals("Target", dummyMessage.getTargetName()); - assertTrue(dummyMessage.hashCode() != 0); + assertNotEquals(0, dummyMessage.hashCode()); dummyMessage.setMessageData(null); - assertTrue(dummyMessage.hashCode() != 0); + assertNotEquals(0, dummyMessage.hashCode()); dummyMessage = new DummyMessage(null, null, null); assertEquals(0, dummyMessage.hashCode()); - assertTrue(dummyMessage.equals(dummyMessage)); - assertFalse(dummyMessage.equals(null)); - assertFalse(dummyMessage.equals(new StartEngine(new AxArtifactKey()))); + assertEquals(dummyMessage, dummyMessage); + assertNotNull(dummyMessage); + assertNotEquals(dummyMessage, new StartEngine(new AxArtifactKey())); dummyMessage = new DummyMessage(new DummyAction(null), null, null); DummyMessage otherDummyMessage = new DummyMessage(null, null, null); - assertFalse(dummyMessage.equals(otherDummyMessage)); + assertNotEquals(dummyMessage, otherDummyMessage); otherDummyMessage = new DummyMessage(new DummyAction(null), null, null); - assertTrue(dummyMessage.equals(otherDummyMessage)); + assertEquals(dummyMessage, otherDummyMessage); dummyMessage = new DummyMessage(null, null, null); - assertFalse(dummyMessage.equals(otherDummyMessage)); + assertNotEquals(dummyMessage, otherDummyMessage); otherDummyMessage = new DummyMessage(null, null, null); - assertTrue(dummyMessage.equals(otherDummyMessage)); + assertEquals(dummyMessage, otherDummyMessage); dummyMessage = new DummyMessage(null, new AxArtifactKey(), null); otherDummyMessage = new DummyMessage(null, null, null); - assertFalse(dummyMessage.equals(otherDummyMessage)); + assertNotEquals(dummyMessage, otherDummyMessage); otherDummyMessage = new DummyMessage(null, new AxArtifactKey(), null); - assertTrue(dummyMessage.equals(otherDummyMessage)); + assertEquals(dummyMessage, otherDummyMessage); dummyMessage = new DummyMessage(null, null, null); - assertFalse(dummyMessage.equals(otherDummyMessage)); + assertNotEquals(dummyMessage, otherDummyMessage); otherDummyMessage = new DummyMessage(null, null, null); - assertTrue(dummyMessage.equals(otherDummyMessage)); + assertEquals(dummyMessage, otherDummyMessage); dummyMessage = new DummyMessage(null, null, "Message"); otherDummyMessage = new DummyMessage(null, null, null); - assertFalse(dummyMessage.equals(otherDummyMessage)); + assertNotEquals(dummyMessage, otherDummyMessage); otherDummyMessage = new DummyMessage(null, null, "Message"); - assertTrue(dummyMessage.equals(otherDummyMessage)); + assertEquals(dummyMessage, otherDummyMessage); dummyMessage = new DummyMessage(null, null, null); - assertFalse(dummyMessage.equals(otherDummyMessage)); + assertNotEquals(dummyMessage, otherDummyMessage); otherDummyMessage = new DummyMessage(null, null, null); - assertTrue(dummyMessage.equals(otherDummyMessage)); + assertEquals(dummyMessage, otherDummyMessage); } } diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/EngineServiceInfoResponseTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/EngineServiceInfoResponseTest.java index c240704e9..87fe44aae 100644 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/EngineServiceInfoResponseTest.java +++ b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/EngineServiceInfoResponseTest.java @@ -1,20 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 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. * 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,9 +22,8 @@ package org.onap.policy.apex.core.protocols.engdep.messages; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.List; @@ -40,72 +39,72 @@ public class EngineServiceInfoResponseTest { public void test() { AxArtifactKey targetKey = new AxArtifactKey("Target:0.0.1"); GetEngineServiceInfo request = new GetEngineServiceInfo(targetKey); - + EngineServiceInfoResponse response = new EngineServiceInfoResponse(targetKey, true, request); assertNotNull(response); response = new EngineServiceInfoResponse(targetKey, true, "Response Data", request); assertNotNull(response); assertEquals("Response Data", response.getMessageData()); - + AxArtifactKey apexModelKey = new AxArtifactKey("Model:0.0.1"); response.setApexModelKey(apexModelKey); assertEquals(apexModelKey, response.getApexModelKey()); - + AxArtifactKey engineServiceKey = new AxArtifactKey("EngineService:0.0.1"); response.setEngineServiceKey(engineServiceKey);; assertEquals(engineServiceKey, response.getEngineServiceKey()); - + List<AxArtifactKey> engineKeyArrayList = new ArrayList<>(); AxArtifactKey engineKey = new AxArtifactKey("Engine:0.0.1"); engineKeyArrayList.add(engineKey); response.setEngineKeyArray(engineKeyArrayList); assertEquals(engineKeyArrayList.get(0), response.getEngineKeyArray()[0]); - + response = new EngineServiceInfoResponse(null, false, null); - assertTrue(response.hashCode() != 0); + assertNotEquals(0, response.hashCode()); response.setApexModelKey(apexModelKey); - assertTrue(response.hashCode() != 0); + assertNotEquals(0, response.hashCode()); response.setApexModelKey(null); response.setEngineServiceKey(engineServiceKey);; - assertTrue(response.hashCode() != 0); + assertNotEquals(0, response.hashCode()); response.setEngineServiceKey(null); response.setEngineKeyArray(engineKeyArrayList); - assertTrue(response.hashCode() != 0); + assertNotEquals(0, response.hashCode()); response.setEngineKeyArray(null); - - assertTrue(response.equals(response)); - assertFalse(response.equals(null)); - assertFalse(response.equals((Object) new StartEngine(new AxArtifactKey()))); + + assertEquals(response, response); + assertNotNull(response); + assertNotEquals(response, (Object) new StartEngine(new AxArtifactKey())); response = new EngineServiceInfoResponse(null, false, null); EngineServiceInfoResponse otherResponse = new EngineServiceInfoResponse(null, false, null); response.setApexModelKey(apexModelKey); - assertFalse(response.equals(otherResponse)); + assertNotEquals(response, otherResponse); otherResponse.setApexModelKey(apexModelKey); - assertTrue(response.equals(otherResponse)); + assertEquals(response, otherResponse); response.setApexModelKey(null); - assertFalse(response.equals(otherResponse)); + assertNotEquals(response, otherResponse); otherResponse.setApexModelKey(null); - assertTrue(response.equals(otherResponse)); + assertEquals(response, otherResponse); response.setEngineServiceKey(engineServiceKey); - assertFalse(response.equals(otherResponse)); + assertNotEquals(response, otherResponse); otherResponse.setEngineServiceKey(engineServiceKey); - assertTrue(response.equals(otherResponse)); + assertEquals(response, otherResponse); response.setEngineServiceKey(null); - assertFalse(response.equals(otherResponse)); + assertNotEquals(response, otherResponse); otherResponse.setEngineServiceKey(null); - assertTrue(response.equals(otherResponse)); + assertEquals(response, otherResponse); response.setEngineKeyArray(engineKeyArrayList); - assertFalse(response.equals(otherResponse)); + assertNotEquals(response, otherResponse); otherResponse.setEngineKeyArray(engineKeyArrayList); - assertTrue(response.equals(otherResponse)); + assertEquals(response, otherResponse); response.setEngineKeyArray(null); - assertFalse(response.equals(otherResponse)); + assertNotEquals(response, otherResponse); otherResponse.setEngineKeyArray(null); - assertTrue(response.equals(otherResponse)); + assertEquals(response, otherResponse); } } diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/ResponseTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/ResponseTest.java index 2c1f658b3..b28993a41 100644 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/ResponseTest.java +++ b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/ResponseTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * 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. @@ -22,6 +23,8 @@ package org.onap.policy.apex.core.protocols.engdep.messages; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.net.UnknownHostException; @@ -63,32 +66,32 @@ public class ResponseTest { assertEquals(responseTo, message.getResponseTo()); message = new Response(null, false, null); - assertTrue(message.hashCode() != 0); + assertNotEquals(0, message.hashCode()); message = new Response(responseKey, false, null); - assertTrue(message.hashCode() != 0); + assertNotEquals(0, message.hashCode()); message = new Response(responseKey, true, null); - assertTrue(message.hashCode() != 0); + assertNotEquals(0, message.hashCode()); message = new Response(responseKey, true, new UpdateModel(null)); - assertTrue(message.hashCode() != 0); - - assertTrue(message.equals(message)); - assertFalse(message.equals(null)); - assertFalse(message.equals(new StartEngine(new AxArtifactKey()))); + assertNotEquals(0, message.hashCode()); + + assertEquals(message, message); + assertNotNull(message); + assertNotEquals(message, new StartEngine(new AxArtifactKey())); message = new Response(null, false, responseTo); Response otherMessage = new Response(null, false, null); - assertFalse(message.equals(otherMessage)); + assertNotEquals(message, otherMessage); otherMessage = new Response(null, false, responseTo); - assertTrue(message.equals(otherMessage)); + assertEquals(message, otherMessage); message = new Response(null, false, null); - assertFalse(message.equals(otherMessage)); + assertNotEquals(message, otherMessage); otherMessage = new Response(null, false, null); - assertTrue(message.equals(otherMessage)); - + assertEquals(message, (otherMessage)); + message = new Response(null, false, null); otherMessage = new Response(null, true, null); - assertFalse(message.equals(otherMessage)); + assertNotEquals(message, otherMessage); otherMessage = new Response(null, false, null); - assertTrue(message.equals(otherMessage)); + assertEquals(message, otherMessage); } } diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/UpdateModelTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/UpdateModelTest.java index 9f954b5a5..0839a43b8 100644 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/UpdateModelTest.java +++ b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/UpdateModelTest.java @@ -20,7 +20,9 @@ package org.onap.policy.apex.core.protocols.engdep.messages; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -57,30 +59,30 @@ public class UpdateModelTest { assertTrue((message.toString()).contains("Placeholder for Apex model XML")); assertFalse(message.isIgnoreConflicts()); assertFalse(message.isForceInstall()); - + message = new UpdateModel(null, null, false, false); - assertTrue(message.hashCode() != 0); + assertNotEquals(0, message.hashCode()); message = new UpdateModel(null, null, true, false); - assertTrue(message.hashCode() != 0); + assertNotEquals(0, message.hashCode()); message = new UpdateModel(null, null, true, true); - assertTrue(message.hashCode() != 0); + assertNotEquals(0, message.hashCode()); message = new UpdateModel(null, null, false, true); - assertTrue(message.hashCode() != 0); - - assertTrue(message.equals(message)); - assertFalse(message.equals(null)); - assertFalse(message.equals(new StartEngine(new AxArtifactKey()))); - + assertNotEquals(0, message.hashCode()); + + assertEquals(message, message); + assertNotNull(message); + assertNotEquals(message, new StartEngine(new AxArtifactKey())); + message = new UpdateModel(null, null, false, false); UpdateModel otherMessage = new UpdateModel(null, null, false, false); - assertTrue(message.equals(otherMessage)); + assertEquals(message, otherMessage); message = new UpdateModel(null, null, true, false); - assertFalse(message.equals(otherMessage)); + assertNotEquals(message, otherMessage); otherMessage = new UpdateModel(null, null, true, false); - assertTrue(message.equals(otherMessage)); + assertEquals(message, otherMessage); message = new UpdateModel(null, null, false, true); - assertFalse(message.equals(otherMessage)); + assertNotEquals(message, otherMessage); otherMessage = new UpdateModel(null, null, false, true); - assertTrue(message.equals(otherMessage)); + assertEquals(message, otherMessage); } } 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` |