From d100854291559df1426ea1e64351872ae2d3867b Mon Sep 17 00:00:00 2001 From: liamfallon Date: Mon, 10 Sep 2018 17:05:36 +0100 Subject: Checkstyle changes for apex model Fix checkstyle warnings in the apex mode and knock on changes. Issue-ID: POLICY-1034 Change-Id: I10537e4288e9cad5ef18165ed2cdc1d3ab3139c1 Signed-off-by: liamfallon --- .../policy/apex/context/impl/ContextAlbumImpl.java | 2 +- .../impl/distribution/DistributorFactory.java | 2 +- .../distribution/jvmlocal/JVMLocalDistributor.java | 70 ---------------------- .../distribution/jvmlocal/JvmLocalDistributor.java | 70 ++++++++++++++++++++++ .../context/impl/locking/LockManagerFactory.java | 4 +- .../impl/locking/jvmlocal/JVMLocalLockManager.java | 56 ----------------- .../impl/locking/jvmlocal/JvmLocalLockManager.java | 56 +++++++++++++++++ .../context/impl/persistence/PersistorFactory.java | 6 +- .../context/impl/schema/AbstractSchemaHelper.java | 35 +++++------ .../context/impl/schema/SchemaHelperFactory.java | 23 +++---- .../context/parameters/DistributorParameters.java | 4 +- .../context/parameters/LockManagerParameters.java | 4 +- .../apex/context/impl/ContextAlbumImplTest.java | 15 +++-- .../java/JavaSchemaHelperInstanceCreationTest.java | 2 - 14 files changed, 176 insertions(+), 173 deletions(-) delete mode 100644 context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/JVMLocalDistributor.java create mode 100644 context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/JvmLocalDistributor.java delete mode 100644 context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/jvmlocal/JVMLocalLockManager.java create mode 100644 context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/jvmlocal/JvmLocalLockManager.java (limited to 'context/context-management') 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 deleted file mode 100644 index cb9a77883..000000000 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/JVMLocalDistributor.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. 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.impl.distribution.jvmlocal; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.onap.policy.apex.context.impl.distribution.AbstractDistributor; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * This context distributor distributes context across threads in a single JVM. It holds context in memory in a map. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class JVMLocalDistributor extends AbstractDistributor { - // Logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(JVMLocalDistributor.class); - - /** - * Create an instance of a JVM Local Context Distributor. - */ - public JVMLocalDistributor() { - super(); - } - - /* - * (non-Javadoc) - * - * @see - * org.onap.policy.apex.context.impl.distribution.AbstractDistributor#getContextAlbumMap(org.onap.policy.apex.model. - * basicmodel.concepts.AxArtifactKey) - */ - @Override - public Map getContextAlbumMap(final AxArtifactKey contextMapKey) { - LOGGER.debug("create map: " + contextMapKey.getId()); - return Collections.synchronizedMap(new HashMap()); - } - - /* - * (non-Javadoc) - * - * @see org.onap.policy.apex.context.impl.distribution.AbstractDistributor#shutdown() - */ - @Override - public void shutdown() { - // No specific shutdown for the JVMLocalContextDistributor - } -} 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 new file mode 100644 index 000000000..701c59342 --- /dev/null +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/JvmLocalDistributor.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. 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.impl.distribution.jvmlocal; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.onap.policy.apex.context.impl.distribution.AbstractDistributor; +import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; +import org.slf4j.ext.XLogger; +import org.slf4j.ext.XLoggerFactory; + +/** + * This context distributor distributes context across threads in a single JVM. It holds context in memory in a map. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ +public class JvmLocalDistributor extends AbstractDistributor { + // Logger for this class + private static final XLogger LOGGER = XLoggerFactory.getXLogger(JvmLocalDistributor.class); + + /** + * Create an instance of a JVM Local Context Distributor. + */ + public JvmLocalDistributor() { + super(); + } + + /* + * (non-Javadoc) + * + * @see + * org.onap.policy.apex.context.impl.distribution.AbstractDistributor#getContextAlbumMap(org.onap.policy.apex.model. + * basicmodel.concepts.AxArtifactKey) + */ + @Override + public Map getContextAlbumMap(final AxArtifactKey contextMapKey) { + LOGGER.debug("create map: " + contextMapKey.getId()); + return Collections.synchronizedMap(new HashMap()); + } + + /* + * (non-Javadoc) + * + * @see org.onap.policy.apex.context.impl.distribution.AbstractDistributor#shutdown() + */ + @Override + public void shutdown() { + // No specific shutdown for the JVMLocalContextDistributor + } +} 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 deleted file mode 100644 index 5e71557b8..000000000 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/jvmlocal/JVMLocalLockManager.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. 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.impl.locking.jvmlocal; - -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import org.onap.policy.apex.context.ContextException; -import org.onap.policy.apex.context.impl.locking.AbstractLockManager; - -/** - * A lock manager that returns locks that have a range of just the local JVM. The implementation uses a Jav - * {@link ReentrantReadWriteLock} as the lock for context album items. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class JVMLocalLockManager extends AbstractLockManager { - /* - * (non-Javadoc) - * - * @see - * org.onap.policy.apex.core.context.impl.locking.AbstractLockManager#getReentrantReadWriteLock(java.lang.String) - */ - @Override - public ReadWriteLock getReentrantReadWriteLock(final String lockId) throws ContextException { - return new ReentrantReadWriteLock(); - } - - /* - * (non-Javadoc) - * - * @see org.onap.policy.apex.core.context.LockManager#shutdown() - */ - @Override - public void shutdown() { - // Nothing to do for this lock manager - } -} 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 new file mode 100644 index 000000000..721aa7f3c --- /dev/null +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/jvmlocal/JvmLocalLockManager.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. 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.impl.locking.jvmlocal; + +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; + +import org.onap.policy.apex.context.ContextException; +import org.onap.policy.apex.context.impl.locking.AbstractLockManager; + +/** + * A lock manager that returns locks that have a range of just the local JVM. The implementation uses a Jav + * {@link ReentrantReadWriteLock} as the lock for context album items. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ +public class JvmLocalLockManager extends AbstractLockManager { + /* + * (non-Javadoc) + * + * @see + * org.onap.policy.apex.core.context.impl.locking.AbstractLockManager#getReentrantReadWriteLock(java.lang.String) + */ + @Override + public ReadWriteLock getReentrantReadWriteLock(final String lockId) throws ContextException { + return new ReentrantReadWriteLock(); + } + + /* + * (non-Javadoc) + * + * @see org.onap.policy.apex.core.context.LockManager#shutdown() + */ + @Override + public void shutdown() { + // Nothing to do for this lock manager + } +} 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()); + new ContextAlbumImpl(new AxContextAlbum(), new JvmLocalDistributor(), new LinkedHashMap()); 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()); + new ContextAlbumImpl(axContextAlbum, new JvmLocalDistributor(), new LinkedHashMap()); 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()); 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; -- cgit 1.2.3-korg