From 35840d835f581c2d61de1c57fe9963e36eb15c9f Mon Sep 17 00:00:00 2001 From: liamfallon Date: Tue, 25 Feb 2020 16:10:08 +0000 Subject: Fix Java 11/Checkstyle/Sonar warnings A number of Java 11, checkstyle, and SONAR warnings have crept into the Apex codebase over the last number of reviews. This change fixes those issues. Issue-ID: POLICY-1913 Change-Id: I2afd607e80f48323355380fb2fe5e048e18879f9 Signed-off-by: liamfallon --- .../integration/executor/engine/TestApexEngine.java | 11 +++++------ .../integration/executor/event/TestEventInstantiation.java | 14 +++++++------- .../executor/handling/TestContextUpdateModel.java | 6 +++--- 3 files changed, 15 insertions(+), 16 deletions(-) (limited to 'testsuites/integration/integration-executor-test/src') diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngine.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngine.java index 003f04f7c..01107e968 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngine.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngine.java @@ -1,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. @@ -49,14 +49,13 @@ public class TestApexEngine { /** * Instantiates a new test apex engine. * - * @param axLogicExecutorType the type of logic executor to use to construct the sample policy - * model for this test + * @param axLogicExecutorType the type of logic executor to use to construct the sample policy model for this test * @throws ApexException the apex exception * @throws InterruptedException the interrupted exception * @throws IOException Signals that an I/O exception has occurred. */ - public TestApexEngine(final String axLogicExecutorType, final EngineParameters parameters) - throws ApexException, InterruptedException, IOException { + public TestApexEngine(final String axLogicExecutorType, + final EngineParameters parameters) throws ApexException, InterruptedException, IOException { logger.debug("Running TestApexEngine test for + " + axLogicExecutorType + "logic . . ."); final AxPolicyModel apexPolicyModel = new SampleDomainModelFactory().getSamplePolicyModel(axLogicExecutorType); @@ -75,7 +74,7 @@ public class TestApexEngine { final Date aDate = new Date(1433453067123L); final Map eventDataMap = new HashMap(); eventDataMap.put("TestSlogan", "This is a test slogan for event " + event.getName()); - eventDataMap.put("TestMatchCase", new Byte((byte) 123)); + eventDataMap.put("TestMatchCase", (byte) 123); eventDataMap.put("TestTimestamp", aDate.getTime()); eventDataMap.put("TestTemperature", 34.5445667); diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java index fb5894656..7522abe0a 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java @@ -1,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. @@ -137,13 +137,13 @@ public class TestEventInstantiation { assertNotNull(slogan1); assertEquals("This is a slogan", slogan1); - Object mc1 = event.put("TestMatchCase", new Byte("4")); + Object mc1 = event.put("TestMatchCase", Byte.valueOf("4")); assertNull(mc1); mc1 = event.get("TestMatchCase"); assertNotNull(mc1); assertEquals((byte) 4, mc1); - Object mc2 = event.put("TestMatchCase", new Byte("16")); + Object mc2 = event.put("TestMatchCase", Byte.valueOf("16")); assertNotNull(mc2); assertEquals((byte) 4, mc2); mc2 = event.get("TestMatchCase"); @@ -173,17 +173,17 @@ public class TestEventInstantiation { event.put("TestMatchCase", "Hello"); } catch (final Exception e) { assertEquals("Event0000:0.0.1:NULL:TestMatchCase: object \"Hello\" of class \"java.lang.String\" " - + "not compatible with class \"java.lang.Byte\"", e.getMessage()); + + "not compatible with class \"java.lang.Byte\"", e.getMessage()); } try { event.put("TestMatchCase", 123.45); } catch (final Exception e) { assertEquals("Event0000:0.0.1:NULL:TestMatchCase: object \"123.45\" of class \"java.lang.Double\" " - + "not compatible with class \"java.lang.Byte\"", e.getMessage()); + + "not compatible with class \"java.lang.Byte\"", e.getMessage()); } - event.put("TestMatchCase", new Byte("16")); + event.put("TestMatchCase", Byte.valueOf("16")); final String slogan2 = (String) event.get("TestSlogan"); assertNotNull(slogan2); @@ -212,7 +212,7 @@ public class TestEventInstantiation { final Date aDate = new Date(1433453067123L); final Map eventDataList = new HashMap(); eventDataList.put("TestSlogan", "This is a test slogan"); - eventDataList.put("TestMatchCase", new Byte("123")); + eventDataList.put("TestMatchCase", Byte.valueOf("123")); eventDataList.put("TestTimestamp", aDate.getTime()); eventDataList.put("TestTemperature", 34.5445667); diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateModel.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateModel.java index 94bf0c8b8..1d33d3f21 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateModel.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateModel.java @@ -1,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. @@ -184,11 +184,11 @@ public class TestContextUpdateModel { * @throws ContextException the context exception */ private void sendEvent(final ApexEngine apexEngine, final TestApexActionListener listener, final String eventName, - final boolean shouldWork) throws ContextException { + final boolean shouldWork) throws ContextException { final Date aDate = new Date(1433453067123L); final Map eventDataMap = new HashMap(); eventDataMap.put("TestSlogan", "This is a test slogan"); - eventDataMap.put("TestMatchCase", new Byte((byte) 123)); + eventDataMap.put("TestMatchCase", (byte) 123); eventDataMap.put("TestTimestamp", aDate.getTime()); eventDataMap.put("TestTemperature", 34.5445667); -- cgit 1.2.3-korg