diff options
author | liamfallon <liam.fallon@est.tech> | 2020-02-25 16:10:08 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2020-02-26 08:33:06 +0000 |
commit | 35840d835f581c2d61de1c57fe9963e36eb15c9f (patch) | |
tree | 10b8a6004cad1b4d1d63ebebe2aa26ae2af7f3e4 /testsuites/integration/integration-context-test/src/test/java/org/onap | |
parent | aacc7442f046d44359934ea3d93f425a809e7616 (diff) |
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 <liam.fallon@est.tech>
Diffstat (limited to 'testsuites/integration/integration-context-test/src/test/java/org/onap')
-rw-r--r-- | testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java | 64 |
1 files changed, 31 insertions, 33 deletions
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) { |