diff options
author | lapentafd <francesco.lapenta@est.tech> | 2021-06-25 14:52:51 +0100 |
---|---|---|
committer | lapentafd <francesco.lapenta@est.tech> | 2021-06-25 14:52:56 +0100 |
commit | 53d0f13eaaaa05184f5f410a23ba52fa091d8081 (patch) | |
tree | daad329a36e6b44f85eeb55999023b574407ce47 /testsuites | |
parent | 93c3d0aa9be2d5cd8ce935730a23f268fa2d2069 (diff) |
Fix sonar issues in apex plugins and testsuites
Replacing local-variable type inference
Issue-ID: POLICY-3093
Change-Id: I715231d6cf71d13c87b260b9f903910f9a5c434f
Signed-off-by: lapentafd <francesco.lapenta@est.tech>
Diffstat (limited to 'testsuites')
4 files changed, 117 insertions, 116 deletions
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java index 20c7446d4..d25bea3a4 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -211,42 +211,42 @@ public class EvalDomainModelFactory { * @return the sample policy model */ public AxPolicyModel getOodaPolicyModel() { - final AxTasks tasks = new AxTasks(new AxArtifactKey("Tasks", DEFAULT_VERSION)); + final var tasks = new AxTasks(new AxArtifactKey("Tasks", DEFAULT_VERSION)); final AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(PACKAGE) .setDefaultLogic("EvalTaskLogic"); - final AxTask obTask = new AxTask(new AxArtifactKey("Task_Observe_0", DEFAULT_VERSION)); + final var 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, + final var obAxLogic = new AxTaskLogic(obTask.getKey(), TASK_LOGIC, (justOneLang == null ? JAVASCRIPT : justOneLang), logicReader); obAxLogic.setLogic(obAxLogic.getLogic().replace(STATE_NAME, OBSERVE) .replace(TASK_NAME, obTask.getKey().getName()).replace(STATE_NUMBER, "1")); obTask.setTaskLogic(obAxLogic); - final AxTask orTask = new AxTask(new AxArtifactKey("Task_Orient_0", DEFAULT_VERSION)); + final var orTask = new AxTask(new AxArtifactKey("Task_Orient_0", DEFAULT_VERSION)); orTask.duplicateInputFields(event0001.getParameterMap()); orTask.duplicateOutputFields(event0002.getParameterMap()); - final AxTaskLogic orAxLogic = new AxTaskLogic(orTask.getKey(), TASK_LOGIC, + final var orAxLogic = new AxTaskLogic(orTask.getKey(), TASK_LOGIC, (justOneLang == null ? JAVASCRIPT : justOneLang), logicReader); orAxLogic.setLogic(orAxLogic.getLogic().replace(STATE_NAME, ORIENT) .replace(TASK_NAME, orTask.getKey().getName()).replace(STATE_NUMBER, "2")); orTask.setTaskLogic(orAxLogic); - final AxTask dTask = new AxTask(new AxArtifactKey("Task_Decide_0", DEFAULT_VERSION)); + final var dTask = new AxTask(new AxArtifactKey("Task_Decide_0", DEFAULT_VERSION)); dTask.duplicateInputFields(event0002.getParameterMap()); dTask.duplicateOutputFields(event0003.getParameterMap()); - final AxTaskLogic dAxLogic = new AxTaskLogic(dTask.getKey(), TASK_LOGIC, + final var dAxLogic = new AxTaskLogic(dTask.getKey(), TASK_LOGIC, (justOneLang == null ? MVEL : justOneLang), logicReader); dAxLogic.setLogic(dAxLogic.getLogic().replace(STATE_NAME, ORIENT) .replace(TASK_NAME, dTask.getKey().getName()).replace(STATE_NUMBER, "3")); dTask.setTaskLogic(dAxLogic); - final AxTask aTask = new AxTask(new AxArtifactKey("Task_Act_0", DEFAULT_VERSION)); + final var aTask = new AxTask(new AxArtifactKey("Task_Act_0", DEFAULT_VERSION)); aTask.duplicateInputFields(event0003.getParameterMap()); aTask.duplicateOutputFields(event0004.getParameterMap()); - final AxTaskLogic aAxLogic = new AxTaskLogic(aTask.getKey(), TASK_LOGIC, + final var aAxLogic = new AxTaskLogic(aTask.getKey(), TASK_LOGIC, (justOneLang == null ? "JAVA" : justOneLang), logicReader); aAxLogic.setLogic(aAxLogic.getLogic().replace(STATE_NAME, "Act") .replace(TASK_NAME, aTask.getKey().getName()).replace(STATE_NUMBER, "4")); @@ -288,19 +288,19 @@ public class EvalDomainModelFactory { p0defaultTaskList.add(tasks.get("Task_Decide_0").getKey()); p0defaultTaskList.add(tasks.get("Task_Act_0").getKey()); - final AxPolicy policy0 = new AxPolicy(new AxArtifactKey("OODAPolicy_0", DEFAULT_VERSION)); + final var policy0 = new AxPolicy(new AxArtifactKey("OODAPolicy_0", DEFAULT_VERSION)); final List<String> axLogicExecutorTypeList = initAxLogicExecutorTypeList(justOneLang); policy0.setStateMap(getOodaStateMap(policy0.getKey(), p0InEventList, p0OutEventList, axLogicExecutorTypeList, p0defaultTaskList, taskReferenceList)); policy0.setFirstState(policy0.getStateMap().get(OBSERVE).getKey().getLocalName()); - final AxPolicies policies = new AxPolicies(new AxArtifactKey("OODAPolicies", DEFAULT_VERSION)); + final var policies = new AxPolicies(new AxArtifactKey("OODAPolicies", DEFAULT_VERSION)); policies.getPolicyMap().put(policy0.getKey(), policy0); - final AxKeyInformation keyInformation = new AxKeyInformation( + final var keyInformation = new AxKeyInformation( new AxArtifactKey("KeyInformation", DEFAULT_VERSION)); - final AxPolicyModel policyModel = new AxPolicyModel( + final var policyModel = new AxPolicyModel( new AxArtifactKey("EvaluationPolicyModel_OODA", DEFAULT_VERSION)); policyModel.setPolicies(policies); policyModel.setEvents(events); @@ -382,9 +382,9 @@ public class EvalDomainModelFactory { final AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(PACKAGE) .setDefaultLogic("EvalStateLogic"); - final AxState actState = new AxState(new AxReferenceKey(policyKey, "Act")); + final var actState = new AxState(new AxReferenceKey(policyKey, "Act")); actState.setTrigger(inEventKeyList.get(THIRD_MEMBER)); - final AxStateOutput act2Out = new AxStateOutput(new AxReferenceKey(actState.getKey(), "Act2Out"), + final var act2Out = new AxStateOutput(new AxReferenceKey(actState.getKey(), "Act2Out"), outEventKeyList.get(THIRD_MEMBER), AxReferenceKey.getNullKey()); actState.getStateOutputs().put(act2Out.getKey().getLocalName(), act2Out); actState.setTaskSelectionLogic(new AxTaskSelectionLogic(actState.getKey(), TASK_SELECTION_LOGIC, @@ -396,9 +396,9 @@ public class EvalDomainModelFactory { AxStateTaskOutputType.DIRECT, act2Out.getKey())); } - final AxState decState = new AxState(new AxReferenceKey(policyKey, "Decide")); + final var decState = new AxState(new AxReferenceKey(policyKey, "Decide")); decState.setTrigger(inEventKeyList.get(2)); - final AxStateOutput dec2Act = new AxStateOutput(new AxReferenceKey(decState.getKey(), "Dec2Act"), + final var dec2Act = new AxStateOutput(new AxReferenceKey(decState.getKey(), "Dec2Act"), outEventKeyList.get(2), actState.getKey()); decState.getStateOutputs().put(dec2Act.getKey().getLocalName(), dec2Act); decState.setTaskSelectionLogic(new AxTaskSelectionLogic(decState.getKey(), TASK_SELECTION_LOGIC, @@ -410,9 +410,9 @@ public class EvalDomainModelFactory { AxStateTaskOutputType.DIRECT, dec2Act.getKey())); } - final AxState orState = new AxState(new AxReferenceKey(policyKey, ORIENT)); + final var orState = new AxState(new AxReferenceKey(policyKey, ORIENT)); orState.setTrigger(inEventKeyList.get(1)); - final AxStateOutput or2Dec = new AxStateOutput(new AxReferenceKey(orState.getKey(), "Or2Dec"), + final var or2Dec = new AxStateOutput(new AxReferenceKey(orState.getKey(), "Or2Dec"), outEventKeyList.get(1), decState.getKey()); orState.getStateOutputs().put(or2Dec.getKey().getLocalName(), or2Dec); orState.setTaskSelectionLogic(new AxTaskSelectionLogic(orState.getKey(), TASK_SELECTION_LOGIC, @@ -424,9 +424,9 @@ public class EvalDomainModelFactory { AxStateTaskOutputType.DIRECT, or2Dec.getKey())); } - final AxState obState = new AxState(new AxReferenceKey(policyKey, OBSERVE)); + final var obState = new AxState(new AxReferenceKey(policyKey, OBSERVE)); obState.setTrigger(inEventKeyList.get(0)); - final AxStateOutput ob2Or = new AxStateOutput(new AxReferenceKey(obState.getKey(), "Ob2Or"), + final var ob2Or = new AxStateOutput(new AxReferenceKey(obState.getKey(), "Ob2Or"), outEventKeyList.get(0), orState.getKey()); obState.getStateOutputs().put(ob2Or.getKey().getLocalName(), ob2Or); obState.setTaskSelectionLogic(new AxTaskSelectionLogic(obState.getKey(), TASK_SELECTION_LOGIC, @@ -454,33 +454,33 @@ public class EvalDomainModelFactory { */ public AxPolicyModel getEcaPolicyModel() { - final AxTasks tasks = new AxTasks(new AxArtifactKey("Tasks", DEFAULT_VERSION)); + final var tasks = new AxTasks(new AxArtifactKey("Tasks", DEFAULT_VERSION)); final AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(PACKAGE) .setDefaultLogic("EvalTaskLogic"); - final AxTask eTask = new AxTask(new AxArtifactKey("Task_Event_0", DEFAULT_VERSION)); + final var eTask = new AxTask(new AxArtifactKey("Task_Event_0", DEFAULT_VERSION)); eTask.duplicateInputFields(event0000.getParameterMap()); eTask.duplicateOutputFields(event0001.getParameterMap()); - final AxTaskLogic eAxLogic = new AxTaskLogic(eTask.getKey(), TASK_LOGIC, + final var eAxLogic = new AxTaskLogic(eTask.getKey(), TASK_LOGIC, (justOneLang == null ? JYTHON : justOneLang), logicReader); eAxLogic.setLogic(eAxLogic.getLogic().replace(STATE_NAME, EVENT) .replace(TASK_NAME, eTask.getKey().getName()).replace(STATE_NUMBER, "1")); eTask.setTaskLogic(eAxLogic); - final AxTask cTask = new AxTask(new AxArtifactKey("Task_Condition_0", DEFAULT_VERSION)); + final var cTask = new AxTask(new AxArtifactKey("Task_Condition_0", DEFAULT_VERSION)); cTask.duplicateInputFields(event0001.getParameterMap()); cTask.duplicateOutputFields(event0002.getParameterMap()); - final AxTaskLogic cAxLogic = new AxTaskLogic(cTask.getKey(), TASK_LOGIC, + final var cAxLogic = new AxTaskLogic(cTask.getKey(), TASK_LOGIC, (justOneLang == null ? JAVASCRIPT : justOneLang), logicReader); cAxLogic.setLogic(cAxLogic.getLogic().replace(STATE_NAME, CONDITION) .replace(TASK_NAME, cTask.getKey().getName()).replace(STATE_NUMBER, "2")); cTask.setTaskLogic(cAxLogic); - final AxTask aTask = new AxTask(new AxArtifactKey("Task_Action_0", DEFAULT_VERSION)); + final var aTask = new AxTask(new AxArtifactKey("Task_Action_0", DEFAULT_VERSION)); aTask.duplicateInputFields(event0002.getParameterMap()); aTask.duplicateOutputFields(event0003.getParameterMap()); - final AxTaskLogic aAxLogic = new AxTaskLogic(aTask.getKey(), TASK_LOGIC, + final var aAxLogic = new AxTaskLogic(aTask.getKey(), TASK_LOGIC, (justOneLang == null ? "JAVA" : justOneLang), logicReader); aAxLogic.setLogic(aAxLogic.getLogic().replace(STATE_NAME, ACTION) .replace(TASK_NAME, aTask.getKey().getName()).replace(STATE_NUMBER, "3")); @@ -515,19 +515,19 @@ public class EvalDomainModelFactory { p0defaultTaskList.add(tasks.get("Task_Condition_0").getKey()); p0defaultTaskList.add(tasks.get("Task_Action_0").getKey()); - final AxPolicy policy0 = new AxPolicy(new AxArtifactKey("ECAPolicy_0", DEFAULT_VERSION)); + final var policy0 = new AxPolicy(new AxArtifactKey("ECAPolicy_0", DEFAULT_VERSION)); final List<String> axLogicExecutorTypeList = Arrays.asList((justOneLang == null ? JAVASCRIPT : justOneLang), (justOneLang == null ? MVEL : justOneLang), (justOneLang == null ? JYTHON : justOneLang)); policy0.setStateMap(getEcaStateMap(policy0.getKey(), p0InEventList, p0OutEventList, axLogicExecutorTypeList, p0defaultTaskList, taskReferenceList)); policy0.setFirstState(policy0.getStateMap().get(EVENT).getKey().getLocalName()); - final AxPolicies policies = new AxPolicies(new AxArtifactKey("ECAPolicies", DEFAULT_VERSION)); + final var policies = new AxPolicies(new AxArtifactKey("ECAPolicies", DEFAULT_VERSION)); policies.getPolicyMap().put(policy0.getKey(), policy0); - final AxKeyInformation keyInformation = new AxKeyInformation( + final var keyInformation = new AxKeyInformation( new AxArtifactKey("KeyInformation", DEFAULT_VERSION)); - final AxPolicyModel policyModel = new AxPolicyModel( + final var policyModel = new AxPolicyModel( new AxArtifactKey("EvaluationPolicyModel_ECA", DEFAULT_VERSION)); policyModel.setPolicies(policies); policyModel.setEvents(events); @@ -584,9 +584,9 @@ public class EvalDomainModelFactory { final AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(PACKAGE) .setDefaultLogic("EvalStateLogic"); - final AxState actionState = new AxState(new AxReferenceKey(policyKey, ACTION)); + final var actionState = new AxState(new AxReferenceKey(policyKey, ACTION)); actionState.setTrigger(inEventKeyList.get(2)); - final AxStateOutput action2Out = new AxStateOutput(actionState.getKey(), AxReferenceKey.getNullKey(), + final var action2Out = new AxStateOutput(actionState.getKey(), AxReferenceKey.getNullKey(), outEventKeyList.get(2)); actionState.getStateOutputs().put(action2Out.getKey().getLocalName(), action2Out); actionState.setTaskSelectionLogic(new AxTaskSelectionLogic(actionState.getKey(), TASK_SELECTION_LOGIC, @@ -598,9 +598,9 @@ public class EvalDomainModelFactory { AxStateTaskOutputType.DIRECT, action2Out.getKey())); } - final AxState conditionState = new AxState(new AxReferenceKey(policyKey, CONDITION)); + final var conditionState = new AxState(new AxReferenceKey(policyKey, CONDITION)); conditionState.setTrigger(inEventKeyList.get(1)); - final AxStateOutput condition2Action = new AxStateOutput(conditionState.getKey(), actionState.getKey(), + final var condition2Action = new AxStateOutput(conditionState.getKey(), actionState.getKey(), outEventKeyList.get(1)); conditionState.getStateOutputs().put(condition2Action.getKey().getLocalName(), condition2Action); conditionState.setTaskSelectionLogic(new AxTaskSelectionLogic(conditionState.getKey(), TASK_SELECTION_LOGIC, @@ -612,9 +612,9 @@ public class EvalDomainModelFactory { AxStateTaskOutputType.DIRECT, condition2Action.getKey())); } - final AxState eventState = new AxState(new AxReferenceKey(policyKey, EVENT)); + final var eventState = new AxState(new AxReferenceKey(policyKey, EVENT)); eventState.setTrigger(inEventKeyList.get(0)); - final AxStateOutput event2Condition = new AxStateOutput(eventState.getKey(), conditionState.getKey(), + final var event2Condition = new AxStateOutput(eventState.getKey(), conditionState.getKey(), outEventKeyList.get(0)); eventState.getStateOutputs().put(event2Condition.getKey().getLocalName(), event2Condition); eventState.setTaskSelectionLogic(new AxTaskSelectionLogic(eventState.getKey(), TASK_SELECTION_LOGIC, diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelFactory.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelFactory.java index 18ef33ae1..c32dbcf4f 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelFactory.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelFactory.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -98,66 +98,66 @@ public class SampleDomainModelFactory { */ // CHECKSTYLE:OFF: checkstyle:maximumMethodLength public AxPolicyModel getSamplePolicyModel(final String axLogicExecutorType) { - AxContextSchema testSlogan = new AxContextSchema(new AxArtifactKey(TEST_SLOGAN, DEFAULT_VERSION), "Java", + var testSlogan = new AxContextSchema(new AxArtifactKey(TEST_SLOGAN, DEFAULT_VERSION), "Java", "java.lang.String"); - AxContextSchema testCase = new AxContextSchema(new AxArtifactKey("TestCase", DEFAULT_VERSION), "Java", + var testCase = new AxContextSchema(new AxArtifactKey("TestCase", DEFAULT_VERSION), "Java", "java.lang.Byte"); - AxContextSchema testTimestamp = new AxContextSchema(new AxArtifactKey(TEST_TIMESTAMP, DEFAULT_VERSION), "Java", + var testTimestamp = new AxContextSchema(new AxArtifactKey(TEST_TIMESTAMP, DEFAULT_VERSION), "Java", "java.lang.Long"); - AxContextSchema testTemperature = new AxContextSchema(new AxArtifactKey(TEST_TEMPERATURE, DEFAULT_VERSION), + var testTemperature = new AxContextSchema(new AxArtifactKey(TEST_TEMPERATURE, DEFAULT_VERSION), "Java", "java.lang.Double"); - AxContextSchema testContextItem000 = new AxContextSchema( + var testContextItem000 = new AxContextSchema( new AxArtifactKey("TestContextItem000", DEFAULT_VERSION), "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem000"); - AxContextSchema testContextItem001 = new AxContextSchema( + var testContextItem001 = new AxContextSchema( new AxArtifactKey("TestContextItem001", DEFAULT_VERSION), "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem001"); - AxContextSchema testContextItem002 = new AxContextSchema( + var testContextItem002 = new AxContextSchema( new AxArtifactKey("TestContextItem002", DEFAULT_VERSION), "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem002"); - AxContextSchema testContextItem003 = new AxContextSchema( + var testContextItem003 = new AxContextSchema( new AxArtifactKey("TestContextItem003", DEFAULT_VERSION), "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem003"); - AxContextSchema testContextItem004 = new AxContextSchema( + var testContextItem004 = new AxContextSchema( new AxArtifactKey("TestContextItem004", DEFAULT_VERSION), "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem004"); - AxContextSchema testContextItem005 = new AxContextSchema( + var testContextItem005 = new AxContextSchema( new AxArtifactKey("TestContextItem005", DEFAULT_VERSION), "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem005"); - AxContextSchema testContextItem006 = new AxContextSchema( + var testContextItem006 = new AxContextSchema( new AxArtifactKey("TestContextItem006", DEFAULT_VERSION), "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem006"); - AxContextSchema testContextItem007 = new AxContextSchema( + var testContextItem007 = new AxContextSchema( new AxArtifactKey("TestContextItem007", DEFAULT_VERSION), "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem007"); - AxContextSchema testContextItem008 = new AxContextSchema( + var testContextItem008 = new AxContextSchema( new AxArtifactKey("TestContextItem008", DEFAULT_VERSION), "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem008"); - AxContextSchema testContextItem009 = new AxContextSchema( + var testContextItem009 = new AxContextSchema( new AxArtifactKey("TestContextItem009", DEFAULT_VERSION), "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem009"); - AxContextSchema testContextItem00A = new AxContextSchema( + var testContextItem00A = new AxContextSchema( new AxArtifactKey("TestContextItem00A", DEFAULT_VERSION), "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem00A"); - AxContextSchema testContextItem00B = new AxContextSchema( + var testContextItem00B = new AxContextSchema( new AxArtifactKey("TestContextItem00B", DEFAULT_VERSION), "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem00B"); - AxContextSchema testContextItem00C = new AxContextSchema( + var testContextItem00C = new AxContextSchema( new AxArtifactKey("TestContextItem00C", DEFAULT_VERSION), "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem00C"); - AxContextSchema testPolicyContextItem = new AxContextSchema( + var testPolicyContextItem = new AxContextSchema( new AxArtifactKey("TestPolicyContextItem", DEFAULT_VERSION), "Java", "org.onap.policy.apex.context.test.concepts.TestPolicyContextItem"); - AxContextSchema testGlobalContextItem = new AxContextSchema( + var testGlobalContextItem = new AxContextSchema( new AxArtifactKey("TestGlobalContextItem", DEFAULT_VERSION), "Java", "org.onap.policy.apex.context.test.concepts.TestGlobalContextItem"); - AxContextSchema testExternalContextItem = new AxContextSchema( + var testExternalContextItem = new AxContextSchema( new AxArtifactKey("TestExternalContextItem", DEFAULT_VERSION), "Java", "org.onap.policy.apex.context.test.concepts.TestExternalContextItem"); - AxContextSchemas axContextSchemas = new AxContextSchemas(new AxArtifactKey("TestDatatypes", DEFAULT_VERSION)); + var axContextSchemas = new AxContextSchemas(new AxArtifactKey("TestDatatypes", DEFAULT_VERSION)); axContextSchemas.getSchemasMap().put(testSlogan.getKey(), testSlogan); axContextSchemas.getSchemasMap().put(testCase.getKey(), testCase); axContextSchemas.getSchemasMap().put(testTimestamp.getKey(), testTimestamp); @@ -181,7 +181,7 @@ public class SampleDomainModelFactory { axContextSchemas.getSchemasMap().put(testGlobalContextItem.getKey(), testGlobalContextItem); axContextSchemas.getSchemasMap().put(testExternalContextItem.getKey(), testExternalContextItem); - AxEvent event0000 = new AxEvent(new AxArtifactKey("Event0000", DEFAULT_VERSION), + var event0000 = new AxEvent(new AxArtifactKey("Event0000", DEFAULT_VERSION), DEFAULT_NAMESPACE); event0000.setSource(DEFAULT_SOURCE); event0000.setTarget(MATCH); @@ -194,7 +194,7 @@ public class SampleDomainModelFactory { event0000.getParameterMap().put(TEST_TEMPERATURE, new AxField( new AxReferenceKey(event0000.getKey(), TEST_TEMPERATURE), testTemperature.getKey())); - AxEvent event0001 = new AxEvent(new AxArtifactKey("Event0001", DEFAULT_VERSION), + var event0001 = new AxEvent(new AxArtifactKey("Event0001", DEFAULT_VERSION), DEFAULT_NAMESPACE); event0001.setSource(MATCH); event0001.setTarget(ESTABLISH); @@ -211,7 +211,7 @@ public class SampleDomainModelFactory { event0001.getParameterMap().put(TEST_MATCH_STATE_TIME, new AxField( new AxReferenceKey(event0001.getKey(), TEST_MATCH_STATE_TIME), testTimestamp.getKey())); - AxEvent event0002 = new AxEvent(new AxArtifactKey("Event0002", DEFAULT_VERSION), + var event0002 = new AxEvent(new AxArtifactKey("Event0002", DEFAULT_VERSION), DEFAULT_NAMESPACE); event0002.setSource(ESTABLISH); event0002.setTarget(DECIDE); @@ -232,7 +232,7 @@ public class SampleDomainModelFactory { event0002.getParameterMap().put(TEST_ESTABLISH_STATE_TIME, new AxField( new AxReferenceKey(event0002.getKey(), TEST_ESTABLISH_STATE_TIME), testTimestamp.getKey())); - AxEvent event0003 = new AxEvent(new AxArtifactKey("Event0003", DEFAULT_VERSION), + var event0003 = new AxEvent(new AxArtifactKey("Event0003", DEFAULT_VERSION), DEFAULT_NAMESPACE); event0003.setSource(DECIDE); event0003.setTarget("Act"); @@ -257,7 +257,7 @@ public class SampleDomainModelFactory { event0003.getParameterMap().put(TEST_DECIDE_STATE_TIME, new AxField( new AxReferenceKey(event0003.getKey(), TEST_DECIDE_STATE_TIME), testTimestamp.getKey())); - AxEvent event0004 = new AxEvent(new AxArtifactKey("Event0004", DEFAULT_VERSION), + var event0004 = new AxEvent(new AxArtifactKey("Event0004", DEFAULT_VERSION), DEFAULT_NAMESPACE); event0004.setSource("Act"); event0004.setTarget(DEFAULT_SOURCE); @@ -286,7 +286,7 @@ public class SampleDomainModelFactory { event0004.getParameterMap().put(TEST_ACT_STATE_TIME, new AxField( new AxReferenceKey(event0004.getKey(), TEST_ACT_STATE_TIME), testTimestamp.getKey())); - AxEvent event0100 = new AxEvent(new AxArtifactKey("Event0100", DEFAULT_VERSION), + var event0100 = new AxEvent(new AxArtifactKey("Event0100", DEFAULT_VERSION), DEFAULT_NAMESPACE); event0100.setSource(DEFAULT_SOURCE); event0100.setTarget(MATCH); @@ -299,7 +299,7 @@ public class SampleDomainModelFactory { event0100.getParameterMap().put(TEST_TEMPERATURE, new AxField( new AxReferenceKey(event0100.getKey(), TEST_TEMPERATURE), testTemperature.getKey())); - AxEvent event0101 = new AxEvent(new AxArtifactKey("Event0101", DEFAULT_VERSION), + var event0101 = new AxEvent(new AxArtifactKey("Event0101", DEFAULT_VERSION), DEFAULT_NAMESPACE); event0101.setSource(MATCH); event0101.setTarget(ESTABLISH); @@ -316,7 +316,7 @@ public class SampleDomainModelFactory { event0101.getParameterMap().put(TEST_MATCH_STATE_TIME, new AxField( new AxReferenceKey(event0101.getKey(), TEST_MATCH_STATE_TIME), testTimestamp.getKey())); - AxEvent event0102 = new AxEvent(new AxArtifactKey("Event0102", DEFAULT_VERSION), + var event0102 = new AxEvent(new AxArtifactKey("Event0102", DEFAULT_VERSION), DEFAULT_NAMESPACE); event0102.setSource(ESTABLISH); event0102.setTarget(DECIDE); @@ -337,7 +337,7 @@ public class SampleDomainModelFactory { event0102.getParameterMap().put(TEST_ESTABLISH_STATE_TIME, new AxField( new AxReferenceKey(event0102.getKey(), TEST_ESTABLISH_STATE_TIME), testTimestamp.getKey())); - AxEvent event0103 = new AxEvent(new AxArtifactKey("Event0103", DEFAULT_VERSION), + var event0103 = new AxEvent(new AxArtifactKey("Event0103", DEFAULT_VERSION), DEFAULT_NAMESPACE); event0103.setSource(DECIDE); event0103.setTarget("Act"); @@ -362,7 +362,7 @@ public class SampleDomainModelFactory { event0103.getParameterMap().put(TEST_DECIDE_STATE_TIME, new AxField( new AxReferenceKey(event0103.getKey(), TEST_DECIDE_STATE_TIME), testTimestamp.getKey())); - AxEvent event0104 = new AxEvent(new AxArtifactKey("Event0104", DEFAULT_VERSION), + var event0104 = new AxEvent(new AxArtifactKey("Event0104", DEFAULT_VERSION), DEFAULT_NAMESPACE); event0104.setSource("Act"); event0104.setTarget(DEFAULT_SOURCE); @@ -391,7 +391,7 @@ public class SampleDomainModelFactory { event0104.getParameterMap().put(TEST_ACT_STATE_TIME, new AxField( new AxReferenceKey(event0104.getKey(), TEST_ACT_STATE_TIME), testTimestamp.getKey())); - AxEvents events = new AxEvents(new AxArtifactKey("Events", DEFAULT_VERSION)); + var events = new AxEvents(new AxArtifactKey("Events", DEFAULT_VERSION)); events.getEventMap().put(event0000.getKey(), event0000); events.getEventMap().put(event0001.getKey(), event0001); events.getEventMap().put(event0002.getKey(), event0002); @@ -403,19 +403,19 @@ public class SampleDomainModelFactory { events.getEventMap().put(event0103.getKey(), event0103); events.getEventMap().put(event0104.getKey(), event0104); - AxContextAlbum externalContextAlbum = new AxContextAlbum( + var externalContextAlbum = new AxContextAlbum( new AxArtifactKey("ExternalContextAlbum", DEFAULT_VERSION), "EXTERNAL", false, testExternalContextItem.getKey()); - AxContextAlbum globalContextAlbum = new AxContextAlbum(new AxArtifactKey("GlobalContextAlbum", DEFAULT_VERSION), + var globalContextAlbum = new AxContextAlbum(new AxArtifactKey("GlobalContextAlbum", DEFAULT_VERSION), "GLOBAL", true, testGlobalContextItem.getKey()); - AxContextAlbum policy0ContextAlbum = new AxContextAlbum( + var policy0ContextAlbum = new AxContextAlbum( new AxArtifactKey("Policy0ContextAlbum", DEFAULT_VERSION), "APPLICATION", true, testPolicyContextItem.getKey()); - AxContextAlbum policy1ContextAlbum = new AxContextAlbum( + var policy1ContextAlbum = new AxContextAlbum( new AxArtifactKey("Policy1ContextAlbum", DEFAULT_VERSION), "APPLICATION", true, testPolicyContextItem.getKey()); - AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("Context", DEFAULT_VERSION)); + var albums = new AxContextAlbums(new AxArtifactKey("Context", DEFAULT_VERSION)); albums.getAlbumsMap().put(externalContextAlbum.getKey(), externalContextAlbum); albums.getAlbumsMap().put(globalContextAlbum.getKey(), globalContextAlbum); albums.getAlbumsMap().put(policy0ContextAlbum.getKey(), policy0ContextAlbum); @@ -445,7 +445,7 @@ public class SampleDomainModelFactory { referenceKeySetList.add(referenceKeySet2); referenceKeySetList.add(referenceKeySet3); - AxTasks tasks = new AxTasks(new AxArtifactKey("Tasks", DEFAULT_VERSION)); + var tasks = new AxTasks(new AxArtifactKey("Tasks", DEFAULT_VERSION)); tasks.getTaskMap().putAll(getTaskMap(MATCH, event0000.getParameterMap(), event0001.getParameterMap(), referenceKeySetList, axLogicExecutorType)); tasks.getTaskMap().putAll(getTaskMap(ESTABLISH, event0001.getParameterMap(), event0002.getParameterMap(), @@ -538,7 +538,7 @@ public class SampleDomainModelFactory { p0ReferenceKeySetList.add(p0ReferenceKeySet2); p0ReferenceKeySetList.add(p0ReferenceKeySet3); - AxPolicy policy0 = new AxPolicy(new AxArtifactKey("Policy0", DEFAULT_VERSION)); + var policy0 = new AxPolicy(new AxArtifactKey("Policy0", DEFAULT_VERSION)); policy0.setTemplate("MEDA"); policy0.setStateMap(getStateMap(policy0.getKey(), p0InEventList, p0OutEventList, p0ReferenceKeySetList, axLogicExecutorType, p0defaultTaskList, taskReferenceList)); @@ -568,18 +568,18 @@ public class SampleDomainModelFactory { p1ReferenceKeySetList.add(p1ReferenceKeySet2); p1ReferenceKeySetList.add(p1ReferenceKeySet3); - AxPolicy policy1 = new AxPolicy(new AxArtifactKey("Policy1", DEFAULT_VERSION)); + var policy1 = new AxPolicy(new AxArtifactKey("Policy1", DEFAULT_VERSION)); policy1.setTemplate("MEDA"); policy1.setStateMap(getStateMap(policy1.getKey(), p1InEventList, p1OutEventList, p1ReferenceKeySetList, axLogicExecutorType, p1defaultTaskList, taskReferenceList)); policy1.setFirstState(policy1.getStateMap().get(MATCH).getKey().getLocalName()); - AxPolicies policies = new AxPolicies(new AxArtifactKey("Policies", DEFAULT_VERSION)); + var policies = new AxPolicies(new AxArtifactKey("Policies", DEFAULT_VERSION)); policies.getPolicyMap().put(policy0.getKey(), policy0); policies.getPolicyMap().put(policy1.getKey(), policy1); - AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInformation", DEFAULT_VERSION)); - AxPolicyModel policyModel = new AxPolicyModel( + var keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInformation", DEFAULT_VERSION)); + var policyModel = new AxPolicyModel( new AxArtifactKey("SamplePolicyModel" + axLogicExecutorType, DEFAULT_VERSION)); policyModel.setKeyInformation(keyInformation); policyModel.setPolicies(policies); @@ -613,9 +613,9 @@ public class SampleDomainModelFactory { final String axLogicExecutorType, final List<AxArtifactKey> defaultTaskList, final List<Set<AxArtifactKey>> taskKeySetList) { - AxState actState = new AxState(new AxReferenceKey(policyKey, "Act")); + var actState = new AxState(new AxReferenceKey(policyKey, "Act")); actState.setTrigger(inEventKeyList.get(3)); - AxStateOutput act2Out = new AxStateOutput(actState.getKey(), AxReferenceKey.getNullKey(), + var act2Out = new AxStateOutput(actState.getKey(), AxReferenceKey.getNullKey(), outEventKeyList.get(3)); actState.getStateOutputs().put(act2Out.getKey().getLocalName(), act2Out); actState.setContextAlbumReferences(referenceKeySetList.get(3)); @@ -630,9 +630,9 @@ public class SampleDomainModelFactory { AxStateTaskOutputType.DIRECT, act2Out.getKey())); } - AxState decideState = new AxState(new AxReferenceKey(policyKey, DECIDE)); + var decideState = new AxState(new AxReferenceKey(policyKey, DECIDE)); decideState.setTrigger(inEventKeyList.get(2)); - AxStateOutput decide2Act = new AxStateOutput(decideState.getKey(), actState.getKey(), outEventKeyList.get(2)); + var decide2Act = new AxStateOutput(decideState.getKey(), actState.getKey(), outEventKeyList.get(2)); decideState.getStateOutputs().put(decide2Act.getKey().getLocalName(), decide2Act); decideState.setContextAlbumReferences(referenceKeySetList.get(2)); decideState.setTaskSelectionLogic(new AxTaskSelectionLogic(decideState.getKey(), TASK_SELECTION_LIGIC, @@ -643,9 +643,9 @@ public class SampleDomainModelFactory { AxStateTaskOutputType.DIRECT, decide2Act.getKey())); } - AxState establishState = new AxState(new AxReferenceKey(policyKey, ESTABLISH)); + var establishState = new AxState(new AxReferenceKey(policyKey, ESTABLISH)); establishState.setTrigger(inEventKeyList.get(1)); - AxStateOutput establish2Decide = new AxStateOutput(establishState.getKey(), decideState.getKey(), + var establish2Decide = new AxStateOutput(establishState.getKey(), decideState.getKey(), outEventKeyList.get(1)); establishState.getStateOutputs().put(establish2Decide.getKey().getLocalName(), establish2Decide); establishState.setContextAlbumReferences(referenceKeySetList.get(1)); @@ -657,9 +657,9 @@ public class SampleDomainModelFactory { AxStateTaskOutputType.DIRECT, establish2Decide.getKey())); } - AxState matchState = new AxState(new AxReferenceKey(policyKey, MATCH)); + var matchState = new AxState(new AxReferenceKey(policyKey, MATCH)); matchState.setTrigger(inEventKeyList.get(0)); - AxStateOutput match2Establish = new AxStateOutput(matchState.getKey(), establishState.getKey(), + var match2Establish = new AxStateOutput(matchState.getKey(), establishState.getKey(), outEventKeyList.get(0)); matchState.getStateOutputs().put(match2Establish.getKey().getLocalName(), match2Establish); matchState.setContextAlbumReferences(referenceKeySetList.get(0)); @@ -695,14 +695,14 @@ public class SampleDomainModelFactory { final Map<String, AxField> outputFields, final List<Set<AxArtifactKey>> referenceKeySetList, final String axLogicExecutorType) { - AxTask testTask0 = new AxTask(new AxArtifactKey(TASK + state + "0", DEFAULT_VERSION)); + var testTask0 = new AxTask(new AxArtifactKey(TASK + state + "0", DEFAULT_VERSION)); testTask0.duplicateInputFields(inputFields); testTask0.duplicateOutputFields(outputFields); - AxTaskParameter parameter00 = new AxTaskParameter(new AxReferenceKey(testTask0.getKey(), PARAMETER0), + var parameter00 = new AxTaskParameter(new AxReferenceKey(testTask0.getKey(), PARAMETER0), DEFAULT_VALUE0); - AxTaskParameter parameter01 = new AxTaskParameter(new AxReferenceKey(testTask0.getKey(), PARAMETER1), + var parameter01 = new AxTaskParameter(new AxReferenceKey(testTask0.getKey(), PARAMETER1), DEFAULT_VALUE1); - AxTaskParameter parameter02 = new AxTaskParameter(new AxReferenceKey(testTask0.getKey(), PARAMETER2), + var parameter02 = new AxTaskParameter(new AxReferenceKey(testTask0.getKey(), PARAMETER2), DEFAULT_VALUE2); testTask0.getTaskParameters().put(parameter00.getKey().getLocalName(), parameter00); testTask0.getTaskParameters().put(parameter01.getKey().getLocalName(), parameter01); @@ -713,31 +713,31 @@ public class SampleDomainModelFactory { .setDefaultLogic("DefaultTaskLogic"); testTask0.setTaskLogic(getTaskLogic(testTask0, logicReader, axLogicExecutorType, state, "2")); - AxTask testTask1 = new AxTask(new AxArtifactKey(TASK + state + "1", DEFAULT_VERSION)); + var testTask1 = new AxTask(new AxArtifactKey(TASK + state + "1", DEFAULT_VERSION)); testTask1.duplicateInputFields(inputFields); testTask1.duplicateOutputFields(outputFields); - AxTaskParameter parameter10 = new AxTaskParameter(new AxReferenceKey(testTask1.getKey(), PARAMETER0), + var parameter10 = new AxTaskParameter(new AxReferenceKey(testTask1.getKey(), PARAMETER0), DEFAULT_VALUE0); - AxTaskParameter parameter11 = new AxTaskParameter(new AxReferenceKey(testTask1.getKey(), PARAMETER1), + var parameter11 = new AxTaskParameter(new AxReferenceKey(testTask1.getKey(), PARAMETER1), DEFAULT_VALUE1); testTask1.getTaskParameters().put(parameter10.getKey().getLocalName(), parameter10); testTask1.getTaskParameters().put(parameter11.getKey().getLocalName(), parameter11); testTask1.setContextAlbumReferences(referenceKeySetList.get(1)); testTask1.setTaskLogic(getTaskLogic(testTask1, logicReader, axLogicExecutorType, state, "3")); - AxTask testTask2 = new AxTask(new AxArtifactKey(TASK + state + "2", DEFAULT_VERSION)); + var testTask2 = new AxTask(new AxArtifactKey(TASK + state + "2", DEFAULT_VERSION)); testTask2.duplicateInputFields(inputFields); testTask2.duplicateOutputFields(outputFields); - AxTaskParameter parameter20 = new AxTaskParameter(new AxReferenceKey(testTask2.getKey(), PARAMETER0), + var parameter20 = new AxTaskParameter(new AxReferenceKey(testTask2.getKey(), PARAMETER0), DEFAULT_VALUE0); testTask2.getTaskParameters().put(parameter20.getKey().getLocalName(), parameter20); testTask2.setContextAlbumReferences(referenceKeySetList.get(2)); testTask2.setTaskLogic(getTaskLogic(testTask2, logicReader, axLogicExecutorType, state, "0")); - AxTask testTask3 = new AxTask(new AxArtifactKey(TASK + state + "3", DEFAULT_VERSION)); + var testTask3 = new AxTask(new AxArtifactKey(TASK + state + "3", DEFAULT_VERSION)); testTask3.duplicateInputFields(inputFields); testTask3.duplicateOutputFields(outputFields); - AxTaskParameter parameter30 = new AxTaskParameter(new AxReferenceKey(testTask3.getKey(), PARAMETER0), + var parameter30 = new AxTaskParameter(new AxReferenceKey(testTask3.getKey(), PARAMETER0), DEFAULT_VALUE0); testTask3.getTaskParameters().put(parameter30.getKey().getLocalName(), parameter30); testTask3.setContextAlbumReferences(referenceKeySetList.get(THIRD_ENTRY)); @@ -764,7 +764,7 @@ public class SampleDomainModelFactory { */ private AxTaskLogic getTaskLogic(final AxTask task, final AxLogicReader logicReader, final String logicFlavour, final String stateName, final String caseToUse) { - AxTaskLogic axLogic = new AxTaskLogic(new AxReferenceKey(task.getKey(), "_TaskLogic"), logicFlavour, + var axLogic = new AxTaskLogic(new AxReferenceKey(task.getKey(), "_TaskLogic"), logicFlavour, logicReader); axLogic.setLogic(axLogic.getLogic().replace("<STATE_NAME>", stateName) diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java index dbd3d918f..7d1b160be 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -43,13 +43,13 @@ public class DefaultTaskLogic { * @return the event */ public boolean getEvent(final TaskExecutionContext executor) { - String idString = executor.subject.getId(); + var idString = executor.subject.getId(); executor.logger.debug(idString); - String albumNameString = executor.getContextAlbum("GlobalContextAlbum").getName(); + var albumNameString = executor.getContextAlbum("GlobalContextAlbum").getName(); executor.logger.debug(albumNameString); - String inFieldsString = executor.inFields.toString(); + var inFieldsString = executor.inFields.toString(); executor.logger.debug(inFieldsString); if (executor.inFields.containsKey("TestDecideCaseSelected")) { executor.outFields.put("TestActCaseSelected", (byte) rand.nextInt(BOUND_FOR_RANDOM_INT)); diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalTaskLogic.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalTaskLogic.java index f4c4945aa..a930b91c1 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalTaskLogic.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalTaskLogic.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 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========================================================= */ @@ -34,17 +35,17 @@ public class EvalTaskLogic { * @return the event */ public boolean getEvent(final TaskExecutionContext executor) { - String idString = executor.subject.getId(); + var idString = executor.subject.getId(); executor.logger.debug(idString); - - String inFieldString = executor.inFields.toString(); + + var inFieldString = executor.inFields.toString(); executor.logger.debug(inFieldString); - + executor.outFields.putAll(executor.inFields); executor.outFields.put("State3Timestamp", java.lang.System.nanoTime()); - - String outFieldString = executor.outFields.toString(); + + var outFieldString = executor.outFields.toString(); executor.logger.debug(outFieldString); return true; } |