diff options
Diffstat (limited to 'context/context-management/src')
12 files changed, 54 insertions, 51 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 305f14c8d..0f991ba36 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 @@ -424,7 +424,7 @@ public final class ContextAlbumImpl implements ContextAlbum { } // Sanity check on incoming context - Assertions.argumentNotNull(incomingContextAlbum, ContextRuntimeException.class, + Assertions.argumentOfClassNotNull(incomingContextAlbum, ContextRuntimeException.class, "cannot update context, context album is null"); // Iterate over the incoming context diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFactory.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFactory.java index dba81d321..55df01b40 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFactory.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFactory.java @@ -49,7 +49,7 @@ public class DistributorFactory { public Distributor getDistributor(final AxArtifactKey key) throws ContextException { LOGGER.entry("Distributor factory, key=" + key); - Assertions.argumentNotNull(key, ContextException.class, "Parameter \"key\" may not be null"); + Assertions.argumentOfClassNotNull(key, ContextException.class, "Parameter \"key\" may not be null"); // Get the class for the distributor using reflection final DistributorParameters distributorParameters = ParameterService 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 cb9a77883..701c59342 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 @@ -34,14 +34,14 @@ import org.slf4j.ext.XLoggerFactory; * * @author Liam Fallon (liam.fallon@ericsson.com) */ -public class JVMLocalDistributor extends AbstractDistributor { +public class JvmLocalDistributor extends AbstractDistributor { // Logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(JVMLocalDistributor.class); + private static final XLogger LOGGER = XLoggerFactory.getXLogger(JvmLocalDistributor.class); /** * Create an instance of a JVM Local Context Distributor. */ - public JVMLocalDistributor() { + public JvmLocalDistributor() { super(); } diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/LockManagerFactory.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/LockManagerFactory.java index c45e3bd27..3e9120672 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/LockManagerFactory.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/LockManagerFactory.java @@ -66,8 +66,8 @@ public class LockManagerFactory { // Check the class is a lock manager if (!(lockManagerObject instanceof LockManager)) { - LOGGER.error("Specified Apex context lock manager plugin class \"{}\" does not implement the LockManager interface", - pluginClass); + LOGGER.error("Specified Apex context lock manager plugin class \"{}\" " + + "does not implement the LockManager interface", pluginClass); throw new ContextException("Specified Apex context lock manager plugin class \"" + pluginClass + "\" does not implement the LockManager interface"); } diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/jvmlocal/JVMLocalLockManager.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/jvmlocal/JvmLocalLockManager.java index 5e71557b8..721aa7f3c 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/jvmlocal/JVMLocalLockManager.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/jvmlocal/JvmLocalLockManager.java @@ -32,7 +32,7 @@ import org.onap.policy.apex.context.impl.locking.AbstractLockManager; * * @author Liam Fallon (liam.fallon@ericsson.com) */ -public class JVMLocalLockManager extends AbstractLockManager { +public class JvmLocalLockManager extends AbstractLockManager { /* * (non-Javadoc) * diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/PersistorFactory.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/PersistorFactory.java index 34fa15dcb..60de80a7f 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/PersistorFactory.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/PersistorFactory.java @@ -48,7 +48,7 @@ public class PersistorFactory { */ public Persistor createPersistor(final AxArtifactKey key) throws ContextException { LOGGER.entry("persistor factory, key=" + key); - Assertions.argumentNotNull(key, ContextException.class, "Parameter \"key\" may not be null"); + Assertions.argumentOfClassNotNull(key, ContextException.class, "Parameter \"key\" may not be null"); final PersistorParameters persistorParameters = ParameterService .get(ContextParameterConstants.PERSISTENCE_GROUP_NAME); @@ -67,8 +67,8 @@ public class PersistorFactory { // Check the class is a persistor if (!(persistorObject instanceof Persistor)) { - LOGGER.error("Specified Apex context persistor plugin class \"{}\" does not implement the ContextDistributor interface", - pluginClass); + LOGGER.error("Specified Apex context persistor plugin class \"{}\" " + + "does not implement the ContextDistributor interface", pluginClass); throw new ContextException("Specified Apex context persistor plugin class \"" + pluginClass + "\" does not implement the ContextDistributor interface"); } 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 5513cc7e6..bb22827cd 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 @@ -32,8 +32,8 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * This class implements the {@link SchemaHelper} functionality that is common across all - * implementations. Schema helpers for specific schema mechanisms specialize this class. + * This class implements the {@link SchemaHelper} functionality that is common across all implementations. Schema + * helpers for specific schema mechanisms specialize this class. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -62,14 +62,15 @@ public abstract class AbstractSchemaHelper implements SchemaHelper { /* * (non-Javadoc) * - * @see - * org.onap.policy.apex.context.SchemaHelper#init(org.onap.policy.apex.model.basicmodel.concepts - * .AxKey, org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema) + * @see org.onap.policy.apex.context.SchemaHelper#init(org.onap.policy.apex.model.basicmodel.concepts .AxKey, + * org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema) */ @Override public void init(final AxKey incomingUserKey, final AxContextSchema incomingSchema) throws ContextRuntimeException { - Assertions.argumentNotNull(incomingUserKey, ContextRuntimeException.class, "incomingUserKey may not be null"); - Assertions.argumentNotNull(incomingSchema, ContextRuntimeException.class, "incomingSchema may not be null"); + Assertions.argumentOfClassNotNull(incomingUserKey, ContextRuntimeException.class, + "incomingUserKey may not be null"); + Assertions.argumentOfClassNotNull(incomingSchema, ContextRuntimeException.class, + "incomingSchema may not be null"); this.userKey = incomingUserKey; this.schema = incomingSchema; @@ -123,8 +124,8 @@ public abstract class AbstractSchemaHelper implements SchemaHelper { @Override public Object createNewInstance() { if (schemaClass == null) { - final String returnString = - userKey.getId() + ": could not create an instance, schema class for the schema is null"; + final String returnString = userKey.getId() + + ": could not create an instance, schema class for the schema is null"; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } @@ -132,9 +133,9 @@ public abstract class AbstractSchemaHelper implements SchemaHelper { try { return schemaClass.newInstance(); } catch (final Exception e) { - final String returnString = - userKey.getId() + ": could not create an instance of class \"" + schemaClass.getCanonicalName() - + "\" using the default constructor \"" + schemaClass.getSimpleName() + "()\""; + final String returnString = 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); } @@ -148,8 +149,8 @@ public abstract class AbstractSchemaHelper implements SchemaHelper { @Override 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"; + final String returnString = userKey.getId() + + ": could not create an instance, schema class for the schema is null"; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } @@ -161,9 +162,9 @@ public abstract class AbstractSchemaHelper implements SchemaHelper { // Invoke the constructor return stringConstructor.newInstance(stringValue); } catch (final Exception e) { - final String returnString = - userKey.getId() + ": could not create an instance of class \"" + schemaClass.getCanonicalName() - + "\" using the string constructor \"" + schemaClass.getSimpleName() + "(String)\""; + final String returnString = 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 c6120c783..efc89b50d 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 @@ -54,15 +54,16 @@ public class SchemaHelperFactory { */ public SchemaHelper createSchemaHelper(final AxKey owningEntityKey, final AxArtifactKey schemaKey) { LOGGER.entry("schema helper factory, owningEntityKey=" + owningEntityKey); - Assertions.argumentNotNull(owningEntityKey, ContextRuntimeException.class, - "Parameter \"owningEntityKey\" may not be null"); - Assertions.argumentNotNull(schemaKey, ContextRuntimeException.class, "Parameter \"schemaKey\" may not be null"); + Assertions.argumentOfClassNotNull(owningEntityKey, ContextRuntimeException.class, + "Parameter \"owningEntityKey\" may not be null"); + Assertions.argumentOfClassNotNull(schemaKey, ContextRuntimeException.class, + "Parameter \"schemaKey\" may not be null"); // Get the schema for items in the album 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"; + final String resultString = "schema \"" + schemaKey.getId() + "\" for entity " + owningEntityKey.getId() + + " does not exist"; LOGGER.warn(resultString); throw new ContextRuntimeException(resultString); } @@ -71,11 +72,11 @@ public class SchemaHelperFactory { final SchemaParameters schemaParameters = ParameterService.get(ContextParameterConstants.SCHEMA_GROUP_NAME); // Get the class for the schema helper from the schema parameters - final SchemaHelperParameters schemaHelperParameters = - schemaParameters.getSchemaHelperParameters(schema.getSchemaFlavour()); + final SchemaHelperParameters schemaHelperParameters = schemaParameters + .getSchemaHelperParameters(schema.getSchemaFlavour()); if (schemaHelperParameters == null) { final String resultString = "context schema helper parameters not found for context schema \"" - + schema.getSchemaFlavour() + "\""; + + schema.getSchemaFlavour() + "\""; LOGGER.warn(resultString); throw new ContextRuntimeException(resultString); } @@ -87,7 +88,7 @@ public class SchemaHelperFactory { schemaHelperObject = Class.forName(pluginClass).newInstance(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { final String resultString = "Apex context schema helper class not found for context schema helper plugin \"" - + pluginClass + "\""; + + pluginClass + "\""; LOGGER.warn(resultString, e); throw new ContextRuntimeException(resultString, e); } @@ -95,7 +96,7 @@ public class SchemaHelperFactory { // Check the class is a schema helper if (!(schemaHelperObject instanceof SchemaHelper)) { final String resultString = "Specified Apex context schema helper plugin class \"" + pluginClass - + "\" does not implement the SchemaHelper interface"; + + "\" does not implement the SchemaHelper interface"; LOGGER.warn(resultString); throw new ContextRuntimeException(resultString); } @@ -107,7 +108,7 @@ public class SchemaHelperFactory { schemaHelper.init(owningEntityKey.getKey(), schema); LOGGER.exit("Schema Helper factory, owningEntityKey=" + owningEntityKey + ", selected schema helper of class " - + schemaHelper.getClass()); + + schemaHelper.getClass()); return schemaHelper; } } 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 e3f58cae4..79310a0e2 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 @@ -20,7 +20,7 @@ package org.onap.policy.apex.context.parameters; -import org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor; +import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor; import org.onap.policy.common.parameters.GroupValidationResult; import org.onap.policy.common.parameters.ParameterGroup; @@ -33,7 +33,7 @@ import org.onap.policy.common.parameters.ParameterGroup; */ public class DistributorParameters implements ParameterGroup { /** The default distributor makes context albums available to all threads in a single JVM. */ - public static final String DEFAULT_DISTRIBUTOR_PLUGIN_CLASS = JVMLocalDistributor.class.getCanonicalName(); + public static final String DEFAULT_DISTRIBUTOR_PLUGIN_CLASS = JvmLocalDistributor.class.getCanonicalName(); private String name; private String pluginClass = DEFAULT_DISTRIBUTOR_PLUGIN_CLASS; 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 27fc05a0b..ed23af1b6 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 @@ -20,7 +20,7 @@ package org.onap.policy.apex.context.parameters; -import org.onap.policy.apex.context.impl.locking.jvmlocal.JVMLocalLockManager; +import org.onap.policy.apex.context.impl.locking.jvmlocal.JvmLocalLockManager; import org.onap.policy.common.parameters.GroupValidationResult; import org.onap.policy.common.parameters.ParameterGroup; @@ -35,7 +35,7 @@ public class LockManagerParameters implements ParameterGroup { /** * The default lock manager can lock context album instance across all threads in a single JVM. */ - public static final String DEFAULT_LOCK_MANAGER_PLUGIN_CLASS = JVMLocalLockManager.class.getCanonicalName(); + public static final String DEFAULT_LOCK_MANAGER_PLUGIN_CLASS = JvmLocalLockManager.class.getCanonicalName(); private String name; private String pluginClass = DEFAULT_LOCK_MANAGER_PLUGIN_CLASS; 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 0208b7a9c..25928716e 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 @@ -34,7 +34,7 @@ import org.onap.policy.apex.context.ContextAlbum; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.context.ContextRuntimeException; import org.onap.policy.apex.context.Distributor; -import org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor; +import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor; import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters; import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.ContextParameters; @@ -57,7 +57,7 @@ public class ContextAlbumImplTest { public static void prepareForTest() { final ContextParameters contextParameters = new ContextParameters(); contextParameters.getLockManagerParameters() - .setPluginClass("org.onap.policy.apex.context.impl.locking.jvmlocal.JVMLocalLockManager"); + .setPluginClass("org.onap.policy.apex.context.impl.locking.jvmlocal.JvmLocalLockManager"); contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME); contextParameters.getDistributorParameters().setName(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME); @@ -76,6 +76,9 @@ public class ContextAlbumImplTest { ParameterService.register(schemaParameters); } + /** + * Clear down the test data. + */ @AfterClass public static void cleanUpAfterTest() { ParameterService.deregister(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME); @@ -107,7 +110,7 @@ public class ContextAlbumImplTest { } try { - new ContextAlbumImpl(new AxContextAlbum(), new JVMLocalDistributor(), null); + new ContextAlbumImpl(new AxContextAlbum(), new JvmLocalDistributor(), null); fail("this test should throw an exception"); } catch (IllegalArgumentException e) { assertEquals("Album map may not be null", e.getMessage()); @@ -116,7 +119,7 @@ public class ContextAlbumImplTest { } try { - new ContextAlbumImpl(new AxContextAlbum(), new JVMLocalDistributor(), new LinkedHashMap<String, Object>()); + new ContextAlbumImpl(new AxContextAlbum(), new JvmLocalDistributor(), new LinkedHashMap<String, Object>()); fail("this test should throw an exception"); } catch (ApexRuntimeException e) { assertEquals("Model for org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas " @@ -138,7 +141,7 @@ public class ContextAlbumImplTest { true, AxArtifactKey.getNullKey()); try { - new ContextAlbumImpl(axContextAlbum, new JVMLocalDistributor(), new LinkedHashMap<String, Object>()); + new ContextAlbumImpl(axContextAlbum, new JvmLocalDistributor(), new LinkedHashMap<String, Object>()); fail("this test should throw an exception"); } catch (ContextException e) { assertEquals("could not initiate schema management for context album AxContextAlbum", @@ -146,7 +149,7 @@ public class ContextAlbumImplTest { } axContextAlbum.setItemSchema(simpleStringSchema.getKey()); - Distributor distributor = new JVMLocalDistributor(); + Distributor distributor = new JvmLocalDistributor(); distributor.init(axContextAlbum.getKey()); ContextAlbum album = new ContextAlbumImpl(axContextAlbum, distributor, new LinkedHashMap<String, Object>()); diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperInstanceCreationTest.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperInstanceCreationTest.java index a71ba3675..800a7011d 100644 --- a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperInstanceCreationTest.java +++ b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperInstanceCreationTest.java @@ -25,12 +25,10 @@ import static org.junit.Assert.fail; import org.junit.AfterClass; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.onap.policy.apex.context.SchemaHelper; import org.onap.policy.apex.context.impl.schema.SchemaHelperFactory; import org.onap.policy.apex.context.parameters.ContextParameterConstants; -import org.onap.policy.apex.context.parameters.ContextParameters; import org.onap.policy.apex.context.parameters.SchemaParameters; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxKey; |