Fixing various Sonar issues in apex.
Issue-ID: POLICY-1034
Change-Id: Ie693637d75bd7e38c71b7ba04886fb75636276ed
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
*/
public class ApexDeploymentRestParameterParser {
// Apache Commons CLI options
- Options options;
+ private Options options;
/**
* Construct the options for the CLI RESTful services.
}
ParameterCheck.StartStop startStop;
- if (startStopValue[0].equalsIgnoreCase("start")) {
+ if ("start".equalsIgnoreCase(startStopValue[0])) {
startStop = ParameterCheck.StartStop.START;
- } else if (startStopValue[0].equalsIgnoreCase("stop")) {
+ } else if ("stop".equalsIgnoreCase(startStopValue[0])) {
startStop = ParameterCheck.StartStop.STOP;
} else {
LOGGER.warn("value \"{}\"of parameter \"{}\" not \"start\" or \"stop\"", startStopValue[0], startStopPar);
// Output and error streams for messages
private final PrintStream outStream;
- /**
- * Main method, main entry point for command.
- *
- * @param args The command line arguments for the editor
- */
- public static void main(final String[] args) {
- try {
- final ApexEditorMain editorMain = new ApexEditorMain(args, System.out);
- editorMain.init();
- } catch (final Exception e) {
- LOGGER.error("start failed", e);
- }
- }
-
/**
* Constructor, kicks off the editor.
*
}
}
}
+
+ /**
+ * Main method, main entry point for command.
+ *
+ * @param args The command line arguments for the editor
+ */
+ public static void main(final String[] args) {
+ try {
+ final ApexEditorMain editorMain = new ApexEditorMain(args, System.out);
+ editorMain.init();
+ } catch (final Exception e) {
+ LOGGER.error("start failed", e);
+ }
+ }
}
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
String version1 = version;
LOGGER.entry(name1, version1);
try {
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
String version1 = version;
LOGGER.entry(name1, version1);
try {
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
final BeanEvent jsonbean = RestUtils.getJsonParameters(jsonString, BeanEvent.class);
- if (jsonbean.getName() == null || jsonbean.getName().equals("") || jsonbean.getVersion() == null
- || jsonbean.getVersion().equals("")) {
+ if (jsonbean.getName() == null || "".equals(jsonbean.getName()) || jsonbean.getVersion() == null
+ || "".equals(jsonbean.getVersion())) {
ret = new ApexApiResult(Result.FAILED, "Null/Empty event name/version (\"" + jsonbean.getName() + ":"
+ jsonbean.getVersion() + "\" passed to UpdateEvent");
return ret;
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
String version1 = version;
LOGGER.entry(name1, version1);
try {
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
final BeanTask jsonbean = RestUtils.getJsonParameters(jsonString, BeanTask.class);
- if (jsonbean.getName() == null || jsonbean.getName().equals("") || jsonbean.getVersion() == null
- || jsonbean.getVersion().equals("")) {
+ if (jsonbean.getName() == null || "".equals(jsonbean.getName()) || jsonbean.getVersion() == null
+ || "".equals(jsonbean.getVersion())) {
ret = new ApexApiResult(Result.FAILED, "Null/Empty task name/version (\"" + jsonbean.getName() + ":"
+ jsonbean.getVersion() + "\" passed to UpdateTask");
return ret;
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
final BeanPolicy jsonbean = RestUtils.getJsonParameters(jsonString, BeanPolicy.class);
- if (jsonbean.getName() == null || jsonbean.getName().equals("") || jsonbean.getVersion() == null
- || jsonbean.getVersion().equals("")) {
+ if (jsonbean.getName() == null || "".equals(jsonbean.getName()) || jsonbean.getVersion() == null
+ || "".equals(jsonbean.getVersion())) {
ret = new ApexApiResult(Result.FAILED, "Null/Empty Policy name/version (\"" + jsonbean.getName() + ":"
+ jsonbean.getVersion() + "\" passed to UpdatePolicy");
return ret;
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public abstract class RestUtils {
+ // Regular expressions for checking input types
+ private static final String XML_INPUT_TYPE_REGEXP = "^\\s*<\\?xml.*>\\s*"; //starts with <?xml...>
+ /**
+ * starts with some kind of bracket [ or ( or {, then has something, then has bracket.
+ */
+ private static final String JSON_INPUT_TYPE_REGEXP = "^\\s*[\\(\\{\\[][\\s+\\S]*[\\)\\}\\]]";
/**
* Constructor, block inheritance.
}
if (val.isJsonPrimitive() && ((JsonPrimitive) val).isString()) {
final String v = ((JsonPrimitive) val).getAsString();
- if (v == null || v.equals("")) {
+ if (v == null || "".equals(v)) {
return JsonNull.INSTANCE;
}
}
return gb.create().fromJson(jsonObject, clz);
}
- // Regular expressions for checking input types
- private static final String XML_INPUT_TYPE_REGEXP = "^\\s*<\\?xml.*>\\s*"; //starts with <?xml...>
- /**
- * starts with some kind of bracket [ or ( or {, then has something, then has bracket.
- */
- private static final String JSON_INPUT_TYPE_REGEXP = "^\\s*[\\(\\{\\[][\\s+\\S]*[\\)\\}\\]]";
-
/**
* Gets the concept from JSON.
*
*/
public class ApexServicesRestParameterParser {
// Apache Commons CLI options
- Options options;
+ private Options options;
/**
* Construct the options for the CLI RESTful services.
}
ParameterCheck.StartStop startStop;
- if (startStopValue[0].equalsIgnoreCase("start")) {
+ if ("start".equalsIgnoreCase(startStopValue[0])) {
startStop = ParameterCheck.StartStop.START;
- } else if (startStopValue[0].equalsIgnoreCase("stop")) {
+ } else if ("stop".equalsIgnoreCase(startStopValue[0])) {
startStop = ParameterCheck.StartStop.STOP;
} else {
LOGGER.warn("value \"{}\" of parameter \"{}\" not \"start\" or \"stop\"", startStopValue[0], startStopPar);
*/
public class ApexMonitoringRestParameterParser {
// Apache Commons CLI options
- Options options;
+ private Options options;
/**
* Construct the options for the CLI RESTful services.
parameterMap.put("AxArtifactKey#" + engineId, new String[]
{ startStop });
final AxArtifactKey engineKey = ParameterCheck.getEngineKey(parameterMap);
- if (startStop.equals("Start")) {
+ if ("Start".equals(startStop)) {
engineServiceFacade.startEngine(engineKey);
- } else if (startStop.equals("Stop")) {
+ } else if ("Stop".equals(startStop)) {
engineServiceFacade.stopEngine(engineKey);
}
} catch (final Exception e) {
parameterMap.put("period", new String[]
{ Long.toString(period) });
final AxArtifactKey engineKey = ParameterCheck.getEngineKey(parameterMap);
- if (startStop.equals("Start")) {
+ if ("Start".equals(startStop)) {
engineServiceFacade.startPerioidicEvents(engineKey, period);
setPeriodicEventsState(host, true);
- } else if (startStop.equals("Stop")) {
+ } else if ("Stop".equals(startStop)) {
engineServiceFacade.stopPerioidicEvents(engineKey);
setPeriodicEventsState(host, false);
}
}
ParameterCheck.StartStop startStop;
- if (startStopValue[0].equalsIgnoreCase("start")) {
+ if ("start".equalsIgnoreCase(startStopValue[0])) {
startStop = ParameterCheck.StartStop.START;
- } else if (startStopValue[0].equalsIgnoreCase("stop")) {
+ } else if ("stop".equalsIgnoreCase(startStopValue[0])) {
startStop = ParameterCheck.StartStop.STOP;
} else {
LOGGER.warn("value \"{}\"of parameter \"{}\" not \"start\" or \"stop\"", startStopValue[0], startStopPar);
return false;
}
final TestContextBooleanItem other = (TestContextBooleanItem) obj;
- if (flag != other.flag) {
- return false;
- }
- return true;
+ return flag == other.flag;
}
/*
return false;
}
final TestContextByteItem other = (TestContextByteItem) obj;
- if (byteValue != other.byteValue) {
- return false;
- }
- return true;
+ return byteValue == other.byteValue;
}
/*
if (time != other.time) {
return false;
}
- if (year != other.year) {
- return false;
- }
- return true;
+ return year == other.year;
}
/*
} else if (!timeZoneString.equals(other.timeZoneString)) {
return false;
}
- if (utcOffset != other.utcOffset) {
- return false;
- }
- return true;
+ return utcOffset == other.utcOffset;
}
/*
return false;
}
final TestContextDoubleItem other = (TestContextDoubleItem) obj;
- if (Double.doubleToLongBits(doubleValue) != Double.doubleToLongBits(other.doubleValue)) {
- return false;
- }
- return true;
+ return Double.doubleToLongBits(doubleValue) == Double.doubleToLongBits(other.doubleValue);
}
/*
return false;
}
final TestContextFloatItem other = (TestContextFloatItem) obj;
- if (Float.floatToIntBits(floatValue) != Float.floatToIntBits(other.floatValue)) {
- return false;
- }
- return true;
+ return Float.floatToIntBits(floatValue) == Float.floatToIntBits(other.floatValue);
}
/*
return false;
}
final TestContextIntItem other = (TestContextIntItem) obj;
- if (intValue != other.intValue) {
- return false;
- }
- return true;
+ return intValue == other.intValue;
}
/*
return false;
}
final TestContextLongItem other = (TestContextLongItem) obj;
- if (longValue != other.longValue) {
- return false;
- }
- return true;
+ return longValue == other.longValue;
}
/*
private static final int HASH_PRIME_1 = 31;
- private Long longValue = new Long(0);
+ private Long longValue = 0L;
/**
* The Constructor.
private static final int HASH_PRIME_1 = 31;
- private Map<String, String> mapValue = new TreeMap<String, String>();
+ private Map<String, String> mapValue = new TreeMap<>();
/**
* The Constructor.
*/
public Map<String, String> getMapValue() {
if (mapValue == null) {
- mapValue = new TreeMap<String, String>();
+ mapValue = new TreeMap<>();
}
return mapValue;
}
import java.io.Serializable;
import java.util.Set;
+import java.util.SortedSet;
import java.util.TreeSet;
/**
private static final int HASH_PRIME_1 = 31;
- private TreeSet<String> setValue = new TreeSet<String>();
+ private SortedSet<String> setValue = new TreeSet<>();
/**
* The Constructor.
*
* @param setValue the set value
*/
- public TestContextTreeSetItem(final TreeSet<String> setValue) {
+ public TestContextTreeSetItem(final SortedSet<String> setValue) {
this.setValue = setValue;
}
*/
public Set<String> getSetValue() {
if (setValue == null) {
- setValue = new TreeSet<String>();
+ setValue = new TreeSet<>();
}
return setValue;
}
*
* @param setValue the sets the value
*/
- public void setSetValue(final TreeSet<String> setValue) {
+ public void setSetValue(final SortedSet<String> setValue) {
this.setValue = setValue;
}
* @throws IOException the IO exception
* @throws ApexException the apex exception
*/
- public void testContextAlbumUpdate() throws ApexModelException, IOException, ApexException {
+ public void testContextAlbumUpdate() throws IOException, ApexException {
LOGGER.debug("Running TestContextAlbumUpdate test . . .");
final AxArtifactKey distributorKey = new AxArtifactKey(APEX_DISTRIBUTOR, VERSION);
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(ContextInstantiation.class);
+ // Recurring string constants
+ private static final String TEST_POLICY_CONTEXT_ITEM000 = "TestPolicyContextItem000";
+ private static final String TEST_POLICY_CONTEXT_ITEM005 = "TestPolicyContextItem005";
+ private static final String TEST_POLICY_CONTEXT_ITEM004 = "TestPolicyContextItem004";
+ private static final String TEST_POLICY_CONTEXT_ITEM003 = "TestPolicyContextItem003";
+ private static final String TEST_POLICY_CONTEXT_ITEM002 = "TestPolicyContextItem002";
+ 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 ";
+
private static final TreeSet<String> TEST_TREE_SET = new TreeSet<>();
private static final Map<String, String> TEST_HASH_MAP = new HashMap<>();
try {
- 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());
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());
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);
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());
assertDouble(PI_VAL, globalContextItem.getTestGlobalContextItem005().getDoubleValue());
assertEquals(STRING_GLOBAL_VAL, globalContextItem.getTestGlobalContextItem006().getStringValue());
- assertEquals(new Long(testDate.getTime()), globalContextItem.getTestGlobalContextItem007().getLongValue());
+ 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());
final AxContextModel externalContextModel = TestContextAlbumFactory.createExternalContextModel();
final TestContextDateTzItem tci9A = new TestContextDateTzItem(tci9);
- final TestContextDateLocaleItem tciA_A = new TestContextDateLocaleItem(tciA);
- final TestExternalContextItem externalContext = getTestExternalContextItem(testDate, tci9A, tciA_A);
+ final TestContextDateLocaleItem tciAa = new TestContextDateLocaleItem(tciA);
+ final TestExternalContextItem externalContext = getTestExternalContextItem(testDate, tci9A, tciAa);
final Map<String, Object> valueMap2 = new HashMap<>();
valueMap2.put(EXTERNAL_CONTEXT, externalContext);
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());
assertDouble(PI_VAL, externalContextItem.getTestExternalContextItem005().getDoubleValue());
assertEquals(STRING_EXT_VAL, externalContextItem.getTestExternalContextItem006().getStringValue());
- assertEquals(new Long(testDate.getTime()),
- externalContextItem.getTestExternalContextItem007().getLongValue());
+ 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(tciA_A.getDateValue().getTime(),
- externalContextItem.getTestExternalContextItem00A().getDateValue().getTime());
+ assertEquals(tciAa.getDateValue().getTime(),
+ externalContextItem.getTestExternalContextItem00A().getDateValue().getTime());
assertEquals(TEST_TREE_SET, externalContextItem.getTestExternalContextItem00B().getSetValue());
assertEquals(TEST_HASH_MAP, externalContextItem.getTestExternalContextItem00C().getMapValue());
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);
}
assertEquals(1, externalContextAlbum.size());
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);
}
final Object aObject = externalContextAlbum.get(EXTERNAL_CONTEXT);
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);
}
try {
externalContextAlbum.put("TestExternalContextItem00A", null);
} catch (final ContextRuntimeException e) {
- assertEquals("album \"ExternalContextAlbum:0.0.1\" null values are illegal on key "
- + "\"TestExternalContextItem00A\" for put()", e.getMessage());
+ assertEquals(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItem00A\" for put()", e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
- assertEquals(tciA_A, externalContextItem.getTestExternalContextItem00A());
+ assertEquals(tciAa, externalContextItem.getTestExternalContextItem00A());
// Should return the hash set
assertEquals(TEST_TREE_SET, externalContextItem.getTestExternalContextItem00B().getSetValue());
try {
externalContextAlbum.put("TestExternalContextItem00A", null);
} catch (final ContextRuntimeException e) {
- assert (e.getMessage().equals("album \"ExternalContextAlbum:0.0.1\" null values are illegal on key "
- + "\"TestExternalContextItem00A\" for put()"));
+ assert (e.getMessage().equals(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItem00A\" for put()"));
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertTrue(externalContextAlbum.get(EXTERNAL_CONTEXT).equals(externalContext));
try {
externalContextAlbum.put("TestExternalContextItemFFF", null);
} catch (final ContextRuntimeException e) {
- assert (e.getMessage().equals("album \"ExternalContextAlbum:0.0.1\" null values are illegal on key "
- + "\"TestExternalContextItemFFF\" for put()"));
+ assert (e.getMessage().equals(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItemFFF\" for put()"));
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertEquals(1, externalContextAlbum.size());
try {
externalContextAlbum.put("TestExternalContextItemFFF", null);
} catch (final ContextRuntimeException e) {
- assertEquals("album \"ExternalContextAlbum:0.0.1\" null values are illegal on key "
- + "\"TestExternalContextItemFFF\" for put()", e.getMessage());
+ assertEquals(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItemFFF\" for put()", e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertEquals(1, externalContextAlbum.size());
}
private void assertContextAlbumContains(final TestExternalContextItem externalContext,
- final ContextAlbum externalContextAlbum) {
+ final ContextAlbum externalContextAlbum) {
try {
externalContextAlbum.containsKey(null);
} catch (final ContextRuntimeException e) {
assertEquals("null values are illegal on method parameter \"key\"", e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertTrue(externalContextAlbum.containsKey(EXTERNAL_CONTEXT));
externalContextAlbum.containsValue(null);
} catch (final ContextRuntimeException e) {
assertEquals("null values are illegal on method parameter \"value\"", e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertTrue(externalContextAlbum.containsValue(externalContext));
}
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);
}
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);
final TestContextByteItem testGlobalContextItem001 = new TestContextByteItem(BYTE_VAL);
final TestContextIntItem testGlobalContextItem002 = new TestContextIntItem(INT_VAL);
final TestContextLongItem testGlobalContextItem003 = new TestContextLongItem(LONG_VAL);
- final TestContextFloatItem testGlobalContextItem004 = new TestContextFloatItem(new Float(FLOAT_VAL));
+ final TestContextFloatItem testGlobalContextItem004 = new TestContextFloatItem(FLOAT_VAL);
final TestContextDoubleItem testGlobalContextItem005 = new TestContextDoubleItem(PI_VAL);
final TestContextStringItem testGlobalContextItem006 = new TestContextStringItem(STRING_GLOBAL_VAL);
final TestContextLongObjectItem testGlobalContextItem007 = new TestContextLongObjectItem(testDate.getTime());
final TestContextTreeSetItem testGlobalContextItem00B = new TestContextTreeSetItem(TEST_TREE_SET);
final TestContextTreeMapItem testGlobalContextItem00C = new TestContextTreeMapItem(TEST_HASH_MAP);
-
globalContext.setTestGlobalContextItem000(testGlobalContextItem000);
globalContext.setTestGlobalContextItem001(testGlobalContextItem001);
globalContext.setTestGlobalContextItem002(testGlobalContextItem002);
final TestContextTreeMapItem contextTreeMapItem = new TestContextTreeMapItem(TEST_HASH_MAP);
final Map<String, Object> valueMapA = new LinkedHashMap<>();
- valueMapA.put("TestPolicyContextItem001", contextLongItem);
- valueMapA.put("TestPolicyContextItem002", contextDoubleItem);
- valueMapA.put("TestPolicyContextItem003", contextBooleanItem);
- valueMapA.put("TestPolicyContextItem004", contextLongItem2);
- valueMapA.put("TestPolicyContextItem005", contextTreeMapItem);
- valueMapA.put("TestPolicyContextItem000", contextStringItem);
+ valueMapA.put(TEST_POLICY_CONTEXT_ITEM001, contextLongItem);
+ valueMapA.put(TEST_POLICY_CONTEXT_ITEM002, contextDoubleItem);
+ valueMapA.put(TEST_POLICY_CONTEXT_ITEM003, contextBooleanItem);
+ valueMapA.put(TEST_POLICY_CONTEXT_ITEM004, contextLongItem2);
+ valueMapA.put(TEST_POLICY_CONTEXT_ITEM005, contextTreeMapItem);
+ valueMapA.put(TEST_POLICY_CONTEXT_ITEM000, contextStringItem);
assertPutMethods(policyContextAlbum, contextStringItem, valueMapA);
}
private void assertPutMethods(final ContextAlbum policyContextAlbum, final TestContextStringItem contextStringItem,
- final Map<String, Object> valueMapA) {
+ final Map<String, Object> valueMapA) {
try {
- policyContextAlbum.put("TestPolicyContextItem000", contextStringItem);
+ policyContextAlbum.put(TEST_POLICY_CONTEXT_ITEM000, contextStringItem);
fail(EXCEPTION_MESSAGE);
} catch (final ContextRuntimeException e) {
- assertEquals(
- getMessage("TestPolicyContextItem000", "TestContextItem006",
+ assertEquals(getMessage(TEST_POLICY_CONTEXT_ITEM000, "TestContextItem006",
TestContextStringItem.class.getCanonicalName(), "stringValue=" + STRING_VAL),
- e.getMessage());
+ e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
try {
policyContextAlbum.putAll(valueMapA);
fail(EXCEPTION_MESSAGE);
} catch (final ContextRuntimeException e) {
- assertEquals(getMessage("TestPolicyContextItem001", "TestContextItem003",
- TestContextLongItem.class.getCanonicalName(), "longValue=" + INT_VAL_3), e.getMessage());
+ assertEquals(getMessage(TEST_POLICY_CONTEXT_ITEM001, "TestContextItem003",
+ TestContextLongItem.class.getCanonicalName(), "longValue=" + INT_VAL_3), e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
}
}
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 TestContextTreeSetItem testExternalContextItem00B = new TestContextTreeSetItem(TEST_TREE_SET);
final TestContextTreeMapItem testExternalContextItem00C = new TestContextTreeMapItem(TEST_HASH_MAP);
-
externalContext.setTestExternalContextItem000(testExternalContextItem000);
externalContext.setTestExternalContextItem001(testExternalContextItem001);
externalContext.setTestExternalContextItem002(testExternalContextItem002);
}
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) {
assertTrue(Double.compare(actual, expected) == 0);
}
-
private Distributor getDistributor() throws ContextException {
final AxArtifactKey distributorKey = new AxArtifactKey("ApexDistributorInit", VERSION);
final Distributor distributor = new DistributorFactory().getDistributor(distributorKey);
* @author Sergey Sachkov (sergey.sachkov@ericsson.com)
*/
public class ContextUpdate {
+ // Recurring string constants.
+ private static final String NORMAL_TEST_EXCEPTION = "normal test exception";
+
private static final String ZERO = "zero";
- private static final String _0 = "0";
+ private static final String NUMBER_ZERO = "0";
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(ContextUpdate.class);
* @throws IOException the IO exception
* @throws ApexException the apex exception
*/
- public void testContextUpdate() throws ApexModelException, IOException, ApexException {
+ public void testContextUpdate() throws IOException, ApexException {
LOGGER.debug("Running TestContextUpdate test . . .");
final Distributor contextDistributor = getDistributor();
final TestContextDateLocaleItem tciA = getTestContextDateLocaleItem();
final TestContextTreeMapItem tciC = getTestContextTreeMapItem();
- longContextAlbum.put(_0, (long) 0);
- longContextAlbum.put(_0, 0);
- longContextAlbum.put(_0, _0);
+ longContextAlbum.put(NUMBER_ZERO, (long) 0);
+ longContextAlbum.put(NUMBER_ZERO, 0);
+ longContextAlbum.put(NUMBER_ZERO, NUMBER_ZERO);
try {
- longContextAlbum.put(_0, ZERO);
+ longContextAlbum.put(NUMBER_ZERO, ZERO);
fail(EXCEPTION_MESSAGE);
} catch (final ContextRuntimeException e) {
assertEquals("Failed to set context value for key \"0\" in album \"LongContextAlbum:0.0.1\":"
+ " LongContextAlbum:0.0.1: object \"zero\" of class \"java.lang.String\" not compatible with"
+ " class \"java.lang.Long\"", e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
try {
- longContextAlbum.put(_0, "");
+ longContextAlbum.put(NUMBER_ZERO, "");
fail(EXCEPTION_MESSAGE);
} catch (final ContextRuntimeException e) {
assertEquals(
"Failed to set context value for key \"0\" in album \"LongContextAlbum:0.0.1\": LongContextAlbum"
+ ":0.0.1: object \"\" of class \"java.lang.String\" not compatible with class \"java.lang.Long\"",
e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
try {
- longContextAlbum.put(_0, null);
+ longContextAlbum.put(NUMBER_ZERO, null);
fail(EXCEPTION_MESSAGE);
} catch (final ContextRuntimeException e) {
assertEquals("album \"LongContextAlbum:0.0.1\" null values are illegal on key \"0\" for put()",
e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
try {
fail(EXCEPTION_MESSAGE);
} catch (final ContextRuntimeException e) {
assertEquals("album \"LongContextAlbum:0.0.1\" null keys are illegal on keys for put()", e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertNull(dateContextAlbum.put("date0", tciA));
private TestContextTreeMapItem getTestContextTreeMapItem() {
final Map<String, String> testHashMap = new HashMap<>();
- testHashMap.put(_0, ZERO);
+ testHashMap.put(NUMBER_ZERO, ZERO);
testHashMap.put("1", "one");
testHashMap.put("2", "two");
testHashMap.put("3", "three");
testHashMap.put("4", "four");
- final TestContextTreeMapItem tciC = new TestContextTreeMapItem(testHashMap);
- return tciC;
+ return new TestContextTreeMapItem(testHashMap);
}
private TestContextDateLocaleItem getTestContextDateLocaleItem() {
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
-
-
/**
* The Class SequentialContextInstantiation checks sequential initiation of context.
*
* @author Sergey Sachkov (sergey.sachkov@ericsson.com)
*/
public class SequentialContextInstantiation {
- private static final String DV1 = "dv1";
- private static final String DV0 = "dv0";
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(SequentialContextInstantiation.class);
+ // Recurring string constants.
+ private static final String TEST_AB = "TestAB";
+ private static final String TEST_AA = "TestAA";
+ private static final String ITEM_NULL = "ItemNull";
+ private static final String ITEM06 = "Item06";
+ private static final String ITEM05 = "Item05";
+ private static final String ITEM03 = "Item03";
+ private static final String ITEM02 = "Item02";
+ private static final String ITEM01 = "Item01";
+ private static final String ITEM00_2 = "Item00_2";
+
+ // Recurring string constants.
+ private static final String NORMAL_TEST_EXCEPTION = "normal test exception";
+ private static final String DV1 = "dv1";
+ private static final String DV0 = "dv0";
+
/**
* Test sequential context instantiation.
*
dateAlbum.put("tci9", tci9);
} catch (final Exception e) {
final String message = "class \"" + TestContextDateTzItem.class.getCanonicalName()
- + "\" not compatible with class \"" + TestContextDateLocaleItem.class.getCanonicalName() + "\"";
+ + "\" not compatible with class \"" + TestContextDateLocaleItem.class.getCanonicalName()
+ + "\"";
assertTrue(e.getMessage().contains(message));
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
final TestContextDateLocaleItem tciA01 = new TestContextDateLocaleItem(tciA00);
final TestContextDateLocaleItem tciA03 = new TestContextDateLocaleItem(tciA00);
final Map<String, Object> valueMap0 = new HashMap<>();
- valueMap0.put("Item01", tciA01);
- valueMap0.put("Item02", tciA02);
- valueMap0.put("Item03", tciA03);
+ valueMap0.put(ITEM01, tciA01);
+ valueMap0.put(ITEM02, tciA02);
+ valueMap0.put(ITEM03, tciA03);
dateAlbum.putAll(valueMap0);
assertEquals(5, dateAlbum.size());
- assertEquals(tciA01, dateAlbum.get("Item01"));
- assertEquals(tciA02, dateAlbum.get("Item02"));
- assertEquals(tciA03, dateAlbum.get("Item03"));
+ assertEquals(tciA01, dateAlbum.get(ITEM01));
+ assertEquals(tciA02, dateAlbum.get(ITEM02));
+ assertEquals(tciA03, dateAlbum.get(ITEM03));
final Map<String, Object> valueMap1 = getMap(testDate, tciA00, tci9);
dateAlbum1.putAll(valueMap1);
fail(EXCEPTION_MESSAGE);
} catch (final Exception e) {
- assertTrue(e.getMessage().endsWith(
- "not compatible with class \"" + TestContextDateLocaleItem.class.getCanonicalName() + "\""));
+ assertTrue(e.getMessage().endsWith("not compatible with class \""
+ + TestContextDateLocaleItem.class.getCanonicalName() + "\""));
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertEquals(5, dateAlbum1.size());
valueMap1.clear();
- valueMap1.put("Item00_2", tciA00);
+ valueMap1.put(ITEM00_2, tciA00);
dateAlbum1.putAll(valueMap1);
assertEquals(6, dateAlbum1.size());
- assertEquals(tciA00, dateAlbum1.get("Item00_2"));
- dateAlbum.remove("Item00_2");
+ assertEquals(tciA00, dateAlbum1.get(ITEM00_2));
+ dateAlbum.remove(ITEM00_2);
assertEquals(5, dateAlbum1.size());
final ContextAlbum dateAlbumCopy = getContextAlbum(DATE_CONTEXT_ALBUM, contextDistributor);
final Map<String, Object> valueMap2 = new HashMap<>();
valueMap2.put("Item04", tciA01);
- valueMap2.put("Item05", tciA02);
- valueMap2.put("Item06", tciA03);
+ valueMap2.put(ITEM05, tciA02);
+ valueMap2.put(ITEM06, tciA03);
dateAlbumCopy.putAll(valueMap2);
assertEquals(8, dateAlbumCopy.size());
- assertEquals(tciA03, dateAlbumCopy.get("Item06"));
+ assertEquals(tciA03, dateAlbumCopy.get(ITEM06));
final Collection<Object> mapValues = dateAlbum.values();
assertTrue(dateAlbumCopy.values().containsAll(mapValues));
dateAlbum1.clear();
assertTrue(dateAlbum1.isEmpty());
-
dateAlbum.put("Item00", tciA00);
final Map<String, Object> valueMap3 = new HashMap<>();
- valueMap3.put("Item01", tciA01);
- valueMap3.put("Item02", tciA02);
- valueMap3.put("Item03", tciA03);
+ valueMap3.put(ITEM01, tciA01);
+ valueMap3.put(ITEM02, tciA02);
+ valueMap3.put(ITEM03, tciA03);
dateAlbum.putAll(valueMap3);
final Map<String, Object> valueMap4 = new HashMap<>();
valueMap4.put("Item04", tciA01);
- valueMap4.put("Item05", tciA02);
- valueMap4.put("Item06", tciA03);
+ valueMap4.put(ITEM05, tciA02);
+ valueMap4.put(ITEM06, tciA03);
dateAlbumCopy.putAll(valueMap4);
assertAlbumGetAndPutMethods(dateAlbum, tciA03, tciA00);
// Should do removes
- dateAlbum.remove("TestAA");
- dateAlbum.remove("TestAB");
- dateAlbum.remove("ItemNull");
+ dateAlbum.remove(TEST_AA);
+ dateAlbum.remove(TEST_AB);
+ dateAlbum.remove(ITEM_NULL);
assertEquals(7, entrySet.size());
assertTrue(dateAlbumCopy.values().containsAll(mapValues));
// CHECKSTYLE:ON: checkstyle:magicNumber
fail(EXCEPTION_MESSAGE);
} catch (final Exception e) {
assertEquals("null values are illegal on method parameter \"key\"", e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
- assertTrue(dateAlbum.containsKey("Item05"));
+ assertTrue(dateAlbum.containsKey(ITEM05));
assertTrue(!dateAlbum.containsKey("Item07"));
try {
dateAlbum.containsValue(null);
} catch (final Exception e) {
assertEquals("null values are illegal on method parameter \"value\"", e.getMessage());
-
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertTrue(dateAlbum.containsValue(tciA01));
}
private void assertAlbumGetAndPutMethods(final ContextAlbum dateAlbum, final TestContextDateLocaleItem tciA03,
- final TestContextDateLocaleItem tciA00) {
+ final TestContextDateLocaleItem tciA00) {
try {
dateAlbum.get(null);
fail(EXCEPTION_MESSAGE);
} catch (final Exception e) {
assertEquals("album \"DateContextAlbum:0.0.1\" null keys are illegal on keys for get()", e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
- final Object aObject = dateAlbum.get("Item03");
+ final Object aObject = dateAlbum.get(ITEM03);
assertEquals(tciA03, aObject);
try {
dateAlbum.put(null, null);
fail(EXCEPTION_MESSAGE);
} catch (final Exception e) {
assertEquals("album \"DateContextAlbum:0.0.1\" null keys are illegal on keys for put()", e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
// Put null ContextItem should work (return null)
try {
- dateAlbum.put("ItemNull", null);
+ dateAlbum.put(ITEM_NULL, null);
} catch (final Exception e) {
assertEquals("album \"DateContextAlbum:0.0.1\" null values are illegal on key \"ItemNull\" for put()",
- e.getMessage());
+ e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
// Should return null
- assertNull(dateAlbum.get("ItemNull"));
+ assertNull(dateAlbum.get(ITEM_NULL));
// Put should return the previous contextItem
tciA00.setDst(false);
- final TestContextDateLocaleItem tciA03_clone = new TestContextDateLocaleItem(tciA03);
- tciA03_clone.setDst(true);
- TestContextDateLocaleItem retItem = (TestContextDateLocaleItem) dateAlbum.put("Item03", tciA03_clone);
+ final TestContextDateLocaleItem tciA03Clone = new TestContextDateLocaleItem(tciA03);
+ tciA03Clone.setDst(true);
+ TestContextDateLocaleItem retItem = (TestContextDateLocaleItem) dateAlbum.put(ITEM03, tciA03Clone);
assertEquals(tciA03, retItem);
- retItem = (TestContextDateLocaleItem) dateAlbum.put("Item03", tciA03);
- assertEquals(tciA03_clone, retItem);
+ retItem = (TestContextDateLocaleItem) dateAlbum.put(ITEM03, tciA03);
+ assertEquals(tciA03Clone, retItem);
try {
- dateAlbum.put("ItemNull", null);
+ dateAlbum.put(ITEM_NULL, null);
fail(EXCEPTION_MESSAGE);
} catch (final Exception e) {
- assert (e.getMessage()
- .equals("album \"DateContextAlbum:0.0.1\" null values are illegal on key \"ItemNull\" for put()"));
+ assert ("album \"DateContextAlbum:0.0.1\" null values are illegal on key \"ItemNull\" for put()"
+ .equals(e.getMessage()));
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
- dateAlbum.put("TestAA", tciA00);
- assertEquals(tciA00, dateAlbum.get("TestAA"));
+ dateAlbum.put(TEST_AA, tciA00);
+ assertEquals(tciA00, dateAlbum.get(TEST_AA));
// Should print warning
try {
- dateAlbum.put("TestAA", null);
+ dateAlbum.put(TEST_AA, null);
fail(EXCEPTION_MESSAGE);
} catch (final Exception e) {
assertEquals("album \"DateContextAlbum:0.0.1\" null values are illegal on key \"TestAA\" for put()",
- e.getMessage());
+ e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertEquals(8, dateAlbum.size());
try {
- dateAlbum.put("TestAB", null);
+ dateAlbum.put(TEST_AB, null);
fail(EXCEPTION_MESSAGE);
} catch (final Exception e) {
assertEquals("album \"DateContextAlbum:0.0.1\" null values are illegal on key \"TestAB\" for put()",
- e.getMessage());
+ e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertEquals(8, dateAlbum.size());
}
private Map<String, Object> getMap(final Date testDate, final TestContextDateLocaleItem tciA00,
- final TestContextDateTzItem tci9) {
+ final TestContextDateTzItem tci9) {
final TestContextBooleanItem testBadItem000 = new TestContextBooleanItem();
final TestContextByteItem testBadItem001 = new TestContextByteItem();
final TestContextIntItem testBadItem002 = new TestContextIntItem();
values.put("TestBadItem007", testBadItem007);
values.put("TestBadItem008", testBadItem008);
values.put("TestBadItem009", tci9);
- values.put("Item00_2", tciA00);
+ values.put(ITEM00_2, tciA00);
return values;
}
}
private ContextAlbum getContextAlbum(final String albumName, final Distributor contextDistributor)
- throws ContextException {
+ throws ContextException {
final ContextAlbum dateAlbum = contextDistributor.createContextAlbum(new AxArtifactKey(albumName, VERSION));
assertNotNull(dateAlbum);
dateAlbum.setUserArtifactStack(Constants.getAxArtifactKeyArray());
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public final class TestContextAlbumFactory {
-
+ // Recurring string constants.
+ private static final String CONTEXT = "context";
+ private static final String SCHEMAS2 = "Schemas";
+ private static final String KEY_INFO_MAP_KEY = "KeyInfoMapKey";
private static final String APPLICATION = "APPLICATION";
private static final String JAVA_LONG = Long.class.getCanonicalName();
private static final String JAVA_FLAVOUR = "Java";
final AxContextAlbum albumDefinition = new AxContextAlbum(new AxArtifactKey(POLICY_CONTEXT_ALBUM, VERSION),
APPLICATION, true, policySchema.getKey());
- final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", VERSION));
+ final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey(SCHEMAS2, VERSION));
schemas.getSchemasMap().put(policySchema.getKey(), policySchema);
- final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("context", VERSION));
+ final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey(CONTEXT, VERSION));
albums.getAlbumsMap().put(albumDefinition.getKey(), albumDefinition);
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", VERSION));
+ final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey(KEY_INFO_MAP_KEY, VERSION));
final AxContextModel contextModel =
new AxContextModel(new AxArtifactKey("PolicyContextModel", VERSION), schemas, albums, keyInformation);
contextModel.setKeyInformation(keyInformation);
final AxContextAlbum albumDefinition = new AxContextAlbum(new AxArtifactKey(GLOBAL_CONTEXT_ALBUM, VERSION),
"GLOBAL", true, globalSchema.getKey());
- final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", VERSION));
+ final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey(SCHEMAS2, VERSION));
schemas.getSchemasMap().put(globalSchema.getKey(), globalSchema);
- final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("context", VERSION));
+ final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey(CONTEXT, VERSION));
albums.getAlbumsMap().put(albumDefinition.getKey(), albumDefinition);
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", VERSION));
+ final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey(KEY_INFO_MAP_KEY, VERSION));
final AxContextModel contextModel =
new AxContextModel(new AxArtifactKey("GlobalContextModel", VERSION), schemas, albums, keyInformation);
contextModel.setKeyInformation(keyInformation);
final AxContextAlbum albumDefinition = new AxContextAlbum(new AxArtifactKey(EXTERNAL_CONTEXT_ALBUM, VERSION),
"EXTERNAL", true, externalSchema.getKey());
- final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", VERSION));
+ final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey(SCHEMAS2, VERSION));
schemas.getSchemasMap().put(externalSchema.getKey(), externalSchema);
- final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("context", VERSION));
+ final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey(CONTEXT, VERSION));
albums.getAlbumsMap().put(albumDefinition.getKey(), albumDefinition);
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", VERSION));
+ final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey(KEY_INFO_MAP_KEY, VERSION));
final AxContextModel contextModel =
new AxContextModel(new AxArtifactKey("ExternalContextModel", VERSION), schemas, albums, keyInformation);
contextModel.setKeyInformation(keyInformation);
final AxContextAlbum albumDefinition2 =
new AxContextAlbum(longContextAlbumKey2, APPLICATION, true, longSchema.getKey());
- final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", VERSION));
+ final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey(SCHEMAS2, VERSION));
schemas.getSchemasMap().put(longSchema.getKey(), longSchema);
- final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("context", VERSION));
+ final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey(CONTEXT, VERSION));
albums.getAlbumsMap().put(albumDefinition1.getKey(), albumDefinition1);
albums.getAlbumsMap().put(albumDefinition2.getKey(), albumDefinition2);
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", VERSION));
+ final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey(KEY_INFO_MAP_KEY, VERSION));
final AxContextModel contextModel =
new AxContextModel(new AxArtifactKey("LongContextModel", VERSION), schemas, albums, keyInformation);
contextModel.setKeyInformation(keyInformation);
final AxContextSchema mapSchema = new AxContextSchema(new AxArtifactKey("MapSchema", VERSION), JAVA_FLAVOUR,
TestContextTreeMapItem.class.getCanonicalName());
- final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", VERSION));
+ final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey(SCHEMAS2, VERSION));
schemas.getSchemasMap().put(longSchema.getKey(), longSchema);
schemas.getSchemasMap().put(lTypeSchema.getKey(), lTypeSchema);
schemas.getSchemasMap().put(dateSchema.getKey(), dateSchema);
final AxContextAlbum mapAlbumDefinition = new AxContextAlbum(new AxArtifactKey(MAP_CONTEXT_ALBUM, VERSION),
APPLICATION, true, mapSchema.getKey());
- final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("context", VERSION));
+ final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey(CONTEXT, VERSION));
albums.getAlbumsMap().put(longAlbumDefinition.getKey(), longAlbumDefinition);
albums.getAlbumsMap().put(lTypeAlbumDefinition.getKey(), lTypeAlbumDefinition);
albums.getAlbumsMap().put(dateAlbumDefinition.getKey(), dateAlbumDefinition);
albums.getAlbumsMap().put(mapAlbumDefinition.getKey(), mapAlbumDefinition);
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", VERSION));
+ final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey(KEY_INFO_MAP_KEY, VERSION));
final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("MultiAlbumsContextModel", VERSION),
schemas, albums, keyInformation);
contextModel.setKeyInformation(keyInformation);
/**
* The Interface AlbumModifier defines the interface to allow context albums be modified during context tests.
*/
+@FunctionalInterface
public interface AlbumModifier {
/**
*
* @param value the value
*/
- private LockType(final int value) {
+ LockType(final int value) {
this.value = value;
}
* @throws ApexException the Apex exception occurs in handling Apex
*/
public Map<String, TestContextLongItem> testConcurrentContext()
- throws ApexModelException, IOException, ApexException {
+ throws IOException, ApexException {
try {
setupAndVerifyContext();
*
* @throws ContextException the context exception
*/
- private void setupAndVerifyContext() throws ContextException {
+ private void setupAndVerifyContext() {
contextDistributor = configrationProvider.getDistributor();
ltypeAlbum = configrationProvider.getContextAlbum(contextDistributor);
final Map<String, Object> initValues = configrationProvider.getContextAlbumInitValues();
public static void main(final String[] args) throws Exception {
configure();
- System.out.println("JVM Arguments: " + Arrays.toString(args));
+ LOGGER.info("JVM Arguments: " + Arrays.toString(args));
// CHECKSTYLE:OFF: checkstyle:magicNumber
// An even number of arguments greater than 3
final int threadLoops = getIntValue("threadLoops", args, 3);
final int albumSize = getIntValue("albumSize", args, 4);
final int lockType = getIntValue("lockType", args, 5);
- final String hazelCastfileLocation = getStringValue("hazelcast file location", args, 6);;
+ final String hazelCastfileLocation = getStringValue("hazelcast file location", args, 6);
System.setProperty("hazelcast.config", hazelCastfileLocation);
} catch (final Exception e) {
LOGGER.error("error running test in JVM", e);
- return;
}
// CHECKSTYLE:ON: checkstyle:magicNumber
-
}
private static String getStringValue(final String key, final String[] args, final int position) {
// first non-loopback
// IPv4 address
// on a host
- final TreeSet<String> ipAddressSet = new TreeSet<String>();
+ final TreeSet<String> ipAddressSet = new TreeSet<>();
final Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
for (final NetworkInterface netint : Collections.list(nets)) {
}
}
- if (ipAddressSet.size() == 0) {
+ if (ipAddressSet.isEmpty()) {
throw new Exception("cound not find real IP address for test");
}
- System.out.println("Setting jgroups.tcp.address to: " + ipAddressSet.first());
+ LOGGER.info("Setting jgroups.tcp.address to: " + ipAddressSet.first());
System.setProperty("jgroups.tcp.address", ipAddressSet.first());
}
}
commandList.add(System.getProperty("java.class.path"));
commandList.add(ConcurrentContextJvm.class.getCanonicalName());
commandList.add(configrationProvider.getTestName());
- commandList.add(new Integer(jvm).toString());
- commandList.add(new Integer(configrationProvider.getThreadCount()).toString());
- commandList.add(new Integer(configrationProvider.getLoopSize()).toString());
- commandList.add(new Integer(configrationProvider.getAlbumSize()).toString());
- commandList.add(new Integer(configrationProvider.getLockType().getValue()).toString());
+ commandList.add(Integer.toString(jvm));
+ commandList.add(Integer.toString(configrationProvider.getThreadCount()));
+ commandList.add(Integer.toString(configrationProvider.getLoopSize()));
+ commandList.add(Integer.toString(configrationProvider.getAlbumSize()));
+ commandList.add(Integer.toString(configrationProvider.getLockType().getValue()));
commandList.add(System.getProperty("hazelcast.config", ""));
for (final Entry<String, ParameterGroup> parameterServiceEntry : ParameterService.getAll()) {
public ExecutorService getExecutorService() {
final String name = getThreadFactoryName(jvmCount, testType);
final IntegrationThreadFactory threadFactory = new IntegrationThreadFactory(name);
- final ExecutorService executorService = Executors.newFixedThreadPool(threadCount, threadFactory);
- return executorService;
+ return Executors.newFixedThreadPool(threadCount, threadFactory);
}
/*
@Override
public ExecutorService getExecutorService(final String threadFactoryName, final int threadPoolSize) {
final IntegrationThreadFactory threadFactory = new IntegrationThreadFactory(threadFactoryName);
- final ExecutorService executorService = Executors.newFixedThreadPool(threadPoolSize, threadFactory);
- return executorService;
+ return Executors.newFixedThreadPool(threadPoolSize, threadFactory);
}
/*
public static final String EXCEPTION_MESSAGE = "Test should throw an exception";
public static final byte BYTE_VAL = (byte) 0xFF;
public static final double PI_VAL = Math.PI;
- public static final float FLOAT_VAL = 3.14159265359f;
+ public static final float FLOAT_VAL = 3.14159265359F;
public static final String EXTERNAL_CONTEXT = "externalContext";
public static final String GLOBAL_CONTEXT_KEY = "globalContext";
public static final String STRING_GLOBAL_VAL = "This is a global context string";
import java.net.SocketException;
import java.util.Collections;
import java.util.Enumeration;
+import java.util.SortedSet;
import java.util.TreeSet;
/**
* @return Set of IPv4 addresses
* @throws SocketException throw socket exception if error occurs
*/
- public static TreeSet<String> getIPv4NonLoopAddresses() throws SocketException {
- final TreeSet<String> ipAddressSet = new TreeSet<String>();
+ public static SortedSet<String> getIPv4NonLoopAddresses() throws SocketException {
+ final TreeSet<String> ipAddressSet = new TreeSet<>();
final Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
for (final NetworkInterface netint : Collections.list(nets)) {
* @throws IOException on IO exceptions from the operating system
*/
public void deployModel(final AxPolicyModel policyModel, final boolean ignoreConflicts, final boolean force)
- throws ApexException, IOException {
+ throws ApexException {
engineServiceFacade.deployModel(policyModel, ignoreConflicts, force);
}
// The facade that is handling messaging to the engine service
private EngineServiceFacade engineServiceFacade = null;
- /**
- * The main method, reads the Apex server host address, port and location of the Apex model XML file from the
- * command line arguments.
- *
- * @param args the arguments that specify the Apex engine and the Apex model file
- */
- public static void main(final String[] args) {
- if (args.length != NUM_ARGUMENTS) {
- String message = "invalid arguments: " + Arrays.toString(args)
- + "\nusage: Deployer <server address> <port address> <start/stop> <periods in ms>";
- LOGGER.error(message);
- return;
- }
-
- PeriodicEventManager deployer = null;
- try {
- // Use a Deployer object to handle model deployment
- deployer = new PeriodicEventManager(args[0], Integer.parseInt(args[1]));
- deployer.init();
- if (args[2].equalsIgnoreCase("start")) {
- deployer.startPerioidicEvents(Long.parseLong(args[PERIODIC_EVENT_INTERVAL]));
- } else {
- deployer.stopPerioidicEvents();
- }
- } catch (final ApexException e) {
- LOGGER.error("model deployment failed on parameters {}", args, e);
- } finally {
- if (deployer != null) {
- deployer.close();
- }
- }
- }
-
/**
* Instantiates a new deployer.
*
engineServiceFacade.stopPerioidicEvents(engineKey);
}
}
+
+ /**
+ * The main method, reads the Apex server host address, port and location of the Apex model XML file from the
+ * command line arguments.
+ *
+ * @param args the arguments that specify the Apex engine and the Apex model file
+ */
+ public static void main(final String[] args) {
+ if (args.length != NUM_ARGUMENTS) {
+ String message = "invalid arguments: " + Arrays.toString(args)
+ + "\nusage: Deployer <server address> <port address> <start/stop> <periods in ms>";
+ LOGGER.error(message);
+ return;
+ }
+
+ PeriodicEventManager deployer = null;
+ try {
+ // Use a Deployer object to handle model deployment
+ deployer = new PeriodicEventManager(args[0], Integer.parseInt(args[1]));
+ deployer.init();
+ if ("start".equalsIgnoreCase(args[2])) {
+ deployer.startPerioidicEvents(Long.parseLong(args[PERIODIC_EVENT_INTERVAL]));
+ } else {
+ deployer.stopPerioidicEvents();
+ }
+ } catch (final ApexException e) {
+ LOGGER.error("model deployment failed on parameters {}", args, e);
+ } finally {
+ if (deployer != null) {
+ deployer.close();
+ }
+ }
+ }
}
* @author Liam Fallon
*
*/
+@FunctionalInterface
public interface EnEventListener {
/**
private final AxEvent axEvent;
// The event monitor for this event
- private final EventMonitor eventMonitor = new EventMonitor();
+ private final transient EventMonitor eventMonitor = new EventMonitor();
// The stack of execution of this event, used for monitoring
private AxConcept[] userArtifactStack;
@Override
public void putAll(final Map<? extends String, ? extends Object> incomingMap) {
// Override the generic "putAll()" call as we want to monitor the puts
- for (final java.util.Map.Entry<? extends String, ? extends Object> incomingEntry : incomingMap.entrySet()) {
+ for (final Map.Entry<? extends String, ? extends Object> incomingEntry : incomingMap.entrySet()) {
put(incomingEntry.getKey(), incomingEntry.getValue());
}
}
private final AxField axField;
// The schema helper for this field
- private SchemaHelper schemaHelper;
+ private transient SchemaHelper schemaHelper;
// The value of this field
- private final Object value;
+ private final transient Object value;
/**
* Instantiates a new EnField, an Engine Field.
contextAlbum.setScope(scope);
}
if (writable != null) {
- if (writable.trim().equalsIgnoreCase("true") || writable.trim().equalsIgnoreCase("t")) {
+ if ("true".equalsIgnoreCase(writable.trim()) || "t".equalsIgnoreCase(writable.trim())) {
contextAlbum.setWritable(true);
} else {
contextAlbum.setWritable(false);
@Override
public String readLogic(final AxLogic axLogic) {
// Java uses compiled logic, other executor types run scripts
- if (axLogic.getLogicFlavour().equals("JAVA")) {
+ if ("JAVA".equals(axLogic.getLogicFlavour())) {
// Check if we're using the default logic
if (defaultLogic != null) {
// Return the java class name for the default logic
private String getJsonString(final Object object, final Object conditionedObject) {
- try (final ByteArrayOutputStream output = new ByteArrayOutputStream();) {
+ try (final ByteArrayOutputStream output = new ByteArrayOutputStream()) {
final DatumWriter<Object> writer = new GenericDatumWriter<>(avroSchema);
final JsonEncoder jsonEncoder = EncoderFactory.get().jsonEncoder(avroSchema, output, true);
writer.write(conditionedObject, jsonEncoder);
// Check if we actually got a connection factory
if (connectionFactory == null) {
- throw new NullPointerException(
+ throw new IllegalArgumentException(
"JMS context lookup of \"" + jmsConsumerProperties.getConnectionFactory() + "\" returned null");
}
} catch (final Exception e) {
// Check if we actually got a topic
if (jmsIncomingTopic == null) {
- throw new NullPointerException(
+ throw new IllegalArgumentException(
"JMS context lookup of \"" + jmsConsumerProperties.getConsumerTopic() + "\" returned null");
}
} catch (final Exception e) {
// Check if we actually got a connection factory
if (connectionFactory == null) {
- throw new NullPointerException("JMS context lookup of \"" + jmsProducerProperties.getConnectionFactory()
+ throw new IllegalArgumentException("JMS context lookup of \"" + jmsProducerProperties.getConnectionFactory()
+ "\" returned null for producer (" + this.name + ")");
}
} catch (final Exception e) {
// Check if we actually got a topic
if (jmsOutgoingTopic == null) {
- throw new NullPointerException("JMS context lookup of \"" + jmsProducerProperties.getProducerTopic()
+ throw new IllegalArgumentException("JMS context lookup of \"" + jmsProducerProperties.getProducerTopic()
+ "\" returned null for producer (" + this.name + ")");
}
} catch (final Exception e) {
restProducerProperties.setHttpMethod(RestClientCarrierTechnologyParameters.DEFAULT_PRODUCER_HTTP_METHOD);
}
- if (!restProducerProperties.getHttpMethod().equalsIgnoreCase("POST")
- && !restProducerProperties.getHttpMethod().equalsIgnoreCase("PUT")) {
+ if (!"POST".equalsIgnoreCase(restProducerProperties.getHttpMethod())
+ && !"PUT".equalsIgnoreCase(restProducerProperties.getHttpMethod())) {
final String errorMessage = "specified HTTP method of \"" + restProducerProperties.getHttpMethod()
+ "\" is invalid, only HTTP methods \"POST\" and \"PUT\" are supproted "
+ "for event sending on REST client producer (" + this.name + ")";
*/
public Response sendEventAsRestRequest(final String event) {
// We have already checked that it is a PUT or POST request
- if (restProducerProperties.getHttpMethod().equalsIgnoreCase("POST")) {
+ if ("POST".equalsIgnoreCase(restProducerProperties.getHttpMethod())) {
return client.target(restProducerProperties.getUrl()).request("application/json").post(Entity.json(event));
} else {
return client.target(restProducerProperties.getUrl()).request("application/json").put(Entity.json(event));
boolean returnValue = false;
final IRubyObject ret = parsedjruby.run();
if (ret != null) {
- final Boolean retbool = (Boolean) ret.toJava(java.lang.Boolean.class);
+ final Boolean retbool = ret.toJava(java.lang.Boolean.class);
if (retbool != null) {
returnValue = true;
}
boolean returnValue = false;
final IRubyObject ret = parsedjruby.run();
if (ret != null) {
- final Boolean retbool = (Boolean) ret.toJava(java.lang.Boolean.class);
+ final Boolean retbool = ret.toJava(java.lang.Boolean.class);
if (retbool != null) {
returnValue = true;
}
boolean returnValue = false;
final IRubyObject ret = parsedjruby.run();
if (ret != null) {
- final Boolean retbool = (Boolean) ret.toJava(java.lang.Boolean.class);
+ final Boolean retbool = ret.toJava(java.lang.Boolean.class);
if (retbool != null) {
returnValue = true;
}
private boolean blockEndTokenUsed = false;
// The thread used to read the text from the stream
- Thread textConsumputionThread;
+ private Thread textConsumputionThread;
// The input stream for text
private InputStream inputStream;
*
* @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
*/
+@FunctionalInterface
public interface ApexEventListener {
/**
* @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com), John Keeney
* (john.keeney@ericsson.com)
*/
+@FunctionalInterface
public interface EngineServiceEventInterface {
/**
* This method forwards an event to the APEX engine.
final AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(PACKAGE)
.setDefaultLogic("EvalTask_Logic");
- final AxTask obTask = new AxTask(new AxArtifactKey("Task_Observe_0", "0.0.1"));
+ final AxTask obTask = new AxTask(new AxArtifactKey("Task_Observe_0", DEFAULT_VERSION));
obTask.duplicateInputFields(event0000.getParameterMap());
obTask.duplicateOutputFields(event0001.getParameterMap());
final AxTaskLogic obAxLogic = new AxTaskLogic(obTask.getKey(), TASK_LOGIC,
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.Map;
-import java.util.TreeSet;
+import java.util.SortedSet;
import org.junit.BeforeClass;
import org.junit.Rule;
final String hazelCastfileLocation = ResourceUtils.getFilePath4Resource(HAZELCAST_XML_FILE);
System.setProperty(HAZELCAST_CONFIG, hazelCastfileLocation);
- final TreeSet<String> ipAddressSet = NetworkUtils.getIPv4NonLoopAddresses();
+ final SortedSet<String> ipAddressSet = NetworkUtils.getIPv4NonLoopAddresses();
if (ipAddressSet.size() == 0) {
throw new Exception("cound not find real IP address for test");
contextParameters.getPersistorParameters().setName(ContextParameterConstants.PERSISTENCE_GROUP_NAME);
ParameterService.register(contextParameters, true);
- ParameterService.register(contextParameters.getDistributorParameters());
- ParameterService.register(contextParameters.getLockManagerParameters());
- ParameterService.register(contextParameters.getPersistorParameters());
+ ParameterService.register(contextParameters.getDistributorParameters(), true);
+ ParameterService.register(contextParameters.getLockManagerParameters(), true);
+ ParameterService.register(contextParameters.getPersistorParameters(), true);
engineServiceParameters = new EngineServiceParameters();
engineServiceParameters.setName("EngDepMessagingTest");
engineServiceParameters.getEngineParameters().getExecutorParameterMap().put("MVEL",
new MvelExecutorParameters());
- ParameterService.register(engineServiceParameters);
- ParameterService.register(engineServiceParameters.getEngineParameters());
+ ParameterService.register(engineServiceParameters, true);
+ ParameterService.register(engineServiceParameters.getEngineParameters(), true);
}
/**
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
-import java.util.TreeSet;
+import java.util.SortedSet;
import org.junit.BeforeClass;
import org.junit.Rule;
final String hazelCastfileLocation = ResourceUtils.getFilePath4Resource(HAZELCAST_XML_FILE);
System.setProperty(HAZELCAST_CONFIG, hazelCastfileLocation);
- final TreeSet<String> ipAddressSet = NetworkUtils.getIPv4NonLoopAddresses();
+ final SortedSet<String> ipAddressSet = NetworkUtils.getIPv4NonLoopAddresses();
if (ipAddressSet.size() == 0) {
throw new Exception("cound not find real IP address for test");
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.StrBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.slf4j.ext.XLoggerFactory;
import org.slf4j.helpers.MessageFormatter;