aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java76
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/AbstractDistributor.java44
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java13
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/JvmLocalDistributor.java8
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/AbstractLockManager.java10
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/ephemeral/EphemeralPersistor.java11
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java27
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperJsonAdapterParameters.java40
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperParameters.java22
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/parameters/ContextParameterConstants.java21
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/parameters/ContextParameters.java76
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/parameters/DistributorParameters.java22
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/parameters/LockManagerParameters.java22
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/parameters/PersistorParameters.java31
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/parameters/SchemaHelperParameters.java29
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/parameters/SchemaParameters.java22
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java119
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java71
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java81
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java47
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java68
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextAlbumsTest.java11
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextModelTest.java4
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextSchemasTest.java11
-rw-r--r--model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/EngineModelTest.java4
-rw-r--r--model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparerTest.java32
-rw-r--r--model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseValues.txt12
-rw-r--r--model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonIdenticalVerboseValues.txt12
28 files changed, 171 insertions, 775 deletions
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 eb2383cae..65a253f87 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
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +28,9 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
import org.onap.policy.apex.context.ContextAlbum;
import org.onap.policy.apex.context.ContextException;
import org.onap.policy.apex.context.ContextRuntimeException;
@@ -47,6 +51,7 @@ import org.slf4j.ext.XLoggerFactory;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@EqualsAndHashCode(onlyExplicitlyIncluded = true)
public final class ContextAlbumImpl implements ContextAlbum, Comparable<ContextAlbumImpl> {
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(ContextAlbumImpl.class);
@@ -56,18 +61,24 @@ public final class ContextAlbumImpl implements ContextAlbum, Comparable<ContextA
private static final String ALBUM = "album \"";
// The definition of this context album
+ @Getter
+ @EqualsAndHashCode.Include
private final AxContextAlbum albumDefinition;
/// The map holding the items and their values for this context album
+ @EqualsAndHashCode.Include
private final Map<String, Object> albumMap;
// The artifact stack of the artifacts currently using the context album
+ @Getter
+ @Setter
private AxConcept[] userArtifactStack = null;
// The context distributor we are using
private final Distributor distributor;
// The schema helper that handles translations of Java objects for this album
+ @Getter
private SchemaHelper schemaHelper;
// The context monitor for this context album
@@ -130,22 +141,6 @@ public final class ContextAlbumImpl implements ContextAlbum, Comparable<ContextA
* {@inheritDoc}.
*/
@Override
- public AxContextAlbum getAlbumDefinition() {
- return albumDefinition;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public SchemaHelper getSchemaHelper() {
- return schemaHelper;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public void lockForReading(final String keyOnAlbum) throws ContextException {
distributor.lockForReading(albumDefinition.getKey(), keyOnAlbum);
monitor.monitorReadLock(albumDefinition.getKey(), albumDefinition.getItemSchema(), keyOnAlbum,
@@ -186,22 +181,6 @@ public final class ContextAlbumImpl implements ContextAlbum, Comparable<ContextA
* {@inheritDoc}.
*/
@Override
- public AxConcept[] getUserArtifactStack() {
- return userArtifactStack;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void setUserArtifactStack(final AxConcept[] userArtifactStack) {
- this.userArtifactStack = userArtifactStack;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public void flush() throws ContextException {
distributor.flushContextAlbum(this);
}
@@ -461,37 +440,4 @@ public final class ContextAlbumImpl implements ContextAlbum, Comparable<ContextA
public int compareTo(ContextAlbumImpl otherContextAlbumImpl) {
return (equals(otherContextAlbumImpl) ? 0 : 1);
}
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + albumDefinition.hashCode();
- result = prime * result + albumMap.hashCode();
- return result;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof ContextAlbumImpl)) {
- return false;
- }
- ContextAlbumImpl other = (ContextAlbumImpl) obj;
- if (!albumDefinition.equals(other.albumDefinition)) {
- return false;
- }
- return albumMap.equals(other.albumMap);
- }
}
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 3444f9342..4d5d01c86 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
@@ -26,6 +26,9 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.Setter;
import org.onap.policy.apex.context.ContextAlbum;
import org.onap.policy.apex.context.ContextException;
import org.onap.policy.apex.context.Distributor;
@@ -56,22 +59,25 @@ public abstract class AbstractDistributor implements Distributor {
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(AbstractDistributor.class);
- // The key of this distributor
- private AxArtifactKey key = null;
-
// The context albums for this context set indexed by their keys
private static Map<AxArtifactKey, ContextAlbum> albumMaps = Collections
.synchronizedMap(new HashMap<AxArtifactKey, ContextAlbum>());
// Lock manager for this distributor
+ @Setter(AccessLevel.PRIVATE)
private static LockManager lockManager = null;
- // Hold a persistor for this distributor
- private Persistor persistor = null;
-
// Hold a flush timer for this context distributor
+ @Setter(AccessLevel.PRIVATE)
private static DistributorFlushTimerTask flushTimer = null;
+ // The key of this distributor
+ @Getter
+ private AxArtifactKey key = null;
+
+ // Hold a persistor for this distributor
+ private Persistor persistor = null;
+
/**
* Create an instance of an abstract Context Distributor.
*/
@@ -106,38 +112,12 @@ public abstract class AbstractDistributor implements Distributor {
}
/**
- * Set the static lock manager.
- *
- * @param incomingLockManager the lock manager value
- */
- private static void setLockManager(final LockManager incomingLockManager) {
- lockManager = incomingLockManager;
- }
-
- /**
- * Set the static flush timer.
- *
- * @param incomingFlushTimer the flush timer value
- */
- private static void setFlushTimer(final DistributorFlushTimerTask incomingFlushTimer) {
- flushTimer = incomingFlushTimer;
- }
-
- /**
* {@inheritDoc}.
*/
@Override
public abstract void shutdown();
/**
- * {@inheritDoc}.
- */
- @Override
- public AxArtifactKey getKey() {
- return key;
- }
-
- /**
* Create a context album using whatever underlying mechanism we are using for albums.
*
* @param contextAlbumKey The key of the album
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 e68f0812c..e98e66148 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
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@ package org.onap.policy.apex.context.impl.distribution;
import java.util.Timer;
import java.util.TimerTask;
+import lombok.ToString;
import org.onap.policy.apex.context.ContextException;
import org.onap.policy.apex.context.Distributor;
import org.onap.policy.apex.context.parameters.ContextParameterConstants;
@@ -35,13 +37,16 @@ import org.slf4j.ext.XLoggerFactory;
*
* @author eeilfn
*/
+@ToString
public class DistributorFlushTimerTask extends TimerTask {
private static final XLogger LOGGER = XLoggerFactory.getXLogger(DistributorFlushTimerTask.class);
// The timer for flushing
+ @ToString.Exclude
private Timer timer = null;
// The context distributor to flush
+ @ToString.Exclude
private final Distributor contextDistributor;
// Timing information
@@ -104,12 +109,4 @@ public class DistributorFlushTimerTask extends TimerTask {
}
return true;
}
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public String toString() {
- return "ContextDistributorFlushTimerTask [period=" + flushPeriod + ", flushCount=" + flushCount + "]";
- }
}
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 ff61bc0bb..65924f463 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
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,13 +39,6 @@ public class JvmLocalDistributor extends AbstractDistributor {
private static final XLogger LOGGER = XLoggerFactory.getXLogger(JvmLocalDistributor.class);
/**
- * Create an instance of a JVM Local Context Distributor.
- */
- public JvmLocalDistributor() {
- super();
- }
-
- /**
* {@inheritDoc}.
*/
@Override
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/AbstractLockManager.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/AbstractLockManager.java
index 4eb878b1c..2ef229193 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/AbstractLockManager.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/AbstractLockManager.java
@@ -25,6 +25,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.ReadWriteLock;
+import lombok.Getter;
import org.onap.policy.apex.context.ContextException;
import org.onap.policy.apex.context.LockManager;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
@@ -45,6 +46,7 @@ public abstract class AbstractLockManager implements LockManager {
private static final String CONTEXT_ITEM = " context item ";
// The key of this lock manager
+ @Getter
private AxArtifactKey key = null;
// Map of locks in use on this distributor for each context map
@@ -63,14 +65,6 @@ public abstract class AbstractLockManager implements LockManager {
* {@inheritDoc}.
*/
@Override
- public AxArtifactKey getKey() {
- return key;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public synchronized void lockForReading(final String lockTypeKey, final String lockKey) throws ContextException {
LOGGER.entry("lockForReading(" + lockTypeKey + "_" + lockKey + ")");
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/ephemeral/EphemeralPersistor.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/ephemeral/EphemeralPersistor.java
index 32f026633..c4fd5054d 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/ephemeral/EphemeralPersistor.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/ephemeral/EphemeralPersistor.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@ package org.onap.policy.apex.context.impl.persistence.ephemeral;
import java.util.Set;
import java.util.TreeSet;
+import lombok.Getter;
import org.onap.policy.apex.context.ContextException;
import org.onap.policy.apex.context.Persistor;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
@@ -34,6 +36,7 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@Getter
public class EphemeralPersistor implements Persistor {
// The key of this persistor
@@ -51,14 +54,6 @@ public class EphemeralPersistor implements Persistor {
* {@inheritDoc}.
*/
@Override
- public AxArtifactKey getKey() {
- return key;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public AxContextSchema readContextItem(final AxReferenceKey itemKey, final Class<?> contextItemClass) {
// Can't read from this persistor as nothing is persisted
return null;
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 44ec22267..d94a59d38 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
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@
package org.onap.policy.apex.context.impl.schema;
import java.lang.reflect.Constructor;
+import lombok.Getter;
import org.apache.commons.lang3.NotImplementedException;
import org.onap.policy.apex.context.ContextRuntimeException;
import org.onap.policy.apex.context.SchemaHelper;
@@ -38,6 +40,7 @@ import org.slf4j.ext.XLoggerFactory;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@Getter
public abstract class AbstractSchemaHelper implements SchemaHelper {
// Get a reference to the logger
private static final XLogger LOGGER = XLoggerFactory.getXLogger(AbstractSchemaHelper.class);
@@ -78,30 +81,6 @@ public abstract class AbstractSchemaHelper implements SchemaHelper {
* {@inheritDoc}.
*/
@Override
- public AxKey getUserKey() {
- return userKey;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public AxContextSchema getSchema() {
- return schema;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public Class<?> getSchemaClass() {
- return schemaClass;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public Object getSchemaObject() {
return null;
}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperJsonAdapterParameters.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperJsonAdapterParameters.java
index 75099f6ad..588f1e6a2 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperJsonAdapterParameters.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperJsonAdapterParameters.java
@@ -24,6 +24,8 @@ package org.onap.policy.apex.context.impl.schema.java;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonSerializer;
import com.google.gson.TypeAdapter;
+import lombok.Getter;
+import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.common.parameters.BeanValidator;
@@ -45,6 +47,8 @@ import org.slf4j.ext.XLoggerFactory;
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
//@formatter:on
+@Getter
+@Setter
public class JavaSchemaHelperJsonAdapterParameters implements ParameterGroup {
private static final XLogger LOGGER = XLoggerFactory.getXLogger(JavaSchemaHelperJsonAdapterParameters.class);
@@ -76,15 +80,6 @@ public class JavaSchemaHelperJsonAdapterParameters implements ParameterGroup {
*
* @return the adapted class
*/
- public String getAdaptedClass() {
- return adaptedClass;
- }
-
- /**
- * Gets the adapted class.
- *
- * @return the adapted class
- */
public Class<?> getAdaptedClazz() {
if (adaptedClass == null) {
return null;
@@ -99,24 +94,6 @@ public class JavaSchemaHelperJsonAdapterParameters implements ParameterGroup {
}
/**
- * Sets the adapted class.
- *
- * @param adaptedClass the new adapted class
- */
- public void setAdaptedClass(String adaptedClass) {
- this.adaptedClass = adaptedClass;
- }
-
- /**
- * Gets the adaptor class.
- *
- * @return the adaptor class
- */
- public String getAdaptorClass() {
- return adaptorClass;
- }
-
- /**
* Gets the adaptor class.
*
* @return the adaptor class
@@ -135,15 +112,6 @@ public class JavaSchemaHelperJsonAdapterParameters implements ParameterGroup {
}
/**
- * Sets the adaptor class.
- *
- * @param adaptorClass the new adaptor class
- */
- public void setAdaptorClass(String adaptorClass) {
- this.adaptorClass = adaptorClass;
- }
-
- /**
* {@inheritDoc}.
*/
@Override
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperParameters.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperParameters.java
index 417a2e8ce..65970fdc2 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperParameters.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperParameters.java
@@ -23,6 +23,8 @@ package org.onap.policy.apex.context.impl.schema.java;
import java.util.LinkedHashMap;
import java.util.Map;
+import lombok.Getter;
+import lombok.Setter;
import org.onap.policy.apex.context.parameters.SchemaHelperParameters;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
@@ -32,6 +34,8 @@ import org.onap.policy.common.parameters.annotations.Valid;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@Getter
+@Setter
public class JavaSchemaHelperParameters extends SchemaHelperParameters {
// Map of specific type adapters for this event
private Map<String, @NotNull @Valid JavaSchemaHelperJsonAdapterParameters> jsonAdapters = new LinkedHashMap<>();
@@ -44,22 +48,4 @@ public class JavaSchemaHelperParameters extends SchemaHelperParameters {
this.setSchemaHelperPluginClass(JavaSchemaHelper.class.getName());
}
- /**
- * Get the JSON adapters.
- *
- * @return the JSON adapters
- */
- public Map<String, JavaSchemaHelperJsonAdapterParameters> getJsonAdapters() {
- return jsonAdapters;
- }
-
- /**
- * Set JSON adapters for the schema helper.
- *
- * @param jsonAdapters the JSON adapters
- */
- public void setJsonAdapters(Map<String, JavaSchemaHelperJsonAdapterParameters> jsonAdapters) {
- this.jsonAdapters = jsonAdapters;
- }
-
}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/ContextParameterConstants.java b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/ContextParameterConstants.java
index 9b2ce9c02..d007a1d8d 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/ContextParameterConstants.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/ContextParameterConstants.java
@@ -1,41 +1,38 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
package org.onap.policy.apex.context.parameters;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
/**
* This class holds constants used when managing context parameter groups in apex.
*/
-public abstract class ContextParameterConstants {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ContextParameterConstants {
public static final String MAIN_GROUP_NAME = "CONTEXT_PARAMETERS";
public static final String SCHEMA_GROUP_NAME = "CONTEXT_SCHEMA_PARAMETERS";
public static final String SCHEMA_HELPER_GROUP_NAME = "CONTEXT_SCHEMA_HELPER_PARAMETERS";
public static final String DISTRIBUTOR_GROUP_NAME = "CONTEXT_DISTRIBUTOR_PARAMETERS";
public static final String LOCKING_GROUP_NAME = "CONTEXT_LOCKING_PARAMETERS";
public static final String PERSISTENCE_GROUP_NAME = "CONTEXT_PERSISTENCE_PARAMETERS";
-
- /**
- * Private default constructor to prevent subclassing.
- */
- private ContextParameterConstants() {
- // Prevents subclassing
- }
-
}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/ContextParameters.java b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/ContextParameters.java
index 56b6c8ec4..78c5cb3fc 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/ContextParameters.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/ContextParameters.java
@@ -21,6 +21,8 @@
package org.onap.policy.apex.context.parameters;
+import lombok.Getter;
+import lombok.Setter;
import org.onap.policy.common.parameters.ParameterGroupImpl;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
@@ -45,6 +47,8 @@ import org.onap.policy.common.parameters.annotations.Valid;
* </ol>
*/
@NotNull
+@Getter
+@Setter
public class ContextParameters extends ParameterGroupImpl {
private @Valid DistributorParameters distributorParameters = new DistributorParameters();
private @Valid SchemaParameters schemaParameters = new SchemaParameters();
@@ -59,78 +63,6 @@ public class ContextParameters extends ParameterGroupImpl {
super(ContextParameterConstants.MAIN_GROUP_NAME);
}
- /**
- * Gets the distributor parameters.
- *
- * @return the distributor parameters
- */
- public DistributorParameters getDistributorParameters() {
- return distributorParameters;
- }
-
- /**
- * Sets the distributor parameters.
- *
- * @param distributorParameters the distributor parameters
- */
- public void setDistributorParameters(final DistributorParameters distributorParameters) {
- this.distributorParameters = distributorParameters;
- }
-
- /**
- * Gets the schema parameters.
- *
- * @return the schema parameters
- */
- public SchemaParameters getSchemaParameters() {
- return schemaParameters;
- }
-
- /**
- * Sets the schema parameters.
- *
- * @param schemaParameters the schema parameters
- */
- public void setSchemaParameters(final SchemaParameters schemaParameters) {
- this.schemaParameters = schemaParameters;
- }
-
- /**
- * Gets the lock manager parameters.
- *
- * @return the lock manager parameters
- */
- public LockManagerParameters getLockManagerParameters() {
- return lockManagerParameters;
- }
-
- /**
- * Sets the lock manager parameters.
- *
- * @param lockManagerParameters the lock manager parameters
- */
- public void setLockManagerParameters(final LockManagerParameters lockManagerParameters) {
- this.lockManagerParameters = lockManagerParameters;
- }
-
- /**
- * Gets the persistor parameters.
- *
- * @return the persistor parameters
- */
- public PersistorParameters getPersistorParameters() {
- return persistorParameters;
- }
-
- /**
- * Sets the persistor parameters.
- *
- * @param persistorParameters the persistor parameters
- */
- public void setPersistorParameters(final PersistorParameters persistorParameters) {
- this.persistorParameters = persistorParameters;
- }
-
@Override
public String toString() {
return "ContextParameters [name=" + getName() + ", distributorParameters=" + distributorParameters
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/DistributorParameters.java b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/DistributorParameters.java
index e1432e6c5..575a8c466 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/DistributorParameters.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/DistributorParameters.java
@@ -21,6 +21,8 @@
package org.onap.policy.apex.context.parameters;
+import lombok.Getter;
+import lombok.Setter;
import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor;
import org.onap.policy.common.parameters.ParameterGroupImpl;
import org.onap.policy.common.parameters.annotations.ClassName;
@@ -34,6 +36,8 @@ import org.onap.policy.common.parameters.annotations.NotNull;
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@NotNull
+@Getter
+@Setter
public class DistributorParameters extends ParameterGroupImpl {
/** The default distributor makes context albums available to all threads in a single JVM. */
public static final String DEFAULT_DISTRIBUTOR_PLUGIN_CLASS = JvmLocalDistributor.class.getName();
@@ -48,24 +52,6 @@ public class DistributorParameters extends ParameterGroupImpl {
super(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME);
}
- /**
- * Gets the plugin class.
- *
- * @return the plugin class
- */
- public String getPluginClass() {
- return pluginClass;
- }
-
- /**
- * Sets the plugin class.
- *
- * @param pluginClass the plugin class
- */
- public void setPluginClass(final String pluginClass) {
- this.pluginClass = pluginClass;
- }
-
@Override
public String toString() {
return "DistributorParameters [name=" + getName() + ", pluginClass=" + pluginClass + "]";
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/LockManagerParameters.java b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/LockManagerParameters.java
index d49adf464..d1feae8b7 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/LockManagerParameters.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/LockManagerParameters.java
@@ -21,6 +21,8 @@
package org.onap.policy.apex.context.parameters;
+import lombok.Getter;
+import lombok.Setter;
import org.onap.policy.apex.context.impl.locking.jvmlocal.JvmLocalLockManager;
import org.onap.policy.common.parameters.ParameterGroupImpl;
import org.onap.policy.common.parameters.annotations.ClassName;
@@ -34,6 +36,8 @@ import org.onap.policy.common.parameters.annotations.NotNull;
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@NotNull
+@Getter
+@Setter
public class LockManagerParameters extends ParameterGroupImpl {
/**
* The default lock manager can lock context album instance across all threads in a single JVM.
@@ -50,24 +54,6 @@ public class LockManagerParameters extends ParameterGroupImpl {
super(ContextParameterConstants.LOCKING_GROUP_NAME);
}
- /**
- * Gets the plugin class.
- *
- * @return the plugin class
- */
- public String getPluginClass() {
- return pluginClass;
- }
-
- /**
- * Sets the plugin class.
- *
- * @param pluginClass the plugin class
- */
- public void setPluginClass(final String pluginClass) {
- this.pluginClass = pluginClass;
- }
-
@Override
public String toString() {
return "LockManagerParameters [name=" + getName() + ", pluginClass=" + pluginClass + "]";
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/PersistorParameters.java b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/PersistorParameters.java
index 98865cd88..bdb093780 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/PersistorParameters.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/PersistorParameters.java
@@ -21,6 +21,8 @@
package org.onap.policy.apex.context.parameters;
+import lombok.Getter;
+import lombok.Setter;
import org.onap.policy.common.parameters.ParameterGroupImpl;
import org.onap.policy.common.parameters.annotations.ClassName;
import org.onap.policy.common.parameters.annotations.NotNull;
@@ -39,6 +41,8 @@ import org.onap.policy.common.parameters.annotations.NotNull;
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@NotNull
+@Getter
+@Setter
public class PersistorParameters extends ParameterGroupImpl {
/** The default persistor is a dummy persistor that stubs the Persistor interface. */
public static final String DEFAULT_PERSISTOR_PLUGIN_CLASS =
@@ -61,33 +65,6 @@ public class PersistorParameters extends ParameterGroupImpl {
}
/**
- * Gets the plugin class.
- *
- * @return the plugin class
- */
- public String getPluginClass() {
- return pluginClass;
- }
-
- /**
- * Sets the plugin class.
- *
- * @param pluginClass the plugin class
- */
- public void setPluginClass(final String pluginClass) {
- this.pluginClass = pluginClass;
- }
-
- /**
- * Gets the flush period in milliseconds.
- *
- * @return the flush period
- */
- public long getFlushPeriod() {
- return flushPeriod;
- }
-
- /**
* Sets the flush period in milliseconds.
*
* @param flushPeriod the flush period
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/SchemaHelperParameters.java b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/SchemaHelperParameters.java
index 0c6d3592b..62feadd28 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/SchemaHelperParameters.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/SchemaHelperParameters.java
@@ -21,6 +21,8 @@
package org.onap.policy.apex.context.parameters;
+import lombok.Getter;
+import lombok.Setter;
import org.onap.policy.common.parameters.ParameterGroupImpl;
import org.onap.policy.common.parameters.annotations.ClassName;
import org.onap.policy.common.parameters.annotations.NotNull;
@@ -32,34 +34,11 @@ import org.onap.policy.common.parameters.annotations.NotNull;
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@NotNull
+@Getter
+@Setter
public class SchemaHelperParameters extends ParameterGroupImpl {
private @ClassName String schemaHelperPluginClass;
- /**
- * Constructor to create a schema helper parameters instance and register the instance with the parameter service.
- */
- public SchemaHelperParameters() {
- super();
- }
-
- /**
- * Gets the schema helper plugin class.
- *
- * @return the schema helper plugin class
- */
- public String getSchemaHelperPluginClass() {
- return schemaHelperPluginClass;
- }
-
- /**
- * Sets the schema helper plugin class.
- *
- * @param pluginClass the schema helper plugin class
- */
- public void setSchemaHelperPluginClass(final String pluginClass) {
- schemaHelperPluginClass = pluginClass;
- }
-
@Override
public String toString() {
return "SchemaHelperParameters [name=" + getName() + ", schemaHelperPluginClass=" + schemaHelperPluginClass
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/SchemaParameters.java b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/SchemaParameters.java
index a1dedc5c0..3d371c6f2 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/SchemaParameters.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/SchemaParameters.java
@@ -23,6 +23,8 @@ package org.onap.policy.apex.context.parameters;
import java.util.Map;
import java.util.TreeMap;
+import lombok.Getter;
+import lombok.Setter;
import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters;
import org.onap.policy.common.parameters.ParameterGroupImpl;
import org.onap.policy.common.parameters.annotations.NotNull;
@@ -39,6 +41,8 @@ import org.onap.policy.common.parameters.annotations.Valid;
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@NotNull
+@Getter
+@Setter
public class SchemaParameters extends ParameterGroupImpl {
/** The Java schema flavour is always available for use. */
public static final String DEFAULT_SCHEMA_FLAVOUR = "Java";
@@ -60,24 +64,6 @@ public class SchemaParameters extends ParameterGroupImpl {
}
/**
- * Gets a map of the schemas and schema helper parameters that are defined.
- *
- * @return the schema helper parameter map
- */
- public Map<String, SchemaHelperParameters> getSchemaHelperParameterMap() {
- return schemaHelperParameterMap;
- }
-
- /**
- * Sets the map of the schemas and schema helper parameters.
- *
- * @param schemaHelperParameterMap the schema helper parameter map
- */
- public void setSchemaHelperParameterMap(final Map<String, SchemaHelperParameters> schemaHelperParameterMap) {
- this.schemaHelperParameterMap = schemaHelperParameterMap;
- }
-
- /**
* Gets the schema helper parameters for a given context schema flavour.
*
* @param schemaFlavour the schema flavour for which to get the schema helper parameters
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java
index 85a6ab803..b3880bd8c 100644
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java
@@ -34,6 +34,10 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
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.AxKey;
@@ -66,6 +70,10 @@ import org.onap.policy.common.utils.validation.Assertions;
@Entity
@Table(name = "AxContextAlbum")
+@Getter
+@ToString
+@EqualsAndHashCode(callSuper = false)
+
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "apexContextAlbum", namespace = "http://www.onap.org/policy/apex-pdp")
@XmlType(name = "AxContextAlbum", namespace = "http://www.onap.org/policy/apex-pdp", propOrder =
@@ -84,9 +92,6 @@ public class AxContextAlbum extends AxConcept {
/** The value of scope for a context album for which a scope has not been specified. */
public static final String SCOPE_UNDEFINED = "UNDEFINED";
- private static final int HASH_PRIME_0 = 1231;
- private static final int HASH_PRIME_1 = 1237;
-
@EmbeddedId
@XmlElement(name = "key", required = true)
private AxArtifactKey key;
@@ -97,6 +102,7 @@ public class AxContextAlbum extends AxConcept {
@Column(name = "isWritable")
@XmlElement(name = "isWritable", required = true)
+ @Setter
private boolean isWritable;
// @formatter:off
@@ -165,14 +171,6 @@ public class AxContextAlbum extends AxConcept {
* {@inheritDoc}.
*/
@Override
- public AxArtifactKey getKey() {
- return key;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public List<AxKey> getKeys() {
final List<AxKey> keyList = key.getKeys();
keyList.add(new AxKeyUse(itemSchema.getKey()));
@@ -191,15 +189,6 @@ public class AxContextAlbum extends AxConcept {
}
/**
- * Gets the scope of the context album.
- *
- * @return the context album scope
- */
- public String getScope() {
- return scope;
- }
-
- /**
* Sets the scope of the context album.
*
* @param scope the context album scope
@@ -210,33 +199,6 @@ public class AxContextAlbum extends AxConcept {
}
/**
- * Sets whether the album is writable or not.
- *
- * @param writable the writable flag value
- */
- public void setWritable(final boolean writable) {
- this.isWritable = writable;
- }
-
- /**
- * Checks if the album is writable.
- *
- * @return true, if the album is writable
- */
- public boolean isWritable() {
- return isWritable;
- }
-
- /**
- * Gets the artifact key of the item schema of this context album.
- *
- * @return the item schema key
- */
- public AxArtifactKey getItemSchema() {
- return itemSchema;
- }
-
- /**
* Sets the artifact key of the item schema of this context album.
*
* @param itemSchema the item schema key
@@ -293,26 +255,6 @@ public class AxContextAlbum extends AxConcept {
* {@inheritDoc}.
*/
@Override
- public String toString() {
- final var builder = new StringBuilder();
- builder.append(this.getClass().getSimpleName());
- builder.append(":(");
- builder.append("key=");
- builder.append(key);
- builder.append(",scope=");
- builder.append(scope);
- builder.append(",isWritable=");
- builder.append(isWritable);
- builder.append(",itemSchema=");
- builder.append(itemSchema);
- builder.append(")");
- return builder.toString();
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public AxConcept copyTo(final AxConcept target) {
Assertions.argumentNotNull(target, "targetObject may not be null");
@@ -332,49 +274,6 @@ public class AxContextAlbum extends AxConcept {
* {@inheritDoc}.
*/
@Override
- public int hashCode() {
- final var prime = 31;
- var result = 1;
- result = prime * result + key.hashCode();
- result = prime * result + scope.hashCode();
- result = prime * result + (isWritable ? HASH_PRIME_0 : HASH_PRIME_1);
- result = prime * result + itemSchema.hashCode();
- return result;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public boolean equals(final Object obj) {
- if (obj == null) {
- return false;
- }
- if (this == obj) {
- return true;
- }
-
- if (getClass() != obj.getClass()) {
- return false;
- }
-
- final AxContextAlbum other = (AxContextAlbum) obj;
- if (!key.equals(other.key)) {
- return false;
- }
- if (!scope.equals(other.scope)) {
- return false;
- }
- if (isWritable != other.isWritable) {
- return (false);
- }
- return itemSchema.equals(other.itemSchema);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public int compareTo(final AxConcept otherObj) {
if (otherObj == null) {
return -1;
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java
index 30e021f43..aa5a89a4d 100644
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,6 +40,10 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
+import lombok.AccessLevel;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;
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.AxConceptGetter;
@@ -63,6 +68,10 @@ import org.onap.policy.common.utils.validation.Assertions;
@Entity
@Table(name = "AxContextAlbums")
+@Getter
+@ToString
+@EqualsAndHashCode(callSuper = false)
+
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AxContextAlbums", namespace = "http://www.onap.org/policy/apex-pdp", propOrder =
{ "key", "albums" })
@@ -79,6 +88,7 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
@JoinTable(joinColumns = {@JoinColumn(name = "contextName", referencedColumnName = "name"),
@JoinColumn(name = "contextVersion", referencedColumnName = "version")})
@XmlElement(name = "albums", required = true)
+ @Getter(AccessLevel.NONE)
private Map<AxArtifactKey, AxContextAlbum> albums;
// @formatter:on
@@ -148,14 +158,6 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
* {@inheritDoc}.
*/
@Override
- public AxArtifactKey getKey() {
- return key;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public List<AxKey> getKeys() {
final List<AxKey> keyList = key.getKeys();
@@ -212,24 +214,6 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
* {@inheritDoc}.
*/
@Override
- public String toString() {
- final var builder = new StringBuilder();
- builder.append(this.getClass().getSimpleName());
- builder.append(":(");
- builder.append(this.getClass().getSimpleName());
- builder.append(":(");
- builder.append("key=");
- builder.append(key);
- builder.append(",albums=");
- builder.append(albums);
- builder.append(")");
- return builder.toString();
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public AxValidationResult validate(final AxValidationResult resultIn) {
AxValidationResult result = resultIn;
@@ -299,41 +283,6 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
* {@inheritDoc}.
*/
@Override
- public int hashCode() {
- final var prime = 31;
- var result = 1;
- result = prime * result + key.hashCode();
- result = prime * result + albums.hashCode();
- return result;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public boolean equals(final Object obj) {
- if (obj == null) {
- return false;
- }
- if (this == obj) {
- return true;
- }
-
- if (getClass() != obj.getClass()) {
- return false;
- }
-
- final AxContextAlbums other = (AxContextAlbums) obj;
- if (!key.equals(other.key)) {
- return false;
- }
- return albums.equals(other.albums);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public int compareTo(final AxConcept otherObj) {
if (otherObj == null) {
return -1;
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java
index c5919c030..9796fa625 100644
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java
@@ -33,6 +33,9 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;
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.AxKey;
@@ -54,6 +57,10 @@ import org.onap.policy.common.utils.validation.Assertions;
@Entity
@Table(name = "AxContextModel")
+@Getter
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = true)
+
@XmlRootElement(name = "apexContextModel", namespace = "http://www.onap.org/policy/apex-pdp")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AxContextModel", namespace = "http://www.onap.org/policy/apex-pdp",
@@ -160,15 +167,6 @@ public class AxContextModel extends AxModel {
}
/**
- * Gets the context schemas from the model.
- *
- * @return the context schemas
- */
- public AxContextSchemas getSchemas() {
- return schemas;
- }
-
- /**
* Sets the context schemas on the model.
*
* @param schemas the context schemas
@@ -179,15 +177,6 @@ public class AxContextModel extends AxModel {
}
/**
- * Gets the context albums from the model.
- *
- * @return the context albums
- */
- public AxContextAlbums getAlbums() {
- return albums;
- }
-
- /**
* Sets the context albums on the model.
*
* @param albums the context albums
@@ -223,23 +212,6 @@ public class AxContextModel extends AxModel {
* {@inheritDoc}.
*/
@Override
- public String toString() {
- final var builder = new StringBuilder();
- builder.append(this.getClass().getSimpleName());
- builder.append(":(");
- builder.append(super.toString());
- builder.append(",schemas=");
- builder.append(schemas);
- builder.append(",albums=");
- builder.append(albums);
- builder.append(")");
- return builder.toString();
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public AxConcept copyTo(final AxConcept target) {
Assertions.argumentNotNull(target, "target may not be null");
@@ -258,45 +230,6 @@ public class AxContextModel extends AxModel {
* {@inheritDoc}.
*/
@Override
- public int hashCode() {
- final var prime = 31;
- var result = 1;
- result = prime * result + super.hashCode();
- result = prime * result + schemas.hashCode();
- result = prime * result + albums.hashCode();
- return result;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public boolean equals(final Object obj) {
- if (obj == null) {
- throw new IllegalArgumentException("comparison object may not be null");
- }
-
- if (this == obj) {
- return true;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
-
- final AxContextModel other = (AxContextModel) obj;
- if (!super.equals(other)) {
- return false;
- }
- if (!schemas.equals(other.schemas)) {
- return false;
- }
- return albums.equals(other.albums);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public int compareTo(final AxConcept otherObj) {
Assertions.argumentNotNull(otherObj, "comparison object may not be null");
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 bca369157..37f44ba49 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
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,6 +34,9 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.ToString;
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.AxKey;
@@ -63,6 +67,9 @@ import org.onap.policy.common.utils.validation.Assertions;
@Entity
@Table(name = "AxContextSchema")
+@Getter
+@ToString
+
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "apexContextSchema", namespace = "http://www.onap.org/policy/apex-pdp")
@XmlType(name = "AxContextSchema", namespace = "http://www.onap.org/policy/apex-pdp", propOrder =
@@ -95,6 +102,7 @@ public class AxContextSchema extends AxConcept {
@Convert(converter = CDataConditioner.class)
@XmlJavaTypeAdapter(value = CDataConditioner.class)
@XmlElement(name = "schemaDefinition", required = true)
+ @Getter(AccessLevel.NONE)
private String schemaDefinition;
/**
@@ -147,14 +155,6 @@ public class AxContextSchema extends AxConcept {
* {@inheritDoc}.
*/
@Override
- public AxArtifactKey getKey() {
- return key;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public List<AxKey> getKeys() {
return key.getKeys();
}
@@ -170,15 +170,6 @@ public class AxContextSchema extends AxConcept {
}
/**
- * Gets the schema flavour, which defines the schema definition type being used.
- *
- * @return the schema flavour
- */
- public String getSchemaFlavour() {
- return schemaFlavour;
- }
-
- /**
* Sets the schema flavour, which defines the type of schema definition being used.
*
* @param schemaFlavour the schema flavour
@@ -255,24 +246,6 @@ public class AxContextSchema extends AxConcept {
* {@inheritDoc}.
*/
@Override
- public String toString() {
- final var builder = new StringBuilder();
- builder.append(this.getClass().getSimpleName());
- builder.append(":(");
- builder.append("key=");
- builder.append(key);
- builder.append(",schemaFlavour=");
- builder.append(schemaFlavour);
- builder.append(",schemaDefinition=");
- builder.append(schemaDefinition);
- builder.append(")");
- return builder.toString();
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public AxConcept copyTo(final AxConcept target) {
Assertions.argumentNotNull(target, "target may not be null");
@@ -296,7 +269,9 @@ public class AxContextSchema extends AxConcept {
var result = 1;
result = prime * result + key.hashCode();
result = prime * result + schemaFlavour.hashCode();
- result = prime * result + schemaDefinition.hashCode();
+
+ final String thisSchema = CDataConditioner.clean(schemaDefinition).replace("\n", "");
+ result = prime * result + thisSchema.hashCode();
return result;
}
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java
index bfd1809a7..1fa0cf57a 100644
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,6 +40,10 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
+import lombok.AccessLevel;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;
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.AxConceptGetter;
@@ -62,6 +67,10 @@ import org.onap.policy.common.utils.validation.Assertions;
@Entity
@Table(name = "AxContextSchemas")
+@Getter
+@ToString
+@EqualsAndHashCode(callSuper = false)
+
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AxContextSchemas", namespace = "http://www.onap.org/policy/apex-pdp", propOrder =
{ "key", "schemas" })
@@ -81,6 +90,7 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
inverseJoinColumns = {@JoinColumn(name = "contextSchemaName", referencedColumnName = "name"),
@JoinColumn(name = "contextSchemaVersion", referencedColumnName = "version")})
@XmlElement(name = "schemas", required = true)
+ @Getter(AccessLevel.NONE)
private Map<AxArtifactKey, AxContextSchema> schemas;
// @formatter:on
@@ -147,14 +157,6 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
* {@inheritDoc}.
*/
@Override
- public AxArtifactKey getKey() {
- return key;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public List<AxKey> getKeys() {
final List<AxKey> keyList = key.getKeys();
keyList.addAll(schemas.keySet());
@@ -252,22 +254,6 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
* {@inheritDoc}.
*/
@Override
- public String toString() {
- final var builder = new StringBuilder();
- builder.append(this.getClass().getSimpleName());
- builder.append(":(");
- builder.append("key=");
- builder.append(key);
- builder.append(",schemas=");
- builder.append(schemas);
- builder.append(")");
- return builder.toString();
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public AxConcept copyTo(final AxConcept target) {
Assertions.argumentNotNull(target, "target may not be null");
@@ -291,40 +277,6 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
* {@inheritDoc}.
*/
@Override
- public int hashCode() {
- final var prime = 31;
- var result = 1;
- result = prime * result + key.hashCode();
- result = prime * result + schemas.hashCode();
- return result;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public boolean equals(final Object obj) {
- if (obj == null) {
- return false;
- }
- if (this == obj) {
- return true;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
-
- final AxContextSchemas other = (AxContextSchemas) obj;
- if (!key.equals(other.key)) {
- return false;
- }
- return schemas.equals(other.schemas);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public int compareTo(final AxConcept otherObj) {
if (otherObj == null) {
return -1;
diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextAlbumsTest.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextAlbumsTest.java
index 8293feb5b..44161b329 100644
--- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextAlbumsTest.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextAlbumsTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,11 +22,11 @@
package org.onap.policy.apex.model.contextmodel.concepts;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
@@ -138,8 +139,8 @@ public class ContextAlbumsTest {
album.setItemSchema(albumSchemaKey);
final AxContextAlbum clonedAlbum = new AxContextAlbum(album);
- assertEquals("AxContextAlbum:(key=AxArtifactKey:(name=NewAlbumName,version=0.0.1),"
- + "scope=NewAlbumScope,isWritable=true,itemSchema="
+ assertEquals("AxContextAlbum(key=AxArtifactKey:(name=NewAlbumName,version=0.0.1), "
+ + "scope=NewAlbumScope, isWritable=true, itemSchema="
+ "AxArtifactKey:(name=AlbumSchemaName,version=0.0.1))", clonedAlbum.toString());
assertNotEquals(0, album.hashCode());
@@ -220,8 +221,8 @@ public class ContextAlbumsTest {
albums.clean();
final AxContextAlbums clonedAlbums = new AxContextAlbums(albums);
- assertTrue(clonedAlbums.toString().startsWith(
- "AxContextAlbums:(AxContextAlbums:(key=AxArtifactKey:(name=AlbumsKey,version=0.0.1)"));
+ assertThat(clonedAlbums.toString()).startsWith(
+ "AxContextAlbums(key=AxArtifactKey:(name=AlbumsKey,version=0.0.1)");
assertNotEquals(0, albums.hashCode());
diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextModelTest.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextModelTest.java
index eab561e25..b148ef6be 100644
--- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextModelTest.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextModelTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +22,7 @@
package org.onap.policy.apex.model.contextmodel.concepts;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
@@ -54,7 +56,7 @@ public class ContextModelTest {
model.clean();
assertNotNull(model);
- assertEquals("AxContextModel:(AxContextModel:(key=AxArtifactKey:", model.toString().substring(0, 50));
+ assertThat(model.toString()).startsWith("AxContextModel(super=AxContextModel:(key=AxArtifactKey:");
final AxContextModel clonedModel = new AxContextModel(model);
diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextSchemasTest.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextSchemasTest.java
index fbca04d7e..52cca14bf 100644
--- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextSchemasTest.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextSchemasTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,11 +22,11 @@
package org.onap.policy.apex.model.contextmodel.concepts;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
@@ -121,8 +122,8 @@ public class ContextSchemasTest {
schema.clean();
final AxContextSchema clonedSchema = new AxContextSchema(schema);
- assertEquals("AxContextSchema:(key=AxArtifactKey:(name=NewSchemaName,version=0.0.1),"
- + "schemaFlavour=NewSchemaFlavour,schemaDefinition=NewSchemaDefinition)",
+ assertEquals("AxContextSchema(key=AxArtifactKey:(name=NewSchemaName,version=0.0.1), "
+ + "schemaFlavour=NewSchemaFlavour, schemaDefinition=NewSchemaDefinition)",
clonedSchema.toString());
assertNotEquals(0, schema.hashCode());
@@ -201,8 +202,8 @@ public class ContextSchemasTest {
schemas.clean();
final AxContextSchemas clonedSchemas = new AxContextSchemas(schemas);
- assertTrue(clonedSchemas.toString()
- .startsWith("AxContextSchemas:(key=AxArtifactKey:(name=SchemasKey,version=0.0.1),"));
+ assertThat(clonedSchemas.toString())
+ .startsWith("AxContextSchemas(key=AxArtifactKey:(name=SchemasKey,version=0.0.1),");
assertNotEquals(0, schemas.hashCode());
diff --git a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/EngineModelTest.java b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/EngineModelTest.java
index 5c87e5621..c23687bb1 100644
--- a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/EngineModelTest.java
+++ b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/EngineModelTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +22,7 @@
package org.onap.policy.apex.model.enginemodel.concepts;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
@@ -92,7 +94,7 @@ public class EngineModelTest {
model.clean();
assertNotNull(model);
- assertEquals("AxEngineModel:(AxEngineModel:(AxEngineModel:(key=A", model.toString().substring(0, 50));
+ assertThat(model.toString()).startsWith("AxEngineModel:(AxContextModel(super=AxEngineModel:(key=A");
final AxEngineModel clonedModel = new AxEngineModel(model);
diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparerTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparerTest.java
index f148f7d2a..0a1e80a20 100644
--- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparerTest.java
+++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparerTest.java
@@ -44,26 +44,26 @@ public class PolicyModelComparerTest {
String resultString = policyModelComparer.asString(false, false);
String checkString = TextFileUtils
.getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonIdenticalVerboseValues.txt");
- assertEquals(resultString.trim().replaceAll("[\\r?\\n]+", " "),
- checkString.trim().replaceAll("[\\r?\\n]+", " "));
+ assertEquals(resultString.trim().replaceAll("\\s+", ""),
+ checkString.trim().replaceAll("\\s+", ""));
resultString = policyModelComparer.asString(false, true);
checkString = TextFileUtils
.getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonIdenticalVerboseKeys.txt");
- assertEquals(checkString.trim().replaceAll("[\\r?\\n]+", " "),
- resultString.trim().replaceAll("[\\r?\\n]+", " "));
+ assertEquals(checkString.trim().replaceAll("\\s+", ""),
+ resultString.trim().replaceAll("\\s+", ""));
resultString = policyModelComparer.asString(true, false);
checkString = TextFileUtils
.getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonIdenticalTerse.txt");
- assertEquals(checkString.trim().replaceAll("[\\r?\\n]+", " "),
- resultString.trim().replaceAll("[\\r?\\n]+", " "));
+ assertEquals(checkString.trim().replaceAll("\\s+", ""),
+ resultString.trim().replaceAll("\\s+", ""));
resultString = policyModelComparer.asString(true, true);
checkString = TextFileUtils
.getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonIdenticalTerse.txt");
- assertEquals(checkString.trim().replaceAll("[\\r?\\n]+", " "),
- resultString.trim().replaceAll("[\\r?\\n]+", " "));
+ assertEquals(checkString.trim().replaceAll("\\s+", ""),
+ resultString.trim().replaceAll("\\s+", ""));
final AxKeyInfo leftOnlyKeyInfo = new AxKeyInfo(new AxArtifactKey("LeftOnlyKeyInfo", "0.0.1"),
UUID.fromString("ce9168c-e6df-414f-9646-6da464b6f000"), "Left only key info");
@@ -83,26 +83,26 @@ public class PolicyModelComparerTest {
resultString = policyModelComparer.asString(false, false);
checkString = TextFileUtils
.getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseValues.txt");
- assertEquals(resultString.trim().replaceAll("[\\r?\\n]+", " "),
- checkString.trim().replaceAll("[\\r?\\n]+", " "));
+ assertEquals(resultString.trim().replaceAll("\\s+", ""),
+ checkString.trim().replaceAll("\\s+", ""));
resultString = policyModelComparer.asString(false, true);
checkString = TextFileUtils
.getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseKeys.txt");
- assertEquals(checkString.trim().replaceAll("[\\r?\\n]+", " "),
- resultString.trim().replaceAll("[\\r?\\n]+", " "));
+ assertEquals(checkString.trim().replaceAll("\\s+", ""),
+ resultString.trim().replaceAll("\\s+", ""));
resultString = policyModelComparer.asString(true, false);
checkString = TextFileUtils
.getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonDifferentTerseValues.txt");
- assertEquals(checkString.trim().replaceAll("[\\r?\\n]+", " "),
- resultString.trim().replaceAll("[\\r?\\n]+", " "));
+ assertEquals(checkString.trim().replaceAll("\\s+", ""),
+ resultString.trim().replaceAll("\\s+", ""));
resultString = policyModelComparer.asString(true, true);
checkString = TextFileUtils
.getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonDifferentTerseKeys.txt");
- assertEquals(checkString.trim().replaceAll("[\\r?\\n]+", " "),
- resultString.trim().replaceAll("[\\r?\\n]+", " "));
+ assertEquals(checkString.trim().replaceAll("\\s+", ""),
+ resultString.trim().replaceAll("\\s+", ""));
assertNotNull(policyModelComparer.getContextAlbumComparisonResult());
assertNotNull(policyModelComparer.getContextAlbumKeyDifference());
diff --git a/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseValues.txt b/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseValues.txt
index 7dd0b3955..2138e97f0 100644
--- a/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseValues.txt
+++ b/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseValues.txt
@@ -6,10 +6,10 @@ left key AxArtifactKey:(name=PolicyModel,version=0.0.1) equals right key AxArtif
*** all right keys in left
*** all values in left and right are identical
*** list of identical entries in left and right
-key=AxArtifactKey:(name=MapType,version=0.0.1),value=AxContextSchema:(key=AxArtifactKey:(name=MapType,version=0.0.1),schemaFlavour=Java,schemaDefinition=org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A)
-key=AxArtifactKey:(name=StringType,version=0.0.1),value=AxContextSchema:(key=AxArtifactKey:(name=StringType,version=0.0.1),schemaFlavour=Java,schemaDefinition=org.onap.policy.apex.model.policymodel.concepts.TestContextItem000)
-key=AxArtifactKey:(name=eventContextItem0,version=0.0.1),value=AxContextSchema:(key=AxArtifactKey:(name=eventContextItem0,version=0.0.1),schemaFlavour=Java,schemaDefinition=java.lang.String)
-key=AxArtifactKey:(name=eventContextItem1,version=0.0.1),value=AxContextSchema:(key=AxArtifactKey:(name=eventContextItem1,version=0.0.1),schemaFlavour=Java,schemaDefinition=java.lang.Long)
+key=AxArtifactKey:(name=MapType,version=0.0.1),value=AxContextSchema(key=AxArtifactKey:(name=MapType,version=0.0.1),schemaFlavour=Java,schemaDefinition=org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A)
+key=AxArtifactKey:(name=StringType,version=0.0.1),value=AxContextSchema(key=AxArtifactKey:(name=StringType,version=0.0.1),schemaFlavour=Java,schemaDefinition=org.onap.policy.apex.model.policymodel.concepts.TestContextItem000)
+key=AxArtifactKey:(name=eventContextItem0,version=0.0.1),value=AxContextSchema(key=AxArtifactKey:(name=eventContextItem0,version=0.0.1),schemaFlavour=Java,schemaDefinition=java.lang.String)
+key=AxArtifactKey:(name=eventContextItem1,version=0.0.1),value=AxContextSchema(key=AxArtifactKey:(name=eventContextItem1,version=0.0.1),schemaFlavour=Java,schemaDefinition=java.lang.Long)
*** event differences ***
left key AxArtifactKey:(name=PolicyModel,version=0.0.1) equals right key AxArtifactKey:(name=PolicyModel,version=0.0.1)
*** all left keys in right
@@ -25,8 +25,8 @@ left key AxArtifactKey:(name=PolicyModel,version=0.0.1) equals right key AxArtif
*** all right keys in left
*** all values in left and right are identical
*** list of identical entries in left and right
-key=AxArtifactKey:(name=contextAlbum0,version=0.0.1),value=AxContextAlbum:(key=AxArtifactKey:(name=contextAlbum0,version=0.0.1),scope=APPLICATION,isWritable=true,itemSchema=AxArtifactKey:(name=MapType,version=0.0.1))
-key=AxArtifactKey:(name=contextAlbum1,version=0.0.1),value=AxContextAlbum:(key=AxArtifactKey:(name=contextAlbum1,version=0.0.1),scope=GLOBAL,isWritable=false,itemSchema=AxArtifactKey:(name=StringType,version=0.0.1))
+key=AxArtifactKey:(name=contextAlbum0,version=0.0.1),value=AxContextAlbum(key=AxArtifactKey:(name=contextAlbum0,version=0.0.1),scope=APPLICATION,isWritable=true,itemSchema=AxArtifactKey:(name=MapType,version=0.0.1))
+key=AxArtifactKey:(name=contextAlbum1,version=0.0.1),value=AxContextAlbum(key=AxArtifactKey:(name=contextAlbum1,version=0.0.1),scope=GLOBAL,isWritable=false,itemSchema=AxArtifactKey:(name=StringType,version=0.0.1))
*** task differences ***
left key AxArtifactKey:(name=PolicyModel,version=0.0.1) equals right key AxArtifactKey:(name=PolicyModel,version=0.0.1)
*** all left keys in right
diff --git a/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonIdenticalVerboseValues.txt b/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonIdenticalVerboseValues.txt
index 149bec002..0faab1cdb 100644
--- a/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonIdenticalVerboseValues.txt
+++ b/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonIdenticalVerboseValues.txt
@@ -6,10 +6,10 @@ left key AxArtifactKey:(name=PolicyModel,version=0.0.1) equals right key AxArtif
*** all right keys in left
*** all values in left and right are identical
*** list of identical entries in left and right
-key=AxArtifactKey:(name=MapType,version=0.0.1),value=AxContextSchema:(key=AxArtifactKey:(name=MapType,version=0.0.1),schemaFlavour=Java,schemaDefinition=org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A)
-key=AxArtifactKey:(name=StringType,version=0.0.1),value=AxContextSchema:(key=AxArtifactKey:(name=StringType,version=0.0.1),schemaFlavour=Java,schemaDefinition=org.onap.policy.apex.model.policymodel.concepts.TestContextItem000)
-key=AxArtifactKey:(name=eventContextItem0,version=0.0.1),value=AxContextSchema:(key=AxArtifactKey:(name=eventContextItem0,version=0.0.1),schemaFlavour=Java,schemaDefinition=java.lang.String)
-key=AxArtifactKey:(name=eventContextItem1,version=0.0.1),value=AxContextSchema:(key=AxArtifactKey:(name=eventContextItem1,version=0.0.1),schemaFlavour=Java,schemaDefinition=java.lang.Long)
+key=AxArtifactKey:(name=MapType,version=0.0.1),value=AxContextSchema(key=AxArtifactKey:(name=MapType,version=0.0.1),schemaFlavour=Java,schemaDefinition=org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A)
+key=AxArtifactKey:(name=StringType,version=0.0.1),value=AxContextSchema(key=AxArtifactKey:(name=StringType,version=0.0.1),schemaFlavour=Java,schemaDefinition=org.onap.policy.apex.model.policymodel.concepts.TestContextItem000)
+key=AxArtifactKey:(name=eventContextItem0,version=0.0.1),value=AxContextSchema(key=AxArtifactKey:(name=eventContextItem0,version=0.0.1),schemaFlavour=Java,schemaDefinition=java.lang.String)
+key=AxArtifactKey:(name=eventContextItem1,version=0.0.1),value=AxContextSchema(key=AxArtifactKey:(name=eventContextItem1,version=0.0.1),schemaFlavour=Java,schemaDefinition=java.lang.Long)
*** event differences ***
left key AxArtifactKey:(name=PolicyModel,version=0.0.1) equals right key AxArtifactKey:(name=PolicyModel,version=0.0.1)
*** all left keys in right
@@ -25,8 +25,8 @@ left key AxArtifactKey:(name=PolicyModel,version=0.0.1) equals right key AxArtif
*** all right keys in left
*** all values in left and right are identical
*** list of identical entries in left and right
-key=AxArtifactKey:(name=contextAlbum0,version=0.0.1),value=AxContextAlbum:(key=AxArtifactKey:(name=contextAlbum0,version=0.0.1),scope=APPLICATION,isWritable=true,itemSchema=AxArtifactKey:(name=MapType,version=0.0.1))
-key=AxArtifactKey:(name=contextAlbum1,version=0.0.1),value=AxContextAlbum:(key=AxArtifactKey:(name=contextAlbum1,version=0.0.1),scope=GLOBAL,isWritable=false,itemSchema=AxArtifactKey:(name=StringType,version=0.0.1))
+key=AxArtifactKey:(name=contextAlbum0,version=0.0.1),value=AxContextAlbum(key=AxArtifactKey:(name=contextAlbum0,version=0.0.1),scope=APPLICATION,isWritable=true,itemSchema=AxArtifactKey:(name=MapType,version=0.0.1))
+key=AxArtifactKey:(name=contextAlbum1,version=0.0.1),value=AxContextAlbum(key=AxArtifactKey:(name=contextAlbum1,version=0.0.1),scope=GLOBAL,isWritable=false,itemSchema=AxArtifactKey:(name=StringType,version=0.0.1))
*** task differences ***
left key AxArtifactKey:(name=PolicyModel,version=0.0.1) equals right key AxArtifactKey:(name=PolicyModel,version=0.0.1)
*** all left keys in right