diff options
author | Jorge Hernandez <jh1730@att.com> | 2018-09-04 20:13:38 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-09-04 20:13:38 +0000 |
commit | f7689b84472ab4698d9d96f1de08402208d99ca8 (patch) | |
tree | f003c5aef834f2158726ab678eb9a76e1ae37dac | |
parent | 25ac320ced13ae5da0e55db5404f62237bdaa491 (diff) | |
parent | 87be30582d1db37bee7c6b456c0c5c3ca9584963 (diff) |
Merge "Fix checkstyle issues in apex model basic"
201 files changed, 1535 insertions, 1511 deletions
diff --git a/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ApexDeploymentRestResource.java b/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ApexDeploymentRestResource.java index 13192aa2a..18aae5001 100644 --- a/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ApexDeploymentRestResource.java +++ b/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ApexDeploymentRestResource.java @@ -88,9 +88,9 @@ public class ApexDeploymentRestResource { final JsonObject responseObject = new JsonObject(); // Engine Service data - responseObject.addProperty("engine_id", engineServiceFacade.getKey().getID()); + responseObject.addProperty("engine_id", engineServiceFacade.getKey().getId()); responseObject.addProperty("model_id", - engineServiceFacade.getApexModelKey() != null ? engineServiceFacade.getApexModelKey().getID() + engineServiceFacade.getApexModelKey() != null ? engineServiceFacade.getApexModelKey().getId() : "Not Set"); responseObject.addProperty("server", hostName); responseObject.addProperty("port", Integer.toString(port)); @@ -132,16 +132,16 @@ public class ApexDeploymentRestResource { engineServiceFacade.deployModel(fileDetail.getFileName(), uploadedInputStream, ignoreConflicts, forceUpdate); } catch (final Exception e) { - LOGGER.warn("Error updating model on engine service " + engineServiceFacade.getKey().getID(), e); + LOGGER.warn("Error updating model on engine service " + engineServiceFacade.getKey().getId(), e); final String errorMessage = - "Error updating model on engine service " + engineServiceFacade.getKey().getID(); + "Error updating model on engine service " + engineServiceFacade.getKey().getId(); LOGGER.warn(errorMessage + "<br>", e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage + "\n" + e.getMessage()) .build(); } return Response.ok("Model " + fileDetail.getFileName() + " deployed on engine service " - + engineServiceFacade.getKey().getID()).build(); + + engineServiceFacade.getKey().getId()).build(); } } diff --git a/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ParameterCheck.java b/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ParameterCheck.java index 50117e52b..b68ffebcf 100644 --- a/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ParameterCheck.java +++ b/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ParameterCheck.java @@ -154,7 +154,7 @@ public final class ParameterCheck { */ public static ParameterCheck.StartStop getStartStop(final Map<String, String[]> parameterMap, final AxArtifactKey engineKey) { - final String startStopPar = AXARTIFACTKEY_PAR + '#' + engineKey.getID(); + final String startStopPar = AXARTIFACTKEY_PAR + '#' + engineKey.getId(); if (!parameterMap.containsKey(startStopPar)) { LOGGER.warn("parameter \"" + startStopPar + "\" not found"); return null; diff --git a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java index 4893775ea..012167b51 100644 --- a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java +++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java @@ -108,7 +108,7 @@ public class RestInterfaceTest { localmodel = new ApexModelReader<>(AxPolicyModel.class, false) .read(ResourceUtils.getResourceAsStream(TESTMODELFILE)); localmodelString = - new ApexModelStringWriter<AxPolicyModel>(false).writeJSONString(localmodel, AxPolicyModel.class); + new ApexModelStringWriter<AxPolicyModel>(false).writeJsonString(localmodel, AxPolicyModel.class); // initialize a session ID createNewSession(); @@ -195,7 +195,7 @@ public class RestInterfaceTest { // Write that local copy of the AxPolicy object to a Json String, ten parse it again final ApexModelStringWriter<AxPolicy> apexModelWriter = new ApexModelStringWriter<>(false); - final String localPolicyString = apexModelWriter.writeJSONString(localpolicy, AxPolicy.class); + final String localPolicyString = apexModelWriter.writeJsonString(localpolicy, AxPolicy.class); apexPolicyReader = new ApexModelReader<>(AxPolicy.class, false); final AxPolicy localpolicyReparsed = apexPolicyReader.read(localPolicyString); // AxPolicy localpolicy_reparsed = RestUtils.getConceptFromJSON(returnedPolicyAsString, AxPolicy.class); diff --git a/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ParameterCheck.java b/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ParameterCheck.java index 8e7cbea71..d7b7229c4 100644 --- a/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ParameterCheck.java +++ b/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ParameterCheck.java @@ -154,7 +154,7 @@ public final class ParameterCheck { */ public static ParameterCheck.StartStop getStartStop(final Map<String, String[]> parameterMap, final AxArtifactKey engineKey) { - final String startStopPar = AXARTIFACTKEY_PAR + '#' + engineKey.getID(); + final String startStopPar = AXARTIFACTKEY_PAR + '#' + engineKey.getId(); if (!parameterMap.containsKey(startStopPar)) { LOGGER.warn("parameter \"" + startStopPar + "\" not found"); return null; diff --git a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestResource.java b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestResource.java index 6a614f326..85465a14b 100644 --- a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestResource.java +++ b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestResource.java @@ -105,9 +105,9 @@ public class ApexMonitoringRestResource { final JsonObject responseObject = new JsonObject(); // Engine Service data - responseObject.addProperty("engine_id", engineServiceFacade.getKey().getID()); + responseObject.addProperty("engine_id", engineServiceFacade.getKey().getId()); responseObject.addProperty("model_id", - engineServiceFacade.getApexModelKey() != null ? engineServiceFacade.getApexModelKey().getID() + engineServiceFacade.getApexModelKey() != null ? engineServiceFacade.getApexModelKey().getId() : "Not Set"); responseObject.addProperty("server", hostName); responseObject.addProperty("port", Integer.toString(port)); @@ -121,23 +121,23 @@ public class ApexMonitoringRestResource { final JsonObject engineStatusObject = new JsonObject(); final AxEngineModel axEngineModel = engineServiceFacade.getEngineStatus(engineKey); engineStatusObject.addProperty("timestamp", axEngineModel.getTimeStampString()); - engineStatusObject.addProperty("id", engineKey.getID()); + engineStatusObject.addProperty("id", engineKey.getId()); engineStatusObject.addProperty("status", axEngineModel.getState().toString()); engineStatusObject.addProperty("last_message", axEngineModel.getStats().getTimeStampString()); engineStatusObject.addProperty("up_time", axEngineModel.getStats().getUpTime() / 1000L); engineStatusObject.addProperty("policy_executions", axEngineModel.getStats().getEventCount()); engineStatusObject.addProperty("last_policy_duration", gson.toJson( - getValuesFromCache(host, engineKey.getID() + "_last_policy_duration", + getValuesFromCache(host, engineKey.getId() + "_last_policy_duration", axEngineModel.getTimestamp(), axEngineModel.getStats().getLastExecutionTime()), List.class)); engineStatusObject.addProperty("average_policy_duration", - gson.toJson(getValuesFromCache(host, engineKey.getID() + "_average_policy_duration", + gson.toJson(getValuesFromCache(host, engineKey.getId() + "_average_policy_duration", axEngineModel.getTimestamp(), (long) axEngineModel.getStats().getAverageExecutionTime()), List.class)); engineStatusList.add(engineStatusObject); } catch (final ApexException e) { - LOGGER.warn("Error getting status of engine with ID " + engineKey.getID() + "<br>", e); + LOGGER.warn("Error getting status of engine with ID " + engineKey.getId() + "<br>", e); } } responseObject.add("status", engineStatusList); @@ -149,12 +149,12 @@ public class ApexMonitoringRestResource { final String engineInfo = engineServiceFacade.getEngineInfo(engineKey); if (engineInfo != null && !engineInfo.trim().isEmpty()) { final JsonObject engineContextObject = new JsonObject(); - engineContextObject.addProperty("id", engineKey.getID()); + engineContextObject.addProperty("id", engineKey.getId()); engineContextObject.addProperty("engine_info", engineInfo); engineContextList.add(engineContextObject); } } catch (final ApexException e) { - LOGGER.warn("Error getting runtime information of engine with ID " + engineKey.getID() + "<br>", e); + LOGGER.warn("Error getting runtime information of engine with ID " + engineKey.getId() + "<br>", e); } } responseObject.add("context", engineContextList); diff --git a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ParameterCheck.java b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ParameterCheck.java index 5bc40c8db..c8eb5ad66 100644 --- a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ParameterCheck.java +++ b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ParameterCheck.java @@ -154,7 +154,7 @@ public final class ParameterCheck { */ public static ParameterCheck.StartStop getStartStop(final Map<String, String[]> parameterMap, final AxArtifactKey engineKey) { - final String startStopPar = AXARTIFACTKEY_PAR + '#' + engineKey.getID(); + final String startStopPar = AXARTIFACTKEY_PAR + '#' + engineKey.getId(); if (!parameterMap.containsKey(startStopPar)) { LOGGER.warn("parameter \"" + startStopPar + "\" not found"); return null; diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java index fbaeb2c91..305f14c8d 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java @@ -290,7 +290,7 @@ public final class ContextAlbumImpl implements ContextAlbum { public Object get(final Object key) { if (key == null) { final String returnString = - "album \"" + albumDefinition.getID() + "\" null keys are illegal on keys for get()"; + "album \"" + albumDefinition.getId() + "\" null keys are illegal on keys for get()"; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } @@ -365,20 +365,20 @@ public final class ContextAlbumImpl implements ContextAlbum { public Object put(final String key, final Object incomingValue) { if (key == null) { final String returnString = - "album \"" + albumDefinition.getID() + "\" null keys are illegal on keys for put()"; + "album \"" + albumDefinition.getId() + "\" null keys are illegal on keys for put()"; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } if (incomingValue == null) { - final String returnString = "album \"" + albumDefinition.getID() + "\" null values are illegal on key \"" + final String returnString = "album \"" + albumDefinition.getId() + "\" null values are illegal on key \"" + key + "\" for put()"; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } if (!albumDefinition.isWritable()) { - final String returnString = "album \"" + albumDefinition.getID() + final String returnString = "album \"" + albumDefinition.getId() + "\" put() not allowed on read only albums for key=\"" + key + "\", value=\"" + incomingValue; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); @@ -403,7 +403,7 @@ public final class ContextAlbumImpl implements ContextAlbum { return albumMap.put(key, valueToPut); } catch (final ContextRuntimeException e) { final String returnString = "Failed to set context value for key \"" + key + "\" in album \"" - + albumDefinition.getID() + "\": " + e.getMessage(); + + albumDefinition.getId() + "\": " + e.getMessage(); LOGGER.warn(returnString); throw new ContextRuntimeException(returnString, e); } @@ -418,7 +418,7 @@ public final class ContextAlbumImpl implements ContextAlbum { public void putAll(final Map<? extends String, ? extends Object> incomingContextAlbum) { if (!albumDefinition.isWritable()) { final String returnString = - "album \"" + albumDefinition.getID() + "\" putAll() not allowed on read only albums"; + "album \"" + albumDefinition.getId() + "\" putAll() not allowed on read only albums"; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } @@ -454,7 +454,7 @@ public final class ContextAlbumImpl implements ContextAlbum { @Override public Object remove(final Object key) { if (!albumDefinition.isWritable()) { - final String returnString = "album \"" + albumDefinition.getID() + final String returnString = "album \"" + albumDefinition.getId() + "\" remove() not allowed on read only albums for key=\"" + key + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); @@ -483,7 +483,7 @@ public final class ContextAlbumImpl implements ContextAlbum { public void clear() { if (!albumDefinition.isWritable()) { final String returnString = - "album \"" + albumDefinition.getID() + "\" clear() not allowed on read only albums"; + "album \"" + albumDefinition.getId() + "\" clear() not allowed on read only albums"; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/AbstractDistributor.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/AbstractDistributor.java index e5a45b203..e40646d56 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/AbstractDistributor.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/AbstractDistributor.java @@ -159,7 +159,7 @@ public abstract class AbstractDistributor implements Distributor { // Get the context album definition final AxContextAlbum album = ModelService.getModel(AxContextAlbums.class).get(axContextAlbumKey); if (album == null) { - final String resultString = "context album " + axContextAlbumKey.getID() + " does not exist"; + final String resultString = "context album " + axContextAlbumKey.getId() + " does not exist"; LOGGER.warn(resultString); throw new ContextException(resultString); } @@ -168,7 +168,7 @@ public abstract class AbstractDistributor implements Distributor { final AxValidationResult result = album.validate(new AxValidationResult()); if (!result.isValid()) { final String resultString = - "context album definition for " + album.getKey().getID() + " is invalid" + result; + "context album definition for " + album.getKey().getId() + " is invalid" + result; LOGGER.warn(resultString); throw new ContextException(resultString); } @@ -176,8 +176,8 @@ public abstract class AbstractDistributor implements Distributor { // Get the schema of the context album final AxContextSchema schema = ModelService.getModel(AxContextSchemas.class).get(album.getItemSchema()); if (schema == null) { - final String resultString = "schema \"" + album.getItemSchema().getID() + "\" for context album " - + album.getKey().getID() + " does not exist"; + final String resultString = "schema \"" + album.getItemSchema().getId() + "\" for context album " + + album.getKey().getId() + " does not exist"; LOGGER.warn(resultString); throw new ContextException(resultString); } @@ -266,7 +266,7 @@ public abstract class AbstractDistributor implements Distributor { @Override public synchronized void lockForReading(final AxArtifactKey mapKey, final String itemKey) throws ContextException { // Lock using the lock manager - lockManager.lockForReading(mapKey.getID(), itemKey); + lockManager.lockForReading(mapKey.getId(), itemKey); } /* @@ -277,7 +277,7 @@ public abstract class AbstractDistributor implements Distributor { @Override public synchronized void lockForWriting(final AxArtifactKey mapKey, final String itemKey) throws ContextException { // Lock using the lock manager - lockManager.lockForWriting(mapKey.getID(), itemKey); + lockManager.lockForWriting(mapKey.getId(), itemKey); } /* @@ -288,7 +288,7 @@ public abstract class AbstractDistributor implements Distributor { @Override public void unlockForReading(final AxArtifactKey mapKey, final String itemKey) throws ContextException { // Unlock using the lock manager - lockManager.unlockForReading(mapKey.getID(), itemKey); + lockManager.unlockForReading(mapKey.getId(), itemKey); } /* @@ -299,7 +299,7 @@ public abstract class AbstractDistributor implements Distributor { @Override public void unlockForWriting(final AxArtifactKey mapKey, final String itemKey) throws ContextException { // Unlock using the lock manager - lockManager.unlockForWriting(mapKey.getID(), itemKey); + lockManager.unlockForWriting(mapKey.getId(), itemKey); } /* diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java index 19bb3602e..2c3661822 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java @@ -68,7 +68,7 @@ public class DistributorFlushTimerTask extends TimerTask { timer = new Timer(DistributorFlushTimerTask.class.getSimpleName(), true); timer.schedule(this, period, period); - LOGGER.debug("context distributor " + contextDistributor.getKey().getID() + " flushing set up with interval: " + LOGGER.debug("context distributor " + contextDistributor.getKey().getId() + " flushing set up with interval: " + period + "ms"); } @@ -80,14 +80,14 @@ public class DistributorFlushTimerTask extends TimerTask { // Increment the flush counter flushCount++; - LOGGER.debug("context distributor " + contextDistributor.getKey().getID() + " flushing: period=" + period + LOGGER.debug("context distributor " + contextDistributor.getKey().getId() + " flushing: period=" + period + ": count=" + flushCount); try { contextDistributor.flush(); - LOGGER.debug("context distributor " + contextDistributor.getKey().getID() + " flushed: period=" + period + LOGGER.debug("context distributor " + contextDistributor.getKey().getId() + " flushed: period=" + period + ": count=" + flushCount); } catch (final ContextException e) { - LOGGER.error("flush error on context distributor " + contextDistributor.getKey().getID() + ": period=" + LOGGER.error("flush error on context distributor " + contextDistributor.getKey().getId() + ": period=" + period + ": count=" + flushCount, e); } } diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/JVMLocalDistributor.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/JVMLocalDistributor.java index dc6637227..cb9a77883 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/JVMLocalDistributor.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/JVMLocalDistributor.java @@ -54,7 +54,7 @@ public class JVMLocalDistributor extends AbstractDistributor { */ @Override public Map<String, Object> getContextAlbumMap(final AxArtifactKey contextMapKey) { - LOGGER.debug("create map: " + contextMapKey.getID()); + LOGGER.debug("create map: " + contextMapKey.getId()); return Collections.synchronizedMap(new HashMap<String, Object>()); } diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java index 6ce924b0e..5513cc7e6 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java @@ -124,7 +124,7 @@ public abstract class AbstractSchemaHelper implements SchemaHelper { public Object createNewInstance() { if (schemaClass == null) { final String returnString = - userKey.getID() + ": could not create an instance, schema class for the schema is null"; + userKey.getId() + ": could not create an instance, schema class for the schema is null"; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } @@ -133,7 +133,7 @@ public abstract class AbstractSchemaHelper implements SchemaHelper { return schemaClass.newInstance(); } catch (final Exception e) { final String returnString = - userKey.getID() + ": could not create an instance of class \"" + schemaClass.getCanonicalName() + userKey.getId() + ": could not create an instance of class \"" + schemaClass.getCanonicalName() + "\" using the default constructor \"" + schemaClass.getSimpleName() + "()\""; LOGGER.warn(returnString, e); throw new ContextRuntimeException(returnString, e); @@ -149,7 +149,7 @@ public abstract class AbstractSchemaHelper implements SchemaHelper { public Object createNewInstance(final String stringValue) { if (schemaClass == null) { final String returnString = - userKey.getID() + ": could not create an instance, schema class for the schema is null"; + userKey.getId() + ": could not create an instance, schema class for the schema is null"; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } @@ -162,7 +162,7 @@ public abstract class AbstractSchemaHelper implements SchemaHelper { return stringConstructor.newInstance(stringValue); } catch (final Exception e) { final String returnString = - userKey.getID() + ": could not create an instance of class \"" + schemaClass.getCanonicalName() + userKey.getId() + ": could not create an instance of class \"" + schemaClass.getCanonicalName() + "\" using the string constructor \"" + schemaClass.getSimpleName() + "(String)\""; LOGGER.warn(returnString, e); throw new ContextRuntimeException(returnString); diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/SchemaHelperFactory.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/SchemaHelperFactory.java index 84025fc25..c6120c783 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/SchemaHelperFactory.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/SchemaHelperFactory.java @@ -62,7 +62,7 @@ public class SchemaHelperFactory { final AxContextSchema schema = ModelService.getModel(AxContextSchemas.class).get(schemaKey); if (schema == null) { final String resultString = - "schema \"" + schemaKey.getID() + "\" for entity " + owningEntityKey.getID() + " does not exist"; + "schema \"" + schemaKey.getId() + "\" for entity " + owningEntityKey.getId() + " does not exist"; LOGGER.warn(resultString); throw new ContextRuntimeException(resultString); } diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java index 1bfe77a45..c6a34e364 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java @@ -82,8 +82,8 @@ public class JavaSchemaHelper extends AbstractSchemaHelper { setSchemaClass(TypeBuilder.getJavaTypeClass(schema.getSchema())); } catch (final IllegalArgumentException e) { - String resultSting = userKey.getID() + ": class/type " + schema.getSchema() + " for context schema \"" - + schema.getID() + "\" not found."; + String resultSting = userKey.getId() + ": class/type " + schema.getSchema() + " for context schema \"" + + schema.getId() + "\" not found."; if (JavaSchemaHelper.BUILT_IN_MAP.get(javatype) != null) { resultSting += " Primitive types are not supported. Use the appropriate Java boxing type instead."; } else { @@ -107,7 +107,7 @@ public class JavaSchemaHelper extends AbstractSchemaHelper { if (getSchemaClass() == null) { final String returnString = - getUserKey().getID() + ": could not create an instance, schema class for the schema is null"; + getUserKey().getId() + ": could not create an instance, schema class for the schema is null"; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } @@ -121,7 +121,7 @@ public class JavaSchemaHelper extends AbstractSchemaHelper { return incomingObject; } - final String returnString = getUserKey().getID() + ": the object \"" + incomingObject + "\" of type \"" + final String returnString = getUserKey().getId() + ": the object \"" + incomingObject + "\" of type \"" + incomingObject.getClass().getCanonicalName() + "\" is not an instance of JsonObject and is not assignable to \"" + getSchemaClass().getCanonicalName() + "\""; @@ -173,7 +173,7 @@ public class JavaSchemaHelper extends AbstractSchemaHelper { // Use Gson to translate the object return new Gson().toJson(schemaObject); } else { - final String returnString = getUserKey().getID() + ": object \"" + schemaObject.toString() + final String returnString = getUserKey().getId() + ": object \"" + schemaObject.toString() + "\" of class \"" + schemaObject.getClass().getCanonicalName() + "\" not compatible with class \"" + getSchemaClass().getCanonicalName() + "\""; LOGGER.warn(returnString); @@ -232,7 +232,7 @@ public class JavaSchemaHelper extends AbstractSchemaHelper { final Constructor<?> stringConstructor = getSchemaClass().getConstructor(String.class); return stringConstructor.newInstance(object.toString()); } catch (final Exception e) { - final String returnString = getUserKey().getID() + ": object \"" + object.toString() + "\" of class \"" + final String returnString = getUserKey().getId() + ": object \"" + object.toString() + "\" of class \"" + object.getClass().getCanonicalName() + "\" not compatible with class \"" + getSchemaClass().getCanonicalName() + "\""; LOGGER.warn(returnString); diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/ContextMonitor.java b/context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/ContextMonitor.java index 8e34ecb1b..e3b335697 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/ContextMonitor.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/ContextMonitor.java @@ -184,9 +184,9 @@ public class ContextMonitor { builder.append(','); } if (stackKey instanceof AxArtifactKey) { - builder.append(((AxArtifactKey) stackKey).getID()); + builder.append(((AxArtifactKey) stackKey).getId()); } else if (stackKey instanceof AxReferenceKey) { - builder.append(((AxReferenceKey) stackKey).getID()); + builder.append(((AxReferenceKey) stackKey).getId()); } else { builder.append(stackKey.toString()); } @@ -194,9 +194,9 @@ public class ContextMonitor { } builder.append("],"); - builder.append(albumKey.getID()); + builder.append(albumKey.getId()); builder.append(','); - builder.append(schemaKey.getID()); + builder.append(schemaKey.getId()); builder.append(','); builder.append(name); diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java index 5f2b426bd..0208b7a9c 100644 --- a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java +++ b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java @@ -155,9 +155,9 @@ public class ContextAlbumImplTest { ContextAlbum albumRo = new ContextAlbumImpl(axContextAlbumRo, distributor, new LinkedHashMap<String, Object>()); assertEquals("TestContextAlbum", album.getName()); - assertEquals("TestContextAlbum:0.0.1", album.getKey().getID()); - assertEquals("TestContextAlbum:0.0.1", album.getAlbumDefinition().getID()); - assertEquals("SimpleStringSchema:0.0.1", album.getSchemaHelper().getSchema().getID()); + assertEquals("TestContextAlbum:0.0.1", album.getKey().getId()); + assertEquals("TestContextAlbum:0.0.1", album.getAlbumDefinition().getId()); + assertEquals("SimpleStringSchema:0.0.1", album.getSchemaHelper().getSchema().getId()); try { album.containsKey(null); @@ -272,8 +272,8 @@ public class ContextAlbumImplTest { AxConcept[] userArtifactStack = { somePolicyKey, somePolicyState }; album.setUserArtifactStack(userArtifactStack); - assertEquals("MyPolicy:0.0.1", album.getUserArtifactStack()[0].getID()); - assertEquals("MyPolicy:0.0.1:NULL:SomeState", album.getUserArtifactStack()[1].getID()); + assertEquals("MyPolicy:0.0.1", album.getUserArtifactStack()[0].getId()); + assertEquals("MyPolicy:0.0.1:NULL:SomeState", album.getUserArtifactStack()[1].getId()); assertEquals(true, album.keySet().contains("Key0")); assertEquals(true, album.values().contains("value of Key0")); diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java index d3a8ba163..c8628935c 100644 --- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java +++ b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java @@ -51,7 +51,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.dao.ApexDao; import org.onap.policy.apex.model.basicmodel.dao.ApexDaoFactory; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.handling.ApexModelException; import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum; import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel; @@ -123,11 +123,11 @@ public class TestPersistentContextInstantiation { final AxArtifactKey[] usedArtifactStackArray = {new AxArtifactKey("testC-top", "0.0.1"), new AxArtifactKey("testC-next", "0.0.1"), new AxArtifactKey("testC-bot", "0.0.1")}; - final DAOParameters daoParameters = new DAOParameters(); - daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); - daoParameters.setPersistenceUnit("DAOTest"); - final ApexDao apexDao = new ApexDaoFactory().createApexDao(daoParameters); - apexDao.init(daoParameters); + final DaoParameters DaoParameters = new DaoParameters(); + DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); + DaoParameters.setPersistenceUnit("DAOTest"); + final ApexDao apexDao = new ApexDaoFactory().createApexDao(DaoParameters); + apexDao.init(DaoParameters); final AxContextModel someContextModel = TestContextAlbumFactory.createMultiAlbumsContextModel(); diff --git a/context/context-test-utils/src/test/resources/META-INF/persistence.xml b/context/context-test-utils/src/test/resources/META-INF/persistence.xml index ec9357851..b7911caa2 100644 --- a/context/context-test-utils/src/test/resources/META-INF/persistence.xml +++ b/context/context-test-utils/src/test/resources/META-INF/persistence.xml @@ -23,8 +23,8 @@ <persistence-unit name="DAOTest" transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner</class> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxConcept</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class> diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java index 2186ee31d..85e45f718 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java @@ -148,10 +148,10 @@ public final class ApexInternalContext implements AxConceptGetter<ContextAlbum> // The schema is different, throw an exception because the schema should not change if the key of the // album has not changed throw new ContextException("internal context update failed on context album \"" - + contextAlbumEntry.getKey().getID() + "\" in model \"" + key.getID() + "\", schema \"" - + currentContextAlbum.getItemSchema().getID() + + contextAlbumEntry.getKey().getId() + "\" in model \"" + key.getId() + "\", schema \"" + + currentContextAlbum.getItemSchema().getId() + "\" on existing context model does not equal schema \"" - + newContextAlbum.getItemSchema().getID() + "\" on incoming model"); + + newContextAlbum.getItemSchema().getId() + "\" on incoming model"); } } diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java index 235140863..3349b609f 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java @@ -82,7 +82,7 @@ public class ApexEngineImpl implements ApexEngine { protected ApexEngineImpl(final AxArtifactKey key) { argumentNotNull(key, "AxArtifactKey may not be null"); - LOGGER.entry("ApexEngine()->" + key.getID() + "," + state); + LOGGER.entry("ApexEngine()->" + key.getId() + "," + state); this.key = key; @@ -90,7 +90,7 @@ public class ApexEngineImpl implements ApexEngine { engineStats = new AxEngineStats(); engineStats.setKey(new AxReferenceKey(key, "_EngineStats")); - LOGGER.exit("ApexEngine()<-" + key.getID() + "," + state); + LOGGER.exit("ApexEngine()<-" + key.getId() + "," + state); } /* @@ -103,16 +103,16 @@ public class ApexEngineImpl implements ApexEngine { @Override public void updateModel(final AxPolicyModel apexModel) throws ApexException { if (apexModel != null) { - LOGGER.entry("updateModel()->" + key.getID() + ", apexPolicyModel=" + apexModel.getKey().getID()); + LOGGER.entry("updateModel()->" + key.getId() + ", apexPolicyModel=" + apexModel.getKey().getId()); } else { - LOGGER.warn("updateModel()<-" + key.getID() + ", Apex model not set"); + LOGGER.warn("updateModel()<-" + key.getId() + ", Apex model not set"); throw new ApexException( - "updateModel()<-" + key.getID() + ", Apex model is not defined, it has a null value"); + "updateModel()<-" + key.getId() + ", Apex model is not defined, it has a null value"); } // The engine must be stopped in order to do a model update if (!state.equals(AxEngineState.STOPPED)) { - throw new ApexException("updateModel()<-" + key.getID() + throw new ApexException("updateModel()<-" + key.getId() + ", cannot update model, engine should be stopped but is in state " + state); } @@ -127,10 +127,10 @@ public class ApexEngineImpl implements ApexEngine { } } catch (final ContextException e) { LOGGER.warn( - "updateModel()<-" + key.getID() + ", error setting the context for engine \"" + key.getID() + "\"", + "updateModel()<-" + key.getId() + ", error setting the context for engine \"" + key.getId() + "\"", e); throw new ApexException( - "updateModel()<-" + key.getID() + ", error setting the context for engine \"" + key.getID() + "\"", + "updateModel()<-" + key.getId() + ", error setting the context for engine \"" + key.getId() + "\"", e); } @@ -140,13 +140,13 @@ public class ApexEngineImpl implements ApexEngine { // always set up as new stateMachineHandler = new StateMachineHandler(internalContext); } catch (final StateMachineException e) { - LOGGER.warn("updateModel()<-" + key.getID() + ", error setting up the engine state machines \"" - + key.getID() + "\"", e); - throw new ApexException("updateModel()<-" + key.getID() + ", error setting up the engine state machines \"" - + key.getID() + "\"", e); + LOGGER.warn("updateModel()<-" + key.getId() + ", error setting up the engine state machines \"" + + key.getId() + "\"", e); + throw new ApexException("updateModel()<-" + key.getId() + ", error setting up the engine state machines \"" + + key.getId() + "\"", e); } - LOGGER.exit("updateModel()<-" + key.getID()); + LOGGER.exit("updateModel()<-" + key.getId()); } /* @@ -159,15 +159,15 @@ public class ApexEngineImpl implements ApexEngine { LOGGER.entry("start()" + key); if (state != AxEngineState.STOPPED) { - LOGGER.warn("start()<-" + key.getID() + "," + state + ", cannot start engine, engine not in state STOPPED"); + LOGGER.warn("start()<-" + key.getId() + "," + state + ", cannot start engine, engine not in state STOPPED"); throw new ApexException( - "start()<-" + key.getID() + "," + state + ", cannot start engine, engine not in state STOPPED"); + "start()<-" + key.getId() + "," + state + ", cannot start engine, engine not in state STOPPED"); } if (stateMachineHandler == null || internalContext == null) { - LOGGER.warn("start()<-" + key.getID() + "," + state + LOGGER.warn("start()<-" + key.getId() + "," + state + ", cannot start engine, engine has not been initialized, its model is not loaded"); - throw new ApexException("start()<-" + key.getID() + "," + state + throw new ApexException("start()<-" + key.getId() + "," + state + ", cannot start engine, engine has not been initialized, its model is not loaded"); } @@ -177,10 +177,10 @@ public class ApexEngineImpl implements ApexEngine { stateMachineHandler.start(); engineStats.engineStart(); } catch (final StateMachineException e) { - LOGGER.warn("updateModel()<-" + key.getID() + ", error starting the engine state machines \"" + key.getID() + LOGGER.warn("updateModel()<-" + key.getId() + ", error starting the engine state machines \"" + key.getId() + "\"", e); - throw new ApexException("updateModel()<-" + key.getID() + ", error starting the engine state machines \"" - + key.getID() + "\"", e); + throw new ApexException("updateModel()<-" + key.getId() + ", error starting the engine state machines \"" + + key.getId() + "\"", e); } // OK, we are good to go @@ -206,7 +206,7 @@ public class ApexEngineImpl implements ApexEngine { // Already stopped case STOPPED: - throw new ApexException("stop()<-" + key.getID() + "," + state + throw new ApexException("stop()<-" + key.getId() + "," + state + ", cannot stop engine, engine is already stopped"); // The normal case, the engine wasn't doing anything or it was executing case READY: @@ -222,13 +222,13 @@ public class ApexEngineImpl implements ApexEngine { state = AxEngineState.STOPPING; break; default: - throw new ApexException("stop()<-" + key.getID() + "," + state + throw new ApexException("stop()<-" + key.getId() + "," + state + ", cannot stop engine, engine is in an undefined state"); } } } - throw new ApexException("stop()<-" + key.getID() + "," + state + ", cannot stop engine, engine stop timed out"); + throw new ApexException("stop()<-" + key.getId() + "," + state + ", cannot stop engine, engine stop timed out"); } /* @@ -241,7 +241,7 @@ public class ApexEngineImpl implements ApexEngine { LOGGER.entry("clear()->" + key); if (state != AxEngineState.STOPPED) { throw new ApexException( - "clear" + "()<-" + key.getID() + "," + state + ", cannot clear engine, engine is not stopped"); + "clear" + "()<-" + key.getId() + "," + state + ", cannot clear engine, engine is not stopped"); } // Clear everything @@ -261,7 +261,7 @@ public class ApexEngineImpl implements ApexEngine { public EnEvent createEvent(final AxArtifactKey eventKey) { if (state != AxEngineState.READY && state != AxEngineState.EXECUTING) { LOGGER.warn( - "createEvent()<-" + key.getID() + "," + state + ", cannot create event, engine not in state READY"); + "createEvent()<-" + key.getId() + "," + state + ", cannot create event, engine not in state READY"); return null; } @@ -269,7 +269,7 @@ public class ApexEngineImpl implements ApexEngine { // Create an event using the internal context return new EnEvent(eventKey); } catch (final Exception e) { - LOGGER.warn("createEvent()<-" + key.getID() + "," + state + ", error on event creation", e); + LOGGER.warn("createEvent()<-" + key.getId() + "," + state + ", error on event creation", e); return null; } } @@ -284,13 +284,13 @@ public class ApexEngineImpl implements ApexEngine { public boolean handleEvent(final EnEvent incomingEvent) { boolean ret = false; if (incomingEvent == null) { - LOGGER.warn("handleEvent()<-" + key.getID() + "," + state + ", cannot run engine, incoming event is null"); + LOGGER.warn("handleEvent()<-" + key.getId() + "," + state + ", cannot run engine, incoming event is null"); return ret; } synchronized (state) { if (state != AxEngineState.READY) { - LOGGER.warn("handleEvent()<-" + key.getID() + "," + state + LOGGER.warn("handleEvent()<-" + key.getId() + "," + state + ", cannot run engine, engine not in state READY"); return ret; } @@ -308,7 +308,7 @@ public class ApexEngineImpl implements ApexEngine { engineStats.executionExit(); ret = true; } catch (final StateMachineException e) { - LOGGER.warn("handleEvent()<-" + key.getID() + "," + state + ", engine execution error: ", e); + LOGGER.warn("handleEvent()<-" + key.getId() + "," + state + ", engine execution error: ", e); // Create an exception return event outgoingEvent = createExceptionEvent(incomingEvent, e); @@ -318,7 +318,7 @@ public class ApexEngineImpl implements ApexEngine { try { synchronized (eventListeners) { if (eventListeners.isEmpty()) { - LOGGER.debug("handleEvent()<-" + key.getID() + "," + state + LOGGER.debug("handleEvent()<-" + key.getId() + "," + state + ", There is no listener registered to recieve outgoing event: " + outgoingEvent); } for (final EnEventListener axEventListener : eventListeners.values()) { @@ -326,7 +326,7 @@ public class ApexEngineImpl implements ApexEngine { } } } catch (final ApexException e) { - LOGGER.warn("handleEvent()<-" + key.getID() + "," + state + ", outgoing event publishing error: ", e); + LOGGER.warn("handleEvent()<-" + key.getId() + "," + state + ", outgoing event publishing error: ", e); ret = false; } synchronized (state) { diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java index f17d7f825..5ade06537 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java @@ -71,7 +71,7 @@ public class StateMachineHandler { * @throws StateMachineException On state machine initiation errors */ protected StateMachineHandler(final ApexInternalContext internalContext) throws StateMachineException { - LOGGER.entry("StateMachineHandler()->" + internalContext.getKey().getID()); + LOGGER.entry("StateMachineHandler()->" + internalContext.getKey().getId()); key = internalContext.getKey(); @@ -97,17 +97,17 @@ public class StateMachineHandler { if (lastStateMachineExecutor != null && lastStateMachineExecutor.getSubject() != thisStateMachineExecutor.getSubject()) { LOGGER.error("No more than one policy in a model can have the same trigger event. In model " - + internalContext.getKey().getID() + " Policy (" - + lastStateMachineExecutor.getSubject().getKey().getID() + ") and Policy (" - + thisStateMachineExecutor.getSubject().getKey().getID() + ") have the same Trigger event (" - + triggerEvent.getKey().getID() + ") "); + + internalContext.getKey().getId() + " Policy (" + + lastStateMachineExecutor.getSubject().getKey().getId() + ") and Policy (" + + thisStateMachineExecutor.getSubject().getKey().getId() + ") have the same Trigger event (" + + triggerEvent.getKey().getId() + ") "); LOGGER.error(" Policy (" + lastStateMachineExecutor.getSubject().getKey() + ") has overwritten Policy (" - + thisStateMachineExecutor.getSubject().getKey().getID() + + thisStateMachineExecutor.getSubject().getKey().getId() + " so this overwritten policy will never be triggered in this engine."); } } - LOGGER.exit("StateMachineHandler()<-" + internalContext.getKey().getID()); + LOGGER.exit("StateMachineHandler()<-" + internalContext.getKey().getId()); } /** @@ -117,21 +117,21 @@ public class StateMachineHandler { * @throws StateMachineException On state machine initiation errors */ protected void start() throws StateMachineException { - LOGGER.entry("start()->" + key.getID()); + LOGGER.entry("start()->" + key.getId()); // Iterate over the state machines for (final StateMachineExecutor smExecutor : stateMachineExecutorMap.values()) { try { smExecutor.prepare(); } catch (final StateMachineException e) { - final String stateMachineID = smExecutor.getContext().getKey().getID(); - LOGGER.warn("start()<-" + key.getID() + ", start failed, state machine \"" + stateMachineID + "\"", e); + final String stateMachineID = smExecutor.getContext().getKey().getId(); + LOGGER.warn("start()<-" + key.getId() + ", start failed, state machine \"" + stateMachineID + "\"", e); throw new StateMachineException( - "start()<-" + key.getID() + ", start failed, state machine \"" + stateMachineID + "\"", e); + "start()<-" + key.getId() + ", start failed, state machine \"" + stateMachineID + "\"", e); } } - LOGGER.exit("start()<-" + key.getID()); + LOGGER.exit("start()<-" + key.getId()); } /** @@ -180,7 +180,7 @@ public class StateMachineHandler { try { smExecutor.cleanUp(); } catch (final StateMachineException e) { - final String smID = smExecutor.getContext().getKey().getID(); + final String smID = smExecutor.getContext().getKey().getId(); LOGGER.warn("stop()<-clean up failed, state machine \"" + smID + "\" cleanup failed", e); } } diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java index 6fbf647b4..109240c0d 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java @@ -123,7 +123,7 @@ public class EnEvent extends HashMap<String, Object> { * @return the event key */ public String getID() { - return axEvent.getKey().getID(); + return axEvent.getKey().getId(); } /** diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java index 5f12e8764..a7ce251bd 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java @@ -65,7 +65,7 @@ public class EnField implements Serializable { try { schemaHelper = new SchemaHelperFactory().createSchemaHelper(axField.getKey(), axField.getSchema()); } catch (final ContextRuntimeException e) { - final String message = "schema helper cannot be created for parameter with key \"" + axField.getID() + final String message = "schema helper cannot be created for parameter with key \"" + axField.getId() + "\" with schema \"" + axField.getSchema() + "\""; LOGGER.warn(message, e); throw new EnException(message, e); diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java index cad83d6bc..9cf7d90e3 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java @@ -131,7 +131,7 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap if (finalizerLogic == null) { // Finalizer logic for the task does not exist throw new StateMachineRuntimeException("state finalizer logic on task reference \"" + taskReference - + "\" on state \"" + axState.getID() + "\" does not exist"); + + "\" on state \"" + axState.getId() + "\" does not exist"); } // Create a state finalizer executor for the task @@ -140,7 +140,7 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap } else { // This should never happen but..... throw new StateMachineRuntimeException("invalid state output type on task reference \"" + taskReference - + "\" on state \"" + axState.getID() + "\""); + + "\" on state \"" + axState.getId() + "\""); } } } @@ -178,7 +178,7 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap // Check that the incoming event matches the trigger for this state if (!incomingEvent.getAxEvent().getKey().equals(axState.getTrigger())) { throw new StateMachineException("incoming event \"" + incomingEvent.getID() + "\" does not match trigger \"" - + axState.getTrigger().getID() + "\" of state \"" + axState.getID() + "\""); + + axState.getTrigger().getId() + "\" of state \"" + axState.getId() + "\""); } // The key of the task to execute @@ -213,8 +213,8 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap // State finalizer logic should exist for the task final StateFinalizerExecutor finalizerLogicExecutor = task2StateFinalizerMap.get(taskKey); if (finalizerLogicExecutor == null) { - throw new StateMachineException("state finalizer logic for task \"" + taskKey.getID() - + "\" not found for state \"" + axState.getID() + "\""); + throw new StateMachineException("state finalizer logic for task \"" + taskKey.getId() + + "\" not found for state \"" + axState.getId() + "\""); } // Execute the state finalizer logic to select a state output and to adjust the @@ -227,7 +227,7 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap final AxStateOutput stateOutputDefinition = axState.getStateOutputs().get(stateOutputName); if (stateOutputDefinition == null) { throw new StateMachineException("state output definition for state output \"" + stateOutputName - + "\" not found for state \"" + axState.getID() + "\""); + + "\" not found for state \"" + axState.getId() + "\""); } // Create the state output and transfer all the fields across to its event @@ -247,8 +247,8 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap // That's it, the state execution is complete return stateOutput; } catch (final Exception e) { - final String errorMessage = "State execution of state \"" + axState.getID() + "\" on task \"" - + (taskKey != null ? taskKey.getID() : "null") + "\" failed: " + e.getMessage(); + final String errorMessage = "State execution of state \"" + axState.getId() + "\" on task \"" + + (taskKey != null ? taskKey.getId() : "null") + "\" failed: " + e.getMessage(); LOGGER.warn(errorMessage); throw new StateMachineException(errorMessage, e); diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java index 0d37b0bb7..3bbcc13dc 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java @@ -95,7 +95,7 @@ public abstract class StateFinalizerExecutor */ @Override public void prepare() throws StateMachineException { - LOGGER.debug("prepare:" + finalizerLogic.getID() + "," + finalizerLogic.getLogicFlavour() + "," + LOGGER.debug("prepare:" + finalizerLogic.getId() + "," + finalizerLogic.getLogicFlavour() + "," + finalizerLogic.getLogic()); argumentNotNull(finalizerLogic.getLogic(), StateMachineException.class, "task logic cannot be null."); } @@ -122,7 +122,7 @@ public abstract class StateFinalizerExecutor @Override public final void executePre(final long executionID, final Map<String, Object> newIncomingFields) throws StateMachineException, ContextException { - LOGGER.debug("execute-pre:" + finalizerLogic.getLogicFlavour() + "," + getSubject().getID() + "," + LOGGER.debug("execute-pre:" + finalizerLogic.getLogicFlavour() + "," + getSubject().getId() + "," + finalizerLogic.getLogic()); // Record the incoming fields @@ -141,8 +141,8 @@ public abstract class StateFinalizerExecutor @Override public final void executePost(final boolean returnValue) throws StateMachineException, ContextException { if (!returnValue) { - String errorMessage = "execute-post: state finalizer logic execution failure on state \"" + axState.getID() - + "\" on finalizer logic " + finalizerLogic.getID(); + String errorMessage = "execute-post: state finalizer logic execution failure on state \"" + axState.getId() + + "\" on finalizer logic " + finalizerLogic.getId(); if (executionContext.getMessage() != null) { errorMessage += ", user message: " + executionContext.getMessage(); } @@ -152,22 +152,22 @@ public abstract class StateFinalizerExecutor // Check a state output has been selected if (getOutgoing() == null) { - LOGGER.warn("execute-post: state finalizer logic \"" + finalizerLogic.getID() + LOGGER.warn("execute-post: state finalizer logic \"" + finalizerLogic.getId() + "\" did not select an output state"); - throw new StateMachineException("execute-post: state finalizer logic \"" + finalizerLogic.getID() + throw new StateMachineException("execute-post: state finalizer logic \"" + finalizerLogic.getId() + "\" did not select an output state"); } if (!axState.getStateOutputs().keySet().contains(getOutgoing())) { LOGGER.warn( - "execute-post: state finalizer logic \"" + finalizerLogic.getID() + "\" selected output state \"" - + getOutgoing() + "\" that does not exsist on state \"" + axState.getID() + "\""); + "execute-post: state finalizer logic \"" + finalizerLogic.getId() + "\" selected output state \"" + + getOutgoing() + "\" that does not exsist on state \"" + axState.getId() + "\""); throw new StateMachineException( - "execute-post: state finalizer logic \"" + finalizerLogic.getID() + "\" selected output state \"" - + getOutgoing() + "\" that does not exsist on state \"" + axState.getID() + "\""); + "execute-post: state finalizer logic \"" + finalizerLogic.getId() + "\" selected output state \"" + + getOutgoing() + "\" that does not exsist on state \"" + axState.getId() + "\""); } - LOGGER.debug("execute-post:" + finalizerLogic.getID() + ", returning state output \"" + getOutgoing() + LOGGER.debug("execute-post:" + finalizerLogic.getId() + ", returning state output \"" + getOutgoing() + " and fields " + incomingFields); } diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java index 7a9594bf8..07ef8d6d6 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java @@ -161,7 +161,7 @@ public class StateMachineExecutor implements Executor<EnEvent, EnEvent, AxPolicy stateExecutor = stateExecutorMap.get(stateOutput.getNextState()); if (stateExecutor == null) { throw new StateMachineException( - "state execution failed, next state \"" + stateOutput.getNextState().getID() + "\" not found"); + "state execution failed, next state \"" + stateOutput.getNextState().getId() + "\" not found"); } } diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java index aaec71b47..65cb0d2b8 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java @@ -110,7 +110,7 @@ public class StateOutput { if (!incomingFieldDefinitionMap.keySet().equals(eventFieldMap.keySet())) { throw new StateMachineException( - "field definitions and values do not match for event " + outputEventDef.getID() + '\n' + "field definitions and values do not match for event " + outputEventDef.getId() + '\n' + incomingFieldDefinitionMap.keySet() + '\n' + eventFieldMap.keySet()); } for (final Entry<String, Object> incomingFieldEntry : eventFieldMap.entrySet()) { @@ -120,7 +120,7 @@ public class StateOutput { // Check if this field is a field in the event if (!outputEventDef.getFields().contains(fieldDef)) { throw new StateMachineException( - "field \"" + fieldName + "\" does not exist on event \"" + outputEventDef.getID() + "\""); + "field \"" + fieldName + "\" does not exist on event \"" + outputEventDef.getId() + "\""); } // Set the value in the output event diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java index 9f6f92d4e..8dd2575b0 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java @@ -99,7 +99,7 @@ public abstract class TaskExecutor */ @Override public void prepare() throws StateMachineException { - LOGGER.debug("prepare:" + axTask.getKey().getID() + "," + axTask.getTaskLogic().getLogicFlavour() + "," + LOGGER.debug("prepare:" + axTask.getKey().getId() + "," + axTask.getTaskLogic().getLogicFlavour() + "," + axTask.getTaskLogic().getLogic()); argumentNotNull(axTask.getTaskLogic().getLogic(), StateMachineException.class, "task logic cannot be null."); } @@ -127,7 +127,7 @@ public abstract class TaskExecutor public final void executePre(final long executionID, final Map<String, Object> newIncomingFields) throws StateMachineException, ContextException { LOGGER.debug("execute-pre:" + getSubject().getTaskLogic().getLogicFlavour() + "," - + getSubject().getKey().getID() + "," + getSubject().getTaskLogic().getLogic()); + + getSubject().getKey().getId() + "," + getSubject().getTaskLogic().getLogic()); // Check that the incoming event has all the input fields for this state final Set<String> missingTaskInputFields = new TreeSet<>(axTask.getInputFields().keySet()); @@ -143,7 +143,7 @@ public abstract class TaskExecutor } if (!missingTaskInputFields.isEmpty()) { throw new StateMachineException("task input fields \"" + missingTaskInputFields - + "\" are missing for task \"" + axTask.getKey().getID() + "\""); + + "\" are missing for task \"" + axTask.getKey().getId() + "\""); } // Record the incoming fields @@ -169,7 +169,7 @@ public abstract class TaskExecutor public final void executePost(final boolean returnValue) throws StateMachineException, ContextException { if (!returnValue) { String errorMessage = "execute-post: task logic execution failure on task \"" + axTask.getKey().getName() - + "\" in model " + internalContext.getKey().getID(); + + "\" in model " + internalContext.getKey().getId(); if (executionContext.getMessage() != null) { errorMessage += ", user message: " + executionContext.getMessage(); } @@ -215,7 +215,7 @@ public abstract class TaskExecutor } if (!missingTaskOutputFields.isEmpty()) { throw new StateMachineException("task output fields \"" + missingTaskOutputFields - + "\" are missing for task \"" + axTask.getKey().getID() + "\""); + + "\" are missing for task \"" + axTask.getKey().getId() + "\""); } // Finally, check that the outgoing field map don't have any extra fields, if present, raise @@ -225,10 +225,10 @@ public abstract class TaskExecutor extraTaskOutputFields.removeAll(axTask.getOutputFields().keySet()); if (!extraTaskOutputFields.isEmpty()) { throw new StateMachineException("task output fields \"" + extraTaskOutputFields - + "\" are unwanted for task \"" + axTask.getKey().getID() + "\""); + + "\" are unwanted for task \"" + axTask.getKey().getId() + "\""); } - LOGGER.debug("execute-post:" + axTask.getKey().getID() + ", returning fields " + outgoingFields.toString()); + LOGGER.debug("execute-post:" + axTask.getKey().getId() + ", returning fields " + outgoingFields.toString()); } /* diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java index f3ac1f6b0..cda0ac549 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java @@ -92,7 +92,7 @@ public abstract class TaskSelectExecutor implements Executor<EnEvent, AxArtifact */ @Override public void prepare() throws StateMachineException { - LOGGER.debug("prepare:" + axState.getKey().getID() + "," + axState.getTaskSelectionLogic().getLogicFlavour() + LOGGER.debug("prepare:" + axState.getKey().getId() + "," + axState.getTaskSelectionLogic().getLogicFlavour() + "," + axState.getTaskSelectionLogic().getLogic()); argumentNotNull(axState.getTaskSelectionLogic().getLogic(), "task selection logic cannot be null."); } @@ -117,7 +117,7 @@ public abstract class TaskSelectExecutor implements Executor<EnEvent, AxArtifact */ @Override public final void executePre(final long executionID, final EnEvent newIncomingEvent) throws StateMachineException { - LOGGER.debug("execute-pre:" + axState.getKey().getID() + "," + axState.getTaskSelectionLogic().getLogicFlavour() + LOGGER.debug("execute-pre:" + axState.getKey().getId() + "," + axState.getTaskSelectionLogic().getLogicFlavour() + "," + axState.getTaskSelectionLogic().getLogic()); this.incomingEvent = newIncomingEvent; @@ -139,7 +139,7 @@ public abstract class TaskSelectExecutor implements Executor<EnEvent, AxArtifact public final void executePost(final boolean returnValue) throws StateMachineException { if (!returnValue) { String errorMessage = - "execute-post: task selection logic failed on state \"" + axState.getKey().getID() + "\""; + "execute-post: task selection logic failed on state \"" + axState.getKey().getId() + "\""; if (executionContext.getMessage() != null) { errorMessage += ", user message: " + executionContext.getMessage(); } @@ -149,18 +149,18 @@ public abstract class TaskSelectExecutor implements Executor<EnEvent, AxArtifact if (outgoingTaskKey == null || AxArtifactKey.getNullKey().getName().equals(outgoingTaskKey.getName())) { outgoingTaskKey = axState.getDefaultTask(); - LOGGER.debug("execute-post:" + axState.getKey().getID() + ", returning default task"); + LOGGER.debug("execute-post:" + axState.getKey().getId() + ", returning default task"); return; } if (!axState.getTaskReferences().containsKey(outgoingTaskKey)) { - LOGGER.error("execute-post: task \"" + outgoingTaskKey.getID() - + "\" returned by task selection logic not defined on state \"" + axState.getKey().getID() + "\""); - throw new StateMachineException("task \"" + outgoingTaskKey.getID() - + "\" returned by task selection logic not defined on state \"" + axState.getKey().getID() + "\""); + LOGGER.error("execute-post: task \"" + outgoingTaskKey.getId() + + "\" returned by task selection logic not defined on state \"" + axState.getKey().getId() + "\""); + throw new StateMachineException("task \"" + outgoingTaskKey.getId() + + "\" returned by task selection logic not defined on state \"" + axState.getKey().getId() + "\""); } - LOGGER.debug("execute-post:" + axState.getKey().getID() + "," + ", returning task " + outgoingTaskKey.getID()); + LOGGER.debug("execute-post:" + axState.getKey().getId() + "," + ", returning task " + outgoingTaskKey.getId()); } /* diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java index e63bd3db8..bb8e36275 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java @@ -68,7 +68,7 @@ public class AxStateFacade { * @return the ID */ public String getId() { - return state.getKey().getID(); + return state.getKey().getId(); } /** diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java index a9e93a3b2..f7b53554d 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java @@ -74,7 +74,7 @@ public class AxTaskFacade { * @return the task ID */ public String getId() { - return task.getID(); + return task.getId(); } /** @@ -112,7 +112,7 @@ public class AxTaskFacade { // Find the field for the field name if (field == null) { final String message = "no " + directionString + " field with name \"" + fieldName + "\" defined on task \"" - + task.getID() + "\""; + + task.getId() + "\""; LOGGER.warn(message); throw new StateMachineRuntimeException(message); } @@ -122,7 +122,7 @@ public class AxTaskFacade { return new SchemaHelperFactory().createSchemaHelper(field.getKey(), field.getSchema()); } catch (final ContextRuntimeException e) { final String message = "schema helper cannot be created for task field \"" + fieldName + "\" with key \"" - + field.getID() + "\" with schema \"" + field.getSchema() + "\""; + + field.getId() + "\" with schema \"" + field.getSchema() + "\""; LOGGER.warn(message, e); throw new EnException(message, e); } diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java index 9710b106e..c1c9ce949 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java @@ -95,9 +95,9 @@ public class EventMonitor { builder.append(','); } if (stackKey instanceof AxArtifactKey) { - builder.append(((AxArtifactKey) stackKey).getID()); + builder.append(((AxArtifactKey) stackKey).getId()); } else if (stackKey instanceof AxReferenceKey) { - builder.append(((AxReferenceKey) stackKey).getID()); + builder.append(((AxReferenceKey) stackKey).getId()); } else { builder.append(stackKey.toString()); } diff --git a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelFactory.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelFactory.java index b0cbf0c17..9a2d50626 100644 --- a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelFactory.java +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelFactory.java @@ -696,7 +696,7 @@ public class AADMDomainModelFactory { final AxValidationResult result = aadmPolicyModel.validate(new AxValidationResult()); if (!result.getValidationResult().equals(AxValidationResult.ValidationResult.VALID)) { - throw new ApexRuntimeException("model " + aadmPolicyModel.getID() + " is not valid" + result); + throw new ApexRuntimeException("model " + aadmPolicyModel.getId() + " is not valid" + result); } return aadmPolicyModel; } diff --git a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelSaver.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelSaver.java index 618a9535a..a25a0e983 100644 --- a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelSaver.java +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelSaver.java @@ -51,7 +51,7 @@ public final class AADMDomainModelSaver { final AxPolicyModel aadmPolicyModel = new AADMDomainModelFactory().getAADMPolicyModel(); final ApexModelSaver<AxPolicyModel> aadmModelSaver = new ApexModelSaver<>(AxPolicyModel.class, aadmPolicyModel, args[0]); - aadmModelSaver.apexModelWriteJSON(); - aadmModelSaver.apexModelWriteXML(); + aadmModelSaver.apexModelWriteJson(); + aadmModelSaver.apexModelWriteXml(); } } diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMDBWrite.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMDBWrite.java index 02e6f9179..dd6a5eb77 100644 --- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMDBWrite.java +++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMDBWrite.java @@ -27,7 +27,7 @@ import java.sql.DriverManager; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.test.TestApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; @@ -51,10 +51,10 @@ public class TestAADMDBWrite { @Test public void testModelWriteReadJPA() throws Exception { - final DAOParameters daoParameters = new DAOParameters(); - daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); - daoParameters.setPersistenceUnit("AADMModelTest"); + final DaoParameters DaoParameters = new DaoParameters(); + DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); + DaoParameters.setPersistenceUnit("AADMModelTest"); - testApexModel.testApexModelWriteReadJPA(daoParameters); + testApexModel.testApexModelWriteReadJpa(DaoParameters); } } diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModel.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModel.java index 2c62c4994..7a453ae24 100644 --- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModel.java +++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModel.java @@ -30,7 +30,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.test.TestApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; @@ -60,21 +60,21 @@ public class TestAADMModel { @Test public void testModelWriteReadXML() throws Exception { - testApexModel.testApexModelWriteReadXML(); + testApexModel.testApexModelWriteReadXml(); } @Test public void testModelWriteReadJSON() throws Exception { - testApexModel.testApexModelWriteReadJSON(); + testApexModel.testApexModelWriteReadJson(); } @Test public void testModelWriteReadJPA() throws Exception { - final DAOParameters daoParameters = new DAOParameters(); - daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); - daoParameters.setPersistenceUnit("AADMModelTest"); + final DaoParameters DaoParameters = new DaoParameters(); + DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); + DaoParameters.setPersistenceUnit("AADMModelTest"); - testApexModel.testApexModelWriteReadJPA(daoParameters); + testApexModel.testApexModelWriteReadJpa(DaoParameters); } private static final String VALID_MODEL_STRING = "***validation of model successful***"; diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java index 1f9b1087c..f7ce2fdf0 100644 --- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java +++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java @@ -441,7 +441,7 @@ public class TestAADMUseCase { */ private AxEvent getTriggerEvent(final AxPolicyModel apexPolicyModel) { for (final AxEvent axEvent : apexPolicyModel.getEvents().getEventMap().values()) { - if (axEvent.getKey().getID().equals("AADMEvent:0.0.1")) { + if (axEvent.getKey().getId().equals("AADMEvent:0.0.1")) { return axEvent; } } diff --git a/examples/examples-aadm/src/test/resources/META-INF/persistence.xml b/examples/examples-aadm/src/test/resources/META-INF/persistence.xml index eaef96a85..eb28ad809 100644 --- a/examples/examples-aadm/src/test/resources/META-INF/persistence.xml +++ b/examples/examples-aadm/src/test/resources/META-INF/persistence.xml @@ -23,8 +23,8 @@ <persistence-unit name="AADMModelTest" transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner</class> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxConcept</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class> diff --git a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java index 6242b1618..6b71468d9 100644 --- a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java @@ -288,7 +288,7 @@ public class AdaptiveDomainModelFactory { final AxValidationResult result = anomalyDetectionPolicyModel.validate(new AxValidationResult()); if (!result.getValidationResult().equals(AxValidationResult.ValidationResult.VALID)) { - throw new ApexRuntimeException("model " + anomalyDetectionPolicyModel.getID() + " is not valid" + result); + throw new ApexRuntimeException("model " + anomalyDetectionPolicyModel.getId() + " is not valid" + result); } return anomalyDetectionPolicyModel; } @@ -550,7 +550,7 @@ public class AdaptiveDomainModelFactory { final AxValidationResult result = autoLearnPolicyModel.validate(new AxValidationResult()); if (!result.getValidationResult().equals(AxValidationResult.ValidationResult.VALID)) { - throw new ApexRuntimeException("model " + autoLearnPolicyModel.getID() + " is not valid" + result); + throw new ApexRuntimeException("model " + autoLearnPolicyModel.getId() + " is not valid" + result); } return autoLearnPolicyModel; } diff --git a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java index 0cc9bd3a2..9c860e3c8 100644 --- a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java @@ -51,14 +51,14 @@ public final class AdaptiveDomainModelSaver { final AxPolicyModel adPolicyModel = new AdaptiveDomainModelFactory().getAnomalyDetectionPolicyModel(); final ApexModelSaver<AxPolicyModel> adModelSaver = new ApexModelSaver<>(AxPolicyModel.class, adPolicyModel, args[0]); - adModelSaver.apexModelWriteJSON(); - adModelSaver.apexModelWriteXML(); + adModelSaver.apexModelWriteJson(); + adModelSaver.apexModelWriteXml(); // Save Auto Learn model final AxPolicyModel alPolicyModel = new AdaptiveDomainModelFactory().getAutoLearnPolicyModel(); final ApexModelSaver<AxPolicyModel> alModelSaver = new ApexModelSaver<>(AxPolicyModel.class, alPolicyModel, args[0]); - alModelSaver.apexModelWriteJSON(); - alModelSaver.apexModelWriteXML(); + alModelSaver.apexModelWriteJson(); + alModelSaver.apexModelWriteXml(); } } diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionDBWrite.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionDBWrite.java index 898531c32..9affa7876 100644 --- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionDBWrite.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionDBWrite.java @@ -27,7 +27,7 @@ import java.sql.DriverManager; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.test.TestApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; @@ -51,10 +51,10 @@ public class TestAnomalyDetectionDBWrite { @Test public void testModelWriteReadJPA() throws Exception { - final DAOParameters daoParameters = new DAOParameters(); - daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); - daoParameters.setPersistenceUnit("AdaptiveModelsTest"); + final DaoParameters DaoParameters = new DaoParameters(); + DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); + DaoParameters.setPersistenceUnit("AdaptiveModelsTest"); - testApexModel.testApexModelWriteReadJPA(daoParameters); + testApexModel.testApexModelWriteReadJpa(DaoParameters); } } diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModel.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModel.java index 7e2fb0eb7..3782f2d88 100644 --- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModel.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModel.java @@ -30,7 +30,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.test.TestApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; @@ -60,21 +60,21 @@ public class TestAnomalyDetectionModel { @Test public void testModelWriteReadXML() throws Exception { - testApexModel.testApexModelWriteReadXML(); + testApexModel.testApexModelWriteReadXml(); } @Test public void testModelWriteReadJSON() throws Exception { - testApexModel.testApexModelWriteReadJSON(); + testApexModel.testApexModelWriteReadJson(); } @Test public void testModelWriteReadJPA() throws Exception { - final DAOParameters daoParameters = new DAOParameters(); - daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); - daoParameters.setPersistenceUnit("AdaptiveModelsTest"); + final DaoParameters DaoParameters = new DaoParameters(); + DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); + DaoParameters.setPersistenceUnit("AdaptiveModelsTest"); - testApexModel.testApexModelWriteReadJPA(daoParameters); + testApexModel.testApexModelWriteReadJpa(DaoParameters); } private static final String VALID_MODEL_STRING = "***validation of model successful***"; diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnDBWrite.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnDBWrite.java index 64efa6c35..e096105d9 100644 --- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnDBWrite.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnDBWrite.java @@ -27,7 +27,7 @@ import java.sql.DriverManager; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.test.TestApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; @@ -51,10 +51,10 @@ public class TestAutoLearnDBWrite { @Test public void testModelWriteReadJPA() throws Exception { - final DAOParameters daoParameters = new DAOParameters(); - daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); - daoParameters.setPersistenceUnit("AdaptiveModelsTest"); + final DaoParameters DaoParameters = new DaoParameters(); + DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); + DaoParameters.setPersistenceUnit("AdaptiveModelsTest"); - testApexModel.testApexModelWriteReadJPA(daoParameters); + testApexModel.testApexModelWriteReadJpa(DaoParameters); } } diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModel.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModel.java index aa7f621c9..beb7a9c80 100644 --- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModel.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModel.java @@ -30,7 +30,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.test.TestApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; @@ -60,21 +60,21 @@ public class TestAutoLearnModel { @Test public void testModelWriteReadXML() throws Exception { - testApexModel.testApexModelWriteReadXML(); + testApexModel.testApexModelWriteReadXml(); } @Test public void testModelWriteReadJSON() throws Exception { - testApexModel.testApexModelWriteReadJSON(); + testApexModel.testApexModelWriteReadJson(); } @Test public void testModelWriteReadJPA() throws Exception { - final DAOParameters daoParameters = new DAOParameters(); - daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); - daoParameters.setPersistenceUnit("AdaptiveModelsTest"); + final DaoParameters DaoParameters = new DaoParameters(); + DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); + DaoParameters.setPersistenceUnit("AdaptiveModelsTest"); - testApexModel.testApexModelWriteReadJPA(daoParameters); + testApexModel.testApexModelWriteReadJpa(DaoParameters); } private static final String VALID_MODEL_STRING = "***validation of model successful***"; diff --git a/examples/examples-adaptive/src/test/resources/META-INF/persistence.xml b/examples/examples-adaptive/src/test/resources/META-INF/persistence.xml index 7282bb562..4dcd879b6 100644 --- a/examples/examples-adaptive/src/test/resources/META-INF/persistence.xml +++ b/examples/examples-adaptive/src/test/resources/META-INF/persistence.xml @@ -23,8 +23,8 @@ <persistence-unit name="AdaptiveModelsTest" transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner</class> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxConcept</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class> diff --git a/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelSaver.java b/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelSaver.java index 7343f747d..fb47f6cf9 100644 --- a/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelSaver.java +++ b/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelSaver.java @@ -50,13 +50,13 @@ public final class MFPDomainModelSaver { AxPolicyModel mfpPolicyModel = new MFPDomainModelFactory().getMFP1PolicyModel(); ApexModelSaver<AxPolicyModel> mfpModelSaver = new ApexModelSaver<>(AxPolicyModel.class, mfpPolicyModel, args[0] + "/1/"); - mfpModelSaver.apexModelWriteJSON(); - mfpModelSaver.apexModelWriteXML(); + mfpModelSaver.apexModelWriteJson(); + mfpModelSaver.apexModelWriteXml(); mfpPolicyModel = new MFPDomainModelFactory().getMFP2PolicyModel(); mfpModelSaver = new ApexModelSaver<>(AxPolicyModel.class, mfpPolicyModel, args[0] + "/2/"); - mfpModelSaver.apexModelWriteJSON(); - mfpModelSaver.apexModelWriteXML(); + mfpModelSaver.apexModelWriteJson(); + mfpModelSaver.apexModelWriteXml(); } } diff --git a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModel.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModel.java index a8be6c4e4..64ff5b1ab 100644 --- a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModel.java +++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModel.java @@ -76,10 +76,10 @@ public class TestMFPModel { @Test public void testModelValid() throws Exception { AxValidationResult result = testApexModel1.testApexModelValid(); - assertTrue("Model did not validate cleanly", result.isOK()); + assertTrue("Model did not validate cleanly", result.isOk()); result = testApexModel2.testApexModelValid(); - assertTrue("Model did not validate cleanly", result.isOK()); + assertTrue("Model did not validate cleanly", result.isOk()); } /** @@ -89,8 +89,8 @@ public class TestMFPModel { */ @Test public void testModelWriteReadXML() throws Exception { - testApexModel1.testApexModelWriteReadXML(); - testApexModel2.testApexModelWriteReadXML(); + testApexModel1.testApexModelWriteReadXml(); + testApexModel2.testApexModelWriteReadXml(); } /** @@ -100,7 +100,7 @@ public class TestMFPModel { */ @Test public void testModelWriteReadJSON() throws Exception { - testApexModel1.testApexModelWriteReadJSON(); - testApexModel2.testApexModelWriteReadJSON(); + testApexModel1.testApexModelWriteReadJson(); + testApexModel2.testApexModelWriteReadJson(); } } diff --git a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPUseCase.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPUseCase.java index 22f985f80..1068a5398 100644 --- a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPUseCase.java +++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPUseCase.java @@ -262,7 +262,7 @@ public class TestMFPUseCase { continue; } assertTrue("Event file " + inputFile + " has a field " + e.getKey() + " but this is not defined for " - + event.getID(), (event.getParameterMap().containsKey(e.getKey()))); + + event.getId(), (event.getParameterMap().containsKey(e.getKey()))); if (jsonObject.get(e.getKey()).isJsonNull()) { ret.put(e.getKey(), null); } @@ -270,7 +270,7 @@ public class TestMFPUseCase { for (final AxField field : event.getFields()) { if (!field.getOptional()) { assertTrue("Event file " + inputFile + " is missing a mandatory field " + field.getKey().getLocalName() - + " for " + event.getID(), jsonObject.has(field.getKey().getLocalName())); + + " for " + event.getId(), jsonObject.has(field.getKey().getLocalName())); } else { ret.put(field.getKey().getLocalName(), null); } @@ -329,7 +329,7 @@ public class TestMFPUseCase { continue; } assertTrue("Event file " + inputFile + " has a field " + e.getKey() + " but this is not defined for " - + event.getID(), (event.getParameterMap().containsKey(e.getKey()))); + + event.getId(), (event.getParameterMap().containsKey(e.getKey()))); if (jsonObject.get(e.getKey()).isJsonNull()) { ret.put(e.getKey(), null); } @@ -337,7 +337,7 @@ public class TestMFPUseCase { for (final AxField field : event.getFields()) { if (!field.getOptional()) { assertTrue("Event file " + inputFile + " is missing a mandatory field " + field.getKey().getLocalName() - + " for " + event.getID(), jsonObject.has(field.getKey().getLocalName())); + + " for " + event.getId(), jsonObject.has(field.getKey().getLocalName())); } else { ret.put(field.getKey().getLocalName(), null); } diff --git a/examples/examples-myfirstpolicy/src/test/resources/META-INF/persistence.xml b/examples/examples-myfirstpolicy/src/test/resources/META-INF/persistence.xml index 4dcba14b7..7acc7a0e9 100644 --- a/examples/examples-myfirstpolicy/src/test/resources/META-INF/persistence.xml +++ b/examples/examples-myfirstpolicy/src/test/resources/META-INF/persistence.xml @@ -23,8 +23,8 @@ <persistence-unit name="MFPModelTest" transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner</class> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxConcept</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class> diff --git a/examples/examples-onap-vcpe/pom.xml b/examples/examples-onap-vcpe/pom.xml index 353c7a26d..3080416b2 100644 --- a/examples/examples-onap-vcpe/pom.xml +++ b/examples/examples-onap-vcpe/pom.xml @@ -52,6 +52,21 @@ <version>${version.jersey}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-schema</groupId> + <artifactId>plugins-context-schema-avro</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.apex-pdp.plugins.plugins-executor</groupId> + <artifactId>plugins-executor-javascript</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId> + <artifactId>plugins-event-carrier-restrequestor</artifactId> + <version>${project.version}</version> + </dependency> </dependencies> <build> diff --git a/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSim.java b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSim.java index a821462f6..f6ae332a8 100644 --- a/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSim.java +++ b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSim.java @@ -28,7 +28,7 @@ import org.glassfish.jersey.server.ResourceConfig; import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; public class AAIAndGuardSim { - private static final String BASE_URI = "http://192.168.144.235:54321/AAIAndGuardSim"; + private static final String BASE_URI = "http://localhost:54321/AAIAndGuardSim"; private HttpServer server; public AAIAndGuardSim() { diff --git a/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelSaver.java b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelSaver.java index ee6277a8e..65e84a4ea 100644 --- a/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelSaver.java +++ b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelSaver.java @@ -50,8 +50,8 @@ public final class PCVSDomainModelSaver { final AxPolicyModel pcvsPolicyModel = new PCVSDomainModelFactory().getPCVVpnSlaSPolicyModel(args[0]); final ApexModelSaver<AxPolicyModel> pcvsModelSaver = new ApexModelSaver<>(AxPolicyModel.class, pcvsPolicyModel, args[1] + "vpnsla/"); - pcvsModelSaver.apexModelWriteJSON(); - pcvsModelSaver.apexModelWriteXML(); + pcvsModelSaver.apexModelWriteJson(); + pcvsModelSaver.apexModelWriteXml(); } } diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexConceptException.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexConceptException.java index 1ffb2776c..d62818dc8 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexConceptException.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexConceptException.java @@ -41,9 +41,9 @@ public class ApexConceptException extends ApexException { * Instantiates a new apex concept exception. * * @param message the message on the exception - * @param e the exception that caused this Apex exception + * @param exception the exception that caused this Apex exception */ - public ApexConceptException(final String message, final Exception e) { - super(message, e); + public ApexConceptException(final String message, final Exception exception) { + super(message, exception); } } diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexException.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexException.java index 94472d3eb..97920c3b5 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexException.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexException.java @@ -55,21 +55,21 @@ public class ApexException extends Exception { * Instantiates a new apex exception. * * @param message the message on the exception - * @param e the exception that caused this Apex exception + * @param exception the exception that caused this Apex exception */ - public ApexException(final String message, final Exception e) { - this(message, e, null); + public ApexException(final String message, final Exception exception) { + this(message, exception, null); } /** * Instantiates a new apex exception. * * @param message the message on the exception - * @param e the exception that caused this Apex exception + * @param exception the exception that caused this Apex exception * @param object the object that the exception was thrown on */ - public ApexException(final String message, final Exception e, final Object object) { - super(message, e); + public ApexException(final String message, final Exception exception, final Object object) { + super(message, exception); this.object = object; } @@ -83,7 +83,7 @@ public class ApexException extends Exception { } /** - * Build a cascaded message from an exception and all its nested exceptions + * Build a cascaded message from an exception and all its nested exceptions. * @param throwable the top level exception * @return cascaded message string */ @@ -100,7 +100,6 @@ public class ApexException extends Exception { } /** - * * Get the object on which the exception was thrown. * * @return The object on which the exception was thrown diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexRuntimeException.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexRuntimeException.java index 5724b487c..b4240ad0f 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexRuntimeException.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexRuntimeException.java @@ -55,21 +55,21 @@ public class ApexRuntimeException extends RuntimeException { * Instantiates a new apex runtime exception. * * @param message the message on the exception - * @param e the exception that caused this Apex exception + * @param exception the exception that caused this Apex exception */ - public ApexRuntimeException(final String message, final Exception e) { - this(message, e, null); + public ApexRuntimeException(final String message, final Exception exception) { + this(message, exception, null); } /** * Instantiates a new apex runtime exception. * * @param message the message on the exception - * @param e the exception that caused this Apex exception + * @param exception the exception that caused this Apex exception * @param object the object that the exception was thrown on */ - public ApexRuntimeException(final String message, final Exception e, final Object object) { - super(message, e); + public ApexRuntimeException(final String message, final Exception exception, final Object object) { + super(message, exception); this.object = object; } diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxArtifactKey.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxArtifactKey.java index e08c3c65f..1f906ea22 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxArtifactKey.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxArtifactKey.java @@ -38,15 +38,16 @@ import org.onap.policy.apex.model.utilities.Assertions; * An artifact key uniquely identifies every first order entity in the system. Every first order concept in the system * must have an {@link AxArtifactKey} to identify it. Concepts that are wholly contained in another concept are * identified using a {@link AxReferenceKey} key. - * <p> - * Key validation checks that the name and version fields match the {@link NAME_REGEXP} and {@link VERSION_REGEXP} + * + * <p>Key validation checks that the name and version fields match the {@link NAME_REGEXP} and {@link VERSION_REGEXP} * regular expressions respectively. */ @Embeddable @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexArtifactKey", namespace = "http://www.onap.org/policy/apex-pdp") -@XmlType(name = "AxArtifactKey", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = { "name", "version" }) +@XmlType(name = "AxArtifactKey", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = + { "name", "version" }) public class AxArtifactKey extends AxKey { private static final long serialVersionUID = 8932717618579392561L; @@ -70,10 +71,9 @@ public class AxArtifactKey extends AxKey { } /** - * Copy constructor + * Copy constructor. * - * @param copyConcept - * the concept to copy from + * @param copyConcept the concept to copy from */ public AxArtifactKey(final AxArtifactKey copyConcept) { super(copyConcept); @@ -82,10 +82,8 @@ public class AxArtifactKey extends AxKey { /** * Constructor to create a key with the specified name and version. * - * @param name - * the key name - * @param version - * the key version + * @param name the key name + * @param version the key version */ public AxArtifactKey(final String name, final String version) { super(); @@ -96,8 +94,7 @@ public class AxArtifactKey extends AxKey { /** * Constructor to create a key using the key and version from the specified key ID. * - * @param id - * the key ID in a format that respects the {@link KEY_ID_REGEXP} + * @param id the key ID in a format that respects the {@link KEY_ID_REGEXP} */ public AxArtifactKey(final String id) { Assertions.argumentNotNull(id, "id may not be null"); @@ -152,7 +149,7 @@ public class AxArtifactKey extends AxKey { * @see org.onap.policy.apex.model.basicmodel.concepts.AxKey#getID() */ @Override - public String getID() { + public String getId() { return name + ':' + version; } @@ -168,8 +165,7 @@ public class AxArtifactKey extends AxKey { /** * Sets the key name. * - * @param name - * the key name + * @param name the key name */ public void setName(final String name) { this.name = Assertions.validateStringParameter(NAME_TOKEN, name, NAME_REGEXP); @@ -187,8 +183,7 @@ public class AxArtifactKey extends AxKey { /** * Sets the key version. * - * @param version - * the key version + * @param version the key version */ public void setVersion(final String version) { this.version = Assertions.validateStringParameter(VERSION_TOKEN, version, VERSION_REGEXP); @@ -265,8 +260,8 @@ public class AxArtifactKey extends AxKey { "name invalid-" + nameValidationErrorMessage)); } - final String versionValidationErrorMessage = Assertions.getStringParameterValidationMessage(VERSION_TOKEN, version, - VERSION_REGEXP); + final String versionValidationErrorMessage = Assertions.getStringParameterValidationMessage(VERSION_TOKEN, + version, VERSION_REGEXP); if (versionValidationErrorMessage != null) { result.addValidationMessage(new AxValidationMessage(this, this.getClass(), ValidationResult.INVALID, "version invalid-" + versionValidationErrorMessage)); diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConcept.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConcept.java index 3d7f5027f..bb6614715 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConcept.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConcept.java @@ -40,12 +40,12 @@ public abstract class AxConcept implements Serializable, Comparable<AxConcept> { private static final long serialVersionUID = -7434939557282697490L; /** - * Default constructor + * Default constructor. */ public AxConcept() {} /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -120,8 +120,8 @@ public abstract class AxConcept implements Serializable, Comparable<AxConcept> { * * @return the ID string of this concept */ - public String getID() { - return getKey().getID(); + public String getId() { + return getKey().getId(); } /** @@ -130,10 +130,10 @@ public abstract class AxConcept implements Serializable, Comparable<AxConcept> { * @param id the key ID to match against * @return true, if this key matches the ID */ - public final boolean matchesID(final String id) { + public final boolean matchesId(final String id) { Assertions.argumentNotNull(id, "id may not be null"); // Check the ID - return getID().equals(id); + return getId().equals(id); } } diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConceptGetter.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConceptGetter.java index 0735f87c3..0284de48a 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConceptGetter.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConceptGetter.java @@ -24,9 +24,9 @@ import java.util.Set; /** * This interface is used to allow get methods to be placed on concepts that have embedded maps. - * <p> - * It forces those concepts with maps to implement the get methods specified on this interface as convenience methods to avoid concept users having to use a - * second level of referencing to access concepts in the the maps. + * + * <p>It forces those concepts with maps to implement the get methods specified on this interface as convenience methods + * to avoid concept users having to use a second level of referencing to access concepts in the the maps. * * @author Liam Fallon (liam.fallon@ericsson.com) * @param <C> the type of concept on which the interface is applied. diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConceptGetterImpl.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConceptGetterImpl.java index b4bff80c8..866de8053 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConceptGetterImpl.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConceptGetterImpl.java @@ -82,7 +82,8 @@ public class AxConceptGetterImpl<C> implements AxConceptGetter<C> { break; } foundKey = nextkey; - } while (true); + } + while (true); return conceptMap.get(foundKey); } @@ -147,7 +148,8 @@ public class AxConceptGetterImpl<C> implements AxConceptGetter<C> { break; } returnSet.add(conceptMap.get(foundKey)); - } while (true); + } + while (true); return returnSet; } diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKey.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKey.java index 36b49259b..5702a6577 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKey.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKey.java @@ -65,14 +65,14 @@ public abstract class AxKey extends AxConcept { } /** - * Default constructor + * Default constructor. */ public AxKey() { super(); } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -86,7 +86,7 @@ public abstract class AxKey extends AxConcept { * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getID() */ @Override - public abstract String getID(); + public abstract String getId(); /** * Return the result of a compatibility check of two keys. diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java index 6c709fa63..2c2952df9 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java @@ -37,16 +37,16 @@ import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult; -import org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner; -import org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String; +import org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner; +import org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String; import org.onap.policy.apex.model.utilities.Assertions; /** * The key information on an {@link AxArtifactKey} key in an Apex policy model. Each {@link AxArtifactKey} must have an * {@link AxKeyInfo} object. THe information held is the key's UUID and it's description. - * <p> - * Validation checks that all fields are defined and that the key is valid. It also observes that descriptions are blank - * and warns if the UUID is a zero UUID. + * + * <p>Validation checks that all fields are defined and that the key is valid. It also observes that descriptions are + * blank and warns if the UUID is a zero UUID. */ @Entity @@ -68,14 +68,14 @@ public class AxKeyInfo extends AxConcept { private AxArtifactKey key; @Column(name = "uuid") - @Convert(converter = UUID2String.class) - @XmlJavaTypeAdapter(value = UUID2String.class) + @Convert(converter = Uuid2String.class) + @XmlJavaTypeAdapter(value = Uuid2String.class) @XmlElement(name = "UUID", required = true) private UUID uuid; @Column(name = "description", length = MAX_DESCRIPTION_LENGTH_8192) - @Convert(converter = CDATAConditioner.class) - @XmlJavaTypeAdapter(value = CDATAConditioner.class) + @Convert(converter = CDataConditioner.class) + @XmlJavaTypeAdapter(value = CDataConditioner.class) @XmlElement(required = true) private String description; @@ -87,7 +87,7 @@ public class AxKeyInfo extends AxConcept { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -101,7 +101,7 @@ public class AxKeyInfo extends AxConcept { * @param key the key of the concept */ public AxKeyInfo(final AxArtifactKey key) { - this(key, UUID.randomUUID(), "Generated description for concept referred to by key \"" + key.getID() + "\""); + this(key, UUID.randomUUID(), "Generated description for concept referred to by key \"" + key.getId() + "\""); } /** @@ -157,7 +157,7 @@ public class AxKeyInfo extends AxConcept { * * @return the uuid of the concept */ - public UUID getUUID() { + public UUID getUuid() { return uuid; } @@ -313,8 +313,8 @@ public class AxKeyInfo extends AxConcept { if (!uuid.equals(other.uuid)) { return false; } - final String thisdesc = CDATAConditioner.clean(description); - final String otherdesc = CDATAConditioner.clean(other.description); + final String thisdesc = CDataConditioner.clean(description); + final String otherdesc = CDataConditioner.clean(other.description); return thisdesc.equals(otherdesc); } @@ -351,7 +351,7 @@ public class AxKeyInfo extends AxConcept { * @param seed the seed * @return the uuid */ - public static UUID generateReproducibleUUID(final String seed) { + public static UUID generateReproducibleUuid(final String seed) { final Random random; if (seed != null && seed.length() > 0) { random = new Random(seed.hashCode()); diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInformation.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInformation.java index 6590ff456..9afec9999 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInformation.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInformation.java @@ -50,9 +50,9 @@ import org.onap.policy.apex.model.utilities.Assertions; * {@link AxModel} must have an {@link AxKeyInformation} field. The {@link AxKeyInformation} class implements the helper * methods of the {@link AxConceptGetter} interface to allow {@link AxKeyInfo} instances to be retrieved by calling * methods directly on this class without referencing the contained map. - * <p> - * Validation checks that the key is not null, that the key information map is not empty, that each key and value in the - * map is defined, that the key in each map entry matches the key if each entry value, and that no duplicate UUIDs + * + * <p>Validation checks that the key is not null, that the key information map is not empty, that each key and value in + * the map is defined, that the key in each map entry matches the key if each entry value, and that no duplicate UUIDs * exist. Each key information entry is then validated individually. */ @Entity @@ -87,7 +87,7 @@ public class AxKeyInformation extends AxConcept implements AxConceptGetter<AxKey } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -125,10 +125,10 @@ public class AxKeyInformation extends AxConcept implements AxConceptGetter<AxKey * Map. This method is called by JAXB after unmarshaling and is used to convert the hash map to a * {@link NavigableMap} so that it will work with the {@link AxConceptGetter} interface. * - * @param u the unmarshaler that is unmarshaling the model + * @param unmarshaler the unmarshaler that is unmarshaling the model * @param parent the parent object of this object in the unmarshaler */ - public void afterUnmarshal(final Unmarshaller u, final Object parent) { + public void afterUnmarshal(final Unmarshaller unmarshaler, final Object parent) { // The map must be navigable to allow name and version searching, // unmarshaling returns a hash map final NavigableMap<AxArtifactKey, AxKeyInfo> navigablekeyInfoMap = new TreeMap<>(); @@ -152,7 +152,7 @@ public class AxKeyInformation extends AxConcept implements AxConceptGetter<AxKey if (!keyInfoMap.containsKey(artifactKey)) { final AxKeyInfo keyInfo = new AxKeyInfo(artifactKey); // generate a reproducible UUID - keyInfo.setUuid(AxKeyInfo.generateReproducibleUUID(keyInfo.getID() + keyInfo.getDescription())); + keyInfo.setUuid(AxKeyInfo.generateReproducibleUuid(keyInfo.getId() + keyInfo.getDescription())); keyInfoMap.put(artifactKey, keyInfo); } } @@ -244,7 +244,7 @@ public class AxKeyInformation extends AxConcept implements AxConceptGetter<AxKey } /** - * Validate an key information entry + * Validate an key information entry. * * @param keyInfoEntry the key information entry * @param uuidSet the set of UUIDs encountered in validation so far, the UUID of this entry is added to the set @@ -268,12 +268,12 @@ public class AxKeyInformation extends AxConcept implements AxConceptGetter<AxKey result = keyInfoEntry.getValue().validate(result); - if (uuidSet.contains(keyInfoEntry.getValue().getUUID())) { + if (uuidSet.contains(keyInfoEntry.getValue().getUuid())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "duplicate UUID found on keyInfoMap entry " + keyInfoEntry.getKey() + ":" - + keyInfoEntry.getValue().getUUID())); + + keyInfoEntry.getValue().getUuid())); } else { - uuidSet.add(keyInfoEntry.getValue().getUUID()); + uuidSet.add(keyInfoEntry.getValue().getUuid()); } } diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyUse.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyUse.java index eeb8dc650..09170de9b 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyUse.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyUse.java @@ -29,8 +29,8 @@ import org.onap.policy.apex.model.utilities.Assertions; * This class records a usage of a key in the system. When the list of keys being used by a concept is built using the * getKeys() method of the {@link AxConcept} class, an instance of this class is created for every key occurrence. The * list of keys returned by the getKeys() method is a list of {@link AxKeyUse} objects. - * <p> - * Validation checks that each key is valid. + * + * <p>Validation checks that each key is valid. */ public class AxKeyUse extends AxKey { @@ -46,7 +46,7 @@ public class AxKeyUse extends AxKey { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -90,8 +90,8 @@ public class AxKeyUse extends AxKey { * @see org.onap.policy.apex.model.basicmodel.concepts.AxKey#getID() */ @Override - public String getID() { - return usedKey.getID(); + public String getId() { + return usedKey.getId(); } /** diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxModel.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxModel.java index dac1d693c..66045db48 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxModel.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxModel.java @@ -46,9 +46,9 @@ import org.onap.policy.apex.model.utilities.Assertions; /** * This class is the base class for all models in Apex. All model classes inherit from this model so all models must * have a key and have key information. - * <p> - * Validation checks that the model key is valid. It goes on to check for null keys and checks each key for uniqueness - * in the model. A check is carried out to ensure that an {@link AxKeyInfo} instance exists for every + * + * <p>Validation checks that the model key is valid. It goes on to check for null keys and checks each key for + * uniqueness in the model. A check is carried out to ensure that an {@link AxKeyInfo} instance exists for every * {@link AxArtifactKey} key. For each {@link AxReferenceKey} instance, a check is made that its parent and local name * are nut null and that a {@link AxKeyInfo} entry exists for its parent. Then a check is made that each used * {@link AxArtifactKey} and {@link AxReferenceKey} usage references a key that exists. Finally, a check is made to @@ -61,7 +61,8 @@ import org.onap.policy.apex.model.utilities.Assertions; @XmlRootElement(name = "apexModel", namespace = "http://www.onap.org/policy/apex-pdp") @XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AxModel", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = { "key", "keyInformation" }) +@XmlType(name = "AxModel", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = + { "key", "keyInformation" }) public class AxModel extends AxConcept { private static final String IS_A_NULL_KEY = " is a null key"; @@ -88,7 +89,7 @@ public class AxModel extends AxConcept { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -197,8 +198,8 @@ public class AxModel extends AxConcept { AxValidationResult result = resultIn; if (key.equals(AxArtifactKey.getNullKey())) { - result.addValidationMessage( - new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key")); + result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, + "key is a null key")); } result = key.validate(result); @@ -226,7 +227,7 @@ public class AxModel extends AxConcept { for (final AxReferenceKey referenceKey : referenceKeySet) { if (!artifactKeySet.contains(referenceKey.getParentArtifactKey())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "parent artifact key not found for reference key " + referenceKey)); + "parent artifact key not found for reference key " + referenceKey)); } } @@ -236,7 +237,7 @@ public class AxModel extends AxConcept { for (final AxArtifactKey keyInfoKey : keyInformation.getKeyInfoMap().keySet()) { if (!artifactKeySet.contains(keyInfoKey)) { result.addValidationMessage(new AxValidationMessage(keyInfoKey, this.getClass(), - ValidationResult.WARNING, "key not found for key information entry")); + ValidationResult.WARNING, "key not found for key information entry")); } } @@ -244,7 +245,7 @@ public class AxModel extends AxConcept { } /** - * Check for consistent usage of an artifact key in the model + * Check for consistent usage of an artifact key in the model. * * @param artifactKey The artifact key to check * @param artifactKeySet The set of artifact keys encountered so far, this key is appended to the set @@ -252,23 +253,23 @@ public class AxModel extends AxConcept { * @return the result of the validation */ private AxValidationResult validateArtifactKeyInModel(final AxArtifactKey artifactKey, - final Set<AxArtifactKey> artifactKeySet, final AxValidationResult result) { + final Set<AxArtifactKey> artifactKeySet, final AxValidationResult result) { // Null key check if (artifactKey.equals(AxArtifactKey.getNullKey())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key " + artifactKey + IS_A_NULL_KEY)); + "key " + artifactKey + IS_A_NULL_KEY)); } // Null key name start check if (artifactKey.getName().toUpperCase().startsWith(AxKey.NULL_KEY_NAME)) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key " + artifactKey + " name starts with keyword " + AxKey.NULL_KEY_NAME)); + "key " + artifactKey + " name starts with keyword " + AxKey.NULL_KEY_NAME)); } // Unique key check if (artifactKeySet.contains(artifactKey)) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "duplicate key " + artifactKey + " found")); + "duplicate key " + artifactKey + " found")); } else { artifactKeySet.add(artifactKey); } @@ -276,14 +277,14 @@ public class AxModel extends AxConcept { // Key information check if (!keyInformation.getKeyInfoMap().containsKey(artifactKey)) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key information not found for key " + artifactKey)); + "key information not found for key " + artifactKey)); } return result; } /** - * Check for consistent usage of a reference key in the model + * Check for consistent usage of a reference key in the model. * * @param artifactKey The reference key to check * @param referenceKeySet The set of reference keys encountered so far, this key is appended to the set @@ -291,35 +292,35 @@ public class AxModel extends AxConcept { * @return the result of the validation */ private AxValidationResult validateReferenceKeyInModel(final AxReferenceKey referenceKey, - final Set<AxReferenceKey> referenceKeySet, final AxValidationResult result) { + final Set<AxReferenceKey> referenceKeySet, final AxValidationResult result) { // Null key check if (referenceKey.equals(AxReferenceKey.getNullKey())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key " + referenceKey + IS_A_NULL_KEY)); + "key " + referenceKey + IS_A_NULL_KEY)); } // Null parent key check if (referenceKey.getParentArtifactKey().equals(AxArtifactKey.getNullKey())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "parent artifact key of key " + referenceKey + IS_A_NULL_KEY)); + "parent artifact key of key " + referenceKey + IS_A_NULL_KEY)); } // Null local name check if (referenceKey.getLocalName().equals(AxKey.NULL_KEY_NAME)) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key " + referenceKey + " has a null local name")); + "key " + referenceKey + " has a null local name")); } // Null key name start check if (referenceKey.getParentArtifactKey().getName().toUpperCase().startsWith(AxKey.NULL_KEY_NAME)) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key " + referenceKey + " parent name starts with keyword " + AxKey.NULL_KEY_NAME)); + "key " + referenceKey + " parent name starts with keyword " + AxKey.NULL_KEY_NAME)); } // Unique key check if (referenceKeySet.contains(referenceKey)) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "duplicate key " + referenceKey + " found")); + "duplicate key " + referenceKey + " found")); } else { referenceKeySet.add(referenceKey); } @@ -327,14 +328,14 @@ public class AxModel extends AxConcept { // Key information check if (!keyInformation.getKeyInfoMap().containsKey(referenceKey.getParentArtifactKey())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key information not found for parent key of key " + referenceKey)); + "key information not found for parent key of key " + referenceKey)); } return result; } /** - * Check for consistent usage of cross-key references in the model + * Check for consistent usage of cross-key references in the model. * * @param usedKeySet The set of all keys used in the model * @param artifactKeySet The set of artifact keys encountered so far, this key is appended to the set @@ -343,20 +344,20 @@ public class AxModel extends AxConcept { * @return the result of the validation */ private AxValidationResult validateKeyUses(final Set<AxKeyUse> usedKeySet, final Set<AxArtifactKey> artifactKeySet, - final Set<AxReferenceKey> referenceKeySet, final AxValidationResult result) { + final Set<AxReferenceKey> referenceKeySet, final AxValidationResult result) { // Check all key uses for (final AxKeyUse usedKey : usedKeySet) { if (usedKey.getKey() instanceof AxArtifactKey) { // AxArtifact key usage, check the key exists if (!artifactKeySet.contains(usedKey.getKey())) { result.addValidationMessage(new AxValidationMessage(usedKey.getKey(), this.getClass(), - ValidationResult.INVALID, "an artifact key used in the model is not defined")); + ValidationResult.INVALID, "an artifact key used in the model is not defined")); } } else { // AxReference key usage, check the key exists if (!referenceKeySet.contains(usedKey.getKey())) { result.addValidationMessage(new AxValidationMessage(usedKey.getKey(), this.getClass(), - ValidationResult.INVALID, "a reference key used in the model is not defined")); + ValidationResult.INVALID, "a reference key used in the model is not defined")); } } } @@ -364,7 +365,6 @@ public class AxModel extends AxConcept { return result; } - /* * (non-Javadoc) * diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxReferenceKey.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxReferenceKey.java index 7cb4dd832..55ea95c3a 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxReferenceKey.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxReferenceKey.java @@ -38,16 +38,16 @@ import org.onap.policy.apex.model.utilities.Assertions; * A reference key identifies entities in the system that are contained in other entities. Every contained concept in * the system must have an {@link AxReferenceKey} to identify it. Non-contained first order concepts are identified * using an {@link AxArtifactKey} key. - * <p> - * An {@link AxReferenceKey} contains an {@link AxArtifactKey} key reference to the first order entity that contains it. - * The local name of the reference key must uniquely identify the referenced concept among those concepts contained in - * the reference key's parent. In other words, if a parent concept has more than one child, the local name in the key of - * all its children must be unique. - * <p> - * If a reference key's parent is itself a reference key, then the parent's local name must be set in the reference key. - * If the parent is a first order concept, then the parent's local name in the key will be set to NULL. - * <p> - * Key validation checks that the parent name and parent version fields match the {@link NAME_REGEXP} and + * + * <p>An {@link AxReferenceKey} contains an {@link AxArtifactKey} key reference to the first order entity that contains + * it. The local name of the reference key must uniquely identify the referenced concept among those concepts contained + * in the reference key's parent. In other words, if a parent concept has more than one child, the local name in the key + * of all its children must be unique. + * + * <p>If a reference key's parent is itself a reference key, then the parent's local name must be set in the reference + * key. If the parent is a first order concept, then the parent's local name in the key will be set to NULL. + * + * <p>Key validation checks that the parent name and parent version fields match the {@link NAME_REGEXP} and * {@link VERSION_REGEXP} regular expressions respectively and that the local name fields match the * {@link LOCAL_NAME_REGEXP} regular expression. */ @@ -69,7 +69,8 @@ public class AxReferenceKey extends AxKey { public static final String LOCAL_NAME_REGEXP = "[A-Za-z0-9\\-_\\.]+|^$"; /** Regular expression to specify the structure of IDs in reference keys. */ - public static final String REFERENCE_KEY_ID_REGEXP = "[A-Za-z0-9\\-_]+:[0-9].[0-9].[0-9]:[A-Za-z0-9\\-_]+:[A-Za-z0-9\\-_]+"; + public static final String REFERENCE_KEY_ID_REGEXP = + "[A-Za-z0-9\\-_]+:[0-9].[0-9].[0-9]:[A-Za-z0-9\\-_]+:[A-Za-z0-9\\-_]+"; private static final int PARENT_NAME_FIELD = 0; private static final int PARENT_VERSION_FIELD = 1; @@ -262,7 +263,7 @@ public class AxReferenceKey extends AxKey { * @see org.onap.policy.apex.model.basicmodel.concepts.AxKey#getID() */ @Override - public String getID() { + public String getId() { return parentKeyName + ':' + parentKeyVersion + ':' + parentLocalName + ':' + localName; } diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxValidationResult.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxValidationResult.java index 664cf9500..dbe4c6a75 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxValidationResult.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxValidationResult.java @@ -73,7 +73,7 @@ public class AxValidationResult { * * @return true, if the concept has no warnings or errors */ - public boolean isOK() { + public boolean isOk() { return validationResult == ValidationResult.VALID || validationResult == ValidationResult.OBSERVATION; } diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDao.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDao.java index 461f3f113..655e9a99f 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDao.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDao.java @@ -43,7 +43,7 @@ public interface ApexDao { * @param daoParameters parameters to use to access the database * @throws ApexException on initialization errors */ - void init(DAOParameters daoParameters) throws ApexException; + void init(DaoParameters daoParameters) throws ApexException; /** * Close the Apex DAO. @@ -70,19 +70,19 @@ public interface ApexDao { * Delete an Apex concept on the database. * * @param <T> the type of the object to delete, a subclass of {@link AxConcept} - * @param aClass the class of the object to delete, a subclass of {@link AxConcept} + * @param someClass the class of the object to delete, a subclass of {@link AxConcept} * @param key the key of the object to delete */ - <T extends AxConcept> void delete(Class<T> aClass, AxArtifactKey key); + <T extends AxConcept> void delete(Class<T> someClass, AxArtifactKey key); /** * Delete an Apex concept on the database. * * @param <T> the type of the object to delete, a subclass of {@link AxConcept} - * @param aClass the class of the object to delete, a subclass of {@link AxConcept} + * @param someClass the class of the object to delete, a subclass of {@link AxConcept} * @param key the key of the object to delete */ - <T extends AxConcept> void delete(Class<T> aClass, AxReferenceKey key); + <T extends AxConcept> void delete(Class<T> someClass, AxReferenceKey key); /** * Create a collection of objects in the database. @@ -90,7 +90,7 @@ public interface ApexDao { * @param <T> the type of the object to create, a subclass of {@link AxConcept} * @param objs the objects to create */ - <T extends AxConcept> void create(Collection<T> objs); + <T extends AxConcept> void createCollection(Collection<T> objs); /** * Delete a collection of objects in the database. @@ -98,103 +98,103 @@ public interface ApexDao { * @param <T> the type of the objects to delete, a subclass of {@link AxConcept} * @param objs the objects to delete */ - <T extends AxConcept> void delete(Collection<T> objs); + <T extends AxConcept> void deleteCollection(Collection<T> objs); /** * Delete a collection of objects in the database referred to by artifact key. * * @param <T> the type of the objects to delete, a subclass of {@link AxConcept} - * @param aClass the class of the objects to delete, a subclass of {@link AxConcept} + * @param someClass the class of the objects to delete, a subclass of {@link AxConcept} * @param keys the keys of the objects to delete * @return the number of objects deleted */ - <T extends AxConcept> int deleteByArtifactKey(Class<T> aClass, Collection<AxArtifactKey> keys); + <T extends AxConcept> int deleteByArtifactKey(Class<T> someClass, Collection<AxArtifactKey> keys); /** * Delete a collection of objects in the database referred to by reference key. * * @param <T> the type of the objects to delete, a subclass of {@link AxConcept} - * @param aClass the class of the objects to delete, a subclass of {@link AxConcept} + * @param someClass the class of the objects to delete, a subclass of {@link AxConcept} * @param keys the keys of the objects to delete * @return the number of objects deleted */ - <T extends AxConcept> int deleteByReferenceKey(Class<T> aClass, Collection<AxReferenceKey> keys); + <T extends AxConcept> int deleteByReferenceKey(Class<T> someClass, Collection<AxReferenceKey> keys); /** * Delete all objects of a given class in the database. * * @param <T> the type of the objects to delete, a subclass of {@link AxConcept} - * @param aClass the class of the objects to delete, a subclass of {@link AxConcept} + * @param someClass the class of the objects to delete, a subclass of {@link AxConcept} */ - <T extends AxConcept> void deleteAll(Class<T> aClass); + <T extends AxConcept> void deleteAll(Class<T> someClass); /** * Get an object from the database, referred to by artifact key. * * @param <T> the type of the object to get, a subclass of {@link AxConcept} - * @param aClass the class of the object to get, a subclass of {@link AxConcept} + * @param someClass the class of the object to get, a subclass of {@link AxConcept} * @param key the key of the object to get * @return the object that was retrieved from the database */ - <T extends AxConcept> T get(Class<T> aClass, AxArtifactKey key); + <T extends AxConcept> T get(Class<T> someClass, AxArtifactKey key); /** * Get an object from the database, referred to by reference key. * * @param <T> the type of the object to get, a subclass of {@link AxConcept} - * @param aClass the class of the object to get, a subclass of {@link AxConcept} + * @param someClass the class of the object to get, a subclass of {@link AxConcept} * @param key the key of the object to get * @return the object that was retrieved from the database or null if the object was not retrieved */ - <T extends AxConcept> T get(Class<T> aClass, AxReferenceKey key); + <T extends AxConcept> T get(Class<T> someClass, AxReferenceKey key); /** * Get all the objects in the database of a given type. * * @param <T> the type of the objects to get, a subclass of {@link AxConcept} - * @param aClass the class of the objects to get, a subclass of {@link AxConcept} + * @param someClass the class of the objects to get, a subclass of {@link AxConcept} * @return the objects or null if no objects were retrieved */ - <T extends AxConcept> List<T> getAll(Class<T> aClass); + <T extends AxConcept> List<T> getAll(Class<T> someClass); /** * Get all the objects in the database of the given type with the given parent artifact key. * * @param <T> the type of the objects to get, a subclass of {@link AxConcept} - * @param aClass the class of the objects to get, a subclass of {@link AxConcept} + * @param someClass the class of the objects to get, a subclass of {@link AxConcept} * @param parentKey the parent key of the concepts to get * @return the all */ - <T extends AxConcept> List<T> getAll(Class<T> aClass, AxArtifactKey parentKey); + <T extends AxConcept> List<T> getAll(Class<T> someClass, AxArtifactKey parentKey); /** * Get a concept from the database with the given artifact key. * * @param <T> the type of the object to get, a subclass of {@link AxConcept} - * @param aClass the class of the object to get, a subclass of {@link AxConcept} - * @param artifactID the artifact key of the concept to get + * @param someClass the class of the object to get, a subclass of {@link AxConcept} + * @param artifactId the artifact key of the concept to get * @return the concept that matches the key or null if the concept is not retrieved */ - <T extends AxConcept> T getArtifact(Class<T> aClass, AxArtifactKey artifactID); + <T extends AxConcept> T getArtifact(Class<T> someClass, AxArtifactKey artifactId); /** * Get a concept from the database with the given reference key. * * @param <T> the type of the object to get, a subclass of {@link AxConcept} - * @param aClass the class of the object to get, a subclass of {@link AxConcept} - * @param artifactID the artifact key of the concept to get + * @param someClass the class of the object to get, a subclass of {@link AxConcept} + * @param artifactId the artifact key of the concept to get * @return the concept that matches the key or null if the concept is not retrieved */ - <T extends AxConcept> T getArtifact(Class<T> aClass, AxReferenceKey artifactID); + <T extends AxConcept> T getArtifact(Class<T> someClass, AxReferenceKey artifactId); /** * Get the number of instances of a concept that exist in the database. * * @param <T> the type of the object to get, a subclass of {@link AxConcept} - * @param aClass the class of the object to get, a subclass of {@link AxConcept} + * @param someClass the class of the object to get, a subclass of {@link AxConcept} * @return the number of instances of the concept in the database */ - <T extends AxConcept> long size(Class<T> aClass); + <T extends AxConcept> long size(Class<T> someClass); /** * Update a concept in the database. diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java index 50724d2d7..82838edf1 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java @@ -27,7 +27,7 @@ import org.slf4j.ext.XLoggerFactory; /** * This factory class returns an Apex DAO for the configured persistence mechanism. The factory uses the plugin class - * specified in {@link DAOParameters} to instantiate a DAO instance. + * specified in {@link DaoParameters} to instantiate a DAO instance. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -42,7 +42,7 @@ public class ApexDaoFactory { * @return the Apex DAO * @throws ApexException on invalid JPA plugins */ - public ApexDao createApexDao(final DAOParameters daoParameters) throws ApexException { + public ApexDao createApexDao(final DaoParameters daoParameters) throws ApexException { Assertions.argumentNotNull(daoParameters, ApexException.class, "Parameter \"daoParameters\" may not be null"); // Get the class for the DAO using reflection diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/DAOParameters.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/DaoParameters.java index 5a44d18a8..cdaf64ed0 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/DAOParameters.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/DaoParameters.java @@ -27,7 +27,7 @@ import java.util.Properties; * * @author Liam Fallon (liam.fallon@ericsson.com) */ -public class DAOParameters { +public class DaoParameters { /** The default Apex DAO plugin class. */ public static final String DEFAULT_PLUGIN_CLASS = "org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"; diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/CDATAConditioner.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/CDataConditioner.java index 9e840da2c..93c891b13 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/CDATAConditioner.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/CDataConditioner.java @@ -31,7 +31,7 @@ import javax.xml.bind.annotation.adapters.XmlAdapter; * @author John Keeney (John.Keeney@ericsson.com) */ @Converter -public class CDATAConditioner extends XmlAdapter<String, String> implements AttributeConverter<String, String> { +public class CDataConditioner extends XmlAdapter<String, String> implements AttributeConverter<String, String> { private static final String NL = "\n"; @@ -61,8 +61,8 @@ public class CDATAConditioner extends XmlAdapter<String, String> implements Attr * @see javax.xml.bind.annotation.adapters.XmlAdapter */ @Override - public String unmarshal(final String v) throws Exception { - return this.convertToEntityAttribute(v); + public String unmarshal(final String value) throws Exception { + return this.convertToEntityAttribute(value); } /* @@ -71,8 +71,8 @@ public class CDATAConditioner extends XmlAdapter<String, String> implements Attr * @see javax.xml.bind.annotation.adapters.XmlAdapter */ @Override - public String marshal(final String v) throws Exception { - return this.convertToDatabaseColumn(v); + public String marshal(final String value) throws Exception { + return this.convertToDatabaseColumn(value); } /** diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/UUID2String.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/Uuid2String.java index f26dfc2de..3f7bddbd1 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/UUID2String.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/Uuid2String.java @@ -32,7 +32,7 @@ import javax.xml.bind.annotation.adapters.XmlAdapter; * @author Liam Fallon (liam.fallon@ericsson.com) */ @Converter -public class UUID2String extends XmlAdapter<String, UUID> implements AttributeConverter<UUID, String> { +public class Uuid2String extends XmlAdapter<String, UUID> implements AttributeConverter<UUID, String> { /* * (non-Javadoc) @@ -67,8 +67,8 @@ public class UUID2String extends XmlAdapter<String, UUID> implements AttributeCo * @see javax.xml.bind.annotation.adapters.XmlAdapter */ @Override - public UUID unmarshal(final String v) throws Exception { - return this.convertToEntityAttribute(v); + public UUID unmarshal(final String value) throws Exception { + return this.convertToEntityAttribute(value); } /* @@ -77,7 +77,7 @@ public class UUID2String extends XmlAdapter<String, UUID> implements AttributeCo * @see javax.xml.bind.annotation.adapters.XmlAdapter */ @Override - public String marshal(final UUID v) throws Exception { - return this.convertToDatabaseColumn(v); + public String marshal(final UUID value) throws Exception { + return this.convertToDatabaseColumn(value); } } diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java index 228362bce..7945a0837 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java @@ -34,7 +34,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxConcept; import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; import org.onap.policy.apex.model.basicmodel.dao.ApexDao; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; @@ -66,7 +66,7 @@ public class DefaultApexDao implements ApexDao { * org.onap.policy.apex.model.basicmodel.dao.ApexDao#init(org.onap.policy.apex.model.basicmodel.dao.DAOParameters) */ @Override - public void init(final DAOParameters daoParameters) throws ApexException { + public void init(final DaoParameters daoParameters) throws ApexException { if (daoParameters == null || daoParameters.getPersistenceUnit() == null) { LOGGER.error("Apex persistence unit parameter not set"); throw new ApexException("Apex persistence unit parameter not set"); @@ -75,11 +75,12 @@ public class DefaultApexDao implements ApexDao { LOGGER.debug("Creating Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\" . . ."); try { emf = Persistence.createEntityManagerFactory(daoParameters.getPersistenceUnit(), - daoParameters.getJdbcProperties()); + daoParameters.getJdbcProperties()); } catch (final Exception e) { LOGGER.warn("Creation of Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\" failed", e); throw new ApexException( - "Creation of Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\" failed", e); + "Creation of Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\" failed", + e); } LOGGER.debug("Created Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\""); } @@ -159,15 +160,15 @@ public class DefaultApexDao implements ApexDao { * org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey) */ @Override - public <T extends AxConcept> void delete(final Class<T> aClass, final AxArtifactKey key) { + public <T extends AxConcept> void delete(final Class<T> someClass, final AxArtifactKey key) { if (key == null) { return; } final EntityManager mg = getEntityManager(); try { mg.getTransaction().begin(); - mg.createQuery(DELETE_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_NAME + key.getName() + AND_C_KEY_VERSION - + key.getVersion() + "'", aClass).executeUpdate(); + mg.createQuery(DELETE_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_NAME + key.getName() + + AND_C_KEY_VERSION + key.getVersion() + "'", someClass).executeUpdate(); mg.getTransaction().commit(); } finally { mg.close(); @@ -181,16 +182,16 @@ public class DefaultApexDao implements ApexDao { * org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey) */ @Override - public <T extends AxConcept> void delete(final Class<T> aClass, final AxReferenceKey key) { + public <T extends AxConcept> void delete(final Class<T> someClass, final AxReferenceKey key) { if (key == null) { return; } final EntityManager mg = getEntityManager(); try { mg.getTransaction().begin(); - mg.createQuery(DELETE_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME + key.getParentKeyName() - + AND_C_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion() + AND_C_KEY_LOCAL_NAME - + key.getLocalName() + "'", aClass).executeUpdate(); + mg.createQuery(DELETE_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME + + key.getParentKeyName() + AND_C_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion() + + AND_C_KEY_LOCAL_NAME + key.getLocalName() + "'", someClass).executeUpdate(); mg.getTransaction().commit(); } finally { mg.close(); @@ -203,7 +204,7 @@ public class DefaultApexDao implements ApexDao { * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#create(java.util.Collection) */ @Override - public <T extends AxConcept> void create(final Collection<T> objs) { + public <T extends AxConcept> void createCollection(final Collection<T> objs) { if (objs == null || objs.isEmpty()) { return; } @@ -225,7 +226,7 @@ public class DefaultApexDao implements ApexDao { * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#delete(java.util.Collection) */ @Override - public <T extends AxConcept> void delete(final Collection<T> objs) { + public <T extends AxConcept> void deleteCollection(final Collection<T> objs) { if (objs == null || objs.isEmpty()) { return; } @@ -247,7 +248,8 @@ public class DefaultApexDao implements ApexDao { * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#deleteByArtifactKey(java.lang.Class, java.util.Collection) */ @Override - public <T extends AxConcept> int deleteByArtifactKey(final Class<T> aClass, final Collection<AxArtifactKey> keys) { + public <T extends AxConcept> int deleteByArtifactKey(final Class<T> someClass, + final Collection<AxArtifactKey> keys) { if (keys == null || keys.isEmpty()) { return 0; } @@ -256,8 +258,10 @@ public class DefaultApexDao implements ApexDao { try { mg.getTransaction().begin(); for (final AxArtifactKey key : keys) { - deletedCount += mg.createQuery(DELETE_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_NAME + key.getName() - + AND_C_KEY_VERSION + key.getVersion() + "'", aClass).executeUpdate(); + deletedCount += mg + .createQuery(DELETE_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_NAME + + key.getName() + AND_C_KEY_VERSION + key.getVersion() + "'", someClass) + .executeUpdate(); } mg.getTransaction().commit(); } finally { @@ -273,8 +277,8 @@ public class DefaultApexDao implements ApexDao { * java.util.Collection) */ @Override - public <T extends AxConcept> int deleteByReferenceKey(final Class<T> aClass, - final Collection<AxReferenceKey> keys) { + public <T extends AxConcept> int deleteByReferenceKey(final Class<T> someClass, + final Collection<AxReferenceKey> keys) { if (keys == null || keys.isEmpty()) { return 0; } @@ -283,12 +287,9 @@ public class DefaultApexDao implements ApexDao { try { mg.getTransaction().begin(); for (final AxReferenceKey key : keys) { - deletedCount += - mg.createQuery( - DELETE_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME - + key.getParentKeyName() + AND_C_KEY_PARENT_KEY_VERSION - + key.getParentKeyVersion() + AND_C_KEY_LOCAL_NAME + key.getLocalName() + "'", - aClass).executeUpdate(); + deletedCount += mg.createQuery(DELETE_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME + + key.getParentKeyName() + AND_C_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion() + + AND_C_KEY_LOCAL_NAME + key.getLocalName() + "'", someClass).executeUpdate(); } mg.getTransaction().commit(); } finally { @@ -303,11 +304,11 @@ public class DefaultApexDao implements ApexDao { * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#deleteAll(java.lang.Class) */ @Override - public <T extends AxConcept> void deleteAll(final Class<T> aClass) { + public <T extends AxConcept> void deleteAll(final Class<T> someClass) { final EntityManager mg = getEntityManager(); try { mg.getTransaction().begin(); - mg.createQuery(DELETE_FROM + aClass.getSimpleName() + " c ", aClass).executeUpdate(); + mg.createQuery(DELETE_FROM + someClass.getSimpleName() + " c ", someClass).executeUpdate(); mg.getTransaction().commit(); } finally { mg.close(); @@ -321,21 +322,21 @@ public class DefaultApexDao implements ApexDao { * org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey) */ @Override - public <T extends AxConcept> T get(final Class<T> aClass, final AxArtifactKey key) { - if (aClass == null) { + public <T extends AxConcept> T get(final Class<T> someClass, final AxArtifactKey key) { + if (someClass == null) { return null; } final EntityManager mg = getEntityManager(); try { - final T t = mg.find(aClass, key); + final T t = mg.find(someClass, key); if (t != null) { // This clone is created to force the JPA DAO to recurse down through the object try { - final T clonedT = aClass.newInstance(); + final T clonedT = someClass.newInstance(); t.copyTo(clonedT); return clonedT; } catch (final Exception e) { - LOGGER.warn("Could not clone object of class \"" + aClass.getCanonicalName() + "\"", e); + LOGGER.warn("Could not clone object of class \"" + someClass.getCanonicalName() + "\"", e); return null; } } else { @@ -353,20 +354,20 @@ public class DefaultApexDao implements ApexDao { * org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey) */ @Override - public <T extends AxConcept> T get(final Class<T> aClass, final AxReferenceKey key) { - if (aClass == null) { + public <T extends AxConcept> T get(final Class<T> someClass, final AxReferenceKey key) { + if (someClass == null) { return null; } final EntityManager mg = getEntityManager(); try { - final T t = mg.find(aClass, key); + final T t = mg.find(someClass, key); if (t != null) { try { - final T clonedT = aClass.newInstance(); + final T clonedT = someClass.newInstance(); t.copyTo(clonedT); return clonedT; } catch (final Exception e) { - LOGGER.warn("Could not clone object of class \"" + aClass.getCanonicalName() + "\"", e); + LOGGER.warn("Could not clone object of class \"" + someClass.getCanonicalName() + "\"", e); return null; } } else { @@ -383,13 +384,13 @@ public class DefaultApexDao implements ApexDao { * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#getAll(java.lang.Class) */ @Override - public <T extends AxConcept> List<T> getAll(final Class<T> aClass) { - if (aClass == null) { + public <T extends AxConcept> List<T> getAll(final Class<T> someClass) { + if (someClass == null) { return Collections.emptyList(); } final EntityManager mg = getEntityManager(); try { - return mg.createQuery(SELECT_C_FROM + aClass.getSimpleName() + " c", aClass).getResultList(); + return mg.createQuery(SELECT_C_FROM + someClass.getSimpleName() + " c", someClass).getResultList(); } finally { mg.close(); } @@ -402,16 +403,15 @@ public class DefaultApexDao implements ApexDao { * org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey) */ @Override - public <T extends AxConcept> List<T> getAll(final Class<T> aClass, final AxArtifactKey parentKey) { - if (aClass == null) { + public <T extends AxConcept> List<T> getAll(final Class<T> someClass, final AxArtifactKey parentKey) { + if (someClass == null) { return Collections.emptyList(); } final EntityManager mg = getEntityManager(); try { - return mg - .createQuery(SELECT_C_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME - + parentKey.getName() + AND_C_KEY_PARENT_KEY_VERSION + parentKey.getVersion() + "'", aClass) - .getResultList(); + return mg.createQuery(SELECT_C_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME + + parentKey.getName() + AND_C_KEY_PARENT_KEY_VERSION + parentKey.getVersion() + "'", + someClass).getResultList(); } finally { mg.close(); } @@ -424,15 +424,15 @@ public class DefaultApexDao implements ApexDao { * org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey) */ @Override - public <T extends AxConcept> T getArtifact(final Class<T> aClass, final AxArtifactKey key) { - if (aClass == null || key == null) { + public <T extends AxConcept> T getArtifact(final Class<T> someClass, final AxArtifactKey key) { + if (someClass == null || key == null) { return null; } final EntityManager mg = getEntityManager(); List<T> ret; try { - ret = mg.createQuery(SELECT_C_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_NAME + key.getName() - + AND_C_KEY_VERSION + key.getVersion() + "'", aClass).getResultList(); + ret = mg.createQuery(SELECT_C_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_NAME + key.getName() + + AND_C_KEY_VERSION + key.getVersion() + "'", someClass).getResultList(); } finally { mg.close(); } @@ -440,8 +440,8 @@ public class DefaultApexDao implements ApexDao { return null; } if (ret.size() > 1) { - throw new IllegalArgumentException("More than one result was returned for search for " + aClass - + " with key " + key.getID() + ": " + ret); + throw new IllegalArgumentException("More than one result was returned for search for " + someClass + + " with key " + key.getId() + ": " + ret); } return ret.get(0); } @@ -453,16 +453,16 @@ public class DefaultApexDao implements ApexDao { * org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey) */ @Override - public <T extends AxConcept> T getArtifact(final Class<T> aClass, final AxReferenceKey key) { - if (aClass == null || key == null) { + public <T extends AxConcept> T getArtifact(final Class<T> someClass, final AxReferenceKey key) { + if (someClass == null || key == null) { return null; } final EntityManager mg = getEntityManager(); List<T> ret; try { - ret = mg.createQuery(SELECT_C_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME - + key.getParentKeyName() + AND_C_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion() - + AND_C_KEY_LOCAL_NAME + key.getLocalName() + "'", aClass).getResultList(); + ret = mg.createQuery(SELECT_C_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME + + key.getParentKeyName() + AND_C_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion() + + AND_C_KEY_LOCAL_NAME + key.getLocalName() + "'", someClass).getResultList(); } finally { mg.close(); } @@ -470,8 +470,8 @@ public class DefaultApexDao implements ApexDao { return null; } if (ret.size() > 1) { - throw new IllegalArgumentException("More than one result was returned for search for " + aClass - + " with key " + key.getID() + ": " + ret); + throw new IllegalArgumentException("More than one result was returned for search for " + someClass + + " with key " + key.getId() + ": " + ret); } return ret.get(0); } @@ -503,15 +503,15 @@ public class DefaultApexDao implements ApexDao { * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#size(java.lang.Class) */ @Override - public <T extends AxConcept> long size(final Class<T> aClass) { - if (aClass == null) { + public <T extends AxConcept> long size(final Class<T> someClass) { + if (someClass == null) { return 0; } final EntityManager mg = getEntityManager(); long size = 0; try { - size = mg.createQuery("SELECT COUNT(c) FROM " + aClass.getSimpleName() + " c", Long.class) - .getSingleResult(); + size = mg.createQuery("SELECT COUNT(c) FROM " + someClass.getSimpleName() + " c", Long.class) + .getSingleResult(); } finally { mg.close(); } diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/package-info.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/package-info.java index 12e854f26..5d585c247 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/package-info.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/package-info.java @@ -19,7 +19,8 @@ */ /** - * Contains a default DAO implementation for APEX {@link org.onap.policy.apex.model.basicmodel.concepts.AxConcept} classes that uses javax persistence. + * Contains a default DAO implementation for APEX {@link org.onap.policy.apex.model.basicmodel.concepts.AxConcept} + * classes that uses javax persistence. * * @author Liam Fallon (liam.fallon@ericsson.com) */ diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/package-info.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/package-info.java index fe551b87a..505e4023a 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/package-info.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/package-info.java @@ -20,8 +20,8 @@ /** * Defines and implements the Data Access Object (DAO) that allows Apex - * {@link org.onap.policy.apex.model.basicmodel.concepts.AxConcept} concepts to be read from and written to databases over - * JDBC. + * {@link org.onap.policy.apex.model.basicmodel.concepts.AxConcept} concepts to be read from and written to databases + * over JDBC. * * @author Liam Fallon (liam.fallon@ericsson.com) */ diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelCreator.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelCreator.java index 82a808c60..a33e1bf1a 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelCreator.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelCreator.java @@ -23,7 +23,8 @@ package org.onap.policy.apex.model.basicmodel.handling; import org.onap.policy.apex.model.basicmodel.concepts.AxModel; /** - * This interface is implemented by factories that create Apex models. It is mainly used by unit test classes that generate Apex models for test purposes. + * This interface is implemented by factories that create Apex models. It is mainly used by unit test classes that + * generate Apex models for test purposes. * * @author Liam Fallon (liam.fallon@ericsson.com) * @param <M> the type of Apex model to create, must be a sub class of {@link AxModel} diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelException.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelException.java index 8964a5bc2..17eb2639d 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelException.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelException.java @@ -43,9 +43,9 @@ public class ApexModelException extends ApexException { * Instantiates a new apex model handling exception. * * @param message the message - * @param e the e + * @param exception the exception */ - public ApexModelException(final String message, final Exception e) { - super(message, e); + public ApexModelException(final String message, final Exception exception) { + super(message, exception); } } diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelFileWriter.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelFileWriter.java index 2312b88db..aead4cb2b 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelFileWriter.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelFileWriter.java @@ -57,8 +57,8 @@ public class ApexModelFileWriter<M extends AxModel> { * @param modelFileName The name of the file to write to * @throws ApexException thrown on errors */ - public void apexModelWriteXMLFile(final M model, final Class<M> rootModelClass, final String modelFileName) - throws ApexException { + public void apexModelWriteXmlFile(final M model, final Class<M> rootModelClass, final String modelFileName) + throws ApexException { LOGGER.debug("running apexModelWriteXMLFile . . ."); final ApexModelWriter<M> modelWriter = new ApexModelWriter<>(rootModelClass); @@ -80,8 +80,8 @@ public class ApexModelFileWriter<M extends AxModel> { * @param modelFileName The name of the file to write to * @throws ApexException thrown on errors */ - public void apexModelWriteJSONFile(final M model, final Class<M> rootModelClass, final String modelFileName) - throws ApexException { + public void apexModelWriteJsonFile(final M model, final Class<M> rootModelClass, final String modelFileName) + throws ApexException { LOGGER.debug("running apexModelWriteJSONFile . . ."); final ApexModelWriter<M> modelWriter = new ApexModelWriter<>(rootModelClass); @@ -119,7 +119,8 @@ public class ApexModelFileWriter<M extends AxModel> { * @param modelFileName the file name of the file to write to * @throws ApexException on exceptions writing the model */ - private void writeModelFile(final M model, final ApexModelWriter<M> modelWriter, final String modelFileName) throws ApexException { + private void writeModelFile(final M model, final ApexModelWriter<M> modelWriter, final String modelFileName) + throws ApexException { final File modelFile = new File(modelFileName); if (!modelFile.getParentFile().exists() && !modelFile.getParentFile().mkdirs()) { LOGGER.warn("could not create directory " + modelFile.getParentFile()); @@ -130,8 +131,7 @@ public class ApexModelFileWriter<M extends AxModel> { final FileOutputStream fileOutputStream = new FileOutputStream(modelFile); modelWriter.write(model, fileOutputStream); fileOutputStream.close(); - } - catch (final Exception e) { + } catch (final Exception e) { LOGGER.warn("error processing file " + modelFile.getAbsolutePath(), e); throw new ApexException("error processing file " + modelFile.getAbsolutePath(), e); } diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelReader.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelReader.java index 6ca9c03d8..ce2c9fc56 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelReader.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelReader.java @@ -59,8 +59,10 @@ public class ApexModelReader<C extends AxConcept> { private static final XLogger LOGGER = XLoggerFactory.getXLogger(ApexModelReader.class); // Regular expressions for checking input types - private static final String XML_INPUT_TYPE_REGEXP = "^\\s*<\\?xml.*>\\s*"; // (starts with <?xml...> - private static final String JSON_INPUT_TYPE_REGEXP = "^\\s*[\\(\\{\\[][\\s+\\S]*[\\)\\}\\]]"; // starts with some kind of bracket [ or ( + // (starts with <?xml...> + private static final String XML_INPUT_TYPE_REGEXP = "^\\s*<\\?xml.*>\\s*"; + // starts with some kind of bracket [ or ( + private static final String JSON_INPUT_TYPE_REGEXP = "^\\s*[\\(\\{\\[][\\s+\\S]*[\\)\\}\\]]"; // or {, then has something, then has // and has a close bracket @@ -119,8 +121,9 @@ public class ApexModelReader<C extends AxConcept> { if (schemaFileName != null) { try { // Set the concept schema - final URL schemaURL = ResourceUtils.getUrlResource(schemaFileName); - final Schema apexConceptSchema = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(schemaURL); + final URL schemaUrl = ResourceUtils.getUrlResource(schemaFileName); + final Schema apexConceptSchema = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI) + .newSchema(schemaUrl); unmarshaller.setSchema(apexConceptSchema); } catch (final Exception e) { diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelSaver.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelSaver.java index 16ea1f3fa..4f3008f04 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelSaver.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelSaver.java @@ -45,13 +45,13 @@ public class ApexModelSaver<M extends AxModel> { private final String writePath; /** - * Constructor, specifies the type of the Apex model (a sub class of {@link AxModel}), the model to write, and the path of a directory to which to write the - * model. + * Constructor, specifies the type of the Apex model (a sub class of {@link AxModel}), the model to write, and the + * path of a directory to which to write the model. * * @param rootModelClass the class of the model, a sub class of {@link AxModel} * @param model the model to write, an instance of a sub class of {@link AxModel} - * @param writePath the directory to which models will be written. The name of the written model will be the Model Name for its key with the suffix - * {@code .xml} or {@code .json}. + * @param writePath the directory to which models will be written. The name of the written model will be the Model + * Name for its key with the suffix {@code .xml} or {@code .json}. */ public ApexModelSaver(final Class<M> rootModelClass, final M model, final String writePath) { Assertions.argumentNotNull(rootModelClass, "argument rootModelClass may not be null"); @@ -68,12 +68,12 @@ public class ApexModelSaver<M extends AxModel> { * * @throws ApexException on errors writing the Apex model */ - public void apexModelWriteXML() throws ApexException { + public void apexModelWriteXml() throws ApexException { LOGGER.debug("running apexModelWriteXML . . ."); // Write the file to disk final File xmlFile = new File(writePath + File.separatorChar + model.getKey().getName() + ".xml"); - new ApexModelFileWriter<M>(true).apexModelWriteXMLFile(model, rootModelClass, xmlFile.getPath()); + new ApexModelFileWriter<M>(true).apexModelWriteXmlFile(model, rootModelClass, xmlFile.getPath()); LOGGER.debug("ran apexModelWriteXML"); } @@ -83,12 +83,12 @@ public class ApexModelSaver<M extends AxModel> { * * @throws ApexException on errors writing the Apex model */ - public void apexModelWriteJSON() throws ApexException { + public void apexModelWriteJson() throws ApexException { LOGGER.debug("running apexModelWriteJSON . . ."); // Write the file to disk final File jsonFile = new File(writePath + File.separatorChar + model.getKey().getName() + ".json"); - new ApexModelFileWriter<M>(true).apexModelWriteJSONFile(model, rootModelClass, jsonFile.getPath()); + new ApexModelFileWriter<M>(true).apexModelWriteJsonFile(model, rootModelClass, jsonFile.getPath()); LOGGER.debug("ran apexModelWriteJSON"); } diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelStringWriter.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelStringWriter.java index 3d2e50b38..92a956bde 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelStringWriter.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelStringWriter.java @@ -58,13 +58,13 @@ public class ApexModelStringWriter<C extends AxConcept> { * @return The string with the concept * @throws ApexException thrown on errors */ - public String writeString(final C concept, final Class<C> rootConceptClass, final boolean jsonFlag) throws ApexException { + public String writeString(final C concept, final Class<C> rootConceptClass, final boolean jsonFlag) + throws ApexException { Assertions.argumentNotNull(concept, "concept may not be null"); - + if (jsonFlag) { - return writeJSONString(concept, rootConceptClass); - } - else { + return writeJsonString(concept, rootConceptClass); + } else { return concept.toString(); } } @@ -77,7 +77,7 @@ public class ApexModelStringWriter<C extends AxConcept> { * @return The string with the concept * @throws ApexException thrown on errors */ - public String writeXMLString(final C concept, final Class<C> rootConceptClass) throws ApexException { + public String writeXmlString(final C concept, final Class<C> rootConceptClass) throws ApexException { LOGGER.debug("running writeXMLString . . ."); final ApexModelWriter<C> conceptWriter = new ApexModelWriter<>(rootConceptClass); @@ -90,8 +90,7 @@ public class ApexModelStringWriter<C extends AxConcept> { try { conceptWriter.write(concept, baOutputStream); baOutputStream.close(); - } - catch (final Exception e) { + } catch (final Exception e) { LOGGER.warn("error writing XML string", e); throw new ApexException("error writing XML string", e); } @@ -108,7 +107,7 @@ public class ApexModelStringWriter<C extends AxConcept> { * @return The string with the concept * @throws ApexException thrown on errors */ - public String writeJSONString(final C concept, final Class<C> rootConceptClass) throws ApexException { + public String writeJsonString(final C concept, final Class<C> rootConceptClass) throws ApexException { LOGGER.debug("running writeJSONString . . ."); final ApexModelWriter<C> conceptWriter = new ApexModelWriter<>(rootConceptClass); @@ -119,8 +118,7 @@ public class ApexModelStringWriter<C extends AxConcept> { try { conceptWriter.write(concept, baOutputStream); baOutputStream.close(); - } - catch (final Exception e) { + } catch (final Exception e) { LOGGER.warn("error writing JSON string", e); throw new ApexException("error writing JSON string", e); } diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelWriter.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelWriter.java index 2bea92cc6..977a8e7c6 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelWriter.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelWriter.java @@ -67,7 +67,7 @@ public class ApexModelWriter<C extends AxConcept> { private boolean jsonOutput = false; // The list of fields to output as CDATA - private final Set<String> cDataFieldSet = new TreeSet<>(); + private final Set<String> cdataFieldSet = new TreeSet<>(); // The Marshaller for the Apex concepts private Marshaller marshaller = null; @@ -104,7 +104,7 @@ public class ApexModelWriter<C extends AxConcept> { * @return the set of fields */ public Set<String> getCDataFieldSet() { - return cDataFieldSet; + return cdataFieldSet; } /** @@ -176,14 +176,14 @@ public class ApexModelWriter<C extends AxConcept> { LOGGER.debug(validationResult.toString()); if (!validationResult.isValid()) { LOGGER.warn(validationResult.toString()); - throw new ApexModelException("Apex concept xml (" + concept.getKey().getID() + ") validation failed"); + throw new ApexModelException("Apex concept xml (" + concept.getKey().getId() + ") validation failed"); } } if (jsonOutput) { - writeJSON(concept, apexConceptWriter); + writeJson(concept, apexConceptWriter); } else { - writeXML(concept, apexConceptWriter); + writeXml(concept, apexConceptWriter); } } @@ -194,7 +194,7 @@ public class ApexModelWriter<C extends AxConcept> { * @param apexConceptWriter the writer to write to * @throws ApexModelException on validation or writing exceptions */ - private void writeXML(final C concept, final Writer apexConceptWriter) throws ApexModelException { + private void writeXml(final C concept, final Writer apexConceptWriter) throws ApexModelException { Assertions.argumentNotNull(concept, CONCEPT_MAY_NOT_BE_NULL); LOGGER.debug("writing Apex concept XML . . ."); @@ -212,7 +212,7 @@ public class ApexModelWriter<C extends AxConcept> { // Convert the cDataFieldSet into a space delimited string domTransformer.setOutputProperty(OutputKeys.CDATA_SECTION_ELEMENTS, - cDataFieldSet.toString().replaceAll("[\\[\\]\\,]", " ")); + cdataFieldSet.toString().replaceAll("[\\[\\]\\,]", " ")); domTransformer.transform(new DOMSource(document), new StreamResult(apexConceptWriter)); } catch (JAXBException | TransformerException | ParserConfigurationException e) { LOGGER.warn("Unable to marshal Apex concept XML", e); @@ -245,7 +245,7 @@ public class ApexModelWriter<C extends AxConcept> { * @param apexConceptWriter the writer to write to * @throws ApexModelException on validation or writing exceptions */ - private void writeJSON(final C concept, final Writer apexConceptWriter) throws ApexModelException { + private void writeJson(final C concept, final Writer apexConceptWriter) throws ApexModelException { Assertions.argumentNotNull(concept, CONCEPT_MAY_NOT_BE_NULL); LOGGER.debug("writing Apex concept JSON . . ."); diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexSchemaGenerator.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexSchemaGenerator.java index 6e17ab94d..46e30bf10 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexSchemaGenerator.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexSchemaGenerator.java @@ -53,20 +53,17 @@ public class ApexSchemaGenerator { if (args.length == 1) { printStream = System.out; - } - else if (args.length == 2) { + } else if (args.length == 2) { final File schemaFile = new File(args[1]); try { schemaFile.getParentFile().mkdirs(); printStream = new PrintStream(schemaFile); - } - catch (final Exception e) { + } catch (final Exception e) { LOGGER.error("error on Apex schema output", e); return; } - } - else { + } else { LOGGER.error("usage: ApexSchemaGenerator apex-root-class [schema-file-name]"); return; } @@ -90,12 +87,10 @@ public class ApexSchemaGenerator { JAXBContext jaxbContext; try { jaxbContext = JAXBContext.newInstance(Class.forName(rootClassName)); - } - catch (final ClassNotFoundException e) { + } catch (final ClassNotFoundException e) { LOGGER.error("could not create JAXB context, root class " + rootClassName + " not found", e); return null; - } - catch (final JAXBException e) { + } catch (final JAXBException e) { LOGGER.error("could not create JAXB context", e); return null; } @@ -103,8 +98,7 @@ public class ApexSchemaGenerator { final ApexSchemaOutputResolver sor = new ApexSchemaOutputResolver(); try { jaxbContext.generateSchema(sor); - } - catch (final IOException e) { + } catch (final IOException e) { LOGGER.error("error generating the Apex schema (XSD) file", e); return null; } @@ -116,22 +110,26 @@ public class ApexSchemaGenerator { } /** - * There is a bug in schema generation that does not specify the elements from Java Maps as being unqualified. This method "hacks" those - * elements in the schema to fix this, the elements being {@code entry}, {@code key}, and {@code value} + * There is a bug in schema generation that does not specify the elements from Java Maps as being unqualified. This + * method "hacks" those elements in the schema to fix this, the elements being {@code entry}, {@code key}, and + * {@code value} * * @param schemaString The schema in which elements should be fixed * @return the string */ private String fixForUnqualifiedBug(final String schemaString) { // Fix the "entry" element - String newSchemaString = schemaString.replaceAll("<xs:element name=\"entry\" minOccurs=\"0\" maxOccurs=\"unbounded\">", - "<xs:element name=\"entry\" minOccurs=\"0\" maxOccurs=\"unbounded\" form=\"unqualified\">"); + String newSchemaString = schemaString.replaceAll( + "<xs:element name=\"entry\" minOccurs=\"0\" maxOccurs=\"unbounded\">", + "<xs:element name=\"entry\" minOccurs=\"0\" maxOccurs=\"unbounded\" form=\"unqualified\">"); // Fix the "key" element - newSchemaString = newSchemaString.replaceAll("<xs:element name=\"key\"", "<xs:element name=\"key\" form=\"unqualified\""); + newSchemaString = newSchemaString.replaceAll("<xs:element name=\"key\"", + "<xs:element name=\"key\" form=\"unqualified\""); // Fix the "value" element - newSchemaString = newSchemaString.replaceAll("<xs:element name=\"value\"", "<xs:element name=\"value\" form=\"unqualified\""); + newSchemaString = newSchemaString.replaceAll("<xs:element name=\"value\"", + "<xs:element name=\"value\" form=\"unqualified\""); return newSchemaString; } @@ -148,14 +146,14 @@ public class ApexSchemaGenerator { * @see javax.xml.bind.SchemaOutputResolver#createOutput(java.lang.String, java.lang.String) */ @Override - public Result createOutput(final String namespaceURI, final String suggestedFileName) throws IOException { + public Result createOutput(final String namespaceUri, final String suggestedFileName) throws IOException { final StreamResult result = new StreamResult(stringWriter); result.setSystemId(suggestedFileName); return result; } /** - * Get the schema from the string writer created in the {@link createOutput()} method. + * Get the schema from the string writer. * * @return the schema generated by JAXB */ diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/package-info.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/package-info.java index 8c76c5fc8..23968c9aa 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/package-info.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/package-info.java @@ -19,10 +19,11 @@ */ /** - * Provides the base definition of an APEX model. It also defines the Model Service, the mechanism that allows access to the - * model for APEX concepts anywhere in the system. + * Provides the base definition of an APEX model. It also defines the Model Service, the mechanism that allows access to + * the model for APEX concepts anywhere in the system. * - * It also provides handling support to models, allowing them to be read and written to file and databases in JSON and XML format. + * It also provides handling support to models, allowing them to be read and written to file and databases in JSON and + * XML format. * * @author Liam Fallon (liam.fallon@ericsson.com) */ diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/ModelService.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/ModelService.java index d1ecc6031..1e922b89a 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/ModelService.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/ModelService.java @@ -29,11 +29,13 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxConcept; /** * The model service makes Apex models available to all classes in a JVM. * - * The reason for having a model service is to avoid having to pass concept and model definitions down long call chains in modules such as the Apex engine and - * editor. The model service makes the model and concept definitions available statically. + * <p>The reason for having a model service is to avoid having to pass concept and model definitions down long call + * chains in modules such as the Apex engine and editor. The model service makes the model and concept definitions + * available statically. * - * Note that the use of the model service means that only a single Apex model of a particular type may exist in Apex (particularly the engine) at any time. Of - * course the model in a JVM can be changed at any time provided all users of the model are stopped and restrted in an orderly manner. + * <p>Note that the use of the model service means that only a single Apex model of a particular type may exist in + * Apex (particularly the engine) at any time. Of course the model in a JVM can be changed at any time provided all + * users of the model are stopped and restarted in an orderly manner. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -80,7 +82,8 @@ public abstract class ModelService { final M model = (M) modelMap.get(modelClass); if (model == null) { - throw new ApexRuntimeException("Model for " + modelClass.getCanonicalName() + " not found in model service"); + throw new ApexRuntimeException( + "Model for " + modelClass.getCanonicalName() + " not found in model service"); } return model; diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModel.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModel.java index 356afd723..81b3373e1 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModel.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModel.java @@ -30,7 +30,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxModel; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.basicmodel.dao.ApexDao; import org.onap.policy.apex.model.basicmodel.dao.ApexDaoFactory; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.handling.ApexModelFileWriter; import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader; import org.onap.policy.apex.model.basicmodel.handling.ApexModelWriter; @@ -39,19 +39,19 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * This class tests reading and writing of Apex models to file and to a database using JPA. It also tests validation of Apex models. This class is designed for - * use in unit tests in modules that define Apex models. + * This class tests reading and writing of Apex models to file and to a database using JPA. It also tests validation of + * Apex models. This class is designed for use in unit tests in modules that define Apex models. * * @author Liam Fallon (liam.fallon@ericsson.com) * @param <M> the generic type */ public class TestApexModel<M extends AxModel> { private static final String MODEL_IS_INVALID = "model is invalid "; - private static final String ERROR_PROCESSING_FILE = "error processing file "; - private static final String TEST_MODEL_DOES_NOT_EQUAL_MODEL_READ_FROM_XML_FILE = "test model does not equal model read from XML file "; - private static final String ERROR_CREATING_TEMPORARY_FILE_FOR_APEX_MODEL = "error creating temporary file for Apex model"; + private static final String ERROR_PROCESSING_FILE = "error processing file "; + private static final String TEST_MODEL_UNEQUAL_STR = "test model does not equal model read from XML file "; + private static final String TEMP_FILE_CREATE_ERR_STR = "error creating temporary file for Apex model"; - private static final XLogger LOGGER = XLoggerFactory.getXLogger(TestApexModel.class); + private static final XLogger LOGGER = XLoggerFactory.getXLogger(TestApexModel.class); // The root model class that specifies the root to import and export from private final Class<M> rootModelClass; @@ -60,8 +60,8 @@ public class TestApexModel<M extends AxModel> { private TestApexModelCreator<M> modelCreator = null; /** - * Constructor, defines the subclass of {@link AxModel} that is being tested and the {@link TestApexModelCreator} object that is used to generate Apex - * models. + * Constructor, defines the subclass of {@link AxModel} that is being tested and the {@link TestApexModelCreator} + * object that is used to generate Apex models. * * @param rootModelClass the Apex model class, a sub class of {@link AxModel} * @param modelCreator the @link TestApexModelCreator} that will generate Apex models of various types for testing @@ -85,36 +85,34 @@ public class TestApexModel<M extends AxModel> { * * @throws ApexException on write/read errors */ - public final void testApexModelWriteReadXML() throws ApexException { + public final void testApexModelWriteReadXml() throws ApexException { LOGGER.debug("running testApexModelWriteReadXML . . ."); final M model = modelCreator.getModel(); // Write the file to disk File xmlFile; - + try { xmlFile = File.createTempFile("ApexModel", ".xml"); xmlFile.deleteOnExit(); + } catch (final Exception e) { + LOGGER.warn(TEMP_FILE_CREATE_ERR_STR, e); + throw new ApexException(TEMP_FILE_CREATE_ERR_STR, e); } - catch (final Exception e) { - LOGGER.warn(ERROR_CREATING_TEMPORARY_FILE_FOR_APEX_MODEL, e); - throw new ApexException(ERROR_CREATING_TEMPORARY_FILE_FOR_APEX_MODEL, e); - } - new ApexModelFileWriter<M>(true).apexModelWriteXMLFile(model, rootModelClass, xmlFile.getPath()); + new ApexModelFileWriter<M>(true).apexModelWriteXmlFile(model, rootModelClass, xmlFile.getPath()); // Read the file from disk final ApexModelReader<M> modelReader = new ApexModelReader<>(rootModelClass); try { - final URL apexModelURL = ResourceUtils.getLocalFile(xmlFile.getAbsolutePath()); - final M fileModel = modelReader.read(apexModelURL.openStream()); + final URL apexModelUrl = ResourceUtils.getLocalFile(xmlFile.getAbsolutePath()); + final M fileModel = modelReader.read(apexModelUrl.openStream()); if (!model.equals(fileModel)) { - LOGGER.warn(TEST_MODEL_DOES_NOT_EQUAL_MODEL_READ_FROM_XML_FILE + xmlFile.getAbsolutePath()); - throw new ApexException(TEST_MODEL_DOES_NOT_EQUAL_MODEL_READ_FROM_XML_FILE + xmlFile.getAbsolutePath()); + LOGGER.warn(TEST_MODEL_UNEQUAL_STR + xmlFile.getAbsolutePath()); + throw new ApexException(TEST_MODEL_UNEQUAL_STR + xmlFile.getAbsolutePath()); } - } - catch (final Exception e) { + } catch (final Exception e) { LOGGER.warn(ERROR_PROCESSING_FILE + xmlFile.getAbsolutePath(), e); throw new ApexException(ERROR_PROCESSING_FILE + xmlFile.getAbsolutePath(), e); } @@ -141,7 +139,7 @@ public class TestApexModel<M extends AxModel> { * * @throws ApexException on write/read errors */ - public final void testApexModelWriteReadJSON() throws ApexException { + public final void testApexModelWriteReadJson() throws ApexException { LOGGER.debug("running testApexModelWriteReadJSON . . ."); final M model = modelCreator.getModel(); @@ -151,25 +149,24 @@ public class TestApexModel<M extends AxModel> { try { jsonFile = File.createTempFile("ApexModel", ".xml"); jsonFile.deleteOnExit(); + } catch (final Exception e) { + LOGGER.warn(TEMP_FILE_CREATE_ERR_STR, e); + throw new ApexException(TEMP_FILE_CREATE_ERR_STR, e); } - catch (final Exception e) { - LOGGER.warn(ERROR_CREATING_TEMPORARY_FILE_FOR_APEX_MODEL, e); - throw new ApexException(ERROR_CREATING_TEMPORARY_FILE_FOR_APEX_MODEL, e); - } - new ApexModelFileWriter<M>(true).apexModelWriteJSONFile(model, rootModelClass, jsonFile.getPath()); + new ApexModelFileWriter<M>(true).apexModelWriteJsonFile(model, rootModelClass, jsonFile.getPath()); // Read the file from disk final ApexModelReader<M> modelReader = new ApexModelReader<>(rootModelClass); try { - final URL apexModelURL = ResourceUtils.getLocalFile(jsonFile.getAbsolutePath()); - final M fileModel = modelReader.read(apexModelURL.openStream()); + final URL apexModelUrl = ResourceUtils.getLocalFile(jsonFile.getAbsolutePath()); + final M fileModel = modelReader.read(apexModelUrl.openStream()); if (!model.equals(fileModel)) { - LOGGER.warn(TEST_MODEL_DOES_NOT_EQUAL_MODEL_READ_FROM_XML_FILE + jsonFile.getAbsolutePath()); - throw new ApexException(TEST_MODEL_DOES_NOT_EQUAL_MODEL_READ_FROM_XML_FILE + jsonFile.getAbsolutePath()); + LOGGER.warn(TEST_MODEL_UNEQUAL_STR + jsonFile.getAbsolutePath()); + throw new ApexException( + TEST_MODEL_UNEQUAL_STR + jsonFile.getAbsolutePath()); } - } - catch (final Exception e) { + } catch (final Exception e) { LOGGER.warn(ERROR_PROCESSING_FILE + jsonFile.getAbsolutePath(), e); throw new ApexException(ERROR_PROCESSING_FILE + jsonFile.getAbsolutePath(), e); } @@ -195,7 +192,7 @@ public class TestApexModel<M extends AxModel> { * @param daoParameters the DAO parameters to use for JPA/JDBC * @throws ApexException thrown on errors writing or reading the model to database */ - public final void testApexModelWriteReadJPA(final DAOParameters daoParameters) throws ApexException { + public final void testApexModelWriteReadJpa(final DaoParameters daoParameters) throws ApexException { LOGGER.debug("running testApexModelWriteReadJPA . . ."); final M model = modelCreator.getModel(); @@ -204,10 +201,10 @@ public class TestApexModel<M extends AxModel> { apexDao.init(daoParameters); apexDao.create(model); - final M dbJPAModel = apexDao.get(rootModelClass, model.getKey()); + final M dbJpaModel = apexDao.get(rootModelClass, model.getKey()); apexDao.close(); - if (!model.equals(dbJPAModel)) { + if (!model.equals(dbJpaModel)) { LOGGER.warn("test model does not equal model written and read using generic JPA"); throw new ApexException("test model does not equal model written and read using generic JPA"); } diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModelCreator.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModelCreator.java index 980748926..65441a33c 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModelCreator.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModelCreator.java @@ -24,8 +24,8 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxModel; import org.onap.policy.apex.model.basicmodel.handling.ApexModelCreator; /** - * The Interface TestApexModelCreator is used to create models for Apex model tests. It is mainly used by unit tests for Apex domain models so that - * developers can write test Java programs to create models. + * The Interface TestApexModelCreator is used to create models for Apex model tests. It is mainly used by unit tests for + * Apex domain models so that developers can write test Java programs to create models. * * @author Liam Fallon (liam.fallon@ericsson.com) * @param <M> the generic type diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyTest.java index 6ac46b14e..ea09cc69d 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyTest.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyTest.java @@ -29,91 +29,99 @@ import static org.junit.Assert.fail; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxKey; +import org.onap.policy.apex.model.basicmodel.concepts.AxKey.Compatibility; import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; -import org.onap.policy.apex.model.basicmodel.concepts.AxKey.Compatibility; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class AxKeyTest { @Test public void testArtifactKey() { - AxArtifactKey aKey0 = new AxArtifactKey(); - AxArtifactKey aKey1 = new AxArtifactKey("name", "0.0.1"); - AxArtifactKey aKey2 = new AxArtifactKey(aKey1); - AxArtifactKey aKey3 = new AxArtifactKey(aKey1.getID()); - AxArtifactKey aKey4 = new AxArtifactKey(aKey1); - AxArtifactKey aKey5 = new AxArtifactKey(aKey1); - AxArtifactKey aKey6 = new AxArtifactKey(aKey1); - try { new AxArtifactKey("some bad key id"); fail("This test should throw an exception"); + } catch (IllegalArgumentException e) { + assertEquals("parameter \"id\": value \"some bad key id\", " + + "does not match regular expression \"[A-Za-z0-9\\-_\\.]+:[0-9].[0-9].[0-9]\"", + e.getMessage()); } - catch (IllegalArgumentException e) { - assertEquals("parameter \"id\": value \"some bad key id\", does not match regular expression \"[A-Za-z0-9\\-_\\.]+:[0-9].[0-9].[0-9]\"", e.getMessage()); - } - - assertEquals(AxArtifactKey.getNullKey(), aKey0); - assertEquals(aKey1, aKey2); - assertEquals(aKey1, aKey3); - - assertEquals(aKey2, aKey1.getKey()); - assertEquals(1, aKey1.getKeys().size()); - - aKey0.setName("zero"); - aKey0.setVersion("0.0.2"); - aKey3.setVersion("0.0.2"); - aKey4.setVersion("0.1.2"); - aKey5.setVersion("1.2.2"); - aKey6.setVersion("3"); - - assertEquals(Compatibility.DIFFERENT, aKey0.getCompatibility(new AxReferenceKey())); - assertEquals(Compatibility.DIFFERENT, aKey0.getCompatibility(aKey1)); - assertEquals(Compatibility.IDENTICAL, aKey2.getCompatibility(aKey1)); - assertEquals(Compatibility.PATCH, aKey3.getCompatibility(aKey1)); - assertEquals(Compatibility.MINOR, aKey4.getCompatibility(aKey1)); - assertEquals(Compatibility.MAJOR, aKey5.getCompatibility(aKey1)); - assertEquals(Compatibility.MAJOR, aKey6.getCompatibility(aKey1)); - - assertTrue(aKey1.isCompatible(aKey2)); - assertTrue(aKey1.isCompatible(aKey3)); - assertTrue(aKey1.isCompatible(aKey4)); - assertFalse(aKey1.isCompatible(aKey0)); - assertFalse(aKey1.isCompatible(aKey5)); - assertFalse(aKey1.isCompatible(new AxReferenceKey())); - - assertEquals(AxValidationResult.ValidationResult.VALID, aKey0.validate(new AxValidationResult()).getValidationResult()); - assertEquals(AxValidationResult.ValidationResult.VALID, aKey1.validate(new AxValidationResult()).getValidationResult()); - assertEquals(AxValidationResult.ValidationResult.VALID, aKey2.validate(new AxValidationResult()).getValidationResult()); - assertEquals(AxValidationResult.ValidationResult.VALID, aKey3.validate(new AxValidationResult()).getValidationResult()); - assertEquals(AxValidationResult.ValidationResult.VALID, aKey4.validate(new AxValidationResult()).getValidationResult()); - assertEquals(AxValidationResult.ValidationResult.VALID, aKey5.validate(new AxValidationResult()).getValidationResult()); - assertEquals(AxValidationResult.ValidationResult.VALID, aKey6.validate(new AxValidationResult()).getValidationResult()); - - aKey0.clean(); - assertNotNull(aKey0.toString()); - - AxArtifactKey aKey7 = new AxArtifactKey(aKey1); - assertEquals(150332875, aKey7.hashCode()); - assertEquals(0, aKey7.compareTo(aKey1)); - assertEquals(-12, aKey7.compareTo(aKey0)); - + + AxArtifactKey someKey0 = new AxArtifactKey(); + assertEquals(AxArtifactKey.getNullKey(), someKey0); + + AxArtifactKey someKey1 = new AxArtifactKey("name", "0.0.1"); + AxArtifactKey someKey2 = new AxArtifactKey(someKey1); + AxArtifactKey someKey3 = new AxArtifactKey(someKey1.getId()); + assertEquals(someKey1, someKey2); + assertEquals(someKey1, someKey3); + + assertEquals(someKey2, someKey1.getKey()); + assertEquals(1, someKey1.getKeys().size()); + + someKey0.setName("zero"); + someKey0.setVersion("0.0.2"); + + someKey3.setVersion("0.0.2"); + + AxArtifactKey someKey4 = new AxArtifactKey(someKey1); + someKey4.setVersion("0.1.2"); + + AxArtifactKey someKey5 = new AxArtifactKey(someKey1); + someKey5.setVersion("1.2.2"); + + AxArtifactKey someKey6 = new AxArtifactKey(someKey1); + someKey6.setVersion("3"); + + assertEquals(Compatibility.DIFFERENT, someKey0.getCompatibility(new AxReferenceKey())); + assertEquals(Compatibility.DIFFERENT, someKey0.getCompatibility(someKey1)); + assertEquals(Compatibility.IDENTICAL, someKey2.getCompatibility(someKey1)); + assertEquals(Compatibility.PATCH, someKey3.getCompatibility(someKey1)); + assertEquals(Compatibility.MINOR, someKey4.getCompatibility(someKey1)); + assertEquals(Compatibility.MAJOR, someKey5.getCompatibility(someKey1)); + assertEquals(Compatibility.MAJOR, someKey6.getCompatibility(someKey1)); + + assertTrue(someKey1.isCompatible(someKey2)); + assertTrue(someKey1.isCompatible(someKey3)); + assertTrue(someKey1.isCompatible(someKey4)); + assertFalse(someKey1.isCompatible(someKey0)); + assertFalse(someKey1.isCompatible(someKey5)); + assertFalse(someKey1.isCompatible(new AxReferenceKey())); + + assertEquals(AxValidationResult.ValidationResult.VALID, + someKey0.validate(new AxValidationResult()).getValidationResult()); + assertEquals(AxValidationResult.ValidationResult.VALID, + someKey1.validate(new AxValidationResult()).getValidationResult()); + assertEquals(AxValidationResult.ValidationResult.VALID, + someKey2.validate(new AxValidationResult()).getValidationResult()); + assertEquals(AxValidationResult.ValidationResult.VALID, + someKey3.validate(new AxValidationResult()).getValidationResult()); + assertEquals(AxValidationResult.ValidationResult.VALID, + someKey4.validate(new AxValidationResult()).getValidationResult()); + assertEquals(AxValidationResult.ValidationResult.VALID, + someKey5.validate(new AxValidationResult()).getValidationResult()); + assertEquals(AxValidationResult.ValidationResult.VALID, + someKey6.validate(new AxValidationResult()).getValidationResult()); + + someKey0.clean(); + assertNotNull(someKey0.toString()); + + AxArtifactKey someKey7 = new AxArtifactKey(someKey1); + assertEquals(150332875, someKey7.hashCode()); + assertEquals(0, someKey7.compareTo(someKey1)); + assertEquals(-12, someKey7.compareTo(someKey0)); + try { - aKey0.compareTo(null); - } - catch (IllegalArgumentException e) { + someKey0.compareTo(null); + } catch (IllegalArgumentException e) { assertEquals("comparison object may not be null", e.getMessage()); } - - assertEquals(0, aKey0.compareTo(aKey0)); - assertEquals(353602977, aKey0.compareTo(new AxReferenceKey())); - - assertFalse(aKey0.equals(null)); - assertTrue(aKey0.equals(aKey0)); - assertFalse(((AxKey)aKey0).equals(new AxReferenceKey())); + + assertEquals(0, someKey0.compareTo(someKey0)); + assertEquals(353602977, someKey0.compareTo(new AxReferenceKey())); + + assertFalse(someKey0.equals(null)); + assertTrue(someKey0.equals(someKey0)); + assertFalse(((AxKey) someKey0).equals(new AxReferenceKey())); } } diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxKeyInfo.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxKeyInfo.java index 8368634bf..f615d9db9 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxKeyInfo.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxKeyInfo.java @@ -33,9 +33,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class TestAxKeyInfo { @Test @@ -46,23 +43,24 @@ public class TestAxKeyInfo { AxKeyInfo testKeyInfo = new AxKeyInfo(); testKeyInfo.setKey((new AxArtifactKey("PN", "0.0.1"))); - assertEquals("PN:0.0.1", testKeyInfo.getKey().getID()); + assertEquals("PN:0.0.1", testKeyInfo.getKey().getId()); AxArtifactKey key = new AxArtifactKey("key", "0.0.1"); testKeyInfo.setKey(key); assertEquals(key, testKeyInfo.getKey()); - + UUID uuid = UUID.randomUUID(); testKeyInfo.setUuid(uuid); - assertEquals(uuid, testKeyInfo.getUUID()); + assertEquals(uuid, testKeyInfo.getUuid()); testKeyInfo.setDescription("Key Description"); assertEquals("Key Description", testKeyInfo.getDescription()); - + AxKeyInfo clonedReferenceKey = new AxKeyInfo(testKeyInfo); - assertTrue(clonedReferenceKey.toString().startsWith("AxKeyInfo:(artifactId=AxArtifactKey:(name=key,version=0.0.1),uuid=")); - + assertTrue(clonedReferenceKey.toString() + .startsWith("AxKeyInfo:(artifactId=AxArtifactKey:(name=key,version=0.0.1),uuid=")); + assertFalse(testKeyInfo.hashCode() == 0); - + assertTrue(testKeyInfo.equals(testKeyInfo)); assertTrue(testKeyInfo.equals(clonedReferenceKey)); assertFalse(testKeyInfo.equals(null)); @@ -71,7 +69,7 @@ public class TestAxKeyInfo { assertFalse(testKeyInfo.equals(new AxKeyInfo(key, UUID.randomUUID(), "Some Description"))); assertFalse(testKeyInfo.equals(new AxKeyInfo(key, uuid, "Some Description"))); assertTrue(testKeyInfo.equals(new AxKeyInfo(key, uuid, "Key Description"))); - + assertEquals(0, testKeyInfo.compareTo(testKeyInfo)); assertEquals(0, testKeyInfo.compareTo(clonedReferenceKey)); assertNotEquals(0, testKeyInfo.compareTo(null)); @@ -80,28 +78,28 @@ public class TestAxKeyInfo { assertNotEquals(0, testKeyInfo.compareTo(new AxKeyInfo(key, UUID.randomUUID(), "Some Description"))); assertNotEquals(0, testKeyInfo.compareTo(new AxKeyInfo(key, uuid, "Some Description"))); assertEquals(0, testKeyInfo.compareTo(new AxKeyInfo(key, uuid, "Key Description"))); - + assertNotNull(testKeyInfo.getKeys()); - + AxValidationResult result = new AxValidationResult(); result = testKeyInfo.validate(result); assertEquals(AxValidationResult.ValidationResult.VALID, result.getValidationResult()); - + testKeyInfo.setDescription(""); result = testKeyInfo.validate(result); assertEquals(AxValidationResult.ValidationResult.OBSERVATION, result.getValidationResult()); - + testKeyInfo.setUuid(new UUID(0, 0)); result = testKeyInfo.validate(result); assertEquals(AxValidationResult.ValidationResult.WARNING, result.getValidationResult()); - + testKeyInfo.setKey(AxArtifactKey.getNullKey()); result = testKeyInfo.validate(result); assertEquals(AxValidationResult.ValidationResult.INVALID, result.getValidationResult()); - - assertNotNull(AxKeyInfo.generateReproducibleUUID(null)); - assertNotNull(AxKeyInfo.generateReproducibleUUID("SeedString")); - + + assertNotNull(AxKeyInfo.generateReproducibleUuid(null)); + assertNotNull(AxKeyInfo.generateReproducibleUuid("SeedString")); + testKeyInfo.clean(); assertNotNull(testKeyInfo); } diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxReferenceKey.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxReferenceKey.java index dbc925d66..79f3984c3 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxReferenceKey.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxReferenceKey.java @@ -32,9 +32,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxKey; import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class TestAxReferenceKey { @Test @@ -49,46 +46,47 @@ public class TestAxReferenceKey { assertNotNull(new AxReferenceKey("ParentKeyName", "0.0.1", "ParentLocalName", "LocalName")); assertNotNull(new AxReferenceKey("ParentKeyName:0.0.1:ParentLocalName:LocalName")); assertEquals(AxReferenceKey.getNullKey().getKey(), AxReferenceKey.getNullKey()); - assertEquals("NULL:0.0.0:NULL:NULL", AxReferenceKey.getNullKey().getID()); + assertEquals("NULL:0.0.0:NULL:NULL", AxReferenceKey.getNullKey().getId()); AxReferenceKey testReferenceKey = new AxReferenceKey(); testReferenceKey.setParentArtifactKey(new AxArtifactKey("PN", "0.0.1")); - assertEquals("PN:0.0.1", testReferenceKey.getParentArtifactKey().getID()); - + assertEquals("PN:0.0.1", testReferenceKey.getParentArtifactKey().getId()); + testReferenceKey.setParentReferenceKey(new AxReferenceKey("PN", "0.0.1", "LN")); - assertEquals("PN:0.0.1:NULL:LN", testReferenceKey.getParentReferenceKey().getID()); - + assertEquals("PN:0.0.1:NULL:LN", testReferenceKey.getParentReferenceKey().getId()); + testReferenceKey.setParentKeyName("NPKN"); assertEquals("NPKN", testReferenceKey.getParentKeyName()); - + testReferenceKey.setParentKeyVersion("0.0.1"); assertEquals("0.0.1", testReferenceKey.getParentKeyVersion()); - + testReferenceKey.setParentLocalName("NPKLN"); assertEquals("NPKLN", testReferenceKey.getParentLocalName()); - + testReferenceKey.setLocalName("NLN"); assertEquals("NLN", testReferenceKey.getLocalName()); - + assertFalse(testReferenceKey.isCompatible(AxArtifactKey.getNullKey())); assertFalse(testReferenceKey.isCompatible(AxReferenceKey.getNullKey())); assertTrue(testReferenceKey.isCompatible(testReferenceKey)); - + assertEquals(AxKey.Compatibility.DIFFERENT, testReferenceKey.getCompatibility(AxArtifactKey.getNullKey())); assertEquals(AxKey.Compatibility.DIFFERENT, testReferenceKey.getCompatibility(AxReferenceKey.getNullKey())); assertEquals(AxKey.Compatibility.IDENTICAL, testReferenceKey.getCompatibility(testReferenceKey)); - + AxValidationResult result = new AxValidationResult(); result = testReferenceKey.validate(result); assertEquals(AxValidationResult.ValidationResult.VALID, result.getValidationResult()); - + testReferenceKey.clean(); - + AxReferenceKey clonedReferenceKey = new AxReferenceKey(testReferenceKey); - assertEquals("AxReferenceKey:(parentKeyName=NPKN,parentKeyVersion=0.0.1,parentLocalName=NPKLN,localName=NLN)", clonedReferenceKey.toString()); - + assertEquals("AxReferenceKey:(parentKeyName=NPKN,parentKeyVersion=0.0.1,parentLocalName=NPKLN,localName=NLN)", + clonedReferenceKey.toString()); + assertFalse(testReferenceKey.hashCode() == 0); - + assertTrue(testReferenceKey.equals(testReferenceKey)); assertTrue(testReferenceKey.equals(clonedReferenceKey)); assertFalse(testReferenceKey.equals("Hello")); @@ -97,7 +95,7 @@ public class TestAxReferenceKey { assertFalse(testReferenceKey.equals(new AxReferenceKey("NPKN", "0.0.1", "PLN", "LN"))); assertFalse(testReferenceKey.equals(new AxReferenceKey("NPKN", "0.0.1", "NPLN", "LN"))); assertTrue(testReferenceKey.equals(new AxReferenceKey("NPKN", "0.0.1", "NPKLN", "NLN"))); - + assertEquals(0, testReferenceKey.compareTo(testReferenceKey)); assertEquals(0, testReferenceKey.compareTo(clonedReferenceKey)); assertNotEquals(0, testReferenceKey.compareTo(new AxArtifactKey())); @@ -106,7 +104,7 @@ public class TestAxReferenceKey { assertNotEquals(0, testReferenceKey.compareTo(new AxReferenceKey("NPKN", "0.0.1", "PLN", "LN"))); assertNotEquals(0, testReferenceKey.compareTo(new AxReferenceKey("NPKN", "0.0.1", "NPLN", "LN"))); assertEquals(0, testReferenceKey.compareTo(new AxReferenceKey("NPKN", "0.0.1", "NPKLN", "NLN"))); - + assertNotNull(testReferenceKey.getKeys()); } } diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestEntity.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestEntity.java index 6ba380bb8..2667f3d4d 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestEntity.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestEntity.java @@ -47,22 +47,22 @@ public class TestEntity extends AxConcept { protected AxReferenceKey key; private double doubleValue; - + public TestEntity() { this.key = new AxReferenceKey(); this.doubleValue = 0; } - + public TestEntity(Double doubleValue) { this.key = new AxReferenceKey(); this.doubleValue = doubleValue; } - + public TestEntity(AxReferenceKey key, Double doubleValue) { this.key = key; this.doubleValue = doubleValue; } - + public AxReferenceKey getKey() { return key; } @@ -96,7 +96,7 @@ public class TestEntity extends AxConcept { public void clean() { key.clean(); } - + @Override public String toString() { final StringBuilder builder = new StringBuilder(); @@ -107,20 +107,18 @@ public class TestEntity extends AxConcept { @Override public AxConcept copyTo(AxConcept target) { - final Object copyObject = ((target == null) ? new TestEntity(): target); + final Object copyObject = ((target == null) ? new TestEntity() : target); if (copyObject instanceof TestEntity) { final TestEntity copy = ((TestEntity) copyObject); if (this.checkSetKey()) { copy.setKey(new AxReferenceKey(key)); - } - else { + } else { copy.key = null; } copy.doubleValue = doubleValue; return copy; - } - else { - return null; + } else { + return null; } } @@ -134,42 +132,49 @@ public class TestEntity extends AxConcept { @Override public boolean equals(Object obj) { - if (obj == null) + if (obj == null) { return false; - if (this == obj) + } + if (this == obj) { return true; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } TestEntity other = (TestEntity) obj; if (key == null) { - if (other.key != null) + if (other.key != null) { return false; + } + } else if (!key.equals(other.key)) { + return false; + } + if (doubleValue != other.doubleValue) { + return false; } - else - if (!key.equals(other.key)) - return false; - if (doubleValue != other.doubleValue) - return false; return true; } - + @Override public int compareTo(AxConcept otherObj) { - if (otherObj == null) + if (otherObj == null) { return -1; - if (this == otherObj) + } + if (this == otherObj) { return 0; + } TestEntity other = (TestEntity) otherObj; if (key == null) { - if (other.key != null) + if (other.key != null) { return 1; + } + } else if (!key.equals(other.key)) { + return key.compareTo(other.key); } - else - if (!key.equals(other.key)) - return key.compareTo(other.key); - if (doubleValue != other.doubleValue) + if (doubleValue != other.doubleValue) { return new Double(doubleValue).compareTo(other.doubleValue); - + } + return 0; } } diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestExceptions.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestExceptions.java index 1fc5209b0..7a980d5f6 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestExceptions.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestExceptions.java @@ -31,9 +31,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class TestExceptions { @Test @@ -42,29 +39,32 @@ public class TestExceptions { assertNotNull(new ApexException("Message", new AxArtifactKey())); assertNotNull(new ApexException("Message", new IOException())); assertNotNull(new ApexException("Message", new IOException(), new AxArtifactKey())); - + AxArtifactKey key = new AxArtifactKey(); ApexException ae = new ApexException("Message", new IOException("IO exception message"), key); assertEquals("Message\ncaused by: Message\ncaused by: IO exception message", ae.getCascadedMessage()); assertEquals(key, ae.getObject()); - + assertNotNull(new ApexRuntimeException("Message")); assertNotNull(new ApexRuntimeException("Message", new AxArtifactKey())); assertNotNull(new ApexRuntimeException("Message", new IOException())); assertNotNull(new ApexRuntimeException("Message", new IOException(), new AxArtifactKey())); - - AxArtifactKey rKey = new AxArtifactKey(); - ApexRuntimeException re = new ApexRuntimeException("Runtime Message", new IOException("IO runtime exception message"), rKey); - assertEquals("Runtime Message\ncaused by: Runtime Message\ncaused by: IO runtime exception message", re.getCascadedMessage()); + + AxArtifactKey rkey = new AxArtifactKey(); + ApexRuntimeException re = new ApexRuntimeException("Runtime Message", + new IOException("IO runtime exception message"), rkey); + assertEquals("Runtime Message\ncaused by: Runtime Message\ncaused by: IO runtime exception message", + re.getCascadedMessage()); assertEquals(key, re.getObject()); - + assertNotNull(new ApexConceptException("Message")); assertNotNull(new ApexConceptException("Message", new IOException())); - - AxArtifactKey cKey = new AxArtifactKey(); - ApexException ace = new ApexException("Concept Message", new IOException("IO concept exception message"), cKey); - assertEquals("Concept Message\ncaused by: Concept Message\ncaused by: IO concept exception message", ace.getCascadedMessage()); - assertEquals(cKey, ace.getObject()); + + AxArtifactKey ckey = new AxArtifactKey(); + ApexException ace = new ApexException("Concept Message", new IOException("IO concept exception message"), ckey); + assertEquals("Concept Message\ncaused by: Concept Message\ncaused by: IO concept exception message", + ace.getCascadedMessage()); + assertEquals(ckey, ace.getObject()); } } diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/testKeyUse.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestKeyUse.java index 10706f36a..6b5346971 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/testKeyUse.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestKeyUse.java @@ -28,12 +28,12 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; +import org.onap.policy.apex.model.basicmodel.concepts.AxKey.Compatibility; import org.onap.policy.apex.model.basicmodel.concepts.AxKeyUse; import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; -import org.onap.policy.apex.model.basicmodel.concepts.AxKey.Compatibility; -public class testKeyUse { +public class TestKeyUse { @Test public void test() { @@ -45,7 +45,7 @@ public class testKeyUse { AxKeyUse keyUse = new AxKeyUse(); keyUse.setKey(key); assertEquals(key, keyUse.getKey()); - assertEquals("Key:0.0.1", keyUse.getID()); + assertEquals("Key:0.0.1", keyUse.getId()); assertEquals(key, keyUse.getKeys().get(0)); assertEquals(Compatibility.IDENTICAL, keyUse.getCompatibility(key)); diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestValidation.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestValidation.java index 93eb78b7c..cfa4d0ded 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestValidation.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestValidation.java @@ -32,9 +32,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class TestValidation { @Test @@ -42,49 +39,53 @@ public class TestValidation { AxValidationResult result = new AxValidationResult(); AxReferenceKey refKey = new AxReferenceKey("PK", "0.0.1", "PLN", "LN"); result = refKey.validate(result); - + assertNotNull(result); - assertTrue(result.isOK()); + assertTrue(result.isOk()); assertTrue(result.isValid()); assertEquals(AxValidationResult.ValidationResult.VALID, result.getValidationResult()); assertNotNull(result.getMessageList()); - - AxValidationMessage vMess0 = new AxValidationMessage(AxArtifactKey.getNullKey(), AxArtifactKey.class, ValidationResult.VALID, "Some message"); - result.addValidationMessage(vMess0); - - assertTrue(result.isOK()); + + AxValidationMessage vmess0 = new AxValidationMessage(AxArtifactKey.getNullKey(), AxArtifactKey.class, + ValidationResult.VALID, "Some message"); + result.addValidationMessage(vmess0); + + assertTrue(result.isOk()); assertTrue(result.isValid()); assertEquals(AxValidationResult.ValidationResult.VALID, result.getValidationResult()); assertNotNull(result.getMessageList()); assertNotNull("hello", result.toString()); - - AxValidationMessage vMess1 = new AxValidationMessage(AxArtifactKey.getNullKey(), AxArtifactKey.class, ValidationResult.OBSERVATION, "Some message"); - result.addValidationMessage(vMess1); - - assertTrue(result.isOK()); + + AxValidationMessage vmess1 = new AxValidationMessage(AxArtifactKey.getNullKey(), AxArtifactKey.class, + ValidationResult.OBSERVATION, "Some message"); + result.addValidationMessage(vmess1); + + assertTrue(result.isOk()); assertTrue(result.isValid()); assertEquals(AxValidationResult.ValidationResult.OBSERVATION, result.getValidationResult()); assertNotNull(result.getMessageList()); assertNotNull("hello", result.toString()); - - AxValidationMessage vMess2 = new AxValidationMessage(AxArtifactKey.getNullKey(), AxArtifactKey.class, ValidationResult.WARNING, "Some message"); - result.addValidationMessage(vMess2); - - assertFalse(result.isOK()); + + AxValidationMessage vmess2 = new AxValidationMessage(AxArtifactKey.getNullKey(), AxArtifactKey.class, + ValidationResult.WARNING, "Some message"); + result.addValidationMessage(vmess2); + + assertFalse(result.isOk()); assertTrue(result.isValid()); assertEquals(AxValidationResult.ValidationResult.WARNING, result.getValidationResult()); assertNotNull(result.getMessageList()); assertNotNull("hello", result.toString()); - - AxValidationMessage vMess3 = new AxValidationMessage(AxArtifactKey.getNullKey(), AxArtifactKey.class, ValidationResult.INVALID, "Some message"); - result.addValidationMessage(vMess3); - - assertFalse(result.isOK()); + + AxValidationMessage vmess3 = new AxValidationMessage(AxArtifactKey.getNullKey(), AxArtifactKey.class, + ValidationResult.INVALID, "Some message"); + result.addValidationMessage(vmess3); + + assertFalse(result.isOk()); assertFalse(result.isValid()); assertEquals(AxValidationResult.ValidationResult.INVALID, result.getValidationResult()); assertNotNull(result.getMessageList()); assertNotNull("hello", result.toString()); - + assertEquals(AxValidationResult.ValidationResult.INVALID, result.getMessageList().get(3).getValidationResult()); assertEquals("Some message", result.getMessageList().get(3).getMessage()); assertEquals(AxArtifactKey.class.getCanonicalName(), result.getMessageList().get(3).getObservedClass()); diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java index e5d597375..4c99ce314 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java @@ -45,7 +45,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; import org.onap.policy.apex.model.basicmodel.concepts.TestEntity; /** - * JUnit test class + * JUnit test class. */ public class EntityTest { private Connection connection; @@ -65,7 +65,7 @@ public class EntityTest { @Test public void testEntityTestSanity() throws ApexException { - final DAOParameters daoParameters = new DAOParameters(); + final DaoParameters daoParameters = new DaoParameters(); apexDao = new ApexDaoFactory().createApexDao(daoParameters); @@ -101,10 +101,10 @@ public class EntityTest { } @Test - public void testEntityTestAllOpsJPA() throws ApexException { - final DAOParameters daoParameters = new DAOParameters(); + public void testEntityTestAllOpsJpa() throws ApexException { + final DaoParameters daoParameters = new DaoParameters(); daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); - daoParameters.setPersistenceUnit("DAOTest"); + daoParameters.setPersistenceUnit("DaoTest"); apexDao = new ApexDaoFactory().createApexDao(daoParameters); apexDao.init(daoParameters); @@ -115,9 +115,9 @@ public class EntityTest { @Test public void testEntityTestBadVals() throws ApexException { - final DAOParameters daoParameters = new DAOParameters(); + final DaoParameters daoParameters = new DaoParameters(); daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); - daoParameters.setPersistenceUnit("DAOTest"); + daoParameters.setPersistenceUnit("DaoTest"); apexDao = new ApexDaoFactory().createApexDao(daoParameters); apexDao.init(daoParameters); @@ -130,12 +130,12 @@ public class EntityTest { final List<AxReferenceKey> emptyRKeyList = new ArrayList<>(); apexDao.create(nullKey); - apexDao.create(nullKeyList); - apexDao.create(emptyKeyList); + apexDao.createCollection(nullKeyList); + apexDao.createCollection(emptyKeyList); apexDao.delete(nullKey); - apexDao.delete(nullKeyList); - apexDao.delete(emptyKeyList); + apexDao.deleteCollection(nullKeyList); + apexDao.deleteCollection(emptyKeyList); apexDao.delete(AxArtifactKey.class, nullKey); apexDao.delete(AxReferenceKey.class, nullRefKey); apexDao.deleteByArtifactKey(AxArtifactKey.class, nullKeyList); @@ -160,12 +160,12 @@ public class EntityTest { final AxArtifactKey aKey0 = new AxArtifactKey("A-KEY0", "0.0.1"); final AxArtifactKey aKey1 = new AxArtifactKey("A-KEY1", "0.0.1"); final AxArtifactKey aKey2 = new AxArtifactKey("A-KEY2", "0.0.1"); - final AxKeyInfo keyInfo0 = - new AxKeyInfo(aKey0, UUID.fromString("00000000-0000-0000-0000-000000000000"), "key description 0"); - final AxKeyInfo keyInfo1 = - new AxKeyInfo(aKey1, UUID.fromString("00000000-0000-0000-0000-000000000001"), "key description 1"); - final AxKeyInfo keyInfo2 = - new AxKeyInfo(aKey2, UUID.fromString("00000000-0000-0000-0000-000000000002"), "key description 2"); + final AxKeyInfo keyInfo0 = new AxKeyInfo(aKey0, UUID.fromString("00000000-0000-0000-0000-000000000000"), + "key description 0"); + final AxKeyInfo keyInfo1 = new AxKeyInfo(aKey1, UUID.fromString("00000000-0000-0000-0000-000000000001"), + "key description 1"); + final AxKeyInfo keyInfo2 = new AxKeyInfo(aKey2, UUID.fromString("00000000-0000-0000-0000-000000000002"), + "key description 2"); apexDao.create(keyInfo0); @@ -185,7 +185,7 @@ public class EntityTest { keyInfoSetIn.add(keyInfo1); keyInfoSetIn.add(keyInfo2); - apexDao.create(keyInfoSetIn); + apexDao.createCollection(keyInfoSetIn); Set<AxKeyInfo> keyInfoSetOut = new TreeSet<AxKeyInfo>(apexDao.getAll(AxKeyInfo.class)); @@ -197,14 +197,14 @@ public class EntityTest { keyInfoSetOut = new TreeSet<AxKeyInfo>(apexDao.getAll(AxKeyInfo.class)); assertTrue(keyInfoSetIn.equals(keyInfoSetOut)); - apexDao.delete(keyInfoSetIn); + apexDao.deleteCollection(keyInfoSetIn); keyInfoSetOut = new TreeSet<AxKeyInfo>(apexDao.getAll(AxKeyInfo.class)); assertEquals(0, keyInfoSetOut.size()); keyInfoSetIn.add(keyInfo0); keyInfoSetIn.add(keyInfo1); keyInfoSetIn.add(keyInfo0); - apexDao.create(keyInfoSetIn); + apexDao.createCollection(keyInfoSetIn); keyInfoSetOut = new TreeSet<AxKeyInfo>(apexDao.getAll(AxKeyInfo.class)); assertTrue(keyInfoSetIn.equals(keyInfoSetOut)); @@ -226,7 +226,7 @@ public class EntityTest { keyInfoSetIn.add(keyInfo0); keyInfoSetIn.add(keyInfo1); keyInfoSetIn.add(keyInfo0); - apexDao.create(keyInfoSetIn); + apexDao.createCollection(keyInfoSetIn); keyInfoSetOut = new TreeSet<AxKeyInfo>(apexDao.getAll(AxKeyInfo.class)); assertTrue(keyInfoSetIn.equals(keyInfoSetOut)); diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/TestDaoMisc.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/TestDaoMisc.java index 9f5b72d39..7966e8d4f 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/TestDaoMisc.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/TestDaoMisc.java @@ -27,28 +27,25 @@ import static org.junit.Assert.fail; import java.util.Properties; import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner; -import org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String; +import org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner; +import org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class TestDaoMisc { @Test - public void testUUID2StringMopUp() { - final UUID2String uuid2String = new UUID2String(); + public void testUuid2StringMopUp() { + final Uuid2String uuid2String = new Uuid2String(); assertEquals("", uuid2String.convertToDatabaseColumn(null)); } @Test public void testCDataConditionerMopUp() { - assertNull(CDATAConditioner.clean(null)); + assertNull(CDataConditioner.clean(null)); } @Test public void testDaoFactory() { - final DAOParameters daoParameters = new DAOParameters(); + final DaoParameters daoParameters = new DaoParameters(); daoParameters.setPluginClass("somewhere.over.the.rainbow"); try { @@ -63,15 +60,14 @@ public class TestDaoMisc { new ApexDaoFactory().createApexDao(daoParameters); fail("test shold throw an exception here"); } catch (final Exception e) { - assertEquals( - "Specified Apex DAO plugin class \"java.lang.String\" does not implement the ApexDao interface", - e.getMessage()); + assertEquals("Specified Apex DAO plugin class \"java.lang.String\" " + + "does not implement the ApexDao interface", e.getMessage()); } } @Test public void testDaoParameters() { - final DAOParameters pars = new DAOParameters(); + final DaoParameters pars = new DaoParameters(); pars.setJdbcProperties(new Properties()); assertEquals(0, pars.getJdbcProperties().size()); @@ -84,8 +80,7 @@ public class TestDaoMisc { pars.setPluginClass("somewhere.over.the.rainbow"); assertEquals("somewhere.over.the.rainbow", pars.getPluginClass()); - assertEquals( - "DAOParameters [pluginClass=somewhere.over.the.rainbow, persistenceUnit=Kansas, jdbcProperties={name=Dorothy}]", - pars.toString()); + assertEquals("DAOParameters [pluginClass=somewhere.over.the.rainbow, " + + "persistenceUnit=Kansas, jdbcProperties={name=Dorothy}]", pars.toString()); } } diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/AxModelWithReferences.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/AxModelWithReferences.java index 38359052b..8e52b393f 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/AxModelWithReferences.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/AxModelWithReferences.java @@ -31,7 +31,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; public class AxModelWithReferences extends AxModel { private static final long serialVersionUID = -8194956638511120008L; - private List<AxKey> extraKeyList = new ArrayList<>(); + private List<AxKey> extrakeyList = new ArrayList<>(); public AxModelWithReferences(final AxArtifactKey key) { super(key); @@ -40,30 +40,33 @@ public class AxModelWithReferences extends AxModel { @Override public List<AxKey> getKeys() { List<AxKey> keys = super.getKeys(); - keys.addAll(extraKeyList); + keys.addAll(extrakeyList); return keys; } - public List<AxKey> getExtraKeyList() { - return extraKeyList; + public List<AxKey> getExtrakeyList() { + return extrakeyList; } + /** + * Set the reference key list. + */ public void setReferenceKeyList() { List<AxKey> keys = super.getKeys(); for (AxKey key: keys) { - AxArtifactKey aKey = (AxArtifactKey)key; - AxReferenceKey keyRef = new AxReferenceKey(aKey, aKey.getName()); - extraKeyList.add(keyRef); + AxArtifactKey akey = (AxArtifactKey)key; + AxReferenceKey keyRef = new AxReferenceKey(akey, akey.getName()); + extrakeyList.add(keyRef); } } - public void addKey(final AxKey aKey) { - extraKeyList.add(aKey); + public void addKey(final AxKey akey) { + extrakeyList.add(akey); } - public void removeKey(final AxKey aKey) { - extraKeyList.remove(aKey); + public void removeKey(final AxKey akey) { + extrakeyList.remove(akey); } } diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModel.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModel.java index d0423eb3a..69942b3df 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModel.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModel.java @@ -33,13 +33,18 @@ import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.concepts.AxModel; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.test.TestApexModel; public class TestApexBasicModel { private Connection connection; TestApexModel<AxModel> testApexModel; + /** + * Set up the test. + * + * @throws Exception any exception thrown by the test + */ @Before public void setup() throws Exception { Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); @@ -88,46 +93,57 @@ public class TestApexBasicModel { } @Test - public void testModelWriteReadXML() throws Exception { - testApexModel.testApexModelWriteReadXML(); + public void testModelWriteReadXml() throws Exception { + testApexModel.testApexModelWriteReadXml(); } @Test - public void testModelWriteReadJSON() throws Exception { - testApexModel.testApexModelWriteReadJSON(); + public void testModelWriteReadJson() throws Exception { + testApexModel.testApexModelWriteReadJson(); } @Test - public void testModelWriteReadJPA() throws Exception { - final DAOParameters daoParameters = new DAOParameters(); + public void testModelWriteReadJpa() throws Exception { + final DaoParameters daoParameters = new DaoParameters(); daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); - daoParameters.setPersistenceUnit("DAOTest"); + daoParameters.setPersistenceUnit("DaoTest"); - testApexModel.testApexModelWriteReadJPA(daoParameters); + testApexModel.testApexModelWriteReadJpa(daoParameters); } // As there are no real concepts in a basic model, this is as near to a valid model as we can get private static final String VALID_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n" - + "AxArtifactKey:(name=FloatKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n" - + "AxArtifactKey:(name=IntegerKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n" - + "********************************"; + + "AxArtifactKey:(name=FloatKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts" + + ".AxModel:WARNING:key not found for key information entry\n" + + "AxArtifactKey:(name=IntegerKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts" + + ".AxModel:WARNING:key not found for key information entry\n" + "********************************"; private static final String WARNING_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n" - + "AxArtifactKey:(name=FloatKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n" - + "AxArtifactKey:(name=IntegerKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n" - + "AxArtifactKey:(name=Unref0,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n" - + "AxArtifactKey:(name=Unref1,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n" - + "********************************"; + + "AxArtifactKey:(name=FloatKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts" + + ".AxModel:WARNING:key not found for key information entry\n" + + "AxArtifactKey:(name=IntegerKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts" + + ".AxModel:WARNING:key not found for key information entry\n" + + "AxArtifactKey:(name=Unref0,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts" + + ".AxModel:WARNING:key not found for key information entry\n" + + "AxArtifactKey:(name=Unref1,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts" + + ".AxModel:WARNING:key not found for key information entry\n" + "********************************"; private static final String INVALID_MODEL_STRING = "\n" + "***validation of model failed***\n" - + "AxArtifactKey:(name=BasicModelKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n" - + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo:OBSERVATION:description is blank\n" - + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n" - + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation:INVALID:duplicate UUID found on keyInfoMap entry AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):00000000-0000-0000-0000-000000000000\n" - + "********************************"; + + "AxArtifactKey:(name=BasicModelKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts." + + "AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n" + + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts." + + "AxKeyInfo:OBSERVATION:description is blank\n" + + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts." + + "AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n" + + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts." + + "AxKeyInformation:INVALID:duplicate UUID found on keyInfoMap entry AxArtifactKey:" + + "(name=KeyInfoMapKey,version=0.0.1):00000000-0000-0000-0000-000000000000\n" + + "********************************"; private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" + "***validation of model failed***\n" - + "AxArtifactKey:(name=BasicModelKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n" - + "AxArtifactKey:(name=BasicModelKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:INVALID:key information not found for key AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1)\n" - + "********************************"; + + "AxArtifactKey:(name=BasicModelKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts." + + "AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n" + + "AxArtifactKey:(name=BasicModelKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts." + + "AxModel:INVALID:key information not found for key " + + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1)\n" + "********************************"; } diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelConcepts.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelConcepts.java index 1ab7a2666..11cab6d88 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelConcepts.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelConcepts.java @@ -257,20 +257,20 @@ public class TestApexBasicModelConcepts { mwr.removeKey(keyU); // Key Use on bad artifact key - final AxKeyUse keyBU = new AxKeyUse(new AxArtifactKey("SomeKey", "0.0.1")); - mwr.addKey(keyBU); + final AxKeyUse keyBadUsage = new AxKeyUse(new AxArtifactKey("SomeKey", "0.0.1")); + mwr.addKey(keyBadUsage); result = new AxValidationResult(); result = mwr.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); - mwr.removeKey(keyBU); + mwr.removeKey(keyBadUsage); // Key Use on bad reference key - final AxKeyUse keyBRU = new AxKeyUse(new AxReferenceKey("SomeKey", "0.0.1", "Local")); - mwr.addKey(keyBRU); + final AxKeyUse keyBadReferenceUsage = new AxKeyUse(new AxReferenceKey("SomeKey", "0.0.1", "Local")); + mwr.addKey(keyBadReferenceUsage); result = new AxValidationResult(); result = mwr.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); - mwr.removeKey(keyBRU); + mwr.removeKey(keyBadReferenceUsage); result = new AxValidationResult(); result = mwr.validate(result); diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelCreator.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelCreator.java index 762c7555f..b11669fdf 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelCreator.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelCreator.java @@ -38,13 +38,16 @@ public class TestApexBasicModelCreator implements TestApexModelCreator<AxModel> basicModel.setKeyInformation(new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"))); basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKey(), new AxKeyInfo(basicModel.getKey())); - basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKeyInformation().getKey(), new AxKeyInfo(basicModel.getKeyInformation().getKey())); + basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKeyInformation().getKey(), + new AxKeyInfo(basicModel.getKeyInformation().getKey())); - AxKeyInfo intKI = new AxKeyInfo(new AxArtifactKey("IntegerKIKey", "0.0.1"), UUID.randomUUID(), "IntegerKIKey description"); - basicModel.getKeyInformation().getKeyInfoMap().put(intKI.getKey(), new AxKeyInfo(intKI.getKey())); + AxKeyInfo intKeyInfo = new AxKeyInfo(new AxArtifactKey("IntegerKIKey", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey description"); + basicModel.getKeyInformation().getKeyInfoMap().put(intKeyInfo.getKey(), new AxKeyInfo(intKeyInfo.getKey())); - AxKeyInfo floatKI = new AxKeyInfo(new AxArtifactKey("FloatKIKey", "0.0.1"), UUID.randomUUID(), "FloatKIKey description"); - basicModel.getKeyInformation().getKeyInfoMap().put(floatKI.getKey(), new AxKeyInfo(floatKI.getKey())); + AxKeyInfo floatKeyInfo = new AxKeyInfo(new AxArtifactKey("FloatKIKey", "0.0.1"), UUID.randomUUID(), + "FloatKIKey description"); + basicModel.getKeyInformation().getKeyInfoMap().put(floatKeyInfo.getKey(), new AxKeyInfo(floatKeyInfo.getKey())); return basicModel; } @@ -57,10 +60,7 @@ public class TestApexBasicModelCreator implements TestApexModelCreator<AxModel> basicModel.setKey(new AxArtifactKey("BasicModelKey", "0.0.1")); basicModel.setKeyInformation(new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"))); - basicModel.getKeyInformation().getKeyInfoMap().put( - basicModel.getKey(), - new AxKeyInfo( - basicModel.getKey(), + basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKey(), new AxKeyInfo(basicModel.getKey(), UUID.fromString("00000000-0000-0000-0000-000000000000"), "\nbasic model description\nThis is a multi line description\nwith another line of text.")); @@ -98,29 +98,27 @@ public class TestApexBasicModelCreator implements TestApexModelCreator<AxModel> basicModel.setKey(new AxArtifactKey("BasicModelKey", "0.0.1")); basicModel.setKeyInformation(new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"))); - basicModel.getKeyInformation().getKeyInfoMap().put( - basicModel.getKey(), - new AxKeyInfo( - basicModel.getKey(), + basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKey(), new AxKeyInfo(basicModel.getKey(), UUID.fromString("00000000-0000-0000-0000-000000000000"), "nbasic model description\nThis is a multi line description\nwith another line of text.")); - basicModel.getKeyInformation().getKeyInfoMap().put( - basicModel.getKeyInformation().getKey(), - new AxKeyInfo( - basicModel.getKeyInformation().getKey(), - UUID.fromString("00000000-0000-0000-0000-000000000000"), - "")); + basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKeyInformation().getKey(), + new AxKeyInfo(basicModel.getKeyInformation().getKey(), + UUID.fromString("00000000-0000-0000-0000-000000000000"), "")); return basicModel; } - + + /** + * Get the model with its references. + * @return the model with its references + */ public final AxModelWithReferences getModelWithReferences() { AxModel model = getModel(); - + AxModelWithReferences modelWithReferences = new AxModelWithReferences(model.getKey()); modelWithReferences.setKeyInformation(model.getKeyInformation()); modelWithReferences.setReferenceKeyList(); - + return modelWithReferences; } } diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator0.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator0.java index ff958373e..a3d841a51 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator0.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator0.java @@ -36,7 +36,8 @@ public class TestApexTestModelCreator0 implements TestApexModelCreator<AxModel> basicModel.setKeyInformation(new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"))); basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKey(), new AxKeyInfo(basicModel.getKey())); - basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKeyInformation().getKey(), new AxKeyInfo(basicModel.getKeyInformation().getKey())); + basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKeyInformation().getKey(), + new AxKeyInfo(basicModel.getKeyInformation().getKey())); return basicModel; } diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator1.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator1.java index d2aa738a0..cbbe05a36 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator1.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator1.java @@ -57,18 +57,12 @@ public class TestApexTestModelCreator1 implements TestApexModelCreator<AxModel> basicModel.setKey(new AxArtifactKey("BasicModelKey", "0.0.1")); basicModel.setKeyInformation(new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"))); - basicModel.getKeyInformation().getKeyInfoMap().put( - basicModel.getKey(), - new AxKeyInfo( - basicModel.getKey(), + basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKey(), new AxKeyInfo(basicModel.getKey(), UUID.fromString("00000000-0000-0000-0000-000000000000"), "nbasic model description\nThis is a multi line description\nwith another line of text.")); - basicModel.getKeyInformation().getKeyInfoMap().put( - basicModel.getKeyInformation().getKey(), - new AxKeyInfo( - basicModel.getKeyInformation().getKey(), - UUID.fromString("00000000-0000-0000-0000-000000000000"), - "")); + basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKeyInformation().getKey(), + new AxKeyInfo(basicModel.getKeyInformation().getKey(), + UUID.fromString("00000000-0000-0000-0000-000000000000"), "")); return basicModel; } diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator2.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator2.java index 85751bf12..a7b77865d 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator2.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator2.java @@ -36,7 +36,8 @@ public class TestApexTestModelCreator2 implements TestApexModelCreator<AxModel> basicModel.setKeyInformation(new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"))); basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKey(), new AxKeyInfo(basicModel.getKey())); - basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKeyInformation().getKey(), new AxKeyInfo(basicModel.getKeyInformation().getKey())); + basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKeyInformation().getKey(), + new AxKeyInfo(basicModel.getKeyInformation().getKey())); basicModel.getKeyInformation().get("BasicModel").setDescription(""); return basicModel; } diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java index 9ddd3cc7e..9ced9d84b 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java @@ -29,15 +29,12 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.concepts.AxModel; import org.onap.policy.apex.model.basicmodel.test.TestApexModel; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class TestBasicModelTest { @Test public void testNormalModelCreator() throws ApexException { - final TestApexModel<AxModel> testApexModel = - new TestApexModel<AxModel>(AxModel.class, new TestApexBasicModelCreator()); + final TestApexModel<AxModel> testApexModel = new TestApexModel<AxModel>(AxModel.class, + new TestApexBasicModelCreator()); testApexModel.testApexModelValid(); try { @@ -50,14 +47,14 @@ public class TestBasicModelTest { testApexModel.testApexModelVaidateInvalidModel(); testApexModel.testApexModelVaidateMalstructured(); - testApexModel.testApexModelWriteReadJSON(); - testApexModel.testApexModelWriteReadXML(); + testApexModel.testApexModelWriteReadJson(); + testApexModel.testApexModelWriteReadXml(); } @Test public void testModelCreator0() throws ApexException { - final TestApexModel<AxModel> testApexModel = - new TestApexModel<AxModel>(AxModel.class, new TestApexTestModelCreator0()); + final TestApexModel<AxModel> testApexModel = new TestApexModel<AxModel>(AxModel.class, + new TestApexTestModelCreator0()); testApexModel.testApexModelValid(); try { @@ -88,8 +85,8 @@ public class TestBasicModelTest { @Test public void testModelCreator1() throws ApexException { - final TestApexModel<AxModel> testApexModel = - new TestApexModel<AxModel>(AxModel.class, new TestApexTestModelCreator1()); + final TestApexModel<AxModel> testApexModel = new TestApexModel<AxModel>(AxModel.class, + new TestApexTestModelCreator1()); try { testApexModel.testApexModelValid(); @@ -115,8 +112,8 @@ public class TestBasicModelTest { @Test public void testModelCreator2() throws ApexException { - final TestApexModel<AxModel> testApexModel = - new TestApexModel<AxModel>(AxModel.class, new TestApexTestModelCreator2()); + final TestApexModel<AxModel> testApexModel = new TestApexModel<AxModel>(AxModel.class, + new TestApexTestModelCreator2()); testApexModel.testApexModelValid(); testApexModel.testApexModelVaidateObservation(); @@ -129,19 +126,19 @@ public class TestBasicModelTest { } @Test - public void testModelCreator1XMLJSON() throws ApexException { - final TestApexModel<AxModel> testApexModel = - new TestApexModel<AxModel>(AxModel.class, new TestApexTestModelCreator1()); + public void testModelCreator1XmlJson() throws ApexException { + final TestApexModel<AxModel> testApexModel = new TestApexModel<AxModel>(AxModel.class, + new TestApexTestModelCreator1()); try { - testApexModel.testApexModelWriteReadJSON(); + testApexModel.testApexModelWriteReadJson(); fail("Test should throw an exception"); } catch (final Exception e) { assertTrue(e.getMessage().startsWith("error processing file")); } try { - testApexModel.testApexModelWriteReadXML(); + testApexModel.testApexModelWriteReadXml(); fail("Test should throw an exception"); } catch (final Exception e) { assertTrue(e.getMessage().startsWith("error processing file")); diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestConceptGetter.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestConceptGetter.java index 83545bf06..f95c0b41d 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestConceptGetter.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestConceptGetter.java @@ -37,37 +37,55 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxModel; import org.onap.policy.apex.model.basicmodel.handling.ApexModelFileWriter; import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class TestConceptGetter { @Test public void testConceptGetter() throws IOException, ApexException { AxModel basicModel = new TestApexBasicModelCreator().getModel(); assertNotNull(basicModel); - - AxKeyInfo intKI01 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey01", "0.0.1"), UUID.randomUUID(), "IntegerKIKey01 description"); - AxKeyInfo intKI11 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey11", "0.0.1"), UUID.randomUUID(), "IntegerKIKey11 description"); - AxKeyInfo intKI21 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey21", "0.0.1"), UUID.randomUUID(), "IntegerKIKey21 description"); - AxKeyInfo intKI22 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey22", "0.0.2"), UUID.randomUUID(), "IntegerKIKey22 description"); - AxKeyInfo intKI23 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey23", "0.0.3"), UUID.randomUUID(), "IntegerKIKey23 description"); - AxKeyInfo intKI24 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey24", "0.0.4"), UUID.randomUUID(), "IntegerKIKey24 description"); - AxKeyInfo intKI25 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey25", "0.0.5"), UUID.randomUUID(), "IntegerKIKey25 description"); - AxKeyInfo intKI26 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey26", "0.0.6"), UUID.randomUUID(), "IntegerKIKey26 description"); - AxKeyInfo intKI31 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey31", "0.0.1"), UUID.randomUUID(), "IntegerKIKey31 description"); - AxKeyInfo intKI41 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey41", "0.0.1"), UUID.randomUUID(), "IntegerKIKey41 description"); - AxKeyInfo intKI51 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey51", "0.0.1"), UUID.randomUUID(), "IntegerKIKey51 description"); - AxKeyInfo intKI52 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey52", "0.0.2"), UUID.randomUUID(), "IntegerKIKey52 description"); - AxKeyInfo intKI53 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey53", "0.0.3"), UUID.randomUUID(), "IntegerKIKey53 description"); - AxKeyInfo intKI54 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey54", "0.0.4"), UUID.randomUUID(), "IntegerKIKey54 description"); - AxKeyInfo intKI61 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey61", "0.0.1"), UUID.randomUUID(), "IntegerKIKey61 description"); - AxKeyInfo intKI62 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey62", "0.0.2"), UUID.randomUUID(), "IntegerKIKey62 description"); - AxKeyInfo intKI63 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey63", "0.0.3"), UUID.randomUUID(), "IntegerKIKey63 description"); - AxKeyInfo intKI64 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey64", "0.0.4"), UUID.randomUUID(), "IntegerKIKey64 description"); - AxKeyInfo intKI71 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey71", "0.0.1"), UUID.randomUUID(), "IntegerKIKey71 description"); - AxKeyInfo intKI81 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey81", "0.0.1"), UUID.randomUUID(), "IntegerKIKey81 description"); - AxKeyInfo intKI91 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey91", "0.0.1"), UUID.randomUUID(), "IntegerKIKey91 description"); + + AxKeyInfo intKI01 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey01", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey01 description"); + AxKeyInfo intKI11 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey11", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey11 description"); + AxKeyInfo intKI21 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey21", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey21 description"); + AxKeyInfo intKI22 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey22", "0.0.2"), UUID.randomUUID(), + "IntegerKIKey22 description"); + AxKeyInfo intKI23 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey23", "0.0.3"), UUID.randomUUID(), + "IntegerKIKey23 description"); + AxKeyInfo intKI24 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey24", "0.0.4"), UUID.randomUUID(), + "IntegerKIKey24 description"); + AxKeyInfo intKI25 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey25", "0.0.5"), UUID.randomUUID(), + "IntegerKIKey25 description"); + AxKeyInfo intKI26 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey26", "0.0.6"), UUID.randomUUID(), + "IntegerKIKey26 description"); + AxKeyInfo intKI31 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey31", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey31 description"); + AxKeyInfo intKI41 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey41", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey41 description"); + AxKeyInfo intKI51 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey51", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey51 description"); + AxKeyInfo intKI52 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey52", "0.0.2"), UUID.randomUUID(), + "IntegerKIKey52 description"); + AxKeyInfo intKI53 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey53", "0.0.3"), UUID.randomUUID(), + "IntegerKIKey53 description"); + AxKeyInfo intKI54 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey54", "0.0.4"), UUID.randomUUID(), + "IntegerKIKey54 description"); + AxKeyInfo intKI61 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey61", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey61 description"); + AxKeyInfo intKI62 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey62", "0.0.2"), UUID.randomUUID(), + "IntegerKIKey62 description"); + AxKeyInfo intKI63 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey63", "0.0.3"), UUID.randomUUID(), + "IntegerKIKey63 description"); + AxKeyInfo intKI64 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey64", "0.0.4"), UUID.randomUUID(), + "IntegerKIKey64 description"); + AxKeyInfo intKI71 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey71", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey71 description"); + AxKeyInfo intKI81 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey81", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey81 description"); + AxKeyInfo intKI91 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey91", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey91 description"); basicModel.getKeyInformation().getKeyInfoMap().put(intKI31.getKey(), intKI31); basicModel.getKeyInformation().getKeyInfoMap().put(intKI24.getKey(), intKI24); basicModel.getKeyInformation().getKeyInfoMap().put(intKI11.getKey(), intKI11); @@ -90,20 +108,34 @@ public class TestConceptGetter { basicModel.getKeyInformation().getKeyInfoMap().put(intKI61.getKey(), intKI61); basicModel.getKeyInformation().getKeyInfoMap().put(intKI63.getKey(), intKI63); - AxKeyInfo floatKI01 = new AxKeyInfo(new AxArtifactKey("FloatKIKey01", "0.0.1"), UUID.randomUUID(), "IntegerKIKey01 description"); - AxKeyInfo floatKI11 = new AxKeyInfo(new AxArtifactKey("FloatKIKey11", "0.0.1"), UUID.randomUUID(), "IntegerKIKey11 description"); - AxKeyInfo floatKI21 = new AxKeyInfo(new AxArtifactKey("FloatKIKey21", "0.0.1"), UUID.randomUUID(), "IntegerKIKey21 description"); - AxKeyInfo floatKI31 = new AxKeyInfo(new AxArtifactKey("FloatKIKey31", "0.0.1"), UUID.randomUUID(), "IntegerKIKey31 description"); - AxKeyInfo floatKI41 = new AxKeyInfo(new AxArtifactKey("FloatKIKey41", "0.0.1"), UUID.randomUUID(), "IntegerKIKey41 description"); - AxKeyInfo floatKI51 = new AxKeyInfo(new AxArtifactKey("FloatKIKey51", "0.0.1"), UUID.randomUUID(), "IntegerKIKey51 description"); - AxKeyInfo floatKI61 = new AxKeyInfo(new AxArtifactKey("FloatKIKey61", "0.0.1"), UUID.randomUUID(), "IntegerKIKey61 description"); - AxKeyInfo floatKI71 = new AxKeyInfo(new AxArtifactKey("FloatKIKey71", "0.0.1"), UUID.randomUUID(), "IntegerKIKey71 description"); - AxKeyInfo floatKI81 = new AxKeyInfo(new AxArtifactKey("FloatKIKey81", "0.0.1"), UUID.randomUUID(), "IntegerKIKey81 description"); - AxKeyInfo floatKI82 = new AxKeyInfo(new AxArtifactKey("FloatKIKey82", "0.0.2"), UUID.randomUUID(), "IntegerKIKey82 description"); - AxKeyInfo floatKI83 = new AxKeyInfo(new AxArtifactKey("FloatKIKey83", "0.0.3"), UUID.randomUUID(), "IntegerKIKey83 description"); - AxKeyInfo floatKI91 = new AxKeyInfo(new AxArtifactKey("FloatKIKey91", "0.0.1"), UUID.randomUUID(), "IntegerKIKey91 description"); - AxKeyInfo floatKI92 = new AxKeyInfo(new AxArtifactKey("FloatKIKey92", "0.0.2"), UUID.randomUUID(), "IntegerKIKey92 description"); - AxKeyInfo floatKI93 = new AxKeyInfo(new AxArtifactKey("FloatKIKey93", "0.0.3"), UUID.randomUUID(), "IntegerKIKey93 description"); + AxKeyInfo floatKI01 = new AxKeyInfo(new AxArtifactKey("FloatKIKey01", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey01 description"); + AxKeyInfo floatKI11 = new AxKeyInfo(new AxArtifactKey("FloatKIKey11", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey11 description"); + AxKeyInfo floatKI21 = new AxKeyInfo(new AxArtifactKey("FloatKIKey21", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey21 description"); + AxKeyInfo floatKI31 = new AxKeyInfo(new AxArtifactKey("FloatKIKey31", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey31 description"); + AxKeyInfo floatKI41 = new AxKeyInfo(new AxArtifactKey("FloatKIKey41", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey41 description"); + AxKeyInfo floatKI51 = new AxKeyInfo(new AxArtifactKey("FloatKIKey51", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey51 description"); + AxKeyInfo floatKI61 = new AxKeyInfo(new AxArtifactKey("FloatKIKey61", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey61 description"); + AxKeyInfo floatKI71 = new AxKeyInfo(new AxArtifactKey("FloatKIKey71", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey71 description"); + AxKeyInfo floatKI81 = new AxKeyInfo(new AxArtifactKey("FloatKIKey81", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey81 description"); + AxKeyInfo floatKI82 = new AxKeyInfo(new AxArtifactKey("FloatKIKey82", "0.0.2"), UUID.randomUUID(), + "IntegerKIKey82 description"); + AxKeyInfo floatKI83 = new AxKeyInfo(new AxArtifactKey("FloatKIKey83", "0.0.3"), UUID.randomUUID(), + "IntegerKIKey83 description"); + AxKeyInfo floatKI91 = new AxKeyInfo(new AxArtifactKey("FloatKIKey91", "0.0.1"), UUID.randomUUID(), + "IntegerKIKey91 description"); + AxKeyInfo floatKI92 = new AxKeyInfo(new AxArtifactKey("FloatKIKey92", "0.0.2"), UUID.randomUUID(), + "IntegerKIKey92 description"); + AxKeyInfo floatKI93 = new AxKeyInfo(new AxArtifactKey("FloatKIKey93", "0.0.3"), UUID.randomUUID(), + "IntegerKIKey93 description"); basicModel.getKeyInformation().getKeyInfoMap().put(floatKI11.getKey(), floatKI11); basicModel.getKeyInformation().getKeyInfoMap().put(floatKI83.getKey(), floatKI83); basicModel.getKeyInformation().getKeyInfoMap().put(floatKI51.getKey(), floatKI51); @@ -124,9 +156,9 @@ public class TestConceptGetter { assertTrue(basicModel.getKeyInformation().get("IntegerKIKey62", "0.0.2").equals(intKI62)); assertTrue(basicModel.getKeyInformation().get("IntegerKIKey21", "0.0.1").equals(intKI21)); assertTrue(basicModel.getKeyInformation().get("IntegerKIKey61", "0.0.1").equals(intKI61)); - + assertNull(basicModel.getKeyInformation().get("NonExistantKey")); - + assertTrue(basicModel.getKeyInformation().get("IntegerKIKey01").equals(intKI01)); assertTrue(basicModel.getKeyInformation().get("IntegerKIKey11").equals(intKI11)); assertTrue(basicModel.getKeyInformation().get("IntegerKIKey26").equals(intKI26)); @@ -137,7 +169,7 @@ public class TestConceptGetter { assertTrue(basicModel.getKeyInformation().get("IntegerKIKey71").equals(intKI71)); assertTrue(basicModel.getKeyInformation().get("IntegerKIKey81").equals(intKI81)); assertTrue(basicModel.getKeyInformation().get("IntegerKIKey91").equals(intKI91)); - + assertTrue(basicModel.getKeyInformation().get("FloatKIKey01").equals(floatKI01)); assertTrue(basicModel.getKeyInformation().get("FloatKIKey11").equals(floatKI11)); assertTrue(basicModel.getKeyInformation().get("FloatKIKey21").equals(floatKI21)); @@ -149,23 +181,22 @@ public class TestConceptGetter { assertTrue(basicModel.getKeyInformation().get("FloatKIKey83").equals(floatKI83)); assertTrue(basicModel.getKeyInformation().get("FloatKIKey93").equals(floatKI93)); - // Ensure marshalling and unmarshalling is OK ApexModelReader<AxModel> modelReader = new ApexModelReader<AxModel>(AxModel.class); ApexModelFileWriter<AxModel> modelWriter = new ApexModelFileWriter<AxModel>(true); - + modelReader.setValidateFlag(false); modelWriter.setValidateFlag(false); - - File tempXMLFile = File.createTempFile("ApexModel", "xml"); - modelWriter.apexModelWriteJSONFile(basicModel, AxModel.class, tempXMLFile.getCanonicalPath()); - - FileInputStream xmlFileInputStream = new FileInputStream(tempXMLFile); - AxModel readXMLModel = modelReader.read(xmlFileInputStream); + + File tempXmlFile = File.createTempFile("ApexModel", "xml"); + modelWriter.apexModelWriteJsonFile(basicModel, AxModel.class, tempXmlFile.getCanonicalPath()); + + FileInputStream xmlFileInputStream = new FileInputStream(tempXmlFile); + AxModel readXmlModel = modelReader.read(xmlFileInputStream); xmlFileInputStream.close(); - assertTrue(basicModel.equals(readXMLModel)); - assertTrue(readXMLModel.getKeyInformation().get("IntegerKIKey91").equals(intKI91)); - assertNotNull(readXMLModel.getKeyInformation().get("FloatKIKey")); - tempXMLFile.delete(); + assertTrue(basicModel.equals(readXmlModel)); + assertTrue(readXmlModel.getKeyInformation().get("IntegerKIKey91").equals(intKI91)); + assertNotNull(readXmlModel.getKeyInformation().get("FloatKIKey")); + tempXmlFile.delete(); } } diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestExceptions.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestExceptions.java index 5c8922793..8b0196b31 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestExceptions.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestExceptions.java @@ -28,9 +28,6 @@ import java.io.IOException; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.handling.ApexModelException; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class TestExceptions { @Test diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelFileWriter.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelFileWriter.java index ec4d0a5a9..3e860e3b1 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelFileWriter.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelFileWriter.java @@ -31,15 +31,10 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.concepts.AxModel; import org.onap.policy.apex.model.basicmodel.handling.ApexModelFileWriter; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class TestModelFileWriter { @Test public void testModelFileWriter() throws IOException, ApexException { - AxModel model = new TestApexBasicModelCreator().getModel(); - ApexModelFileWriter<AxModel> modelFileWriter = new ApexModelFileWriter<>(true); modelFileWriter.setValidateFlag(true); @@ -52,9 +47,10 @@ public class TestModelFileWriter { File jsonTempFile = new File(tempDir.getAbsolutePath() + "/aaa/ApexFileWriterTest.json"); File xmlTempFile = new File(tempDir.getAbsolutePath() + "/ccc/ApexFileWriterTest.xml"); - modelFileWriter.apexModelWriteJSONFile(model, AxModel.class, jsonTempFile.getAbsolutePath()); + AxModel model = new TestApexBasicModelCreator().getModel(); - modelFileWriter.apexModelWriteXMLFile(model, AxModel.class, xmlTempFile.getAbsolutePath()); + modelFileWriter.apexModelWriteJsonFile(model, AxModel.class, jsonTempFile.getAbsolutePath()); + modelFileWriter.apexModelWriteXmlFile(model, AxModel.class, xmlTempFile.getAbsolutePath()); jsonTempFile.delete(); xmlTempFile.delete(); @@ -64,8 +60,8 @@ public class TestModelFileWriter { jsonTempFile = new File(tempDir.getAbsolutePath() + "/aaa/bbb/ApexFileWriterTest.json"); xmlTempFile = new File(tempDir.getAbsolutePath() + "/ccc/ddd/ApexFileWriterTest.xml"); - modelFileWriter.apexModelWriteJSONFile(model, AxModel.class, jsonTempFile.getAbsolutePath()); - modelFileWriter.apexModelWriteXMLFile(model, AxModel.class, xmlTempFile.getAbsolutePath()); + modelFileWriter.apexModelWriteJsonFile(model, AxModel.class, jsonTempFile.getAbsolutePath()); + modelFileWriter.apexModelWriteXmlFile(model, AxModel.class, xmlTempFile.getAbsolutePath()); jsonTempFile.delete(); xmlTempFile.delete(); @@ -84,7 +80,7 @@ public class TestModelFileWriter { jsonTempFile = new File(tempDir.getAbsolutePath() + "/aaa/bbb/ApexFileWriterTest.xml"); try { - modelFileWriter.apexModelWriteJSONFile(model, AxModel.class, jsonTempFile.getAbsolutePath()); + modelFileWriter.apexModelWriteJsonFile(model, AxModel.class, jsonTempFile.getAbsolutePath()); fail("this test should throw an exception here"); } catch (Exception e) { @@ -92,7 +88,7 @@ public class TestModelFileWriter { } try { - modelFileWriter.apexModelWriteXMLFile(model, AxModel.class, jsonTempFile.getAbsolutePath()); + modelFileWriter.apexModelWriteXmlFile(model, AxModel.class, jsonTempFile.getAbsolutePath()); fail("this test should throw an exception here"); } catch (Exception e) { @@ -110,7 +106,7 @@ public class TestModelFileWriter { jsonTempFile = new File(tempDir.getAbsolutePath() + "/aaa/bbb/ApexFileWriterTest.xml"); try { - modelFileWriter.apexModelWriteJSONFile(model, AxModel.class, jsonTempFile.getAbsolutePath()); + modelFileWriter.apexModelWriteJsonFile(model, AxModel.class, jsonTempFile.getAbsolutePath()); fail("this test should throw an exception here"); } catch (Exception e) { @@ -118,7 +114,7 @@ public class TestModelFileWriter { } try { - modelFileWriter.apexModelWriteXMLFile(model, AxModel.class, jsonTempFile.getAbsolutePath()); + modelFileWriter.apexModelWriteXmlFile(model, AxModel.class, jsonTempFile.getAbsolutePath()); fail("this test should throw an exception here"); } catch (Exception e) { diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelReader.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelReader.java index 140817e00..1695a0b2c 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelReader.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelReader.java @@ -39,9 +39,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxModel; import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader; import org.onap.policy.apex.model.basicmodel.handling.ApexModelWriter; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class TestModelReader { @Test @@ -87,12 +84,12 @@ public class TestModelReader { modelWriter.setJsonOutput(false); - ByteArrayOutputStream baosXML = new ByteArrayOutputStream(); - modelWriter.write(model, baosXML); + ByteArrayOutputStream baosXml = new ByteArrayOutputStream(); + modelWriter.write(model, baosXml); - ByteArrayInputStream baisXML = new ByteArrayInputStream(baosXML.toByteArray()); - AxModel readModelXML = modelReader.read(baisXML); - assertEquals(model, readModelXML); + ByteArrayInputStream baisXml = new ByteArrayInputStream(baosXml.toByteArray()); + AxModel readModelXml = modelReader.read(baisXml); + assertEquals(model, readModelXml); String dummyString = "SomeDummyText"; ByteArrayInputStream baisDummy = new ByteArrayInputStream(dummyString.getBytes()); diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelSaver.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelSaver.java index 08f123cba..634a929d9 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelSaver.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelSaver.java @@ -30,22 +30,20 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.concepts.AxModel; import org.onap.policy.apex.model.basicmodel.handling.ApexModelSaver; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class TestModelSaver { @Test public void testModelSaver() throws IOException, ApexException { AxModel model = new TestApexBasicModelCreator().getModel(); - + Path tempPath = Files.createTempDirectory("ApexTest"); - - ApexModelSaver<AxModel> modelSaver = new ApexModelSaver<AxModel>(AxModel.class, model, tempPath.toAbsolutePath().toString()); - - modelSaver.apexModelWriteXML(); - modelSaver.apexModelWriteJSON(); - + + ApexModelSaver<AxModel> modelSaver = new ApexModelSaver<AxModel>(AxModel.class, model, + tempPath.toAbsolutePath().toString()); + + modelSaver.apexModelWriteXml(); + modelSaver.apexModelWriteJson(); + Files.deleteIfExists(new File(tempPath.toAbsolutePath() + "/BasicModel.json").toPath()); Files.deleteIfExists(new File(tempPath.toAbsolutePath() + "/BasicModel.xml").toPath()); Files.deleteIfExists(tempPath); diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelStringWriter.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelStringWriter.java index d2a504676..d187e55ee 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelStringWriter.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelStringWriter.java @@ -33,9 +33,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo; import org.onap.policy.apex.model.basicmodel.concepts.AxModel; import org.onap.policy.apex.model.basicmodel.handling.ApexModelStringWriter; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class TestModelStringWriter { @Test @@ -43,23 +40,23 @@ public class TestModelStringWriter { AxModel basicModel = new TestApexBasicModelCreator().getModel(); assertNotNull(basicModel); - AxKeyInfo intKI = basicModel.getKeyInformation().get("IntegerKIKey"); - AxKeyInfo floatKI = basicModel.getKeyInformation().get("FloatKIKey"); + AxKeyInfo intKeyInfo = basicModel.getKeyInformation().get("IntegerKIKey"); + AxKeyInfo floatKeyInfo = basicModel.getKeyInformation().get("FloatKIKey"); // Ensure marshalling is OK ApexModelStringWriter<AxKeyInfo> stringWriter = new ApexModelStringWriter<AxKeyInfo>(true); - assertNotNull(stringWriter.writeJSONString(intKI, AxKeyInfo.class)); - assertNotNull(stringWriter.writeJSONString(floatKI, AxKeyInfo.class)); + assertNotNull(stringWriter.writeJsonString(intKeyInfo, AxKeyInfo.class)); + assertNotNull(stringWriter.writeJsonString(floatKeyInfo, AxKeyInfo.class)); - assertNotNull(stringWriter.writeString(intKI, AxKeyInfo.class, true)); - assertNotNull(stringWriter.writeString(floatKI, AxKeyInfo.class, true)); + assertNotNull(stringWriter.writeString(intKeyInfo, AxKeyInfo.class, true)); + assertNotNull(stringWriter.writeString(floatKeyInfo, AxKeyInfo.class, true)); - assertNotNull(stringWriter.writeString(intKI, AxKeyInfo.class, false)); - assertNotNull(stringWriter.writeString(floatKI, AxKeyInfo.class, false)); + assertNotNull(stringWriter.writeString(intKeyInfo, AxKeyInfo.class, false)); + assertNotNull(stringWriter.writeString(floatKeyInfo, AxKeyInfo.class, false)); - assertNotNull(stringWriter.writeXMLString(intKI, AxKeyInfo.class)); - assertNotNull(stringWriter.writeXMLString(floatKI, AxKeyInfo.class)); + assertNotNull(stringWriter.writeXmlString(intKeyInfo, AxKeyInfo.class)); + assertNotNull(stringWriter.writeXmlString(floatKeyInfo, AxKeyInfo.class)); try { stringWriter.writeString(null, AxKeyInfo.class, true); @@ -78,7 +75,7 @@ public class TestModelStringWriter { } try { - stringWriter.writeJSONString(null, AxKeyInfo.class); + stringWriter.writeJsonString(null, AxKeyInfo.class); fail("test should thrown an exception here"); } catch (Exception e) { @@ -86,7 +83,7 @@ public class TestModelStringWriter { } try { - stringWriter.writeXMLString(null, AxKeyInfo.class); + stringWriter.writeXmlString(null, AxKeyInfo.class); fail("test should thrown an exception here"); } catch (Exception e) { diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java index 8e5af45b3..648194a52 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java @@ -33,15 +33,10 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.concepts.AxModel; import org.onap.policy.apex.model.basicmodel.handling.ApexModelWriter; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class TestModelWriter { @Test public void testModelWriter() throws IOException, ApexException { - AxModel model = new TestApexBasicModelCreator().getModel(); - ApexModelWriter<AxModel> modelWriter = new ApexModelWriter<AxModel>(AxModel.class); modelWriter.setValidateFlag(true); @@ -56,6 +51,8 @@ public class TestModelWriter { ByteArrayOutputStream baos = new ByteArrayOutputStream(); + AxModel model = new TestApexBasicModelCreator().getModel(); + modelWriter.write(model, baos); modelWriter.setJsonOutput(true); modelWriter.write(model, baos); diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestSchemaGenerator.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestSchemaGenerator.java index cdf3b4615..36e4125ec 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestSchemaGenerator.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestSchemaGenerator.java @@ -31,9 +31,6 @@ import java.io.PrintStream; import org.junit.Test; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class TestSchemaGenerator { @Test @@ -83,7 +80,7 @@ public class TestSchemaGenerator { final File tempFile = File.createTempFile("ApexSchemaGeneratorTest", "xsd"); final String[] args5 = - { "org.onap.policy.apex.model.basicmodel.concepts.AxModel", tempFile.getCanonicalPath() }; + { "org.onap.policy.apex.model.basicmodel.concepts.AxModel", tempFile.getCanonicalPath() }; ApexSchemaGenerator.main(args5); assertTrue(tempFile.length() > 100); diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/TestModelService.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/TestModelService.java index 9c20d837f..4f05de177 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/TestModelService.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/TestModelService.java @@ -29,9 +29,6 @@ import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation; import org.onap.policy.apex.model.basicmodel.handling.TestApexBasicModelCreator; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class TestModelService { @Test @@ -42,13 +39,12 @@ public class TestModelService { try { ModelService.getModel(AxKeyInformation.class); } catch (final Exception e) { - assertEquals( - "Model for org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation not found in model service", - e.getMessage()); + assertEquals("Model for org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation " + + "not found in model service", e.getMessage()); } ModelService.registerModel(AxKeyInformation.class, - new TestApexBasicModelCreator().getModel().getKeyInformation()); + new TestApexBasicModelCreator().getModel().getKeyInformation()); assertTrue(ModelService.existsModel(AxKeyInformation.class)); assertNotNull(ModelService.getModel(AxKeyInformation.class)); @@ -58,13 +54,12 @@ public class TestModelService { try { ModelService.getModel(AxKeyInformation.class); } catch (final Exception e) { - assertEquals( - "Model for org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation not found in model service", - e.getMessage()); + assertEquals("Model for org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation " + + "not found in model service", e.getMessage()); } ModelService.registerModel(AxKeyInformation.class, - new TestApexBasicModelCreator().getModel().getKeyInformation()); + new TestApexBasicModelCreator().getModel().getKeyInformation()); assertTrue(ModelService.existsModel(AxKeyInformation.class)); assertNotNull(ModelService.getModel(AxKeyInformation.class)); @@ -73,9 +68,8 @@ public class TestModelService { try { ModelService.getModel(AxKeyInformation.class); } catch (final Exception e) { - assertEquals( - "Model for org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation not found in model service", - e.getMessage()); + assertEquals("Model for org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation " + + "not found in model service", e.getMessage()); } } diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/xml/TestAxReferenceKeyAdapter.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/xml/TestAxReferenceKeyAdapter.java index bde0956b8..a7773c37c 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/xml/TestAxReferenceKeyAdapter.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/xml/TestAxReferenceKeyAdapter.java @@ -27,9 +27,6 @@ import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; import org.onap.policy.apex.model.basicmodel.xml.AxReferenceKeyAdapter; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class TestAxReferenceKeyAdapter { @Test @@ -37,10 +34,10 @@ public class TestAxReferenceKeyAdapter { AxReferenceKeyAdapter arka = new AxReferenceKeyAdapter(); assertNotNull(arka); - AxReferenceKey rKey = new AxReferenceKey("Name", "0.0.1", "PLN", "LN"); + AxReferenceKey rkey = new AxReferenceKey("Name", "0.0.1", "PLN", "LN"); - String rKeyString = arka.marshal(rKey); - assertEquals("LN", rKeyString); - assertEquals(rKey.getLocalName(),arka.unmarshal(rKeyString).getLocalName()); + String rkeyString = arka.marshal(rkey); + assertEquals("LN", rkeyString); + assertEquals(rkey.getLocalName(),arka.unmarshal(rkeyString).getLocalName()); } } diff --git a/model/basic-model/src/test/resources/META-INF/persistence.xml b/model/basic-model/src/test/resources/META-INF/persistence.xml index a7bf1f6ac..ffc6526c3 100644 --- a/model/basic-model/src/test/resources/META-INF/persistence.xml +++ b/model/basic-model/src/test/resources/META-INF/persistence.xml @@ -20,11 +20,11 @@ --> <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0"> - <persistence-unit name="DAOTest" transaction-type="RESOURCE_LOCAL"> + <persistence-unit name="DaoTest" transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner</class> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class> diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java index 3abcebee9..bf8289ecb 100644 --- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java +++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java @@ -40,7 +40,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxKey; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult; -import org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner; +import org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner; import org.onap.policy.apex.model.utilities.Assertions; /** @@ -93,8 +93,8 @@ public class AxContextSchema extends AxConcept { private String schemaFlavour; @Column(name = "schemaDefinition", length = MAX_SCHEMA_SIZE) - @Convert(converter = CDATAConditioner.class) - @XmlJavaTypeAdapter(value = CDATAConditioner.class) + @Convert(converter = CDataConditioner.class) + @XmlJavaTypeAdapter(value = CDataConditioner.class) @XmlElement(name = "schemaDefinition", required = true) private String schemaDefinition; @@ -343,8 +343,8 @@ public class AxContextSchema extends AxConcept { if (!schemaFlavour.equals(other.schemaFlavour)) { return false; } - final String thisSchema = CDATAConditioner.clean(schemaDefinition).replaceAll("\n", ""); - final String otherSchema = CDATAConditioner.clean(other.schemaDefinition).replaceAll("\n", ""); + final String thisSchema = CDataConditioner.clean(schemaDefinition).replaceAll("\n", ""); + final String otherSchema = CDataConditioner.clean(other.schemaDefinition).replaceAll("\n", ""); return thisSchema.equals(otherSchema); } @@ -372,8 +372,8 @@ public class AxContextSchema extends AxConcept { if (!schemaFlavour.equals(other.schemaFlavour)) { return schemaFlavour.compareTo(other.schemaFlavour); } - final String thisSchema = CDATAConditioner.clean(schemaDefinition).replaceAll("\n", ""); - final String otherSchema = CDATAConditioner.clean(other.schemaDefinition).replaceAll("\n", ""); + final String thisSchema = CDataConditioner.clean(schemaDefinition).replaceAll("\n", ""); + final String otherSchema = CDataConditioner.clean(other.schemaDefinition).replaceAll("\n", ""); return thisSchema.compareTo(otherSchema); } } diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextAlbums.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextAlbums.java index 710c44e5b..839e19835 100644 --- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextAlbums.java +++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextAlbums.java @@ -53,8 +53,8 @@ public class TestContextAlbums { final AxArtifactKey newKey = new AxArtifactKey("NewAlbumName", "0.0.1"); album.setKey(newKey); - assertEquals("NewAlbumName:0.0.1", album.getKey().getID()); - assertEquals("NewAlbumName:0.0.1", album.getKeys().get(0).getID()); + assertEquals("NewAlbumName:0.0.1", album.getKey().getId()); + assertEquals("NewAlbumName:0.0.1", album.getKeys().get(0).getId()); album.setKey(albumKey); try { @@ -74,7 +74,7 @@ public class TestContextAlbums { final AxArtifactKey newSchemaKey = new AxArtifactKey("NewAlbumSchemaName", "0.0.1"); album.setItemSchema(newSchemaKey); - assertEquals("NewAlbumSchemaName:0.0.1", album.getItemSchema().getID()); + assertEquals("NewAlbumSchemaName:0.0.1", album.getItemSchema().getId()); album.setItemSchema(albumSchemaKey); AxValidationResult result = new AxValidationResult(); diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextSchemas.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextSchemas.java index e9e9564ac..02dfd6fb1 100644 --- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextSchemas.java +++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextSchemas.java @@ -50,8 +50,8 @@ public class TestContextSchemas { final AxArtifactKey newKey = new AxArtifactKey("NewSchemaName", "0.0.1"); schema.setKey(newKey); - assertEquals("NewSchemaName:0.0.1", schema.getKey().getID()); - assertEquals("NewSchemaName:0.0.1", schema.getKeys().get(0).getID()); + assertEquals("NewSchemaName:0.0.1", schema.getKey().getId()); + assertEquals("NewSchemaName:0.0.1", schema.getKeys().get(0).getId()); try { schema.setSchemaFlavour(""); diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModel.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModel.java index 477755ccc..10609ec9b 100644 --- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModel.java +++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModel.java @@ -30,7 +30,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.test.TestApexModel; import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel; @@ -84,21 +84,21 @@ public class TestApexContextModel { @Test public void testModelWriteReadXML() throws Exception { - testApexModel.testApexModelWriteReadXML(); + testApexModel.testApexModelWriteReadXml(); } @Test public void testModelWriteReadJSON() throws Exception { - testApexModel.testApexModelWriteReadJSON(); + testApexModel.testApexModelWriteReadJson(); } @Test public void testModelWriteReadJPA() throws Exception { - final DAOParameters daoParameters = new DAOParameters(); - daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); - daoParameters.setPersistenceUnit("DAOTest"); + final DaoParameters DaoParameters = new DaoParameters(); + DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); + DaoParameters.setPersistenceUnit("DAOTest"); - testApexModel.testApexModelWriteReadJPA(daoParameters); + testApexModel.testApexModelWriteReadJpa(DaoParameters); } private static final String VALID_MODEL_STRING = "***validation of model successful***"; diff --git a/model/context-model/src/test/resources/META-INF/persistence.xml b/model/context-model/src/test/resources/META-INF/persistence.xml index ec9357851..b7911caa2 100644 --- a/model/context-model/src/test/resources/META-INF/persistence.xml +++ b/model/context-model/src/test/resources/META-INF/persistence.xml @@ -23,8 +23,8 @@ <persistence-unit name="DAOTest" transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner</class> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxConcept</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class> diff --git a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineModel.java b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineModel.java index 86530462c..79537cfaf 100644 --- a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineModel.java +++ b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineModel.java @@ -70,8 +70,8 @@ public class TestEngineModel { } model.setKey(modelKey); - assertEquals("ModelName:0.0.1", model.getKey().getID()); - assertEquals("ModelName:0.0.1", model.getKeys().get(0).getID()); + assertEquals("ModelName:0.0.1", model.getKey().getId()); + assertEquals("ModelName:0.0.1", model.getKeys().get(0).getId()); final long timestamp = System.currentTimeMillis(); model.setTimestamp(timestamp); diff --git a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineStats.java b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineStats.java index 1cbe1930e..6346e59f7 100644 --- a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineStats.java +++ b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineStats.java @@ -54,8 +54,8 @@ public class TestEngineStats { } stats.setKey(statsKey); - assertEquals("EngineKey:0.0.1:NULL:EngineStats", stats.getKey().getID()); - assertEquals("EngineKey:0.0.1:NULL:EngineStats", stats.getKeys().get(0).getID()); + assertEquals("EngineKey:0.0.1:NULL:EngineStats", stats.getKey().getId()); + assertEquals("EngineKey:0.0.1:NULL:EngineStats", stats.getKeys().get(0).getId()); stats.setAverageExecutionTime(123.45); assertEquals(new Double(123.45), new Double(stats.getAverageExecutionTime())); diff --git a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/TestApexEngineModel.java b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/TestApexEngineModel.java index c1e6f3f37..c8076aab7 100644 --- a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/TestApexEngineModel.java +++ b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/TestApexEngineModel.java @@ -30,7 +30,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.test.TestApexModel; import org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel; @@ -72,21 +72,21 @@ public class TestApexEngineModel { @Test public void testModelWriteReadXML() throws Exception { - testApexModel.testApexModelWriteReadXML(); + testApexModel.testApexModelWriteReadXml(); } @Test public void testModelWriteReadJSON() throws Exception { - testApexModel.testApexModelWriteReadJSON(); + testApexModel.testApexModelWriteReadJson(); } @Test public void testModelWriteReadJPA() throws Exception { - final DAOParameters daoParameters = new DAOParameters(); - daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); - daoParameters.setPersistenceUnit("DAOTest"); + final DaoParameters DaoParameters = new DaoParameters(); + DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); + DaoParameters.setPersistenceUnit("DAOTest"); - testApexModel.testApexModelWriteReadJPA(daoParameters); + testApexModel.testApexModelWriteReadJpa(DaoParameters); } private static final String VALID_MODEL_STRING = "***validation of model successful***"; diff --git a/model/engine-model/src/test/resources/META-INF/persistence.xml b/model/engine-model/src/test/resources/META-INF/persistence.xml index 717d1a540..a157cf34f 100644 --- a/model/engine-model/src/test/resources/META-INF/persistence.xml +++ b/model/engine-model/src/test/resources/META-INF/persistence.xml @@ -23,8 +23,8 @@ <persistence-unit name="DAOTest" transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner</class> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxConcept</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class> diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEvents.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEvents.java index 5456dfad8..309359fa2 100644 --- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEvents.java +++ b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEvents.java @@ -60,8 +60,8 @@ public class TestEvents { final AxArtifactKey eventKey = new AxArtifactKey("EventName", "0.0.1"); event.setKey(eventKey); - assertEquals("EventName:0.0.1", event.getKey().getID()); - assertEquals("EventName:0.0.1", event.getKeys().get(0).getID()); + assertEquals("EventName:0.0.1", event.getKey().getId()); + assertEquals("EventName:0.0.1", event.getKeys().get(0).getId()); event.setNameSpace("namespace"); assertEquals("namespace", event.getNameSpace()); @@ -86,13 +86,13 @@ public class TestEvents { final AxArtifactKey newEventKey = new AxArtifactKey("NewEventName", "0.0.1"); event.setKey(newEventKey); - assertEquals("NewEventName:0.0.1", event.getKey().getID()); - assertEquals("NewEventName:0.0.1", event.getKeys().get(0).getID()); + assertEquals("NewEventName:0.0.1", event.getKey().getId()); + assertEquals("NewEventName:0.0.1", event.getKeys().get(0).getId()); assertEquals("NewEventName:0.0.1", - event.getParameterMap().get("Field0").getKey().getParentArtifactKey().getID()); + event.getParameterMap().get("Field0").getKey().getParentArtifactKey().getId()); event.setKey(eventKey); - assertEquals("EventName:0.0.1", event.getKey().getID()); - assertEquals("EventName:0.0.1", event.getKeys().get(0).getID()); + assertEquals("EventName:0.0.1", event.getKey().getId()); + assertEquals("EventName:0.0.1", event.getKeys().get(0).getId()); assertTrue("Field0", event.getFields().contains(eventField)); assertTrue(event.hasFields(new TreeSet<AxField>(parameterMap.values()))); @@ -223,7 +223,7 @@ public class TestEvents { // Invalid, no events in event map events.setKey(new AxArtifactKey("EventsKey", "0.0.1")); - assertEquals("EventsKey:0.0.1", events.getKey().getID()); + assertEquals("EventsKey:0.0.1", events.getKey().getId()); result = new AxValidationResult(); result = events.validate(result); diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestField.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestField.java index 11b8b745e..8d2e8a686 100644 --- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestField.java +++ b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestField.java @@ -68,12 +68,12 @@ public class TestField { final AxReferenceKey fieldKey = new AxReferenceKey("FieldName", "0.0.1", "PLN", "LN"); field.setKey(fieldKey); - assertEquals("FieldName:0.0.1:PLN:LN", field.getKey().getID()); - assertEquals("FieldName:0.0.1:PLN:LN", field.getKeys().get(0).getID()); + assertEquals("FieldName:0.0.1:PLN:LN", field.getKey().getId()); + assertEquals("FieldName:0.0.1:PLN:LN", field.getKeys().get(0).getId()); final AxArtifactKey schemaKey = new AxArtifactKey("SchemaName", "0.0.1"); field.setSchema(schemaKey); - assertEquals("SchemaName:0.0.1", field.getSchema().getID()); + assertEquals("SchemaName:0.0.1", field.getSchema().getId()); assertEquals(false, field.getOptional()); field.setOptional(true); diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModel.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModel.java index ee2638a54..abb3a3480 100644 --- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModel.java +++ b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModel.java @@ -30,7 +30,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.test.TestApexModel; import org.onap.policy.apex.model.eventmodel.concepts.AxEventModel; @@ -84,21 +84,21 @@ public class TestApexEventModel { @Test public void testModelWriteReadXML() throws Exception { - testApexModel.testApexModelWriteReadXML(); + testApexModel.testApexModelWriteReadXml(); } @Test public void testModelWriteReadJSON() throws Exception { - testApexModel.testApexModelWriteReadJSON(); + testApexModel.testApexModelWriteReadJson(); } @Test public void testModelWriteReadJPA() throws Exception { - final DAOParameters daoParameters = new DAOParameters(); - daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); - daoParameters.setPersistenceUnit("DAOTest"); + final DaoParameters DaoParameters = new DaoParameters(); + DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); + DaoParameters.setPersistenceUnit("DAOTest"); - testApexModel.testApexModelWriteReadJPA(daoParameters); + testApexModel.testApexModelWriteReadJpa(DaoParameters); } private static final String VALID_MODEL_STRING = "***validation of model successful***"; diff --git a/model/event-model/src/test/resources/META-INF/persistence.xml b/model/event-model/src/test/resources/META-INF/persistence.xml index db32612ab..9e61cbd73 100644 --- a/model/event-model/src/test/resources/META-INF/persistence.xml +++ b/model/event-model/src/test/resources/META-INF/persistence.xml @@ -23,8 +23,8 @@ <persistence-unit name="DAOTest" transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner</class> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxConcept</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class> diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexModel.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexModel.java index c9190b8db..8b4d4a91b 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexModel.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexModel.java @@ -20,7 +20,7 @@ package org.onap.policy.apex.model.modelapi; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; /** @@ -67,18 +67,18 @@ public interface ApexModel extends ApexEditorAPI { * @param modelName the name of the model to load * @param modelVersion the version of the model to load, loads the policy model from the database with this name, if more than one exist, an exception is * thrown - * @param daoParameters the parameters to use to access the database over JDBC + * @param DaoParameters the parameters to use to access the database over JDBC * @return the result of the operation */ - ApexAPIResult loadFromDatabase(String modelName, String modelVersion, DAOParameters daoParameters); + ApexAPIResult loadFromDatabase(String modelName, String modelVersion, DaoParameters DaoParameters); /** * Save an Apex model to a database. * - * @param daoParameters the parameters to use to access the database over JDBC + * @param DaoParameters the parameters to use to access the database over JDBC * @return the result of the operation */ - ApexAPIResult saveToDatabase(DAOParameters daoParameters); + ApexAPIResult saveToDatabase(DaoParameters DaoParameters); /** * Read an APEX model from a location identified by a URL. diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java index 738178d17..429d3c66f 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java @@ -22,7 +22,7 @@ package org.onap.policy.apex.model.modelapi.impl; import java.util.Properties; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.modelapi.ApexAPIResult; import org.onap.policy.apex.model.modelapi.ApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; @@ -1054,23 +1054,23 @@ public final class ApexModelImpl implements ApexModel { * (non-Javadoc) * * @see org.onap.policy.apex.model.modelapi.ApexModel#loadFromDatabase(java.lang.String, - * java.lang.String, org.onap.policy.apex.model.basicmodel.dao.DAOParameters) + * java.lang.String, org.onap.policy.apex.model.basicmodel.dao.DaoParameters) */ @Override public ApexAPIResult loadFromDatabase(final String modelName, final String modelVersion, - final DAOParameters daoParameters) { - return modelHandlerFacade.loadFromDatabase(modelName, modelVersion, daoParameters); + final DaoParameters DaoParameters) { + return modelHandlerFacade.loadFromDatabase(modelName, modelVersion, DaoParameters); } /* * (non-Javadoc) * * @see org.onap.policy.apex.model.modelapi.ApexModel#saveToDatabase(org.onap.policy.apex.model. - * basicmodel. dao.DAOParameters) + * basicmodel. dao.DaoParameters) */ @Override - public ApexAPIResult saveToDatabase(final DAOParameters daoParameters) { - return modelHandlerFacade.saveToDatabase(daoParameters); + public ApexAPIResult saveToDatabase(final DaoParameters DaoParameters) { + return modelHandlerFacade.saveToDatabase(DaoParameters); } /* diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumFacade.java index afd518d7a..840242569 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumFacade.java @@ -100,7 +100,7 @@ public class ContextAlbumFacade { if (apexModel.getPolicyModel().getAlbums().getAlbumsMap().containsKey(key)) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, - CONCEPT + key.getID() + " already exists"); + CONCEPT + key.getId() + " already exists"); } final AxContextSchema schema = @@ -229,7 +229,7 @@ public class ContextAlbumFacade { return new ApexAPIResult(); } else { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + key.getID() + DOES_NOT_EXIST); + CONCEPT + key.getId() + DOES_NOT_EXIST); } } diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextSchemaFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextSchemaFacade.java index 3f7f75652..620f229f1 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextSchemaFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextSchemaFacade.java @@ -96,7 +96,7 @@ public class ContextSchemaFacade { } if (apexModel.getPolicyModel().getSchemas().getSchemasMap().containsKey(key)) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, CONCEPT + key.getID() + ALREADY_EXISTS); + return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, CONCEPT + key.getId() + ALREADY_EXISTS); } apexModel.getPolicyModel().getSchemas().getSchemasMap().put(key, new AxContextSchema(key, schemaFlavour, schemaDefinition)); @@ -189,7 +189,7 @@ public class ContextSchemaFacade { new ApexModelStringWriter<AxContextSchema>(false).writeString(removedSchema, AxContextSchema.class, jsonMode)); } else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, CONCEPT + key.getID() + DOES_NOT_EXIST); + return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, CONCEPT + key.getId() + DOES_NOT_EXIST); } } diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/EventFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/EventFacade.java index 095d4f9f4..4706ff70a 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/EventFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/EventFacade.java @@ -99,7 +99,7 @@ public class EventFacade { } if (apexModel.getPolicyModel().getEvents().getEventMap().containsKey(key)) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, CONCEPT + key.getID() + ALREADY_EXISTS); + return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, CONCEPT + key.getId() + ALREADY_EXISTS); } final AxEvent event = new AxEvent(key); @@ -200,7 +200,7 @@ public class EventFacade { .writeString(removedEvent, AxEvent.class, jsonMode)); } else { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + key.getID() + DOES_NOT_EXIST); + CONCEPT + key.getId() + DOES_NOT_EXIST); } } @@ -278,7 +278,7 @@ public class EventFacade { if (event.getParameterMap().containsKey(refKey.getLocalName())) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, - CONCEPT + refKey.getID() + ALREADY_EXISTS); + CONCEPT + refKey.getId() + ALREADY_EXISTS); } final AxContextSchema schema = @@ -323,7 +323,7 @@ public class EventFacade { } else { if (event.getParameterMap().size() == 0) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - "no parameters defined on event " + event.getKey().getID()); + "no parameters defined on event " + event.getKey().getId()); } final ApexAPIResult result = new ApexAPIResult(); @@ -368,7 +368,7 @@ public class EventFacade { } else { if (event.getParameterMap().size() == 0) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - "no parameters defined on event " + event.getKey().getID()); + "no parameters defined on event " + event.getKey().getId()); } for (final AxField eventPar : event.getParameterMap().values()) { diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/KeyInformationFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/KeyInformationFacade.java index d9b9cef1a..e3e3db0c9 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/KeyInformationFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/KeyInformationFacade.java @@ -88,7 +88,7 @@ public class KeyInformationFacade { } if (apexModel.getPolicyModel().getKeyInformation().getKeyInfoMap().containsKey(key)) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, CONCEPT + key.getID() + ALREADY_EXISTS); + return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, CONCEPT + key.getId() + ALREADY_EXISTS); } final AxKeyInfo keyInfo = new AxKeyInfo(key); @@ -99,7 +99,7 @@ public class KeyInformationFacade { keyInfo.setUuid(UUID.fromString(uuid)); } else { // generate a reproducible UUID - keyInfo.setUuid(AxKeyInfo.generateReproducibleUUID(keyInfo.getID() + keyInfo.getDescription())); + keyInfo.setUuid(AxKeyInfo.generateReproducibleUuid(keyInfo.getId() + keyInfo.getDescription())); } apexModel.getPolicyModel().getKeyInformation().getKeyInfoMap().put(key, keyInfo); return new ApexAPIResult(); @@ -135,7 +135,7 @@ public class KeyInformationFacade { keyInfo.setUuid(UUID.fromString(uuid)); } else { // generate a reproducible UUID - keyInfo.setUuid(AxKeyInfo.generateReproducibleUUID(keyInfo.getID() + keyInfo.getDescription())); + keyInfo.setUuid(AxKeyInfo.generateReproducibleUuid(keyInfo.getId() + keyInfo.getDescription())); } return new ApexAPIResult(); @@ -190,7 +190,7 @@ public class KeyInformationFacade { .writeString(removedKeyInfo, AxKeyInfo.class, jsonMode)); } else { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + key.getID() + DOES_NOT_EXIST); + CONCEPT + key.getId() + DOES_NOT_EXIST); } } diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ModelFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ModelFacade.java index 2a6dd3ebf..65be2ae82 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ModelFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ModelFacade.java @@ -98,7 +98,7 @@ public class ModelFacade { if (!apexModel.getPolicyModel().getKey().equals(AxArtifactKey.getNullKey())) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, - CONCEPT + apexModel.getPolicyModel().getKey().getID() + ALREADY_CREATED); + CONCEPT + apexModel.getPolicyModel().getKey().getId() + ALREADY_CREATED); } apexModel.setPolicyModel(new AxPolicyModel(key)); @@ -137,13 +137,13 @@ public class ModelFacade { key.setVersion(defaultVersion); } else { return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, - CONCEPT + apexModel.getPolicyModel().getKey().getID() + NO_VERSION_SPECIFIED); + CONCEPT + apexModel.getPolicyModel().getKey().getId() + NO_VERSION_SPECIFIED); } } if (apexModel.getPolicyModel().getKey().equals(AxArtifactKey.getNullKey())) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + apexModel.getPolicyModel().getKey().getID() + DOES_NOT_EXIST); + CONCEPT + apexModel.getPolicyModel().getKey().getId() + DOES_NOT_EXIST); } return keyInformationFacade.updateKeyInformation(name, version, uuid, description); diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ModelHandlerFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ModelHandlerFacade.java index b422d84d1..5e54744d5 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ModelHandlerFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ModelHandlerFacade.java @@ -39,7 +39,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.basicmodel.dao.ApexDao; import org.onap.policy.apex.model.basicmodel.dao.ApexDaoFactory; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.handling.ApexModelException; import org.onap.policy.apex.model.basicmodel.handling.ApexModelFileWriter; import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader; @@ -106,7 +106,7 @@ public class ModelHandlerFacade { if (!apexModel.getPolicyModel().getKey().equals(AxArtifactKey.getNullKey())) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, - MODEL + apexModel.getPolicyModel().getKey().getID() + ALREADY_LOADED); + MODEL + apexModel.getPolicyModel().getKey().getId() + ALREADY_LOADED); } ApexAPIResult result = new ApexAPIResult(); @@ -127,7 +127,7 @@ public class ModelHandlerFacade { if (!apexModel.getPolicyModel().getKey().equals(AxArtifactKey.getNullKey())) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, - MODEL + apexModel.getPolicyModel().getKey().getID() + ALREADY_LOADED); + MODEL + apexModel.getPolicyModel().getKey().getId() + ALREADY_LOADED); } ApexAPIResult result = new ApexAPIResult(); @@ -152,9 +152,9 @@ public class ModelHandlerFacade { try { if (xmlFlag) { - apexModelFileWriter.apexModelWriteXMLFile(apexModel.getPolicyModel(), AxPolicyModel.class, fileName); + apexModelFileWriter.apexModelWriteXmlFile(apexModel.getPolicyModel(), AxPolicyModel.class, fileName); } else { - apexModelFileWriter.apexModelWriteJSONFile(apexModel.getPolicyModel(), AxPolicyModel.class, fileName); + apexModelFileWriter.apexModelWriteJsonFile(apexModel.getPolicyModel(), AxPolicyModel.class, fileName); } return new ApexAPIResult(); } catch (ApexException e) { @@ -168,23 +168,23 @@ public class ModelHandlerFacade { * @param modelName the name of the model to load * @param modelVersion the version of the model to load, loads the policy model from the * database with this name, if more than one exist, an exception is thrown - * @param daoParameters the parameters to use to access the database over JDBC + * @param DaoParameters the parameters to use to access the database over JDBC * @return the result of the operation */ public ApexAPIResult loadFromDatabase(final String modelName, final String modelVersion, - final DAOParameters daoParameters) { + final DaoParameters DaoParameters) { Assertions.argumentNotNull(modelName, "modelName may not be null"); - Assertions.argumentNotNull(daoParameters, "daoParameters may not be null"); + Assertions.argumentNotNull(DaoParameters, "DaoParameters may not be null"); if (!apexModel.getPolicyModel().getKey().equals(AxArtifactKey.getNullKey())) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, - MODEL + apexModel.getPolicyModel().getKey().getID() + ALREADY_LOADED); + MODEL + apexModel.getPolicyModel().getKey().getId() + ALREADY_LOADED); } ApexDao apexDao = null; try { - apexDao = new ApexDaoFactory().createApexDao(daoParameters); - apexDao.init(daoParameters); + apexDao = new ApexDaoFactory().createApexDao(DaoParameters); + apexDao.init(DaoParameters); // Single specific model requested if (modelVersion != null) { @@ -249,15 +249,15 @@ public class ModelHandlerFacade { /** * Save an Apex model to a database. * - * @param daoParameters the parameters to use to access the database over JDBC + * @param DaoParameters the parameters to use to access the database over JDBC * @return the result of the operation */ - public ApexAPIResult saveToDatabase(final DAOParameters daoParameters) { + public ApexAPIResult saveToDatabase(final DaoParameters DaoParameters) { ApexDao apexDao = null; try { - apexDao = new ApexDaoFactory().createApexDao(daoParameters); - apexDao.init(daoParameters); + apexDao = new ApexDaoFactory().createApexDao(DaoParameters); + apexDao.init(DaoParameters); apexDao.create(apexModel.getPolicyModel()); return new ApexAPIResult(); @@ -281,7 +281,7 @@ public class ModelHandlerFacade { if (!apexModel.getPolicyModel().getKey().equals(AxArtifactKey.getNullKey())) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, - MODEL + apexModel.getPolicyModel().getKey().getID() + ALREADY_LOADED); + MODEL + apexModel.getPolicyModel().getKey().getId() + ALREADY_LOADED); } URL apexModelURL; @@ -468,7 +468,7 @@ public class ModelHandlerFacade { PolicyModelSplitter.getSubPolicyModel(apexModel.getPolicyModel(), requiredPolicySet, false); ApexModelFileWriter<AxPolicyModel> apexModelFileWriter = new ApexModelFileWriter<>(false); - apexModelFileWriter.apexModelWriteJSONFile(splitPolicyModel, AxPolicyModel.class, targetModelName); + apexModelFileWriter.apexModelWriteJsonFile(splitPolicyModel, AxPolicyModel.class, targetModelName); return new ApexAPIResult(); } catch (ApexException e) { return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); @@ -503,7 +503,7 @@ public class ModelHandlerFacade { return splitResult; } catch (Exception e) { return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, - "split of policy model " + apexModel.getPolicyModel().getID() + " failed", e); + "split of policy model " + apexModel.getPolicyModel().getId() + " failed", e); } finally { if (tempSplitPolicyFile != null) { try { diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java index 97bf3da0d..1fe6d3599 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java @@ -116,7 +116,7 @@ public class PolicyFacade { } if (apexModel.getPolicyModel().getPolicies().getPolicyMap().containsKey(key)) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, CONCEPT + key.getID() + ALREADY_EXISTS); + return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, CONCEPT + key.getId() + ALREADY_EXISTS); } final AxPolicy policy = new AxPolicy(key); @@ -211,7 +211,7 @@ public class PolicyFacade { .writeString(removedPolicy, AxPolicy.class, jsonMode)); } else { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + key.getID() + DOES_NOT_EXIST); + CONCEPT + key.getId() + DOES_NOT_EXIST); } } @@ -291,7 +291,7 @@ public class PolicyFacade { if (policy.getStateMap().containsKey(refKey.getLocalName())) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, - CONCEPT + refKey.getID() + ALREADY_EXISTS); + CONCEPT + refKey.getId() + ALREADY_EXISTS); } final AxEvent triggerEvent = apexModel.getPolicyModel().getEvents().get(triggerName, triggerVersion); @@ -345,7 +345,7 @@ public class PolicyFacade { final AxState state = policy.getStateMap().get(stateName); if (state == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + policy.getKey().getID() + ':' + stateName + DOES_NOT_EXIST); + CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } if (triggerName != null) { @@ -401,7 +401,7 @@ public class PolicyFacade { } else { if (policy.getStateMap().size() == 0) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - "no states defined on policy " + policy.getKey().getID()); + "no states defined on policy " + policy.getKey().getId()); } final ApexAPIResult result = new ApexAPIResult(); for (final AxState state : policy.getStateMap().values()) { @@ -445,7 +445,7 @@ public class PolicyFacade { } else { if (policy.getStateMap().size() == 0) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - "no states defined on policy " + policy.getKey().getID()); + "no states defined on policy " + policy.getKey().getId()); } for (final AxState state : policy.getStateMap().values()) { result.addMessage( @@ -484,7 +484,7 @@ public class PolicyFacade { final AxState state = policy.getStateMap().get(stateName); if (state == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + policy.getKey().getID() + ':' + stateName + DOES_NOT_EXIST); + CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } // There is only one logic item associated with a state so we use a hard coded logic @@ -493,7 +493,7 @@ public class PolicyFacade { if (!state.getTaskSelectionLogic().getKey().getLocalName().equals(AxKey.NULL_KEY_NAME)) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, - CONCEPT + refKey.getID() + ALREADY_EXISTS); + CONCEPT + refKey.getId() + ALREADY_EXISTS); } state.setTaskSelectionLogic(new AxTaskSelectionLogic(refKey, logicFlavour, logic)); @@ -527,12 +527,12 @@ public class PolicyFacade { final AxState state = policy.getStateMap().get(stateName); if (state == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + policy.getKey().getID() + ':' + stateName + DOES_NOT_EXIST); + CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } if (state.getTaskSelectionLogic().getKey().getLocalName().equals(AxKey.NULL_KEY_NAME)) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + state.getTaskSelectionLogic().getKey().getID() + DOES_NOT_EXIST); + CONCEPT + state.getTaskSelectionLogic().getKey().getId() + DOES_NOT_EXIST); } final AxTaskSelectionLogic taskSelectionLogic = state.getTaskSelectionLogic(); @@ -571,7 +571,7 @@ public class PolicyFacade { final AxState state = policy.getStateMap().get(stateName); if (state == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + policy.getKey().getID() + ':' + stateName + DOES_NOT_EXIST); + CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } return new ApexAPIResult(ApexAPIResult.RESULT.SUCCESS, @@ -604,12 +604,12 @@ public class PolicyFacade { final AxState state = policy.getStateMap().get(stateName); if (state == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + policy.getKey().getID() + ':' + stateName + DOES_NOT_EXIST); + CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } if (state.getTaskSelectionLogic().getKey().getLocalName().equals(AxKey.NULL_KEY_NAME)) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + state.getTaskSelectionLogic().getKey().getID() + DOES_NOT_EXIST); + CONCEPT + state.getTaskSelectionLogic().getKey().getId() + DOES_NOT_EXIST); } final ApexAPIResult result = new ApexAPIResult(); @@ -651,13 +651,13 @@ public class PolicyFacade { final AxState state = policy.getStateMap().get(stateName); if (state == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - "State concept " + policy.getKey().getID() + ':' + stateName + DOES_NOT_EXIST); + "State concept " + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } final AxReferenceKey refKey = new AxReferenceKey(state.getKey(), outputName); if (state.getStateOutputs().containsKey(refKey.getLocalName())) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, - "Output concept " + refKey.getID() + ALREADY_EXISTS); + "Output concept " + refKey.getId() + ALREADY_EXISTS); } final AxEvent event = apexModel.getPolicyModel().getEvents().get(eventName, eventVersion); @@ -676,7 +676,7 @@ public class PolicyFacade { if (!policy.getStateMap().containsKey(nextState)) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - "Next state concept " + nextStateKey.getID() + DOES_NOT_EXIST); + "Next state concept " + nextStateKey.getId() + DOES_NOT_EXIST); } } @@ -710,7 +710,7 @@ public class PolicyFacade { final AxState state = policy.getStateMap().get(stateName); if (state == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + policy.getKey().getID() + ':' + stateName + DOES_NOT_EXIST); + CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } if (outputName != null) { @@ -721,12 +721,12 @@ public class PolicyFacade { AxStateOutput.class, jsonMode)); } else { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + state.getKey().getID() + ':' + outputName + DOES_NOT_EXIST); + CONCEPT + state.getKey().getId() + ':' + outputName + DOES_NOT_EXIST); } } else { if (state.getStateOutputs().size() == 0) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - "no state output concepts exist for state " + state.getKey().getID()); + "no state output concepts exist for state " + state.getKey().getId()); } final ApexAPIResult result = new ApexAPIResult(); @@ -765,7 +765,7 @@ public class PolicyFacade { final AxState state = policy.getStateMap().get(stateName); if (state == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + policy.getKey().getID() + ':' + stateName + DOES_NOT_EXIST); + CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } if (outputName != null) { @@ -778,12 +778,12 @@ public class PolicyFacade { return result; } else { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + state.getKey().getID() + ':' + outputName + DOES_NOT_EXIST); + CONCEPT + state.getKey().getId() + ':' + outputName + DOES_NOT_EXIST); } } else { if (state.getStateOutputs().size() == 0) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - "no state output concepts exist for state " + state.getKey().getID()); + "no state output concepts exist for state " + state.getKey().getId()); } final ApexAPIResult result = new ApexAPIResult(); @@ -827,14 +827,14 @@ public class PolicyFacade { final AxState state = policy.getStateMap().get(stateName); if (state == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + policy.getKey().getID() + ':' + stateName + DOES_NOT_EXIST); + CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } final AxReferenceKey refKey = new AxReferenceKey(state.getKey(), finalizerLogicName); if (state.getStateFinalizerLogicMap().containsKey(refKey.getLocalName())) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, - CONCEPT + refKey.getID() + ALREADY_EXISTS); + CONCEPT + refKey.getId() + ALREADY_EXISTS); } state.getStateFinalizerLogicMap().put(finalizerLogicName, @@ -872,7 +872,7 @@ public class PolicyFacade { final AxState state = policy.getStateMap().get(stateName); if (state == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + policy.getKey().getID() + ':' + stateName + DOES_NOT_EXIST); + CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } final AxReferenceKey refKey = new AxReferenceKey(state.getKey(), finalizerLogicName); @@ -880,7 +880,7 @@ public class PolicyFacade { state.getStateFinalizerLogicMap().get(refKey.getKey().getLocalName()); if (stateFinalizerLogic == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - STATE_FINALIZER_LOGIC + refKey.getID() + DOES_NOT_EXIST); + STATE_FINALIZER_LOGIC + refKey.getId() + DOES_NOT_EXIST); } if (logicFlavour != null) { @@ -919,7 +919,7 @@ public class PolicyFacade { final AxState state = policy.getStateMap().get(stateName); if (state == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + policy.getKey().getID() + ':' + stateName + DOES_NOT_EXIST); + CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } if (finalizerLogicName != null) { @@ -928,7 +928,7 @@ public class PolicyFacade { state.getStateFinalizerLogicMap().get(refKey.getKey().getLocalName()); if (stateFinalizerLogic == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - STATE_FINALIZER_LOGIC + refKey.getID() + DOES_NOT_EXIST); + STATE_FINALIZER_LOGIC + refKey.getId() + DOES_NOT_EXIST); } return new ApexAPIResult(ApexAPIResult.RESULT.SUCCESS, @@ -937,7 +937,7 @@ public class PolicyFacade { } else { if (state.getStateFinalizerLogicMap().size() == 0) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - "no state finalizer logic defined on state " + state.getKey().getID()); + "no state finalizer logic defined on state " + state.getKey().getId()); } final ApexAPIResult result = new ApexAPIResult(); for (final AxStateFinalizerLogic stateFinalizerLogic : state.getStateFinalizerLogicMap().values()) { @@ -974,7 +974,7 @@ public class PolicyFacade { final AxState state = policy.getStateMap().get(stateName); if (state == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + policy.getKey().getID() + ':' + stateName + DOES_NOT_EXIST); + CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } if (finalizerLogicName != null) { @@ -983,7 +983,7 @@ public class PolicyFacade { state.getStateFinalizerLogicMap().get(refKey.getKey().getLocalName()); if (stateFinalizerLogic == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - STATE_FINALIZER_LOGIC + refKey.getID() + DOES_NOT_EXIST); + STATE_FINALIZER_LOGIC + refKey.getId() + DOES_NOT_EXIST); } final ApexAPIResult result = new ApexAPIResult(); @@ -994,7 +994,7 @@ public class PolicyFacade { } else { if (state.getStateFinalizerLogicMap().size() == 0) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - "no state finalizer logic defined on state " + state.getKey().getID()); + "no state finalizer logic defined on state " + state.getKey().getId()); } final ApexAPIResult result = new ApexAPIResult(); @@ -1042,7 +1042,7 @@ public class PolicyFacade { final AxState state = policy.getStateMap().get(stateName); if (state == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + policy.getKey().getID() + ':' + stateName + DOES_NOT_EXIST); + CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } final AxTask task = apexModel.getPolicyModel().getTasks().get(taskName, taskVersion); @@ -1052,7 +1052,7 @@ public class PolicyFacade { } if (state.getTaskReferences().containsKey(task.getKey())) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, "task " + task.getKey().getID() + return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, "task " + task.getKey().getId() + " already has reference with output " + state.getTaskReferences().get(task.getKey())); } @@ -1070,12 +1070,12 @@ public class PolicyFacade { if (stateTaskOutputType.equals(AxStateTaskOutputType.DIRECT)) { if (!state.getStateOutputs().containsKey(outputRefKey.getLocalName())) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - "state output concept " + outputRefKey.getID() + DOES_NOT_EXIST); + "state output concept " + outputRefKey.getId() + DOES_NOT_EXIST); } } else if (stateTaskOutputType.equals(AxStateTaskOutputType.LOGIC)) { if (!state.getStateFinalizerLogicMap().containsKey(outputRefKey.getLocalName())) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - "state finalizer logic concept " + outputRefKey.getID() + DOES_NOT_EXIST); + "state finalizer logic concept " + outputRefKey.getId() + DOES_NOT_EXIST); } } else { return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, "output type " + outputType + " invalid"); @@ -1114,7 +1114,7 @@ public class PolicyFacade { final AxState state = policy.getStateMap().get(stateName); if (state == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + policy.getKey().getID() + ':' + stateName + DOES_NOT_EXIST); + CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } final ApexAPIResult result = new ApexAPIResult(); @@ -1138,7 +1138,7 @@ public class PolicyFacade { return result; } else { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - "no task references found for state " + state.getKey().getID()); + "no task references found for state " + state.getKey().getId()); } } catch (final Exception e) { return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); @@ -1169,7 +1169,7 @@ public class PolicyFacade { final AxState state = policy.getStateMap().get(stateName); if (state == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + policy.getKey().getID() + ':' + stateName + DOES_NOT_EXIST); + CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } final Set<AxArtifactKey> deleteSet = new TreeSet<>(); @@ -1183,7 +1183,7 @@ public class PolicyFacade { } if (deleteSet.isEmpty()) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + taskName + ':' + taskVersion + DOES_NOT_EXIST_ON_STATE + state.getKey().getID()); + CONCEPT + taskName + ':' + taskVersion + DOES_NOT_EXIST_ON_STATE + state.getKey().getId()); } final ApexAPIResult result = new ApexAPIResult(); @@ -1223,7 +1223,7 @@ public class PolicyFacade { final AxState state = policy.getStateMap().get(stateName); if (state == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + policy.getKey().getID() + ':' + stateName + DOES_NOT_EXIST); + CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } final AxContextAlbum contextAlbum = @@ -1235,7 +1235,7 @@ public class PolicyFacade { if (state.getContextAlbumReferences().contains(contextAlbum.getKey())) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, "concept album reference for concept " - + contextAlbum.getKey().getID() + " already exists in state"); + + contextAlbum.getKey().getId() + " already exists in state"); } state.getContextAlbumReferences().add(contextAlbum.getKey()); @@ -1271,7 +1271,7 @@ public class PolicyFacade { final AxState state = policy.getStateMap().get(stateName); if (state == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + policy.getKey().getID() + ':' + stateName + DOES_NOT_EXIST); + CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } final ApexAPIResult result = new ApexAPIResult(); @@ -1287,7 +1287,7 @@ public class PolicyFacade { } if (!found) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, CONCEPT + contextAlbumName + ':' - + contextAlbumVersion + DOES_NOT_EXIST_ON_STATE + state.getKey().getID()); + + contextAlbumVersion + DOES_NOT_EXIST_ON_STATE + state.getKey().getId()); } return result; } catch (final Exception e) { @@ -1321,7 +1321,7 @@ public class PolicyFacade { final AxState state = policy.getStateMap().get(stateName); if (state == null) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + policy.getKey().getID() + ':' + stateName + DOES_NOT_EXIST); + CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } final Set<AxArtifactKey> deleteSet = new TreeSet<>(); @@ -1337,7 +1337,7 @@ public class PolicyFacade { } if (deleteSet.isEmpty()) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, CONCEPT + contextAlbumName + ':' - + contextAlbumVersion + DOES_NOT_EXIST_ON_STATE + state.getKey().getID()); + + contextAlbumVersion + DOES_NOT_EXIST_ON_STATE + state.getKey().getId()); } final ApexAPIResult result = new ApexAPIResult(); diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/TaskFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/TaskFacade.java index dd00da7d4..5cb2e7475 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/TaskFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/TaskFacade.java @@ -101,7 +101,7 @@ public class TaskFacade { } if (apexModel.getPolicyModel().getTasks().getTaskMap().containsKey(key)) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, CONCEPT + key.getID() + ALREADY_EXISTS); + return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, CONCEPT + key.getId() + ALREADY_EXISTS); } apexModel.getPolicyModel().getTasks().getTaskMap().put(key, new AxTask(key)); @@ -182,7 +182,7 @@ public class TaskFacade { new ApexModelStringWriter<AxTask>(false).writeString(removedTask, AxTask.class, jsonMode)); } else { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + key.getID() + DOES_NOT_EXIST); + CONCEPT + key.getId() + DOES_NOT_EXIST); } } @@ -256,7 +256,7 @@ public class TaskFacade { if (!task.getTaskLogic().getKey().getLocalName().equals(AxKey.NULL_KEY_NAME)) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, - CONCEPT + refKey.getID() + ALREADY_EXISTS); + CONCEPT + refKey.getId() + ALREADY_EXISTS); } task.setTaskLogic(new AxTaskLogic(refKey, logicFlavour, logic)); @@ -286,7 +286,7 @@ public class TaskFacade { if (task.getTaskLogic().getKey().getLocalName().equals(AxKey.NULL_KEY_NAME)) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + task.getTaskLogic().getKey().getID() + DOES_NOT_EXIST); + CONCEPT + task.getTaskLogic().getKey().getId() + DOES_NOT_EXIST); } final AxTaskLogic taskLogic = task.getTaskLogic(); @@ -342,7 +342,7 @@ public class TaskFacade { if (task.getTaskLogic().getKey().getLocalName().equals(AxKey.NULL_KEY_NAME)) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - CONCEPT + task.getTaskLogic().getKey().getID() + DOES_NOT_EXIST); + CONCEPT + task.getTaskLogic().getKey().getId() + DOES_NOT_EXIST); } final ApexAPIResult result = new ApexAPIResult(); @@ -383,7 +383,7 @@ public class TaskFacade { if (task.getInputFields().containsKey(refKey.getLocalName())) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, - CONCEPT + refKey.getID() + ALREADY_EXISTS); + CONCEPT + refKey.getId() + ALREADY_EXISTS); } final AxContextSchema schema = @@ -430,7 +430,7 @@ public class TaskFacade { } else { if (task.getInputFields().size() == 0) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - "no input fields defined on task " + task.getKey().getID()); + "no input fields defined on task " + task.getKey().getId()); } final ApexAPIResult result = new ApexAPIResult(); @@ -476,7 +476,7 @@ public class TaskFacade { } else { if (task.getInputFields().size() == 0) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - "no input fields defined on task " + task.getKey().getID()); + "no input fields defined on task " + task.getKey().getId()); } for (final AxInputField field : task.getInputFields().values()) { @@ -520,7 +520,7 @@ public class TaskFacade { if (task.getOutputFields().containsKey(refKey.getLocalName())) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, - CONCEPT + refKey.getID() + ALREADY_EXISTS); + CONCEPT + refKey.getId() + ALREADY_EXISTS); } final AxContextSchema schema = @@ -567,7 +567,7 @@ public class TaskFacade { } else { if (task.getOutputFields().size() == 0) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - "no output fields defined on task " + task.getKey().getID()); + "no output fields defined on task " + task.getKey().getId()); } final ApexAPIResult result = new ApexAPIResult(); @@ -612,7 +612,7 @@ public class TaskFacade { } else { if (task.getOutputFields().size() == 0) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - "no output fields defined on task " + task.getKey().getID()); + "no output fields defined on task " + task.getKey().getId()); } for (final AxOutputField field : task.getOutputFields().values()) { @@ -651,7 +651,7 @@ public class TaskFacade { if (task.getTaskParameters().containsKey(refKey.getLocalName())) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, - CONCEPT + refKey.getID() + ALREADY_EXISTS); + CONCEPT + refKey.getId() + ALREADY_EXISTS); } task.getTaskParameters().put(refKey.getLocalName(), new AxTaskParameter(refKey, defaultValue)); @@ -690,7 +690,7 @@ public class TaskFacade { } else { if (task.getTaskParameters().size() == 0) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - "no task parameters defined on task " + task.getKey().getID()); + "no task parameters defined on task " + task.getKey().getId()); } final ApexAPIResult result = new ApexAPIResult(); @@ -735,7 +735,7 @@ public class TaskFacade { } else { if (task.getTaskParameters().size() == 0) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, - "no task parameters defined on task " + task.getKey().getID()); + "no task parameters defined on task " + task.getKey().getId()); } for (final AxTaskParameter parameter : task.getTaskParameters().values()) { @@ -778,7 +778,7 @@ public class TaskFacade { if (task.getContextAlbumReferences().contains(contextAlbum.getKey())) { return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, "context album reference for concept " - + contextAlbum.getKey().getID() + " already exists in task"); + + contextAlbum.getKey().getId() + " already exists in task"); } task.getContextAlbumReferences().add(contextAlbum.getKey()); diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexModelAPI.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexModelAPI.java index 68341249c..c3521d307 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexModelAPI.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexModelAPI.java @@ -35,7 +35,7 @@ import java.util.UUID; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.modelapi.impl.ApexModelImpl; import org.onap.policy.apex.model.utilities.TextFileUtils; @@ -114,29 +114,29 @@ public class TestApexModelAPI { ApexAPIResult result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.json"); assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); - final DAOParameters daoParameters = new DAOParameters(); - daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); - daoParameters.setPersistenceUnit("DAOTest"); + final DaoParameters DaoParameters = new DaoParameters(); + DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); + DaoParameters.setPersistenceUnit("DAOTest"); - result = apexModel.saveToDatabase(daoParameters); + result = apexModel.saveToDatabase(DaoParameters); assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); result = apexModel.deleteModel(); assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); - result = apexModel.loadFromDatabase("PolicyModel", "0.0.1", daoParameters); + result = apexModel.loadFromDatabase("PolicyModel", "0.0.1", DaoParameters); assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); result = apexModel.deleteModel(); assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); - result = apexModel.loadFromDatabase("PolicyModel", null, daoParameters); + result = apexModel.loadFromDatabase("PolicyModel", null, DaoParameters); assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); result = apexModel.deleteModel(); assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); - result = apexModel.loadFromDatabase("VPNPolicyModel", "0.0.1", daoParameters); + result = apexModel.loadFromDatabase("VPNPolicyModel", "0.0.1", DaoParameters); assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); } diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestModelHandlerFacade.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestModelHandlerFacade.java index f13b8dfd5..7439cd328 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestModelHandlerFacade.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestModelHandlerFacade.java @@ -29,7 +29,7 @@ import java.io.IOException; import java.util.Properties; import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.modelapi.impl.ModelHandlerFacade; import org.onap.policy.apex.model.utilities.TextFileUtils; @@ -77,17 +77,17 @@ public class TestModelHandlerFacade { result = mhf.loadFromString(modelString); assertEquals(ApexAPIResult.RESULT.CONCEPT_EXISTS, result.getResult()); - final DAOParameters daoParameters = new DAOParameters(); - result = mhf.loadFromDatabase("SomeModel", null, daoParameters); + final DaoParameters DaoParameters = new DaoParameters(); + result = mhf.loadFromDatabase("SomeModel", null, DaoParameters); assertEquals(ApexAPIResult.RESULT.CONCEPT_EXISTS, result.getResult()); result = apexModel.deleteModel(); assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); - result = mhf.loadFromDatabase("SomeModel", null, daoParameters); + result = mhf.loadFromDatabase("SomeModel", null, DaoParameters); assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = mhf.saveToDatabase(daoParameters); + result = mhf.saveToDatabase(DaoParameters); assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); result = mhf.readFromURL("blah://somewhere/over/the/rainbow"); diff --git a/model/model-api/src/test/resources/META-INF/persistence.xml b/model/model-api/src/test/resources/META-INF/persistence.xml index 3db74174c..f834e0f49 100644 --- a/model/model-api/src/test/resources/META-INF/persistence.xml +++ b/model/model-api/src/test/resources/META-INF/persistence.xml @@ -23,8 +23,8 @@ <persistence-unit name="DAOTest" transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner</class> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxConcept</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class> diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java index a537d90b9..2fc4467dc 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java @@ -42,7 +42,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult; -import org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner; +import org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner; import org.onap.policy.apex.model.basicmodel.xml.AxReferenceKeyAdapter; import org.onap.policy.apex.model.utilities.Assertions; @@ -99,8 +99,8 @@ public class AxLogic extends AxConcept { private String logicFlavour; @Column(name = "logic", length = MAX_LOGIC_SIZE) - @Convert(converter = CDATAConditioner.class) - @XmlJavaTypeAdapter(value = CDATAConditioner.class) + @Convert(converter = CDataConditioner.class) + @XmlJavaTypeAdapter(value = CDataConditioner.class) @XmlElement(required = true) private String logic; @@ -385,8 +385,8 @@ public class AxLogic extends AxConcept { if (!logicFlavour.equals(other.logicFlavour)) { return false; } - final String thislogic = CDATAConditioner.clean(logic).replaceAll("\n", ""); - final String otherlogic = CDATAConditioner.clean(other.logic).replaceAll("\n", ""); + final String thislogic = CDataConditioner.clean(logic).replaceAll("\n", ""); + final String otherlogic = CDataConditioner.clean(other.logic).replaceAll("\n", ""); return thislogic.equals(otherlogic); } diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java index ff7e4a23f..8b87c41ce 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java @@ -303,7 +303,7 @@ public class AxPolicy extends AxConcept { // Validation continues from this point only if all validation checks this far have been // passed - if (!result.isOK()) { + if (!result.isOk()) { return result; } @@ -361,7 +361,7 @@ public class AxPolicy extends AxConcept { && !stateMap.containsKey(stateOutput.getNextState().getLocalName())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, " nextState of state " + stateEntry.getKey() + " not found in StateMap: " - + stateOutput.getNextState().getID())); + + stateOutput.getNextState().getId())); } } diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java index f6000b1f3..ad465a48e 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java @@ -382,7 +382,7 @@ public class AxPolicyModel extends AxModel { if (getSchemas().get(field.getSchema()) == null) { result.addValidationMessage( new AxValidationMessage(event.getKey(), this.getClass(), ValidationResult.INVALID, - "event field data type " + field.getSchema().getID() + DOES_NOT_EXIST)); + "event field data type " + field.getSchema().getId() + DOES_NOT_EXIST)); } } } @@ -400,7 +400,7 @@ public class AxPolicyModel extends AxModel { if (getSchemas().get(contextAlbum.getItemSchema()) == null) { result.addValidationMessage( new AxValidationMessage(contextAlbum.getKey(), this.getClass(), ValidationResult.INVALID, - "context album schema " + contextAlbum.getItemSchema().getID() + DOES_NOT_EXIST)); + "context album schema " + contextAlbum.getItemSchema().getId() + DOES_NOT_EXIST)); } } return result; @@ -431,20 +431,20 @@ public class AxPolicyModel extends AxModel { if (getSchemas().get(field.getSchema()) == null) { result.addValidationMessage( new AxValidationMessage(task.getKey(), this.getClass(), ValidationResult.INVALID, - "task input field schema " + field.getSchema().getID() + DOES_NOT_EXIST)); + "task input field schema " + field.getSchema().getId() + DOES_NOT_EXIST)); } } for (final AxField field : task.getOutputFieldSet()) { if (getSchemas().get(field.getSchema()) == null) { result.addValidationMessage( new AxValidationMessage(task.getKey(), this.getClass(), ValidationResult.INVALID, - "task output field schema " + field.getSchema().getID() + DOES_NOT_EXIST)); + "task output field schema " + field.getSchema().getId() + DOES_NOT_EXIST)); } } for (final AxArtifactKey contextAlbumKey : task.getContextAlbumReferences()) { if (albums.get(contextAlbumKey) == null) { result.addValidationMessage(new AxValidationMessage(task.getKey(), this.getClass(), - ValidationResult.INVALID, "task context album " + contextAlbumKey.getID() + DOES_NOT_EXIST)); + ValidationResult.INVALID, "task context album " + contextAlbumKey.getId() + DOES_NOT_EXIST)); } } return result; @@ -476,20 +476,20 @@ public class AxPolicyModel extends AxModel { for (final AxArtifactKey contextAlbumKey : state.getContextAlbumReferences()) { if (albums.get(contextAlbumKey) == null) { result.addValidationMessage(new AxValidationMessage(state.getKey(), this.getClass(), - ValidationResult.INVALID, "state context album " + contextAlbumKey.getID() + DOES_NOT_EXIST)); + ValidationResult.INVALID, "state context album " + contextAlbumKey.getId() + DOES_NOT_EXIST)); } } final AxEvent triggerEvent = events.getEventMap().get(state.getTrigger()); if (triggerEvent == null) { result.addValidationMessage(new AxValidationMessage(state.getKey(), this.getClass(), - ValidationResult.INVALID, "state trigger event " + state.getTrigger().getID() + DOES_NOT_EXIST)); + ValidationResult.INVALID, "state trigger event " + state.getTrigger().getId() + DOES_NOT_EXIST)); } final AxTask defaultTask = tasks.getTaskMap().get(state.getDefaultTask()); if (defaultTask == null) { result.addValidationMessage(new AxValidationMessage(state.getKey(), this.getClass(), - ValidationResult.INVALID, "state default task " + state.getDefaultTask().getID() + DOES_NOT_EXIST)); + ValidationResult.INVALID, "state default task " + state.getDefaultTask().getId() + DOES_NOT_EXIST)); } // Check task input fields and event fields are compatible for default tasks with no task @@ -501,15 +501,15 @@ public class AxPolicyModel extends AxModel { for (final AxField unhandledTaskInputField : unhandledTaskInputFields) { result.addValidationMessage(new AxValidationMessage(state.getKey(), this.getClass(), ValidationResult.INVALID, "task input field " + unhandledTaskInputField + " for task " - + defaultTask.getID() + " not in trigger event " + triggerEvent.getID())); + + defaultTask.getId() + " not in trigger event " + triggerEvent.getId())); } } for (final AxStateOutput stateOutput : state.getStateOutputs().values()) { if (events.getEventMap().get(stateOutput.getOutgingEvent()) == null) { result.addValidationMessage(new AxValidationMessage(stateOutput.getKey(), this.getClass(), - ValidationResult.INVALID, "output event " + stateOutput.getOutgingEvent().getID() - + " for state output " + stateOutput.getID() + DOES_NOT_EXIST)); + ValidationResult.INVALID, "output event " + stateOutput.getOutgingEvent().getId() + + " for state output " + stateOutput.getId() + DOES_NOT_EXIST)); } } @@ -534,7 +534,7 @@ public class AxPolicyModel extends AxModel { final AxTask usedTask = tasks.getTaskMap().get(taskRefEntry.getKey()); if (usedTask == null) { result.addValidationMessage(new AxValidationMessage(state.getKey(), this.getClass(), - ValidationResult.INVALID, "state task " + taskRefEntry.getKey().getID() + DOES_NOT_EXIST)); + ValidationResult.INVALID, "state task " + taskRefEntry.getKey().getId() + DOES_NOT_EXIST)); } else { AxStateOutput stateOutput = state.getStateOutputs().get(taskRefEntry.getValue().getOutput().getKey().getLocalName()); @@ -556,14 +556,14 @@ public class AxPolicyModel extends AxModel { final AxStateOutput stateOutput, AxValidationResult result) { if (stateOutput == null) { result.addValidationMessage(new AxValidationMessage(state.getKey(), this.getClass(), - ValidationResult.INVALID, "state output on task reference for task " + task.getID() + " is null")); + ValidationResult.INVALID, "state output on task reference for task " + task.getId() + " is null")); } else { final AxEvent usedEvent = events.getEventMap().get(stateOutput.getOutgingEvent()); if (usedEvent == null) { result.addValidationMessage(new AxValidationMessage(stateOutput.getKey(), this.getClass(), - ValidationResult.INVALID, "output event " + stateOutput.getOutgingEvent().getID() - + " for state output " + stateOutput.getID() + DOES_NOT_EXIST)); + ValidationResult.INVALID, "output event " + stateOutput.getOutgingEvent().getId() + + " for state output " + stateOutput.getId() + DOES_NOT_EXIST)); } if (task != null && usedEvent != null) { @@ -572,7 +572,7 @@ public class AxPolicyModel extends AxModel { for (final AxField unhandledTaskOutputField : unhandledTaskOutputFields) { result.addValidationMessage(new AxValidationMessage(state.getKey(), this.getClass(), ValidationResult.INVALID, "task output field " + unhandledTaskOutputField + " for task " - + task.getID() + " not in output event " + usedEvent.getID())); + + task.getId() + " not in output event " + usedEvent.getId())); } } } diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxState.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxState.java index 895232e1c..6851e4859 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxState.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxState.java @@ -685,7 +685,7 @@ public class AxState extends AxConcept { if (!taskSelectionLogic.getKey().equals(AxReferenceKey.getNullKey())) { if (!taskSelectionLogic.getKey().getParentReferenceKey().equals(key)) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "taskSelectionLogic key " + taskSelectionLogic.getKey().getID() + DOES_NOT_EQUAL_STATE_KEY)); + "taskSelectionLogic key " + taskSelectionLogic.getKey().getId() + DOES_NOT_EQUAL_STATE_KEY)); } result = taskSelectionLogic.validate(result); } @@ -707,7 +707,7 @@ public class AxState extends AxConcept { } else { if (!stateFinalizerLogicEntry.getValue().getKey().getParentReferenceKey().equals(key)) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "stateFinalizerLogic parent key " + stateFinalizerLogicEntry.getValue().getKey().getID() + "stateFinalizerLogic parent key " + stateFinalizerLogicEntry.getValue().getKey().getId() + DOES_NOT_EQUAL_STATE_KEY)); } @@ -778,7 +778,7 @@ public class AxState extends AxConcept { Set<String> stateFinalizerLogicNameSet, AxValidationResult result) { if (!taskReference.getKey().getParentReferenceKey().equals(key)) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "stateTaskReference parent key " + taskReference.getKey().getID() + DOES_NOT_EQUAL_STATE_KEY)); + "stateTaskReference parent key " + taskReference.getKey().getId() + DOES_NOT_EQUAL_STATE_KEY)); } if (taskReference.getStateTaskOutputType().equals(AxStateTaskOutputType.DIRECT)) { diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskReference.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskReference.java index 011af6cbb..8a43e371d 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskReference.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskReference.java @@ -269,7 +269,7 @@ public class AxStateTaskReference extends AxConcept { if (output.equals(AxReferenceKey.getNullKey())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "output key " + output.getID() + " is a null key")); + "output key " + output.getId() + " is a null key")); } result = output.validate(result); diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTree.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTree.java index 30076ca0b..478608ca4 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTree.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTree.java @@ -73,7 +73,7 @@ public class AxStateTree implements Comparable<AxStateTree> { // Check for state tree loops if (referencedStateNameSet.contains(nextState.getKey())) { - throw new PolicyRuntimeException("loop detected in state tree for policy " + policy.getID() + " state " + throw new PolicyRuntimeException("loop detected in state tree for policy " + policy.getId() + " state " + thisState.getKey().getLocalName() + ", next state " + nextState.getKey().getLocalName() + " referenced more than once"); } diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java index b1f26f6c0..f26331671 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java @@ -483,7 +483,7 @@ public class AxTask extends AxConcept { if (!taskLogic.getKey().getParentArtifactKey().equals(key)) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "taskLogic parent key " + taskLogic.getKey().getID() + DOES_NOT_EQUAL_TASK_KEY)); + "taskLogic parent key " + taskLogic.getKey().getId() + DOES_NOT_EQUAL_TASK_KEY)); } return taskLogic.validate(result); diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalysisResult.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalysisResult.java index d59af7cba..2f5cd43d8 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalysisResult.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalysisResult.java @@ -212,7 +212,7 @@ public class PolicyAnalysisResult { builder.append('\n'); for (final Entry<? extends AxKey, Set<AxKey>> usageEntry : usageMap.entrySet()) { builder.append(" "); - builder.append(usageEntry.getKey().getID()); + builder.append(usageEntry.getKey().getId()); if (usageEntry.getValue().isEmpty()) { builder.append(" (unused)\n"); continue; @@ -221,7 +221,7 @@ public class PolicyAnalysisResult { builder.append('\n'); for (final AxKey usageKey : usageEntry.getValue()) { builder.append(" "); - builder.append(usageKey.getID()); + builder.append(usageKey.getId()); builder.append("\n"); } } diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/DummyLogicReader.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/DummyLogicReader.java index 28f70f48b..093ed483e 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/DummyLogicReader.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/DummyLogicReader.java @@ -23,9 +23,6 @@ package org.onap.policy.apex.model.policymodel.concepts; import org.onap.policy.apex.model.policymodel.concepts.AxLogic; import org.onap.policy.apex.model.policymodel.concepts.AxLogicReader; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class DummyLogicReader implements AxLogicReader { /* 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 a415a1c69..3b1fc6b8f 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 @@ -83,8 +83,8 @@ public class TestLogic { final AxReferenceKey logicKey = new AxReferenceKey("LogicParentName", "0.0.1", "PLN", "LN"); logic.setKey(logicKey); - assertEquals("LogicParentName:0.0.1:PLN:LN", logic.getKey().getID()); - assertEquals("LogicParentName:0.0.1:PLN:LN", logic.getKeys().get(0).getID()); + assertEquals("LogicParentName:0.0.1:PLN:LN", logic.getKey().getId()); + assertEquals("LogicParentName:0.0.1:PLN:LN", logic.getKeys().get(0).getId()); logic.setLogicFlavour("LogicFlavour"); assertEquals("LogicFlavour", logic.getLogicFlavour()); 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 9da944b60..b2a3911bf 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 @@ -76,8 +76,8 @@ public class TestPolicies { } policy.setKey(policyKey); - assertEquals("PolicyName:0.0.1", policy.getKey().getID()); - assertEquals("PolicyName:0.0.1", policy.getKeys().get(0).getID()); + assertEquals("PolicyName:0.0.1", policy.getKey().getId()); + assertEquals("PolicyName:0.0.1", policy.getKeys().get(0).getId()); try { policy.setTemplate(null); @@ -109,7 +109,7 @@ public class TestPolicies { policy.setFirstState("FirstState"); assertEquals("FirstState", policy.getFirstState()); - assertEquals("PolicyName:0.0.1", policy.getKeys().get(0).getID()); + assertEquals("PolicyName:0.0.1", policy.getKeys().get(0).getId()); policy = new TestApexPolicyModelCreator().getModel().getPolicies().get("policy"); @@ -269,7 +269,7 @@ public class TestPolicies { // Invalid, no events in event map policies.setKey(new AxArtifactKey("PoliciesKey", "0.0.1")); - assertEquals("PoliciesKey:0.0.1", policies.getKey().getID()); + assertEquals("PoliciesKey:0.0.1", policies.getKey().getId()); result = new AxValidationResult(); result = policies.validate(result); 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 db1d1ee62..5df831cc7 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 @@ -75,7 +75,7 @@ public class TestPolicyModel { model.register(); assertNotNull(model.getContextModel()); - assertEquals("ModelKey:0.0.1", model.getKeys().get(0).getID()); + assertEquals("ModelKey:0.0.1", model.getKeys().get(0).getId()); model.clean(); assertNotNull(model); 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 1d62ae63a..c53fff1ca 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 @@ -86,8 +86,8 @@ public class TestState { } state.setKey(stateKey); - assertEquals("PolicyName:0.0.1:NULL:StateName", state.getKey().getID()); - assertEquals("PolicyName:0.0.1:NULL:StateName", state.getKeys().get(0).getID()); + 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 soU = new AxStateOutput(new AxReferenceKey(stateKey, "SOU"), triggerKey, stateKeyNext); 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 5911d41be..5306b7642 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 @@ -60,8 +60,8 @@ public class TestStateOutput { } so.setKey(soKey); - assertEquals("SOStateParent:0.0.1:SOState:SOName", so.getKey().getID()); - assertEquals("SOStateParent:0.0.1:SOState:SOName", so.getKeys().get(0).getID()); + assertEquals("SOStateParent:0.0.1:SOState:SOName", so.getKey().getId()); + assertEquals("SOStateParent:0.0.1:SOState:SOName", so.getKeys().get(0).getId()); try { so.setNextState(null); 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 c85fda4be..eeaf19e07 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 @@ -62,8 +62,8 @@ public class TestStateTaskReference { } stRef.setKey(stRefKey); - assertEquals("StateParent:0.0.1:SOState:SOName", stRef.getKey().getID()); - assertEquals("StateParent:0.0.1:SOState:SOName", stRef.getKeys().get(0).getID()); + assertEquals("StateParent:0.0.1:SOState:SOName", stRef.getKey().getId()); + assertEquals("StateParent:0.0.1:SOState:SOName", stRef.getKeys().get(0).getId()); try { stRef.setStateTaskOutputType(null); 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 63906add2..ff6ab42b8 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 @@ -49,8 +49,8 @@ public class TestTaskParameter { final AxReferenceKey parKey = new AxReferenceKey("ParParentName", "0.0.1", "PLN", "LN"); par.setKey(parKey); - assertEquals("ParParentName:0.0.1:PLN:LN", par.getKey().getID()); - assertEquals("ParParentName:0.0.1:PLN:LN", par.getKeys().get(0).getID()); + assertEquals("ParParentName:0.0.1:PLN:LN", par.getKey().getId()); + assertEquals("ParParentName:0.0.1:PLN:LN", par.getKeys().get(0).getId()); par.setDefaultValue("DefaultValue"); assertEquals("DefaultValue", par.getTaskParameterValue()); 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 967e4e0aa..78691accb 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 @@ -67,8 +67,8 @@ public class TestTasks { final AxArtifactKey taskKey = new AxArtifactKey("TaskName", "0.0.1"); task.setKey(taskKey); - assertEquals("TaskName:0.0.1", task.getKey().getID()); - assertEquals("TaskName:0.0.1", task.getKeys().get(0).getID()); + assertEquals("TaskName:0.0.1", task.getKey().getId()); + assertEquals("TaskName:0.0.1", task.getKeys().get(0).getId()); final AxArtifactKey f0SchemaKey = new AxArtifactKey("FS0", "0.0.1"); @@ -114,8 +114,8 @@ public class TestTasks { assertEquals(tl, task.getTaskLogic()); task.setKey(taskKey); - assertEquals("TaskName:0.0.1", task.getKey().getID()); - assertEquals("TaskName:0.0.1", task.getKeys().get(0).getID()); + assertEquals("TaskName:0.0.1", task.getKey().getId()); + assertEquals("TaskName:0.0.1", task.getKeys().get(0).getId()); task.afterUnmarshal(null, null); assertEquals(1, task.getTaskParameters().size()); @@ -256,7 +256,7 @@ public class TestTasks { // Invalid, no tasks in task map tasks.setKey(new AxArtifactKey("TasksKey", "0.0.1")); - assertEquals("TasksKey:0.0.1", tasks.getKey().getID()); + assertEquals("TasksKey:0.0.1", tasks.getKey().getId()); result = new AxValidationResult(); result = tasks.validate(result); 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 b3fd4a1b0..5dfeede0a 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 @@ -31,7 +31,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.test.TestApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; @@ -86,21 +86,21 @@ public class TestApexPolicyModel { @Test public void testModelWriteReadXML() throws Exception { - testApexModel.testApexModelWriteReadXML(); + testApexModel.testApexModelWriteReadXml(); } @Test public void testModelWriteReadJSON() throws Exception { - testApexModel.testApexModelWriteReadJSON(); + testApexModel.testApexModelWriteReadJson(); } @Test public void testModelWriteReadJPA() throws Exception { - final DAOParameters daoParameters = new DAOParameters(); - daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); - daoParameters.setPersistenceUnit("DAOTest"); + final DaoParameters DaoParameters = new DaoParameters(); + DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); + DaoParameters.setPersistenceUnit("DAOTest"); - testApexModel.testApexModelWriteReadJPA(daoParameters); + testApexModel.testApexModelWriteReadJpa(DaoParameters); } private static final String VALID_MODEL_STRING = "***validation of model successful***"; diff --git a/model/policy-model/src/test/resources/META-INF/persistence.xml b/model/policy-model/src/test/resources/META-INF/persistence.xml index 6131c82d1..cd9a420d0 100644 --- a/model/policy-model/src/test/resources/META-INF/persistence.xml +++ b/model/policy-model/src/test/resources/META-INF/persistence.xml @@ -23,8 +23,8 @@ <persistence-unit name="DAOTest" transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner</class> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxConcept</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class> diff --git a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/TextFileUtils.java b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/TextFileUtils.java index 97face9bd..29e31d6e6 100644 --- a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/TextFileUtils.java +++ b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/TextFileUtils.java @@ -103,7 +103,8 @@ public abstract class TextFileUtils { if (charsRead > 0) { builder.append(chars, 0, charsRead); } - } while (charsRead > 0); + } + while (charsRead > 0); return builder.toString(); } } diff --git a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/CollectionUtilitiesTest.java b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/CollectionUtilitiesTest.java index 4682d985d..e9ddc11bc 100644 --- a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/CollectionUtilitiesTest.java +++ b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/CollectionUtilitiesTest.java @@ -28,24 +28,22 @@ import java.util.List; import org.junit.Test; import org.onap.policy.apex.model.utilities.CollectionUtils; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class CollectionUtilitiesTest { @Test public void testNullLists() { - List<String> leftList = new ArrayList<String>(); - List<String> rightList = new ArrayList<String>(); - int result = 0; result = CollectionUtils.compareLists(null, null); assertEquals(0, result); + List<String> leftList = new ArrayList<String>(); + result = CollectionUtils.compareLists(leftList, null); assertEquals(-1, result); + List<String> rightList = new ArrayList<String>(); + result = CollectionUtils.compareLists(null, rightList); assertEquals(1, result); @@ -73,8 +71,8 @@ public class CollectionUtilitiesTest { result = CollectionUtils.compareLists(leftList, rightList); assertEquals(-1, result); - leftList.remove(leftList.size() -1); - rightList.remove(rightList.size() -1); + leftList.remove(leftList.size() - 1); + rightList.remove(rightList.size() - 1); result = CollectionUtils.compareLists(leftList, rightList); assertEquals(0, result); @@ -83,8 +81,8 @@ public class CollectionUtilitiesTest { result = CollectionUtils.compareLists(leftList, rightList); assertEquals(1, result); - leftList.remove(leftList.size() -1); - rightList.remove(rightList.size() -1); + leftList.remove(leftList.size() - 1); + rightList.remove(rightList.size() - 1); result = CollectionUtils.compareLists(leftList, rightList); assertEquals(0, result); } diff --git a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/DirectoryUtilsTest.java b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/DirectoryUtilsTest.java index 84e9733f3..95839cd72 100644 --- a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/DirectoryUtilsTest.java +++ b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/DirectoryUtilsTest.java @@ -29,9 +29,6 @@ import org.junit.Test; import org.onap.policy.apex.model.utilities.DirectoryUtils; import org.onap.policy.apex.model.utilities.TextFileUtils; -/** - * @author Liam Fallon (liam.fallon@ericsson.com) - */ public class DirectoryUtilsTest { @Test diff --git a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/json/JSONHandlerTest.java b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/json/JsonHandlerTest.java index b8e2cebbc..c9db6c395 100644 --- a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/json/JSONHandlerTest.java +++ b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/json/JsonHandlerTest.java @@ -17,10 +17,13 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ + package org.onap.policy.apex.model.utilities.json; import static org.junit.Assert.assertEquals; +import com.google.gson.GsonBuilder; + import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -28,9 +31,7 @@ import java.nio.charset.StandardCharsets; import org.junit.Test; -import com.google.gson.GsonBuilder; - -public class JSONHandlerTest { +public class JsonHandlerTest { private static final String VALUE = "value"; diff --git a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributor.java b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributor.java index 2b17b17cf..9d35c30a8 100644 --- a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributor.java +++ b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributor.java @@ -85,8 +85,8 @@ public class HazelcastContextDistributor extends AbstractDistributor { @Override public Map<String, Object> getContextAlbumMap(final AxArtifactKey contextAlbumKey) { // Get the map from Hazelcast - LOGGER.info("HazelcastContextDistributor: create album: " + contextAlbumKey.getID()); - return hazelcastInstance.getMap(contextAlbumKey.getID()); + LOGGER.info("HazelcastContextDistributor: create album: " + contextAlbumKey.getId()); + return hazelcastInstance.getMap(contextAlbumKey.getId()); } /* diff --git a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributor.java b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributor.java index d6a04dd7c..9f1327df1 100644 --- a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributor.java +++ b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributor.java @@ -91,11 +91,11 @@ public class InfinispanContextDistributor extends AbstractDistributor { */ @Override public Map<String, Object> getContextAlbumMap(final AxArtifactKey contextAlbumKey) { - LOGGER.info("InfinispanContextDistributor: create album: " + contextAlbumKey.getID()); + LOGGER.info("InfinispanContextDistributor: create album: " + contextAlbumKey.getId()); // Get the Cache from Infinispan final Cache<String, Object> infinispanCache = - infinispanManager.getCacheManager().getCache(contextAlbumKey.getID().replace(':', '_')); + infinispanManager.getCacheManager().getCache(contextAlbumKey.getId().replace(':', '_')); return infinispanCache; } diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java index dc281a52b..20e701bc7 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java @@ -102,7 +102,7 @@ public class AvroBytesObjectMapper implements AvroObjectMapper { // The Avro object should be a Utf8 object if (!(avroObject instanceof ByteBuffer)) { final String returnString = - userKey.getID() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() + userKey.getId() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() + "\" cannot be decoded to an object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); @@ -127,7 +127,7 @@ public class AvroBytesObjectMapper implements AvroObjectMapper { @Override public Object mapToAvro(final Object object) { if (object == null) { - final String returnString = userKey.getID() + ": cannot encode a null object of class \"" + final String returnString = userKey.getId() + ": cannot encode a null object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); @@ -135,7 +135,7 @@ public class AvroBytesObjectMapper implements AvroObjectMapper { // The incoming object should be a byte array if (!(object instanceof byte[])) { - final String returnString = userKey.getID() + ": object \"" + object + "\" of class \"" + object.getClass() + final String returnString = userKey.getId() + ": object \"" + object + "\" of class \"" + object.getClass() + "\" cannot be decoded to an object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java index acf64c3c9..35e811dec 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java @@ -132,7 +132,7 @@ public class AvroDirectObjectMapper implements AvroObjectMapper { // the decoded object is always returned as a null if (!schemaClass.isAssignableFrom(avroObject.getClass())) { final String returnString = - userKey.getID() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() + userKey.getId() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() + "\" cannot be decoded to an object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); @@ -152,7 +152,7 @@ public class AvroDirectObjectMapper implements AvroObjectMapper { // Null values are only allowed if the schema class is null if (object == null) { if (schemaClass != null) { - final String returnString = userKey.getID() + ": cannot encode a null object of class \"" + final String returnString = userKey.getId() + ": cannot encode a null object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroObjectMapperFactory.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroObjectMapperFactory.java index 22152a8da..a48ca8089 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroObjectMapperFactory.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroObjectMapperFactory.java @@ -79,7 +79,7 @@ public class AvroObjectMapperFactory { // currently only support unions with 2 types, one of which is NULL final Schema nullschema = Schema.create(Schema.Type.NULL); if (types.size() != 2 || !types.contains(nullschema)) { - final String resultSting = userKey.getID() + final String resultSting = userKey.getId() + ": Apex currently only supports UNION schemas with 2 options, one must be NULL"; LOGGER.warn(resultSting); throw new ContextRuntimeException(resultSting); @@ -91,7 +91,7 @@ public class AvroObjectMapperFactory { schema = types.get(1); } if (Schema.Type.NULL.equals(schema.getType())) { - final String resultSting = userKey.getID() + final String resultSting = userKey.getId() + ": Apex currently only supports UNION schema2 with 2 options, only one can be NULL, and the other cannot be another UNION"; LOGGER.warn(resultSting); throw new ContextRuntimeException(resultSting); @@ -103,7 +103,7 @@ public class AvroObjectMapperFactory { // Check that there is a definition for the mapper for this type if (!AVRO_OBJECT_MAPPER_MAP.containsKey(avroType) || AVRO_OBJECT_MAPPER_MAP.get(avroType) == null) { final String resultSting = - userKey.getID() + ": no Avro object mapper defined for Avro type \"" + avroType + "\""; + userKey.getId() + ": no Avro object mapper defined for Avro type \"" + avroType + "\""; LOGGER.warn(resultSting); throw new ContextRuntimeException(resultSting); } @@ -117,7 +117,7 @@ public class AvroObjectMapperFactory { } } catch (final Exception e) { - final String resultSting = userKey.getID() + ": could not create an Avro object mapper of type \"" + final String resultSting = userKey.getId() + ": could not create an Avro object mapper of type \"" + AVRO_OBJECT_MAPPER_MAP.get(avroType) + "\" for Avro type \"" + avroType + "\" : " + e; LOGGER.warn(resultSting, e); throw new ContextRuntimeException(resultSting, e); diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java index 5fba274ce..df430b683 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java @@ -66,7 +66,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { try { avroSchema = new Schema.Parser().parse(schema.getSchema()); } catch (final Exception e) { - final String resultSting = userKey.getID() + ": avro context schema \"" + schema.getID() + final String resultSting = userKey.getId() + ": avro context schema \"" + schema.getId() + "\" schema is invalid: " + e.getMessage() + ", schema: " + schema.getSchema(); LOGGER.warn(resultSting); throw new ContextRuntimeException(resultSting); @@ -121,7 +121,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { return createNewInstance(elementJsonString); } else { - final String returnString = getUserKey().getID() + ": the object \"" + incomingObject + final String returnString = getUserKey().getId() + ": the object \"" + incomingObject + "\" is not an instance of JsonObject"; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); @@ -146,7 +146,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { final JsonDecoder jsonDecoder = DecoderFactory.get().jsonDecoder(avroSchema, objectString); decodedObject = new GenericDatumReader<GenericRecord>(avroSchema).read(null, jsonDecoder); } catch (final Exception e) { - final String returnString = getUserKey().getID() + ": object \"" + objectString + final String returnString = getUserKey().getId() + ": object \"" + objectString + "\" Avro unmarshalling failed: " + e.getMessage(); LOGGER.warn(returnString, e); throw new ContextRuntimeException(returnString, e); @@ -185,7 +185,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { return (String) object; } } catch (final ClassCastException e) { - final String returnString = getUserKey().getID() + ": object \"" + object + "\" of type \"" + final String returnString = getUserKey().getId() + ": object \"" + object + "\" of type \"" + (object != null ? object.getClass().getCanonicalName() : "null") + "\" must be assignable to \"" + getSchemaClass().getCanonicalName() + "\" or be a Json string representation of it for Avro unmarshalling"; @@ -218,7 +218,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { return new String(output.toByteArray()); } catch (final Exception e) { final String returnString = - getUserKey().getID() + ": object \"" + object + "\" Avro marshalling failed: " + e.getMessage(); + getUserKey().getId() + ": object \"" + object + "\" Avro marshalling failed: " + e.getMessage(); LOGGER.warn(returnString); throw new ContextRuntimeException(returnString, e); } diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java index cb3625f31..09d1d9f1f 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java @@ -101,7 +101,7 @@ public class AvroStringObjectMapper implements AvroObjectMapper { // The Avro object should be a Utf8 object if (!(avroObject instanceof Utf8)) { final String returnString = - userKey.getID() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() + userKey.getId() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() + "\" cannot be decoded to an object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); @@ -119,7 +119,7 @@ public class AvroStringObjectMapper implements AvroObjectMapper { @Override public Object mapToAvro(final Object object) { if (object == null) { - final String returnString = userKey.getID() + ": cannot encode a null object of class \"" + final String returnString = userKey.getId() + ": cannot encode a null object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/Apex2YamlEventConverter.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/Apex2YamlEventConverter.java index 689b1e730..f81c3a914 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/Apex2YamlEventConverter.java +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/Apex2YamlEventConverter.java @@ -165,7 +165,7 @@ public class Apex2YamlEventConverter implements ApexEventProtocolConverter { if (!apexEvent.containsKey(fieldName)) { if (!eventField.getOptional()) { - final String errorMessage = "error parsing " + eventDefinition.getID() + " event to Json. " + final String errorMessage = "error parsing " + eventDefinition.getId() + " event to Json. " + "Field \"" + fieldName + "\" is missing, but is mandatory. Fields: " + apexEvent; LOGGER.debug(errorMessage); throw new ApexEventRuntimeException(errorMessage); @@ -204,7 +204,7 @@ public class Apex2YamlEventConverter implements ApexEventProtocolConverter { final String fieldName = eventField.getKey().getLocalName(); if (!yamlMap.containsKey(fieldName)) { if (!eventField.getOptional()) { - final String errorMessage = "error parsing " + eventDefinition.getID() + " event from Json. " + final String errorMessage = "error parsing " + eventDefinition.getId() + " event from Json. " + "Field \"" + fieldName + "\" is missing, but is mandatory."; LOGGER.debug(errorMessage); throw new ApexEventException(errorMessage); diff --git a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java index 52b78733a..4fff29092 100644 --- a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java +++ b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java @@ -88,10 +88,10 @@ public class JavaStateFinalizerExecutor extends StateFinalizerExecutor { new Class[] { StateFinalizerExecutionContext.class }); returnValue = (boolean) method.invoke(stateFinalizerLogicObject, getExecutionContext()); } catch (final Exception e) { - LOGGER.error("execute: state finalizer logic failed to run for state finalizer \"" + getSubject().getID() + LOGGER.error("execute: state finalizer logic failed to run for state finalizer \"" + getSubject().getId() + "\""); throw new StateMachineException( - "state finalizer logic failed to run for state finalizer \"" + getSubject().getID() + "\"", e); + "state finalizer logic failed to run for state finalizer \"" + getSubject().getId() + "\"", e); } // Do the execution post work @@ -112,7 +112,7 @@ public class JavaStateFinalizerExecutor extends StateFinalizerExecutor { */ @Override public void cleanUp() throws StateMachineException { - LOGGER.debug("cleanUp:" + getSubject().getID() + "," + getSubject().getLogicFlavour() + "," + LOGGER.debug("cleanUp:" + getSubject().getId() + "," + getSubject().getLogicFlavour() + "," + getSubject().getLogic()); } } diff --git a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java index 6343f1a9f..753f08b7e 100644 --- a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java +++ b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java @@ -88,9 +88,9 @@ public class JavaTaskExecutor extends TaskExecutor { new Class[] { TaskExecutionContext.class }); returnValue = (boolean) method.invoke(taskLogicObject, getExecutionContext()); } catch (final Exception e) { - LOGGER.error("execute: task logic failed to run for task \"" + getSubject().getKey().getID() + "\""); + LOGGER.error("execute: task logic failed to run for task \"" + getSubject().getKey().getId() + "\""); throw new StateMachineException( - "task logic failed to run for task \"" + getSubject().getKey().getID() + "\"", e); + "task logic failed to run for task \"" + getSubject().getKey().getId() + "\"", e); } // Do the execution post work @@ -111,7 +111,7 @@ public class JavaTaskExecutor extends TaskExecutor { */ @Override public void cleanUp() throws StateMachineException { - LOGGER.debug("cleanUp:" + getSubject().getKey().getID() + "," + getSubject().getTaskLogic().getLogicFlavour() + LOGGER.debug("cleanUp:" + getSubject().getKey().getId() + "," + getSubject().getTaskLogic().getLogicFlavour() + "," + getSubject().getTaskLogic().getLogic()); } } diff --git a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java index ee33c52d1..a42ff2cfa 100644 --- a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java +++ b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java @@ -89,10 +89,10 @@ public class JavaTaskSelectExecutor extends TaskSelectExecutor { returnValue = (boolean) method.invoke(taskSelectionLogicObject, getExecutionContext()); } catch (final Exception e) { LOGGER.error( - "execute: task selection logic failed to run for state \"" + getSubject().getKey().getID() + "\"", + "execute: task selection logic failed to run for state \"" + getSubject().getKey().getId() + "\"", e); throw new StateMachineException( - "task selection logic failed to run for state \"" + getSubject().getKey().getID() + "\"", e); + "task selection logic failed to run for state \"" + getSubject().getKey().getId() + "\"", e); } // Do the execution post work @@ -113,7 +113,7 @@ public class JavaTaskSelectExecutor extends TaskSelectExecutor { */ @Override public void cleanUp() throws StateMachineException { - LOGGER.debug("cleanUp:" + getSubject().getKey().getID() + "," + LOGGER.debug("cleanUp:" + getSubject().getKey().getId() + "," + getSubject().getTaskSelectionLogic().getLogicFlavour() + "," + getSubject().getTaskSelectionLogic().getLogic()); } diff --git a/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptStateFinalizerExecutor.java b/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptStateFinalizerExecutor.java index 66c036375..7b91c5975 100644 --- a/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptStateFinalizerExecutor.java +++ b/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptStateFinalizerExecutor.java @@ -61,9 +61,9 @@ public class JavascriptStateFinalizerExecutor extends StateFinalizerExecutor { compiled = ((Compilable) engine).compile(getSubject().getLogic()); } catch (final ScriptException e) { LOGGER.error("execute: state finalizer logic failed to compile for state finalizer \"" - + getSubject().getKey().getID() + "\""); + + getSubject().getKey().getId() + "\""); throw new StateMachineException("state finalizer logic failed to compile for state finalizer \"" - + getSubject().getKey().getID() + "\"", e); + + getSubject().getKey().getId() + "\"", e); } } @@ -95,9 +95,9 @@ public class JavascriptStateFinalizerExecutor extends StateFinalizerExecutor { } } catch (final ScriptException e) { LOGGER.error("execute: state finalizer logic failed to run for state finalizer \"" - + getSubject().getKey().getID() + "\""); + + getSubject().getKey().getId() + "\""); throw new StateMachineException("state finalizer logic failed to run for state finalizer \"" - + getSubject().getKey().getID() + "\"", e); + + getSubject().getKey().getId() + "\"", e); } returnValue = (boolean) engine.get("returnValue"); @@ -120,7 +120,7 @@ public class JavascriptStateFinalizerExecutor extends StateFinalizerExecutor { */ @Override public void cleanUp() throws StateMachineException { - LOGGER.debug("cleanUp:" + getSubject().getKey().getID() + "," + getSubject().getLogicFlavour() + "," + LOGGER.debug("cleanUp:" + getSubject().getKey().getId() + "," + getSubject().getLogicFlavour() + "," + getSubject().getLogic()); engine = null; } diff --git a/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskExecutor.java b/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskExecutor.java index 80f744b5d..38be929c0 100644 --- a/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskExecutor.java +++ b/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskExecutor.java @@ -60,9 +60,9 @@ public class JavascriptTaskExecutor extends TaskExecutor { try { compiled = ((Compilable) engine).compile(getSubject().getTaskLogic().getLogic()); } catch (final ScriptException e) { - LOGGER.error("execute: task logic failed to compile for task \"" + getSubject().getKey().getID() + "\""); + LOGGER.error("execute: task logic failed to compile for task \"" + getSubject().getKey().getId() + "\""); throw new StateMachineException( - "task logic failed to compile for task \"" + getSubject().getKey().getID() + "\"", e); + "task logic failed to compile for task \"" + getSubject().getKey().getId() + "\"", e); } } @@ -93,25 +93,25 @@ public class JavascriptTaskExecutor extends TaskExecutor { compiled.eval(engine.getContext()); } } catch (final ScriptException e) { - LOGGER.error("execute: task logic failed to run for task \"" + getSubject().getKey().getID() + "\""); + LOGGER.error("execute: task logic failed to run for task \"" + getSubject().getKey().getId() + "\""); throw new StateMachineException( - "task logic failed to run for task \"" + getSubject().getKey().getID() + "\"", e); + "task logic failed to run for task \"" + getSubject().getKey().getId() + "\"", e); } try { final Object ret = engine.get("returnValue"); if (ret == null) { LOGGER.error("execute: task logic failed to set a return value for task \"" - + getSubject().getKey().getID() + "\""); + + getSubject().getKey().getId() + "\""); throw new StateMachineException("execute: task logic failed to set a return value for task \"" - + getSubject().getKey().getID() + "\""); + + getSubject().getKey().getId() + "\""); } returnValue = (Boolean) ret; } catch (NullPointerException | ClassCastException e) { LOGGER.error("execute: task selection logic failed to set a correct return value for state \"" - + getSubject().getKey().getID() + "\"", e); + + getSubject().getKey().getId() + "\"", e); throw new StateMachineException("execute: task selection logic failed to set a return value for state \"" - + getSubject().getKey().getID() + "\"", e); + + getSubject().getKey().getId() + "\"", e); } // Do the execution post work @@ -132,7 +132,7 @@ public class JavascriptTaskExecutor extends TaskExecutor { */ @Override public void cleanUp() throws StateMachineException { - LOGGER.debug("cleanUp:" + getSubject().getKey().getID() + "," + getSubject().getTaskLogic().getLogicFlavour() + LOGGER.debug("cleanUp:" + getSubject().getKey().getId() + "," + getSubject().getTaskLogic().getLogicFlavour() + "," + getSubject().getTaskLogic().getLogic()); engine = null; } diff --git a/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutor.java b/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutor.java index aa9c6650f..570b33b2a 100644 --- a/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutor.java +++ b/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutor.java @@ -60,10 +60,10 @@ public class JavascriptTaskSelectExecutor extends TaskSelectExecutor { try { compiled = ((Compilable) engine).compile(getSubject().getTaskSelectionLogic().getLogic()); } catch (final ScriptException e) { - LOGGER.error("execute: task selection logic failed to compile for state \"" + getSubject().getKey().getID() + LOGGER.error("execute: task selection logic failed to compile for state \"" + getSubject().getKey().getId() + "\""); throw new StateMachineException( - "task selection logic failed to compile for state \"" + getSubject().getKey().getID() + "\"", e); + "task selection logic failed to compile for state \"" + getSubject().getKey().getId() + "\"", e); } } @@ -96,26 +96,26 @@ public class JavascriptTaskSelectExecutor extends TaskSelectExecutor { } } catch (final ScriptException e) { LOGGER.error( - "execute: task selection logic failed to run for state \"" + getSubject().getKey().getID() + "\""); + "execute: task selection logic failed to run for state \"" + getSubject().getKey().getId() + "\""); throw new StateMachineException( - "task selection logic failed to run for state \"" + getSubject().getKey().getID() + "\"", e); + "task selection logic failed to run for state \"" + getSubject().getKey().getId() + "\"", e); } try { final Object ret = engine.get("returnValue"); if (ret == null) { LOGGER.error("execute: task selection logic failed to set a return value for state \"" - + getSubject().getKey().getID() + "\""); + + getSubject().getKey().getId() + "\""); throw new StateMachineException( "execute: task selection logic failed to set a return value for state \"" - + getSubject().getKey().getID() + "\""); + + getSubject().getKey().getId() + "\""); } returnValue = (Boolean) ret; } catch (NullPointerException | ClassCastException e) { LOGGER.error("execute: task selection logic failed to set a correct return value for state \"" - + getSubject().getKey().getID() + "\"", e); + + getSubject().getKey().getId() + "\"", e); throw new StateMachineException("execute: task selection logic failed to set a return value for state \"" - + getSubject().getKey().getID() + "\"", e); + + getSubject().getKey().getId() + "\"", e); } // Do the execution post work @@ -136,7 +136,7 @@ public class JavascriptTaskSelectExecutor extends TaskSelectExecutor { */ @Override public void cleanUp() throws StateMachineException { - LOGGER.debug("cleanUp:" + getSubject().getKey().getID() + "," + LOGGER.debug("cleanUp:" + getSubject().getKey().getId() + "," + getSubject().getTaskSelectionLogic().getLogicFlavour() + "," + getSubject().getTaskSelectionLogic().getLogic()); engine = null; diff --git a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutor.java b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutor.java index 41ad359eb..f8f66e5d2 100644 --- a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutor.java +++ b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutor.java @@ -113,7 +113,7 @@ public class JrubyStateFinalizerExecutor extends StateFinalizerExecutor { */ @Override public void cleanUp() throws StateMachineException { - LOGGER.debug("cleanUp:" + getSubject().getKey().getID() + "," + getSubject().getLogicFlavour() + "," + LOGGER.debug("cleanUp:" + getSubject().getKey().getId() + "," + getSubject().getLogicFlavour() + "," + getSubject().getLogic()); container.terminate(); container = null; diff --git a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutor.java b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutor.java index 8db650fa1..56b28d02e 100644 --- a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutor.java +++ b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutor.java @@ -113,7 +113,7 @@ public class JrubyTaskExecutor extends TaskExecutor { */ @Override public void cleanUp() throws StateMachineException { - LOGGER.debug("cleanUp:" + getSubject().getKey().getID() + "," + getSubject().getTaskLogic().getLogicFlavour() + LOGGER.debug("cleanUp:" + getSubject().getKey().getId() + "," + getSubject().getTaskLogic().getLogicFlavour() + "," + getSubject().getTaskLogic().getLogic()); container.terminate(); container = null; diff --git a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutor.java b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutor.java index 85c7ba018..8405f4e60 100644 --- a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutor.java +++ b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutor.java @@ -114,7 +114,7 @@ public class JrubyTaskSelectExecutor extends TaskSelectExecutor { */ @Override public void cleanUp() throws StateMachineException { - LOGGER.debug("cleanUp:" + getSubject().getKey().getID() + "," + LOGGER.debug("cleanUp:" + getSubject().getKey().getId() + "," + getSubject().getTaskSelectionLogic().getLogicFlavour() + "," + getSubject().getTaskSelectionLogic().getLogic()); container.terminate(); diff --git a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutor.java b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutor.java index 71dce5801..e1c0f096a 100644 --- a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutor.java +++ b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutor.java @@ -67,8 +67,8 @@ public class JythonTaskExecutor extends TaskExecutor { compiled = Py.compile_flags(logic, filename, CompileMode.exec, new CompilerFlags()); } } catch (final PyException e) { - LOGGER.warn("failed to compile Jython code for task " + getSubject().getKey().getID(), e); - throw new StateMachineException("failed to compile Jython code for task " + getSubject().getKey().getID(), + LOGGER.warn("failed to compile Jython code for task " + getSubject().getKey().getId(), e); + throw new StateMachineException("failed to compile Jython code for task " + getSubject().getKey().getId(), e); } @@ -104,24 +104,24 @@ public class JythonTaskExecutor extends TaskExecutor { final Object ret = interpreter.get("returnValue", java.lang.Boolean.class); if (ret == null) { LOGGER.error("execute: task logic failed to set a return value for task \"" - + getSubject().getKey().getID() + "\""); + + getSubject().getKey().getId() + "\""); throw new StateMachineException("execute: task logic failed to set a return value for task \"" - + getSubject().getKey().getID() + "\""); + + getSubject().getKey().getId() + "\""); } returnValue = (Boolean) ret; } catch (NullPointerException | ClassCastException e) { LOGGER.error("execute: task selection logic failed to set a correct return value for state \"" - + getSubject().getKey().getID() + "\"", e); + + getSubject().getKey().getId() + "\"", e); throw new StateMachineException( "execute: task selection logic failed to set a return value for state \"" - + getSubject().getKey().getID() + "\"", + + getSubject().getKey().getId() + "\"", e); } } /* */ } catch (final Exception e) { - LOGGER.warn("failed to execute Jython code for task " + getSubject().getKey().getID(), e); - throw new StateMachineException("failed to execute Jython code for task " + getSubject().getKey().getID(), + LOGGER.warn("failed to execute Jython code for task " + getSubject().getKey().getId(), e); + throw new StateMachineException("failed to execute Jython code for task " + getSubject().getKey().getId(), e); } @@ -144,7 +144,7 @@ public class JythonTaskExecutor extends TaskExecutor { @Override public void cleanUp() throws StateMachineException { interpreter.cleanup(); - LOGGER.debug("cleanUp:" + getSubject().getKey().getID() + "," + getSubject().getTaskLogic().getLogicFlavour() + LOGGER.debug("cleanUp:" + getSubject().getKey().getId() + "," + getSubject().getTaskLogic().getLogicFlavour() + "," + getSubject().getTaskLogic().getLogic()); } } diff --git a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutor.java b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutor.java index d28001d87..4f4d38a19 100644 --- a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutor.java +++ b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutor.java @@ -66,10 +66,10 @@ public class JythonTaskSelectExecutor extends TaskSelectExecutor { compiled = Py.compile_flags(logic, filename, CompileMode.exec, new CompilerFlags()); } } catch (final PyException e) { - LOGGER.warn("failed to compile Jython code for task selection logic in " + getSubject().getKey().getID(), + LOGGER.warn("failed to compile Jython code for task selection logic in " + getSubject().getKey().getId(), e); throw new StateMachineException( - "failed to compile Jython code for task selection logic in " + getSubject().getKey().getID(), e); + "failed to compile Jython code for task selection logic in " + getSubject().getKey().getId(), e); } } @@ -104,27 +104,27 @@ public class JythonTaskSelectExecutor extends TaskSelectExecutor { final Object ret = interpreter.get("returnValue", java.lang.Boolean.class); if (ret == null) { LOGGER.error("execute: task selection logic failed to set a return value for state \"" - + getSubject().getKey().getID() + "\""); + + getSubject().getKey().getId() + "\""); throw new StateMachineException( "execute: task selection logic failed to set a return value for state \"" - + getSubject().getKey().getID() + "\""); + + getSubject().getKey().getId() + "\""); } returnValue = (Boolean) ret; } catch (NullPointerException | ClassCastException e) { LOGGER.error("execute: task selection logic failed to set a correct return value for state \"" - + getSubject().getKey().getID() + "\"", e); + + getSubject().getKey().getId() + "\"", e); throw new StateMachineException( "execute: task selection logic failed to set a return value for state \"" - + getSubject().getKey().getID() + "\"", + + getSubject().getKey().getId() + "\"", e); } } /* */ } catch (final Exception e) { - LOGGER.warn("failed to execute Jython code for task selection logic in " + getSubject().getKey().getID(), + LOGGER.warn("failed to execute Jython code for task selection logic in " + getSubject().getKey().getId(), e); throw new StateMachineException( - "failed to execute Jython code for task selection logic in " + getSubject().getKey().getID(), e); + "failed to execute Jython code for task selection logic in " + getSubject().getKey().getId(), e); } // Do the execution post work @@ -146,7 +146,7 @@ public class JythonTaskSelectExecutor extends TaskSelectExecutor { @Override public void cleanUp() throws StateMachineException { interpreter.cleanup(); - LOGGER.debug("cleanUp:" + getSubject().getKey().getID() + "," + LOGGER.debug("cleanUp:" + getSubject().getKey().getId() + "," + getSubject().getTaskSelectionLogic().getLogicFlavour() + "," + getSubject().getTaskSelectionLogic().getLogic()); } diff --git a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutor.java b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutor.java index 8cd76a94d..ea39c6d74 100644 --- a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutor.java +++ b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutor.java @@ -59,8 +59,8 @@ public class MvelStateFinalizerExecutor extends StateFinalizerExecutor { try { compiled = MVEL.compileExpression(getSubject().getLogic()); } catch (final Exception e) { - LOGGER.warn("failed to compile MVEL code for state " + getSubject().getKey().getID(), e); - throw new StateMachineException("failed to compile MVEL code for state " + getSubject().getKey().getID(), + LOGGER.warn("failed to compile MVEL code for state " + getSubject().getKey().getId(), e); + throw new StateMachineException("failed to compile MVEL code for state " + getSubject().getKey().getId(), e); } } @@ -89,8 +89,8 @@ public class MvelStateFinalizerExecutor extends StateFinalizerExecutor { returnValue = (boolean) MVEL.executeExpression(compiled, getExecutionContext(), new HashMap<String, Object>()); } catch (final Exception e) { - LOGGER.warn("failed to execute MVEL code for state " + getSubject().getKey().getID(), e); - throw new StateMachineException("failed to execute MVEL code for state " + getSubject().getKey().getID(), + LOGGER.warn("failed to execute MVEL code for state " + getSubject().getKey().getId(), e); + throw new StateMachineException("failed to execute MVEL code for state " + getSubject().getKey().getId(), e); } @@ -112,7 +112,7 @@ public class MvelStateFinalizerExecutor extends StateFinalizerExecutor { */ @Override public void cleanUp() throws StateMachineException { - LOGGER.debug("cleanUp:" + getSubject().getKey().getID() + "," + getSubject().getLogicFlavour() + "," + LOGGER.debug("cleanUp:" + getSubject().getKey().getId() + "," + getSubject().getLogicFlavour() + "," + getSubject().getLogic()); } } diff --git a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutor.java b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutor.java index 8599eabac..966a8004a 100644 --- a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutor.java +++ b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutor.java @@ -59,8 +59,8 @@ public class MvelTaskExecutor extends TaskExecutor { try { compiled = MVEL.compileExpression(getSubject().getTaskLogic().getLogic()); } catch (final Exception e) { - LOGGER.warn("failed to compile MVEL code for task " + getSubject().getKey().getID(), e); - throw new StateMachineException("failed to compile MVEL code for task " + getSubject().getKey().getID(), e); + LOGGER.warn("failed to compile MVEL code for task " + getSubject().getKey().getId(), e); + throw new StateMachineException("failed to compile MVEL code for task " + getSubject().getKey().getId(), e); } argumentNotNull(compiled, "MVEL task not compiled."); } @@ -89,8 +89,8 @@ public class MvelTaskExecutor extends TaskExecutor { returnValue = (boolean) MVEL.executeExpression(compiled, getExecutionContext(), new HashMap<String, Object>()); } catch (final Exception e) { - LOGGER.warn("failed to execute MVEL code for task " + getSubject().getKey().getID(), e); - throw new StateMachineException("failed to execute MVEL code for task " + getSubject().getKey().getID(), e); + LOGGER.warn("failed to execute MVEL code for task " + getSubject().getKey().getId(), e); + throw new StateMachineException("failed to execute MVEL code for task " + getSubject().getKey().getId(), e); } // Do the execution post work @@ -111,7 +111,7 @@ public class MvelTaskExecutor extends TaskExecutor { */ @Override public void cleanUp() throws StateMachineException { - LOGGER.debug("cleanUp:" + getSubject().getKey().getID() + "," + getSubject().getTaskLogic().getLogicFlavour() + LOGGER.debug("cleanUp:" + getSubject().getKey().getId() + "," + getSubject().getTaskLogic().getLogicFlavour() + "," + getSubject().getTaskLogic().getLogic()); } } diff --git a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutor.java b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutor.java index 3cb5d9bf6..4991fbade 100644 --- a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutor.java +++ b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutor.java @@ -60,8 +60,8 @@ public class MvelTaskSelectExecutor extends TaskSelectExecutor { try { compiled = MVEL.compileExpression(getSubject().getTaskSelectionLogic().getLogic()); } catch (final Exception e) { - LOGGER.warn("failed to compile MVEL code for state " + getSubject().getKey().getID(), e); - throw new StateMachineException("failed to compile MVEL code for state " + getSubject().getKey().getID(), + LOGGER.warn("failed to compile MVEL code for state " + getSubject().getKey().getId(), e); + throw new StateMachineException("failed to compile MVEL code for state " + getSubject().getKey().getId(), e); } } @@ -90,8 +90,8 @@ public class MvelTaskSelectExecutor extends TaskSelectExecutor { returnValue = (boolean) MVEL.executeExpression(compiled, getExecutionContext(), new HashMap<String, Object>()); } catch (final Exception e) { - LOGGER.warn("failed to execute MVEL code for state " + getSubject().getKey().getID(), e); - throw new StateMachineException("failed to execute MVEL code for state " + getSubject().getKey().getID(), + LOGGER.warn("failed to execute MVEL code for state " + getSubject().getKey().getId(), e); + throw new StateMachineException("failed to execute MVEL code for state " + getSubject().getKey().getId(), e); } @@ -113,7 +113,7 @@ public class MvelTaskSelectExecutor extends TaskSelectExecutor { */ @Override public void cleanUp() throws StateMachineException { - LOGGER.debug("cleanUp:" + getSubject().getKey().getID() + "," + LOGGER.debug("cleanUp:" + getSubject().getKey().getId() + "," + getSubject().getTaskSelectionLogic().getLogicFlavour() + "," + getSubject().getTaskSelectionLogic().getLogic()); } diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java index d33621e47..4a27bcfa7 100644 --- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java +++ b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java @@ -37,7 +37,7 @@ import org.onap.policy.apex.context.test.entities.ReferenceKeyTestEntity; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; /** * Junit tests for class EclipselinkApexDao @@ -51,16 +51,16 @@ public class EclipselinkApexDaoTest { private static final List<AxArtifactKey> TEST_ARTIKEYS = Arrays.asList(new AxArtifactKey[] { new AxArtifactKey("ABC", "0.0.1"), new AxArtifactKey("DEF", "0.1.1"), new AxArtifactKey("XYZ", "1.1.1")}); - private final DAOParameters daoParameters = new DAOParameters(); + private final DaoParameters DaoParameters = new DaoParameters(); private EclipselinkApexDao eclipselinkApexDao = null; @Before public void setup() throws ApexException { - daoParameters.setPluginClass(EclipselinkApexDao.class.getCanonicalName()); - daoParameters.setPersistenceUnit("DAOTest"); + DaoParameters.setPluginClass(EclipselinkApexDao.class.getCanonicalName()); + DaoParameters.setPersistenceUnit("DAOTest"); eclipselinkApexDao = new EclipselinkApexDao(); - eclipselinkApexDao.init(daoParameters); + eclipselinkApexDao.init(DaoParameters); } @After diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/main/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/HibernateApexDao.java b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/main/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/HibernateApexDao.java index 2d60e3751..087535d6b 100644 --- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/main/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/HibernateApexDao.java +++ b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/main/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/HibernateApexDao.java @@ -239,7 +239,7 @@ public class HibernateApexDao extends DefaultApexDao { } if (ret.size() > 1) { throw new IllegalArgumentException("More than one result was returned for search for " + aClass - + " with key " + key.getID() + ": " + ret); + + " with key " + key.getId() + ": " + ret); } return ret.get(0); } @@ -269,7 +269,7 @@ public class HibernateApexDao extends DefaultApexDao { } if (ret.size() > 1) { throw new IllegalArgumentException("More than one result was returned for search for " + aClass - + " with key " + key.getID() + ": " + ret); + + " with key " + key.getId() + ": " + ret); } return ret.get(0); } diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/HibernateApexDaoTest.java b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/HibernateApexDaoTest.java index 851332b7b..1f100fde8 100644 --- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/HibernateApexDaoTest.java +++ b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/HibernateApexDaoTest.java @@ -37,7 +37,7 @@ import org.onap.policy.apex.context.test.entities.ReferenceKeyTestEntity; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; /** * Junit test for class HibernateApexDao @@ -51,16 +51,16 @@ public class HibernateApexDaoTest { private static final List<AxArtifactKey> TEST_ARTIKEYS = Arrays.asList(new AxArtifactKey[] { new AxArtifactKey("ABC", "0.0.1"), new AxArtifactKey("DEF", "0.1.1"), new AxArtifactKey("XYZ", "1.1.1")}); - private final DAOParameters daoParameters = new DAOParameters(); + private final DaoParameters DaoParameters = new DaoParameters(); private HibernateApexDao hibernateApexDao = null; @Before public void setupDAO() throws ApexException { - daoParameters.setPluginClass(HibernateApexDao.class.getCanonicalName()); - daoParameters.setPersistenceUnit("DAOTest"); + DaoParameters.setPluginClass(HibernateApexDao.class.getCanonicalName()); + DaoParameters.setPersistenceUnit("DAOTest"); hibernateApexDao = new HibernateApexDao(); - hibernateApexDao.init(daoParameters); + hibernateApexDao.init(DaoParameters); } @After diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/engdep/EngDepMessageListener.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/engdep/EngDepMessageListener.java index 1bc88a409..3840e915d 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/engdep/EngDepMessageListener.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/engdep/EngDepMessageListener.java @@ -203,90 +203,90 @@ public class EngDepMessageListener implements MessageListener<Message>, Runnable switch (enDepAction) { case GET_ENGINE_SERVICE_INFO: final GetEngineServiceInfo engineServiceInformationMessage = (GetEngineServiceInfo) message; - LOGGER.debug("getting engine service information for engine service " + apexService.getKey().getID() + LOGGER.debug("getting engine service information for engine service " + apexService.getKey().getId() + " . . ."); // Send a reply with the engine service information sendServiceInfoReply(webSocket, engineServiceInformationMessage, apexService.getKey(), apexService.getEngineKeys(), apexService.getApexModelKey()); LOGGER.debug( - "returned engine service information for engine service " + apexService.getKey().getID()); + "returned engine service information for engine service " + apexService.getKey().getId()); break; case UPDATE_MODEL: final UpdateModel updateModelMessage = (UpdateModel) message; - LOGGER.debug("updating model in engine {} . . .", updateModelMessage.getTarget().getID()); + LOGGER.debug("updating model in engine {} . . .", updateModelMessage.getTarget().getId()); // Update the model apexService.updateModel(updateModelMessage.getTarget(), updateModelMessage.getMessageData(), updateModelMessage.isForceInstall()); // Send a reply indicating the message action worked sendReply(webSocket, updateModelMessage, true, - "updated model in engine " + updateModelMessage.getTarget().getID()); - LOGGER.debug("updated model in engine service {}", updateModelMessage.getTarget().getID()); + "updated model in engine " + updateModelMessage.getTarget().getId()); + LOGGER.debug("updated model in engine service {}", updateModelMessage.getTarget().getId()); break; case START_ENGINE: final StartEngine startEngineMessage = (StartEngine) message; - LOGGER.debug("starting engine {} . . .", startEngineMessage.getTarget().getID()); + LOGGER.debug("starting engine {} . . .", startEngineMessage.getTarget().getId()); // Start the engine apexService.start(startEngineMessage.getTarget()); // Send a reply indicating the message action worked sendReply(webSocket, startEngineMessage, true, - "started engine " + startEngineMessage.getTarget().getID()); - LOGGER.debug("started engine {}", startEngineMessage.getTarget().getID()); + "started engine " + startEngineMessage.getTarget().getId()); + LOGGER.debug("started engine {}", startEngineMessage.getTarget().getId()); break; case STOP_ENGINE: final StopEngine stopEngineMessage = (StopEngine) message; - LOGGER.debug("stopping engine {} . . .", stopEngineMessage.getTarget().getID()); + LOGGER.debug("stopping engine {} . . .", stopEngineMessage.getTarget().getId()); // Stop the engine apexService.stop(stopEngineMessage.getTarget()); // Send a reply indicating the message action worked sendReply(webSocket, stopEngineMessage, true, - "stopped engine " + stopEngineMessage.getTarget().getID()); - LOGGER.debug("stopping engine {}", stopEngineMessage.getTarget().getID()); + "stopped engine " + stopEngineMessage.getTarget().getId()); + LOGGER.debug("stopping engine {}", stopEngineMessage.getTarget().getId()); break; case START_PERIODIC_EVENTS: final StartPeriodicEvents startPeriodicEventsMessage = (StartPeriodicEvents) message; LOGGER.debug("starting periodic events on engine {} . . .", - startPeriodicEventsMessage.getTarget().getID()); + startPeriodicEventsMessage.getTarget().getId()); // Start periodic events with the period specified in the message final Long period = Long.parseLong(startPeriodicEventsMessage.getMessageData()); apexService.startPeriodicEvents(period); // Send a reply indicating the message action worked sendReply(webSocket, startPeriodicEventsMessage, true, "started periodic events on engine " - + startPeriodicEventsMessage.getTarget().getID() + " with period " + period); - LOGGER.debug("started periodic events on engine " + startPeriodicEventsMessage.getTarget().getID() + + startPeriodicEventsMessage.getTarget().getId() + " with period " + period); + LOGGER.debug("started periodic events on engine " + startPeriodicEventsMessage.getTarget().getId() + " with period " + period); break; case STOP_PERIODIC_EVENTS: final StopPeriodicEvents stopPeriodicEventsMessage = (StopPeriodicEvents) message; LOGGER.debug("stopping periodic events on engine {} . . .", - stopPeriodicEventsMessage.getTarget().getID()); + stopPeriodicEventsMessage.getTarget().getId()); // Stop periodic events apexService.stopPeriodicEvents(); // Send a reply indicating the message action worked sendReply(webSocket, stopPeriodicEventsMessage, true, - "stopped periodic events on engine " + stopPeriodicEventsMessage.getTarget().getID()); - LOGGER.debug("stopped periodic events on engine " + stopPeriodicEventsMessage.getTarget().getID()); + "stopped periodic events on engine " + stopPeriodicEventsMessage.getTarget().getId()); + LOGGER.debug("stopped periodic events on engine " + stopPeriodicEventsMessage.getTarget().getId()); break; case GET_ENGINE_STATUS: final GetEngineStatus getEngineStatusMessage = (GetEngineStatus) message; - LOGGER.debug("getting status for engine{} . . .", getEngineStatusMessage.getTarget().getID()); + LOGGER.debug("getting status for engine{} . . .", getEngineStatusMessage.getTarget().getId()); // Send a reply with the engine status sendReply(webSocket, getEngineStatusMessage, true, apexService.getStatus(getEngineStatusMessage.getTarget())); - LOGGER.debug("returned status for engine {}", getEngineStatusMessage.getTarget().getID()); + LOGGER.debug("returned status for engine {}", getEngineStatusMessage.getTarget().getId()); break; case GET_ENGINE_INFO: final GetEngineInfo getEngineInfo = (GetEngineInfo) message; - LOGGER.debug("getting runtime information for engine {} . . .", getEngineInfo.getTarget().getID()); + LOGGER.debug("getting runtime information for engine {} . . .", getEngineInfo.getTarget().getId()); // Send a reply with the engine runtime information sendReply(webSocket, getEngineInfo, true, apexService.getRuntimeInfo(getEngineInfo.getTarget())); - LOGGER.debug("returned runtime information for engine {}", getEngineInfo.getTarget().getID()); + LOGGER.debug("returned runtime information for engine {}", getEngineInfo.getTarget().getId()); break; case RESPONSE: throw new ApexException("RESPONSE action on received message not handled by engine"); diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JSONEventConverter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JSONEventConverter.java index 21e4cd122..30e9db722 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JSONEventConverter.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JSONEventConverter.java @@ -176,7 +176,7 @@ public class Apex2JSONEventConverter implements ApexEventProtocolConverter { if (!apexEvent.containsKey(fieldName)) { if (!eventField.getOptional()) { - final String errorMessage = "error parsing " + eventDefinition.getID() + " event to Json. " + final String errorMessage = "error parsing " + eventDefinition.getId() + " event to Json. " + "Field \"" + fieldName + "\" is missing, but is mandatory. Fields: " + apexEvent; LOGGER.debug(errorMessage); throw new ApexEventRuntimeException(errorMessage); @@ -240,7 +240,7 @@ public class Apex2JSONEventConverter implements ApexEventProtocolConverter { final String fieldName = eventField.getKey().getLocalName(); if (!hasJSONField(jsonObject, fieldName)) { if (!eventField.getOptional()) { - final String errorMessage = "error parsing " + eventDefinition.getID() + " event from Json. " + final String errorMessage = "error parsing " + eventDefinition.getId() + " event from Json. " + "Field \"" + fieldName + "\" is missing, but is mandatory."; LOGGER.debug(errorMessage); throw new ApexEventException(errorMessage); diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImpl.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImpl.java index ee5f9ae72..d5cb05507 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImpl.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImpl.java @@ -113,7 +113,7 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven final AxArtifactKey engineWorkerKey = new AxArtifactKey(engineServiceKey.getName() + '-' + engineCounter, engineServiceKey.getVersion()); engineWorkerMap.put(engineWorkerKey, new EngineWorker(engineWorkerKey, queue, atFactory)); - LOGGER.info("Created apex engine {} .", engineWorkerKey.getID()); + LOGGER.info("Created apex engine {} .", engineWorkerKey.getId()); } LOGGER.info("APEX service created."); @@ -272,9 +272,9 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven // Check if the Apex model specified is sane if (apexModelString == null || apexModelString.trim().length() == 0) { LOGGER.warn( - "model for updating on engine service with key " + incomingEngineServiceKey.getID() + " is empty"); + "model for updating on engine service with key " + incomingEngineServiceKey.getId() + " is empty"); throw new ApexException( - "model for updating on engine service with key " + incomingEngineServiceKey.getID() + " is empty"); + "model for updating on engine service with key " + incomingEngineServiceKey.getId() + " is empty"); } // Read the Apex model into memory using the Apex Model Reader @@ -283,14 +283,14 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven final ApexModelReader<AxPolicyModel> modelReader = new ApexModelReader<>(AxPolicyModel.class); apexPolicyModel = modelReader.read(new ByteArrayInputStream(apexModelString.getBytes())); } catch (final ApexModelException e) { - LOGGER.error("failed to unmarshal the apex model on engine service " + incomingEngineServiceKey.getID(), e); + LOGGER.error("failed to unmarshal the apex model on engine service " + incomingEngineServiceKey.getId(), e); throw new ApexException( - "failed to unmarshal the apex model on engine service " + incomingEngineServiceKey.getID(), e); + "failed to unmarshal the apex model on engine service " + incomingEngineServiceKey.getId(), e); } if (apexPolicyModel == null) { - LOGGER.error("apex model null on engine service " + incomingEngineServiceKey.getID()); - throw new ApexException("apex model null on engine service " + incomingEngineServiceKey.getID()); + LOGGER.error("apex model null on engine service " + incomingEngineServiceKey.getId()); + throw new ApexException("apex model null on engine service " + incomingEngineServiceKey.getId()); } // Update the model @@ -315,17 +315,17 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven // Check if the Apex model specified is sane if (apexModel == null) { LOGGER.warn( - "model for updating on engine service with key " + incomingEngineServiceKey.getID() + " is null"); + "model for updating on engine service with key " + incomingEngineServiceKey.getId() + " is null"); throw new ApexException( - "model for updating on engine service with key " + incomingEngineServiceKey.getID() + " is null"); + "model for updating on engine service with key " + incomingEngineServiceKey.getId() + " is null"); } // Check if the key on the update request is correct if (!this.engineServiceKey.equals(incomingEngineServiceKey)) { - LOGGER.warn("engine service key " + incomingEngineServiceKey.getID() + " does not match the key" - + engineServiceKey.getID() + " of this engine service"); - throw new ApexException("engine service key " + incomingEngineServiceKey.getID() + " does not match the key" - + engineServiceKey.getID() + " of this engine service"); + LOGGER.warn("engine service key " + incomingEngineServiceKey.getId() + " does not match the key" + + engineServiceKey.getId() + " of this engine service"); + throw new ApexException("engine service key " + incomingEngineServiceKey.getId() + " does not match the key" + + engineServiceKey.getId() + " of this engine service"); } // Check model compatibility @@ -334,14 +334,14 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven final AxPolicyModel currentModel = ModelService.getModel(AxPolicyModel.class); if (!currentModel.getKey().isCompatible(apexModel.getKey())) { if (forceFlag) { - LOGGER.warn("apex model update forced, supplied model with key \"" + apexModel.getKey().getID() + LOGGER.warn("apex model update forced, supplied model with key \"" + apexModel.getKey().getId() + "\" is not a compatible model update from the existing engine model with key \"" - + currentModel.getKey().getID() + "\""); + + currentModel.getKey().getId() + "\""); } else { throw new ContextException( - "apex model update failed, supplied model with key \"" + apexModel.getKey().getID() + "apex model update failed, supplied model with key \"" + apexModel.getKey().getId() + "\" is not a compatible model update from the existing engine model with key \"" - + currentModel.getKey().getID() + "\""); + + currentModel.getKey().getId() + "\""); } } } @@ -359,7 +359,7 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven final StringBuilder notStoppedEngineIDBuilder = new StringBuilder(); for (final Entry<AxArtifactKey, EngineService> engineWorkerEntry : engineWorkerMap.entrySet()) { if (engineWorkerEntry.getValue().getState() != AxEngineState.STOPPED) { - notStoppedEngineIDBuilder.append(engineWorkerEntry.getKey().getID()); + notStoppedEngineIDBuilder.append(engineWorkerEntry.getKey().getId()); notStoppedEngineIDBuilder.append('('); notStoppedEngineIDBuilder.append(engineWorkerEntry.getValue().getState()); notStoppedEngineIDBuilder.append(") "); @@ -367,7 +367,7 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven } if (notStoppedEngineIDBuilder.length() > 0) { final String errorString = "cannot update model on engine service with key " - + incomingEngineServiceKey.getID() + ", engines not stopped after " + MAX_STOP_WAIT_TIME + + incomingEngineServiceKey.getId() + ", engines not stopped after " + MAX_STOP_WAIT_TIME + "ms are: " + notStoppedEngineIDBuilder.toString().trim(); LOGGER.warn(errorString); throw new ApexException(errorString); @@ -376,7 +376,7 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven // Update the engines for (final Entry<AxArtifactKey, EngineService> engineWorkerEntry : engineWorkerMap.entrySet()) { - LOGGER.info("Registering apex model on engine {}", engineWorkerEntry.getKey().getID()); + LOGGER.info("Registering apex model on engine {}", engineWorkerEntry.getKey().getId()); engineWorkerEntry.getValue().updateModel(engineWorkerEntry.getKey(), apexModel, forceFlag); } @@ -392,7 +392,7 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven for (final Entry<AxArtifactKey, EngineService> engineWorkerEntry : engineWorkerMap.entrySet()) { if (engineWorkerEntry.getValue().getState() != AxEngineState.READY && engineWorkerEntry.getValue().getState() != AxEngineState.EXECUTING) { - notRunningEngineIDBuilder.append(engineWorkerEntry.getKey().getID()); + notRunningEngineIDBuilder.append(engineWorkerEntry.getKey().getId()); notRunningEngineIDBuilder.append('('); notRunningEngineIDBuilder.append(engineWorkerEntry.getValue().getState()); notRunningEngineIDBuilder.append(") "); @@ -400,7 +400,7 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven } if (notRunningEngineIDBuilder.length() > 0) { final String errorString = "engine start error on model update on engine service with key " - + incomingEngineServiceKey.getID() + ", engines not running are: " + + incomingEngineServiceKey.getId() + ", engines not running are: " + notRunningEngineIDBuilder.toString().trim(); LOGGER.warn(errorString); throw new ApexException(errorString); @@ -457,8 +457,8 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven // Check if we have this key on our map if (!engineWorkerMap.containsKey(engineKey)) { - LOGGER.warn("engine with key " + engineKey.getID() + " not found in engine service"); - throw new ApexException("engine with key " + engineKey.getID() + " not found in engine service"); + LOGGER.warn("engine with key " + engineKey.getId() + " not found in engine service"); + throw new ApexException("engine with key " + engineKey.getId() + " not found in engine service"); } // Start the engine @@ -499,8 +499,8 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven // Check if we have this key on our map if (!engineWorkerMap.containsKey(engineKey)) { - LOGGER.warn("engine with key " + engineKey.getID() + " not found in engine service"); - throw new ApexException("engine with key " + engineKey.getID() + " not found in engine service"); + LOGGER.warn("engine with key " + engineKey.getId() + " not found in engine service"); + throw new ApexException("engine with key " + engineKey.getId() + " not found in engine service"); } // Stop the engine @@ -536,7 +536,7 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven public boolean isStarted(final AxArtifactKey engineKey) { // Check if we have this key on our map if (!engineWorkerMap.containsKey(engineKey)) { - LOGGER.warn("engine with key " + engineKey.getID() + " not found in engine service"); + LOGGER.warn("engine with key " + engineKey.getId() + " not found in engine service"); } return engineWorkerMap.get(engineKey).isStarted(); } @@ -568,7 +568,7 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven public boolean isStopped(final AxArtifactKey engineKey) { // Check if we have this key on our map if (!engineWorkerMap.containsKey(engineKey)) { - LOGGER.warn("engine with key " + engineKey.getID() + " not found in engine service"); + LOGGER.warn("engine with key " + engineKey.getId() + " not found in engine service"); } return engineWorkerMap.get(engineKey).isStopped(); } @@ -582,9 +582,9 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven public void startPeriodicEvents(final long period) throws ApexException { // Check if periodic events are already started if (periodicEventGenerator != null) { - LOGGER.warn("Peiodic event geneation already running on engine " + engineServiceKey.getID() + ", " + LOGGER.warn("Peiodic event geneation already running on engine " + engineServiceKey.getId() + ", " + periodicEventGenerator.toString()); - throw new ApexException("Peiodic event geneation already running on engine " + engineServiceKey.getID() + throw new ApexException("Peiodic event geneation already running on engine " + engineServiceKey.getId() + ", " + periodicEventGenerator.toString()); } @@ -605,8 +605,8 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven public void stopPeriodicEvents() throws ApexException { // Check if periodic events are already started if (periodicEventGenerator == null) { - LOGGER.warn("Peiodic event geneation not running on engine " + engineServiceKey.getID()); - throw new ApexException("Peiodic event geneation not running on engine " + engineServiceKey.getID()); + LOGGER.warn("Peiodic event geneation not running on engine " + engineServiceKey.getId()); + throw new ApexException("Peiodic event geneation not running on engine " + engineServiceKey.getId()); } // Stop periodic events @@ -625,8 +625,8 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven public String getStatus(final AxArtifactKey engineKey) throws ApexException { // Check if we have this key on our map if (!engineWorkerMap.containsKey(engineKey)) { - LOGGER.warn("engine with key " + engineKey.getID() + " not found in engine service"); - throw new ApexException("engine with key " + engineKey.getID() + " not found in engine service"); + LOGGER.warn("engine with key " + engineKey.getId() + " not found in engine service"); + throw new ApexException("engine with key " + engineKey.getId() + " not found in engine service"); } // Return the information for this worker @@ -644,8 +644,8 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven public String getRuntimeInfo(final AxArtifactKey engineKey) throws ApexException { // Check if we have this key on our map if (!engineWorkerMap.containsKey(engineKey)) { - LOGGER.warn("engine with key " + engineKey.getID() + " not found in engine service"); - throw new ApexException("engine with key " + engineKey.getID() + " not found in engine service"); + LOGGER.warn("engine with key " + engineKey.getId() + " not found in engine service"); + throw new ApexException("engine with key " + engineKey.getId() + " not found in engine service"); } // Return the information for this worker @@ -664,12 +664,12 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven // Check if we have this key on our map if (getState() == AxEngineState.STOPPED) { LOGGER.warn("event " + event.getName() + " not processed, no engines on engine service " - + engineServiceKey.getID() + " are running"); + + engineServiceKey.getId() + " are running"); return; } if (event == null) { - LOGGER.warn("Null events cannot be processed, in engine service " + engineServiceKey.getID()); + LOGGER.warn("Null events cannot be processed, in engine service " + engineServiceKey.getId()); return; } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java index f82aae69b..be294aae7 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java @@ -131,7 +131,7 @@ final class EngineWorker implements EngineService { public void registerActionListener(final String listenerName, final ApexEventListener apexEventListener) { // Sanity checks on the Apex model if (engine == null) { - LOGGER.warn("listener registration on engine with key " + engineWorkerKey.getID() + LOGGER.warn("listener registration on engine with key " + engineWorkerKey.getId() + ", failed, listener is null"); return; } @@ -150,7 +150,7 @@ final class EngineWorker implements EngineService { public void deregisterActionListener(final String listenerName) { // Sanity checks on the Apex model if (engine == null) { - LOGGER.warn("listener deregistration on engine with key " + engineWorkerKey.getID() + LOGGER.warn("listener deregistration on engine with key " + engineWorkerKey.getId() + ", failed, listener is null"); return; } @@ -222,13 +222,13 @@ final class EngineWorker implements EngineService { final ApexModelReader<AxPolicyModel> modelReader = new ApexModelReader<>(AxPolicyModel.class); apexPolicyModel = modelReader.read(new ByteArrayInputStream(engineModel.getBytes())); } catch (final ApexModelException e) { - LOGGER.error("failed to unmarshal the apex model on engine " + engineKey.getID(), e); - throw new ApexException("failed to unmarshal the apex model on engine " + engineKey.getID(), e); + LOGGER.error("failed to unmarshal the apex model on engine " + engineKey.getId(), e); + throw new ApexException("failed to unmarshal the apex model on engine " + engineKey.getId(), e); } if (apexPolicyModel == null) { - LOGGER.error("apex model null on engine " + engineKey.getID()); - throw new ApexException("apex model null on engine " + engineKey.getID()); + LOGGER.error("apex model null on engine " + engineKey.getId()); + throw new ApexException("apex model null on engine " + engineKey.getId()); } // Update the Apex model in the Apex engine @@ -252,16 +252,16 @@ final class EngineWorker implements EngineService { // Check if the key on the update request is correct if (!engineWorkerKey.equals(engineKey)) { - LOGGER.warn("engine key " + engineKey.getID() + " does not match the key" + engineWorkerKey.getID() + LOGGER.warn("engine key " + engineKey.getId() + " does not match the key" + engineWorkerKey.getId() + " of this engine"); - throw new ApexException("engine key " + engineKey.getID() + " does not match the key" - + engineWorkerKey.getID() + " of this engine"); + throw new ApexException("engine key " + engineKey.getId() + " does not match the key" + + engineWorkerKey.getId() + " of this engine"); } // Sanity checks on the Apex model if (engine == null) { - LOGGER.warn("engine with key " + engineKey.getID() + " not initialized"); - throw new ApexException("engine with key " + engineKey.getID() + " not initialized"); + LOGGER.warn("engine with key " + engineKey.getId() + " not initialized"); + throw new ApexException("engine with key " + engineKey.getId() + " not initialized"); } // Check model compatibility @@ -270,14 +270,14 @@ final class EngineWorker implements EngineService { final AxPolicyModel currentModel = ModelService.getModel(AxPolicyModel.class); if (!currentModel.getKey().isCompatible(apexModel.getKey())) { if (forceFlag) { - LOGGER.warn("apex model update forced, supplied model with key \"" + apexModel.getKey().getID() + LOGGER.warn("apex model update forced, supplied model with key \"" + apexModel.getKey().getId() + "\" is not a compatible model update from the existing engine model with key \"" - + currentModel.getKey().getID() + "\""); + + currentModel.getKey().getId() + "\""); } else { throw new ContextException( - "apex model update failed, supplied model with key \"" + apexModel.getKey().getID() + "apex model update failed, supplied model with key \"" + apexModel.getKey().getId() + "\" is not a compatible model update from the existing engine model with key \"" - + currentModel.getKey().getID() + "\""); + + currentModel.getKey().getId() + "\""); } } } @@ -285,7 +285,7 @@ final class EngineWorker implements EngineService { // Update the Apex model in the Apex engine engine.updateModel(apexModel); - LOGGER.debug("engine model {} added to the engine-{}", apexModel.getKey().getID(), engineWorkerKey); + LOGGER.debug("engine model {} added to the engine-{}", apexModel.getKey().getId(), engineWorkerKey); LOGGER.exit(); } @@ -322,22 +322,22 @@ final class EngineWorker implements EngineService { // Check if the key on the start request is correct if (!engineWorkerKey.equals(engineKey)) { - LOGGER.warn("engine key " + engineKey.getID() + " does not match the key" + engineWorkerKey.getID() + LOGGER.warn("engine key " + engineKey.getId() + " does not match the key" + engineWorkerKey.getId() + " of this engine"); - throw new ApexException("engine key " + engineKey.getID() + " does not match the key" - + engineWorkerKey.getID() + " of this engine"); + throw new ApexException("engine key " + engineKey.getId() + " does not match the key" + + engineWorkerKey.getId() + " of this engine"); } if (engine == null) { - LOGGER.error("apex engine for engine key" + engineWorkerKey.getID() + " null"); - throw new ApexException("apex engine for engine key" + engineWorkerKey.getID() + " null"); + LOGGER.error("apex engine for engine key" + engineWorkerKey.getId() + " null"); + throw new ApexException("apex engine for engine key" + engineWorkerKey.getId() + " null"); } // Starts the event processing thread that handles incoming events if (processorThread != null && processorThread.isAlive()) { - LOGGER.error("apex engine for engine key" + engineWorkerKey.getID() + " is already running with state " + LOGGER.error("apex engine for engine key" + engineWorkerKey.getId() + " is already running with state " + getState()); - throw new ApexException("apex engine for engine key" + engineWorkerKey.getID() + throw new ApexException("apex engine for engine key" + engineWorkerKey.getId() + " is already running with state " + getState()); } @@ -372,22 +372,22 @@ final class EngineWorker implements EngineService { public void stop(final AxArtifactKey engineKey) throws ApexException { // Check if the key on the start request is correct if (!engineWorkerKey.equals(engineKey)) { - LOGGER.warn("engine key " + engineKey.getID() + " does not match the key" + engineWorkerKey.getID() + LOGGER.warn("engine key " + engineKey.getId() + " does not match the key" + engineWorkerKey.getId() + " of this engine"); - throw new ApexException("engine key " + engineKey.getID() + " does not match the key" - + engineWorkerKey.getID() + " of this engine"); + throw new ApexException("engine key " + engineKey.getId() + " does not match the key" + + engineWorkerKey.getId() + " of this engine"); } if (engine == null) { - LOGGER.error("apex engine for engine key" + engineWorkerKey.getID() + " null"); - throw new ApexException("apex engine for engine key" + engineWorkerKey.getID() + " null"); + LOGGER.error("apex engine for engine key" + engineWorkerKey.getId() + " null"); + throw new ApexException("apex engine for engine key" + engineWorkerKey.getId() + " null"); } // Interrupt the worker to stop its thread if (processorThread == null || !processorThread.isAlive()) { processorThread = null; - LOGGER.warn("apex engine for engine key" + engineWorkerKey.getID() + " is already stopped with state " + LOGGER.warn("apex engine for engine key" + engineWorkerKey.getId() + " is already stopped with state " + getState()); return; } diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/EvalDomainModelFactory.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/EvalDomainModelFactory.java index 83a4ccc76..a3f626f48 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/EvalDomainModelFactory.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/EvalDomainModelFactory.java @@ -263,8 +263,8 @@ public class EvalDomainModelFactory { policyModel.getKeyInformation().generateKeyInfo(policyModel); final AxValidationResult result = policyModel.validate(new AxValidationResult()); - if (!result.isOK()) { - throw new ApexRuntimeException("model " + policyModel.getID() + " is not valid" + result); + if (!result.isOk()) { + throw new ApexRuntimeException("model " + policyModel.getId() + " is not valid" + result); } return policyModel; } @@ -434,8 +434,8 @@ public class EvalDomainModelFactory { policyModel.getKeyInformation().generateKeyInfo(policyModel); final AxValidationResult result = policyModel.validate(new AxValidationResult()); - if (!result.isOK()) { - throw new ApexRuntimeException("model " + policyModel.getID() + " is not valid" + result); + if (!result.isOk()) { + throw new ApexRuntimeException("model " + policyModel.getId() + " is not valid" + result); } return policyModel; } diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/SampleDomainModelFactory.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/SampleDomainModelFactory.java index 24993674c..184529fa9 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/SampleDomainModelFactory.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/SampleDomainModelFactory.java @@ -535,7 +535,7 @@ public class SampleDomainModelFactory { AxValidationResult result = policyModel.validate(new AxValidationResult()); if (!result.getValidationResult().equals(AxValidationResult.ValidationResult.VALID)) { - throw new ApexRuntimeException("model " + policyModel.getID() + " is not valid" + result); + throw new ApexRuntimeException("model " + policyModel.getId() + " is not valid" + result); } return policyModel; } diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/SampleDomainModelSaver.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/SampleDomainModelSaver.java index c346d94c0..6ca644ff4 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/SampleDomainModelSaver.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/SampleDomainModelSaver.java @@ -51,32 +51,32 @@ public final class SampleDomainModelSaver { // Save Java model final AxPolicyModel javaPolicyModel = new SampleDomainModelFactory().getSamplePolicyModel("JAVA"); final ApexModelSaver<AxPolicyModel> javaModelSaver = new ApexModelSaver<AxPolicyModel>(AxPolicyModel.class, javaPolicyModel, args[0]); - javaModelSaver.apexModelWriteJSON(); - javaModelSaver.apexModelWriteXML(); + javaModelSaver.apexModelWriteJson(); + javaModelSaver.apexModelWriteXml(); // Save Javascript model final AxPolicyModel javascriptPolicyModel = new SampleDomainModelFactory().getSamplePolicyModel("JAVASCRIPT"); final ApexModelSaver<AxPolicyModel> javascriptModelSaver = new ApexModelSaver<AxPolicyModel>(AxPolicyModel.class, javascriptPolicyModel, args[0]); - javascriptModelSaver.apexModelWriteJSON(); - javascriptModelSaver.apexModelWriteXML(); + javascriptModelSaver.apexModelWriteJson(); + javascriptModelSaver.apexModelWriteXml(); // Save JRuby model final AxPolicyModel jRubyPolicyModel = new SampleDomainModelFactory().getSamplePolicyModel("JRUBY"); final ApexModelSaver<AxPolicyModel> jRubyModelSaver = new ApexModelSaver<AxPolicyModel>(AxPolicyModel.class, jRubyPolicyModel, args[0]); - jRubyModelSaver.apexModelWriteJSON(); - jRubyModelSaver.apexModelWriteXML(); + jRubyModelSaver.apexModelWriteJson(); + jRubyModelSaver.apexModelWriteXml(); // Save Jython model final AxPolicyModel jythonPolicyModel = new SampleDomainModelFactory().getSamplePolicyModel("JYTHON"); final ApexModelSaver<AxPolicyModel> jythonModelSaver = new ApexModelSaver<AxPolicyModel>(AxPolicyModel.class, jythonPolicyModel, args[0]); - jythonModelSaver.apexModelWriteJSON(); - jythonModelSaver.apexModelWriteXML(); + jythonModelSaver.apexModelWriteJson(); + jythonModelSaver.apexModelWriteXml(); // Save MVEL model final AxPolicyModel mvelPolicyModel = new SampleDomainModelFactory().getSamplePolicyModel("MVEL"); final ApexModelSaver<AxPolicyModel> mvelModelSaver = new ApexModelSaver<AxPolicyModel>(AxPolicyModel.class, mvelPolicyModel, args[0]); - mvelModelSaver.apexModelWriteJSON(); - mvelModelSaver.apexModelWriteXML(); + mvelModelSaver.apexModelWriteJson(); + mvelModelSaver.apexModelWriteXml(); } } diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyCreateModelFiles.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyCreateModelFiles.java index 8113436ca..384ad5114 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyCreateModelFiles.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyCreateModelFiles.java @@ -30,8 +30,8 @@ public class TestApexSamplePolicyCreateModelFiles { final TestApexSamplePolicyModelCreator apexPolicyModelCreator = new TestApexSamplePolicyModelCreator("JAVA"); final TestApexModel<AxPolicyModel> testApexPolicyModel = new TestApexModel<AxPolicyModel>(AxPolicyModel.class, apexPolicyModelCreator); - testApexPolicyModel.testApexModelWriteReadXML(); - testApexPolicyModel.testApexModelWriteReadJSON(); + testApexPolicyModel.testApexModelWriteReadXml(); + testApexPolicyModel.testApexModelWriteReadJson(); } @Test @@ -40,8 +40,8 @@ public class TestApexSamplePolicyCreateModelFiles { new TestApexSamplePolicyModelCreator("JAVASCRIPT"); final TestApexModel<AxPolicyModel> testApexPolicyModel = new TestApexModel<AxPolicyModel>(AxPolicyModel.class, apexPolicyModelCreator); - testApexPolicyModel.testApexModelWriteReadXML(); - testApexPolicyModel.testApexModelWriteReadJSON(); + testApexPolicyModel.testApexModelWriteReadXml(); + testApexPolicyModel.testApexModelWriteReadJson(); } @Test @@ -49,8 +49,8 @@ public class TestApexSamplePolicyCreateModelFiles { final TestApexSamplePolicyModelCreator apexPolicyModelCreator = new TestApexSamplePolicyModelCreator("JRUBY"); final TestApexModel<AxPolicyModel> testApexPolicyModel = new TestApexModel<AxPolicyModel>(AxPolicyModel.class, apexPolicyModelCreator); - testApexPolicyModel.testApexModelWriteReadXML(); - testApexPolicyModel.testApexModelWriteReadJSON(); + testApexPolicyModel.testApexModelWriteReadXml(); + testApexPolicyModel.testApexModelWriteReadJson(); } @Test @@ -58,8 +58,8 @@ public class TestApexSamplePolicyCreateModelFiles { final TestApexSamplePolicyModelCreator apexPolicyModelCreator = new TestApexSamplePolicyModelCreator("JYTHON"); final TestApexModel<AxPolicyModel> testApexPolicyModel = new TestApexModel<AxPolicyModel>(AxPolicyModel.class, apexPolicyModelCreator); - testApexPolicyModel.testApexModelWriteReadXML(); - testApexPolicyModel.testApexModelWriteReadJSON(); + testApexPolicyModel.testApexModelWriteReadXml(); + testApexPolicyModel.testApexModelWriteReadJson(); } @Test @@ -67,7 +67,7 @@ public class TestApexSamplePolicyCreateModelFiles { final TestApexSamplePolicyModelCreator apexPolicyModelCreator = new TestApexSamplePolicyModelCreator("MVEL"); final TestApexModel<AxPolicyModel> testApexPolicyModel = new TestApexModel<AxPolicyModel>(AxPolicyModel.class, apexPolicyModelCreator); - testApexPolicyModel.testApexModelWriteReadXML(); - testApexPolicyModel.testApexModelWriteReadJSON(); + testApexPolicyModel.testApexModelWriteReadXml(); + testApexPolicyModel.testApexModelWriteReadJson(); } } diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyDBWrite.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyDBWrite.java index 48e2f8058..45314672e 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyDBWrite.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyDBWrite.java @@ -26,7 +26,7 @@ import java.sql.DriverManager; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao; import org.onap.policy.apex.model.basicmodel.test.TestApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; @@ -50,10 +50,10 @@ public class TestApexSamplePolicyDBWrite { @Test public void testModelWriteReadJPA() throws Exception { - final DAOParameters daoParameters = new DAOParameters(); - daoParameters.setPluginClass(DefaultApexDao.class.getCanonicalName()); - daoParameters.setPersistenceUnit("SampleModelTest"); + final DaoParameters DaoParameters = new DaoParameters(); + DaoParameters.setPluginClass(DefaultApexDao.class.getCanonicalName()); + DaoParameters.setPersistenceUnit("SampleModelTest"); - testApexModel.testApexModelWriteReadJPA(daoParameters); + testApexModel.testApexModelWriteReadJpa(DaoParameters); } } diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyModel.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyModel.java index 3673dae2f..36810b44b 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyModel.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyModel.java @@ -29,7 +29,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; -import org.onap.policy.apex.model.basicmodel.dao.DAOParameters; +import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao; import org.onap.policy.apex.model.basicmodel.test.TestApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; @@ -60,21 +60,21 @@ public class TestApexSamplePolicyModel { @Test public void testModelWriteReadXML() throws Exception { - testApexModel.testApexModelWriteReadXML(); + testApexModel.testApexModelWriteReadXml(); } @Test public void testModelWriteReadJSON() throws Exception { - testApexModel.testApexModelWriteReadJSON(); + testApexModel.testApexModelWriteReadJson(); } @Test public void testModelWriteReadJPA() throws Exception { - final DAOParameters daoParameters = new DAOParameters(); - daoParameters.setPluginClass(DefaultApexDao.class.getCanonicalName()); - daoParameters.setPersistenceUnit("SampleModelTest"); + final DaoParameters DaoParameters = new DaoParameters(); + DaoParameters.setPluginClass(DefaultApexDao.class.getCanonicalName()); + DaoParameters.setPersistenceUnit("SampleModelTest"); - testApexModel.testApexModelWriteReadJPA(daoParameters); + testApexModel.testApexModelWriteReadJpa(DaoParameters); } diff --git a/testsuites/integration/integration-executor-test/src/test/resources/META-INF/persistence.xml b/testsuites/integration/integration-executor-test/src/test/resources/META-INF/persistence.xml index 5ba5bfa4c..40773a4d4 100644 --- a/testsuites/integration/integration-executor-test/src/test/resources/META-INF/persistence.xml +++ b/testsuites/integration/integration-executor-test/src/test/resources/META-INF/persistence.xml @@ -23,8 +23,8 @@ <persistence-unit name="SampleModelTest" transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner</class> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner</class> + <class>org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxConcept</class> <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class> diff --git a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/KeyInfoGetter.java b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/KeyInfoGetter.java index a04ed49f3..f7dfe8456 100644 --- a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/KeyInfoGetter.java +++ b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/KeyInfoGetter.java @@ -131,10 +131,10 @@ public class KeyInfoGetter { */ public String getUUID(final AxArtifactKey key) { final AxKeyInfo ki = model.getKeyInformation().get(key); - if (ki == null || ki.getUUID() == null) { + if (ki == null || ki.getUuid() == null) { return null; } - return ki.getUUID().toString(); + return ki.getUuid().toString(); } /** diff --git a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/SchemaUtils.java b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/SchemaUtils.java index 3a4feb049..545d15eeb 100644 --- a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/SchemaUtils.java +++ b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/SchemaUtils.java @@ -112,7 +112,7 @@ public final class SchemaUtils { } } catch (final AvroRuntimeException e) { throw new ApexEventException("failed to decode a schema for parameter " + parameter.getKey().getLocalName() - + " of type " + parameter.getSchema().getID() + " with Java type " + schemaHelper.getSchemaClass(), + + " of type " + parameter.getSchema().getId() + " with Java type " + schemaHelper.getSchemaClass(), e); } final String schemaname = parameterSchema.getFullName(); @@ -126,7 +126,7 @@ public final class SchemaUtils { processSubSchemas(parameterSchema, preexistingParamSchemas); } catch (AvroRuntimeException | ApexEventException e) { throw new ApexEventException("failed to decode a schema for parameter " + parameter.getKey().getLocalName() - + " of type " + parameter.getSchema().getID() + " using Schema type " + schemaname, e); + + " of type " + parameter.getSchema().getId() + " using Schema type " + schemaname, e); } if (alreadyseen != null) { // logger.warn("parameter "+ parameter.getKey().getLocalName() + " of type " + parameter.getSchema().getID() diff --git a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java index d374a6c60..2712e5d33 100644 --- a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java +++ b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java @@ -121,7 +121,7 @@ public class Model2Cli { if (validate) { final AxValidationResult val = new AxValidationResult(); policyModel.validate(val); - if (!val.isOK()) { + if (!val.isOk()) { System.err.println("Cannot translate the model. The model is not valid: \n" + val.toString()); return -1; } |