diff options
author | liamfallon <liam.fallon@ericsson.com> | 2018-09-10 17:05:36 +0100 |
---|---|---|
committer | liamfallon <liam.fallon@ericsson.com> | 2018-09-10 17:07:47 +0100 |
commit | d100854291559df1426ea1e64351872ae2d3867b (patch) | |
tree | 78baab90111307cd3d2460b2cca37e93a20ac9a3 /model/policy-model/src/test/java | |
parent | 8f82d7adcb53b349e14d3b356bda03588a554f95 (diff) |
Checkstyle changes for apex model
Fix checkstyle warnings in the apex mode
and knock on changes.
Issue-ID: POLICY-1034
Change-Id: I10537e4288e9cad5ef18165ed2cdc1d3ab3139c1
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'model/policy-model/src/test/java')
14 files changed, 376 insertions, 307 deletions
diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestExceptions.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestExceptions.java index 9c7405b97..1fa3928b5 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestExceptions.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestExceptions.java @@ -30,6 +30,7 @@ import org.onap.policy.apex.model.policymodel.concepts.PolicyException; import org.onap.policy.apex.model.policymodel.concepts.PolicyRuntimeException; /** + * Test model exceptions. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestExceptions { diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestLogic.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestLogic.java index 3b1fc6b8f..710b360f9 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestLogic.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestLogic.java @@ -38,6 +38,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxTaskLogic; import org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic; /** + * Test apex logic. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestLogic { @@ -117,9 +119,8 @@ public class TestLogic { logic.setLogicFlavour(""); fail("test shold throw an exception here"); } catch (final Exception e) { - assertEquals( - "parameter \"logicFlavour\": value \"\", does not match regular expression \"[A-Za-z0-9\\-_]+\"", - e.getMessage()); + assertEquals("parameter \"logicFlavour\": value \"\", " + + "does not match regular expression \"[A-Za-z0-9\\-_]+\"", e.getMessage()); } logic.setLogicFlavour(AxLogic.LOGIC_FLAVOUR_UNDEFINED); @@ -152,9 +153,9 @@ public class TestLogic { logic.clean(); final AxLogic clonedLogic = new AxLogic(logic); - assertEquals( - "AxLogic:(key=AxReferenceKey:(parentKeyName=LogicParentName,parentKeyVersion=0.0.1,parentLocalName=PLN,localName=LN),logicFlavour=LogicFlavour,logic=Logic)", - clonedLogic.toString()); + assertEquals("AxLogic:(key=AxReferenceKey:(parentKeyName=LogicParentName,parentKeyVersion=0.0.1," + + "parentLocalName=PLN,localName=LN),logicFlavour=LogicFlavour,logic=Logic)", + clonedLogic.toString()); assertFalse(logic.hashCode() == 0); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestPolicies.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestPolicies.java index b2a3911bf..1e0e88c7b 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestPolicies.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestPolicies.java @@ -44,6 +44,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxStateTree; import org.onap.policy.apex.model.policymodel.handling.TestApexPolicyModelCreator; /** + * Test apex policies. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestPolicies { @@ -63,9 +65,9 @@ public class TestPolicies { final AxState firstState = new AxState(new AxReferenceKey(policy.getKey(), "FirstState")); final AxState badState = new AxState(new AxReferenceKey(policy.getKey(), "BadState")); - final AxStateOutput badSO = new AxStateOutput(badState.getKey(), AxArtifactKey.getNullKey(), - new AxReferenceKey(policyKey, "BadNextState")); - badState.getStateOutputs().put(badSO.getKey().getLocalName(), badSO); + final AxStateOutput badStateOutput = new AxStateOutput(badState.getKey(), AxArtifactKey.getNullKey(), + new AxReferenceKey(policyKey, "BadNextState")); + badState.getStateOutputs().put(badStateOutput.getKey().getLocalName(), badStateOutput); stateMap.put(firstState.getKey().getLocalName(), firstState); try { @@ -231,7 +233,7 @@ public class TestPolicies { final AxPolicy clonedPolicy = new AxPolicy(policy); assertEquals("AxPolicy:(key=AxArtifactKey:(name=policy,version=0.0.1),template=FREEFORM,sta", - clonedPolicy.toString().substring(0, 77)); + clonedPolicy.toString().substring(0, 77)); assertFalse(policy.hashCode() == 0); @@ -239,8 +241,8 @@ public class TestPolicies { assertTrue(policy.equals(clonedPolicy)); assertFalse(policy.equals(null)); assertFalse(policy.equals("Hello")); - assertFalse( - policy.equals(new AxPolicy(AxArtifactKey.getNullKey(), savedTemplate, savedStateMap, savedFirstState))); + assertFalse(policy.equals( + new AxPolicy(AxArtifactKey.getNullKey(), savedTemplate, savedStateMap, savedFirstState))); assertFalse(policy.equals(new AxPolicy(savedPolicyKey, "SomeTemplate", savedStateMap, savedFirstState))); assertFalse(policy.equals(new AxPolicy(savedPolicyKey, savedTemplate, stateMapEmpty, savedFirstState))); assertFalse(policy.equals(new AxPolicy(savedPolicyKey, savedTemplate, savedStateMap, "SomeFirstState"))); @@ -250,14 +252,14 @@ public class TestPolicies { assertEquals(0, policy.compareTo(clonedPolicy)); assertNotEquals(0, policy.compareTo(new AxArtifactKey())); assertNotEquals(0, policy.compareTo(null)); - assertNotEquals(0, policy - .compareTo(new AxPolicy(AxArtifactKey.getNullKey(), savedTemplate, savedStateMap, savedFirstState))); + assertNotEquals(0, policy.compareTo( + new AxPolicy(AxArtifactKey.getNullKey(), savedTemplate, savedStateMap, savedFirstState))); assertNotEquals(0, - policy.compareTo(new AxPolicy(savedPolicyKey, "SomeTemplate", savedStateMap, savedFirstState))); + policy.compareTo(new AxPolicy(savedPolicyKey, "SomeTemplate", savedStateMap, savedFirstState))); assertNotEquals(0, - policy.compareTo(new AxPolicy(savedPolicyKey, savedTemplate, stateMapEmpty, savedFirstState))); + policy.compareTo(new AxPolicy(savedPolicyKey, savedTemplate, stateMapEmpty, savedFirstState))); assertNotEquals(0, - policy.compareTo(new AxPolicy(savedPolicyKey, savedTemplate, savedStateMap, "SomeFirstState"))); + policy.compareTo(new AxPolicy(savedPolicyKey, savedTemplate, savedStateMap, "SomeFirstState"))); assertEquals(0, policy.compareTo(new AxPolicy(savedPolicyKey, savedTemplate, savedStateMap, savedFirstState))); assertNotNull(policy.getKeys()); @@ -315,7 +317,7 @@ public class TestPolicies { final AxPolicies clonedPolicies = new AxPolicies(policies); assertEquals("AxPolicies:(key=AxArtifactKey:(name=PoliciesKey,version=0.0.", - clonedPolicies.toString().substring(0, 60)); + clonedPolicies.toString().substring(0, 60)); assertFalse(policies.hashCode() == 0); @@ -359,18 +361,17 @@ public class TestPolicies { assertNotNull(stateTree.getNextStates()); policy.getStateMap().get("SecondState").getStateOutputs().get("stateOutput0") - .setNextState(policy.getStateMap().get("state").getKey()); + .setNextState(policy.getStateMap().get("state").getKey()); try { policy.getStateTree(); fail("test should throw an exception here"); } catch (final Exception e) { - assertEquals( - "loop detected in state tree for policy policy:0.0.1 state SecondState, next state state referenced more than once", - e.getMessage()); + assertEquals("loop detected in state tree for policy policy:0.0.1 state SecondState, " + + "next state state referenced more than once", e.getMessage()); } policy.getStateMap().get("SecondState").getStateOutputs().get("stateOutput0") - .setNextState(AxReferenceKey.getNullKey()); + .setNextState(AxReferenceKey.getNullKey()); final AxState thirdState = new AxState(policy.getStateMap().get("state")); thirdState.getKey().setLocalName("ThirdState"); @@ -378,12 +379,12 @@ public class TestPolicies { policy.getStateMap().put("ThirdState", thirdState); policy.getStateMap().get("SecondState").getStateOutputs().get("stateOutput0").setNextState(thirdState.getKey()); policy.getStateMap().get("ThirdState").getStateOutputs().get("stateOutput0") - .setNextState(AxReferenceKey.getNullKey()); + .setNextState(AxReferenceKey.getNullKey()); stateTree = policy.getStateTree(); - final AxStateOutput ssS0Clone = - new AxStateOutput(policy.getStateMap().get("SecondState").getStateOutputs().get("stateOutput0")); + final AxStateOutput ssS0Clone = new AxStateOutput( + policy.getStateMap().get("SecondState").getStateOutputs().get("stateOutput0")); ssS0Clone.getKey().setLocalName("ssS0Clone"); policy.getStateMap().get("SecondState").getStateOutputs().put("ssS0Clone", ssS0Clone); @@ -391,9 +392,8 @@ public class TestPolicies { policy.getStateTree(); fail("test should throw an exception here"); } catch (final Exception e) { - assertEquals( - "loop detected in state tree for policy policy:0.0.1 state SecondState, next state ThirdState referenced more than once", - e.getMessage()); + assertEquals("loop detected in state tree for policy policy:0.0.1 state SecondState, " + + "next state ThirdState referenced more than once", e.getMessage()); } policy.getStateMap().get("SecondState").getStateOutputs().remove("ssS0Clone"); @@ -411,9 +411,8 @@ public class TestPolicies { policy.getStateTree(); fail("test should throw an exception here"); } catch (final Exception e) { - assertEquals( - "loop detected in state tree for policy policy:0.0.1 state ThirdState, next state SecondState referenced more than once", - e.getMessage()); + assertEquals("loop detected in state tree for policy policy:0.0.1 state ThirdState, " + + "next state SecondState referenced more than once", e.getMessage()); } thirdState.getStateOutputs().get("stateOutput0").setNextState(AxReferenceKey.getNullKey()); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestPolicyModel.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestPolicyModel.java index 5df831cc7..b2803c4f8 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestPolicyModel.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestPolicyModel.java @@ -49,6 +49,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxTasks; import org.onap.policy.apex.model.policymodel.handling.TestApexPolicyModelCreator; /** + * Test policy models. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestPolicyModel { @@ -58,7 +60,7 @@ public class TestPolicyModel { assertNotNull(new AxPolicyModel()); assertNotNull(new AxPolicyModel(new AxArtifactKey())); assertNotNull(new AxPolicyModel(new AxArtifactKey(), new AxContextSchemas(), new AxKeyInformation(), - new AxEvents(), new AxContextAlbums(), new AxTasks(), new AxPolicies())); + new AxEvents(), new AxContextAlbums(), new AxTasks(), new AxPolicies())); final AxArtifactKey modelKey = new AxArtifactKey("ModelKey", "0.0.1"); final AxArtifactKey schemasKey = new AxArtifactKey("SchemasKey", "0.0.1"); @@ -69,8 +71,8 @@ public class TestPolicyModel { final AxArtifactKey policiesKey = new AxArtifactKey("PoliciesKey", "0.0.1"); AxPolicyModel model = new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), - new AxTasks(tasksKey), new AxPolicies(policiesKey)); + new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), + new AxTasks(tasksKey), new AxPolicies(policiesKey)); model.register(); @@ -90,63 +92,59 @@ public class TestPolicyModel { assertFalse(model.equals("Hello")); assertFalse(model.equals(new AxPolicyModel(new AxArtifactKey()))); assertFalse(model.equals(new AxPolicyModel(AxArtifactKey.getNullKey(), new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), - new AxTasks(tasksKey), new AxPolicies(policiesKey)))); + new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), + new AxTasks(tasksKey), new AxPolicies(policiesKey)))); assertFalse(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(), new AxKeyInformation(keyInfoKey), - new AxEvents(eventsKey), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), - new AxPolicies(policiesKey)))); + new AxEvents(eventsKey), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), + new AxPolicies(policiesKey)))); assertFalse(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), new AxKeyInformation(), - new AxEvents(eventsKey), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), - new AxPolicies(policiesKey)))); + new AxEvents(eventsKey), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), + new AxPolicies(policiesKey)))); assertFalse(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), - new AxPolicies(policiesKey)))); + new AxKeyInformation(keyInfoKey), new AxEvents(), new AxContextAlbums(albumsKey), + new AxTasks(tasksKey), new AxPolicies(policiesKey)))); assertFalse(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(), new AxTasks(tasksKey), - new AxPolicies(policiesKey)))); + new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(), + new AxTasks(tasksKey), new AxPolicies(policiesKey)))); assertFalse(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), - new AxTasks(), new AxPolicies(policiesKey)))); + new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), + new AxTasks(), new AxPolicies(policiesKey)))); assertFalse(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), - new AxTasks(tasksKey), new AxPolicies()))); + new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), + new AxTasks(tasksKey), new AxPolicies()))); assertTrue(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), - new AxTasks(tasksKey), new AxPolicies(policiesKey)))); + new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), + new AxTasks(tasksKey), new AxPolicies(policiesKey)))); assertEquals(0, model.compareTo(model)); assertEquals(0, model.compareTo(clonedModel)); assertNotEquals(0, model.compareTo(new AxArtifactKey())); - assertNotEquals(0, - model.compareTo(new AxPolicyModel(AxArtifactKey.getNullKey(), new AxContextSchemas(schemasKey), + assertNotEquals(0, model.compareTo(new AxPolicyModel(AxArtifactKey.getNullKey(), + new AxContextSchemas(schemasKey), new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), + new AxContextAlbums(albumsKey), new AxTasks(tasksKey), new AxPolicies(policiesKey)))); + assertNotEquals(0, model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(), new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), new AxPolicies(policiesKey)))); assertNotEquals(0, - model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(), new AxKeyInformation(keyInfoKey), - new AxEvents(eventsKey), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), - new AxPolicies(policiesKey)))); - assertNotEquals(0, - model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), new AxKeyInformation(), - new AxEvents(eventsKey), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), - new AxPolicies(policiesKey)))); - assertNotEquals(0, - model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), + model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), + new AxKeyInformation(), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), + new AxTasks(tasksKey), new AxPolicies(policiesKey)))); + assertNotEquals(0, model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), new AxKeyInformation(keyInfoKey), new AxEvents(), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), new AxPolicies(policiesKey)))); assertNotEquals(0, - model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(), - new AxTasks(tasksKey), new AxPolicies(policiesKey)))); + model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), + new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), + new AxContextAlbums(), new AxTasks(tasksKey), new AxPolicies(policiesKey)))); assertNotEquals(0, - model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), - new AxTasks(), new AxPolicies(policiesKey)))); + model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), + new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), + new AxContextAlbums(albumsKey), new AxTasks(), new AxPolicies(policiesKey)))); assertNotEquals(0, - model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), - new AxTasks(tasksKey), new AxPolicies()))); - assertEquals(0, - model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), + model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), + new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), + new AxContextAlbums(albumsKey), new AxTasks(tasksKey), new AxPolicies()))); + assertEquals(0, model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), new AxPolicies(policiesKey)))); @@ -168,7 +166,7 @@ public class TestPolicyModel { assertEquals(ValidationResult.VALID, result.getValidationResult()); final AxField badField = new AxField(new AxReferenceKey(model.getEvents().get("inEvent").getKey(), "BadField"), - new AxArtifactKey("NonExistantSchema", "0.0.1")); + new AxArtifactKey("NonExistantSchema", "0.0.1")); model.getEvents().get("inEvent").getParameterMap().put(badField.getKey().getLocalName(), badField); result = new AxValidationResult(); result = model.validate(result); @@ -180,7 +178,7 @@ public class TestPolicyModel { assertEquals(ValidationResult.VALID, result.getValidationResult()); final AxContextAlbum badAlbum = new AxContextAlbum(new AxArtifactKey("BadAlbum", "0.0.1"), "SomeScope", true, - new AxArtifactKey("NonExistantSchema", "0.0.1")); + new AxArtifactKey("NonExistantSchema", "0.0.1")); model.getAlbums().getAlbumsMap().put(badAlbum.getKey(), badAlbum); result = new AxValidationResult(); result = model.validate(result); @@ -191,8 +189,8 @@ public class TestPolicyModel { result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); - final AxInputField badInField = - new AxInputField(new AxReferenceKey(model.getTasks().get("task").getKey(), "BadInField"), + final AxInputField badInField = new AxInputField( + new AxReferenceKey(model.getTasks().get("task").getKey(), "BadInField"), new AxArtifactKey("NonExistantSchema", "0.0.1")); model.getTasks().get("task").getInputFields().put(badInField.getKey().getLocalName(), badInField); result = new AxValidationResult(); @@ -204,8 +202,8 @@ public class TestPolicyModel { result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); - final AxOutputField badOutField = - new AxOutputField(new AxReferenceKey(model.getTasks().get("task").getKey(), "BadOutField"), + final AxOutputField badOutField = new AxOutputField( + new AxReferenceKey(model.getTasks().get("task").getKey(), "BadOutField"), new AxArtifactKey("NonExistantSchema", "0.0.1")); model.getTasks().get("task").getOutputFields().put(badOutField.getKey().getLocalName(), badOutField); result = new AxValidationResult(); @@ -218,32 +216,32 @@ public class TestPolicyModel { assertEquals(ValidationResult.VALID, result.getValidationResult()); model.getTasks().get("task").getContextAlbumReferences() - .add(new AxArtifactKey("NonExistantContextAlbum", "0.0.1")); + .add(new AxArtifactKey("NonExistantContextAlbum", "0.0.1")); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); model.getTasks().get("task").getContextAlbumReferences() - .remove(new AxArtifactKey("NonExistantContextAlbum", "0.0.1")); + .remove(new AxArtifactKey("NonExistantContextAlbum", "0.0.1")); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); model.getPolicies().get("policy").getStateMap().get("state").getContextAlbumReferences() - .add(new AxArtifactKey("NonExistantContextAlbum", "0.0.1")); + .add(new AxArtifactKey("NonExistantContextAlbum", "0.0.1")); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); model.getPolicies().get("policy").getStateMap().get("state").getContextAlbumReferences() - .remove(new AxArtifactKey("NonExistantContextAlbum", "0.0.1")); + .remove(new AxArtifactKey("NonExistantContextAlbum", "0.0.1")); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); final AxArtifactKey savedTrigger = model.getPolicies().get("policy").getStateMap().get("state").getTrigger(); model.getPolicies().get("policy").getStateMap().get("state") - .setTrigger(new AxArtifactKey("NonExistantEvent", "0.0.1")); + .setTrigger(new AxArtifactKey("NonExistantEvent", "0.0.1")); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); @@ -253,10 +251,10 @@ public class TestPolicyModel { result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); - final AxArtifactKey savedDefaultTask = - model.getPolicies().get("policy").getStateMap().get("state").getDefaultTask(); + final AxArtifactKey savedDefaultTask = model.getPolicies().get("policy").getStateMap().get("state") + .getDefaultTask(); model.getPolicies().get("policy").getStateMap().get("state") - .setDefaultTask(new AxArtifactKey("NonExistantTask", "0.0.1")); + .setDefaultTask(new AxArtifactKey("NonExistantTask", "0.0.1")); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); @@ -267,10 +265,10 @@ public class TestPolicyModel { assertEquals(ValidationResult.VALID, result.getValidationResult()); // It is OK not to have TSL - final AxTaskSelectionLogic savedTSL = - model.getPolicies().get("policy").getStateMap().get("state").getTaskSelectionLogic(); + final AxTaskSelectionLogic savedTaskSelectionLogic = model.getPolicies().get("policy").getStateMap() + .get("state").getTaskSelectionLogic(); model.getPolicies().get("policy").getStateMap().get("state") - .setTaskSelectionLogic(new AxTaskSelectionLogic(AxReferenceKey.getNullKey())); + .setTaskSelectionLogic(new AxTaskSelectionLogic(AxReferenceKey.getNullKey())); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); @@ -285,71 +283,72 @@ public class TestPolicyModel { result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); - model.getPolicies().get("policy").getStateMap().get("state").setTaskSelectionLogic(savedTSL); + model.getPolicies().get("policy").getStateMap().get("state").setTaskSelectionLogic(savedTaskSelectionLogic); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); final AxStateOutput badStateOutput = new AxStateOutput( - new AxReferenceKey(model.getPolicies().get("policy").getStateMap().get("state").getKey(), "BadSO"), - new AxArtifactKey("NonExistantEvent", "0.0.1"), AxReferenceKey.getNullKey()); + new AxReferenceKey(model.getPolicies().get("policy").getStateMap().get("state").getKey(), + "BadSO"), + new AxArtifactKey("NonExistantEvent", "0.0.1"), AxReferenceKey.getNullKey()); model.getPolicies().get("policy").getStateMap().get("state").getStateOutputs() - .put(badStateOutput.getKey().getLocalName(), badStateOutput); + .put(badStateOutput.getKey().getLocalName(), badStateOutput); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); model.getPolicies().get("policy").getStateMap().get("state").getStateOutputs() - .remove(badStateOutput.getKey().getLocalName()); + .remove(badStateOutput.getKey().getLocalName()); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); - final AxStateTaskReference badTR = new AxStateTaskReference( - new AxReferenceKey(model.getPolicies().get("policy").getStateMap().get("state").getKey(), - "NonExistantTask"), - AxStateTaskOutputType.LOGIC, badStateOutput.getKey()); + final AxStateTaskReference badTaskReference = new AxStateTaskReference( + new AxReferenceKey(model.getPolicies().get("policy").getStateMap().get("state").getKey(), + "NonExistantTask"), + AxStateTaskOutputType.LOGIC, badStateOutput.getKey()); model.getPolicies().get("policy").getStateMap().get("state").getTaskReferences() - .put(new AxArtifactKey("NonExistantTask", "0.0.1"), badTR); + .put(new AxArtifactKey("NonExistantTask", "0.0.1"), badTaskReference); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); - badTR.setStateTaskOutputType(AxStateTaskOutputType.DIRECT); + badTaskReference.setStateTaskOutputType(AxStateTaskOutputType.DIRECT); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); model.getPolicies().get("policy").getStateMap().get("state").getTaskReferences() - .remove(new AxArtifactKey("NonExistantTask", "0.0.1")); + .remove(new AxArtifactKey("NonExistantTask", "0.0.1")); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); final AxStateTaskReference tr = model.getPolicies().get("policy").getStateMap().get("state").getTaskReferences() - .get(new AxArtifactKey("task", "0.0.1")); + .get(new AxArtifactKey("task", "0.0.1")); - final String savedSOName = tr.getOutput().getLocalName(); + final String savedStateOutputName = tr.getOutput().getLocalName(); tr.getOutput().setLocalName("NonExistantOutput"); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); - tr.getOutput().setLocalName(savedSOName); + tr.getOutput().setLocalName(savedStateOutputName); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); - final AxStateOutput so = - model.getPolicies().get("policy").getStateMap().get("state").getStateOutputs().get(savedSOName); + final AxStateOutput so = model.getPolicies().get("policy").getStateMap().get("state").getStateOutputs() + .get(savedStateOutputName); - final AxArtifactKey savedOE = so.getOutgingEvent(); + final AxArtifactKey savedOutEvent = so.getOutgingEvent(); so.setOutgoingEvent(new AxArtifactKey("NonExistantEvent", "0.0.1")); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); - so.setOutgoingEvent(savedOE); + so.setOutgoingEvent(savedOutEvent); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestState.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestState.java index c53fff1ca..56d0a6a82 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestState.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestState.java @@ -45,6 +45,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference; import org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic; /** + * Test policy states. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestState { @@ -64,7 +66,7 @@ public class TestState { assertNotNull(new AxState()); assertNotNull(new AxState(new AxReferenceKey())); assertNotNull(new AxState(new AxReferenceKey(), new AxArtifactKey(), soEmptyMap, ctxtEmptySet, - new AxTaskSelectionLogic(), sflEmptyMap, new AxArtifactKey(), trEmptyMap)); + new AxTaskSelectionLogic(), sflEmptyMap, new AxArtifactKey(), trEmptyMap)); final AxState state = new AxState(); @@ -89,25 +91,28 @@ public class TestState { assertEquals("PolicyName:0.0.1:NULL:StateName", state.getKey().getId()); assertEquals("PolicyName:0.0.1:NULL:StateName", state.getKeys().get(0).getId()); - final AxStateOutput so0 = new AxStateOutput(new AxReferenceKey(stateKey, "SO0"), triggerKey, new AxReferenceKey()); + final AxStateOutput so0 = new AxStateOutput(new AxReferenceKey(stateKey, "SO0"), triggerKey, + new AxReferenceKey()); final AxStateOutput soU = new AxStateOutput(new AxReferenceKey(stateKey, "SOU"), triggerKey, stateKeyNext); final AxStateOutput soSame = new AxStateOutput(new AxReferenceKey(stateKey, "SOU"), triggerKey, stateKey); final AxArtifactKey cr0 = new AxArtifactKey("ContextReference", "0.0.1"); final AxStateFinalizerLogic sfl = new AxStateFinalizerLogic(stateKey, "SFLogicName", "LogicFlavour", "Logic"); - final AxStateFinalizerLogic sflU = new AxStateFinalizerLogic(stateKey, "UnusedSFLogicName", "LogicFlavour", "Logic"); + final AxStateFinalizerLogic sflU = new AxStateFinalizerLogic(stateKey, "UnusedSFLogicName", "LogicFlavour", + "Logic"); final AxStateTaskReference str0 = new AxStateTaskReference(new AxReferenceKey(stateKey, "STR0"), - AxStateTaskOutputType.DIRECT, so0.getKey()); + AxStateTaskOutputType.DIRECT, so0.getKey()); final AxStateTaskReference str1 = new AxStateTaskReference(new AxReferenceKey(stateKey, "STR1"), - AxStateTaskOutputType.DIRECT, so0.getKey()); + AxStateTaskOutputType.DIRECT, so0.getKey()); final AxStateTaskReference str2 = new AxStateTaskReference(new AxReferenceKey(stateKey, "STR2"), - AxStateTaskOutputType.LOGIC, sfl.getKey()); + AxStateTaskOutputType.LOGIC, sfl.getKey()); final AxStateTaskReference strBadState = new AxStateTaskReference(new AxReferenceKey(stateKeyBad, "STR2"), - AxStateTaskOutputType.LOGIC, sfl.getKey()); - final AxStateTaskReference strBadSO = new AxStateTaskReference(new AxReferenceKey(stateKey, "STR2"), - AxStateTaskOutputType.UNDEFINED, sfl.getKey()); - final AxStateTaskReference strBadSFL = new AxStateTaskReference(new AxReferenceKey(stateKeyBad, "STR2"), - AxStateTaskOutputType.LOGIC, new AxReferenceKey(stateKey, "SomeSFL")); + AxStateTaskOutputType.LOGIC, sfl.getKey()); + final AxStateTaskReference strBadStateOutput = new AxStateTaskReference(new AxReferenceKey(stateKey, "STR2"), + AxStateTaskOutputType.UNDEFINED, sfl.getKey()); + final AxStateTaskReference strBadStateFinalizerLogic = new AxStateTaskReference( + new AxReferenceKey(stateKeyBad, "STR2"), AxStateTaskOutputType.LOGIC, + new AxReferenceKey(stateKey, "SomeSFL")); soMap.put(so0.getKey().getLocalName(), so0); ctxtSet.add(cr0); @@ -358,7 +363,7 @@ public class TestState { result = state.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); - trMap.put(taskKeyBad, strBadSO); + trMap.put(taskKeyBad, strBadStateOutput); result = new AxValidationResult(); result = state.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); @@ -378,7 +383,7 @@ public class TestState { result = state.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); - trMap.put(taskKeyBad, strBadSFL); + trMap.put(taskKeyBad, strBadStateFinalizerLogic); result = new AxValidationResult(); result = state.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); @@ -429,22 +434,22 @@ public class TestState { assertTrue(state.equals(clonedState)); assertFalse(state.equals(null)); assertFalse(state.equals("Hello")); - assertFalse(state - .equals(new AxState(new AxReferenceKey(), triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); - assertFalse(state - .equals(new AxState(stateKey, new AxArtifactKey(), soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); - assertFalse( - state.equals(new AxState(stateKey, triggerKey, soEmptyMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); - assertFalse( - state.equals(new AxState(stateKey, triggerKey, soMap, ctxtEmptySet, tsl, sflMap, defTaskKey, trMap))); + assertFalse(state.equals( + new AxState(new AxReferenceKey(), triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); + assertFalse(state.equals( + new AxState(stateKey, new AxArtifactKey(), soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); + assertFalse(state.equals( + new AxState(stateKey, triggerKey, soEmptyMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); + assertFalse(state.equals( + new AxState(stateKey, triggerKey, soMap, ctxtEmptySet, tsl, sflMap, defTaskKey, trMap))); assertFalse(state.equals(new AxState(stateKey, triggerKey, soMap, ctxtSet, new AxTaskSelectionLogic(), sflMap, - defTaskKey, trMap))); - assertFalse( - state.equals(new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflEmptyMap, defTaskKey, trMap))); - assertFalse(state - .equals(new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, new AxArtifactKey(), trMap))); - assertFalse( - state.equals(new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trEmptyMap))); + defTaskKey, trMap))); + assertFalse(state.equals( + new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflEmptyMap, defTaskKey, trMap))); + assertFalse(state.equals( + new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, new AxArtifactKey(), trMap))); + assertFalse(state.equals( + new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trEmptyMap))); assertTrue(state.equals(new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); assertEquals(0, state.compareTo(state)); @@ -452,23 +457,23 @@ public class TestState { assertNotEquals(0, state.compareTo(new AxArtifactKey())); assertNotEquals(0, state.compareTo(null)); assertNotEquals(0, state.compareTo( - new AxState(new AxReferenceKey(), triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); - assertNotEquals(0, state - .compareTo(new AxState(stateKey, new AxArtifactKey(), soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); - assertNotEquals(0, state - .compareTo(new AxState(stateKey, triggerKey, soEmptyMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); - assertNotEquals(0, state - .compareTo(new AxState(stateKey, triggerKey, soMap, ctxtEmptySet, tsl, sflMap, defTaskKey, trMap))); + new AxState(new AxReferenceKey(), triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); + assertNotEquals(0, state.compareTo( + new AxState(stateKey, new AxArtifactKey(), soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); + assertNotEquals(0, state.compareTo( + new AxState(stateKey, triggerKey, soEmptyMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); + assertNotEquals(0, state.compareTo( + new AxState(stateKey, triggerKey, soMap, ctxtEmptySet, tsl, sflMap, defTaskKey, trMap))); assertNotEquals(0, state.compareTo(new AxState(stateKey, triggerKey, soMap, ctxtSet, new AxTaskSelectionLogic(), - sflMap, defTaskKey, trMap))); - assertNotEquals(0, state - .compareTo(new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflEmptyMap, defTaskKey, trMap))); - assertNotEquals(0, state - .compareTo(new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, new AxArtifactKey(), trMap))); - assertNotEquals(0, state - .compareTo(new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trEmptyMap))); - assertEquals(0, - state.compareTo(new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); + sflMap, defTaskKey, trMap))); + assertNotEquals(0, state.compareTo( + new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflEmptyMap, defTaskKey, trMap))); + assertNotEquals(0, state.compareTo( + new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, new AxArtifactKey(), trMap))); + assertNotEquals(0, state.compareTo( + new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trEmptyMap))); + assertEquals(0, state + .compareTo(new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); assertNotNull(state.getKeys()); } diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestStateOutput.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestStateOutput.java index 5306b7642..90b486053 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestStateOutput.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestStateOutput.java @@ -35,6 +35,8 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.Validat import org.onap.policy.apex.model.policymodel.concepts.AxStateOutput; /** + * Test state outputs. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestStateOutput { diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestStateTaskReference.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestStateTaskReference.java index eeaf19e07..90c7001b8 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestStateTaskReference.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestStateTaskReference.java @@ -36,6 +36,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskOutputType; import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference; /** + * Test state task references. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestStateTaskReference { @@ -44,15 +46,14 @@ public class TestStateTaskReference { public void testStateTaskReference() { assertNotNull(new AxStateTaskReference()); assertNotNull(new AxStateTaskReference(new AxReferenceKey())); - assertNotNull( - new AxStateTaskReference(new AxReferenceKey(), AxStateTaskOutputType.UNDEFINED, new AxReferenceKey())); + assertNotNull(new AxStateTaskReference(new AxReferenceKey(), AxStateTaskOutputType.UNDEFINED, + new AxReferenceKey())); assertNotNull(new AxStateTaskReference(new AxReferenceKey(), new AxArtifactKey(), - AxStateTaskOutputType.UNDEFINED, new AxReferenceKey())); + AxStateTaskOutputType.UNDEFINED, new AxReferenceKey())); AxStateTaskReference stRef = new AxStateTaskReference(); AxReferenceKey stRefKey = new AxReferenceKey("StateParent", "0.0.1", "SOState", "SOName"); - AxReferenceKey soKey = new AxReferenceKey("StateParent", "0.0.1", "SOState", "STRef0"); try { stRef.setKey(null); @@ -86,6 +87,7 @@ public class TestStateTaskReference { assertEquals("output may not be null", e.getMessage()); } + AxReferenceKey soKey = new AxReferenceKey("StateParent", "0.0.1", "SOState", "STRef0"); stRef.setOutput(soKey); assertEquals(soKey, stRef.getOutput()); @@ -134,25 +136,25 @@ public class TestStateTaskReference { assertTrue(stRef.equals(clonedStRef)); assertFalse(stRef.equals(null)); assertFalse(stRef.equals("Hello")); - assertFalse(stRef - .equals(new AxStateTaskReference(AxReferenceKey.getNullKey(), AxStateTaskOutputType.LOGIC, soKey))); + assertFalse(stRef.equals( + new AxStateTaskReference(AxReferenceKey.getNullKey(), AxStateTaskOutputType.LOGIC, soKey))); assertFalse(stRef.equals(new AxStateTaskReference(stRefKey, AxStateTaskOutputType.DIRECT, soKey))); - assertFalse( - stRef.equals(new AxStateTaskReference(stRefKey, AxStateTaskOutputType.LOGIC, new AxReferenceKey()))); + assertFalse(stRef + .equals(new AxStateTaskReference(stRefKey, AxStateTaskOutputType.LOGIC, new AxReferenceKey()))); assertTrue(stRef.equals(new AxStateTaskReference(stRefKey, AxStateTaskOutputType.LOGIC, soKey))); assertNotNull(new AxStateTaskReference(new AxReferenceKey(), new AxArtifactKey(), - AxStateTaskOutputType.UNDEFINED, new AxReferenceKey())); + AxStateTaskOutputType.UNDEFINED, new AxReferenceKey())); assertEquals(0, stRef.compareTo(stRef)); assertEquals(0, stRef.compareTo(clonedStRef)); assertNotEquals(0, stRef.compareTo(new AxArtifactKey())); assertNotEquals(0, stRef.compareTo(null)); - assertNotEquals(0, stRef - .compareTo(new AxStateTaskReference(AxReferenceKey.getNullKey(), AxStateTaskOutputType.LOGIC, soKey))); + assertNotEquals(0, stRef.compareTo( + new AxStateTaskReference(AxReferenceKey.getNullKey(), AxStateTaskOutputType.LOGIC, soKey))); assertNotEquals(0, stRef.compareTo(new AxStateTaskReference(stRefKey, AxStateTaskOutputType.DIRECT, soKey))); - assertNotEquals(0, - stRef.compareTo(new AxStateTaskReference(stRefKey, AxStateTaskOutputType.LOGIC, new AxReferenceKey()))); + assertNotEquals(0, stRef.compareTo( + new AxStateTaskReference(stRefKey, AxStateTaskOutputType.LOGIC, new AxReferenceKey()))); assertEquals(0, stRef.compareTo(new AxStateTaskReference(stRefKey, AxStateTaskOutputType.LOGIC, soKey))); assertNotNull(stRef.getKeys()); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestTaskParameter.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestTaskParameter.java index ff6ab42b8..4eb2c4232 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestTaskParameter.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestTaskParameter.java @@ -35,6 +35,8 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.Validat import org.onap.policy.apex.model.policymodel.concepts.AxTaskParameter; /** + * Test task parameters. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestTaskParameter { @@ -89,9 +91,8 @@ public class TestTaskParameter { par.clean(); final AxTaskParameter clonedPar = new AxTaskParameter(par); - assertEquals( - "AxTaskParameter:(key=AxReferenceKey:(parentKeyName=ParParentName,parentKeyVersion=0.0.1,parentLocalName=PLN,localName=LN),defaultValue=DefaultValue)", - clonedPar.toString()); + assertEquals("AxTaskParameter:(key=AxReferenceKey:(parentKeyName=ParParentName,parentKeyVersion=0.0.1," + + "parentLocalName=PLN,localName=LN),defaultValue=DefaultValue)", clonedPar.toString()); assertFalse(par.hashCode() == 0); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestTasks.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestTasks.java index 78691accb..4f6292f04 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestTasks.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestTasks.java @@ -43,6 +43,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxTaskParameter; import org.onap.policy.apex.model.policymodel.concepts.AxTasks; /** + * Test policy tasks. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestTasks { @@ -302,7 +304,7 @@ public class TestTasks { final AxTasks clonedTasks = new AxTasks(tasks); assertEquals("AxTasks:(key=AxArtifactKey:(name=TasksKey,version=0.0.1),tas", - clonedTasks.toString().substring(0, 60)); + clonedTasks.toString().substring(0, 60)); assertFalse(tasks.hashCode() == 0); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestApexPolicyModel.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestApexPolicyModel.java index 5dfeede0a..6c4fd5174 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestApexPolicyModel.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestApexPolicyModel.java @@ -39,6 +39,11 @@ public class TestApexPolicyModel { private Connection connection; TestApexModel<AxPolicyModel> testApexModel; + /** + * Set up the policy model tests. + * + * @throws Exception on setup errors + */ @Before public void setup() throws Exception { Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); @@ -65,7 +70,6 @@ public class TestApexPolicyModel { assertTrue(result.toString().equals(OBSERVATION_MODEL_STRING)); } - @Test public void testApexModelVaidateWarning() throws Exception { final AxValidationResult result = testApexModel.testApexModelVaidateWarning(); @@ -85,17 +89,17 @@ public class TestApexPolicyModel { } @Test - public void testModelWriteReadXML() throws Exception { + public void testModelWriteReadXml() throws Exception { testApexModel.testApexModelWriteReadXml(); } @Test - public void testModelWriteReadJSON() throws Exception { + public void testModelWriteReadJson() throws Exception { testApexModel.testApexModelWriteReadJson(); } @Test - public void testModelWriteReadJPA() throws Exception { + public void testModelWriteReadJpa() throws Exception { final DaoParameters DaoParameters = new DaoParameters(); DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); DaoParameters.setPersistenceUnit("DAOTest"); @@ -105,35 +109,71 @@ public class TestApexPolicyModel { private static final String VALID_MODEL_STRING = "***validation of model successful***"; - private static final String OBSERVATION_MODEL_STRING = - "\n" + "***observations noted during validation of model***\n" - + "AxReferenceKey:(parentKeyName=policy,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=state):org.onap.policy.apex.model.policymodel.concepts.AxState:OBSERVATION:state output stateOutput0 is not used directly by any task\n" + private static final String OBSERVATION_MODEL_STRING = "\n" + + "***observations noted during validation of model***\n" + + "AxReferenceKey:(parentKeyName=policy,parentKeyVersion=0.0.1,parentLocalName=NULL," + + "localName=state):org.onap.policy.apex.model.policymodel.concepts.AxState:OBSERVATION:" + + "state output stateOutput0 is not used directly by any task\n" + "********************************"; private static final String WARNING_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n" - + "AxArtifactKey:(name=policy,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxPolicy:WARNING:state AxReferenceKey:(parentKeyName=policy,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=anotherState) is not referenced in the policy execution tree\n" - + "********************************"; + + "AxArtifactKey:(name=policy,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxPolicy:WARNING:state AxReferenceKey:" + + "(parentKeyName=policy,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=anotherState) " + + "is not referenced in the policy execution tree\n" + "********************************"; private static final String INVALID_MODEL_STRING = "\n" + "***validation of model failed***\n" - + "AxArtifactKey:(name=contextAlbum0,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum:INVALID:scope is not defined\n" - + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum:INVALID:scope is not defined\n" - + "AxReferenceKey:(parentKeyName=policy,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=state):org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:task output field AxOutputField:(key=AxReferenceKey:(parentKeyName=task,parentKeyVersion=0.0.1,parentLocalName=outputFields,localName=OE1PAR0),fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false) for task task:0.0.1 not in output event outEvent0:0.0.1\n" - + "AxReferenceKey:(parentKeyName=policy,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=state):org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:task output field AxOutputField:(key=AxReferenceKey:(parentKeyName=task,parentKeyVersion=0.0.1,parentLocalName=outputFields,localName=OE1PAR1),fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false) for task task:0.0.1 not in output event outEvent0:0.0.1\n" - + "********************************"; + + "AxArtifactKey:(name=contextAlbum0,version=0.0.1):" + + "org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum:INVALID:scope is not defined\n" + + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):" + + "org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum:INVALID:scope is not defined\n" + + "AxReferenceKey:" + + "(parentKeyName=policy,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=state):" + + "org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" + + "task output field AxOutputField:(key=AxReferenceKey:" + + "(parentKeyName=task,parentKeyVersion=0.0.1,parentLocalName=outputFields,localName=OE1PAR0)," + + "fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false) for task " + + "task:0.0.1 not in output event outEvent0:0.0.1\n" + "AxReferenceKey:" + + "(parentKeyName=policy,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=state):" + + "org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" + + "task output field AxOutputField:(key=AxReferenceKey:" + + "(parentKeyName=task,parentKeyVersion=0.0.1,parentLocalName=outputFields,localName=OE1PAR1)," + + "fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false) for task " + + "task:0.0.1 not in output event outEvent0:0.0.1\n" + "********************************"; private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" + "***validation of model failed***\n" - + "AxArtifactKey:(name=policyModel_KeyInfo,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation:INVALID:keyInfoMap may not be empty\n" - + "AxArtifactKey:(name=policyModel,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:key information not found for key AxArtifactKey:(name=policyModel,version=0.0.1)\n" - + "AxArtifactKey:(name=policyModel,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:key information not found for key AxArtifactKey:(name=policyModel_KeyInfo,version=0.0.1)\n" - + "AxArtifactKey:(name=policyModel,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:key information not found for key AxArtifactKey:(name=policyModel_Schemas,version=0.0.1)\n" - + "AxArtifactKey:(name=policyModel,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:key information not found for key AxArtifactKey:(name=policyModel_Events,version=0.0.1)\n" - + "AxArtifactKey:(name=policyModel,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:key information not found for key AxArtifactKey:(name=policyModel_Albums,version=0.0.1)\n" - + "AxArtifactKey:(name=policyModel,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:key information not found for key AxArtifactKey:(name=policyModel_Tasks,version=0.0.1)\n" - + "AxArtifactKey:(name=policyModel,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:key information not found for key AxArtifactKey:(name=policyModel_Policies,version=0.0.1)\n" - + "AxArtifactKey:(name=policyModel_Schemas,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas:INVALID:contextSchemas may not be empty\n" - + "AxArtifactKey:(name=policyModel_Events,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvents:INVALID:eventMap may not be empty\n" - + "AxArtifactKey:(name=policyModel_Albums,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums:OBSERVATION:albums are empty\n" - + "AxArtifactKey:(name=policyModel_Tasks,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxTasks:INVALID:taskMap may not be empty\n" - + "AxArtifactKey:(name=policyModel_Policies,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxPolicies:INVALID:policyMap may not be empty\n" - + "********************************"; + + "AxArtifactKey:(name=policyModel_KeyInfo,version=0.0.1):" + + "org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation:INVALID:" + + "keyInfoMap may not be empty\n" + "AxArtifactKey:(name=policyModel,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=policyModel,version=0.0.1)\n" + + "AxArtifactKey:(name=policyModel,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=policyModel_KeyInfo,version=0.0.1)\n" + + "AxArtifactKey:(name=policyModel,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=policyModel_Schemas,version=0.0.1)\n" + + "AxArtifactKey:(name=policyModel,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=policyModel_Events,version=0.0.1)\n" + + "AxArtifactKey:(name=policyModel,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=policyModel_Albums,version=0.0.1)\n" + + "AxArtifactKey:(name=policyModel,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=policyModel_Tasks,version=0.0.1)\n" + + "AxArtifactKey:(name=policyModel,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=policyModel_Policies,version=0.0.1)\n" + + "AxArtifactKey:(name=policyModel_Schemas,version=0.0.1):" + + "org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas:INVALID:" + + "contextSchemas may not be empty\n" + "AxArtifactKey:(name=policyModel_Events,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvents:INVALID:eventMap may not be empty\n" + + "AxArtifactKey:(name=policyModel_Albums,version=0.0.1):" + + "org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums:OBSERVATION:albums are empty\n" + + "AxArtifactKey:(name=policyModel_Tasks,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxTasks:INVALID:taskMap may not be empty\n" + + "AxArtifactKey:(name=policyModel_Policies,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxPolicies:INVALID:policyMap may not be empty\n" + + "********************************"; } diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestApexPolicyModelCreator.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestApexPolicyModelCreator.java index cf2bb6524..cbcecc589 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestApexPolicyModelCreator.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestApexPolicyModelCreator.java @@ -52,20 +52,22 @@ import org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic; import org.onap.policy.apex.model.policymodel.concepts.AxTasks; /** + * Model creator for model tests. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicyModel> { @Override public AxPolicyModel getModel() { - final AxContextSchema schema0 = - new AxContextSchema(new AxArtifactKey("eventContextItem0", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema schema1 = - new AxContextSchema(new AxArtifactKey("eventContextItem1", "0.0.1"), "Java", "java.lang.Long"); + final AxContextSchema schema0 = new AxContextSchema(new AxArtifactKey("eventContextItem0", "0.0.1"), "Java", + "java.lang.String"); + final AxContextSchema schema1 = new AxContextSchema(new AxArtifactKey("eventContextItem1", "0.0.1"), "Java", + "java.lang.Long"); final AxContextSchema schema2 = new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", - "org.onap.policy.apex.model.policymodel.concepts.TestContextItem000"); + "org.onap.policy.apex.model.policymodel.concepts.TestContextItem000"); final AxContextSchema schema3 = new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", - "org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A"); + "org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A"); final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("ContextSchemas", "0.0.1")); schemas.getSchemasMap().put(schema0.getKey(), schema0); @@ -73,39 +75,39 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy schemas.getSchemasMap().put(schema2.getKey(), schema2); schemas.getSchemasMap().put(schema3.getKey(), schema3); - final AxContextAlbum album0 = - new AxContextAlbum(new AxArtifactKey("contextAlbum0", "0.0.1"), "APPLICATION", true, schema3.getKey()); - final AxContextAlbum album1 = - new AxContextAlbum(new AxArtifactKey("contextAlbum1", "0.0.1"), "GLOBAL", false, schema2.getKey()); + final AxContextAlbum album0 = new AxContextAlbum(new AxArtifactKey("contextAlbum0", "0.0.1"), "APPLICATION", + true, schema3.getKey()); + final AxContextAlbum album1 = new AxContextAlbum(new AxArtifactKey("contextAlbum1", "0.0.1"), "GLOBAL", false, + schema2.getKey()); final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("context", "0.0.1")); albums.getAlbumsMap().put(album0.getKey(), album0); albums.getAlbumsMap().put(album1.getKey(), album1); final AxEvent inEvent = new AxEvent(new AxArtifactKey("inEvent", "0.0.1"), - "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); + "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); inEvent.getParameterMap().put("IEPAR0", - new AxField(new AxReferenceKey(inEvent.getKey(), "IEPAR0"), schema0.getKey())); + new AxField(new AxReferenceKey(inEvent.getKey(), "IEPAR0"), schema0.getKey())); inEvent.getParameterMap().put("IEPAR1", - new AxField(new AxReferenceKey(inEvent.getKey(), "IEPAR1"), schema1.getKey())); + new AxField(new AxReferenceKey(inEvent.getKey(), "IEPAR1"), schema1.getKey())); final AxEvent outEvent0 = new AxEvent(new AxArtifactKey("outEvent0", "0.0.1"), - "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); + "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); outEvent0.getParameterMap().put("OE0PAR0", - new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PAR0"), schema0.getKey())); + new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PAR0"), schema0.getKey())); outEvent0.getParameterMap().put("OE0PAR1", - new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PAR1"), schema1.getKey())); + new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PAR1"), schema1.getKey())); outEvent0.getParameterMap().put("OE1PAR0", - new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PAR0"), schema0.getKey())); + new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PAR0"), schema0.getKey())); outEvent0.getParameterMap().put("OE1PAR1", - new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PAR1"), schema1.getKey())); + new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PAR1"), schema1.getKey())); final AxEvent outEvent1 = new AxEvent(new AxArtifactKey("outEvent1", "0.0.1"), - "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); + "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); outEvent1.getParameterMap().put("OE1PAR0", - new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PAR0"), schema0.getKey())); + new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PAR0"), schema0.getKey())); outEvent1.getParameterMap().put("OE1PAR1", - new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PAR1"), schema1.getKey())); + new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PAR1"), schema1.getKey())); final AxEvents events = new AxEvents(new AxArtifactKey("events", "0.0.1")); events.getEventMap().put(inEvent.getKey(), inEvent); @@ -116,37 +118,37 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy for (final AxField field : inEvent.getFields()) { final AxReferenceKey fieldkey = new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(), - "inputFields", field.getKey().getLocalName()); + "inputFields", field.getKey().getLocalName()); final AxInputField inputField = new AxInputField(fieldkey, field.getSchema()); task.getInputFields().put(inputField.getKey().getLocalName(), inputField); } for (final AxField field : outEvent0.getFields()) { final AxReferenceKey fieldkey = new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(), - "outputFields", field.getKey().getLocalName()); + "outputFields", field.getKey().getLocalName()); final AxOutputField outputField = new AxOutputField(fieldkey, field.getSchema()); task.getOutputFields().put(outputField.getKey().getLocalName(), outputField); } for (final AxField field : outEvent1.getFields()) { final AxReferenceKey fieldkey = new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(), - "outputFields", field.getKey().getLocalName()); + "outputFields", field.getKey().getLocalName()); final AxOutputField outputField = new AxOutputField(fieldkey, field.getSchema()); task.getOutputFields().put(outputField.getKey().getLocalName(), outputField); } - final AxTaskParameter taskPar0 = - new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameter0"), "Task parameter 0 value"); - final AxTaskParameter taskPar1 = - new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameter1"), "Task parameter 1 value"); + final AxTaskParameter taskPar0 = new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameter0"), + "Task parameter 0 value"); + final AxTaskParameter taskPar1 = new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameter1"), + "Task parameter 1 value"); task.getTaskParameters().put(taskPar0.getKey().getLocalName(), taskPar0); task.getTaskParameters().put(taskPar1.getKey().getLocalName(), taskPar1); task.getContextAlbumReferences().add(album0.getKey()); task.getContextAlbumReferences().add(album1.getKey()); - final AxTaskLogic taskLogic = - new AxTaskLogic(new AxReferenceKey(task.getKey(), "taskLogic"), "MVEL", "Some task logic"); + final AxTaskLogic taskLogic = new AxTaskLogic(new AxReferenceKey(task.getKey(), "taskLogic"), "MVEL", + "Some task logic"); task.setTaskLogic(taskLogic); final AxTasks tasks = new AxTasks(new AxArtifactKey("tasks", "0.0.1")); @@ -157,7 +159,7 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy final AxState state = new AxState(new AxReferenceKey(policy.getKey(), "state")); final AxTaskSelectionLogic taskSelectionLogic = new AxTaskSelectionLogic( - new AxReferenceKey(state.getKey(), "taskSelectionLogic"), "MVEL", "Some TS logic "); + new AxReferenceKey(state.getKey(), "taskSelectionLogic"), "MVEL", "Some TS logic "); state.setTrigger(inEvent.getKey()); state.getContextAlbumReferences().add(album0.getKey()); @@ -166,12 +168,12 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy state.setDefaultTask(task.getKey()); final AxStateOutput stateOutput0 = new AxStateOutput(new AxReferenceKey(state.getKey(), "stateOutput0"), - outEvent0.getKey(), AxReferenceKey.getNullKey()); + outEvent0.getKey(), AxReferenceKey.getNullKey()); state.getStateOutputs().put(stateOutput0.getKey().getLocalName(), stateOutput0); - final AxStateTaskReference stateTaskReference = - new AxStateTaskReference(new AxReferenceKey(state.getKey(), task.getKey().getName()), - AxStateTaskOutputType.DIRECT, stateOutput0.getKey()); + final AxStateTaskReference stateTaskReference = new AxStateTaskReference( + new AxReferenceKey(state.getKey(), task.getKey().getName()), AxStateTaskOutputType.DIRECT, + stateOutput0.getKey()); state.getTaskReferences().put(task.getKey(), stateTaskReference); @@ -203,15 +205,20 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy return policyModel; } + /** + * Gets another policy model. + * + * @return the model + */ public AxPolicyModel getAnotherModel() { - final AxContextSchema schema0 = - new AxContextSchema(new AxArtifactKey("eventContextItemA0", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema schema1 = - new AxContextSchema(new AxArtifactKey("eventContextItemA1", "0.0.1"), "Java", "java.lang.Long"); + final AxContextSchema schema0 = new AxContextSchema(new AxArtifactKey("eventContextItemA0", "0.0.1"), "Java", + "java.lang.String"); + final AxContextSchema schema1 = new AxContextSchema(new AxArtifactKey("eventContextItemA1", "0.0.1"), "Java", + "java.lang.Long"); final AxContextSchema schema2 = new AxContextSchema(new AxArtifactKey("StringTypeA", "0.0.1"), "Java", - "org.onap.policy.apex.model.policymodel.concepts.TestContextItem000"); + "org.onap.policy.apex.model.policymodel.concepts.TestContextItem000"); final AxContextSchema schema3 = new AxContextSchema(new AxArtifactKey("MapTypeA", "0.0.1"), "Java", - "org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A"); + "org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A"); final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("ContextSchemasA", "0.0.1")); schemas.getSchemasMap().put(schema0.getKey(), schema0); @@ -219,39 +226,39 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy schemas.getSchemasMap().put(schema2.getKey(), schema2); schemas.getSchemasMap().put(schema3.getKey(), schema3); - final AxContextAlbum album0 = - new AxContextAlbum(new AxArtifactKey("contextAlbumA0", "0.0.1"), "APPLICATION", true, schema3.getKey()); - final AxContextAlbum album1 = - new AxContextAlbum(new AxArtifactKey("contextAlbumA1", "0.0.1"), "GLOBAL", false, schema2.getKey()); + final AxContextAlbum album0 = new AxContextAlbum(new AxArtifactKey("contextAlbumA0", "0.0.1"), "APPLICATION", + true, schema3.getKey()); + final AxContextAlbum album1 = new AxContextAlbum(new AxArtifactKey("contextAlbumA1", "0.0.1"), "GLOBAL", false, + schema2.getKey()); final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("contextA", "0.0.1")); albums.getAlbumsMap().put(album0.getKey(), album0); albums.getAlbumsMap().put(album1.getKey(), album1); final AxEvent inEvent = new AxEvent(new AxArtifactKey("inEventA", "0.0.1"), - "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); + "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); inEvent.getParameterMap().put("IEPARA0", - new AxField(new AxReferenceKey(inEvent.getKey(), "IEPARA0"), schema0.getKey())); + new AxField(new AxReferenceKey(inEvent.getKey(), "IEPARA0"), schema0.getKey())); inEvent.getParameterMap().put("IEPARA1", - new AxField(new AxReferenceKey(inEvent.getKey(), "IEPARA1"), schema1.getKey())); + new AxField(new AxReferenceKey(inEvent.getKey(), "IEPARA1"), schema1.getKey())); final AxEvent outEvent0 = new AxEvent(new AxArtifactKey("outEventA0", "0.0.1"), - "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); + "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); outEvent0.getParameterMap().put("OE0PARA0", - new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PARA0"), schema0.getKey())); + new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PARA0"), schema0.getKey())); outEvent0.getParameterMap().put("OE0PARA1", - new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PARA1"), schema1.getKey())); + new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PARA1"), schema1.getKey())); outEvent0.getParameterMap().put("OE1PARA0", - new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PARA0"), schema0.getKey())); + new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PARA0"), schema0.getKey())); outEvent0.getParameterMap().put("OE1PARA1", - new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PARA1"), schema1.getKey())); + new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PARA1"), schema1.getKey())); final AxEvent outEvent1 = new AxEvent(new AxArtifactKey("outEventA1", "0.0.1"), - "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); + "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); outEvent1.getParameterMap().put("OE1PARA0", - new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PARA0"), schema0.getKey())); + new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PARA0"), schema0.getKey())); outEvent1.getParameterMap().put("OE1PARA1", - new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PARA1"), schema1.getKey())); + new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PARA1"), schema1.getKey())); final AxEvents events = new AxEvents(new AxArtifactKey("eventsA", "0.0.1")); events.getEventMap().put(inEvent.getKey(), inEvent); @@ -262,37 +269,37 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy for (final AxField field : inEvent.getFields()) { final AxReferenceKey fieldkey = new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(), - "inputFieldsA", field.getKey().getLocalName()); + "inputFieldsA", field.getKey().getLocalName()); final AxInputField inputField = new AxInputField(fieldkey, field.getSchema()); task.getInputFields().put(inputField.getKey().getLocalName(), inputField); } for (final AxField field : outEvent0.getFields()) { final AxReferenceKey fieldkey = new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(), - "outputFieldsA", field.getKey().getLocalName()); + "outputFieldsA", field.getKey().getLocalName()); final AxOutputField outputField = new AxOutputField(fieldkey, field.getSchema()); task.getOutputFields().put(outputField.getKey().getLocalName(), outputField); } for (final AxField field : outEvent1.getFields()) { final AxReferenceKey fieldkey = new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(), - "outputFieldsA", field.getKey().getLocalName()); + "outputFieldsA", field.getKey().getLocalName()); final AxOutputField outputField = new AxOutputField(fieldkey, field.getSchema()); task.getOutputFields().put(outputField.getKey().getLocalName(), outputField); } - final AxTaskParameter taskPar0 = - new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameterA0"), "Task parameter 0 value"); - final AxTaskParameter taskPar1 = - new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameterA1"), "Task parameter 1 value"); + final AxTaskParameter taskPar0 = new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameterA0"), + "Task parameter 0 value"); + final AxTaskParameter taskPar1 = new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameterA1"), + "Task parameter 1 value"); task.getTaskParameters().put(taskPar0.getKey().getLocalName(), taskPar0); task.getTaskParameters().put(taskPar1.getKey().getLocalName(), taskPar1); task.getContextAlbumReferences().add(album0.getKey()); task.getContextAlbumReferences().add(album1.getKey()); - final AxTaskLogic taskLogic = - new AxTaskLogic(new AxReferenceKey(task.getKey(), "taskLogicA"), "MVEL", "Some task logic"); + final AxTaskLogic taskLogic = new AxTaskLogic(new AxReferenceKey(task.getKey(), "taskLogicA"), "MVEL", + "Some task logic"); task.setTaskLogic(taskLogic); final AxTasks tasks = new AxTasks(new AxArtifactKey("tasksA", "0.0.1")); @@ -303,7 +310,7 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy final AxState state = new AxState(new AxReferenceKey(policy.getKey(), "stateA")); final AxTaskSelectionLogic taskSelectionLogic = new AxTaskSelectionLogic( - new AxReferenceKey(state.getKey(), "taskSelectionLogicA"), "MVEL", "Some TS logic "); + new AxReferenceKey(state.getKey(), "taskSelectionLogicA"), "MVEL", "Some TS logic "); state.setTrigger(inEvent.getKey()); state.getContextAlbumReferences().add(album0.getKey()); @@ -312,12 +319,12 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy state.setDefaultTask(task.getKey()); final AxStateOutput stateOutput0 = new AxStateOutput(new AxReferenceKey(state.getKey(), "stateOutputA0"), - outEvent0.getKey(), AxReferenceKey.getNullKey()); + outEvent0.getKey(), AxReferenceKey.getNullKey()); state.getStateOutputs().put(stateOutput0.getKey().getLocalName(), stateOutput0); - final AxStateTaskReference stateTaskReference = - new AxStateTaskReference(new AxReferenceKey(state.getKey(), task.getKey().getName()), - AxStateTaskOutputType.DIRECT, stateOutput0.getKey()); + final AxStateTaskReference stateTaskReference = new AxStateTaskReference( + new AxReferenceKey(state.getKey(), task.getKey().getName()), AxStateTaskOutputType.DIRECT, + stateOutput0.getKey()); state.getTaskReferences().put(task.getKey(), stateTaskReference); @@ -362,12 +369,12 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy final AxState state = policyModel.getPolicies().get("policy").getStateMap().get("state"); final AxTask task = policyModel.getTasks().get("task"); - final AxStateFinalizerLogic stateFinalizerLogic = - new AxStateFinalizerLogic(new AxReferenceKey(state.getKey(), "SFL"), "MVEL", "Some SF logic "); + final AxStateFinalizerLogic stateFinalizerLogic = new AxStateFinalizerLogic( + new AxReferenceKey(state.getKey(), "SFL"), "MVEL", "Some SF logic "); state.getStateFinalizerLogicMap().put(stateFinalizerLogic.getKey().getLocalName(), stateFinalizerLogic); - final AxStateTaskReference stateTaskReference = - new AxStateTaskReference(new AxReferenceKey(state.getKey(), task.getKey().getName()), - AxStateTaskOutputType.LOGIC, stateFinalizerLogic.getKey()); + final AxStateTaskReference stateTaskReference = new AxStateTaskReference( + new AxReferenceKey(state.getKey(), task.getKey().getName()), AxStateTaskOutputType.LOGIC, + stateFinalizerLogic.getKey()); state.getTaskReferences().put(task.getKey(), stateTaskReference); @@ -378,8 +385,8 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy public AxPolicyModel getWarningModel() { final AxPolicyModel policyModel = getModel(); - final AxState anotherState = - new AxState(new AxReferenceKey(new AxArtifactKey("policy", "0.0.1"), "anotherState")); + final AxState anotherState = new AxState( + new AxReferenceKey(new AxArtifactKey("policy", "0.0.1"), "anotherState")); final AxEvent inEvent = policyModel.getEvents().getEventMap().get(new AxArtifactKey("inEvent", "0.0.1")); final AxEvent outEvent0 = policyModel.getEvents().getEventMap().get(new AxArtifactKey("outEvent0", "0.0.1")); @@ -388,44 +395,44 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy for (final AxField field : inEvent.getFields()) { final AxReferenceKey fieldkey = new AxReferenceKey(anotherTask.getKey().getName(), - anotherTask.getKey().getVersion(), "inputFields", field.getKey().getLocalName()); + anotherTask.getKey().getVersion(), "inputFields", field.getKey().getLocalName()); final AxInputField inputField = new AxInputField(fieldkey, field.getSchema()); anotherTask.getInputFields().put(inputField.getKey().getLocalName(), inputField); } for (final AxField field : outEvent0.getFields()) { final AxReferenceKey fieldkey = new AxReferenceKey(anotherTask.getKey().getName(), - anotherTask.getKey().getVersion(), "outputFields", field.getKey().getLocalName()); + anotherTask.getKey().getVersion(), "outputFields", field.getKey().getLocalName()); final AxOutputField outputField = new AxOutputField(fieldkey, field.getSchema()); anotherTask.getOutputFields().put(outputField.getKey().getLocalName(), outputField); } final AxTaskParameter taskPar0 = new AxTaskParameter(new AxReferenceKey(anotherTask.getKey(), "taskParameter0"), - "Task parameter 0 value"); + "Task parameter 0 value"); final AxTaskParameter taskPar1 = new AxTaskParameter(new AxReferenceKey(anotherTask.getKey(), "taskParameter1"), - "Task parameter 1 value"); + "Task parameter 1 value"); anotherTask.getTaskParameters().put(taskPar0.getKey().getLocalName(), taskPar0); anotherTask.getTaskParameters().put(taskPar1.getKey().getLocalName(), taskPar1); - final AxTaskLogic taskLogic = - new AxTaskLogic(new AxReferenceKey(anotherTask.getKey(), "taskLogic"), "MVEL", "Some task logic"); + final AxTaskLogic taskLogic = new AxTaskLogic(new AxReferenceKey(anotherTask.getKey(), "taskLogic"), "MVEL", + "Some task logic"); anotherTask.setTaskLogic(taskLogic); policyModel.getTasks().getTaskMap().put(anotherTask.getKey(), anotherTask); - final AxStateOutput anotherStateOutput0 = - new AxStateOutput(new AxReferenceKey(anotherState.getKey(), "stateOutput0"), outEvent0.getKey(), + final AxStateOutput anotherStateOutput0 = new AxStateOutput( + new AxReferenceKey(anotherState.getKey(), "stateOutput0"), outEvent0.getKey(), AxReferenceKey.getNullKey()); anotherState.setTrigger(inEvent.getKey()); anotherState.getStateOutputs().put(anotherStateOutput0.getKey().getLocalName(), anotherStateOutput0); anotherState.setDefaultTask(anotherTask.getKey()); - final AxStateTaskReference anotherStateTaskReference = - new AxStateTaskReference(new AxReferenceKey(anotherState.getKey(), anotherTask.getKey().getName()), + final AxStateTaskReference anotherStateTaskReference = new AxStateTaskReference( + new AxReferenceKey(anotherState.getKey(), anotherTask.getKey().getName()), AxStateTaskOutputType.DIRECT, anotherStateOutput0.getKey()); anotherState.getTaskReferences().put(anotherTask.getKey(), anotherStateTaskReference); policyModel.getPolicies().getPolicyMap().get(new AxArtifactKey("policy", "0.0.1")).getStateMap() - .put(anotherState.getKey().getLocalName(), anotherState); + .put(anotherState.getKey().getLocalName(), anotherState); policyModel.getKeyInformation().generateKeyInfo(policyModel); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyLogicReader.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyLogicReader.java index 446cbeed8..bb16c90d1 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyLogicReader.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyLogicReader.java @@ -31,6 +31,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxLogic; import org.onap.policy.apex.model.policymodel.handling.PolicyLogicReader; /** + * Logic reader for policy tests. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestPolicyLogicReader { @@ -51,9 +53,8 @@ public class TestPolicyLogicReader { new AxLogic(logicKey, "FunkyLogic", plReader); fail("test should throw an exception here"); } catch (final Exception e) { - assertEquals( - "logic not found for logic \"somewhere/over/the/rainbow/funkylogic/FunkyDefaultLogic.funkylogic\"", - e.getMessage()); + assertEquals("logic not found for logic " + + "\"somewhere/over/the/rainbow/funkylogic/FunkyDefaultLogic.funkylogic\"", e.getMessage()); } plReader.setDefaultLogic(null); @@ -61,9 +62,9 @@ public class TestPolicyLogicReader { new AxLogic(logicKey, "FunkyLogic", plReader); fail("test should throw an exception here"); } catch (final Exception e) { - assertEquals( - "logic not found for logic \"somewhere/over/the/rainbow/funkylogic/LogicParent_LogicInstanceName.funkylogic\"", - e.getMessage()); + assertEquals("logic not found for logic " + + "\"somewhere/over/the/rainbow/funkylogic/LogicParent_LogicInstanceName.funkylogic\"", + e.getMessage()); } logicKey.setParentLocalName("LogicParentLocalName"); @@ -71,9 +72,8 @@ public class TestPolicyLogicReader { new AxLogic(logicKey, "FunkyLogic", plReader); fail("test should throw an exception here"); } catch (final Exception e) { - assertEquals( - "logic not found for logic \"somewhere/over/the/rainbow/funkylogic/LogicParent_LogicParentLocalName_LogicInstanceName.funkylogic\"", - e.getMessage()); + assertEquals("logic not found for logic " + "\"somewhere/over/the/rainbow/funkylogic/" + + "LogicParent_LogicParentLocalName_LogicInstanceName.funkylogic\"", e.getMessage()); } plReader.setLogicPackage("path.to.apex.logic"); @@ -98,7 +98,7 @@ public class TestPolicyLogicReader { try { final AxLogic logic = new AxLogic(logicKey, "JAVA", plReader); assertEquals("somewhere.over.the.rainbow.java.LogicParent_LogicParentLocalName_LogicInstanceName", - logic.getLogic()); + logic.getLogic()); } catch (final Exception e) { fail("test should not throw an exception"); } diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyModelMerger.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyModelMerger.java index 92d1dc32a..8f717a234 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyModelMerger.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyModelMerger.java @@ -31,6 +31,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; import org.onap.policy.apex.model.policymodel.handling.PolicyModelMerger; /** + * Test model merging. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestPolicyModelMerger { @@ -41,8 +43,8 @@ public class TestPolicyModelMerger { AxPolicyModel rightPolicyModel = new TestApexPolicyModelCreator().getModel(); try { - final AxPolicyModel mergedPolicyModel = - PolicyModelMerger.getMergedPolicyModel(leftPolicyModel, rightPolicyModel, false); + final AxPolicyModel mergedPolicyModel = PolicyModelMerger.getMergedPolicyModel(leftPolicyModel, + rightPolicyModel, false); assertEquals(leftPolicyModel, mergedPolicyModel); assertEquals(rightPolicyModel, mergedPolicyModel); } catch (final ApexModelException e) { @@ -66,8 +68,8 @@ public class TestPolicyModelMerger { leftPolicyModel.getKeyInformation().generateKeyInfo(leftPolicyModel); try { - final AxPolicyModel mergedPolicyModel = - PolicyModelMerger.getMergedPolicyModel(leftPolicyModel, rightPolicyModel, true); + final AxPolicyModel mergedPolicyModel = PolicyModelMerger.getMergedPolicyModel(leftPolicyModel, + rightPolicyModel, true); assertNotNull(mergedPolicyModel); } catch (final ApexModelException e) { fail("test should not throw an exception"); @@ -90,8 +92,8 @@ public class TestPolicyModelMerger { rightPolicyModel.getKeyInformation().generateKeyInfo(rightPolicyModel); try { - final AxPolicyModel mergedPolicyModel = - PolicyModelMerger.getMergedPolicyModel(leftPolicyModel, rightPolicyModel, false); + final AxPolicyModel mergedPolicyModel = PolicyModelMerger.getMergedPolicyModel(leftPolicyModel, + rightPolicyModel, false); assertNotNull(mergedPolicyModel); } catch (final ApexModelException e) { fail("test should not throw an exception"); @@ -99,8 +101,8 @@ public class TestPolicyModelMerger { rightPolicyModel = new TestApexPolicyModelCreator().getAnotherModel(); try { - final AxPolicyModel mergedPolicyModel = - PolicyModelMerger.getMergedPolicyModel(leftPolicyModel, rightPolicyModel, true); + final AxPolicyModel mergedPolicyModel = PolicyModelMerger.getMergedPolicyModel(leftPolicyModel, + rightPolicyModel, true); assertNotNull(mergedPolicyModel); } catch (final ApexModelException e) { fail("test should not throw an exception"); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/utils/PolicyModelValidator.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/utils/PolicyModelValidator.java index 4610a827e..9cee85491 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/utils/PolicyModelValidator.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/utils/PolicyModelValidator.java @@ -28,11 +28,19 @@ import org.onap.policy.apex.model.basicmodel.handling.ApexModelException; import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +/** + * Main class to run the policy model validator. + */ public class PolicyModelValidator { + /** + * Main method. + * @param args the command line arguments + * @throws ApexModelException on errors on the apex model + * @throws FileNotFoundException on file find failures + */ public static void main(final String[] args) throws ApexModelException, FileNotFoundException { - final ApexModelReader<AxPolicyModel> policyModelReader = - new ApexModelReader<AxPolicyModel>(AxPolicyModel.class); - + final ApexModelReader<AxPolicyModel> policyModelReader = new ApexModelReader<AxPolicyModel>( + AxPolicyModel.class); final AxPolicyModel policyModel = policyModelReader.read(new FileInputStream(args[0])); final AxValidationResult result = policyModel.validate(new AxValidationResult()); |