/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2021 Nordix Foundation.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import org.onap.policy.apex.context.SchemaHelper;
import org.onap.policy.apex.context.impl.schema.SchemaHelperFactory;
import org.onap.policy.apex.model.basicmodel.service.ModelService;
import org.onap.policy.apex.model.eventmodel.concepts.AxEvent;
public void init(final EventProtocolParameters parameters) {
// Check and get the YAML parameters
if (!(parameters instanceof YamlEventProtocolParameters)) {
- final String errorMessage = "specified consumer properties are not applicable to the YAML event protocol";
+ final var errorMessage = "specified consumer properties are not applicable to the YAML event protocol";
throw new ApexEventRuntimeException(errorMessage);
}
throw new ApexEventException(errorMessage);
}
- final String yamlEventString = (String) eventObject;
+ final var yamlEventString = (String) eventObject;
// The list of events we will return
final List<ApexEvent> eventList = new ArrayList<>();
// Convert the YAML document string into an object
- Object yamlObject = new Yaml().load(yamlEventString);
+ var yamlObject = new Yaml().load(yamlEventString);
// If the incoming YAML did not create a map it is a primitive type or a collection so we
// convert it into a map for processing
}
// Use Snake YAML to convert the APEX event to YAML
- Yaml yaml = new Yaml();
+ var yaml = new Yaml();
return yaml.dumpAs(yamlMap, null, FlowStyle.BLOCK);
}
*/
private ApexEvent yamlMap2ApexEvent(final String eventName, final Map<?, ?> yamlMap) throws ApexEventException {
// Process the mandatory Apex header
- final ApexEvent apexEvent = processApexEventHeader(eventName, yamlMap);
+ final var apexEvent = processApexEventHeader(eventName, yamlMap);
// Get the event definition for the event from the model service
final AxEvent eventDefinition = ModelService.getModel(AxEvents.class).get(apexEvent.getName(),
if (fieldValue != null) {
// Get the schema helper
- final SchemaHelper fieldSchemaHelper = new SchemaHelperFactory().createSchemaHelper(eventField.getKey(),
+ final var fieldSchemaHelper = new SchemaHelperFactory().createSchemaHelper(eventField.getKey(),
eventField.getSchema());
apexEvent.put(fieldName, fieldSchemaHelper.createNewInstance(fieldValue));
} else {
*/
private ApexEvent processApexEventHeader(final String eventName, final Map<?, ?> yamlMap)
throws ApexEventException {
- String name = getYamlStringField(yamlMap, ApexEvent.NAME_HEADER_FIELD, yamlPars.getNameAlias(),
+ var name = getYamlStringField(yamlMap, ApexEvent.NAME_HEADER_FIELD, yamlPars.getNameAlias(),
ApexEvent.NAME_REGEXP, false);
// Check that an event name has been specified
// Now, find the event definition in the model service. If version is null, the newest event
// definition in the model service is used
- String version = getYamlStringField(yamlMap, ApexEvent.VERSION_HEADER_FIELD, yamlPars.getVersionAlias(),
+ var version = getYamlStringField(yamlMap, ApexEvent.VERSION_HEADER_FIELD, yamlPars.getVersionAlias(),
ApexEvent.VERSION_REGEXP, false);
final AxEvent eventDefinition = ModelService.getModel(AxEvents.class).get(name, version);
if (eventDefinition == null) {
*/
private String getEventHeaderNamespace(final Map<?, ?> yamlMap, String name, final AxEvent eventDefinition) {
// Check the name space is OK if it is defined, if not, use the name space from the model
- String namespace = getYamlStringField(yamlMap, ApexEvent.NAMESPACE_HEADER_FIELD, yamlPars.getNameSpaceAlias(),
+ var namespace = getYamlStringField(yamlMap, ApexEvent.NAMESPACE_HEADER_FIELD, yamlPars.getNameSpaceAlias(),
ApexEvent.NAMESPACE_REGEXP, false);
if (namespace != null) {
if (!namespace.equals(eventDefinition.getNameSpace())) {
*/
private String getEventHeaderSource(final Map<?, ?> yamlMap, final AxEvent eventDefinition) {
// For source, use the defined source only if the source is not found on the incoming event
- String source = getYamlStringField(yamlMap, ApexEvent.SOURCE_HEADER_FIELD, yamlPars.getSourceAlias(),
+ var source = getYamlStringField(yamlMap, ApexEvent.SOURCE_HEADER_FIELD, yamlPars.getSourceAlias(),
ApexEvent.SOURCE_REGEXP, false);
if (source == null) {
source = eventDefinition.getSource();
*/
private String getHeaderTarget(final Map<?, ?> yamlMap, final AxEvent eventDefinition) {
// For target, use the defined source only if the source is not found on the incoming event
- String target = getYamlStringField(yamlMap, ApexEvent.TARGET_HEADER_FIELD, yamlPars.getTargetAlias(),
+ var target = getYamlStringField(yamlMap, ApexEvent.TARGET_HEADER_FIELD, yamlPars.getTargetAlias(),
ApexEvent.TARGET_REGEXP, false);
if (target == null) {
target = eventDefinition.getTarget();
+ yamlField.getClass().getName() + "\" is not a string value");
}
- final String fieldValueString = (String) yamlField;
+ final var fieldValueString = (String) yamlField;
// Is regular expression checking required
if (fieldRegexp == null) {
/*-
* ============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.
* @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"));
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);
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,
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,
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,
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,
*/
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"));
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);
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,
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,
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,
/*-
* ============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.
*/
// 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);
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);
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);
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);
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");
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);
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);
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);
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);
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");
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);
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);
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);
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(),
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));
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);
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));
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,
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));
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));
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);
.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));
*/
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)