diff options
author | Jim Hahn <jrh3@att.com> | 2020-02-26 14:23:16 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-02-26 14:23:16 +0000 |
commit | d1a3d4f7fc8f754937f10e320389825316662b2d (patch) | |
tree | ad5d84906c59bb7f54ea9b4f685b07a2fdc31fa4 /testsuites/integration | |
parent | e1735a6044b9a0b5ec8e3afede88744a7d57782a (diff) | |
parent | 35840d835f581c2d61de1c57fe9963e36eb15c9f (diff) |
Merge "Fix Java 11/Checkstyle/Sonar warnings"
Diffstat (limited to 'testsuites/integration')
11 files changed, 108 insertions, 107 deletions
diff --git a/testsuites/integration/integration-common/pom.xml b/testsuites/integration/integration-common/pom.xml index 942c5f267..85c4fcdf5 100644 --- a/testsuites/integration/integration-common/pom.xml +++ b/testsuites/integration/integration-common/pom.xml @@ -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 @@ <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId> - <artifactId>integration</artifactId> + <artifactId>apex-integration</artifactId> <version>2.3.0-SNAPSHOT</version> </parent> <artifactId>integration-common</artifactId> diff --git a/testsuites/integration/integration-context-test/pom.xml b/testsuites/integration/integration-context-test/pom.xml index 51787a0a2..3ea18519e 100644 --- a/testsuites/integration/integration-context-test/pom.xml +++ b/testsuites/integration/integration-context-test/pom.xml @@ -1,7 +1,7 @@ <!-- ============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. @@ -24,7 +24,7 @@ <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId> - <artifactId>integration</artifactId> + <artifactId>apex-integration</artifactId> <version>2.3.0-SNAPSHOT</version> </parent> @@ -94,4 +94,4 @@ </distributionManagement> </profile> </profiles> -</project>
\ No newline at end of file +</project> 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 a29dcbcf8..e954fe862 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 @@ -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. @@ -104,7 +104,7 @@ public class ContextInstantiation { private static final String TEST_POLICY_CONTEXT_ITEM001 = "TestPolicyContextItem001"; private static final String NORMAL_TEST_EXCEPTION = "normal test exception"; private static final String NULL_VALUES_ILLEGAL_TAG = - "album \"ExternalContextAlbum:0.0.1\" null values are illegal on key "; + "album \"ExternalContextAlbum:0.0.1\" null values are illegal on key "; private static final TreeSet<String> TEST_TREE_SET = new TreeSet<>(); private static final Map<String, String> TEST_HASH_MAP = new HashMap<>(); @@ -134,8 +134,8 @@ public class ContextInstantiation { final Distributor contextDistributor = getDistributor(); - final ContextAlbum policyContextAlbum = contextDistributor - .createContextAlbum(new AxArtifactKey(POLICY_CONTEXT_ALBUM, VERSION)); + final ContextAlbum policyContextAlbum = + contextDistributor.createContextAlbum(new AxArtifactKey(POLICY_CONTEXT_ALBUM, VERSION)); assertNotNull(policyContextAlbum); policyContextAlbum.setUserArtifactStack(Constants.getAxArtifactKeyArray()); @@ -152,8 +152,8 @@ public class ContextInstantiation { policyContextAlbum.putAll(valueMap0); - final TestPolicyContextItem contextItem = (TestPolicyContextItem) policyContextAlbum - .get(TEST_POLICY_CONTEXT_ITEM); + final TestPolicyContextItem contextItem = + (TestPolicyContextItem) policyContextAlbum.get(TEST_POLICY_CONTEXT_ITEM); assertEquals(STRING_VAL, contextItem.getTestPolicyContextItem000().getStringValue()); assertEquals(LONG_VAL, contextItem.getTestPolicyContextItem001().getLongValue()); @@ -162,8 +162,7 @@ public class ContextInstantiation { assertEquals(contextItem.getTestPolicyContextItem004().getLongValue(), testDate.getTime()); assertEquals(TEST_HASH_MAP, contextItem.getTestPolicyContextItem005().getMapValue()); - final TestGlobalContextItem globalContext = getTestGlobalContextItem(contextDistributor, testDate, tci9, - tciA); + final TestGlobalContextItem globalContext = getTestGlobalContextItem(contextDistributor, testDate, tci9, tciA); final Map<String, Object> valueMap1 = new HashMap<>(); valueMap1.put(GLOBAL_CONTEXT_KEY, globalContext); @@ -172,8 +171,8 @@ public class ContextInstantiation { globalContextAlbum.putAll(valueMap1); - final TestGlobalContextItem globalContextItem = (TestGlobalContextItem) globalContextAlbum - .get(GLOBAL_CONTEXT_KEY); + final TestGlobalContextItem globalContextItem = + (TestGlobalContextItem) globalContextAlbum.get(GLOBAL_CONTEXT_KEY); assertFalse(globalContextItem.getTestGlobalContextItem000().getFlag()); @@ -189,10 +188,10 @@ public class ContextInstantiation { assertEquals((Long) testDate.getTime(), globalContextItem.getTestGlobalContextItem007().getLongValue()); assertEquals(testDate, globalContextItem.getTestGlobalContextItem008().getDateValue()); assertEquals(tci9.getDateValue().getTime(), - globalContextItem.getTestGlobalContextItem009().getDateValue().getTime()); + globalContextItem.getTestGlobalContextItem009().getDateValue().getTime()); assertEquals(tciA.getDateValue().getTime(), - globalContextItem.getTestGlobalContextItem00A().getDateValue().getTime()); + globalContextItem.getTestGlobalContextItem00A().getDateValue().getTime()); assertEquals(TEST_TREE_SET, globalContextItem.getTestGlobalContextItem00B().getSetValue()); assertEquals(TEST_HASH_MAP, globalContextItem.getTestGlobalContextItem00C().getMapValue()); @@ -218,8 +217,8 @@ public class ContextInstantiation { externalContextAlbum.putAll(valueMap2); externalContextAlbum.getAlbumDefinition().setWritable(false); - TestExternalContextItem externalContextItem = (TestExternalContextItem) externalContextAlbum - .get(EXTERNAL_CONTEXT); + TestExternalContextItem externalContextItem = + (TestExternalContextItem) externalContextAlbum.get(EXTERNAL_CONTEXT); assertFalse(externalContextItem.getTestExternalContextItem000().getFlag()); assertEquals(BYTE_VAL, externalContextItem.getTestExternalContextItem001().getByteValue()); @@ -233,10 +232,10 @@ public class ContextInstantiation { assertEquals((Long) testDate.getTime(), externalContextItem.getTestExternalContextItem007().getLongValue()); assertEquals(testDate, externalContextItem.getTestExternalContextItem008().getDateValue()); assertEquals(tci9A.getDateValue().getTime(), - externalContextItem.getTestExternalContextItem009().getDateValue().getTime()); + externalContextItem.getTestExternalContextItem009().getDateValue().getTime()); assertEquals(tciAa.getDateValue().getTime(), - externalContextItem.getTestExternalContextItem00A().getDateValue().getTime()); + externalContextItem.getTestExternalContextItem00A().getDateValue().getTime()); assertEquals(TEST_TREE_SET, externalContextItem.getTestExternalContextItem00B().getSetValue()); assertEquals(TEST_HASH_MAP, externalContextItem.getTestExternalContextItem00C().getMapValue()); @@ -249,7 +248,7 @@ public class ContextInstantiation { fail(EXCEPTION_MESSAGE); } catch (final ContextRuntimeException e) { assertEquals("album \"ExternalContextAlbum:0.0.1\" clear() not allowed on read only albums", - e.getMessage()); + e.getMessage()); LOGGER.trace(NORMAL_TEST_EXCEPTION, e); } @@ -264,7 +263,7 @@ public class ContextInstantiation { externalContextAlbum.get(null); } catch (final ContextRuntimeException e) { assertEquals("album \"ExternalContextAlbum:0.0.1\" null keys are illegal on keys for get()", - e.getMessage()); + e.getMessage()); LOGGER.trace(NORMAL_TEST_EXCEPTION, e); } @@ -276,7 +275,7 @@ public class ContextInstantiation { externalContextAlbum.put(null, null); } catch (final ContextRuntimeException e) { assertEquals("album \"ExternalContextAlbum:0.0.1\" null keys are illegal on keys for put()", - e.getMessage()); + e.getMessage()); LOGGER.trace(NORMAL_TEST_EXCEPTION, e); } @@ -342,7 +341,7 @@ public class ContextInstantiation { } private void assertContextAlbumContains(final TestExternalContextItem externalContext, - final ContextAlbum externalContextAlbum) { + final ContextAlbum externalContextAlbum) { try { externalContextAlbum.containsKey(null); } catch (final ContextRuntimeException e) { @@ -365,15 +364,15 @@ public class ContextInstantiation { } private ContextAlbum getContextAlbum(final Distributor contextDistributor) throws ContextException { - final ContextAlbum globalContextAlbum = contextDistributor - .createContextAlbum(new AxArtifactKey(GLOBAL_CONTEXT_ALBUM, VERSION)); + final ContextAlbum globalContextAlbum = + contextDistributor.createContextAlbum(new AxArtifactKey(GLOBAL_CONTEXT_ALBUM, VERSION)); assertNotNull(globalContextAlbum); globalContextAlbum.setUserArtifactStack(Constants.getAxArtifactKeyArray()); return globalContextAlbum; } private TestGlobalContextItem getTestGlobalContextItem(final Distributor contextDistributor, final Date testDate, - final TestContextDateTzItem tci9, final TestContextDateLocaleItem tciA) throws ContextException { + final TestContextDateTzItem tci9, final TestContextDateLocaleItem tciA) throws ContextException { final AxContextModel globalContextModel = TestContextAlbumFactory.createGlobalContextModel(); final TestGlobalContextItem globalContext = getTestGlobalContextItem(testDate, tci9, tciA); contextDistributor.registerModel(globalContextModel); @@ -381,7 +380,7 @@ public class ContextInstantiation { } private TestGlobalContextItem getTestGlobalContextItem(final Date testDate, final TestContextDateTzItem tci9, - final TestContextDateLocaleItem tciA) { + final TestContextDateLocaleItem tciA) { final TestGlobalContextItem globalContext = new TestGlobalContextItem(); final TestContextBooleanItem testGlobalContextItem000 = new TestContextBooleanItem(false); @@ -445,14 +444,13 @@ public class ContextInstantiation { } private void assertPutMethods(final ContextAlbum policyContextAlbum, final TestContextStringItem contextStringItem, - final Map<String, Object> valueMapA) { + 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()); + TestContextStringItem.class.getName(), "stringValue=" + STRING_VAL), e.getMessage()); LOGGER.trace(NORMAL_TEST_EXCEPTION, e); } @@ -461,7 +459,7 @@ public class ContextInstantiation { fail(EXCEPTION_MESSAGE); } catch (final ContextRuntimeException e) { assertEquals(getMessage(TEST_POLICY_CONTEXT_ITEM001, "TestContextItem003", - TestContextLongItem.class.getName(), "longValue=" + INT_VAL_3), e.getMessage()); + TestContextLongItem.class.getName(), "longValue=" + INT_VAL_3), e.getMessage()); LOGGER.trace(NORMAL_TEST_EXCEPTION, e); } } @@ -495,14 +493,14 @@ public class ContextInstantiation { } private TestExternalContextItem getTestExternalContextItem(final Date testDate, final TestContextDateTzItem tci9A, - final TestContextDateLocaleItem tciAa) { + final TestContextDateLocaleItem tciAa) { final TestExternalContextItem externalContext = new TestExternalContextItem(); final TestContextBooleanItem testExternalContextItem000 = new TestContextBooleanItem(false); final TestContextByteItem testExternalContextItem001 = new TestContextByteItem(BYTE_VAL); final TestContextIntItem testExternalContextItem002 = new TestContextIntItem(INT_VAL); final TestContextLongItem testExternalContextItem003 = new TestContextLongItem(LONG_VAL); - final TestContextFloatItem testExternalContextItem004 = new TestContextFloatItem(new Float(3.14159265359)); + final TestContextFloatItem testExternalContextItem004 = new TestContextFloatItem(3.14159265359F); final TestContextDoubleItem testExternalContextItem005 = new TestContextDoubleItem(PI_VAL); final TestContextStringItem testExternalContextItem006 = new TestContextStringItem(STRING_EXT_VAL); final TestContextLongObjectItem testExternalContextItem007 = new TestContextLongObjectItem(testDate.getTime()); @@ -531,10 +529,10 @@ public class ContextInstantiation { } private String getMessage(final String key, final String objName, final String clazzName, final String valString, - final String compatibleClazzName) { + final String compatibleClazzName) { return "Failed to set context value for key \"" + key + "\" in album \"PolicyContextAlbum:0.0.1\": " - + "PolicyContextAlbum:0.0.1: object \"" + objName + " [" + valString + "]\" " + "of class \"" - + clazzName + "\"" + " not compatible with class \"" + compatibleClazzName + "\""; + + "PolicyContextAlbum:0.0.1: object \"" + objName + " [" + valString + "]\" " + "of class \"" + + clazzName + "\"" + " not compatible with class \"" + compatibleClazzName + "\""; } private void assertFloat(final float actual, final float expected) { diff --git a/testsuites/integration/integration-executor-test/pom.xml b/testsuites/integration/integration-executor-test/pom.xml index d6ef942b8..fdb98252e 100644 --- a/testsuites/integration/integration-executor-test/pom.xml +++ b/testsuites/integration/integration-executor-test/pom.xml @@ -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. @@ -22,7 +23,7 @@ <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId> - <artifactId>integration</artifactId> + <artifactId>apex-integration</artifactId> <version>2.3.0-SNAPSHOT</version> </parent> @@ -96,4 +97,4 @@ </distributionManagement> </profile> </profiles> -</project>
\ No newline at end of file +</project> 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<String, Object> eventDataMap = new HashMap<String, Object>(); 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<String, Object> eventDataList = new HashMap<String, Object>(); 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<String, Object> eventDataMap = new HashMap<String, Object>(); 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); diff --git a/testsuites/integration/integration-uservice-test/pom.xml b/testsuites/integration/integration-uservice-test/pom.xml index bfcfc4294..6de0f0cef 100644 --- a/testsuites/integration/integration-uservice-test/pom.xml +++ b/testsuites/integration/integration-uservice-test/pom.xml @@ -1,7 +1,7 @@ <!-- ============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. @@ -24,7 +24,7 @@ <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId> - <artifactId>integration</artifactId> + <artifactId>apex-integration</artifactId> <version>2.3.0-SNAPSHOT</version> </parent> diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngineTestServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngineTestServer.java index 585787c28..103704df2 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngineTestServer.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngineTestServer.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========================================================= */ @@ -200,10 +201,10 @@ public class EngineTestServer implements Runnable, EngineServiceEventInterface { } /** - * The listener interface for receiving testApex events. The class that is interested in - * processing a testApex event implements this interface, and the object created with that class - * is registered with a component using the component's {@code addTestApexListener} method. When - * the testApex event occurs, that object's appropriate method is invoked. + * The listener interface for receiving testApex events. The class that is interested in processing a testApex event + * implements this interface, and the object created with that class is registered with a component using the + * component's {@code addTestApexListener} method. When the testApex event occurs, that object's appropriate method + * is invoked. * * <p>This class listens for events from the Apex engine * @@ -245,7 +246,7 @@ public class EngineTestServer implements Runnable, EngineServiceEventInterface { // CHECKSTYLE:OFF: checkstyle:magicNumber assert result.get("TestSlogan").equals("This is a test slogan"); - assert result.get("TestMatchCase").equals(new Byte((byte) 123)); + assert result.get("TestMatchCase").equals((byte) 123); assert result.get("TestTemperature").equals(34.5445667); assert ((byte) result.get("TestMatchCaseSelected") >= 0 && (byte) result.get("TestMatchCaseSelected") <= 3); assert ((byte) result.get("TestEstablishCaseSelected") >= 0 diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java index 3ea4bde84..3a15b3906 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java @@ -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========================================================= */ @@ -165,7 +166,7 @@ public class ApexServiceModelUpdateTest { } catch (final Exception e) { e.printStackTrace(); assertEquals("start()<-Machine-1_process-1_engine-1-0:0.0.0,STOPPED, cannot start engine, " - + "engine has not been initialized, its model is not loaded", e.getMessage()); + + "engine has not been initialized, its model is not loaded", e.getMessage()); } } @@ -233,8 +234,8 @@ public class ApexServiceModelUpdateTest { } catch (final Exception e) { System.err.println(e.getMessage()); assertEquals("apex model update failed, supplied model with key \"INCOMPATIBLE:0.0.1\" is not a compatible " - + "model update from the existing engine model " - + "with key \"SamplePolicyModelJAVASCRIPT:0.0.1\"", e.getMessage()); + + "model update from the existing engine model " + "with key \"SamplePolicyModelJAVASCRIPT:0.0.1\"", + e.getMessage()); } // Still on old model @@ -251,8 +252,8 @@ public class ApexServiceModelUpdateTest { System.err.println(e.getMessage()); e.printStackTrace(); assertEquals("apex model update failed, supplied model with key \"SamplePolicyModelJAVASCRIPT:1.0.1\" " - + "is not a compatible model update from the existing engine model with key " - + "\"SamplePolicyModelJAVASCRIPT:0.0.1\"", e.getMessage()); + + "is not a compatible model update from the existing engine model with key " + + "\"SamplePolicyModelJAVASCRIPT:0.0.1\"", e.getMessage()); } // Still on old model @@ -323,7 +324,7 @@ public class ApexServiceModelUpdateTest { /** * Utility method to send some events into the test engine. - * + * * @throws ApexEventException if there is an error */ private void sendEvents() throws ApexEventException { @@ -337,13 +338,13 @@ public class ApexServiceModelUpdateTest { eventDataMap.put("TestTimestamp", testStartTime.getTime()); eventDataMap.put("TestTemperature", 34.5445667); - final ApexEvent event = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", - "test", "apex"); + final ApexEvent event = + new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex"); event.putAll(eventDataMap); engineServiceEventInterface.sendEvent(event); - final ApexEvent event2 = new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", - "test", "apex"); + final ApexEvent event2 = + new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex"); event2.putAll(eventDataMap); engineServiceEventInterface.sendEvent(event2); @@ -388,19 +389,18 @@ public class ApexServiceModelUpdateTest { assertTrue(result.getName().startsWith("Event0004") || result.getName().startsWith("Event0104")); assertTrue(result.get("TestSlogan").equals("This is a test slogan")); - assertTrue(result.get("TestMatchCase").equals(new Byte((byte) 123))); + assertTrue(result.get("TestMatchCase").equals((byte) 123)); assertTrue(result.get("TestTemperature").equals(34.5445667)); assertTrue(((byte) result.get("TestMatchCaseSelected")) >= 0 - && ((byte) result.get("TestMatchCaseSelected") <= 3)); + && ((byte) result.get("TestMatchCaseSelected") <= 3)); assertTrue(((byte) result.get("TestEstablishCaseSelected")) >= 0 - && ((byte) result.get("TestEstablishCaseSelected") <= 3)); + && ((byte) result.get("TestEstablishCaseSelected") <= 3)); assertTrue(((byte) result.get("TestDecideCaseSelected")) >= 0 - && ((byte) result.get("TestDecideCaseSelected") <= 3)); - assertTrue(((byte) result.get("TestActCaseSelected")) >= 0 - && ((byte) result.get("TestActCaseSelected") <= 3)); + && ((byte) result.get("TestDecideCaseSelected") <= 3)); + assertTrue( + ((byte) result.get("TestActCaseSelected")) >= 0 && ((byte) result.get("TestActCaseSelected") <= 3)); } } - /** * Gets the model string. diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java index 2377cfb91..052f6a2af 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java @@ -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. @@ -176,14 +177,14 @@ public class ApexServiceTest { eventDataMap.put("TestTimestamp", testStartTime.getTime()); eventDataMap.put("TestTemperature", 34.5445667); - final ApexEvent event = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", - "test", "apex"); + final ApexEvent event = + new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex"); event.setExecutionId(System.nanoTime()); event.putAll(eventDataMap); engineServiceEventInterface.sendEvent(event); - final ApexEvent event2 = new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", - "test", "apex"); + final ApexEvent event2 = + new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex"); event2.setExecutionId(System.nanoTime()); event2.putAll(eventDataMap); engineServiceEventInterface.sendEvent(event2); @@ -236,8 +237,8 @@ public class ApexServiceTest { eventDataMap.put("TestTimestamp", testStartTime.getTime()); eventDataMap.put("TestTemperature", 34.5445667); - final ApexEvent event1 = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", - "test", "apex"); + final ApexEvent event1 = + new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex"); event1.putAll(eventDataMap); event1.setExecutionId(System.nanoTime()); @@ -258,8 +259,8 @@ public class ApexServiceTest { ThreadUtilities.sleep(100); } - final ApexEvent event2 = new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", - "test", "apex"); + final ApexEvent event2 = + new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex"); event2.setExecutionId(System.nanoTime()); event2.putAll(eventDataMap); @@ -326,14 +327,14 @@ public class ApexServiceTest { eventDataMap.put("TestTimestamp", testStartTime.getTime()); eventDataMap.put("TestTemperature", 34.5445667); - final ApexEvent event = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", - "test", "apex"); + final ApexEvent event = + new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex"); event.setExecutionId(System.nanoTime()); event.putAll(eventDataMap); engineServiceEventInterface.sendEvent(event); - final ApexEvent event2 = new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", - "test", "apex"); + final ApexEvent event2 = + new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex"); event2.setExecutionId(System.nanoTime()); event2.putAll(eventDataMap); engineServiceEventInterface.sendEvent(event2); @@ -386,8 +387,8 @@ public class ApexServiceTest { eventDataMap.put("TestTimestamp", testStartTime.getTime()); eventDataMap.put("TestTemperature", 34.5445667); - final ApexEvent event1 = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", - "test", "apex"); + final ApexEvent event1 = + new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex"); event1.putAll(eventDataMap); final ApexEventListener myEventListener1 = new ApexEventListener() { @@ -407,8 +408,8 @@ public class ApexServiceTest { ThreadUtilities.sleep(100); } - final ApexEvent event2 = new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", - "test", "apex"); + final ApexEvent event2 = + new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex"); event2.putAll(eventDataMap); final ApexEventListener myEventListener2 = new ApexEventListener() { @@ -499,16 +500,16 @@ public class ApexServiceTest { assertTrue(result.getName().startsWith("Event0004") || result.getName().startsWith("Event0104")); assertTrue(result.get("TestSlogan").equals("This is a test slogan")); - assertTrue(result.get("TestMatchCase").equals(new Byte((byte) 123))); + assertTrue(result.get("TestMatchCase").equals((byte) 123)); assertTrue(result.get("TestTemperature").equals(34.5445667)); assertTrue(((byte) result.get("TestMatchCaseSelected")) >= 0 - && ((byte) result.get("TestMatchCaseSelected") <= 3)); + && ((byte) result.get("TestMatchCaseSelected") <= 3)); assertTrue(((byte) result.get("TestEstablishCaseSelected")) >= 0 - && ((byte) result.get("TestEstablishCaseSelected") <= 3)); + && ((byte) result.get("TestEstablishCaseSelected") <= 3)); assertTrue(((byte) result.get("TestDecideCaseSelected")) >= 0 - && ((byte) result.get("TestDecideCaseSelected") <= 3)); - assertTrue(((byte) result.get("TestActCaseSelected")) >= 0 - && ((byte) result.get("TestActCaseSelected") <= 3)); + && ((byte) result.get("TestDecideCaseSelected") <= 3)); + assertTrue( + ((byte) result.get("TestActCaseSelected")) >= 0 && ((byte) result.get("TestActCaseSelected") <= 3)); } } |