diff --git a/context/context-management/pom.xml b/context/context-management/pom.xml
new file mode 100644
index 0000000..b05c76a
--- /dev/null
+++ b/context/context-management/pom.xml
@@ -0,0 +1,49 @@
+<!--
+  ============LICENSE_START=======================================================
+   Copyright (C) 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=========================================================
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.onap.policy.apex-pdp.context</groupId>
+        <artifactId>context</artifactId>
+        <version>2.0.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>context-management</artifactId>
+    <name>${project.artifactId}</name>
+    <description>Context management for Apex policy execution</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onap.policy.apex-pdp.model</groupId>
+            <artifactId>context-model</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onap.policy.apex-pdp.model</groupId>
+            <artifactId>utilities</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/ContextAlbum.java b/context/context-management/src/main/java/org/onap/policy/apex/context/ContextAlbum.java
new file mode 100644
index 0000000..73ef668
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/ContextAlbum.java
@@ -0,0 +1,127 @@
+/*-
+ * ============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;
+
+import java.util.Map;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
+
+/**
+ * The Interface ContextAlbum is implemented by all classes that manage context in Apex. Context albums may store
+ * context in memory, on disk, in a repository or in a mechanism such as a distributed map.
+ * <p>
+ * A context album uses plugins to handle its context schemas, its distribution, its locking, and its persistence.
+ * <p>
+ * The schema that defines the items in a context album is interpreted by a plugin that implements the
+ * {@link SchemaHelper} interface. The schema helper uses the schema definition to provide new instances for a context
+ * album. By default, context albums use Java schemas.
+ * <p>
+ * Context albums may be shared across an arbitrary number of JVMs using a distribution mechanism. Apex context
+ * distributed context albums using plugins that implement the {@link Distributor} interface. By default, context albums
+ * use JVM local distribution, that is context albums are only available in a single JVM
+ * <p>
+ * Items in a context album may be locked across all distributed instances of an album. Apex locks instances on context
+ * albums using the distributed locking mechanism in a plugin that implements the {@link LockManager} interface. By
+ * default, context albums use Java locking local to a single JVM on each context album instance.
+ * <p>
+ * Context albums may be persisted to disk, database, or any other repository. Apex persists context albums using the
+ * persistence mechanism in a plugin that implements the {@link Persistor} interface. By default, context albums use a
+ * dummy persistor plugin that does not persist context albums.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public interface ContextAlbum extends Map<String, Object> {
+    /**
+     * Gets the key of the context album instance.
+     *
+     * @return the key
+     */
+    AxArtifactKey getKey();
+
+    /**
+     * Gets the name of the context album instance.
+     *
+     * @return the name
+     */
+    String getName();
+
+    /**
+     * Get the current context album with values.
+     *
+     * @return the current context runtime values
+     */
+    AxContextAlbum getAlbumDefinition();
+
+    /**
+     * Get the schema helper for the technology that is handling the schema for this album.
+     *
+     * @return the schema helper
+     */
+    SchemaHelper getSchemaHelper();
+
+    /**
+     * Place a read lock on a key in this album across the entire cluster.
+     *
+     * @param key The key to lock
+     * @throws ContextException on locking errors
+     */
+    void lockForReading(String key) throws ContextException;
+
+    /**
+     * Place a write lock on a key in this album across the entire cluster.
+     *
+     * @param key The key to lock
+     * @throws ContextException on locking errors
+     */
+    void lockForWriting(String key) throws ContextException;
+
+    /**
+     * Release the the read lock on a key in this album across the entire cluster.
+     *
+     * @param key The key to unlock
+     * @throws ContextException on locking errors
+     */
+    void unlockForReading(String key) throws ContextException;
+
+    /**
+     * Release the the write lock on a key in this album across the entire cluster.
+     *
+     * @param key The key to unlock
+     * @throws ContextException on locking errors
+     */
+    void unlockForWriting(String key) throws ContextException;
+
+    /**
+     * Set the stack of artifact keys currently using this context item.
+     *
+     * @param userArtifactStack the keys of the artifacts using the context album at the moment
+     */
+    void setUserArtifactStack(AxConcept[] userArtifactStack);
+
+    /**
+     * Flush the context album to the distribution and persistence mechanism.
+     *
+     * @throws ContextException On context flush errors
+     */
+    void flush() throws ContextException;
+}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/ContextException.java b/context/context-management/src/main/java/org/onap/policy/apex/context/ContextException.java
new file mode 100644
index 0000000..de5cec0
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/ContextException.java
@@ -0,0 +1,51 @@
+/*-
+ * ============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;
+
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+
+/**
+ * This exception will be called if an error occurs in an Apex context item.
+ *
+ * @author Liam Fallon
+ */
+public class ContextException extends ApexException {
+    private static final long serialVersionUID = -8507246953751956974L;
+
+    /**
+     * Instantiates a new apex context exception with a message.
+     *
+     * @param message the message
+     */
+    public ContextException(final String message) {
+        super(message);
+    }
+
+    /**
+     * Instantiates a new apex context exception with a message and a caused by exception.
+     *
+     * @param message the message
+     * @param e the exception that caused this exception to be thrown
+     */
+    public ContextException(final String message, final Exception e) {
+        super(message, e);
+    }
+}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/ContextRuntimeException.java b/context/context-management/src/main/java/org/onap/policy/apex/context/ContextRuntimeException.java
new file mode 100644
index 0000000..b2aa017
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/ContextRuntimeException.java
@@ -0,0 +1,51 @@
+/*-
+ * ============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;
+
+import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException;
+
+/**
+ * This exception will be called if an error occurs in an Apex context item.
+ *
+ * @author Liam Fallon
+ */
+public class ContextRuntimeException extends ApexRuntimeException {
+    private static final long serialVersionUID = -8507246953751956974L;
+
+    /**
+     * Instantiates a new apex context exception with a message.
+     *
+     * @param message the message
+     */
+    public ContextRuntimeException(final String message) {
+        super(message);
+    }
+
+    /**
+     * Instantiates a new apex context exception with a message and a caused by exception.
+     *
+     * @param message the message
+     * @param e the exception that caused this exception to be thrown
+     */
+    public ContextRuntimeException(final String message, final Exception e) {
+        super(message, e);
+    }
+}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/Distributor.java b/context/context-management/src/main/java/org/onap/policy/apex/context/Distributor.java
new file mode 100644
index 0000000..a173138
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/Distributor.java
@@ -0,0 +1,140 @@
+/*-
+ * ============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;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
+
+/**
+ * This interface is implemented by plugin classes that distribute context albums in Apex.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public interface Distributor {
+
+    /**
+     * Initialize the distributor with its properties.
+     *
+     * @param key The key that identifies this distributor
+     * @throws ContextException On errors initializing the distributor
+     */
+    void init(AxArtifactKey key) throws ContextException;
+
+    /**
+     * Shut down distributor.
+     *
+     * @throws ContextException On errors initializing the distributor
+     */
+    void shutdown() throws ContextException;
+
+    /**
+     * Get the key of the distributor.
+     *
+     * @return the contextSetKey
+     */
+    AxArtifactKey getKey();
+
+    /**
+     * Register the context model and its sub models with the model service.
+     *
+     * @param contextModel the context model to register
+     * @throws ContextException on model registration errors
+     */
+    void registerModel(AxContextModel contextModel) throws ContextException;
+
+    /**
+     * Create a context album on a distributor, the distributor looks up the album and initialize it. The
+     * {@link AxContextAlbum} is used to check that the album in the distributor matches the album definition we expect
+     * to get.
+     *
+     * @param axContextAlbumKey the key of the model context album for this context album
+     * @return the context album
+     * @throws ContextException if the album cannot be initialised
+     */
+    ContextAlbum createContextAlbum(AxArtifactKey axContextAlbumKey) throws ContextException;
+
+    /**
+     * Remove a context album from a distributor.
+     *
+     * @param contextAlbum The album to remove
+     * @throws ContextException if the album cannot be removed
+     */
+    void removeContextAlbum(AxContextAlbum contextAlbum) throws ContextException;
+
+    /**
+     * Flush all context albums owned by the distributor to the distribution mechanism.
+     *
+     * @throws ContextException on context flushing errors
+     */
+    void flush() throws ContextException;
+
+    /**
+     * Flush a context album owned by the distributor to the distribution mechanism.
+     *
+     * @param contextAlbum the context album to flush
+     * @throws ContextException on errors in flushing the context album
+     */
+    void flushContextAlbum(ContextAlbum contextAlbum) throws ContextException;
+
+    /**
+     * Place a read lock on an item in an album across the entire cluster.
+     *
+     * @param albumKey The key of the album containing the item
+     * @param keyOnMap The key on the album to lock
+     * @throws ContextException on locking errors
+     */
+    void lockForReading(AxArtifactKey albumKey, String keyOnMap) throws ContextException;
+
+    /**
+     * Place a write lock on an album item across the entire cluster.
+     *
+     * @param albumKey The key of the album containing the item
+     * @param key The key on the album to lock
+     * @throws ContextException on locking errors
+     */
+    void lockForWriting(AxArtifactKey albumKey, String key) throws ContextException;
+
+    /**
+     * Release the read lock on a key across the entire cluster.
+     *
+     * @param albumKey The key of the album containing the item
+     * @param key The key on the album to unlock
+     * @throws ContextException on locking errors
+     */
+    void unlockForReading(AxArtifactKey albumKey, String key) throws ContextException;
+
+    /**
+     * Release the write lock on a key across the entire cluster.
+     *
+     * @param albumKey The key of the album containing the item
+     * @param key The key on the album to unlock
+     * @throws ContextException on locking errors
+     */
+    void unlockForWriting(AxArtifactKey albumKey, String key) throws ContextException;
+
+    /**
+     * Clear all the context from the context distributor.
+     *
+     * @throws ContextException on context clearing exceptions
+     */
+    void clear() throws ContextException;
+}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/LockManager.java b/context/context-management/src/main/java/org/onap/policy/apex/context/LockManager.java
new file mode 100644
index 0000000..8ccf544
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/LockManager.java
@@ -0,0 +1,88 @@
+/*-
+ * ============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;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+
+/**
+ * This interface provides a facade to hide implementation details of various lock managers that may be used to manage
+ * locking of context items.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public interface LockManager {
+
+    /**
+     * Initialize the lock manager with its properties.
+     *
+     * @param key The key of this lock manager
+     * @throws ContextException On errors initializing the persistor
+     */
+    void init(AxArtifactKey key) throws ContextException;
+
+    /**
+     * Get the key of the lock manager.
+     *
+     * @return the managers key
+     */
+    AxArtifactKey getKey();
+
+    /**
+     * Place a read lock on a lock type and key across the entire cluster.
+     *
+     * @param lockTypeKey The key of the map where the context item to lock is
+     * @param lockKey The key on the map to lock
+     * @throws ContextException on locking errors
+     */
+    void lockForReading(String lockTypeKey, String lockKey) throws ContextException;
+
+    /**
+     * Place a write lock on a lock type and key across the entire cluster.
+     *
+     * @param lockTypeKey The key of the map where the context item to lock is
+     * @param lockKey The key on the map to lock
+     * @throws ContextException on locking errors
+     */
+    void lockForWriting(String lockTypeKey, String lockKey) throws ContextException;
+
+    /**
+     * Release a read lock on a lock type and key across the entire cluster.
+     *
+     * @param lockTypeKey The key of the map where the context item to lock is
+     * @param lockKey The key on the map to lock
+     * @throws ContextException on locking errors
+     */
+    void unlockForReading(String lockTypeKey, String lockKey) throws ContextException;
+
+    /**
+     * Release a write lock on a lock type and key across the entire cluster.
+     *
+     * @param lockTypeKey The key of the map where the context item to lock is
+     * @param lockKey The key on the map to lock
+     * @throws ContextException on locking errors
+     */
+    void unlockForWriting(String lockTypeKey, String lockKey) throws ContextException;
+
+    /**
+     * Shut down the lock manager and clear any connections or data it is using.
+     */
+    void shutdown();
+}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/Persistor.java b/context/context-management/src/main/java/org/onap/policy/apex/context/Persistor.java
new file mode 100644
index 0000000..d3218a3
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/Persistor.java
@@ -0,0 +1,79 @@
+/*-
+ * ============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;
+
+import java.util.Set;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
+
+/**
+ * This interface is implemented by plugin classes that persist Context Albums in Apex.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public interface Persistor {
+
+    /**
+     * Initialize the persistor with its properties.
+     *
+     * @param key The key that identifies this persistor
+     * @throws ContextException On errors initializing the persistor
+     */
+    void init(AxArtifactKey key) throws ContextException;
+
+    /**
+     * Get the key of the persistor.
+     *
+     * @return the contextSetKey
+     */
+    AxArtifactKey getKey();
+
+    /**
+     * Read a context item from the persistence mechanism.
+     *
+     * @param key the key of the context item
+     * @param contextItemClassName the name of the context item class, a subclass of {@link AxContextSchema}
+     * @return the context item that has been read
+     * @throws ContextException on persistence read errors
+     */
+    AxContextSchema readContextItem(AxReferenceKey key, Class<?> contextItemClassName) throws ContextException;
+
+    /**
+     * Read all the values of a particular type from persistence.
+     *
+     * @param ownerKey the owner key
+     * @param contextItemClassName The class name of the objects to return
+     * @return the set of context item values read from persistence or null if none were found
+     * @throws ContextException On read errors
+     */
+    Set<AxContextSchema> readContextItems(AxArtifactKey ownerKey, Class<?> contextItemClassName)
+            throws ContextException;
+
+    /**
+     * Write a context item value to the persistence mechanism.
+     *
+     * @param contextItem the context item
+     * @return the context item that has been written
+     */
+    Object writeContextItem(Object contextItem);
+}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/SchemaHelper.java b/context/context-management/src/main/java/org/onap/policy/apex/context/SchemaHelper.java
new file mode 100644
index 0000000..aa6ea9f
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/SchemaHelper.java
@@ -0,0 +1,119 @@
+/*-
+ * ============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;
+
+import com.google.gson.JsonElement;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
+
+/**
+ * This interface is implemented by plugin classes that use a particular schema to convert Apex context objects to an
+ * understandable form.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public interface SchemaHelper {
+
+    /**
+     * Initialize the schema helper with its properties.
+     *
+     * @param userKey The key that identifies the user of the schema helper
+     * @param schema the schema
+     * @throws ContextRuntimeException the context runtime exception
+     */
+    void init(AxKey userKey, AxContextSchema schema) throws ContextRuntimeException;
+
+    /**
+     * Get the user key of the schema helper.
+     *
+     * @return the user key
+     */
+    AxKey getUserKey();
+
+    /**
+     * Get the schema of the schema helper.
+     *
+     * @return the schema
+     */
+    AxContextSchema getSchema();
+
+    /**
+     * The Java class that this schema produces on the Java side.
+     *
+     * @return the schema class
+     */
+    Class<?> getSchemaClass();
+
+    /**
+     * The Java class that handles the schema for the schema technology in use.
+     *
+     * @return the schema object
+     */
+    Object getSchemaObject();
+
+    /**
+     * Create a new instance of the schema class using whatever schema technology is being used.
+     *
+     * @return the new instance
+     */
+    Object createNewInstance();
+
+    /**
+     * Create a new instance of the schema class using whatever schema technology is being used.
+     *
+     * @param stringValue the string represents the value the new instance should have
+     * @return the new instance
+     */
+    Object createNewInstance(String stringValue);
+
+    /**
+     * Create a new instance of the schema class from a GSON JsonElement using whatever schema technology is being used.
+     *
+     * @param jsonElement the JSON element that holds the Json representation of the object
+     * @return the new instance
+     */
+    Object createNewInstance(JsonElement jsonElement);
+
+    /**
+     * Unmarshal an object in schema format into a Java object.
+     *
+     * @param object the object as a Java object
+     * @return the object in schema format
+     */
+    Object unmarshal(Object object);
+
+    /**
+     * Marshal a Java object into Json format.
+     *
+     * @param schemaObject the object in schema format
+     * @return the object as a Json string
+     */
+    String marshal2Json(Object schemaObject);
+
+    /**
+     * Marshal a Java object into a GSON json element.
+     *
+     * @param schemaObject the object in schema format
+     * @return the object as a GSON Json element
+     */
+    JsonElement marshal2JsonElement(Object schemaObject);
+}
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
new file mode 100644
index 0000000..a682716
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java
@@ -0,0 +1,486 @@
+/*-
+ * ============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;
+
+import java.util.AbstractMap.SimpleEntry;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+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.SchemaHelper;
+import org.onap.policy.apex.context.impl.schema.SchemaHelperFactory;
+import org.onap.policy.apex.context.monitoring.ContextMonitor;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
+import org.onap.policy.apex.model.utilities.Assertions;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * The Class ContextAlbumImpl implements the methods on the {@link ContextAlbum} interface. It implements the getters
+ * and setters on the {@link Map} and uses the {@link Distributor} to handle distribution and locking.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public final class ContextAlbumImpl implements ContextAlbum {
+    // Logger for this class
+    private static final XLogger LOGGER = XLoggerFactory.getXLogger(ContextAlbumImpl.class);
+
+    // The definition of this context album
+    private final AxContextAlbum albumDefinition;
+
+    /// The map holding the items and their values for this context album
+    private final Map<String, Object> albumMap;
+
+    // The artifact stack of the artifacts currently using the context album
+    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
+    private SchemaHelper schemaHelper;
+
+    // The context monitor for this context album
+    private ContextMonitor monitor = null;
+
+    /**
+     * Constructor, instantiate the context album.
+     *
+     * @param albumDefinition The model definition of this context album
+     * @param distributor The context distributor passed to us to distribute context across ContextAlbum instances
+     * @param albumMap the album map
+     * @throws ContextException on errors creating context albums
+     */
+    public ContextAlbumImpl(final AxContextAlbum albumDefinition, final Distributor distributor,
+            final Map<String, Object> albumMap) throws ContextException {
+        this.albumDefinition = albumDefinition;
+
+        // Use the context distributor passed to us
+        this.distributor = distributor;
+
+        // The map to use to store objects
+        this.albumMap = albumMap;
+
+        try {
+            // Get a schema helper to manage the translations between objects on the album map for this album
+            schemaHelper = new SchemaHelperFactory().createSchemaHelper(albumDefinition.getKey(),
+                    albumDefinition.getItemSchema());
+        } catch (final ContextRuntimeException e) {
+            final String resultString = "could not initiate schema management for context album " + albumDefinition;
+            LOGGER.warn(resultString, e);
+            throw new ContextException(resultString, e);
+        }
+
+        // Create the context monitor
+        monitor = new ContextMonitor();
+
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.ContextAlbum#getKey()
+     */
+    @Override
+    public AxArtifactKey getKey() {
+        return albumDefinition.getKey();
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.ContextAlbum#getName()
+     */
+    @Override
+    public String getName() {
+        return albumDefinition.getKey().getName();
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.ContextAlbum#getAxContextAlbum()
+     */
+    @Override
+    public AxContextAlbum getAlbumDefinition() {
+        return albumDefinition;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.ContextAlbum#getSchemaHelper()
+     */
+    @Override
+    public SchemaHelper getSchemaHelper() {
+        return schemaHelper;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.ContextAlbum#lockForReading(java.lang.String)
+     */
+    @Override
+    public void lockForReading(final String keyOnAlbum) throws ContextException {
+        distributor.lockForReading(albumDefinition.getKey(), keyOnAlbum);
+        monitor.monitorReadLock(albumDefinition.getKey(), albumDefinition.getItemSchema(), keyOnAlbum,
+                userArtifactStack);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.ContextAlbum#lockForWriting(java.lang.String)
+     */
+    @Override
+    public void lockForWriting(final String keyOnAlbum) throws ContextException {
+        distributor.lockForWriting(albumDefinition.getKey(), keyOnAlbum);
+        monitor.monitorWriteLock(albumDefinition.getKey(), albumDefinition.getItemSchema(), keyOnAlbum,
+                userArtifactStack);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.ContextAlbum#unlockForReading(java.lang.String)
+     */
+    @Override
+    public void unlockForReading(final String keyOnAlbum) throws ContextException {
+        distributor.unlockForReading(albumDefinition.getKey(), keyOnAlbum);
+        monitor.monitorReadUnlock(albumDefinition.getKey(), albumDefinition.getItemSchema(), keyOnAlbum,
+                userArtifactStack);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.ContextAlbum#unlockForWriting(java.lang.String)
+     */
+    @Override
+    public void unlockForWriting(final String keyOnAlbum) throws ContextException {
+        distributor.unlockForWriting(albumDefinition.getKey(), keyOnAlbum);
+        monitor.monitorWriteUnlock(albumDefinition.getKey(), albumDefinition.getItemSchema(), keyOnAlbum,
+                userArtifactStack);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.onap.policy.apex.context.ContextAlbum#setUserArtifactStack(org.onap.policy.apex.model.basicmodel.concepts.
+     * AxConcept [])
+     */
+    @Override
+    public void setUserArtifactStack(final AxConcept[] userArtifactStack) {
+        this.userArtifactStack = userArtifactStack;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.ContextAlbum#flush()
+     */
+    @Override
+    public void flush() throws ContextException {
+        distributor.flushContextAlbum(this);
+    }
+
+    /*
+     * The Map interface
+     */
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.util.Map#size()
+     */
+    @Override
+    public int size() {
+        return albumMap.size();
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.util.Map#isEmpty()
+     */
+    @Override
+    public boolean isEmpty() {
+        return albumMap.isEmpty();
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.util.Map#containsKey(java.lang.Object)
+     */
+    @Override
+    public boolean containsKey(final Object key) {
+        if (key == null) {
+            LOGGER.warn("null values are illegal on method parameter \"key\"");
+            throw new ContextRuntimeException("null values are illegal on method parameter \"key\"");
+        }
+
+        return albumMap.containsKey(key);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.util.Map#containsValue(java.lang.Object)
+     */
+    @Override
+    public boolean containsValue(final Object value) {
+        if (value == null) {
+            LOGGER.warn("null values are illegal on method parameter \"value\"");
+            throw new ContextRuntimeException("null values are illegal on method parameter \"value\"");
+        }
+
+        return albumMap.containsValue(value);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.util.Map#get(java.lang.Object)
+     */
+    @Override
+    public Object get(final Object key) {
+        if (key == null) {
+            final String returnString =
+                    "album \"" + albumDefinition.getID() + "\" null keys are illegal on keys for get()";
+            LOGGER.warn(returnString);
+            throw new ContextRuntimeException(returnString);
+        }
+
+        final Object item = albumMap.get(key);
+        if (item == null) {
+            return null;
+        }
+
+        // Get the context value and monitor it
+        monitor.monitorGet(albumDefinition.getKey(), albumDefinition.getItemSchema(), key.toString(), item,
+                userArtifactStack);
+        return item;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.util.Map#keySet()
+     */
+    @Override
+    public Set<String> keySet() {
+        return albumMap.keySet();
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.util.Map#values()
+     */
+    @Override
+    public Collection<Object> values() {
+        // Build the key set and return it
+        final ArrayList<Object> valueList = new ArrayList<>();
+
+        for (final Entry<String, Object> contextAlbumEntry : albumMap.entrySet()) {
+            final Object item = contextAlbumEntry.getValue();
+            monitor.monitorGet(albumDefinition.getKey(), albumDefinition.getItemSchema(), contextAlbumEntry.getKey(),
+                    item, userArtifactStack);
+            valueList.add(contextAlbumEntry.getValue());
+        }
+
+        return valueList;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.util.Map#entrySet()
+     */
+    @Override
+    public Set<Entry<String, Object>> entrySet() {
+        // Build the entry set and return it
+        final Set<Entry<String, Object>> entrySet = new HashSet<>();
+
+        for (final Entry<String, Object> contextAlbumEntry : albumMap.entrySet()) {
+            final Object item = contextAlbumEntry.getValue();
+            monitor.monitorGet(albumDefinition.getKey(), albumDefinition.getItemSchema(), contextAlbumEntry.getKey(),
+                    item, userArtifactStack);
+            entrySet.add(new SimpleEntry<>(contextAlbumEntry.getKey(), contextAlbumEntry.getValue()));
+        }
+
+        return entrySet;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.util.Map#put(java.lang.Object, java.lang.Object)
+     */
+    @Override
+    public Object put(final String key, final Object incomingValue) {
+        if (key == null) {
+            final String returnString =
+                    "album \"" + albumDefinition.getID() + "\" null keys are illegal on keys for put()";
+            LOGGER.warn(returnString);
+            throw new ContextRuntimeException(returnString);
+        }
+
+        if (incomingValue == null) {
+            final String returnString = "album \"" + albumDefinition.getID() + "\" null values are illegal on key \""
+                    + key + "\" for put()";
+            LOGGER.warn(returnString);
+            throw new ContextRuntimeException(returnString);
+        }
+
+        if (!albumDefinition.isWritable()) {
+            final String returnString = "album \"" + albumDefinition.getID()
+                    + "\" put() not allowed on read only albums for key=\"" + key + "\", value=\"" + incomingValue;
+            LOGGER.warn(returnString);
+            throw new ContextRuntimeException(returnString);
+        }
+
+        try {
+            // Translate the object to a schema object
+            final Object valueToPut = schemaHelper.unmarshal(incomingValue);
+
+            // Check if the key is already in the map
+            if (albumMap.containsKey(key)) {
+                // Update the value in the context item and in the context value map
+                monitor.monitorSet(albumDefinition.getKey(), albumDefinition.getItemSchema(), key, incomingValue,
+                        userArtifactStack);
+            } else {
+                // Update the value in the context item and in the context value map
+                monitor.monitorInit(albumDefinition.getKey(), albumDefinition.getItemSchema(), key, incomingValue,
+                        userArtifactStack);
+            }
+
+            // Put the translated value on the map and return the old map value
+            return albumMap.put(key, valueToPut);
+        } catch (final ContextRuntimeException e) {
+            final String returnString = "Failed to set context value for key \"" + key + "\" in album \""
+                    + albumDefinition.getID() + "\": " + e.getMessage();
+            LOGGER.warn(returnString);
+            throw new ContextRuntimeException(returnString, e);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.util.Map#putAll(java.util.Map)
+     */
+    @Override
+    public void putAll(final Map<? extends String, ? extends Object> incomingContextAlbum) {
+        if (!albumDefinition.isWritable()) {
+            final String returnString =
+                    "album \"" + albumDefinition.getID() + "\" putAll() not allowed on read only albums";
+            LOGGER.warn(returnString);
+            throw new ContextRuntimeException(returnString);
+        }
+
+        // Sanity check on incoming context
+        Assertions.argumentNotNull(incomingContextAlbum, ContextRuntimeException.class,
+                "cannot update context, context album is null");
+
+        // Iterate over the incoming context
+        for (final Entry<String, Object> entry : albumMap.entrySet()) {
+            synchronized (albumDefinition) {
+                // Get the key for the incoming name
+                final Object incomingDataItem = incomingContextAlbum.get(entry.getKey());
+                if (incomingDataItem != null) {
+                    // Update the value the context album
+                    put(entry.getKey(), incomingDataItem);
+                }
+            }
+        }
+
+        // Put all the objects on the context album
+        for (final Entry<? extends String, ? extends Object> incomingMapEntry : incomingContextAlbum.entrySet()) {
+            // Put the entry on the map
+            this.put(incomingMapEntry.getKey(), incomingMapEntry.getValue());
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.util.Map#remove(java.lang.Object)
+     */
+    @Override
+    public Object remove(final Object key) {
+        if (!albumDefinition.isWritable()) {
+            final String returnString = "album \"" + albumDefinition.getID()
+                    + "\" remove() not allowed on read only albums for key=\"" + key;
+            LOGGER.warn(returnString);
+            throw new ContextRuntimeException(returnString);
+        }
+
+        if (key == null) {
+            LOGGER.warn("null values are illegal on method parameter \"key\"");
+            throw new ContextRuntimeException("null values are illegal on method parameter \"keyID\"");
+        }
+
+        // Delete the item
+        final Object removedValue = albumMap.remove(key);
+        monitor.monitorDelete(albumDefinition.getKey(), albumDefinition.getItemSchema(), key.toString(), removedValue,
+                userArtifactStack);
+
+        // Return the value of the deleted item
+        return removedValue;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.util.Map#clear()
+     */
+    @Override
+    public void clear() {
+        if (!albumDefinition.isWritable()) {
+            final String returnString =
+                    "album \"" + albumDefinition.getID() + "\" clear() not allowed on read only albums";
+            LOGGER.warn(returnString);
+            throw new ContextRuntimeException(returnString);
+        }
+
+        // Monitor deletion of each item
+        for (final Entry<String, Object> contextAlbumEntry : albumMap.entrySet()) {
+            final Object item = contextAlbumEntry.getValue();
+            monitor.monitorDelete(albumDefinition.getKey(), albumDefinition.getItemSchema(), contextAlbumEntry.getKey(),
+                    item, userArtifactStack);
+        }
+
+        // Clear the map
+        albumMap.clear();
+    }
+}
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
new file mode 100644
index 0000000..e5a45b2
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/AbstractDistributor.java
@@ -0,0 +1,326 @@
+/*-
+ * ============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;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.onap.policy.apex.context.ContextAlbum;
+import org.onap.policy.apex.context.ContextException;
+import org.onap.policy.apex.context.Distributor;
+import org.onap.policy.apex.context.LockManager;
+import org.onap.policy.apex.context.Persistor;
+import org.onap.policy.apex.context.impl.ContextAlbumImpl;
+import org.onap.policy.apex.context.impl.locking.LockManagerFactory;
+import org.onap.policy.apex.context.impl.persistence.PersistorFactory;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.service.ModelService;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * This context distributor implements the mechanism-neutral parts of a context distributor.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+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
+    private static LockManager lockManager = null;
+
+    // Hold a persistor for this distributor
+    private Persistor persistor = null;
+
+    // Hold a flush timer for this context distributor
+    private static DistributorFlushTimerTask flushTimer = null;
+
+    /**
+     * Create an instance of an abstract Context Distributor.
+     */
+    public AbstractDistributor() {
+        LOGGER.entry("AbstractContextDistributor()");
+        LOGGER.exit("AbstractContextDistributor()");
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.ContextDistributor#init(org.onap.policy.apex.model.basicmodel.concepts.
+     * AxArtifactKey)
+     */
+    @Override
+    public void init(final AxArtifactKey distributorKey) throws ContextException {
+        LOGGER.entry("init(" + distributorKey + ")");
+
+        // Record parameters and key
+        this.key = distributorKey;
+
+        // Create the lock manager if it doesn't already exist
+        if (lockManager == null) {
+            lockManager = new LockManagerFactory().createLockManager(key);
+        }
+
+        // Set up flushing on the context distributor if its not set up already
+        if (flushTimer == null) {
+            flushTimer = new DistributorFlushTimerTask(this);
+        }
+
+        // Create a new persistor for this key
+        persistor = new PersistorFactory().createPersistor(key);
+        LOGGER.exit("init(" + key + ")");
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.ContextDistributor#shutdown()
+     */
+    @Override
+    public abstract void shutdown();
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.ContextDistributor#getKey()
+     */
+    @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
+     * @return The album as a string-object map
+     */
+    public abstract Map<String, Object> getContextAlbumMap(AxArtifactKey contextAlbumKey);
+
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.Distributor#registerModel(org.onap.policy.apex.model.contextmodel.concepts.
+     * AxContextModel)
+     */
+    @Override
+    public void registerModel(final AxContextModel contextModel) throws ContextException {
+        ModelService.registerModel(AxKeyInformation.class, contextModel.getKeyInformation());
+        ModelService.registerModel(AxContextSchemas.class, contextModel.getSchemas());
+        ModelService.registerModel(AxContextAlbums.class, contextModel.getAlbums());
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.onap.policy.apex.core.context.ContextDistributor#createContextAlbum(org.onap.policy.apex.core.basicmodel.
+     * concepts. AxArtifactKey)
+     */
+    @Override
+    public synchronized ContextAlbum createContextAlbum(final AxArtifactKey axContextAlbumKey) throws ContextException {
+        // Get the context album definition
+        final AxContextAlbum album = ModelService.getModel(AxContextAlbums.class).get(axContextAlbumKey);
+        if (album == null) {
+            final String resultString = "context album " + axContextAlbumKey.getID() + " does not exist";
+            LOGGER.warn(resultString);
+            throw new ContextException(resultString);
+        }
+
+        // Check if the context album is valid
+        final AxValidationResult result = album.validate(new AxValidationResult());
+        if (!result.isValid()) {
+            final String resultString =
+                    "context album definition for " + album.getKey().getID() + " is invalid" + result;
+            LOGGER.warn(resultString);
+            throw new ContextException(resultString);
+        }
+
+        // Get the schema of the context album
+        final AxContextSchema schema = ModelService.getModel(AxContextSchemas.class).get(album.getItemSchema());
+        if (schema == null) {
+            final String resultString = "schema \"" + album.getItemSchema().getID() + "\" for context album "
+                    + album.getKey().getID() + " does not exist";
+            LOGGER.warn(resultString);
+            throw new ContextException(resultString);
+        }
+
+        // Check if the map has already been instantiated
+        if (!albumMaps.containsKey(album.getKey())) {
+            // Instantiate the album map for this context album that we'll distribute using the distribution mechanism
+            final Map<String, Object> newContextAlbumMap = getContextAlbumMap(album.getKey());
+
+            // The distributed context album will have content from another process instance if the album exists in
+            // another process,
+            // if not, we have to try to read the content from persistence
+            if (newContextAlbumMap.isEmpty()) {
+                // Read entries from persistence
+                // TODO: READ ITEMS FROM PRESISTENCE!!!!
+            }
+
+            // Create the context album and put the context album object onto the distributor
+            albumMaps.put(album.getKey(), new ContextAlbumImpl(album, this, newContextAlbumMap));
+        }
+
+        return albumMaps.get(album.getKey());
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.onap.policy.apex.core.context.ContextDistributor#removeContextAlbum(org.onap.policy.apex.core.basicmodel.
+     * concepts. AxArtifactKey)
+     */
+    @Override
+    public void removeContextAlbum(final AxContextAlbum contextAlbum) throws ContextException {
+        // Check if the map already exists, if not return
+        if (!albumMaps.containsKey(contextAlbum.getKey())) {
+            LOGGER.warn("map remove failed, supplied map is null");
+            throw new ContextException("map update failed, supplied map is null");
+        }
+
+        // Remove the map from the distributor
+        albumMaps.remove(contextAlbum.getKey());
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.core.context.ContextDistributor#flush()
+     */
+    @Override
+    public void flush() throws ContextException {
+        // Flush all the maps
+        for (final Entry<AxArtifactKey, ContextAlbum> distributorMapEntry : albumMaps.entrySet()) {
+            // Let the persistor write each of the entries
+            for (final Object contextItem : distributorMapEntry.getValue().values()) {
+                LOGGER.debug(contextItem.toString());
+                // persistor.writeContextItem((AxContextSchema) contextItem);
+            }
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.core.context.ContextDistributor#flushContextAlbum(org.onap.policy.apex.core.context.
+     * ContextAlbum)
+     */
+    @Override
+    public void flushContextAlbum(final ContextAlbum contextAlbum) throws ContextException {
+        // Check if the map already exists, if not return
+        if (!albumMaps.containsKey(contextAlbum.getKey())) {
+            LOGGER.warn("map flush failed, supplied map is null");
+            throw new ContextException("map flush failed, supplied map is null");
+        }
+
+        // Let the persistor flush the items on the map
+        for (final Object contextItem : albumMaps.get(contextAlbum.getKey()).values()) {
+            persistor.writeContextItem(contextItem);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.core.context.ContextDistributor#lockForReading(java.lang.String)
+     */
+    @Override
+    public synchronized void lockForReading(final AxArtifactKey mapKey, final String itemKey) throws ContextException {
+        // Lock using the lock manager
+        lockManager.lockForReading(mapKey.getID(), itemKey);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.core.context.ContextDistributor#lockForWriting(java.lang.String)
+     */
+    @Override
+    public synchronized void lockForWriting(final AxArtifactKey mapKey, final String itemKey) throws ContextException {
+        // Lock using the lock manager
+        lockManager.lockForWriting(mapKey.getID(), itemKey);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.core.context.ContextDistributor#unlockForReading(java.lang.String)
+     */
+    @Override
+    public void unlockForReading(final AxArtifactKey mapKey, final String itemKey) throws ContextException {
+        // Unlock using the lock manager
+        lockManager.unlockForReading(mapKey.getID(), itemKey);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.core.context.ContextDistributor#unlockForWriting(java.lang.String)
+     */
+    @Override
+    public void unlockForWriting(final AxArtifactKey mapKey, final String itemKey) throws ContextException {
+        // Unlock using the lock manager
+        lockManager.unlockForWriting(mapKey.getID(), itemKey);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.core.context.ContextDistributor#clear()
+     */
+    @Override
+    public void clear() {
+        // Shut down the lock manager
+        if (lockManager != null) {
+            lockManager.shutdown();
+            lockManager = null;
+        }
+
+        albumMaps.clear();
+
+        // Turn off the flush timer
+        flushTimer.cancel();
+
+        // Shut down the specialization of the context distributor
+        shutdown();
+    }
+}
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
new file mode 100644
index 0000000..1af13cb
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFactory.java
@@ -0,0 +1,86 @@
+/*-
+ * ============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;
+
+import org.onap.policy.apex.context.ContextException;
+import org.onap.policy.apex.context.Distributor;
+import org.onap.policy.apex.context.parameters.DistributorParameters;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.service.ParameterService;
+import org.onap.policy.apex.model.utilities.Assertions;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * This class returns a context distributor for the particular type of distribution mechanism configured for use.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class DistributorFactory {
+    // Get a reference to the logger
+    private static final XLogger LOGGER = XLoggerFactory.getXLogger(DistributorFactory.class);
+
+    /**
+     * Get a context distributor for a given context set key.
+     *
+     * @param key The key for the distributor
+     * @return a context distributor
+     * @throws ContextException on context distributor creation errors
+     */
+    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");
+
+        // Get the class for the distributor using reflection
+        final DistributorParameters distributorParameters = ParameterService.getParameters(DistributorParameters.class);
+        final String pluginClass = distributorParameters.getPluginClass();
+        Object contextDistributorObject = null;
+        try {
+            contextDistributorObject = Class.forName(pluginClass).newInstance();
+        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
+            LOGGER.error(
+                    "Apex context distributor class not found for context distributor plugin \"" + pluginClass + "\"",
+                    e);
+            throw new ContextException(
+                    "Apex context distributor class not found for context distributor plugin \"" + pluginClass + "\"",
+                    e);
+        }
+
+        // Check the class is a distributor
+        if (!(contextDistributorObject instanceof Distributor)) {
+            final String returnString = "Specified Apex context distributor plugin class \"" + pluginClass
+                    + "\" does not implement the ContextDistributor interface";
+            LOGGER.error(returnString);
+            throw new ContextException(returnString);
+        }
+
+        // The context Distributor to return
+        final Distributor contextDistributor = (Distributor) contextDistributorObject;
+
+        // Lock and load the context distributor
+        contextDistributor.init(key);
+
+        LOGGER.exit(
+                "Distributor factory, key=" + key + ", selected distributor of class " + contextDistributor.getClass());
+        return contextDistributor;
+    }
+}
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
new file mode 100644
index 0000000..467d43f
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java
@@ -0,0 +1,116 @@
+/*-
+ * ============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;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.onap.policy.apex.context.ContextException;
+import org.onap.policy.apex.context.Distributor;
+import org.onap.policy.apex.context.parameters.PersistorParameters;
+import org.onap.policy.apex.model.basicmodel.service.ParameterService;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * This class is used to periodically flush a context distributor.
+ *
+ * @author eeilfn
+ */
+public class DistributorFlushTimerTask extends TimerTask {
+    private static final XLogger LOGGER = XLoggerFactory.getXLogger(DistributorFlushTimerTask.class);
+
+    // The timer for flushing
+    private Timer timer = null;
+
+    // The context distributor to flush
+    private final Distributor contextDistributor;
+
+    // Timing information
+    private long period = 0;
+    private long flushCount = 0;
+
+    /**
+     * Constructor, save a reference to the event stream handler.
+     *
+     * @param contextDistributor the distributor that this timer task is flushing
+     * @throws ContextException On flush setup errors
+     */
+    public DistributorFlushTimerTask(final Distributor contextDistributor) throws ContextException {
+        // Save the context distributor and period
+        this.contextDistributor = contextDistributor;
+
+        // Set the period for persistence flushing
+        final PersistorParameters persistorParameters = ParameterService.getParameters(PersistorParameters.class);
+        period = persistorParameters.getFlushPeriod();
+
+        // Set up the timer
+        timer = new Timer(DistributorFlushTimerTask.class.getSimpleName(), true);
+        timer.schedule(this, period, period);
+
+        LOGGER.debug("context distributor " + contextDistributor.getKey().getID() + " flushing set up with interval: "
+                + period + "ms");
+    }
+
+    /**
+     * Flush the context distributor.
+     */
+    @Override
+    public void run() {
+        // Increment the flush counter
+        flushCount++;
+
+        LOGGER.debug("context distributor " + contextDistributor.getKey().getID() + " flushing: period=" + period
+                + ": count=" + flushCount);
+        try {
+            contextDistributor.flush();
+            LOGGER.debug("context distributor " + contextDistributor.getKey().getID() + " flushed: period=" + period
+                    + ": count=" + flushCount);
+        } catch (final ContextException e) {
+            LOGGER.error("flush error on context distributor " + contextDistributor.getKey().getID() + ": period="
+                    + period + ": count=" + flushCount, e);
+        }
+    }
+
+    /**
+     * Cancel the timer.
+     *
+     * @return true, if cancel
+     */
+    @Override
+    public boolean cancel() {
+        // Cancel the timer
+        if (timer != null) {
+            timer.cancel();
+        }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "ContextDistributorFlushTimerTask [period=" + period + ", 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
new file mode 100644
index 0000000..dc66372
--- /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<String, Object> getContextAlbumMap(final AxArtifactKey contextMapKey) {
+        LOGGER.debug("create map: " + contextMapKey.getID());
+        return Collections.synchronizedMap(new HashMap<String, Object>());
+    }
+
+    /*
+     * (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/package-info.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/package-info.java
new file mode 100644
index 0000000..d964200
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/package-info.java
@@ -0,0 +1,27 @@
+/*-
+ * ============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=========================================================
+ */
+
+/**
+ * Provides the JVM local default context distribution mechanism for APEX.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+
+package org.onap.policy.apex.context.impl.distribution.jvmlocal;
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/package-info.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/package-info.java
new file mode 100644
index 0000000..9b21eed
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/package-info.java
@@ -0,0 +1,28 @@
+/*-
+ * ============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=========================================================
+ */
+
+/**
+ * Provides an implementation of context album distribution that uses a distribution plugin to distribute items in APEX
+ * context albums. It also provides a default JVM local distribution plugin.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+
+package org.onap.policy.apex.context.impl.distribution;
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
new file mode 100644
index 0000000..4f197e2
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/AbstractLockManager.java
@@ -0,0 +1,225 @@
+/*-
+ * ============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;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.locks.ReadWriteLock;
+
+import org.onap.policy.apex.context.ContextException;
+import org.onap.policy.apex.context.LockManager;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * This class implements the {@link LockManager} functionality that is common across all implementations. Lock managers
+ * for specific lock mechanisms specialize this class.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public abstract class AbstractLockManager implements LockManager {
+    // Logger for this class
+    private static final XLogger LOGGER = XLoggerFactory.getXLogger(AbstractLockManager.class);
+
+    // The key of this lock manager
+    private AxArtifactKey key = null;
+
+    // Map of locks in use on this distributor for each context map
+    private final Map<String, Map<String, ReadWriteLock>> lockMaps =
+            Collections.synchronizedMap(new HashMap<String, Map<String, ReadWriteLock>>());
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.LockManager#init(org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey)
+     */
+    @Override
+    public void init(final AxArtifactKey lockManagerKey) throws ContextException {
+        this.key = lockManagerKey;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.LockManager#getKey()
+     */
+    @Override
+    public AxArtifactKey getKey() {
+        return key;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.core.context.LockManager#lockForReading(org.onap.policy.apex.core.model.concepts.
+     * AxArtifactKey, java.lang.String)
+     */
+    @Override
+    public synchronized void lockForReading(final String lockTypeKey, final String lockKey) throws ContextException {
+        LOGGER.entry("lockForReading(" + lockTypeKey + "_" + lockKey + ")");
+
+        // Find the lock or create a new one
+        final ReadWriteLock lock = getLock(lockTypeKey, lockKey, true);
+
+        try {
+            lock.readLock().lock();
+            LOGGER.exit("lockForReading(" + lockTypeKey + "_" + lockKey + ")");
+        } catch (final Exception e) {
+            LOGGER.warn("error acquiring read lock on context map " + lockTypeKey + " context item " + lockKey, e);
+            throw new ContextException(
+                    "error acquiring read lock on context map " + lockTypeKey + " context item " + lockKey, e);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.core.context.LockManager#lockForWriting(java.lang.String, java.lang.String)
+     */
+    @Override
+    public synchronized void lockForWriting(final String lockTypeKey, final String lockKey) throws ContextException {
+        LOGGER.entry("lockForWriting(" + lockTypeKey + "_" + lockKey + ")");
+
+        // Find the lock or create a new one
+        final ReadWriteLock lock = getLock(lockTypeKey, lockKey, true);
+
+        try {
+            lock.writeLock().lock();
+            LOGGER.exit("lockForWriting(" + lockTypeKey + "_" + lockKey + ")");
+        } catch (final Exception e) {
+            LOGGER.warn("error acquiring write lock on context map " + lockTypeKey + " context item " + lockKey, e);
+            throw new ContextException(
+                    "error acquiring write lock on context map " + lockTypeKey + " context item " + lockKey, e);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.core.context.LockManager#unlockForReading(java.lang.String, java.lang.String)
+     */
+    @Override
+    public void unlockForReading(final String lockTypeKey, final String lockKey) throws ContextException {
+        LOGGER.entry("unlockForReading(" + lockTypeKey + "_" + lockKey + ")");
+
+        // Find the lock
+        final ReadWriteLock lock = getLock(lockTypeKey, lockKey, false);
+
+        try {
+            lock.readLock().unlock();
+            LOGGER.exit("unlockForReading(" + lockTypeKey + "_" + lockKey + ")");
+        } catch (final Exception e) {
+            LOGGER.warn("error releasing read lock on context map " + lockTypeKey + " context item " + lockKey, e);
+            throw new ContextException(
+                    "error releasing read lock on context map " + lockTypeKey + " context item " + lockKey, e);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.core.context.LockManager#unlockForWriting(java.lang.String, java.lang.String)
+     */
+    @Override
+    public void unlockForWriting(final String lockTypeKey, final String lockKey) throws ContextException {
+        LOGGER.entry("unlockForWriting(" + lockTypeKey + "_" + lockKey + ")");
+
+        // Find the lock
+        final ReadWriteLock lock = getLock(lockTypeKey, lockKey, false);
+
+        try {
+            lock.writeLock().unlock();
+            LOGGER.exit("unlockForWriting(" + lockTypeKey + "_" + lockKey + ")");
+        } catch (final Exception e) {
+            LOGGER.warn("error releasing write lock on context map " + lockTypeKey + " context item " + lockKey, e);
+            throw new ContextException(
+                    "error releasing write lock on context map " + lockTypeKey + " context item " + lockKey, e);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.core.context.LockManager#shutdown()
+     */
+    @Override
+    public abstract void shutdown();
+
+    /**
+     * Get a reentrant read write lock from whatever locking mechanism is in use.
+     *
+     * @param lockId The unique ID of the lock.
+     * @return The lock
+     * @throws ContextException On errors getting a lock
+     */
+    protected abstract ReadWriteLock getReentrantReadWriteLock(String lockId) throws ContextException;
+
+    /**
+     * Get a lock for a context item in a context map.
+     *
+     * @param lockTypeKey The key of the map where the context item to lock is
+     * @param lockKey The key on the map to lock
+     * @param createMode if true, create a lock if it does not exist
+     * @return The lock
+     * @throws ContextException On errors getting the lock
+     */
+    private ReadWriteLock getLock(final String lockTypeKey, final String lockKey, final boolean createMode)
+            throws ContextException {
+        // Check if we have a lock type map for this lock type yet
+        if (!lockMaps.containsKey(lockTypeKey)) {
+            // Create a lock type map for the lock type
+            lockMaps.put(lockTypeKey, Collections.synchronizedMap(new HashMap<String, ReadWriteLock>()));
+        }
+
+        // Find or create a lock in the lock map
+        ReadWriteLock lock = lockMaps.get(lockTypeKey).get(lockKey);
+        if (lock != null) {
+            return lock;
+        }
+
+        // Should we create a lock?
+        if (!createMode) {
+            LOGGER.warn("error getting lock on context map " + lockTypeKey + " context item " + lockKey
+                    + ", lock does not exist");
+            throw new ContextException("error getting lock on context map " + lockTypeKey + " context item " + lockKey
+                    + ", lock does not exist");
+        }
+
+        try {
+            // Create the lock using the specialization of this abstract class
+            lock = getReentrantReadWriteLock(lockTypeKey + "_" + lockKey);
+
+            // Add the lock to the lock map
+            lockMaps.get(lockTypeKey).put(lockKey, lock);
+
+            if (LOGGER.isTraceEnabled()) {
+                LOGGER.trace("created lock " + lockTypeKey + "_" + lockKey);
+            }
+            return lock;
+        } catch (final Exception e) {
+            LOGGER.warn("error getting lock on context map " + lockTypeKey + " context item " + lockKey, e);
+            throw new ContextException("error getting lock on context map " + lockTypeKey + " context item " + lockKey,
+                    e);
+        }
+    }
+}
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
new file mode 100644
index 0000000..f3f4a62
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/LockManagerFactory.java
@@ -0,0 +1,84 @@
+/*-
+ * ============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;
+
+import org.onap.policy.apex.context.ContextException;
+import org.onap.policy.apex.context.LockManager;
+import org.onap.policy.apex.context.parameters.LockManagerParameters;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.service.ParameterService;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * This class returns a {@link LockManager} for the particular type of locking mechanism that has been configured for
+ * use.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class LockManagerFactory {
+    // Get a reference to the logger
+    private static final XLogger LOGGER = XLoggerFactory.getXLogger(LockManagerFactory.class);
+
+    /**
+     * Return a {@link LockManager} for the particular type of locking mechanism configured for use.
+     *
+     * @param key The key for the lock manager
+     * @return a lock manager that can generate locks using some underlying mechanism
+     * @throws ContextException on errors in getting a lock manager
+     */
+    public LockManager createLockManager(final AxArtifactKey key) throws ContextException {
+        LOGGER.entry("Lock Manager factory, key=" + key);
+
+        final LockManagerParameters lockManagerParameters = ParameterService.getParameters(LockManagerParameters.class);
+
+        // Get the class for the lock manager using reflection
+        Object lockManagerObject = null;
+        final String pluginClass = lockManagerParameters.getPluginClass();
+        try {
+            lockManagerObject = Class.forName(pluginClass).newInstance();
+        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
+            LOGGER.error(
+                    "Apex context lock manager class not found for context lock manager plugin \"" + pluginClass + "\"",
+                    e);
+            throw new ContextException(
+                    "Apex context lock manager class not found for context lock manager plugin \"" + pluginClass + "\"",
+                    e);
+        }
+
+        // Check the class is a lock manager
+        if (!(lockManagerObject instanceof LockManager)) {
+            LOGGER.error("Specified Apex context lock manager plugin class \"" + pluginClass
+                    + "\" does not implement the LockManager interface");
+            throw new ContextException("Specified Apex context lock manager plugin class \"" + pluginClass
+                    + "\" does not implement the LockManager interface");
+        }
+
+        // The context lock manager to return
+        final LockManager lockManager = (LockManager) lockManagerObject;
+
+        // Lock and load (OK sorry!!!) the lock manager
+        lockManager.init(key);
+
+        LOGGER.exit("Lock manager factory, key=" + key + ", selected lock manager of class " + lockManager.getClass());
+        return lockManager;
+    }
+}
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 0000000..5e71557
--- /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/locking/jvmlocal/package-info.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/jvmlocal/package-info.java
new file mode 100644
index 0000000..f1ac5cf
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/jvmlocal/package-info.java
@@ -0,0 +1,27 @@
+/*-
+ * ============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=========================================================
+ */
+
+/**
+ * Provides the JVM local default context lock management mechanism for apex.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+
+package org.onap.policy.apex.context.impl.locking.jvmlocal;
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/package-info.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/package-info.java
new file mode 100644
index 0000000..1a46727
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/package-info.java
@@ -0,0 +1,26 @@
+/*-
+ * ============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=========================================================
+ */
+
+/**
+ * Provides an implementation of context album lock management that uses a lock management plugin to lock items items in
+ * Apex context albums. It also provides a default JVM local lock management plugin.
+ */
+
+package org.onap.policy.apex.context.impl.locking;
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/package-info.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/package-info.java
new file mode 100644
index 0000000..989827b
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/package-info.java
@@ -0,0 +1,28 @@
+/*-
+ * ============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=========================================================
+ */
+
+/**
+ * Provides an implementation of APEX context schemas and APEX context albums. It provides default implementations of
+ * context schema handling and context album distribution, locking, and persistence.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+
+package org.onap.policy.apex.context.impl;
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
new file mode 100644
index 0000000..af6f922
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/PersistorFactory.java
@@ -0,0 +1,83 @@
+/*-
+ * ============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.persistence;
+
+import org.onap.policy.apex.context.ContextException;
+import org.onap.policy.apex.context.Persistor;
+import org.onap.policy.apex.context.parameters.PersistorParameters;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.service.ParameterService;
+import org.onap.policy.apex.model.utilities.Assertions;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * This class returns a persistor for the particular type of persistor mechanism that has been configured for use.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class PersistorFactory {
+    // Get a reference to the logger
+    private static final XLogger LOGGER = XLoggerFactory.getXLogger(PersistorFactory.class);
+
+    /**
+     * Return a persistor for the persistence mechanism configured for use.
+     *
+     * @param key The key for the persistor
+     * @return a persistor
+     * @throws ContextException on invalid persistor types
+     */
+    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");
+
+        final PersistorParameters persistorParameters = ParameterService.getParameters(PersistorParameters.class);
+
+        // Get the class for the persistor using reflection
+        Object persistorObject = null;
+        final String pluginClass = persistorParameters.getPluginClass();
+        try {
+            persistorObject = Class.forName(pluginClass).newInstance();
+        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
+            LOGGER.error("Apex context persistor class not found for context persistor plugin \"" + pluginClass + "\"",
+                    e);
+            throw new ContextException(
+                    "Apex context persistor class not found for context persistor plugin \"" + pluginClass + "\"", e);
+        }
+
+        // Check the class is a persistor
+        if (!(persistorObject instanceof Persistor)) {
+            LOGGER.error("Specified Apex context persistor plugin class \"" + pluginClass
+                    + "\" does not implement the ContextDistributor interface");
+            throw new ContextException("Specified Apex context persistor plugin class \"" + pluginClass
+                    + "\" does not implement the ContextDistributor interface");
+        }
+
+        // The persistor to return
+        final Persistor persistor = (Persistor) persistorObject;
+
+        // Lock and load the persistor
+        persistor.init(key);
+
+        LOGGER.exit("Persistor factory, key=" + key + ", selected persistor of class " + persistor.getClass());
+        return persistor;
+    }
+}
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
new file mode 100644
index 0000000..b875978
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/ephemeral/EphemeralPersistor.java
@@ -0,0 +1,100 @@
+/*-
+ * ============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.persistence.ephemeral;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.onap.policy.apex.context.ContextException;
+import org.onap.policy.apex.context.Persistor;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
+
+/**
+ * This class acts as an "in memory" persistor for a single JVM. It just initiates stubs the Persistor interface and
+ * does not persist anything.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class EphemeralPersistor implements Persistor {
+
+    // The key of this persistor
+    private AxArtifactKey key;
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.Persistor#init(org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey)
+     */
+    @Override
+    public void init(final AxArtifactKey persistorKey) throws ContextException {
+        this.key = persistorKey;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.Persistor#getKey()
+     */
+    @Override
+    public AxArtifactKey getKey() {
+        return key;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.core.context.Persistor#readContextItem(org.onap.policy.apex.core.basicmodel.concepts.
+     * AxReferenceKey, java.lang.Class)
+     */
+    @Override
+    public AxContextSchema readContextItem(final AxReferenceKey itemKey, final Class<?> contextItemClass) {
+        // Can't read from this persistor as nothing is persisted
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.core.context.Persistor#readContextItems(org.onap.policy.apex.core.basicmodel.concepts.
+     * AxArtifactKey, java.lang.Class)
+     */
+    @Override
+    public Set<AxContextSchema> readContextItems(final AxArtifactKey ownerKey, final Class<?> contextItemClass)
+            throws ContextException {
+        // No reading from persistence on the Ephemeral persistor, return an empty set
+        return new TreeSet<>();
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.onap.policy.apex.core.context.Persistor#writeContextItem(org.onap.policy.apex.core.contextmodel.concepts.
+     * AxContextItem)
+     */
+    @Override
+    public Object writeContextItem(final Object contextItem) {
+        // No writing to persistence on the Ephemeral persistor
+        return contextItem;
+    }
+}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/ephemeral/package-info.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/ephemeral/package-info.java
new file mode 100644
index 0000000..2d31d21
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/ephemeral/package-info.java
@@ -0,0 +1,28 @@
+/*-
+ * ============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=========================================================
+ */
+
+/**
+ * Provides the JVM local default context persistence mechanism for APEX, which is in fact a dummy persistor that just
+ * stubs the Persistor interface and does not persist anything.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+
+package org.onap.policy.apex.context.impl.persistence.ephemeral;
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/package-info.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/package-info.java
new file mode 100644
index 0000000..d450dd8
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/package-info.java
@@ -0,0 +1,28 @@
+/*-
+ * ============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=========================================================
+ */
+
+/**
+ * Provides an implementation of context album persistence that uses a persistence plugin to lock items items in APEX
+ * context albums. It also provides a default JVM local persistence plugin.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+
+package org.onap.policy.apex.context.impl.persistence;
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
new file mode 100644
index 0000000..83d1b6b
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java
@@ -0,0 +1,169 @@
+/*-
+ * ============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.schema;
+
+import java.lang.reflect.Constructor;
+
+import org.onap.policy.apex.context.ContextRuntimeException;
+import org.onap.policy.apex.context.SchemaHelper;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
+import org.onap.policy.apex.model.utilities.Assertions;
+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.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public abstract class AbstractSchemaHelper implements SchemaHelper {
+    // Get a reference to the logger
+    private static final XLogger LOGGER = XLoggerFactory.getXLogger(AbstractSchemaHelper.class);
+
+    // The key of the user of this schema helper
+    private AxKey userKey = null;
+
+    // The schema of this schema helper
+    private AxContextSchema schema = null;
+
+    // The class of objects for this schema
+    private Class<?> schemaClass;
+
+    /**
+     * Sets the schema class for the schema, designed jots to be called by sub classes.
+     *
+     * @param schemaClass the Java class that is used to hold items of this schema
+     */
+    protected void setSchemaClass(final Class<?> schemaClass) {
+        this.schemaClass = schemaClass;
+    }
+
+    /*
+     * (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)
+     */
+    @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");
+
+        this.userKey = incomingUserKey;
+        this.schema = incomingSchema;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.SchemaHelper#getKey()
+     */
+    @Override
+    public AxKey getUserKey() {
+        return userKey;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.SchemaHelper#getSchema()
+     */
+    @Override
+    public AxContextSchema getSchema() {
+        return schema;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.SchemaHelper#getSchemaClass()
+     */
+    @Override
+    public Class<?> getSchemaClass() {
+        return schemaClass;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.SchemaHelper#getSchemaObject()
+     */
+    @Override
+    public Object getSchemaObject() {
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.SchemaHelper#createNewInstance()
+     */
+    @Override
+    public Object createNewInstance() {
+        if (schemaClass == 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);
+        }
+
+        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() + "()\"";
+            LOGGER.warn(returnString, e);
+            throw new ContextRuntimeException(returnString, e);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.SchemaHelper#createNewInstance(java.lang.String)
+     */
+    @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";
+            LOGGER.warn(returnString);
+            throw new ContextRuntimeException(returnString);
+        }
+
+        try {
+            // Find a string constructor
+            final Constructor<?> stringConstructor = schemaClass.getConstructor(String.class);
+
+            // 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)\"";
+            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
new file mode 100644
index 0000000..7252d37
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/SchemaHelperFactory.java
@@ -0,0 +1,119 @@
+/*-
+ * ============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.schema;
+
+import org.onap.policy.apex.context.ContextRuntimeException;
+import org.onap.policy.apex.context.SchemaHelper;
+import org.onap.policy.apex.context.parameters.SchemaHelperParameters;
+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;
+import org.onap.policy.apex.model.basicmodel.service.ModelService;
+import org.onap.policy.apex.model.basicmodel.service.ParameterService;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
+import org.onap.policy.apex.model.utilities.Assertions;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * This class returns a {@link SchemaHelper} for the particular type of schema mechanism configured for use.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class SchemaHelperFactory {
+    // Get a reference to the logger
+    private static final XLogger LOGGER = XLoggerFactory.getXLogger(SchemaHelperFactory.class);
+
+    /**
+     * Return a {@link SchemaHelper} for the particular type of schema mechanism configured for use.
+     *
+     * @param owningEntityKey The key of the entity that owns the schema helper
+     * @param schemaKey The key of the schema the schema helper is operating on
+     * @return a lock schema that can handle translation of objects in a particular schema format
+     * @throws ContextRuntimeException the context runtime exception
+     */
+    public SchemaHelper createSchemaHelper(final AxKey owningEntityKey, final AxArtifactKey schemaKey)
+            throws ContextRuntimeException {
+        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");
+
+        // 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";
+            LOGGER.warn(resultString);
+            throw new ContextRuntimeException(resultString);
+        }
+
+        // Get the schema class using the parameter service
+        final SchemaParameters schemaParameters = ParameterService.getParameters(SchemaParameters.class);
+        if (schemaParameters == null) {
+            final String resultString = "context schema parameters \"" + SchemaParameters.class.getCanonicalName()
+                    + "\" not found in parameter service";
+            LOGGER.warn(resultString);
+            throw new ContextRuntimeException(resultString);
+        }
+
+        // Get the class for the schema helper from the schema parameters
+        final SchemaHelperParameters schemaHelperParameters =
+                schemaParameters.getSchemaHelperParameters(schema.getSchemaFlavour());
+        if (schemaHelperParameters == null) {
+            final String resultString = "context schema helper parameters not found for context schema  \""
+                    + schema.getSchemaFlavour() + "\"";
+            LOGGER.warn(resultString);
+            throw new ContextRuntimeException(resultString);
+        }
+
+        // Get the class for the schema helper using reflection
+        Object schemaHelperObject = null;
+        final String pluginClass = schemaHelperParameters.getSchemaHelperPluginClass();
+        try {
+            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 + "\"";
+            LOGGER.warn(resultString, e);
+            throw new ContextRuntimeException(resultString, e);
+        }
+
+        // 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";
+            LOGGER.warn(resultString);
+            throw new ContextRuntimeException(resultString);
+        }
+
+        // The context schema helper to return
+        final SchemaHelper schemaHelper = (SchemaHelper) schemaHelperObject;
+
+        // Lock and load the schema helper
+        schemaHelper.init(owningEntityKey.getKey(), schema);
+
+        LOGGER.exit("Schema Helper factory, owningEntityKey=" + owningEntityKey + ", selected schema helper of class "
+                + schemaHelper.getClass());
+        return schemaHelper;
+    }
+}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java
new file mode 100644
index 0000000..b89efbf
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java
@@ -0,0 +1,214 @@
+/*-
+ * ============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.schema.java;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.onap.policy.apex.context.ContextRuntimeException;
+import org.onap.policy.apex.context.impl.schema.AbstractSchemaHelper;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
+import org.onap.policy.apex.model.utilities.typeutils.TypeBuilder;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * This class implements translation to and from Apex distributed objects and Java objects when a Java schema is used.
+ * It creates schema items as Java objects and marshals and unmarshals these objects in various formats. All objects
+ * must be of the type of Java class defined in the schema.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class JavaSchemaHelper extends AbstractSchemaHelper {
+    // Get a reference to the logger
+    private static final XLogger LOGGER = XLoggerFactory.getXLogger(JavaSchemaHelper.class);
+
+    // This map defines the built in types in types in Java
+    // @formatter:off
+    private static final Map<String, Class<?>> BUILT_IN_MAP = new HashMap<>();
+    {
+        BUILT_IN_MAP.put("int",    Integer  .TYPE);
+        BUILT_IN_MAP.put("long",   Long     .TYPE);
+        BUILT_IN_MAP.put("double", Double   .TYPE);
+        BUILT_IN_MAP.put("float",  Float    .TYPE);
+        BUILT_IN_MAP.put("bool",   Boolean  .TYPE);
+        BUILT_IN_MAP.put("char",   Character.TYPE);
+        BUILT_IN_MAP.put("byte",   Byte     .TYPE);
+        BUILT_IN_MAP.put("void",   Void     .TYPE);
+        BUILT_IN_MAP.put("short",  Short    .TYPE);
+    }
+    // @formatter:on
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.impl.schema.AbstractSchemaHelper#init(org.onap.policy.apex.model.basicmodel.
+     * concepts. AxKey, org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema)
+     */
+    @Override
+    public void init(final AxKey userKey, final AxContextSchema schema) throws ContextRuntimeException {
+        super.init(userKey, schema);
+
+        final String javatype = schema.getSchema();
+        // For Java, the schema is the Java class canonical path
+
+        try {
+            setSchemaClass(TypeBuilder.getJavaTypeClass(schema.getSchema()));
+        } catch (final IllegalArgumentException e) {
+
+            String resultSting = userKey.getID() + ": class/type " + schema.getSchema() + " for context schema \""
+                    + schema.getID() + "\" not found.";
+            if (JavaSchemaHelper.BUILT_IN_MAP.get(javatype) != null) {
+                resultSting += " Primitive types are not supported. Use the appropriate Java boxing type instead.";
+            } else {
+                resultSting += " Check the class path of the JVM";
+            }
+            LOGGER.warn(resultSting);
+            throw new ContextRuntimeException(resultSting, e);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.SchemaHelper#createNewInstance(com.google.gson.JsonElement)
+     */
+    @Override
+    public Object createNewInstance(final JsonElement jsonElement) {
+        final String elementJsonString = new Gson().toJson(jsonElement);
+
+        return new Gson().fromJson(elementJsonString, this.getSchemaClass());
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.SchemaHelper#object2SchemaObject(java.lang.Object)
+     */
+    @Override
+    public Object unmarshal(final Object object) {
+        if (object == null) {
+            return null;
+        }
+
+        // If the object is an instance of the incoming object, carry on
+        if (object.getClass().equals(getSchemaClass())) {
+            return object;
+        }
+
+        // For numeric types, do a numeric conversion
+        if (Number.class.isAssignableFrom(getSchemaClass())) {
+            return numericConversion(object);
+        }
+
+        if (getSchemaClass().isAssignableFrom(object.getClass())) {
+            return object;
+        } else {
+            return stringConversion(object);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.SchemaHelper#schemaObject2Json(java.lang.Object)
+     */
+    @Override
+    public String marshal2Json(final Object schemaObject) {
+        if (schemaObject == null) {
+            return "null";
+        }
+
+        // Check the incoming object is of a correct class
+        if (getSchemaClass().isAssignableFrom(schemaObject.getClass())) {
+            // Use Gson to translate the object
+            return new Gson().toJson(schemaObject);
+        } else {
+            final String returnString = getUserKey().getID() + ": object \"" + schemaObject.toString()
+                    + "\" of class \"" + schemaObject.getClass().getCanonicalName() + "\" not compatible with class \""
+                    + getSchemaClass().getCanonicalName() + "\"";
+            LOGGER.warn(returnString);
+            throw new ContextRuntimeException(returnString);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.context.SchemaHelper#marshal2JsonElement(java.lang.Object)
+     */
+    @Override
+    public JsonElement marshal2JsonElement(final Object schemaObject) {
+        // Use Gson to marshal the schema object into a Json element to return
+        return new Gson().toJsonTree(schemaObject, getSchemaClass());
+    }
+
+    /**
+     * Do a numeric conversion between numeric types.
+     *
+     * @param object The incoming numeric object
+     * @return The converted object
+     */
+    private Object numericConversion(final Object object) {
+        // Check if the incoming object is a number, if not do a string conversion
+        if (object instanceof Number) {
+            if (getSchemaClass().isAssignableFrom(Byte.class)) {
+                return ((Number) object).byteValue();
+            } else if (getSchemaClass().isAssignableFrom(Integer.class)) {
+                return ((Number) object).intValue();
+            } else if (getSchemaClass().isAssignableFrom(Long.class)) {
+                return ((Number) object).longValue();
+            } else if (getSchemaClass().isAssignableFrom(Float.class)) {
+                return ((Number) object).floatValue();
+            } else if (getSchemaClass().isAssignableFrom(Double.class)) {
+                return ((Number) object).doubleValue();
+            }
+        }
+
+        // OK, we'll try and convert from a string representation of the incoming object
+        return stringConversion(object);
+    }
+
+    /**
+     * Do a string conversion to the class type.
+     *
+     * @param object The incoming numeric object
+     * @return The converted object
+     */
+    private Object stringConversion(final Object object) {
+        // OK, we'll try and convert from a string representation of the incoming object
+        try {
+            final Constructor<?> stringConstructor = getSchemaClass().getConstructor(String.class);
+            return stringConstructor.newInstance(object.toString());
+        } catch (final Exception e) {
+            final String returnString = getUserKey().getID() + ": object \"" + object.toString() + "\" of class \""
+                    + object.getClass().getCanonicalName() + "\" not compatible with class \""
+                    + getSchemaClass().getCanonicalName() + "\"";
+            LOGGER.warn(returnString);
+            throw new ContextRuntimeException(returnString);
+        }
+    }
+}
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
new file mode 100644
index 0000000..18339d8
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperParameters.java
@@ -0,0 +1,38 @@
+/*-
+ * ============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.schema.java;
+
+import org.onap.policy.apex.context.parameters.SchemaHelperParameters;
+
+/**
+ * The Schema helper parameter class for the Java schema helper is an empty parameter class that acts as a placeholder.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class JavaSchemaHelperParameters extends SchemaHelperParameters {
+
+    /**
+     * The Constructor.
+     */
+    public JavaSchemaHelperParameters() {
+        this.setSchemaHelperPluginClass(JavaSchemaHelper.class.getCanonicalName());
+    }
+}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/package-info.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/package-info.java
new file mode 100644
index 0000000..0529813
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/package-info.java
@@ -0,0 +1,27 @@
+/*-
+ * ============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=========================================================
+ */
+
+/**
+ * Provides the Java schema helper for APEX, which manages context items that are Java objects.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+
+package org.onap.policy.apex.context.impl.schema.java;
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/package-info.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/package-info.java
new file mode 100644
index 0000000..458a86a
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/package-info.java
@@ -0,0 +1,29 @@
+/*-
+ * ============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=========================================================
+ */
+
+/**
+ * Provides an implementation of context schema handling that uses a schema helper plugin to manage schemas and to
+ * create, marshal, and unmarshal context items in various formats for APEX context. It also provides a default java
+ * schema handler plugin.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+
+package org.onap.policy.apex.context.impl.schema;
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/ContextMonitor.java b/context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/ContextMonitor.java
new file mode 100644
index 0000000..8e34ecb
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/ContextMonitor.java
@@ -0,0 +1,210 @@
+/*-
+ * ============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.monitoring;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * This class is used to monitor context creates, deletes, gets, sets, locks and unlocks on context items in Apex
+ * context albums.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class ContextMonitor {
+    // Logger for this class
+    private static final XLogger LOGGER = XLoggerFactory.getXLogger(ContextMonitor.class);
+
+    /**
+     * Monitor an initiation on a context item.
+     *
+     * @param albumKey The item album
+     * @param schemaKey The item schema
+     * @param name The name of the item
+     * @param value The value of the item
+     */
+    public void monitorInit(final AxArtifactKey albumKey, final AxArtifactKey schemaKey, final String name,
+            final Object value) {
+        LOGGER.trace(monitor("INIT", null, albumKey, schemaKey, name, value));
+    }
+
+    /**
+     * Monitor an initiation on a context item.
+     *
+     * @param albumKey The item album
+     * @param schemaKey The item schema
+     * @param name The name of the item
+     * @param value The value of the item
+     * @param userArtifactStack the keys of the artifacts using the context map at the moment
+     */
+    public void monitorInit(final AxArtifactKey albumKey, final AxArtifactKey schemaKey, final String name,
+            final Object value, final AxConcept[] userArtifactStack) {
+        LOGGER.trace(monitor("INIT", userArtifactStack, albumKey, schemaKey, name, value));
+    }
+
+    /**
+     * Monitor a deletion on a context item.
+     *
+     * @param albumKey The item album
+     * @param schemaKey The item schema
+     * @param name The name of the item
+     * @param value The value of the item
+     * @param userArtifactStack the keys of the artifacts using the context map at the moment
+     */
+    public void monitorDelete(final AxArtifactKey albumKey, final AxArtifactKey schemaKey, final String name,
+            final Object value, final AxConcept[] userArtifactStack) {
+        LOGGER.trace(monitor("DEL", userArtifactStack, albumKey, schemaKey, name, value));
+    }
+
+    /**
+     * Monitor get on a context item.
+     *
+     * @param albumKey The item album
+     * @param schemaKey The item schema
+     * @param name The name of the item
+     * @param value The value of the item
+     * @param userArtifactStack the keys of the artifacts using the context map at the moment
+     */
+    public void monitorGet(final AxArtifactKey albumKey, final AxArtifactKey schemaKey, final String name,
+            final Object value, final AxConcept[] userArtifactStack) {
+        LOGGER.trace(monitor("GET", userArtifactStack, albumKey, schemaKey, name, value));
+    }
+
+    /**
+     * Monitor set on a context item.
+     *
+     * @param albumKey The item album
+     * @param schemaKey The item schema
+     * @param name The name of the item
+     * @param value The value of the item
+     * @param userArtifactStack the keys of the artifacts using the context map at the moment
+     */
+    public void monitorSet(final AxArtifactKey albumKey, final AxArtifactKey schemaKey, final String name,
+            final Object value, final AxConcept[] userArtifactStack) {
+        LOGGER.trace(monitor("SET", userArtifactStack, albumKey, schemaKey, name, value));
+    }
+
+    /**
+     * Monitor a read lock on a key.
+     *
+     * @param albumKey The item album
+     * @param schemaKey The item schema
+     * @param name The name of the item
+     * @param userArtifactStack the keys of the artifacts using the context map at the moment
+     */
+    public void monitorReadLock(final AxArtifactKey albumKey, final AxArtifactKey schemaKey, final String name,
+            final AxConcept[] userArtifactStack) {
+        LOGGER.trace(monitor("READLOCK", userArtifactStack, albumKey, schemaKey, name, null));
+    }
+
+    /**
+     * Monitor a write lock on a key.
+     *
+     * @param albumKey The item album
+     * @param schemaKey The item schema
+     * @param name The name of the item
+     * @param userArtifactStack the keys of the artifacts using the context map at the moment
+     */
+    public void monitorWriteLock(final AxArtifactKey albumKey, final AxArtifactKey schemaKey, final String name,
+            final AxConcept[] userArtifactStack) {
+        LOGGER.trace(monitor("WRITELOCK", userArtifactStack, albumKey, schemaKey, name, null));
+    }
+
+    /**
+     * Monitor a read unlock on a key.
+     *
+     * @param albumKey The item album
+     * @param schemaKey The item schema
+     * @param name The name of the item
+     * @param userArtifactStack the keys of the artifacts using the context map at the moment
+     */
+    public void monitorReadUnlock(final AxArtifactKey albumKey, final AxArtifactKey schemaKey, final String name,
+            final AxConcept[] userArtifactStack) {
+        LOGGER.trace(monitor("READUNLOCK", userArtifactStack, albumKey, schemaKey, name, null));
+    }
+
+    /**
+     * Monitor a write unlock on a key.
+     *
+     * @param albumKey The item album
+     * @param schemaKey The item schema
+     * @param name The name of the item
+     * @param userArtifactStack the keys of the artifacts using the context map at the moment
+     */
+    public void monitorWriteUnlock(final AxArtifactKey albumKey, final AxArtifactKey schemaKey, final String name,
+            final AxConcept[] userArtifactStack) {
+        LOGGER.trace(monitor("WRITEUNLOCK", userArtifactStack, albumKey, schemaKey, name, null));
+    }
+
+    /**
+     * Monitor the user artifact stack.
+     *
+     * @param preamble the preamble
+     * @param userArtifactStack The user stack to print
+     * @param albumKey the album key
+     * @param schemaKey the schema key
+     * @param name the name
+     * @param value the value
+     * @return the string
+     */
+    private String monitor(final String preamble, final AxConcept[] userArtifactStack, final AxArtifactKey albumKey,
+            final AxArtifactKey schemaKey, final String name, final Object value) {
+        final StringBuilder builder = new StringBuilder();
+
+        builder.append(preamble);
+        builder.append(",[");
+
+        if (userArtifactStack != null) {
+            boolean first = true;
+            for (final AxConcept stackKey : userArtifactStack) {
+                if (first) {
+                    first = false;
+                } else {
+                    builder.append(',');
+                }
+                if (stackKey instanceof AxArtifactKey) {
+                    builder.append(((AxArtifactKey) stackKey).getID());
+                } else if (stackKey instanceof AxReferenceKey) {
+                    builder.append(((AxReferenceKey) stackKey).getID());
+                } else {
+                    builder.append(stackKey.toString());
+                }
+            }
+        }
+        builder.append("],");
+
+        builder.append(albumKey.getID());
+        builder.append(',');
+        builder.append(schemaKey.getID());
+        builder.append(',');
+        builder.append(name);
+
+        if (value != null) {
+            builder.append(',');
+            builder.append(value.toString());
+        }
+
+        return builder.toString();
+    }
+}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/package-info.java b/context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/package-info.java
new file mode 100644
index 0000000..2f8ac82
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/package-info.java
@@ -0,0 +1,27 @@
+/*-
+ * ============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=========================================================
+ */
+
+/**
+ * Monitors all creation, deletion, get, set, lock, and unlock operations on items in APEX context albums.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+
+package org.onap.policy.apex.context.monitoring;
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/package-info.java b/context/context-management/src/main/java/org/onap/policy/apex/context/package-info.java
new file mode 100644
index 0000000..8707ae3
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/package-info.java
@@ -0,0 +1,29 @@
+/*-
+ * ============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=========================================================
+ */
+
+/**
+ * Provides the context handling for APEX. It provides the infrastructure and generic implementation for context schemas
+ * and context albums. Schema handlers and context album handlers are implemented as plugins that implement interfaces
+ * defined in this package.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+
+package org.onap.policy.apex.context;
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
new file mode 100644
index 0000000..e50cc60
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/ContextParameters.java
@@ -0,0 +1,146 @@
+/*-
+ * ============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.parameters;
+
+import org.onap.policy.apex.model.basicmodel.service.AbstractParameters;
+import org.onap.policy.apex.model.basicmodel.service.ParameterService;
+
+/**
+ * Bean class to hold parameters for context handling in Apex. This class contains all the context parameters for schema
+ * handling, distribution, locking, and persistence of context albums.
+ * <p>
+ * The following parameters are defined:
+ * <ol>
+ * <li>flushPeriod: Context is flushed to any persistor plugin that is defined periodically, and the period for flushing
+ * is the flush period.
+ * <li>distributorParameters: The parameters (a {@link distributorParameters} instance) for the distributor plugin that
+ * is being used for context album distribution
+ * <li>schemaParameters: The parameters (a {@link SchemaParameters} instance) for the schema plugin that is being used
+ * for context album schemas
+ * <li>lockManagerParameters: The parameters (a {@link LockManagerParameters} instance) for the locking mechanism plugin
+ * that is being used for context album locking
+ * <li>persistorParameters: The parameters (a {@link PersistorParameters} instance) for the persistence plugin that is
+ * being used for context album persistence
+ * </ol>
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class ContextParameters extends AbstractParameters {
+    // @formatter:off
+    // Plugin Parameters
+    private DistributorParameters distributorParameters = new DistributorParameters();
+    private SchemaParameters      schemaParameters      = new SchemaParameters();
+    private LockManagerParameters lockManagerParameters = new LockManagerParameters();
+    private PersistorParameters   persistorParameters   = new PersistorParameters();
+    // @formatter:on
+
+    /**
+     * Constructor to create a context parameters instance and register the instance with the parameter service.
+     */
+    public ContextParameters() {
+        super(ContextParameters.class.getCanonicalName());
+        ParameterService.registerParameters(ContextParameters.class, this);
+    }
+
+    /**
+     * 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;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.model.basicmodel.service.AbstractParameters#toString()
+     */
+    @Override
+    public String toString() {
+        return "ContextParameters [distributorParameters=" + distributorParameters + ", schemaParameters="
+                + schemaParameters + ", lockManagerParameters=" + lockManagerParameters + ", persistorParameters="
+                + persistorParameters + "]";
+    }
+}
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
new file mode 100644
index 0000000..147e4eb
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/DistributorParameters.java
@@ -0,0 +1,85 @@
+/*-
+ * ============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.parameters;
+
+import org.onap.policy.apex.model.basicmodel.service.AbstractParameters;
+import org.onap.policy.apex.model.basicmodel.service.ParameterService;
+
+/**
+ * An empty distributor parameter class that may be specialized by context distributor plugins that require plugin
+ * specific parameters. The class defines the default distributor plugin as the JVM local distributor.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class DistributorParameters extends AbstractParameters {
+    /** The default distributor makes context albums available to all threads in a single JVM. */
+    public static final String DEFAULT_DISTRIBUTOR_PLUGIN_CLASS =
+            "org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor";
+
+    // Plugin class names
+    private String pluginClass = DEFAULT_DISTRIBUTOR_PLUGIN_CLASS;
+
+    /**
+     * Constructor to create a distributor parameters instance and register the instance with the parameter service.
+     */
+    public DistributorParameters() {
+        super(DistributorParameters.class.getCanonicalName());
+        ParameterService.registerParameters(DistributorParameters.class, this);
+    }
+
+    /**
+     * Constructor to create a distributor parameters instance with the name of a sub class of this class and register
+     * the instance with the parameter service.
+     *
+     * @param parameterClassName the class name of a sub class of this class
+     */
+    public DistributorParameters(final String parameterClassName) {
+        super(parameterClassName);
+    }
+
+    /**
+     * 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;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.model.basicmodel.service.AbstractParameters#toString()
+     */
+    @Override
+    public String toString() {
+        return "DistributorParameters [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
new file mode 100644
index 0000000..93e4223
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/LockManagerParameters.java
@@ -0,0 +1,85 @@
+/*-
+ * ============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.parameters;
+
+import org.onap.policy.apex.model.basicmodel.service.AbstractParameters;
+import org.onap.policy.apex.model.basicmodel.service.ParameterService;
+
+/**
+ * An empty lock manager parameter class that may be specialized by context lock manager plugins that require plugin
+ * specific parameters. The class defines the default lock manager plugin as the JVM local lock manager.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class LockManagerParameters extends AbstractParameters {
+    /** 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 =
+            "org.onap.policy.apex.context.impl.locking.jvmlocal.JVMLocalLockManager";
+
+    // Plugin class names
+    private String pluginClass = DEFAULT_LOCK_MANAGER_PLUGIN_CLASS;
+
+    /**
+     * Constructor to create a lock manager parameters instance and register the instance with the parameter service.
+     */
+    public LockManagerParameters() {
+        super(LockManagerParameters.class.getCanonicalName());
+        ParameterService.registerParameters(LockManagerParameters.class, this);
+    }
+
+    /**
+     * Constructor to create a lock manager parameters instance with the name of a sub class of this class and register
+     * the instance with the parameter service.
+     *
+     * @param parameterClassName the class name of a sub class of this class
+     */
+    public LockManagerParameters(final String parameterClassName) {
+        super(parameterClassName);
+    }
+
+    /**
+     * 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;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.model.basicmodel.service.AbstractParameters#toString()
+     */
+    @Override
+    public String toString() {
+        return "LockManagerParameters [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
new file mode 100644
index 0000000..c9b0d85
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/PersistorParameters.java
@@ -0,0 +1,120 @@
+/*-
+ * ============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.parameters;
+
+import org.onap.policy.apex.model.basicmodel.service.AbstractParameters;
+import org.onap.policy.apex.model.basicmodel.service.ParameterService;
+
+/**
+ * A persistor parameter class that may be specialized by context persistor plugins that require plugin specific
+ * parameters.
+ * <p>
+ * The following parameters are defined:
+ * <ol>
+ * <li>pluginClass: the persistor plugin as the JVM local dummy ephemeral persistor
+ * <li>flushPeriod: Context is flushed to any persistor plugin that is defined periodically, and the period for flushing
+ * is the flush period.
+ * </ol>
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class PersistorParameters extends AbstractParameters {
+    /** The default persistor is a dummy persistor that stubs the Persistor interface. */
+    public static final String DEFAULT_PERSISTOR_PLUGIN_CLASS =
+            "org.onap.policy.apex.context.impl.persistence.ephemeral.EphemeralPersistor";
+
+    /** Default periodic flushing interval, 5 minutes in milliseconds. */
+    public static final long DEFAULT_FLUSH_PERIOD = 300000;
+
+    // Plugin class names
+    private String pluginClass = DEFAULT_PERSISTOR_PLUGIN_CLASS;
+
+    // Parameters for flushing
+    private long flushPeriod = DEFAULT_FLUSH_PERIOD;
+
+    /**
+     * Constructor to create a persistor parameters instance and register the instance with the parameter service.
+     */
+    public PersistorParameters() {
+        super(PersistorParameters.class.getCanonicalName());
+        ParameterService.registerParameters(PersistorParameters.class, this);
+    }
+
+    /**
+     * Constructor to create a persistor parameters instance with the name of a sub class of this class and register the
+     * instance with the parameter service.
+     *
+     * @param parameterClassName the class name of a sub class of this class
+     */
+    public PersistorParameters(final String parameterClassName) {
+        super(parameterClassName);
+    }
+
+    /**
+     * 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
+     */
+    public void setFlushPeriod(final long flushPeriod) {
+        if (flushPeriod <= 0) {
+            this.flushPeriod = DEFAULT_FLUSH_PERIOD;
+        } else {
+            this.flushPeriod = flushPeriod;
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.model.basicmodel.service.AbstractParameters#toString()
+     */
+    @Override
+    public String toString() {
+        return "PersistorParameters [pluginClass=" + pluginClass + ", flushPeriod=" + flushPeriod + "]";
+    }
+}
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
new file mode 100644
index 0000000..9ccd431
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/SchemaHelperParameters.java
@@ -0,0 +1,81 @@
+/*-
+ * ============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.parameters;
+
+import org.onap.policy.apex.model.basicmodel.service.AbstractParameters;
+import org.onap.policy.apex.model.basicmodel.service.ParameterService;
+
+/**
+ * An empty schema helper parameter class that may be specialized by context schema helper plugins that require plugin
+ * specific parameters.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class SchemaHelperParameters extends AbstractParameters {
+    // Schema helper plugin class for the schema
+    private String schemaHelperPluginClass;
+
+    /**
+     * Constructor to create a schema helper parameters instance and register the instance with the parameter service.
+     */
+    public SchemaHelperParameters() {
+        super(SchemaHelperParameters.class.getCanonicalName());
+        ParameterService.registerParameters(SchemaHelperParameters.class, this);
+    }
+
+    /**
+     * Constructor to create a schema helper parameters instance with the name of a sub class of this class and register
+     * the instance with the parameter service.
+     *
+     * @param parameterClassName the class name of a sub class of this class
+     */
+    public SchemaHelperParameters(final String parameterClassName) {
+        super(parameterClassName);
+    }
+
+    /**
+     * 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;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.model.basicmodel.service.AbstractParameters#toString()
+     */
+    @Override
+    public String toString() {
+        return "SchemaHelperParameters [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
new file mode 100644
index 0000000..858a6a3
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/SchemaParameters.java
@@ -0,0 +1,87 @@
+/*-
+ * ============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.parameters;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters;
+import org.onap.policy.apex.model.basicmodel.service.AbstractParameters;
+import org.onap.policy.apex.model.basicmodel.service.ParameterService;
+
+/**
+ * Bean class holding schema parameters for schemas and their helpers. As more than one schema can be used in Apex
+ * simultaneously, this class is used to hold the schemas that are defined in a given Apex system and to get the schema
+ * helper plugin parameters {@link SchemaHelperParameters} for each schema.
+ * <p>
+ * The default {@code Java} schema is always defined and its parameters are held in a {@link JavaSchemaHelperParameters}
+ * instance.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class SchemaParameters extends AbstractParameters {
+    /** The Java schema flavour is always available for use. */
+    public static final String DEFAULT_SCHEMA_FLAVOUR = "Java";
+
+    // A map of parameters for executors of various logic types
+    private Map<String, SchemaHelperParameters> schemaHelperParameterMap;
+
+    /**
+     * Constructor to create a distributor parameters instance and register the instance with the parameter service.
+     */
+    public SchemaParameters() {
+        super(SchemaParameters.class.getCanonicalName());
+        ParameterService.registerParameters(SchemaParameters.class, this);
+
+        schemaHelperParameterMap = new TreeMap<>();
+
+        // The default schema helper
+        schemaHelperParameterMap.put(DEFAULT_SCHEMA_FLAVOUR, new JavaSchemaHelperParameters());
+    }
+
+    /**
+     * 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
+     * @return the schema helper parameters for the given schema flavour
+     */
+    public SchemaHelperParameters getSchemaHelperParameters(final String schemaFlavour) {
+        return schemaHelperParameterMap.get(schemaFlavour);
+    }
+}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/package-info.java b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/package-info.java
new file mode 100644
index 0000000..52a4270
--- /dev/null
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/package-info.java
@@ -0,0 +1,28 @@
+/*-
+ * ============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=========================================================
+ */
+
+/**
+ * Holds the definitions of generic parameters for schema helpers, distributors, lock managers, and persistors in APEX.
+ * All the parameter definitions can be specialized to provide parameters to APEX plugins.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+
+package org.onap.policy.apex.context.parameters;
diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/TestInstanceCreation.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/TestInstanceCreation.java
new file mode 100644
index 0000000..9c2c685
--- /dev/null
+++ b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/TestInstanceCreation.java
@@ -0,0 +1,96 @@
+/*-
+ * ============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.schema.java;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.junit.Before;
+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.SchemaParameters;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.basicmodel.service.ModelService;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
+
+/**
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ * @version
+ */
+public class TestInstanceCreation {
+    private final AxKey testKey = new AxArtifactKey("AvroTest", "0.0.1");
+    private AxContextSchemas schemas;
+
+    @Before
+    public void initTest() {
+        schemas = new AxContextSchemas(new AxArtifactKey("AvroSchemas", "0.0.1"));
+        ModelService.registerModel(AxContextSchemas.class, schemas);
+        new SchemaParameters();
+    }
+
+    @Test
+    public void testNullEncoding() {
+        final AxContextSchema javaBooleanSchema =
+                new AxContextSchema(new AxArtifactKey("Boolean", "0.0.1"), "Java", "java.lang.Boolean");
+        final AxContextSchema javaLongSchema =
+                new AxContextSchema(new AxArtifactKey("Long", "0.0.1"), "Java", "java.lang.Long");
+        final AxContextSchema javaStringSchema =
+                new AxContextSchema(new AxArtifactKey("String", "0.0.1"), "Java", "java.lang.String");
+
+        schemas.getSchemasMap().put(javaBooleanSchema.getKey(), javaBooleanSchema);
+        schemas.getSchemasMap().put(javaLongSchema.getKey(), javaLongSchema);
+        schemas.getSchemasMap().put(javaStringSchema.getKey(), javaStringSchema);
+
+        final SchemaHelper schemaHelper0 =
+                new SchemaHelperFactory().createSchemaHelper(testKey, javaBooleanSchema.getKey());
+        final SchemaHelper schemaHelper1 =
+                new SchemaHelperFactory().createSchemaHelper(testKey, javaLongSchema.getKey());
+        final SchemaHelper schemaHelper2 =
+                new SchemaHelperFactory().createSchemaHelper(testKey, javaStringSchema.getKey());
+
+        try {
+            schemaHelper0.createNewInstance();
+            fail("this test should throw an exception here");
+        } catch (final Exception e) {
+            assertEquals(
+                    "AvroTest:0.0.1: could not create an instance of class \"java.lang.Boolean\" using the default constructor \"Boolean()\"",
+                    e.getMessage());
+        }
+        assertEquals(true, schemaHelper0.createNewInstance("true"));
+
+
+        try {
+            schemaHelper1.createNewInstance();
+            fail("this test should throw an exception here");
+        } catch (final Exception e) {
+            assertEquals(
+                    "AvroTest:0.0.1: could not create an instance of class \"java.lang.Long\" using the default constructor \"Long()\"",
+                    e.getMessage());
+        }
+        assertEquals(65536L, schemaHelper1.createNewInstance("65536"));
+
+        assertEquals("", schemaHelper2.createNewInstance());
+        assertEquals("true", schemaHelper2.createNewInstance("true"));
+    }
+}
diff --git a/context/context-management/src/test/resources/logback-test.xml b/context/context-management/src/test/resources/logback-test.xml
new file mode 100644
index 0000000..51398da
--- /dev/null
+++ b/context/context-management/src/test/resources/logback-test.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ============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=========================================================
+-->
+
+<configuration>
+
+    <contextName>Apex</contextName>
+    <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
+    <property name="LOG_DIR" value="${java.io.tmpdir}/apex_logging/" />
+
+	<!-- USE FOR STD OUT ONLY -->
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern>
+        </encoder>
+    </appender>
+
+    <root level="ERROR">
+        <appender-ref ref="STDOUT" />
+    </root>
+
+    <logger name="org.infinispan" level="ERROR" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="org.apache.zookeeper.ClientCnxn" level="OFF" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+        <file>${LOG_DIR}/apex.log</file>
+        <encoder>
+            <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level
+                %logger{26} - %msg %n %ex{full}</pattern>
+        </encoder>
+    </appender>
+
+    <appender name="CTXT_FILE" class="ch.qos.logback.core.FileAppender">
+        <file>${LOG_DIR}/apex_ctxt.log</file>
+        <encoder>
+            <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level
+                %logger{26} - %msg %n %ex{full}</pattern>
+        </encoder>
+    </appender>
+
+    <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="ERROR" additivity="false">
+        <appender-ref ref="CTXT_FILE" />
+    </logger>
+
+    <logger name="org.onap.policy.apex.core.context" level="TRACE" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+</configuration>
diff --git a/context/context-test/pom.xml b/context/context-test/pom.xml
new file mode 100644
index 0000000..ded707a
--- /dev/null
+++ b/context/context-test/pom.xml
@@ -0,0 +1,55 @@
+<!--
+  ============LICENSE_START=======================================================
+   Copyright (C) 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=========================================================
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.onap.policy.apex-pdp.context</groupId>
+        <artifactId>context</artifactId>
+        <version>2.0.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>context-test</artifactId>
+    <name>${project.artifactId}</name>
+    <description>[${project.parent.artifactId}] module to hold test context date for testing</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onap.policy.apex-pdp.model</groupId>
+            <artifactId>context-model</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onap.policy.apex-pdp.context</groupId>
+            <artifactId>context-management</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derby</artifactId>
+            <version>${version.derby}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem000.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem000.java
new file mode 100644
index 0000000..49e5278
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem000.java
@@ -0,0 +1,114 @@
+/*-
+ * ============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.test.concepts;
+
+import java.io.Serializable;
+
+/**
+ * The Class TestContextItem000.
+ */
+public class TestContextItem000 implements Serializable {
+    private static final int HASH_PRIME_1 = 31;
+    private static final int HASH_PRIME_2 = 1231;
+    private static final int HASH_PRIME_3 = 1237;
+
+    private static final long serialVersionUID = 7241008665286367796L;
+
+    private boolean flag = false;;
+
+    /**
+     * The Constructor.
+     */
+    public TestContextItem000() {}
+
+    /**
+     * The Constructor.
+     *
+     * @param flag the flag
+     */
+    public TestContextItem000(final Boolean flag) {
+        this.flag = flag;
+    }
+
+    /**
+     * Gets the flag.
+     *
+     * @return the flag
+     */
+    public boolean getFlag() {
+        return flag;
+    }
+
+    /**
+     * Sets the flag.
+     *
+     * @param flag the flag
+     */
+    public void setFlag(final boolean flag) {
+        this.flag = flag;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = HASH_PRIME_1;
+        int result = 1;
+        result = prime * result + (flag ? HASH_PRIME_2 : HASH_PRIME_3);
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final TestContextItem000 other = (TestContextItem000) obj;
+        if (flag != other.flag) {
+            return false;
+        }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "TestContextItem000 [flag=" + flag + "]";
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem001.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem001.java
new file mode 100644
index 0000000..5d41269
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem001.java
@@ -0,0 +1,112 @@
+/*-
+ * ============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.test.concepts;
+
+import java.io.Serializable;
+
+/**
+ * The Class TestContextItem001.
+ */
+public class TestContextItem001 implements Serializable {
+    private static final long serialVersionUID = 1361938145823720386L;
+
+    private static final int HASH_PRIME_1 = 31;
+
+    private byte byteValue = 0;
+
+    /**
+     * The Constructor.
+     */
+    public TestContextItem001() {}
+
+    /**
+     * The Constructor.
+     *
+     * @param byteValue the byte value
+     */
+    public TestContextItem001(final Byte byteValue) {
+        this.byteValue = byteValue;
+    }
+
+    /**
+     * Gets the byte value.
+     *
+     * @return the byte value
+     */
+    public byte getByteValue() {
+        return byteValue;
+    }
+
+    /**
+     * Sets the byte value.
+     *
+     * @param byteValue the byte value
+     */
+    public void setByteValue(final byte byteValue) {
+        this.byteValue = byteValue;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = HASH_PRIME_1;
+        int result = 1;
+        result = prime * result + byteValue;
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final TestContextItem001 other = (TestContextItem001) obj;
+        if (byteValue != other.byteValue) {
+            return false;
+        }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "TestContextItem001 [byteValue=" + byteValue + "]";
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem002.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem002.java
new file mode 100644
index 0000000..3b5242f
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem002.java
@@ -0,0 +1,121 @@
+/*-
+ * ============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.test.concepts;
+
+import java.io.Serializable;
+
+/**
+ * The Class TestContextItem002.
+ */
+public class TestContextItem002 implements Serializable {
+    private static final long serialVersionUID = -8978435658277900984L;
+
+    private static final int HASH_PRIME_1 = 31;
+
+    private int intValue = 0;
+
+    /**
+     * The Constructor.
+     */
+    public TestContextItem002() {}
+
+    /**
+     * The Constructor.
+     *
+     * @param intValue the int value
+     */
+    public TestContextItem002(final Integer intValue) {
+        this.intValue = intValue;
+    }
+
+    /**
+     * The Constructor.
+     *
+     * @param original the original
+     */
+    public TestContextItem002(final TestContextItem002 original) {
+        this.intValue = original.intValue;
+    }
+
+    /**
+     * Gets the int value.
+     *
+     * @return the int value
+     */
+    public int getIntValue() {
+        return intValue;
+    }
+
+    /**
+     * Sets the int value.
+     *
+     * @param intValue the int value
+     */
+    public void setIntValue(final int intValue) {
+        this.intValue = intValue;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = HASH_PRIME_1;
+        int result = 1;
+        result = prime * result + intValue;
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final TestContextItem002 other = (TestContextItem002) obj;
+        if (intValue != other.intValue) {
+            return false;
+        }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "TestContextItem002 [intValue=" + intValue + "]";
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem003.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem003.java
new file mode 100644
index 0000000..e7532ec
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem003.java
@@ -0,0 +1,113 @@
+/*-
+ * ============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.test.concepts;
+
+import java.io.Serializable;
+
+/**
+ * The Class TestContextItem003.
+ */
+public class TestContextItem003 implements Serializable {
+    private static final long serialVersionUID = 3599267534512489386L;
+
+    private static final int HASH_PRIME_1 = 31;
+    private static final int FOUR_BYTES = 33;
+
+    private long longValue = 0;
+
+    /**
+     * The Constructor.
+     */
+    public TestContextItem003() {}
+
+    /**
+     * The Constructor.
+     *
+     * @param longValue the long value
+     */
+    public TestContextItem003(final Long longValue) {
+        this.longValue = longValue;
+    }
+
+    /**
+     * Gets the long value.
+     *
+     * @return the long value
+     */
+    public long getLongValue() {
+        return longValue;
+    }
+
+    /**
+     * Sets the long value.
+     *
+     * @param longValue the long value
+     */
+    public void setLongValue(final long longValue) {
+        this.longValue = longValue;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = HASH_PRIME_1;
+        int result = 1;
+        result = prime * result + (int) (longValue ^ (longValue >>> FOUR_BYTES));
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final TestContextItem003 other = (TestContextItem003) obj;
+        if (longValue != other.longValue) {
+            return false;
+        }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "TestContextItem003 [longValue=" + longValue + "]";
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem004.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem004.java
new file mode 100644
index 0000000..1370db1
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem004.java
@@ -0,0 +1,112 @@
+/*-
+ * ============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.test.concepts;
+
+import java.io.Serializable;
+
+/**
+ * The Class TestContextItem004.
+ */
+public class TestContextItem004 implements Serializable {
+    private static final long serialVersionUID = -3359180576903272400L;
+
+    private static final int HASH_PRIME_1 = 31;
+
+    private float floatValue = 0;
+
+    /**
+     * The Constructor.
+     */
+    public TestContextItem004() {}
+
+    /**
+     * The Constructor.
+     *
+     * @param floatValue the float value
+     */
+    public TestContextItem004(final Float floatValue) {
+        this.floatValue = floatValue;
+    }
+
+    /**
+     * Gets the float value.
+     *
+     * @return the float value
+     */
+    public float getFloatValue() {
+        return floatValue;
+    }
+
+    /**
+     * Sets the float value.
+     *
+     * @param floatValue the float value
+     */
+    public void setFloatValue(final float floatValue) {
+        this.floatValue = floatValue;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = HASH_PRIME_1;
+        int result = 1;
+        result = prime * result + Float.floatToIntBits(floatValue);
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final TestContextItem004 other = (TestContextItem004) obj;
+        if (Float.floatToIntBits(floatValue) != Float.floatToIntBits(other.floatValue)) {
+            return false;
+        }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "TestContextItem004 [floatValue=" + floatValue + "]";
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem005.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem005.java
new file mode 100644
index 0000000..d8a3352
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem005.java
@@ -0,0 +1,115 @@
+/*-
+ * ============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.test.concepts;
+
+import java.io.Serializable;
+
+/**
+ * The Class TestContextItem005.
+ */
+public class TestContextItem005 implements Serializable {
+    private static final long serialVersionUID = -2958758261076734821L;
+
+    private static final int HASH_PRIME_1 = 31;
+    private static final int FOUR_BYTES = 32;
+
+    private double doubleValue = 0;
+
+    /**
+     * The Constructor.
+     */
+    public TestContextItem005() {}
+
+    /**
+     * The Constructor.
+     *
+     * @param doubleValue the double value
+     */
+    public TestContextItem005(final Double doubleValue) {
+        this.doubleValue = doubleValue;
+    }
+
+    /**
+     * Gets the double value.
+     *
+     * @return the double value
+     */
+    public double getDoubleValue() {
+        return doubleValue;
+    }
+
+    /**
+     * Sets the double value.
+     *
+     * @param doubleValue the double value
+     */
+    public void setDoubleValue(final double doubleValue) {
+        this.doubleValue = doubleValue;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = HASH_PRIME_1;
+        int result = 1;
+        long temp;
+        temp = Double.doubleToLongBits(doubleValue);
+        result = prime * result + (int) (temp ^ (temp >>> FOUR_BYTES));
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final TestContextItem005 other = (TestContextItem005) obj;
+        if (Double.doubleToLongBits(doubleValue) != Double.doubleToLongBits(other.doubleValue)) {
+            return false;
+        }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "TestContextItem005 [doubleValue=" + doubleValue + "]";
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem006.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem006.java
new file mode 100644
index 0000000..5fd2f9d
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem006.java
@@ -0,0 +1,116 @@
+/*-
+ * ============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.test.concepts;
+
+import java.io.Serializable;
+
+/**
+ * The Class TestContextItem006.
+ */
+public class TestContextItem006 implements Serializable {
+    private static final long serialVersionUID = -1074772190611125121L;
+
+    private static final int HASH_PRIME_1 = 31;
+
+    private String stringValue = "";
+
+    /**
+     * The Constructor.
+     */
+    public TestContextItem006() {}
+
+    /**
+     * The Constructor.
+     *
+     * @param stringValue the string value
+     */
+    public TestContextItem006(final String stringValue) {
+        this.stringValue = stringValue;
+    }
+
+    /**
+     * Gets the string value.
+     *
+     * @return the string value
+     */
+    public String getStringValue() {
+        return stringValue;
+    }
+
+    /**
+     * Sets the string value.
+     *
+     * @param stringValue the string value
+     */
+    public void setStringValue(final String stringValue) {
+        this.stringValue = stringValue;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = HASH_PRIME_1;
+        int result = 1;
+        result = prime * result + ((stringValue == null) ? 0 : stringValue.hashCode());
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final TestContextItem006 other = (TestContextItem006) obj;
+        if (stringValue == null) {
+            if (other.stringValue != null) {
+                return false;
+            }
+        } else if (!stringValue.equals(other.stringValue)) {
+            return false;
+        }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "TestContextItem006 [stringValue=" + stringValue + "]";
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem007.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem007.java
new file mode 100644
index 0000000..21c6f8c
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem007.java
@@ -0,0 +1,116 @@
+/*-
+ * ============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.test.concepts;
+
+import java.io.Serializable;
+
+/**
+ * The Class TestContextItem007.
+ */
+public class TestContextItem007 implements Serializable {
+    private static final long serialVersionUID = -1029406737866392421L;
+
+    private static final int HASH_PRIME_1 = 31;
+
+    private Long longValue = new Long(0);
+
+    /**
+     * The Constructor.
+     */
+    public TestContextItem007() {}
+
+    /**
+     * The Constructor.
+     *
+     * @param longValue the long value
+     */
+    public TestContextItem007(final Long longValue) {
+        this.longValue = longValue;
+    }
+
+    /**
+     * Gets the long value.
+     *
+     * @return the long value
+     */
+    public Long getLongValue() {
+        return longValue;
+    }
+
+    /**
+     * Sets the long value.
+     *
+     * @param longValue the long value
+     */
+    public void setLongValue(final Long longValue) {
+        this.longValue = longValue;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = HASH_PRIME_1;
+        int result = 1;
+        result = prime * result + ((longValue == null) ? 0 : longValue.hashCode());
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final TestContextItem007 other = (TestContextItem007) obj;
+        if (longValue == null) {
+            if (other.longValue != null) {
+                return false;
+            }
+        } else if (!longValue.equals(other.longValue)) {
+            return false;
+        }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "TestContextItem007 [longValue=" + longValue + "]";
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem008.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem008.java
new file mode 100644
index 0000000..82a02a8
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem008.java
@@ -0,0 +1,258 @@
+/*-
+ * ============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.test.concepts;
+
+import java.io.Serializable;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+/**
+ * The Class TestContextItem008.
+ */
+public class TestContextItem008 implements Serializable {
+    private static final long serialVersionUID = -6984963129968805460L;
+
+    private static final int HASH_PRIME_1 = 31;
+    private static final int FOUR_BYTES = 32;
+
+    private long time;
+
+    private int year;
+    private int month;
+    private int day;
+    private int hour;
+    private int minute;
+    private int second;
+    private int milliSecond;
+
+    /**
+     * The Constructor.
+     */
+    public TestContextItem008() {
+        this(new Date(System.currentTimeMillis()));
+    }
+
+    /**
+     * The Constructor.
+     *
+     * @param dateValue the date value
+     */
+    public TestContextItem008(final Date dateValue) {
+        setDateValue(dateValue.getTime());
+    }
+
+    /**
+     * The Constructor.
+     *
+     * @param time the time
+     */
+    public TestContextItem008(final long time) {
+        setDateValue(time);
+    }
+
+    /**
+     * Gets the time.
+     *
+     * @return the time
+     */
+    public long getTime() {
+        return time;
+    }
+
+    /**
+     * Gets the year.
+     *
+     * @return the year
+     */
+    public int getYear() {
+        return year;
+    }
+
+    /**
+     * Gets the month.
+     *
+     * @return the month
+     */
+    public int getMonth() {
+        return month;
+    }
+
+    /**
+     * Gets the day.
+     *
+     * @return the day
+     */
+    public int getDay() {
+        return day;
+    }
+
+    /**
+     * Gets the hour.
+     *
+     * @return the hour
+     */
+    public int getHour() {
+        return hour;
+    }
+
+    /**
+     * Gets the minute.
+     *
+     * @return the minute
+     */
+    public int getMinute() {
+        return minute;
+    }
+
+    /**
+     * Gets the second.
+     *
+     * @return the second
+     */
+    public int getSecond() {
+        return second;
+    }
+
+    /**
+     * Gets the milli second.
+     *
+     * @return the milli second
+     */
+    public int getMilliSecond() {
+        return milliSecond;
+    }
+
+    /**
+     * Gets the date value.
+     *
+     * @return the date value
+     */
+    public Date getDateValue() {
+        return new Date(time);
+    }
+
+    /**
+     * Sets the date value.
+     *
+     * @param dateValue the date value
+     */
+    public void setDateValue(final Date dateValue) {
+        setDateValue(dateValue.getTime());
+    }
+
+    /**
+     * Sets the date value.
+     *
+     * @param dateValue the date value
+     */
+    public void setDateValue(final long dateValue) {
+        this.time = dateValue;
+
+        final Calendar calendar = Calendar.getInstance();
+        calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
+        calendar.setTimeInMillis(time);
+
+        year = calendar.get(Calendar.YEAR);
+        month = calendar.get(Calendar.MONTH);
+        day = calendar.get(Calendar.DAY_OF_MONTH);
+        hour = calendar.get(Calendar.HOUR);
+        minute = calendar.get(Calendar.MINUTE);
+        second = calendar.get(Calendar.SECOND);
+        milliSecond = calendar.get(Calendar.MILLISECOND);
+    }
+
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = HASH_PRIME_1;
+        int result = 1;
+        result = prime * result + day;
+        result = prime * result + hour;
+        result = prime * result + milliSecond;
+        result = prime * result + minute;
+        result = prime * result + month;
+        result = prime * result + second;
+        result = prime * result + (int) (time ^ (time >>> FOUR_BYTES));
+        result = prime * result + year;
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final TestContextItem008 other = (TestContextItem008) obj;
+        if (day != other.day) {
+            return false;
+        }
+        if (hour != other.hour) {
+            return false;
+        }
+        if (milliSecond != other.milliSecond) {
+            return false;
+        }
+        if (minute != other.minute) {
+            return false;
+        }
+        if (month != other.month) {
+            return false;
+        }
+        if (second != other.second) {
+            return false;
+        }
+        if (time != other.time) {
+            return false;
+        }
+        if (year != other.year) {
+            return false;
+        }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "TestContextItem008 [time=" + time + ", year=" + year + ", month=" + month + ", day=" + day + ", hour="
+                + hour + ", minute=" + minute + ", second=" + second + ", milliSecond=" + milliSecond + "]";
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem009.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem009.java
new file mode 100644
index 0000000..f3e8953
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem009.java
@@ -0,0 +1,186 @@
+/*-
+ * ============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.test.concepts;
+
+import java.io.Serializable;
+import java.util.TimeZone;
+
+/**
+ * The Class TestContextItem009.
+ */
+public class TestContextItem009 implements Serializable {
+    private static final long serialVersionUID = 5604426823170331706L;
+
+    private static final int HASH_PRIME_1 = 31;
+    private static final int HASH_PRIME_2 = 1231;
+    private static final int HASH_PRIME_3 = 1237;
+
+    private TestContextItem008 dateValue = new TestContextItem008(System.currentTimeMillis());
+    private String timeZoneString = TimeZone.getTimeZone("Europe/Dublin").getDisplayName();
+    private boolean dst = false;
+
+    /**
+     * The Constructor.
+     */
+    public TestContextItem009() {
+        dst = true;
+    }
+
+    /**
+     * The Constructor.
+     *
+     * @param dateValue the date value
+     * @param tzValue the tz value
+     * @param dst the dst
+     */
+    public TestContextItem009(final TestContextItem008 dateValue, final String tzValue, final boolean dst) {
+        this.dateValue = dateValue;
+        this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName();
+        this.dst = dst;
+    }
+
+    /**
+     * The Constructor.
+     *
+     * @param original the original
+     */
+    public TestContextItem009(final TestContextItem009 original) {
+        this.dateValue = original.dateValue;
+        this.timeZoneString = original.timeZoneString;
+        this.dst = original.dst;
+    }
+
+    /**
+     * Gets the date value.
+     *
+     * @return the date value
+     */
+    public TestContextItem008 getDateValue() {
+        return dateValue;
+    }
+
+    /**
+     * Sets the date value.
+     *
+     * @param dateValue the date value
+     */
+    public void setDateValue(final TestContextItem008 dateValue) {
+        this.dateValue = dateValue;
+    }
+
+    /**
+     * Gets the TZ value.
+     *
+     * @return the TZ value
+     */
+    public String getTZValue() {
+        return timeZoneString;
+    }
+
+    /**
+     * Sets the TZ value.
+     *
+     * @param tzValue the TZ value
+     */
+    public void setTZValue(final String tzValue) {
+        this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName();
+    }
+
+    /**
+     * Gets the DST.
+     *
+     * @return the dst
+     */
+    public boolean getDST() {
+        return dst;
+    }
+
+    /**
+     * Sets the DST.
+     *
+     * @param newDst the dst
+     */
+    public void setDST(final boolean newDst) {
+        this.dst = newDst;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = HASH_PRIME_1;
+        int result = 1;
+        result = prime * result + ((dateValue == null) ? 0 : dateValue.hashCode());
+        result = prime * result + (dst ? HASH_PRIME_2 : HASH_PRIME_3);
+        result = prime * result + ((timeZoneString == null) ? 0 : timeZoneString.hashCode());
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final TestContextItem009 other = (TestContextItem009) obj;
+        if (dateValue == null) {
+            if (other.dateValue != null) {
+                return false;
+            }
+        } else if (!dateValue.equals(other.dateValue)) {
+            return false;
+        }
+        if (dst != other.dst) {
+            return false;
+        }
+        if (timeZoneString == null) {
+            if (other.timeZoneString != null) {
+                return false;
+            }
+        } else if (!timeZoneString.equals(other.timeZoneString)) {
+            return false;
+        }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "TestContextItem009 [dateValue=" + dateValue + ", tzValue=" + timeZoneString + ", dst=" + dst + "]";
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem00A.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem00A.java
new file mode 100644
index 0000000..db380cc
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem00A.java
@@ -0,0 +1,261 @@
+/*-
+ * ============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.test.concepts;
+
+import java.io.Serializable;
+import java.util.Locale;
+import java.util.TimeZone;
+
+/**
+ * The Class TestContextItem00A.
+ */
+public class TestContextItem00A implements Serializable {
+    private static final long serialVersionUID = -6579903685538233754L;
+
+    private static final int HASH_PRIME_1 = 31;
+    private static final int HASH_PRIME_2 = 1231;
+    private static final int HASH_PRIME_3 = 1237;
+
+    private TestContextItem008 dateValue = new TestContextItem008(System.currentTimeMillis());
+    private String timeZoneString = TimeZone.getTimeZone("Europe/Dublin").getDisplayName();
+    private boolean dst = false;
+    private int utcOffset = 0;
+    private String localeLanguage = Locale.ENGLISH.getLanguage();
+    private String localeCountry = Locale.ENGLISH.getCountry();
+
+    /**
+     * The Constructor.
+     */
+    public TestContextItem00A() {}
+
+    /**
+     * The Constructor.
+     *
+     * @param dateValue the date value
+     * @param tzValue the tz value
+     * @param dst the dst
+     * @param utcOffset the utc offset
+     * @param language the language
+     * @param country the country
+     */
+    public TestContextItem00A(final TestContextItem008 dateValue, final String tzValue, final boolean dst,
+            final int utcOffset, final String language, final String country) {
+        this.dateValue = dateValue;
+        this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName();
+        this.dst = dst;
+        this.utcOffset = utcOffset;
+
+        final Locale locale = new Locale(language, country);
+        this.localeLanguage = locale.getLanguage();
+        this.localeCountry = locale.getCountry();
+    }
+
+    /**
+     * The Constructor.
+     *
+     * @param original the original
+     */
+    public TestContextItem00A(final TestContextItem00A original) {
+        this.dateValue = original.dateValue;
+        this.timeZoneString = TimeZone.getTimeZone(original.timeZoneString).getDisplayName();
+        this.dst = original.dst;
+        this.utcOffset = original.utcOffset;
+
+        final Locale locale = new Locale(original.localeLanguage, original.localeCountry);
+        this.localeLanguage = locale.getLanguage();
+        this.localeCountry = locale.getCountry();
+    }
+
+    /**
+     * Gets the date value.
+     *
+     * @return the date value
+     */
+    public TestContextItem008 getDateValue() {
+        return dateValue;
+    }
+
+    /**
+     * Sets the date value.
+     *
+     * @param dateValue the date value
+     */
+    public void setDateValue(final TestContextItem008 dateValue) {
+        this.dateValue = dateValue;
+    }
+
+    /**
+     * Gets the TZ value.
+     *
+     * @return the TZ value
+     */
+    public String getTZValue() {
+        return timeZoneString;
+    }
+
+    /**
+     * Sets the TZ value.
+     *
+     * @param tzValue the TZ value
+     */
+    public void setTZValue(final String tzValue) {
+        this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName();
+    }
+
+    /**
+     * Gets the DST.
+     *
+     * @return the dst
+     */
+    public boolean getDST() {
+        return dst;
+    }
+
+    /**
+     * Sets the DST.
+     *
+     * @param newDst the dst
+     */
+    public void setDST(final boolean newDst) {
+        this.dst = newDst;
+    }
+
+    /**
+     * Gets the UTC offset.
+     *
+     * @return the UTC offset
+     */
+    public int getUTCOffset() {
+        return utcOffset;
+    }
+
+    /**
+     * Sets the UTC offset.
+     *
+     * @param newUtcOffset the UTC offset
+     */
+    public void setUTCOffset(final int newUtcOffset) {
+        this.utcOffset = newUtcOffset;
+    }
+
+    /**
+     * Gets the locale.
+     *
+     * @return the locale
+     */
+    public Locale getLocale() {
+        return new Locale(localeLanguage, localeCountry);
+    }
+
+    /**
+     * Sets the locale.
+     *
+     * @param locale the locale
+     */
+    public void setLocale(final Locale locale) {
+        this.localeLanguage = locale.getLanguage();
+        this.localeCountry = locale.getCountry();
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = HASH_PRIME_1;
+        int result = 1;
+        result = prime * result + ((dateValue == null) ? 0 : dateValue.hashCode());
+        result = prime * result + (dst ? HASH_PRIME_2 : HASH_PRIME_3);
+        result = prime * result + ((localeCountry == null) ? 0 : localeCountry.hashCode());
+        result = prime * result + ((localeLanguage == null) ? 0 : localeLanguage.hashCode());
+        result = prime * result + ((timeZoneString == null) ? 0 : timeZoneString.hashCode());
+        result = prime * result + utcOffset;
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final TestContextItem00A other = (TestContextItem00A) obj;
+        if (dateValue == null) {
+            if (other.dateValue != null) {
+                return false;
+            }
+        } else if (!dateValue.equals(other.dateValue)) {
+            return false;
+        }
+        if (dst != other.dst) {
+            return false;
+        }
+        if (localeCountry == null) {
+            if (other.localeCountry != null) {
+                return false;
+            }
+        } else if (!localeCountry.equals(other.localeCountry)) {
+            return false;
+        }
+        if (localeLanguage == null) {
+            if (other.localeLanguage != null) {
+                return false;
+            }
+        } else if (!localeLanguage.equals(other.localeLanguage)) {
+            return false;
+        }
+        if (timeZoneString == null) {
+            if (other.timeZoneString != null) {
+                return false;
+            }
+        } else if (!timeZoneString.equals(other.timeZoneString)) {
+            return false;
+        }
+        if (utcOffset != other.utcOffset) {
+            return false;
+        }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "TestContextItem00A [dateValue=" + dateValue + ", timeZoneString=" + timeZoneString + ", dst=" + dst
+                + ", utcOffset=" + utcOffset + ", localeLanguage=" + localeLanguage + ", localeCountry=" + localeCountry
+                + "]";
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem00B.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem00B.java
new file mode 100644
index 0000000..4990b1b
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem00B.java
@@ -0,0 +1,128 @@
+/*-
+ * ============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.test.concepts;
+
+import java.io.Serializable;
+import java.util.Set;
+import java.util.TreeSet;
+
+/**
+ * The Class TestContextItem00B.
+ */
+public class TestContextItem00B implements Serializable {
+    private static final long serialVersionUID = 1254589722957250388L;
+
+    private static final int HASH_PRIME_1 = 31;
+
+    private TreeSet<String> setValue = new TreeSet<String>();
+
+    /**
+     * The Constructor.
+     */
+    public TestContextItem00B() {}
+
+    /**
+     * The Constructor.
+     *
+     * @param setArray the set array
+     */
+    public TestContextItem00B(final String[] setArray) {}
+
+    /**
+     * The Constructor.
+     *
+     * @param setValue the set value
+     */
+    public TestContextItem00B(final TreeSet<String> setValue) {
+        this.setValue = setValue;
+    }
+
+    /**
+     * Gets the set value.
+     *
+     * @return the sets the value
+     */
+    public Set<String> getSetValue() {
+        if (setValue == null) {
+            setValue = new TreeSet<String>();
+        }
+        return setValue;
+    }
+
+    /**
+     * Sets the set value.
+     *
+     * @param setValue the sets the value
+     */
+    public void setSetValue(final TreeSet<String> setValue) {
+        this.setValue = setValue;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = HASH_PRIME_1;
+        int result = 1;
+        result = prime * result + ((setValue == null) ? 0 : setValue.hashCode());
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final TestContextItem00B other = (TestContextItem00B) obj;
+        if (setValue == null) {
+            if (other.setValue != null) {
+                return false;
+            }
+        } else if (!setValue.equals(other.setValue)) {
+            return false;
+        }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "TestContextItem00B [setValue=" + setValue + "]";
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem00C.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem00C.java
new file mode 100644
index 0000000..6c91297
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextItem00C.java
@@ -0,0 +1,122 @@
+/*-
+ * ============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.test.concepts;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * The Class TestContextItem00C.
+ */
+public class TestContextItem00C implements Serializable {
+    private static final long serialVersionUID = -7497746259264651884L;
+
+    private static final int HASH_PRIME_1 = 31;
+
+    private Map<String, String> mapValue = new TreeMap<String, String>();
+
+    /**
+     * The Constructor.
+     */
+    public TestContextItem00C() {}
+
+    /**
+     * The Constructor.
+     *
+     * @param mapValue the map value
+     */
+    public TestContextItem00C(final Map<String, String> mapValue) {
+        this.mapValue = mapValue;
+    }
+
+    /**
+     * Gets the map value.
+     *
+     * @return the map value
+     */
+    public Map<String, String> getMapValue() {
+        if (mapValue == null) {
+            mapValue = new TreeMap<String, String>();
+        }
+        return mapValue;
+    }
+
+    /**
+     * Sets the map value.
+     *
+     * @param mapValue the map value
+     */
+    public void setMapValue(final Map<String, String> mapValue) {
+        this.mapValue = mapValue;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = HASH_PRIME_1;
+        int result = 1;
+        result = prime * result + ((mapValue == null) ? 0 : mapValue.hashCode());
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final TestContextItem00C other = (TestContextItem00C) obj;
+        if (mapValue == null) {
+            if (other.mapValue != null) {
+                return false;
+            }
+        } else if (!mapValue.equals(other.mapValue)) {
+            return false;
+        }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "TestContextItem00C [mapValue=" + mapValue + "]";
+    }
+
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestExternalContextItem.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestExternalContextItem.java
new file mode 100644
index 0000000..11a1af1
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestExternalContextItem.java
@@ -0,0 +1,434 @@
+/*-
+ * ============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.test.concepts;
+
+import java.io.Serializable;
+
+/**
+ * The Class TestExternalContextItem.
+ */
+public class TestExternalContextItem implements Serializable {
+    private static final long serialVersionUID = 3512435733818672173L;
+
+    private static final int HASH_PRIME_1 = 31;
+
+    private TestContextItem000 testExternalContextItem000;
+    private TestContextItem001 testExternalContextItem001;
+    private TestContextItem002 testExternalContextItem002;
+    private TestContextItem003 testExternalContextItem003;
+    private TestContextItem004 testExternalContextItem004;
+    private TestContextItem005 testExternalContextItem005;
+    private TestContextItem006 testExternalContextItem006;
+    private TestContextItem007 testExternalContextItem007;
+    private TestContextItem008 testExternalContextItem008;
+    private TestContextItem009 testExternalContextItem009;
+    private TestContextItem00A testExternalContextItem00A;
+    private TestContextItem00B testExternalContextItem00B;
+    private TestContextItem00C testExternalContextItem00C;
+
+    /**
+     * Gets the test external context item 000.
+     *
+     * @return the test external context item 000
+     */
+    public TestContextItem000 getTestExternalContextItem000() {
+        return testExternalContextItem000;
+    }
+
+    /**
+     * Sets the test external context item 000.
+     *
+     * @param testExternalContextItem000 the test external context item 000
+     */
+    public void setTestExternalContextItem000(final TestContextItem000 testExternalContextItem000) {
+        this.testExternalContextItem000 = testExternalContextItem000;
+    }
+
+    /**
+     * Gets the test external context item 001.
+     *
+     * @return the test external context item 001
+     */
+    public TestContextItem001 getTestExternalContextItem001() {
+        return testExternalContextItem001;
+    }
+
+    /**
+     * Sets the test external context item 001.
+     *
+     * @param testExternalContextItem001 the test external context item 001
+     */
+    public void setTestExternalContextItem001(final TestContextItem001 testExternalContextItem001) {
+        this.testExternalContextItem001 = testExternalContextItem001;
+    }
+
+    /**
+     * Gets the test external context item 002.
+     *
+     * @return the test external context item 002
+     */
+    public TestContextItem002 getTestExternalContextItem002() {
+        return testExternalContextItem002;
+    }
+
+    /**
+     * Sets the test external context item 002.
+     *
+     * @param testExternalContextItem002 the test external context item 002
+     */
+    public void setTestExternalContextItem002(final TestContextItem002 testExternalContextItem002) {
+        this.testExternalContextItem002 = testExternalContextItem002;
+    }
+
+    /**
+     * Gets the test external context item 003.
+     *
+     * @return the test external context item 003
+     */
+    public TestContextItem003 getTestExternalContextItem003() {
+        return testExternalContextItem003;
+    }
+
+    /**
+     * Sets the test external context item 003.
+     *
+     * @param testExternalContextItem003 the test external context item 003
+     */
+    public void setTestExternalContextItem003(final TestContextItem003 testExternalContextItem003) {
+        this.testExternalContextItem003 = testExternalContextItem003;
+    }
+
+    /**
+     * Gets the test external context item 004.
+     *
+     * @return the test external context item 004
+     */
+    public TestContextItem004 getTestExternalContextItem004() {
+        return testExternalContextItem004;
+    }
+
+    /**
+     * Sets the test external context item 004.
+     *
+     * @param testExternalContextItem004 the test external context item 004
+     */
+    public void setTestExternalContextItem004(final TestContextItem004 testExternalContextItem004) {
+        this.testExternalContextItem004 = testExternalContextItem004;
+    }
+
+    /**
+     * Gets the test external context item 005.
+     *
+     * @return the test external context item 005
+     */
+    public TestContextItem005 getTestExternalContextItem005() {
+        return testExternalContextItem005;
+    }
+
+    /**
+     * Sets the test external context item 005.
+     *
+     * @param testExternalContextItem005 the test external context item 005
+     */
+    public void setTestExternalContextItem005(final TestContextItem005 testExternalContextItem005) {
+        this.testExternalContextItem005 = testExternalContextItem005;
+    }
+
+    /**
+     * Gets the test external context item 006.
+     *
+     * @return the test external context item 006
+     */
+    public TestContextItem006 getTestExternalContextItem006() {
+        return testExternalContextItem006;
+    }
+
+    /**
+     * Sets the test external context item 006.
+     *
+     * @param testExternalContextItem006 the test external context item 006
+     */
+    public void setTestExternalContextItem006(final TestContextItem006 testExternalContextItem006) {
+        this.testExternalContextItem006 = testExternalContextItem006;
+    }
+
+    /**
+     * Gets the test external context item 007.
+     *
+     * @return the test external context item 007
+     */
+    public TestContextItem007 getTestExternalContextItem007() {
+        return testExternalContextItem007;
+    }
+
+    /**
+     * Sets the test external context item 007.
+     *
+     * @param testExternalContextItem007 the test external context item 007
+     */
+    public void setTestExternalContextItem007(final TestContextItem007 testExternalContextItem007) {
+        this.testExternalContextItem007 = testExternalContextItem007;
+    }
+
+    /**
+     * Gets the test external context item 008.
+     *
+     * @return the test external context item 008
+     */
+    public TestContextItem008 getTestExternalContextItem008() {
+        return testExternalContextItem008;
+    }
+
+    /**
+     * Sets the test external context item 008.
+     *
+     * @param testExternalContextItem008 the test external context item 008
+     */
+    public void setTestExternalContextItem008(final TestContextItem008 testExternalContextItem008) {
+        this.testExternalContextItem008 = testExternalContextItem008;
+    }
+
+    /**
+     * Gets the test external context item 009.
+     *
+     * @return the test external context item 009
+     */
+    public TestContextItem009 getTestExternalContextItem009() {
+        return testExternalContextItem009;
+    }
+
+    /**
+     * Sets the test external context item 009.
+     *
+     * @param testExternalContextItem009 the test external context item 009
+     */
+    public void setTestExternalContextItem009(final TestContextItem009 testExternalContextItem009) {
+        this.testExternalContextItem009 = testExternalContextItem009;
+    }
+
+    /**
+     * Gets the test external context item 00 A.
+     *
+     * @return the test external context item 00 A
+     */
+    public TestContextItem00A getTestExternalContextItem00A() {
+        return testExternalContextItem00A;
+    }
+
+    /**
+     * Sets the test external context item 00 A.
+     *
+     * @param testExternalContextItem00A the test external context item 00 A
+     */
+    public void setTestExternalContextItem00A(final TestContextItem00A testExternalContextItem00A) {
+        this.testExternalContextItem00A = testExternalContextItem00A;
+    }
+
+    /**
+     * Gets the test external context item 00 B.
+     *
+     * @return the test external context item 00 B
+     */
+    public TestContextItem00B getTestExternalContextItem00B() {
+        return testExternalContextItem00B;
+    }
+
+    /**
+     * Sets the test external context item 00 B.
+     *
+     * @param testExternalContextItem00B the test external context item 00 B
+     */
+    public void setTestExternalContextItem00B(final TestContextItem00B testExternalContextItem00B) {
+        this.testExternalContextItem00B = testExternalContextItem00B;
+    }
+
+    /**
+     * Gets the test external context item 00 C.
+     *
+     * @return the test external context item 00 C
+     */
+    public TestContextItem00C getTestExternalContextItem00C() {
+        return testExternalContextItem00C;
+    }
+
+    /**
+     * Sets the test external context item 00 C.
+     *
+     * @param testExternalContextItem00C the test external context item 00 C
+     */
+    public void setTestExternalContextItem00C(final TestContextItem00C testExternalContextItem00C) {
+        this.testExternalContextItem00C = testExternalContextItem00C;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = HASH_PRIME_1;
+        int result = 1;
+        result = prime * result + ((testExternalContextItem000 == null) ? 0 : testExternalContextItem000.hashCode());
+        result = prime * result + ((testExternalContextItem001 == null) ? 0 : testExternalContextItem001.hashCode());
+        result = prime * result + ((testExternalContextItem002 == null) ? 0 : testExternalContextItem002.hashCode());
+        result = prime * result + ((testExternalContextItem003 == null) ? 0 : testExternalContextItem003.hashCode());
+        result = prime * result + ((testExternalContextItem004 == null) ? 0 : testExternalContextItem004.hashCode());
+        result = prime * result + ((testExternalContextItem005 == null) ? 0 : testExternalContextItem005.hashCode());
+        result = prime * result + ((testExternalContextItem006 == null) ? 0 : testExternalContextItem006.hashCode());
+        result = prime * result + ((testExternalContextItem007 == null) ? 0 : testExternalContextItem007.hashCode());
+        result = prime * result + ((testExternalContextItem008 == null) ? 0 : testExternalContextItem008.hashCode());
+        result = prime * result + ((testExternalContextItem009 == null) ? 0 : testExternalContextItem009.hashCode());
+        result = prime * result + ((testExternalContextItem00A == null) ? 0 : testExternalContextItem00A.hashCode());
+        result = prime * result + ((testExternalContextItem00B == null) ? 0 : testExternalContextItem00B.hashCode());
+        result = prime * result + ((testExternalContextItem00C == null) ? 0 : testExternalContextItem00C.hashCode());
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final TestExternalContextItem other = (TestExternalContextItem) obj;
+        if (testExternalContextItem000 == null) {
+            if (other.testExternalContextItem000 != null) {
+                return false;
+            }
+        } else if (!testExternalContextItem000.equals(other.testExternalContextItem000)) {
+            return false;
+        }
+        if (testExternalContextItem001 == null) {
+            if (other.testExternalContextItem001 != null) {
+                return false;
+            }
+        } else if (!testExternalContextItem001.equals(other.testExternalContextItem001)) {
+            return false;
+        }
+        if (testExternalContextItem002 == null) {
+            if (other.testExternalContextItem002 != null) {
+                return false;
+            }
+        } else if (!testExternalContextItem002.equals(other.testExternalContextItem002)) {
+            return false;
+        }
+        if (testExternalContextItem003 == null) {
+            if (other.testExternalContextItem003 != null) {
+                return false;
+            }
+        } else if (!testExternalContextItem003.equals(other.testExternalContextItem003)) {
+            return false;
+        }
+        if (testExternalContextItem004 == null) {
+            if (other.testExternalContextItem004 != null) {
+                return false;
+            }
+        } else if (!testExternalContextItem004.equals(other.testExternalContextItem004)) {
+            return false;
+        }
+        if (testExternalContextItem005 == null) {
+            if (other.testExternalContextItem005 != null) {
+                return false;
+            }
+        } else if (!testExternalContextItem005.equals(other.testExternalContextItem005)) {
+            return false;
+        }
+        if (testExternalContextItem006 == null) {
+            if (other.testExternalContextItem006 != null) {
+                return false;
+            }
+        } else if (!testExternalContextItem006.equals(other.testExternalContextItem006)) {
+            return false;
+        }
+        if (testExternalContextItem007 == null) {
+            if (other.testExternalContextItem007 != null) {
+                return false;
+            }
+        } else if (!testExternalContextItem007.equals(other.testExternalContextItem007)) {
+            return false;
+        }
+        if (testExternalContextItem008 == null) {
+            if (other.testExternalContextItem008 != null) {
+                return false;
+            }
+        } else if (!testExternalContextItem008.equals(other.testExternalContextItem008)) {
+            return false;
+        }
+        if (testExternalContextItem009 == null) {
+            if (other.testExternalContextItem009 != null) {
+                return false;
+            }
+        } else if (!testExternalContextItem009.equals(other.testExternalContextItem009)) {
+            return false;
+        }
+        if (testExternalContextItem00A == null) {
+            if (other.testExternalContextItem00A != null) {
+                return false;
+            }
+        } else if (!testExternalContextItem00A.equals(other.testExternalContextItem00A)) {
+            return false;
+        }
+        if (testExternalContextItem00B == null) {
+            if (other.testExternalContextItem00B != null) {
+                return false;
+            }
+        } else if (!testExternalContextItem00B.equals(other.testExternalContextItem00B)) {
+            return false;
+        }
+        if (testExternalContextItem00C == null) {
+            if (other.testExternalContextItem00C != null) {
+                return false;
+            }
+        } else if (!testExternalContextItem00C.equals(other.testExternalContextItem00C)) {
+            return false;
+        }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "TestExternalContextItem [testExternalContextItem000=" + testExternalContextItem000
+                + ", testExternalContextItem001=" + testExternalContextItem001 + ", testExternalContextItem002="
+                + testExternalContextItem002 + ", testExternalContextItem003=" + testExternalContextItem003
+                + ", testExternalContextItem004=" + testExternalContextItem004 + ", testExternalContextItem005="
+                + testExternalContextItem005 + ", testExternalContextItem006=" + testExternalContextItem006
+                + ", testExternalContextItem007=" + testExternalContextItem007 + ", testExternalContextItem008="
+                + testExternalContextItem008 + ", testExternalContextItem009=" + testExternalContextItem009
+                + ", testExternalContextItem00A=" + testExternalContextItem00A + ", testExternalContextItem00B="
+                + testExternalContextItem00B + ", testExternalContextItem00C=" + testExternalContextItem00C + "]";
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestGlobalContextItem.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestGlobalContextItem.java
new file mode 100644
index 0000000..2e893d9
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestGlobalContextItem.java
@@ -0,0 +1,434 @@
+/*-
+ * ============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.test.concepts;
+
+import java.io.Serializable;
+
+/**
+ * The Class TestGlobalContextItem.
+ */
+public class TestGlobalContextItem implements Serializable {
+    private static final long serialVersionUID = 3348445332683174361L;
+
+    private static final int HASH_PRIME_1 = 31;
+
+    private TestContextItem000 testGlobalContextItem000;
+    private TestContextItem001 testGlobalContextItem001;
+    private TestContextItem002 testGlobalContextItem002;
+    private TestContextItem003 testGlobalContextItem003;
+    private TestContextItem004 testGlobalContextItem004;
+    private TestContextItem005 testGlobalContextItem005;
+    private TestContextItem006 testGlobalContextItem006;
+    private TestContextItem007 testGlobalContextItem007;
+    private TestContextItem008 testGlobalContextItem008;
+    private TestContextItem009 testGlobalContextItem009;
+    private TestContextItem00A testGlobalContextItem00A;
+    private TestContextItem00B testGlobalContextItem00B;
+    private TestContextItem00C testGlobalContextItem00C;
+
+    /**
+     * Gets the test global context item 000.
+     *
+     * @return the test global context item 000
+     */
+    public TestContextItem000 getTestGlobalContextItem000() {
+        return testGlobalContextItem000;
+    }
+
+    /**
+     * Sets the test global context item 000.
+     *
+     * @param testGlobalContextItem000 the test global context item 000
+     */
+    public void setTestGlobalContextItem000(final TestContextItem000 testGlobalContextItem000) {
+        this.testGlobalContextItem000 = testGlobalContextItem000;
+    }
+
+    /**
+     * Gets the test global context item 001.
+     *
+     * @return the test global context item 001
+     */
+    public TestContextItem001 getTestGlobalContextItem001() {
+        return testGlobalContextItem001;
+    }
+
+    /**
+     * Sets the test global context item 001.
+     *
+     * @param testGlobalContextItem001 the test global context item 001
+     */
+    public void setTestGlobalContextItem001(final TestContextItem001 testGlobalContextItem001) {
+        this.testGlobalContextItem001 = testGlobalContextItem001;
+    }
+
+    /**
+     * Gets the test global context item 002.
+     *
+     * @return the test global context item 002
+     */
+    public TestContextItem002 getTestGlobalContextItem002() {
+        return testGlobalContextItem002;
+    }
+
+    /**
+     * Sets the test global context item 002.
+     *
+     * @param testGlobalContextItem002 the test global context item 002
+     */
+    public void setTestGlobalContextItem002(final TestContextItem002 testGlobalContextItem002) {
+        this.testGlobalContextItem002 = testGlobalContextItem002;
+    }
+
+    /**
+     * Gets the test global context item 003.
+     *
+     * @return the test global context item 003
+     */
+    public TestContextItem003 getTestGlobalContextItem003() {
+        return testGlobalContextItem003;
+    }
+
+    /**
+     * Sets the test global context item 003.
+     *
+     * @param testGlobalContextItem003 the test global context item 003
+     */
+    public void setTestGlobalContextItem003(final TestContextItem003 testGlobalContextItem003) {
+        this.testGlobalContextItem003 = testGlobalContextItem003;
+    }
+
+    /**
+     * Gets the test global context item 004.
+     *
+     * @return the test global context item 004
+     */
+    public TestContextItem004 getTestGlobalContextItem004() {
+        return testGlobalContextItem004;
+    }
+
+    /**
+     * Sets the test global context item 004.
+     *
+     * @param testGlobalContextItem004 the test global context item 004
+     */
+    public void setTestGlobalContextItem004(final TestContextItem004 testGlobalContextItem004) {
+        this.testGlobalContextItem004 = testGlobalContextItem004;
+    }
+
+    /**
+     * Gets the test global context item 005.
+     *
+     * @return the test global context item 005
+     */
+    public TestContextItem005 getTestGlobalContextItem005() {
+        return testGlobalContextItem005;
+    }
+
+    /**
+     * Sets the test global context item 005.
+     *
+     * @param testGlobalContextItem005 the test global context item 005
+     */
+    public void setTestGlobalContextItem005(final TestContextItem005 testGlobalContextItem005) {
+        this.testGlobalContextItem005 = testGlobalContextItem005;
+    }
+
+    /**
+     * Gets the test global context item 006.
+     *
+     * @return the test global context item 006
+     */
+    public TestContextItem006 getTestGlobalContextItem006() {
+        return testGlobalContextItem006;
+    }
+
+    /**
+     * Sets the test global context item 006.
+     *
+     * @param testGlobalContextItem006 the test global context item 006
+     */
+    public void setTestGlobalContextItem006(final TestContextItem006 testGlobalContextItem006) {
+        this.testGlobalContextItem006 = testGlobalContextItem006;
+    }
+
+    /**
+     * Gets the test global context item 007.
+     *
+     * @return the test global context item 007
+     */
+    public TestContextItem007 getTestGlobalContextItem007() {
+        return testGlobalContextItem007;
+    }
+
+    /**
+     * Sets the test global context item 007.
+     *
+     * @param testGlobalContextItem007 the test global context item 007
+     */
+    public void setTestGlobalContextItem007(final TestContextItem007 testGlobalContextItem007) {
+        this.testGlobalContextItem007 = testGlobalContextItem007;
+    }
+
+    /**
+     * Gets the test global context item 008.
+     *
+     * @return the test global context item 008
+     */
+    public TestContextItem008 getTestGlobalContextItem008() {
+        return testGlobalContextItem008;
+    }
+
+    /**
+     * Sets the test global context item 008.
+     *
+     * @param testGlobalContextItem008 the test global context item 008
+     */
+    public void setTestGlobalContextItem008(final TestContextItem008 testGlobalContextItem008) {
+        this.testGlobalContextItem008 = testGlobalContextItem008;
+    }
+
+    /**
+     * Gets the test global context item 009.
+     *
+     * @return the test global context item 009
+     */
+    public TestContextItem009 getTestGlobalContextItem009() {
+        return testGlobalContextItem009;
+    }
+
+    /**
+     * Sets the test global context item 009.
+     *
+     * @param testGlobalContextItem009 the test global context item 009
+     */
+    public void setTestGlobalContextItem009(final TestContextItem009 testGlobalContextItem009) {
+        this.testGlobalContextItem009 = testGlobalContextItem009;
+    }
+
+    /**
+     * Gets the test global context item 00 A.
+     *
+     * @return the test global context item 00 A
+     */
+    public TestContextItem00A getTestGlobalContextItem00A() {
+        return testGlobalContextItem00A;
+    }
+
+    /**
+     * Sets the test global context item 00 A.
+     *
+     * @param testGlobalContextItem00A the test global context item 00 A
+     */
+    public void setTestGlobalContextItem00A(final TestContextItem00A testGlobalContextItem00A) {
+        this.testGlobalContextItem00A = testGlobalContextItem00A;
+    }
+
+    /**
+     * Gets the test global context item 00 B.
+     *
+     * @return the test global context item 00 B
+     */
+    public TestContextItem00B getTestGlobalContextItem00B() {
+        return testGlobalContextItem00B;
+    }
+
+    /**
+     * Sets the test global context item 00 B.
+     *
+     * @param testGlobalContextItem00B the test global context item 00 B
+     */
+    public void setTestGlobalContextItem00B(final TestContextItem00B testGlobalContextItem00B) {
+        this.testGlobalContextItem00B = testGlobalContextItem00B;
+    }
+
+    /**
+     * Gets the test global context item 00 C.
+     *
+     * @return the test global context item 00 C
+     */
+    public TestContextItem00C getTestGlobalContextItem00C() {
+        return testGlobalContextItem00C;
+    }
+
+    /**
+     * Sets the test global context item 00 C.
+     *
+     * @param testGlobalContextItem00C the test global context item 00 C
+     */
+    public void setTestGlobalContextItem00C(final TestContextItem00C testGlobalContextItem00C) {
+        this.testGlobalContextItem00C = testGlobalContextItem00C;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = HASH_PRIME_1;
+        int result = 1;
+        result = prime * result + ((testGlobalContextItem000 == null) ? 0 : testGlobalContextItem000.hashCode());
+        result = prime * result + ((testGlobalContextItem001 == null) ? 0 : testGlobalContextItem001.hashCode());
+        result = prime * result + ((testGlobalContextItem002 == null) ? 0 : testGlobalContextItem002.hashCode());
+        result = prime * result + ((testGlobalContextItem003 == null) ? 0 : testGlobalContextItem003.hashCode());
+        result = prime * result + ((testGlobalContextItem004 == null) ? 0 : testGlobalContextItem004.hashCode());
+        result = prime * result + ((testGlobalContextItem005 == null) ? 0 : testGlobalContextItem005.hashCode());
+        result = prime * result + ((testGlobalContextItem006 == null) ? 0 : testGlobalContextItem006.hashCode());
+        result = prime * result + ((testGlobalContextItem007 == null) ? 0 : testGlobalContextItem007.hashCode());
+        result = prime * result + ((testGlobalContextItem008 == null) ? 0 : testGlobalContextItem008.hashCode());
+        result = prime * result + ((testGlobalContextItem009 == null) ? 0 : testGlobalContextItem009.hashCode());
+        result = prime * result + ((testGlobalContextItem00A == null) ? 0 : testGlobalContextItem00A.hashCode());
+        result = prime * result + ((testGlobalContextItem00B == null) ? 0 : testGlobalContextItem00B.hashCode());
+        result = prime * result + ((testGlobalContextItem00C == null) ? 0 : testGlobalContextItem00C.hashCode());
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final TestGlobalContextItem other = (TestGlobalContextItem) obj;
+        if (testGlobalContextItem000 == null) {
+            if (other.testGlobalContextItem000 != null) {
+                return false;
+            }
+        } else if (!testGlobalContextItem000.equals(other.testGlobalContextItem000)) {
+            return false;
+        }
+        if (testGlobalContextItem001 == null) {
+            if (other.testGlobalContextItem001 != null) {
+                return false;
+            }
+        } else if (!testGlobalContextItem001.equals(other.testGlobalContextItem001)) {
+            return false;
+        }
+        if (testGlobalContextItem002 == null) {
+            if (other.testGlobalContextItem002 != null) {
+                return false;
+            }
+        } else if (!testGlobalContextItem002.equals(other.testGlobalContextItem002)) {
+            return false;
+        }
+        if (testGlobalContextItem003 == null) {
+            if (other.testGlobalContextItem003 != null) {
+                return false;
+            }
+        } else if (!testGlobalContextItem003.equals(other.testGlobalContextItem003)) {
+            return false;
+        }
+        if (testGlobalContextItem004 == null) {
+            if (other.testGlobalContextItem004 != null) {
+                return false;
+            }
+        } else if (!testGlobalContextItem004.equals(other.testGlobalContextItem004)) {
+            return false;
+        }
+        if (testGlobalContextItem005 == null) {
+            if (other.testGlobalContextItem005 != null) {
+                return false;
+            }
+        } else if (!testGlobalContextItem005.equals(other.testGlobalContextItem005)) {
+            return false;
+        }
+        if (testGlobalContextItem006 == null) {
+            if (other.testGlobalContextItem006 != null) {
+                return false;
+            }
+        } else if (!testGlobalContextItem006.equals(other.testGlobalContextItem006)) {
+            return false;
+        }
+        if (testGlobalContextItem007 == null) {
+            if (other.testGlobalContextItem007 != null) {
+                return false;
+            }
+        } else if (!testGlobalContextItem007.equals(other.testGlobalContextItem007)) {
+            return false;
+        }
+        if (testGlobalContextItem008 == null) {
+            if (other.testGlobalContextItem008 != null) {
+                return false;
+            }
+        } else if (!testGlobalContextItem008.equals(other.testGlobalContextItem008)) {
+            return false;
+        }
+        if (testGlobalContextItem009 == null) {
+            if (other.testGlobalContextItem009 != null) {
+                return false;
+            }
+        } else if (!testGlobalContextItem009.equals(other.testGlobalContextItem009)) {
+            return false;
+        }
+        if (testGlobalContextItem00A == null) {
+            if (other.testGlobalContextItem00A != null) {
+                return false;
+            }
+        } else if (!testGlobalContextItem00A.equals(other.testGlobalContextItem00A)) {
+            return false;
+        }
+        if (testGlobalContextItem00B == null) {
+            if (other.testGlobalContextItem00B != null) {
+                return false;
+            }
+        } else if (!testGlobalContextItem00B.equals(other.testGlobalContextItem00B)) {
+            return false;
+        }
+        if (testGlobalContextItem00C == null) {
+            if (other.testGlobalContextItem00C != null) {
+                return false;
+            }
+        } else if (!testGlobalContextItem00C.equals(other.testGlobalContextItem00C)) {
+            return false;
+        }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "TestGlobalContextItem [testGlobalContextItem000=" + testGlobalContextItem000
+                + ", testGlobalContextItem001=" + testGlobalContextItem001 + ", testGlobalContextItem002="
+                + testGlobalContextItem002 + ", testGlobalContextItem003=" + testGlobalContextItem003
+                + ", testGlobalContextItem004=" + testGlobalContextItem004 + ", testGlobalContextItem005="
+                + testGlobalContextItem005 + ", testGlobalContextItem006=" + testGlobalContextItem006
+                + ", testGlobalContextItem007=" + testGlobalContextItem007 + ", testGlobalContextItem008="
+                + testGlobalContextItem008 + ", testGlobalContextItem009=" + testGlobalContextItem009
+                + ", testGlobalContextItem00A=" + testGlobalContextItem00A + ", testGlobalContextItem00B="
+                + testGlobalContextItem00B + ", testGlobalContextItem00C=" + testGlobalContextItem00C + "]";
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestPolicyContextItem.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestPolicyContextItem.java
new file mode 100644
index 0000000..e9381de
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/TestPolicyContextItem.java
@@ -0,0 +1,241 @@
+/*-
+ * ============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.test.concepts;
+
+import java.io.Serializable;
+
+/**
+ * The Class TestPolicyContextItem.
+ */
+public class TestPolicyContextItem implements Serializable {
+    private static final long serialVersionUID = 6336372857646152910L;
+
+    private static final int HASH_PRIME_1 = 31;
+
+    private TestContextItem006 testPolicyContextItem000;
+    private TestContextItem003 testPolicyContextItem001;
+    private TestContextItem005 testPolicyContextItem002;
+    private TestContextItem000 testPolicyContextItem003;
+    private TestContextItem003 testPolicyContextItem004;
+    private TestContextItem00C testPolicyContextItem005;
+
+    /**
+     * Gets the test policy context item 000.
+     *
+     * @return the test policy context item 000
+     */
+    public TestContextItem006 getTestPolicyContextItem000() {
+        return testPolicyContextItem000;
+    }
+
+    /**
+     * Sets the test policy context item 000.
+     *
+     * @param testPolicyContextItem000 the test policy context item 000
+     */
+    public void setTestPolicyContextItem000(final TestContextItem006 testPolicyContextItem000) {
+        this.testPolicyContextItem000 = testPolicyContextItem000;
+    }
+
+    /**
+     * Gets the test policy context item 001.
+     *
+     * @return the test policy context item 001
+     */
+    public TestContextItem003 getTestPolicyContextItem001() {
+        return testPolicyContextItem001;
+    }
+
+    /**
+     * Sets the test policy context item 001.
+     *
+     * @param testPolicyContextItem001 the test policy context item 001
+     */
+    public void setTestPolicyContextItem001(final TestContextItem003 testPolicyContextItem001) {
+        this.testPolicyContextItem001 = testPolicyContextItem001;
+    }
+
+    /**
+     * Gets the test policy context item 002.
+     *
+     * @return the test policy context item 002
+     */
+    public TestContextItem005 getTestPolicyContextItem002() {
+        return testPolicyContextItem002;
+    }
+
+    /**
+     * Sets the test policy context item 002.
+     *
+     * @param testPolicyContextItem002 the test policy context item 002
+     */
+    public void setTestPolicyContextItem002(final TestContextItem005 testPolicyContextItem002) {
+        this.testPolicyContextItem002 = testPolicyContextItem002;
+    }
+
+    /**
+     * Gets the test policy context item 003.
+     *
+     * @return the test policy context item 003
+     */
+    public TestContextItem000 getTestPolicyContextItem003() {
+        return testPolicyContextItem003;
+    }
+
+    /**
+     * Sets the test policy context item 003.
+     *
+     * @param testPolicyContextItem003 the test policy context item 003
+     */
+    public void setTestPolicyContextItem003(final TestContextItem000 testPolicyContextItem003) {
+        this.testPolicyContextItem003 = testPolicyContextItem003;
+    }
+
+    /**
+     * Gets the test policy context item 004.
+     *
+     * @return the test policy context item 004
+     */
+    public TestContextItem003 getTestPolicyContextItem004() {
+        return testPolicyContextItem004;
+    }
+
+    /**
+     * Sets the test policy context item 004.
+     *
+     * @param testPolicyContextItem004 the test policy context item 004
+     */
+    public void setTestPolicyContextItem004(final TestContextItem003 testPolicyContextItem004) {
+        this.testPolicyContextItem004 = testPolicyContextItem004;
+    }
+
+    /**
+     * Gets the test policy context item 005.
+     *
+     * @return the test policy context item 005
+     */
+    public TestContextItem00C getTestPolicyContextItem005() {
+        return testPolicyContextItem005;
+    }
+
+    /**
+     * Sets the test policy context item 005.
+     *
+     * @param testPolicyContextItem005 the test policy context item 005
+     */
+    public void setTestPolicyContextItem005(final TestContextItem00C testPolicyContextItem005) {
+        this.testPolicyContextItem005 = testPolicyContextItem005;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = HASH_PRIME_1;
+        int result = 1;
+        result = prime * result + ((testPolicyContextItem000 == null) ? 0 : testPolicyContextItem000.hashCode());
+        result = prime * result + ((testPolicyContextItem001 == null) ? 0 : testPolicyContextItem001.hashCode());
+        result = prime * result + ((testPolicyContextItem002 == null) ? 0 : testPolicyContextItem002.hashCode());
+        result = prime * result + ((testPolicyContextItem003 == null) ? 0 : testPolicyContextItem003.hashCode());
+        result = prime * result + ((testPolicyContextItem004 == null) ? 0 : testPolicyContextItem004.hashCode());
+        result = prime * result + ((testPolicyContextItem005 == null) ? 0 : testPolicyContextItem005.hashCode());
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final TestPolicyContextItem other = (TestPolicyContextItem) obj;
+        if (testPolicyContextItem000 == null) {
+            if (other.testPolicyContextItem000 != null) {
+                return false;
+            }
+        } else if (!testPolicyContextItem000.equals(other.testPolicyContextItem000)) {
+            return false;
+        }
+        if (testPolicyContextItem001 == null) {
+            if (other.testPolicyContextItem001 != null) {
+                return false;
+            }
+        } else if (!testPolicyContextItem001.equals(other.testPolicyContextItem001)) {
+            return false;
+        }
+        if (testPolicyContextItem002 == null) {
+            if (other.testPolicyContextItem002 != null) {
+                return false;
+            }
+        } else if (!testPolicyContextItem002.equals(other.testPolicyContextItem002)) {
+            return false;
+        }
+        if (testPolicyContextItem003 == null) {
+            if (other.testPolicyContextItem003 != null) {
+                return false;
+            }
+        } else if (!testPolicyContextItem003.equals(other.testPolicyContextItem003)) {
+            return false;
+        }
+        if (testPolicyContextItem004 == null) {
+            if (other.testPolicyContextItem004 != null) {
+                return false;
+            }
+        } else if (!testPolicyContextItem004.equals(other.testPolicyContextItem004)) {
+            return false;
+        }
+        if (testPolicyContextItem005 == null) {
+            if (other.testPolicyContextItem005 != null) {
+                return false;
+            }
+        } else if (!testPolicyContextItem005.equals(other.testPolicyContextItem005)) {
+            return false;
+        }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "TestPolicyContextItem [testPolicyContextItem000=" + testPolicyContextItem000
+                + ", testPolicyContextItem001=" + testPolicyContextItem001 + ", testPolicyContextItem002="
+                + testPolicyContextItem002 + ", testPolicyContextItem003=" + testPolicyContextItem003
+                + ", testPolicyContextItem004=" + testPolicyContextItem004 + ", testPolicyContextItem005="
+                + testPolicyContextItem005 + "]";
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/package-info.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/package-info.java
new file mode 100644
index 0000000..d57b3fd
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/concepts/package-info.java
@@ -0,0 +1,27 @@
+/*-
+ * ============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=========================================================
+ */
+
+/**
+ * Defines test Java context classes.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+
+package org.onap.policy.apex.context.test.concepts;
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java
new file mode 100644
index 0000000..ae0fea7
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java
@@ -0,0 +1,121 @@
+/*-
+ * ============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.test.distribution;
+
+import java.io.IOException;
+
+import org.onap.policy.apex.context.ContextAlbum;
+import org.onap.policy.apex.context.Distributor;
+import org.onap.policy.apex.context.impl.distribution.DistributorFactory;
+import org.onap.policy.apex.context.test.factory.TestContextAlbumFactory;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
+import org.onap.policy.apex.model.utilities.comparison.KeyedMapComparer;
+import org.onap.policy.apex.model.utilities.comparison.KeyedMapDifference;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * The Class ContextAlbumUpdate is used to test Context Album updates.
+ */
+public class ContextAlbumUpdate {
+    // Logger for this class
+    private static final XLogger LOGGER = XLoggerFactory.getXLogger(ContextAlbumUpdate.class);
+
+    /**
+     * Test context album update.
+     *
+     * @throws ApexModelException the apex model exception
+     * @throws IOException the IO exception
+     * @throws ApexException the apex exception
+     */
+    public void testContextAlbumUpdate() throws ApexModelException, IOException, ApexException {
+        LOGGER.debug("Running TestContextAlbumUpdate test . . .");
+
+        final AxArtifactKey distributorKey = new AxArtifactKey("ApexDistributor", "0.0.1");
+        final Distributor contextDistributor = new DistributorFactory().getDistributor(distributorKey);
+
+        final AxContextModel longModel = TestContextAlbumFactory.createLongContextModel();
+        contextDistributor.registerModel(longModel);
+
+        final AxContextAlbum longAlbum1Def = longModel.getAlbums().get(new AxArtifactKey("LongContextAlbum1", "0.0.1"));
+        final ContextAlbum longAlbum1 = contextDistributor.createContextAlbum(longAlbum1Def.getKey());
+        assert (longAlbum1 != null);
+
+        final AxContextAlbum longAlbum2Def = longModel.getAlbums().get(new AxArtifactKey("LongContextAlbum2", "0.0.1"));
+        final ContextAlbum longAlbum2 = contextDistributor.createContextAlbum(longAlbum2Def.getKey());
+        assert (longAlbum2 != null);
+
+        // CHECKSTYLE:OFF: checkstyle:magicNumber
+        longAlbum1.put("0", (long) 0);
+        longAlbum1.put("1", (long) 1);
+        longAlbum1.put("2", (long) 2);
+        longAlbum1.put("3", (long) 3);
+
+        final KeyedMapDifference<String, Object> result0 =
+                new KeyedMapComparer<String, Object>().compareMaps(longAlbum1, longAlbum2);
+
+        assert (0 == result0.getDifferentValues().size());
+        assert (0 == result0.getIdenticalValues().size());
+        assert (0 == result0.getRightOnly().size());
+        assert (4 == result0.getLeftOnly().size());
+
+        longAlbum2.putAll(longAlbum1);
+
+        final KeyedMapDifference<String, Object> result1 =
+                new KeyedMapComparer<String, Object>().compareMaps(longAlbum1, longAlbum2);
+
+        assert (0 == result1.getDifferentValues().size());
+        assert (4 == result1.getIdenticalValues().size());
+        assert (0 == result1.getRightOnly().size());
+        assert (0 == result1.getLeftOnly().size());
+
+        longAlbum1.put("4", (long) 4);
+        longAlbum2.put("5", (long) 5);
+        longAlbum1.put("67", (long) 6);
+        longAlbum2.put("67", (long) 7);
+
+        final KeyedMapDifference<String, Object> result2 =
+                new KeyedMapComparer<String, Object>().compareMaps(longAlbum1, longAlbum2);
+
+        assert (1 == result2.getDifferentValues().size());
+        assert (4 == result2.getIdenticalValues().size());
+        assert (1 == result2.getRightOnly().size());
+        assert (1 == result2.getLeftOnly().size());
+
+        longAlbum1.remove("0");
+        longAlbum2.remove("3");
+        // CHECKSTYLE:ON: checkstyle:magicNumber
+
+        final KeyedMapDifference<String, Object> result3 =
+                new KeyedMapComparer<String, Object>().compareMaps(longAlbum1, longAlbum2);
+
+        assert (1 == result3.getDifferentValues().size());
+        assert (2 == result3.getIdenticalValues().size());
+        assert (2 == result3.getRightOnly().size());
+        assert (2 == result3.getLeftOnly().size());
+
+        contextDistributor.clear();
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java
new file mode 100644
index 0000000..4a9af5a
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java
@@ -0,0 +1,487 @@
+/*-
+ * ============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.test.distribution;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TimeZone;
+import java.util.TreeSet;
+
+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.DistributorFactory;
+import org.onap.policy.apex.context.test.concepts.TestContextItem000;
+import org.onap.policy.apex.context.test.concepts.TestContextItem001;
+import org.onap.policy.apex.context.test.concepts.TestContextItem002;
+import org.onap.policy.apex.context.test.concepts.TestContextItem003;
+import org.onap.policy.apex.context.test.concepts.TestContextItem004;
+import org.onap.policy.apex.context.test.concepts.TestContextItem005;
+import org.onap.policy.apex.context.test.concepts.TestContextItem006;
+import org.onap.policy.apex.context.test.concepts.TestContextItem007;
+import org.onap.policy.apex.context.test.concepts.TestContextItem008;
+import org.onap.policy.apex.context.test.concepts.TestContextItem009;
+import org.onap.policy.apex.context.test.concepts.TestContextItem00A;
+import org.onap.policy.apex.context.test.concepts.TestContextItem00B;
+import org.onap.policy.apex.context.test.concepts.TestContextItem00C;
+import org.onap.policy.apex.context.test.concepts.TestExternalContextItem;
+import org.onap.policy.apex.context.test.concepts.TestGlobalContextItem;
+import org.onap.policy.apex.context.test.concepts.TestPolicyContextItem;
+import org.onap.policy.apex.context.test.factory.TestContextAlbumFactory;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * The Class TestContextInstantiation is used to test Apex context insitiation is correct.
+ *
+ * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
+ */
+public class ContextInstantiation {
+    // Logger for this class
+    private static final XLogger LOGGER = XLoggerFactory.getXLogger(ContextInstantiation.class);
+
+    /**
+     * Test context instantiation.
+     *
+     * @throws ContextException the context exception
+     */
+    // CHECKSTYLE:OFF: checkstyle:MaximumMethodLength
+    public void testContextInstantiation() throws ContextException {
+        // CHECKSTYLE:ON: checkstyle:MaximumMethodLength
+        LOGGER.debug("Running TestContextInstantiation test . . .");
+
+        final AxArtifactKey distributorKey = new AxArtifactKey("ApexDistributorInit", "0.0.1");
+        Distributor contextDistributor = null;
+        try {
+            contextDistributor = new DistributorFactory().getDistributor(distributorKey);
+        } catch (final Exception e) {
+            e.printStackTrace();
+            return;
+        }
+
+        // @formatter:off
+        final AxArtifactKey[] usedArtifactStackArray = {
+                new AxArtifactKey("testC-top", "0.0.1"), new AxArtifactKey("testC-next", "0.0.1"),
+                new AxArtifactKey("testC-bot", "0.0.1")
+        };
+        // @formatter:on
+
+        try {
+            // CHECKSTYLE:OFF: checkstyle:magicNumber
+            final AxContextModel policyContextModel = TestContextAlbumFactory.createPolicyContextModel();
+            final AxValidationResult result = new AxValidationResult();
+            policyContextModel.validate(result);
+            LOGGER.debug(result.toString());
+            assert (result.isValid());
+
+            contextDistributor.registerModel(policyContextModel);
+
+            final ContextAlbum policyContextAlbum =
+                    contextDistributor.createContextAlbum(new AxArtifactKey("PolicyContextAlbum", "0.0.1"));
+            assert (policyContextAlbum != null);
+            policyContextAlbum.setUserArtifactStack(usedArtifactStackArray);
+
+            final Float testFloat = new Float(3.14159265359);
+            final Date testDate = new Date();
+
+            final TestContextItem009 tci9 = new TestContextItem009();
+            tci9.setDateValue(new TestContextItem008(testDate));
+            tci9.setTZValue(TimeZone.getTimeZone("Europe/Dublin").getDisplayName());
+            tci9.setDST(true);
+
+            final TestContextItem00A tciA = new TestContextItem00A();
+            tciA.setDateValue(new TestContextItem008(testDate));
+            tciA.setTZValue(TimeZone.getTimeZone("Europe/Dublin").getDisplayName());
+            tciA.setDST(true);
+            tciA.setUTCOffset(-600);
+            tciA.setLocale(Locale.ENGLISH);
+
+            final TreeSet<String> testTreeSet = new TreeSet<>();
+            testTreeSet.add("one hundred");
+            testTreeSet.add("one hundred and one");
+            testTreeSet.add("one hundred and two");
+            testTreeSet.add("one hundred and three");
+            testTreeSet.add("one hundred and four");
+
+            final Map<String, String> testHashMap = new HashMap<>();
+            testHashMap.put("0", "zero");
+            testHashMap.put("1", "one");
+            testHashMap.put("2", "two");
+            testHashMap.put("3", "three");
+            testHashMap.put("4", "four");
+
+            final TestContextItem006 testPolicyContextItem000 =
+                    new TestContextItem006("This is a policy context string");
+            final TestContextItem003 testPolicyContextItem001 = new TestContextItem003(0xFFFFFFFFFFFFFFFFL);
+            final TestContextItem005 testPolicyContextItem002 = new TestContextItem005(Math.PI);
+            final TestContextItem000 testPolicyContextItem003 = new TestContextItem000(true);
+            final TestContextItem003 testPolicyContextItem004 = new TestContextItem003(testDate.getTime());
+            final TestContextItem00C testPolicyContextItem005 = new TestContextItem00C(testHashMap);
+
+            final Map<String, Object> valueMapA = new LinkedHashMap<>();
+            valueMapA.put("TestPolicyContextItem001", testPolicyContextItem001);
+            valueMapA.put("TestPolicyContextItem002", testPolicyContextItem002);
+            valueMapA.put("TestPolicyContextItem003", testPolicyContextItem003);
+            valueMapA.put("TestPolicyContextItem004", testPolicyContextItem004);
+            valueMapA.put("TestPolicyContextItem005", testPolicyContextItem005);
+            valueMapA.put("TestPolicyContextItem000", testPolicyContextItem000);
+
+            try {
+                policyContextAlbum.put("TestPolicyContextItem000", testPolicyContextItem000);
+                assert ("Test should throw an exception".equals(""));
+            } catch (final ContextRuntimeException e) {
+                assert (e.getMessage().equals(
+                        "Failed to set context value for key \"TestPolicyContextItem000\" in album \"PolicyContextAlbum:0.0.1\": "
+                                + "PolicyContextAlbum:0.0.1: object \"TestContextItem006 [stringValue=This is a policy context string]\" "
+                                + "of class \"org.onap.policy.apex.context.test.concepts.TestContextItem006\""
+                                + " not compatible with class \"org.onap.policy.apex.context.test.concepts.TestPolicyContextItem\""));
+            }
+
+            try {
+                policyContextAlbum.putAll(valueMapA);
+                assert ("Test should throw an exception".equals(""));
+            } catch (final ContextRuntimeException e) {
+                assert (e.getMessage().equals(
+                        "Failed to set context value for key \"TestPolicyContextItem001\" in album \"PolicyContextAlbum:0.0.1\": "
+                                + "PolicyContextAlbum:0.0.1: object \"TestContextItem003 [longValue=-1]\" "
+                                + "of class \"org.onap.policy.apex.context.test.concepts.TestContextItem003\""
+                                + " not compatible with class \"org.onap.policy.apex.context.test.concepts.TestPolicyContextItem\""));
+            }
+
+            final TestPolicyContextItem policyContext = new TestPolicyContextItem();
+
+            LOGGER.debug(policyContextAlbum.toString());
+
+            policyContext.setTestPolicyContextItem000(testPolicyContextItem000);
+            policyContext.setTestPolicyContextItem001(testPolicyContextItem001);
+            policyContext.setTestPolicyContextItem002(testPolicyContextItem002);
+            policyContext.setTestPolicyContextItem003(testPolicyContextItem003);
+            policyContext.setTestPolicyContextItem004(testPolicyContextItem004);
+            policyContext.setTestPolicyContextItem005(testPolicyContextItem005);
+
+            final Map<String, Object> valueMap0 = new HashMap<>();
+            valueMap0.put("TestPolicyContextItem", policyContext);
+
+            policyContextAlbum.putAll(valueMap0);
+
+            assert (((TestPolicyContextItem) policyContextAlbum.get("TestPolicyContextItem"))
+                    .getTestPolicyContextItem000().getStringValue().equals("This is a policy context string"));
+            assert (((TestPolicyContextItem) policyContextAlbum.get("TestPolicyContextItem"))
+                    .getTestPolicyContextItem001().getLongValue() == 0xFFFFFFFFFFFFFFFFL);
+            assert (((TestPolicyContextItem) policyContextAlbum.get("TestPolicyContextItem"))
+                    .getTestPolicyContextItem002().getDoubleValue() == Math.PI);
+            assert (((TestPolicyContextItem) policyContextAlbum.get("TestPolicyContextItem"))
+                    .getTestPolicyContextItem003().getFlag());
+            assert (((TestPolicyContextItem) policyContextAlbum.get("TestPolicyContextItem"))
+                    .getTestPolicyContextItem004().getLongValue() == testDate.getTime());
+            assert (((TestPolicyContextItem) policyContextAlbum.get("TestPolicyContextItem"))
+                    .getTestPolicyContextItem005().getMapValue().equals(testHashMap));
+
+            final AxContextModel globalContextModel = TestContextAlbumFactory.createGlobalContextModel();
+
+            final TestContextItem000 testGlobalContextItem000 = new TestContextItem000(false);
+            final TestContextItem001 testGlobalContextItem001 = new TestContextItem001((byte) 0xFF);
+            final TestContextItem002 testGlobalContextItem002 = new TestContextItem002(0xFFFFFFFF);
+            final TestContextItem003 testGlobalContextItem003 = new TestContextItem003(0xFFFFFFFFFFFFFFFFL);
+            final TestContextItem004 testGlobalContextItem004 = new TestContextItem004(testFloat);
+            final TestContextItem005 testGlobalContextItem005 = new TestContextItem005(Math.PI);
+            final TestContextItem006 testGlobalContextItem006 =
+                    new TestContextItem006("This is a global context string");
+            final TestContextItem007 testGlobalContextItem007 = new TestContextItem007(testDate.getTime());
+            final TestContextItem008 testGlobalContextItem008 = new TestContextItem008(testDate);
+            final TestContextItem00B testGlobalContextItem00B = new TestContextItem00B(testTreeSet);
+            final TestContextItem00C testGlobalContextItem00C = new TestContextItem00C(testHashMap);
+
+            final TestGlobalContextItem globalContext = new TestGlobalContextItem();
+
+            globalContext.setTestGlobalContextItem000(testGlobalContextItem000);
+            globalContext.setTestGlobalContextItem001(testGlobalContextItem001);
+            globalContext.setTestGlobalContextItem002(testGlobalContextItem002);
+            globalContext.setTestGlobalContextItem003(testGlobalContextItem003);
+            globalContext.setTestGlobalContextItem004(testGlobalContextItem004);
+            globalContext.setTestGlobalContextItem005(testGlobalContextItem005);
+            globalContext.setTestGlobalContextItem006(testGlobalContextItem006);
+            globalContext.setTestGlobalContextItem007(testGlobalContextItem007);
+            globalContext.setTestGlobalContextItem008(testGlobalContextItem008);
+            globalContext.setTestGlobalContextItem009(tci9);
+            globalContext.setTestGlobalContextItem00A(tciA);
+            globalContext.setTestGlobalContextItem00B(testGlobalContextItem00B);
+            globalContext.setTestGlobalContextItem00C(testGlobalContextItem00C);
+            final Map<String, Object> valueMap1 = new HashMap<>();
+            valueMap1.put("globalContext", globalContext);
+
+            try {
+                contextDistributor.registerModel(globalContextModel);
+            } catch (final ContextException e) {
+                assert (e.getMessage().equals(
+                        "active context albums found in distributor, clear the distributor before registering models"));
+            }
+
+            contextDistributor.registerModel(globalContextModel);
+
+            final ContextAlbum globalContextAlbum =
+                    contextDistributor.createContextAlbum(new AxArtifactKey("GlobalContextAlbum", "0.0.1"));
+            assert (globalContextAlbum != null);
+            globalContextAlbum.setUserArtifactStack(usedArtifactStackArray);
+
+            globalContextAlbum.putAll(valueMap1);
+
+            assert (!((TestGlobalContextItem) globalContextAlbum.get("globalContext")).getTestGlobalContextItem000()
+                    .getFlag());
+            assert (((TestGlobalContextItem) globalContextAlbum.get("globalContext")).getTestGlobalContextItem001()
+                    .getByteValue() == (byte) 0xFF);
+            assert (((TestGlobalContextItem) globalContextAlbum.get("globalContext")).getTestGlobalContextItem002()
+                    .getIntValue() == 0xFFFFFFFF);
+            assert (((TestGlobalContextItem) globalContextAlbum.get("globalContext")).getTestGlobalContextItem003()
+                    .getLongValue() == 0xFFFFFFFFFFFFFFFFL);
+            assert (((TestGlobalContextItem) globalContextAlbum.get("globalContext")).getTestGlobalContextItem004()
+                    .getFloatValue() == testFloat);
+            assert (((TestGlobalContextItem) globalContextAlbum.get("globalContext")).getTestGlobalContextItem005()
+                    .getDoubleValue() == Math.PI);
+            assert (((TestGlobalContextItem) globalContextAlbum.get("globalContext")).getTestGlobalContextItem006()
+                    .getStringValue().equals("This is a global context string"));
+            assert (((TestGlobalContextItem) globalContextAlbum.get("globalContext")).getTestGlobalContextItem007()
+                    .getLongValue() == testDate.getTime());
+            assert (((TestGlobalContextItem) globalContextAlbum.get("globalContext")).getTestGlobalContextItem008()
+                    .getDateValue().equals(testDate));
+            assert (((TestGlobalContextItem) globalContextAlbum.get("globalContext")).getTestGlobalContextItem009()
+                    .getDateValue().getTime() == tci9.getDateValue().getTime());
+            assert (((TestGlobalContextItem) globalContextAlbum.get("globalContext")).getTestGlobalContextItem00A()
+                    .getDateValue().getTime() == tciA.getDateValue().getTime());
+            assert (((TestGlobalContextItem) globalContextAlbum.get("globalContext")).getTestGlobalContextItem00B()
+                    .getSetValue().equals(testTreeSet));
+            assert (((TestGlobalContextItem) globalContextAlbum.get("globalContext")).getTestGlobalContextItem00C()
+                    .getMapValue().equals(testHashMap));
+
+            final AxContextModel externalContextModel = TestContextAlbumFactory.createExternalContextModel();
+
+            final TestExternalContextItem externalContext = new TestExternalContextItem();
+
+            final TestContextItem000 testExternalContextItem000 = new TestContextItem000(false);
+            final TestContextItem001 testExternalContextItem001 = new TestContextItem001((byte) 0xFF);
+            final TestContextItem002 testExternalContextItem002 = new TestContextItem002(0xFFFFFFFF);
+            final TestContextItem003 testExternalContextItem003 = new TestContextItem003(0xFFFFFFFFFFFFFFFFL);
+            final TestContextItem004 testExternalContextItem004 = new TestContextItem004(testFloat);
+            final TestContextItem005 testExternalContextItem005 = new TestContextItem005(Math.PI);
+            final TestContextItem006 testExternalContextItem006 =
+                    new TestContextItem006("This is an external context string");
+            final TestContextItem007 testExternalContextItem007 = new TestContextItem007(testDate.getTime());
+            final TestContextItem008 testExternalContextItem008 = new TestContextItem008(testDate);
+            final TestContextItem00B testExternalContextItem00B = new TestContextItem00B(testTreeSet);
+            final TestContextItem00C testExternalContextItem00C = new TestContextItem00C(testHashMap);
+
+            final TestContextItem009 tci9A = new TestContextItem009(tci9);
+            final TestContextItem00A tciAA = new TestContextItem00A(tciA);
+
+            externalContext.setTestExternalContextItem000(testExternalContextItem000);
+            externalContext.setTestExternalContextItem001(testExternalContextItem001);
+            externalContext.setTestExternalContextItem002(testExternalContextItem002);
+            externalContext.setTestExternalContextItem003(testExternalContextItem003);
+            externalContext.setTestExternalContextItem004(testExternalContextItem004);
+            externalContext.setTestExternalContextItem005(testExternalContextItem005);
+            externalContext.setTestExternalContextItem006(testExternalContextItem006);
+            externalContext.setTestExternalContextItem007(testExternalContextItem007);
+            externalContext.setTestExternalContextItem008(testExternalContextItem008);
+            externalContext.setTestExternalContextItem009(tci9A);
+            externalContext.setTestExternalContextItem00A(tciAA);
+            externalContext.setTestExternalContextItem00B(testExternalContextItem00B);
+            externalContext.setTestExternalContextItem00C(testExternalContextItem00C);
+
+            final Map<String, Object> valueMap2 = new HashMap<>();
+            valueMap2.put("externalContext", externalContext);
+
+            contextDistributor.clear();
+            contextDistributor.init(new AxArtifactKey("ClearedandInittedDistributor", "0.0.1"));
+            contextDistributor.registerModel(externalContextModel);
+
+            final ContextAlbum externalContextAlbum =
+                    contextDistributor.createContextAlbum(new AxArtifactKey("ExternalContextAlbum", "0.0.1"));
+            assert (externalContextAlbum != null);
+            externalContextAlbum.setUserArtifactStack(usedArtifactStackArray);
+
+            externalContextAlbum.putAll(valueMap2);
+            externalContextAlbum.getAlbumDefinition().setWritable(false);
+
+            assert (!((TestExternalContextItem) externalContextAlbum.get("externalContext"))
+                    .getTestExternalContextItem000().getFlag());
+            assert (((TestExternalContextItem) externalContextAlbum.get("externalContext"))
+                    .getTestExternalContextItem001().getByteValue() == (byte) 0xFF);
+            assert (((TestExternalContextItem) externalContextAlbum.get("externalContext"))
+                    .getTestExternalContextItem002().getIntValue() == 0xFFFFFFFF);
+            assert (((TestExternalContextItem) externalContextAlbum.get("externalContext"))
+                    .getTestExternalContextItem003().getLongValue() == 0xFFFFFFFFFFFFFFFFL);
+            assert (((TestExternalContextItem) externalContextAlbum.get("externalContext"))
+                    .getTestExternalContextItem004().getFloatValue() == testFloat);
+            assert (((TestExternalContextItem) externalContextAlbum.get("externalContext"))
+                    .getTestExternalContextItem005().getDoubleValue() == Math.PI);
+            assert (((TestExternalContextItem) externalContextAlbum.get("externalContext"))
+                    .getTestExternalContextItem006().getStringValue().equals("This is an external context string"));
+            assert (((TestExternalContextItem) externalContextAlbum.get("externalContext"))
+                    .getTestExternalContextItem007().getLongValue() == testDate.getTime());
+            assert (((TestExternalContextItem) externalContextAlbum.get("externalContext"))
+                    .getTestExternalContextItem008().getDateValue().equals(testDate));
+            assert (((TestExternalContextItem) externalContextAlbum.get("externalContext"))
+                    .getTestExternalContextItem009().getDateValue().getTime() == tci9A.getDateValue().getTime());
+            assert (((TestExternalContextItem) externalContextAlbum.get("externalContext"))
+                    .getTestExternalContextItem00A().getDateValue().getTime() == tciAA.getDateValue().getTime());
+            assert (((TestExternalContextItem) externalContextAlbum.get("externalContext"))
+                    .getTestExternalContextItem00B().getSetValue().equals(testTreeSet));
+            assert (((TestExternalContextItem) externalContextAlbum.get("externalContext"))
+                    .getTestExternalContextItem00C().getMapValue().equals(testHashMap));
+
+            final Collection<Object> mapValues = externalContextAlbum.values();
+            assert (externalContextAlbum.values().containsAll(mapValues));
+
+            // Check that clearing does not work
+            try {
+                externalContextAlbum.clear();
+                assert ("Test should throw an exception".equals(""));
+            } catch (final ContextRuntimeException e) {
+                assert (e.getMessage()
+                        .equals("album \"ExternalContextAlbum:0.0.1\" clear() not allowed on read only albums"));
+            }
+
+            assert (externalContextAlbum.size() == 1);
+
+            try {
+                externalContextAlbum.containsKey(null);
+            } catch (final ContextRuntimeException e) {
+                assert (e.getMessage().equals("null values are illegal on method parameter \"key\""));
+            }
+
+            assert (externalContextAlbum.containsKey("externalContext"));
+            assert (!externalContextAlbum.containsKey("globalContext"));
+
+            try {
+                externalContextAlbum.containsValue(null);
+            } catch (final ContextRuntimeException e) {
+                assert (e.getMessage().equals("null values are illegal on method parameter \"value\""));
+            }
+
+            assert (externalContextAlbum.containsValue(externalContext));
+            assert (!externalContextAlbum.containsValue(new String("Hello")));
+
+            final Set<Entry<String, Object>> entrySet = externalContextAlbum.entrySet();
+            assert (entrySet.size() == 1);
+
+            try {
+                externalContextAlbum.get(null);
+            } catch (final ContextRuntimeException e) {
+                assert (e.getMessage()
+                        .equals("album \"ExternalContextAlbum:0.0.1\" null keys are illegal on keys for get()"));
+            }
+
+            final Object aObject = externalContextAlbum.get("externalContext");
+            assert (aObject.equals(externalContext));
+
+            // put null keys should fail, throws a runtime exception
+            try {
+                externalContextAlbum.put(null, null);
+            } catch (final ContextRuntimeException e) {
+                assert (e.getMessage()
+                        .equals("album \"ExternalContextAlbum:0.0.1\" null keys are illegal on keys for put()"));
+            }
+
+            try {
+                externalContextAlbum.put("TestExternalContextItem00A", null);
+            } catch (final ContextRuntimeException e) {
+                assert (e.getMessage().equals(
+                        "album \"ExternalContextAlbum:0.0.1\" null values are illegal on key \"TestExternalContextItem00A\" for put()"));
+            }
+            assert (((TestExternalContextItem) externalContextAlbum.get("externalContext"))
+                    .getTestExternalContextItem00A().equals(tciAA));
+
+            // Should return the hash set
+            assert (((TestExternalContextItem) externalContextAlbum.get("externalContext"))
+                    .getTestExternalContextItem00B().getSetValue().equals(testTreeSet));
+
+            assert (externalContextAlbum.values().containsAll(mapValues));
+
+            // Set the write flag back as it should be
+            externalContextAlbum.getAlbumDefinition().setWritable(true);
+
+            // Put should return the previous contextItem
+            final TestExternalContextItem externalContextOther = new TestExternalContextItem();
+            externalContextOther.setTestExternalContextItem002(new TestContextItem002());
+            externalContextOther.getTestExternalContextItem002().setIntValue(2000);
+
+            assert (externalContextAlbum.put("externalContext", externalContextOther).equals(externalContext));
+            assert (((TestExternalContextItem) externalContextAlbum.get("externalContext"))
+                    .getTestExternalContextItem002().getIntValue() == 2000);
+            assert (externalContextAlbum.put("externalContext", externalContext).equals(externalContextOther));
+            assert (((TestExternalContextItem) externalContextAlbum.get("externalContext"))
+                    .getTestExternalContextItem002().getIntValue() == -1);
+
+            try {
+                externalContextAlbum.put("TestExternalContextItem00A", null);
+            } catch (final ContextRuntimeException e) {
+                assert (e.getMessage().equals(
+                        "album \"ExternalContextAlbum:0.0.1\" null values are illegal on key \"TestExternalContextItem00A\" for put()"));
+            }
+            assert (externalContextAlbum.get("externalContext").equals(externalContext));
+
+            try {
+                externalContextAlbum.put("TestExternalContextItemFFF", null);
+            } catch (final ContextRuntimeException e) {
+                assert (e.getMessage().equals(
+                        "album \"ExternalContextAlbum:0.0.1\" null values are illegal on key \"TestExternalContextItemFFF\" for put()"));
+            }
+            assert (externalContextAlbum.size() == 1);
+
+            try {
+                externalContextAlbum.put("TestExternalContextItemFFF", null);
+            } catch (final ContextRuntimeException e) {
+                assert (e.getMessage().equals(
+                        "album \"ExternalContextAlbum:0.0.1\" null values are illegal on key \"TestExternalContextItemFFF\" for put()"));
+            }
+            assert (externalContextAlbum.size() == 1);
+
+            // Should ignore remove
+            externalContextAlbum.remove("TestExternalContextItem017");
+            assert (externalContextAlbum.size() == 1);
+
+            assert (externalContextAlbum.values().size() == 1);
+            assert (externalContextAlbum.values().containsAll(mapValues));
+            // CHECKSTYLE:ON: checkstyle:magicNumber
+        } catch (final Exception e) {
+            e.printStackTrace();
+            contextDistributor.clear();
+            assert ("Test has failed".equals(""));
+        }
+
+        try {
+            contextDistributor.clear();
+        } catch (final Exception e) {
+            e.printStackTrace();
+            assert ("Test has failed".equals(""));
+        }
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java
new file mode 100644
index 0000000..d93f15e
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java
@@ -0,0 +1,155 @@
+/*-
+ * ============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.test.distribution;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.TimeZone;
+
+import org.onap.policy.apex.context.ContextAlbum;
+import org.onap.policy.apex.context.ContextRuntimeException;
+import org.onap.policy.apex.context.Distributor;
+import org.onap.policy.apex.context.impl.distribution.DistributorFactory;
+import org.onap.policy.apex.context.test.concepts.TestContextItem008;
+import org.onap.policy.apex.context.test.concepts.TestContextItem00A;
+import org.onap.policy.apex.context.test.concepts.TestContextItem00C;
+import org.onap.policy.apex.context.test.factory.TestContextAlbumFactory;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * The Class TestContextUpdate checks context updates.
+ *
+ * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
+ */
+public class ContextUpdate {
+    // Logger for this class
+    private static final XLogger LOGGER = XLoggerFactory.getXLogger(ContextUpdate.class);
+
+    /**
+     * Test context update.
+     *
+     * @throws ApexModelException the apex model exception
+     * @throws IOException the IO exception
+     * @throws ApexException the apex exception
+     */
+    public void testContextUpdate() throws ApexModelException, IOException, ApexException {
+        LOGGER.debug("Running TestContextUpdate test . . .");
+
+        final AxArtifactKey distributorKey = new AxArtifactKey("ApexDistributor", "0.0.1");
+        final Distributor contextDistributor = new DistributorFactory().getDistributor(distributorKey);
+
+        // @formatter:off
+        final AxArtifactKey[] usedArtifactStackArray = {
+                new AxArtifactKey("testC-top", "0.0.1"),
+                new AxArtifactKey("testC-next", "0.0.1"),
+                new AxArtifactKey("testC-bot", "0.0.1")
+        };
+        // @formatter:on
+
+        // CHECKSTYLE:OFF: checkstyle:magicNumber
+
+        final AxContextModel multiModel = TestContextAlbumFactory.createMultiAlbumsContextModel();
+        contextDistributor.registerModel(multiModel);
+
+        final ContextAlbum longContextAlbum =
+                contextDistributor.createContextAlbum(new AxArtifactKey("LongContextAlbum", "0.0.1"));
+        assert (longContextAlbum != null);
+        longContextAlbum.setUserArtifactStack(usedArtifactStackArray);
+
+        final ContextAlbum dateContextAlbum =
+                contextDistributor.createContextAlbum(new AxArtifactKey("DateContextAlbum", "0.0.1"));
+        assert (dateContextAlbum != null);
+        longContextAlbum.setUserArtifactStack(usedArtifactStackArray);
+
+        final ContextAlbum mapContextAlbum =
+                contextDistributor.createContextAlbum(new AxArtifactKey("MapContextAlbum", "0.0.1"));
+        assert (mapContextAlbum != null);
+        mapContextAlbum.setUserArtifactStack(usedArtifactStackArray);
+
+        final TestContextItem00A tciA = new TestContextItem00A();
+        tciA.setDateValue(new TestContextItem008(new Date()));
+        tciA.setTZValue(TimeZone.getTimeZone("Europe/Dublin").getDisplayName());
+        tciA.setDST(true);
+        tciA.setUTCOffset(-600);
+        tciA.setLocale(Locale.ENGLISH);
+
+        final Map<String, String> testHashMap = new HashMap<>();
+        testHashMap.put("0", "zero");
+        testHashMap.put("1", "one");
+        testHashMap.put("2", "two");
+        testHashMap.put("3", "three");
+        testHashMap.put("4", "four");
+
+        final TestContextItem00C tciC = new TestContextItem00C(testHashMap);
+
+        longContextAlbum.put("0", (long) 0);
+        longContextAlbum.put("0", 0);
+        longContextAlbum.put("0", "0");
+
+        try {
+            longContextAlbum.put("0", "zero");
+            assert ("Test should throw an exception".equals(""));
+        } catch (final ContextRuntimeException e) {
+            assert (e.getMessage().equals(
+                    "Failed to set context value for key \"0\" in album \"LongContextAlbum:0.0.1\": LongContextAlbum:0.0.1: object \"zero\" of class \"java.lang.String\" not compatible with class \"java.lang.Long\""));
+        }
+
+        try {
+            longContextAlbum.put("0", "");
+            assert ("Test should throw an exception".equals(""));
+        } catch (final ContextRuntimeException e) {
+            assert (e.getMessage().equals(
+                    "Failed to set context value for key \"0\" in album \"LongContextAlbum:0.0.1\": LongContextAlbum:0.0.1: object \"\" of class \"java.lang.String\" not compatible with class \"java.lang.Long\""));
+        }
+
+        try {
+            longContextAlbum.put("0", null);
+            assert ("Test should throw an exception".equals(""));
+        } catch (final ContextRuntimeException e) {
+            assert (e.getMessage()
+                    .equals("album \"LongContextAlbum:0.0.1\" null values are illegal on key \"0\" for put()"));
+        }
+
+        try {
+            longContextAlbum.put(null, null);
+            assert ("Test should throw an exception".equals(""));
+        } catch (final ContextRuntimeException e) {
+            assert (e.getMessage().equals("album \"LongContextAlbum:0.0.1\" null keys are illegal on keys for put()"));
+        }
+
+        assert (dateContextAlbum.put("date0", tciA) == null);
+        assert (dateContextAlbum.put("date0", tciA).equals(tciA));
+
+        assert (mapContextAlbum.put("map0", tciC) == null);
+        assert (mapContextAlbum.put("map0", tciC).equals(tciC));
+
+        contextDistributor.clear();
+        // CHECKSTYLE:ON: checkstyle:magicNumber
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java
new file mode 100644
index 0000000..28439b7
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java
@@ -0,0 +1,343 @@
+/*-
+ * ============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.test.distribution;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TimeZone;
+
+import org.onap.policy.apex.context.ContextAlbum;
+import org.onap.policy.apex.context.ContextException;
+import org.onap.policy.apex.context.Distributor;
+import org.onap.policy.apex.context.impl.distribution.DistributorFactory;
+import org.onap.policy.apex.context.test.concepts.TestContextItem000;
+import org.onap.policy.apex.context.test.concepts.TestContextItem001;
+import org.onap.policy.apex.context.test.concepts.TestContextItem002;
+import org.onap.policy.apex.context.test.concepts.TestContextItem003;
+import org.onap.policy.apex.context.test.concepts.TestContextItem004;
+import org.onap.policy.apex.context.test.concepts.TestContextItem005;
+import org.onap.policy.apex.context.test.concepts.TestContextItem006;
+import org.onap.policy.apex.context.test.concepts.TestContextItem007;
+import org.onap.policy.apex.context.test.concepts.TestContextItem008;
+import org.onap.policy.apex.context.test.concepts.TestContextItem009;
+import org.onap.policy.apex.context.test.concepts.TestContextItem00A;
+import org.onap.policy.apex.context.test.factory.TestContextAlbumFactory;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * The Class SequentialContextInstantiation checks sequential initiation of context.
+ *
+ * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
+ */
+public class SequentialContextInstantiation {
+    // Logger for this class
+    private static final XLogger LOGGER = XLoggerFactory.getXLogger(SequentialContextInstantiation.class);
+
+    /**
+     * Test sequential context instantiation.
+     *
+     * @throws ContextException the context exception
+     */
+    // CHECKSTYLE:OFF: checkstyle:MaximumMethodLength
+    public void testSequentialContextInstantiation() throws ContextException {
+        // CHECKSTYLE:ON: MaximumMethodLength
+        LOGGER.debug("Running TestContextInstantiation test . . .");
+
+        final AxArtifactKey distributorKey = new AxArtifactKey("ApexDistributor", "0.0.1");
+        Distributor contextDistributor = null;
+        try {
+            contextDistributor = new DistributorFactory().getDistributor(distributorKey);
+        } catch (final Exception e) {
+            e.printStackTrace();
+            assert ("Test has failed".equals(""));
+            return;
+        }
+
+        // @formatter:off
+       final AxArtifactKey[] usedArtifactStackArray = {
+                new AxArtifactKey("testC-top", "0.0.1"),
+                new AxArtifactKey("testC-next", "0.0.1"),
+                new AxArtifactKey("testC-bot", "0.0.1")
+                };
+       // @formatter:on
+
+        try {
+            // CHECKSTYLE:OFF: checkstyle:magicNumber
+            final AxContextModel multiModel = TestContextAlbumFactory.createMultiAlbumsContextModel();
+            contextDistributor.registerModel(multiModel);
+
+            final ContextAlbum dateAlbum =
+                    contextDistributor.createContextAlbum(new AxArtifactKey("DateContextAlbum", "0.0.1"));
+            assert (dateAlbum != null);
+            dateAlbum.setUserArtifactStack(usedArtifactStackArray);
+
+            final Date testDate = new Date();
+
+            final TestContextItem00A tciA00 = new TestContextItem00A();
+            tciA00.setDateValue(new TestContextItem008(new Date()));
+            tciA00.setTZValue(TimeZone.getTimeZone("Europe/Dublin").getDisplayName());
+            tciA00.setDST(true);
+            tciA00.setUTCOffset(-600);
+            tciA00.setLocale(Locale.ENGLISH);
+
+            dateAlbum.put("dv0", tciA00);
+            assert (tciA00.equals(dateAlbum.get("dv0")));
+
+            dateAlbum.put("dv1", tciA00);
+            assert (tciA00.equals(dateAlbum.get("dv1")));
+
+            final TestContextItem009 tci9 = new TestContextItem009();
+            tci9.setDateValue(new TestContextItem008(testDate));
+            tci9.setTZValue(TimeZone.getTimeZone("Europe/Dublin").getDisplayName());
+            tci9.setDST(true);
+
+            try {
+                dateAlbum.put("tci9", tci9);
+            } catch (final Exception e) {
+                assert (e.getMessage().contains(
+                        "class \"org.onap.policy.apex.context.test.concepts.TestContextItem009\" not compatible with class \"org.onap.policy.apex.context.test.concepts.TestContextItem00A\""));
+            }
+
+            final TestContextItem00A tciA01 = new TestContextItem00A(tciA00);
+            final TestContextItem00A tciA02 = new TestContextItem00A(tciA00);
+            final TestContextItem00A tciA03 = new TestContextItem00A(tciA00);
+
+            final Map<String, Object> valueMap0 = new HashMap<>();
+            valueMap0.put("Item01", tciA01);
+            valueMap0.put("Item02", tciA02);
+            valueMap0.put("Item03", tciA03);
+
+            dateAlbum.putAll(valueMap0);
+            assert (dateAlbum.size() == 5);
+            assert (tciA01.equals(dateAlbum.get("Item01")));
+            assert (tciA02.equals(dateAlbum.get("Item02")));
+            assert (tciA03.equals(dateAlbum.get("Item03")));
+
+            final Float testFloat = new Float(3.14159265359);
+
+            final TestContextItem000 testBadItem000 = new TestContextItem000();
+            final TestContextItem001 testBadItem001 = new TestContextItem001();
+            final TestContextItem002 testBadItem002 = new TestContextItem002();
+            final TestContextItem003 testBadItem003 = new TestContextItem003();
+            final TestContextItem004 testBadItem004 = new TestContextItem004();
+            final TestContextItem005 testBadItem005 = new TestContextItem005();
+            final TestContextItem006 testBadItem006 = new TestContextItem006();
+            final TestContextItem007 testBadItem007 = new TestContextItem007();
+            final TestContextItem008 testBadItem008 = new TestContextItem008();
+
+            testBadItem000.setFlag(false);
+            testBadItem001.setByteValue((byte) 0xFF);
+            testBadItem002.setIntValue(0xFFFFFFFF);
+            testBadItem003.setLongValue(0xFFFFFFFFFFFFFFFFL);
+            testBadItem004.setFloatValue(testFloat);
+            testBadItem005.setDoubleValue(Math.PI);
+            testBadItem006.setStringValue("This is a global context string");
+            testBadItem007.setLongValue(testDate.getTime());
+            testBadItem008.setDateValue(testDate);
+
+            final Map<String, Object> valueMap1 = new HashMap<>();
+            valueMap1.put("TestBadItem000", testBadItem000);
+            valueMap1.put("TestBadItem001", testBadItem001);
+            valueMap1.put("TestBadItem002", testBadItem002);
+            valueMap1.put("TestBadItem003", testBadItem003);
+            valueMap1.put("TestBadItem004", testBadItem004);
+            valueMap1.put("TestBadItem005", testBadItem005);
+            valueMap1.put("TestBadItem006", testBadItem006);
+            valueMap1.put("TestBadItem007", testBadItem007);
+            valueMap1.put("TestBadItem008", testBadItem008);
+            valueMap1.put("TestBadItem009", tci9);
+            valueMap1.put("Item00_2", tciA00);
+
+            // Get another reference to the album
+            final ContextAlbum dateAlbum1 =
+                    contextDistributor.createContextAlbum(new AxArtifactKey("DateContextAlbum", "0.0.1"));
+            assert (dateAlbum1 != null);
+            dateAlbum1.setUserArtifactStack(usedArtifactStackArray);
+
+            try {
+                dateAlbum1.putAll(valueMap1);
+            } catch (final Exception e) {
+                assert (e.getMessage().endsWith(
+                        "not compatible with class \"org.onap.policy.apex.context.test.concepts.TestContextItem00A\""));
+            }
+            assert (dateAlbum1.size() == 5);
+
+            valueMap1.clear();
+            valueMap1.put("Item00_2", tciA00);
+            dateAlbum1.putAll(valueMap1);
+            assert (dateAlbum1.size() == 6);
+
+            assert (tciA00.equals(dateAlbum1.get("Item00_2")));
+            dateAlbum.remove("Item00_2");
+            assert (5 == dateAlbum1.size());
+
+            final ContextAlbum dateAlbumCopy =
+                    contextDistributor.createContextAlbum(new AxArtifactKey("DateContextAlbum", "0.0.1"));
+            assert (dateAlbumCopy != null);
+            dateAlbumCopy.setUserArtifactStack(usedArtifactStackArray);
+
+            final Map<String, Object> valueMap2 = new HashMap<>();
+            valueMap2.put("Item04", tciA01);
+            valueMap2.put("Item05", tciA02);
+            valueMap2.put("Item06", tciA03);
+
+            dateAlbumCopy.putAll(valueMap2);
+            assert (8 == dateAlbumCopy.size());
+            assert (tciA03.equals(dateAlbumCopy.get("Item06")));
+
+            final Collection<Object> mapValues = dateAlbum.values();
+            assert (dateAlbumCopy.values().containsAll(mapValues));
+
+            // Check that clearing works
+            dateAlbum1.clear();
+            assert (dateAlbum1.size() == 0);
+
+            dateAlbum.put("Item00", tciA00);
+            final Map<String, Object> valueMap3 = new HashMap<>();
+            valueMap3.put("Item01", tciA01);
+            valueMap3.put("Item02", tciA02);
+            valueMap3.put("Item03", tciA03);
+            dateAlbum.putAll(valueMap3);
+
+            final Map<String, Object> valueMap4 = new HashMap<>();
+            valueMap4.put("Item04", tciA01);
+            valueMap4.put("Item05", tciA02);
+            valueMap4.put("Item06", tciA03);
+
+            dateAlbumCopy.putAll(valueMap4);
+
+            try {
+                dateAlbum.containsKey(null);
+            } catch (final Exception e) {
+                assert (e.getMessage().equals("null values are illegal on method parameter \"key\""));
+            }
+
+            for (final Entry<String, Object> entry : dateAlbum.entrySet()) {
+                System.out.println(entry.getKey() + "->" + entry.getValue());
+            }
+            assert (dateAlbum.containsKey("Item05"));
+            assert (!dateAlbum.containsKey("Item07"));
+
+            try {
+                dateAlbum.containsValue(null);
+            } catch (final Exception e) {
+                assert (e.getMessage().equals("null values are illegal on method parameter \"value\""));
+            }
+
+            assert (dateAlbum.containsValue(tciA01));
+            assert (!dateAlbum.containsValue(new String("Hello")));
+
+            final Set<Entry<String, Object>> entrySet = dateAlbum.entrySet();
+            assert (entrySet.size() == 7);
+
+            try {
+                assert (dateAlbum.get(null) == null);
+            } catch (final Exception e) {
+                assert (e.getMessage()
+                        .equals("album \"DateContextAlbum:0.0.1\" null keys are illegal on keys for get()"));
+            }
+
+            final Object aObject = dateAlbum.get("Item03");
+            assert (aObject.equals(tciA03));
+
+            try {
+                assert (dateAlbum.put(null, null) == null);
+            } catch (final Exception e) {
+                assert (e.getMessage()
+                        .equals("album \"DateContextAlbum:0.0.1\" null keys are illegal on keys for put()"));
+            }
+
+            // Put null ContextItem should work (return null)
+            try {
+                dateAlbum.put("ItemNull", null);
+            } catch (final Exception e) {
+                assert (e.getMessage().equals(
+                        "album \"DateContextAlbum:0.0.1\" null values are illegal on key \"ItemNull\" for put()"));
+            }
+
+            // Should return null
+            assert (dateAlbum.get("ItemNull") == null);
+
+            // Put should return the previous contextItem
+            tciA00.setDST(false);
+            final TestContextItem00A tciA03_clone = new TestContextItem00A(tciA03);
+            tciA03_clone.setDST(true);
+            TestContextItem00A retItem = (TestContextItem00A) dateAlbum.put("Item03", tciA03_clone);
+            assert (retItem.equals(tciA03));
+            retItem = (TestContextItem00A) dateAlbum.put("Item03", tciA03);
+            assert (retItem.equals(tciA03_clone));
+
+            try {
+                dateAlbum.put("ItemNull", null);
+                assert (dateAlbum.get("ItemNull") == null);
+            } catch (final Exception e) {
+                assert (e.getMessage().equals(
+                        "album \"DateContextAlbum:0.0.1\" null values are illegal on key \"ItemNull\" for put()"));
+            }
+
+            dateAlbum.put("TestAA", tciA00);
+            assert (dateAlbum.get("TestAA").equals(tciA00));
+
+            // Should print warning
+            try {
+                dateAlbum.put("TestAA", null);
+            } catch (final Exception e) {
+                assert (e.getMessage().equals(
+                        "album \"DateContextAlbum:0.0.1\" null values are illegal on key \"TestAA\" for put()"));
+            }
+            assert (dateAlbum.size() == 8);
+            try {
+                dateAlbum.put("TestAB", null);
+            } catch (final Exception e) {
+                assert (e.getMessage().equals(
+                        "album \"DateContextAlbum:0.0.1\" null values are illegal on key \"TestAB\" for put()"));
+            }
+            assert (dateAlbum.size() == 8);
+
+            // Should do removes
+            dateAlbum.remove("TestAA");
+            dateAlbum.remove("TestAB");
+            dateAlbum.remove("ItemNull");
+            assert (dateAlbum.size() == 7);
+            assert (dateAlbumCopy.values().containsAll(mapValues));
+            // CHECKSTYLE:ON: checkstyle:magicNumber
+        } catch (final Exception e) {
+            e.printStackTrace();
+            contextDistributor.clear();
+            assert ("Test has failed".equals(""));
+        }
+
+        try {
+            contextDistributor.clear();
+        } catch (final Exception e) {
+            e.printStackTrace();
+            assert ("Test has failed".equals(""));
+        }
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/distribution/package-info.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/distribution/package-info.java
new file mode 100644
index 0000000..148c8ca
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/distribution/package-info.java
@@ -0,0 +1,27 @@
+/*-
+ * ============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=========================================================
+ */
+
+/**
+ * Runs context distribution tests in APEX.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+
+package org.onap.policy.apex.context.test.distribution;
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/factory/TestContextAlbumFactory.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/factory/TestContextAlbumFactory.java
new file mode 100644
index 0000000..64de009
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/factory/TestContextAlbumFactory.java
@@ -0,0 +1,189 @@
+/*-
+ * ============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.test.factory;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
+
+/**
+ * The Class TestContextAlbumFactory creates test context albums.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public final class TestContextAlbumFactory {
+    /**
+     * Default constructor to prevent sub-classing.
+     */
+    private TestContextAlbumFactory() {}
+
+    /**
+     * Creates the policy context model.
+     *
+     * @return the ax context model
+     */
+    public static AxContextModel createPolicyContextModel() {
+        final AxContextSchema policySchema = new AxContextSchema(new AxArtifactKey("PolicySchema", "0.0.1"), "Java",
+                "org.onap.policy.apex.context.test.concepts.TestPolicyContextItem");
+        final AxContextAlbum albumDefinition = new AxContextAlbum(new AxArtifactKey("PolicyContextAlbum", "0.0.1"),
+                "APPLICATION", true, policySchema.getKey());
+
+        final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1"));
+        schemas.getSchemasMap().put(policySchema.getKey(), policySchema);
+        final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("context", "0.0.1"));
+        albums.getAlbumsMap().put(albumDefinition.getKey(), albumDefinition);
+
+        final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
+        final AxContextModel contextModel =
+                new AxContextModel(new AxArtifactKey("PolicyContextModel", "0.0.1"), schemas, albums, keyInformation);
+        contextModel.setKeyInformation(keyInformation);
+        keyInformation.generateKeyInfo(contextModel);
+
+        return contextModel;
+    }
+
+    /**
+     * Creates the global context model.
+     *
+     * @return the ax context model
+     */
+    public static AxContextModel createGlobalContextModel() {
+        final AxContextSchema globalSchema = new AxContextSchema(new AxArtifactKey("GlobalSchema", "0.0.1"), "Java",
+                "org.onap.policy.apex.context.test.concepts.TestGlobalContextItem");
+        final AxContextAlbum albumDefinition = new AxContextAlbum(new AxArtifactKey("GlobalContextAlbum", "0.0.1"),
+                "GLOBAL", true, globalSchema.getKey());
+
+        final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1"));
+        schemas.getSchemasMap().put(globalSchema.getKey(), globalSchema);
+        final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("context", "0.0.1"));
+        albums.getAlbumsMap().put(albumDefinition.getKey(), albumDefinition);
+
+        final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
+        final AxContextModel contextModel =
+                new AxContextModel(new AxArtifactKey("GlobalContextModel", "0.0.1"), schemas, albums, keyInformation);
+        contextModel.setKeyInformation(keyInformation);
+        keyInformation.generateKeyInfo(contextModel);
+
+        return contextModel;
+    }
+
+    /**
+     * Creates the external context model.
+     *
+     * @return the ax context model
+     */
+    public static AxContextModel createExternalContextModel() {
+        final AxContextSchema externalSchema = new AxContextSchema(new AxArtifactKey("ExternalSchema", "0.0.1"), "Java",
+                "org.onap.policy.apex.context.test.concepts.TestExternalContextItem");
+        final AxContextAlbum albumDefinition = new AxContextAlbum(new AxArtifactKey("ExternalContextAlbum", "0.0.1"),
+                "EXTERNAL", true, externalSchema.getKey());
+
+        final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1"));
+        schemas.getSchemasMap().put(externalSchema.getKey(), externalSchema);
+        final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("context", "0.0.1"));
+        albums.getAlbumsMap().put(albumDefinition.getKey(), albumDefinition);
+
+        final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
+        final AxContextModel contextModel =
+                new AxContextModel(new AxArtifactKey("ExternalContextModel", "0.0.1"), schemas, albums, keyInformation);
+        contextModel.setKeyInformation(keyInformation);
+        keyInformation.generateKeyInfo(contextModel);
+
+        return contextModel;
+    }
+
+    /**
+     * Creates the long context model.
+     *
+     * @return the ax context model
+     */
+    public static AxContextModel createLongContextModel() {
+        final AxContextSchema longSchema =
+                new AxContextSchema(new AxArtifactKey("LongSchema", "0.0.1"), "Java", "java.lang.Long");
+        final AxContextAlbum albumDefinition1 = new AxContextAlbum(new AxArtifactKey("LongContextAlbum1", "0.0.1"),
+                "APPLICATION", true, longSchema.getKey());
+        final AxContextAlbum albumDefinition2 = new AxContextAlbum(new AxArtifactKey("LongContextAlbum2", "0.0.1"),
+                "APPLICATION", true, longSchema.getKey());
+
+        final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1"));
+        schemas.getSchemasMap().put(longSchema.getKey(), longSchema);
+        final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("context", "0.0.1"));
+        albums.getAlbumsMap().put(albumDefinition1.getKey(), albumDefinition1);
+        albums.getAlbumsMap().put(albumDefinition2.getKey(), albumDefinition2);
+
+        final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
+        final AxContextModel contextModel =
+                new AxContextModel(new AxArtifactKey("LongContextModel", "0.0.1"), schemas, albums, keyInformation);
+        contextModel.setKeyInformation(keyInformation);
+        keyInformation.generateKeyInfo(contextModel);
+
+        return contextModel;
+    }
+
+    /**
+     * Creates the multi albums context model.
+     *
+     * @return the ax context model
+     */
+    public static AxContextModel createMultiAlbumsContextModel() {
+        final AxContextSchema longSchema =
+                new AxContextSchema(new AxArtifactKey("LongSchema", "0.0.1"), "Java", "java.lang.Long");
+        final AxContextSchema lTypeSchema = new AxContextSchema(new AxArtifactKey("LTypeSchema", "0.0.1"), "Java",
+                "org.onap.policy.apex.context.test.concepts.TestContextItem003");
+        final AxContextSchema dateSchema = new AxContextSchema(new AxArtifactKey("DateSchema", "0.0.1"), "Java",
+                "org.onap.policy.apex.context.test.concepts.TestContextItem00A");
+        final AxContextSchema mapSchema = new AxContextSchema(new AxArtifactKey("MapSchema", "0.0.1"), "Java",
+                "org.onap.policy.apex.context.test.concepts.TestContextItem00C");
+
+        final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1"));
+        schemas.getSchemasMap().put(longSchema.getKey(), longSchema);
+        schemas.getSchemasMap().put(lTypeSchema.getKey(), lTypeSchema);
+        schemas.getSchemasMap().put(dateSchema.getKey(), dateSchema);
+        schemas.getSchemasMap().put(mapSchema.getKey(), mapSchema);
+
+        final AxContextAlbum longAlbumDefinition = new AxContextAlbum(new AxArtifactKey("LongContextAlbum", "0.0.1"),
+                "APPLICATION", true, longSchema.getKey());
+        final AxContextAlbum lTypeAlbumDefinition = new AxContextAlbum(new AxArtifactKey("LTypeContextAlbum", "0.0.1"),
+                "APPLICATION", true, lTypeSchema.getKey());
+        final AxContextAlbum dateAlbumDefinition = new AxContextAlbum(new AxArtifactKey("DateContextAlbum", "0.0.1"),
+                "APPLICATION", true, dateSchema.getKey());
+        final AxContextAlbum mapAlbumDefinition = new AxContextAlbum(new AxArtifactKey("MapContextAlbum", "0.0.1"),
+                "APPLICATION", true, mapSchema.getKey());
+
+        final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("context", "0.0.1"));
+        albums.getAlbumsMap().put(longAlbumDefinition.getKey(), longAlbumDefinition);
+        albums.getAlbumsMap().put(lTypeAlbumDefinition.getKey(), lTypeAlbumDefinition);
+        albums.getAlbumsMap().put(dateAlbumDefinition.getKey(), dateAlbumDefinition);
+        albums.getAlbumsMap().put(mapAlbumDefinition.getKey(), mapAlbumDefinition);
+
+        final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
+        final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("MultiAlbumsContextModel", "0.0.1"),
+                schemas, albums, keyInformation);
+        contextModel.setKeyInformation(keyInformation);
+        keyInformation.generateKeyInfo(contextModel);
+
+        return contextModel;
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/factory/package-info.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/factory/package-info.java
new file mode 100644
index 0000000..ea70ce2
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/factory/package-info.java
@@ -0,0 +1,27 @@
+/*-
+ * ============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=========================================================
+ */
+
+/**
+ * Contains factories for creating test context albums.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+
+package org.onap.policy.apex.context.test.factory;
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java
new file mode 100644
index 0000000..971d0c4
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java
@@ -0,0 +1,194 @@
+/*-
+ * ============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.test.locking;
+
+import java.io.IOException;
+
+import org.onap.policy.apex.context.ContextAlbum;
+import org.onap.policy.apex.context.ContextException;
+import org.onap.policy.apex.context.Distributor;
+import org.onap.policy.apex.context.impl.distribution.DistributorFactory;
+import org.onap.policy.apex.context.test.concepts.TestContextItem003;
+import org.onap.policy.apex.context.test.factory.TestContextAlbumFactory;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * The Class TestConcurrentContext tests concurrent use of context.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class ConcurrentContext {
+    private static final int TEN_MILLISECONDS = 10;
+
+    // Logger for this class
+    private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContext.class);
+
+    // The context distributor and map used by each test
+    private Distributor contextDistributor = null;
+    private ContextAlbum lTypeAlbum = null;
+
+    /**
+     * Test concurrent context.
+     *
+     * @param testType the test type
+     * @param jvmCount the jvm count
+     * @param threadCount the thread count
+     * @param threadLoops the thread loops
+     * @return the long
+     * @throws ApexModelException the apex model exception
+     * @throws IOException the IO exception
+     * @throws ApexException the apex exception
+     */
+    public long testConcurrentContext(final String testType, final int jvmCount, final int threadCount,
+            final int threadLoops) throws ApexModelException, IOException, ApexException {
+        final ConcurrentContext concurrentContext = new ConcurrentContext();
+
+        try {
+            concurrentContext.setupAndVerifyContext();
+        } catch (final Exception e) {
+            e.printStackTrace();
+            throw e;
+        }
+
+        LOGGER.debug("starting JVMs and threads . . .");
+
+        final Thread[] threadArray = new Thread[threadCount];
+
+        // Check if we have a single JVM or multiple JVMs
+        int runningThreadCount = -1;
+        if (jvmCount == 1) {
+            // Run everything in this JVM
+            for (int t = 0; t < threadCount; t++) {
+                threadArray[t] = new Thread(new ConcurrentContextThread(0, t, threadLoops));
+                threadArray[t].setName(testType + ":TestConcurrentContextThread_0_" + t);
+                threadArray[t].start();
+            }
+
+            runningThreadCount = threadCount;
+        } else {
+            // Spawn JVMs to run the tests
+            for (int j = 0; j < jvmCount; j++) {
+                threadArray[j] = new Thread(new ConcurrentContextJVMThread(testType, j, threadCount, threadLoops));
+                threadArray[j].setName(testType + ":TestConcurrentContextJVMThread_" + j);
+                threadArray[j].start();
+            }
+            runningThreadCount = jvmCount;
+        }
+
+        boolean allFinished;
+        do {
+            allFinished = true;
+            for (int i = 0; i < runningThreadCount; i++) {
+                if (threadArray[i].isAlive()) {
+                    allFinished = false;
+                    try {
+                        Thread.sleep(TEN_MILLISECONDS);
+                    } catch (final Exception e) {
+                    }
+                    break;
+                }
+            }
+        } while (!allFinished);
+
+        return concurrentContext.verifyAndClearContext(jvmCount, threadCount, threadLoops);
+    }
+
+    /**
+     * Setup and verify context.
+     *
+     * @throws ContextException the context exception
+     */
+    private void setupAndVerifyContext() throws ContextException {
+        final AxArtifactKey distributorKey = new AxArtifactKey("ApexDistributor", "0.0.1");
+        contextDistributor = new DistributorFactory().getDistributor(distributorKey);
+
+        // @formatter:off
+        final AxArtifactKey[] usedArtifactStackArray = {
+                new AxArtifactKey("testC-top", "0.0.1"),
+                new AxArtifactKey("testC-next", "0.0.1"),
+                new AxArtifactKey("testC-bot", "0.0.1")
+                };
+        // @formatter:on
+
+        final AxContextModel albumsModel = TestContextAlbumFactory.createMultiAlbumsContextModel();
+        contextDistributor.registerModel(albumsModel);
+
+        lTypeAlbum = contextDistributor.createContextAlbum(new AxArtifactKey("LTypeContextAlbum", "0.0.1"));
+        assert (lTypeAlbum != null);
+        lTypeAlbum.setUserArtifactStack(usedArtifactStackArray);
+
+        // CHECKSTYLE:OFF: checkstyle:magicNumber
+        lTypeAlbum.put("lTypeValue0", new TestContextItem003(0xFFFFFFFFFFFFFFFFL));
+        lTypeAlbum.put("lTypeValue1", new TestContextItem003(0xFFFFFFFFFFFFFFFEL));
+        lTypeAlbum.put("lTypeValue2", new TestContextItem003(0xFFFFFFFFFFFFFFFDL));
+        lTypeAlbum.put("lTypeValue3", new TestContextItem003(0xFFFFFFFFFFFFFFFCL));
+        lTypeAlbum.put("lTypeValue4", new TestContextItem003(0xFFFFFFFFFFFFFFFBL));
+        lTypeAlbum.put("lTypeValue5", new TestContextItem003(0xFFFFFFFFFFFFFFFAL));
+        lTypeAlbum.put("lTypeValue6", new TestContextItem003(0xFFFFFFFFFFFFFFF9L));
+        lTypeAlbum.put("lTypeValue7", new TestContextItem003(0xFFFFFFFFFFFFFFF8L));
+        lTypeAlbum.put("lTypeValue8", new TestContextItem003(0xFFFFFFFFFFFFFFF7L));
+        lTypeAlbum.put("lTypeValue9", new TestContextItem003(0xFFFFFFFFFFFFFFF6L));
+        lTypeAlbum.put("lTypeValueA", new TestContextItem003(0xFFFFFFFFFFFFFFF5L));
+        lTypeAlbum.put("lTypeValueB", new TestContextItem003(0xFFFFFFFFFFFFFFF4L));
+        lTypeAlbum.put("lTypeValueC", new TestContextItem003(0xFFFFFFFFFFFFFFF3L));
+        lTypeAlbum.put("lTypeValueD", new TestContextItem003(0xFFFFFFFFFFFFFFF2L));
+        lTypeAlbum.put("lTypeValueE", new TestContextItem003(0xFFFFFFFFFFFFFFF1L));
+        lTypeAlbum.put("lTypeValueF", new TestContextItem003(0xFFFFFFFFFFFFFFF0L));
+        LOGGER.debug(lTypeAlbum.toString());
+        assert (lTypeAlbum.size() >= 16);
+        // CHECKSTYLE:ON: checkstyle:magicNumber
+
+        // The initial value for concurrent testing
+        final TestContextItem003 item = new TestContextItem003(0L);
+        lTypeAlbum.put("testValue", item);
+
+    }
+
+    /**
+     * Verify and clear context.
+     *
+     * @param jvmCount the jvm count
+     * @param threadCount the thread count
+     * @param threadLoops the thread loops
+     * @return the long
+     * @throws ContextException the context exception
+     */
+    private long verifyAndClearContext(final int jvmCount, final int threadCount, final int threadLoops)
+            throws ContextException {
+        try {
+            LOGGER.debug("threads finished, end value is {}",
+                    ((TestContextItem003) lTypeAlbum.get("testValue")).getLongValue());
+        } catch (final Exception e) {
+            e.printStackTrace();
+        }
+        final long total = ((TestContextItem003) lTypeAlbum.get("testValue")).getLongValue();
+
+        contextDistributor.clear();
+        contextDistributor = null;
+
+        return total;
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJVM.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJVM.java
new file mode 100644
index 0000000..0145bd1
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJVM.java
@@ -0,0 +1,219 @@
+/*-
+ * ============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.test.locking;
+
+import com.google.gson.Gson;
+
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Map.Entry;
+import java.util.TreeSet;
+
+import org.onap.policy.apex.context.ContextAlbum;
+import org.onap.policy.apex.context.Distributor;
+import org.onap.policy.apex.context.impl.distribution.DistributorFactory;
+import org.onap.policy.apex.context.test.factory.TestContextAlbumFactory;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.service.AbstractParameters;
+import org.onap.policy.apex.model.basicmodel.service.ParameterService;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * The Class ConcurrentContextJVM tests concurrent use of context in a single JVM.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public final class ConcurrentContextJVM {
+    // Logger for this class
+    private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContextJVM.class);
+
+    private static final int TEN_MILLISECONDS = 10;
+    private static final int IPV4_ADDRESS_LENGTH = 4;
+
+    /**
+     * The Constructor.
+     *
+     * @param testType the test type
+     * @param jvmNo the jvm no
+     * @param threadCount the thread count
+     * @param threadLoops the thread loops
+     * @throws ApexException the apex exception
+     */
+    private ConcurrentContextJVM(final String testType, final int jvmNo, final int threadCount, final int threadLoops)
+            throws ApexException {
+        super();
+        LOGGER.debug("starting JVMs and threads . . .");
+
+        final AxArtifactKey distributorKey = new AxArtifactKey("ApexDistributor" + jvmNo, "0.0.1");
+        final Distributor contextDistributor = new DistributorFactory().getDistributor(distributorKey);
+
+        // @formatter:off
+        final AxArtifactKey[] usedArtifactStackArray = {
+                new AxArtifactKey("testC-top", "0.0.1"),
+                new AxArtifactKey("testC-next", "0.0.1"),
+                new AxArtifactKey("testC-bot", "0.0.1")
+                };
+        // @formatter:on
+
+        final AxContextModel albumsModel = TestContextAlbumFactory.createMultiAlbumsContextModel();
+        contextDistributor.registerModel(albumsModel);
+
+        final ContextAlbum lTypeAlbum =
+                contextDistributor.createContextAlbum(new AxArtifactKey("LTypeContextAlbum", "0.0.1"));
+        assert (lTypeAlbum != null);
+        lTypeAlbum.setUserArtifactStack(usedArtifactStackArray);
+
+        final Thread[] threadArray = new Thread[threadCount];
+
+        for (int t = 0; t < threadCount; t++) {
+            threadArray[t] = new Thread(new ConcurrentContextThread(jvmNo, t, threadLoops));
+            threadArray[t].setName(testType + ":ConcurrentContextThread_" + jvmNo + "_" + t);
+            threadArray[t].start();
+            LOGGER.debug("started thread " + threadArray[t].getName());
+        }
+
+        boolean allFinished;
+        do {
+            allFinished = true;
+            for (int t = 0; t < threadCount; t++) {
+                if (threadArray[t].isAlive()) {
+                    allFinished = false;
+                    try {
+                        Thread.sleep(TEN_MILLISECONDS);
+                    } catch (final Exception e) {
+                    }
+                    break;
+                }
+            }
+        } while (!allFinished);
+
+        LOGGER.debug("threads finished, end value is {}", lTypeAlbum.get("testValue"));
+        contextDistributor.clear();
+    }
+
+    /**
+     * The main method.
+     *
+     * @param args the args
+     * @throws Exception Any exception thrown by the test code
+     */
+    @SuppressWarnings("unchecked")
+    public static void main(final String[] args) throws Exception {
+        configure();
+
+        System.out.println("JVM Arguments: " + Arrays.toString(args));
+        // CHECKSTYLE:OFF: checkstyle:magicNumber
+
+        // An even number of arguments greater than 3
+        if (args.length < 4 || (args.length % 2 != 0)) {
+            LOGGER.error("invalid arguments: " + Arrays.toString(args));
+            LOGGER.error(
+                    "usage: TestConcurrentContextJVM testType jvmNo threadCount threadLoops [parameterKey parameterJson].... ");
+            return;
+        }
+
+        int jvmNo = -1;
+        int threadCount = -1;
+        int threadLoops = -1;
+
+        try {
+            jvmNo = Integer.parseInt(args[1]);
+        } catch (final Exception e) {
+            LOGGER.error("invalid argument jvmNo", e);
+            return;
+        }
+
+        try {
+            threadCount = Integer.parseInt(args[2]);
+        } catch (final Exception e) {
+            LOGGER.error("invalid argument threadCount", e);
+            return;
+        }
+
+        try {
+            threadLoops = Integer.parseInt(args[3]);
+        } catch (final Exception e) {
+            LOGGER.error("invalid argument threadLoops", e);
+            return;
+        }
+
+        for (int p = 4; p < args.length - 1; p += 2) {
+            @SuppressWarnings("rawtypes")
+            final Class parametersClass = Class.forName(args[p]);
+            final AbstractParameters parameters =
+                    (AbstractParameters) new Gson().fromJson(args[p + 1], parametersClass);
+            ParameterService.registerParameters(parametersClass, parameters);
+        }
+
+        for (final Entry<Class<?>, AbstractParameters> parameterEntry : ParameterService.getAll()) {
+            LOGGER.info("Parameter class " + parameterEntry.getKey().getCanonicalName() + "="
+                    + parameterEntry.getValue().toString());
+        }
+
+        try {
+            new ConcurrentContextJVM(args[0], jvmNo, threadCount, threadLoops);
+        } catch (final Exception e) {
+            LOGGER.error("error running test in JVM", e);
+            return;
+        }
+        // CHECKSTYLE:ON: checkstyle:magicNumber
+    }
+
+    /**
+     * This method setus up any static configuration required by the JVM.
+     *
+     * @throws Exception on configuration errors
+     */
+    public static void configure() throws Exception {
+        System.setProperty("java.net.preferIPv4Stack", "true");
+        System.setProperty("hazelcast.config", "src/test/resources/hazelcast/hazelcast.xml");
+
+        // The JGroups IP address must be set to a real (not loopback) IP address for Infinispan to work. IN order to
+        // ensure that all
+        // the JVMs in a test pick up the same IP address, this function sets te address to be the first non-loopback
+        // IPv4 address
+        // on a host
+        final TreeSet<String> ipAddressSet = new TreeSet<String>();
+
+        final Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
+        for (final NetworkInterface netint : Collections.list(nets)) {
+            final Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();
+            for (final InetAddress inetAddress : Collections.list(inetAddresses)) {
+                // Look for real IPv4 Internet addresses
+                if (!inetAddress.isLoopbackAddress() && inetAddress.getAddress().length == IPV4_ADDRESS_LENGTH) {
+                    ipAddressSet.add(inetAddress.getHostAddress());
+                }
+            }
+        }
+
+        if (ipAddressSet.size() == 0) {
+            throw new Exception("cound not find real IP address for test");
+        }
+        System.out.println("Setting jgroups.tcp.address to: " + ipAddressSet.first());
+        System.setProperty("jgroups.tcp.address", ipAddressSet.first());
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJVMThread.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJVMThread.java
new file mode 100644
index 0000000..0f82341
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJVMThread.java
@@ -0,0 +1,123 @@
+/*-
+ * ============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.test.locking;
+
+import com.google.gson.Gson;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map.Entry;
+
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.service.AbstractParameters;
+import org.onap.policy.apex.model.basicmodel.service.ParameterService;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * The Class TestConcurrentContextThread tests concurrent use of context.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class ConcurrentContextJVMThread implements Runnable {
+    // Logger for this class
+    private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContextJVMThread.class);
+
+    private final String testType;
+    private final int jvm;
+    private final int threadCount;
+    private final int target;
+
+    /**
+     * The Constructor.
+     *
+     * @param testType the test type
+     * @param jvm the jvm
+     * @param threadCount the thread count
+     * @param target the target
+     * @throws ApexException the apex exception
+     */
+    public ConcurrentContextJVMThread(final String testType, final int jvm, final int threadCount, final int target)
+            throws ApexException {
+        this.testType = testType;
+        this.jvm = jvm;
+        this.threadCount = threadCount;
+        this.target = target;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Runnable#run()
+     */
+    @Override
+    public void run() {
+        final List<String> commandList = new ArrayList<>();
+        commandList.add(System.getProperty("java.home") + System.getProperty("file.separator") + "bin"
+                + System.getProperty("file.separator") + "java");
+        commandList.add("-cp");
+        commandList.add(System.getProperty("java.class.path"));
+        commandList.add("org.onap.policy.apex.context.test.locking.ConcurrentContextJVM");
+        commandList.add(testType);
+        commandList.add(new Integer(jvm).toString());
+        commandList.add(new Integer(threadCount).toString());
+        commandList.add(new Integer(target).toString());
+
+        for (final Entry<Class<?>, AbstractParameters> parameterServiceEntry : ParameterService.getAll()) {
+            commandList.add(parameterServiceEntry.getKey().getCanonicalName());
+            commandList.add(new Gson().toJson(parameterServiceEntry.getValue()));
+        }
+
+        LOGGER.info("starting JVM " + jvm);
+
+        // Run the JVM
+        final ProcessBuilder processBuilder = new ProcessBuilder(commandList);
+        processBuilder.redirectErrorStream(true);
+        Process process;
+
+        try {
+            process = processBuilder.start();
+
+            final InputStream is = process.getInputStream();
+            final InputStreamReader isr = new InputStreamReader(is);
+            final BufferedReader br = new BufferedReader(isr);
+            String line;
+            LOGGER.info("JVM Output for command " + commandList + "\n");
+            while ((line = br.readLine()) != null) {
+                LOGGER.info(line);
+            }
+
+            // Wait to get exit value
+            try {
+                final int exitValue = process.waitFor();
+                LOGGER.info("\n\nJVM " + jvm + " finished, exit value is " + exitValue);
+            } catch (final InterruptedException e) {
+                e.printStackTrace();
+            }
+        } catch (final IOException e1) {
+            e1.printStackTrace();
+        }
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextThread.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextThread.java
new file mode 100644
index 0000000..0691b8a
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextThread.java
@@ -0,0 +1,149 @@
+/*-
+ * ============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.test.locking;
+
+import org.onap.policy.apex.context.ContextAlbum;
+import org.onap.policy.apex.context.ContextException;
+import org.onap.policy.apex.context.Distributor;
+import org.onap.policy.apex.context.impl.distribution.DistributorFactory;
+import org.onap.policy.apex.context.parameters.ContextParameters;
+import org.onap.policy.apex.context.test.concepts.TestContextItem003;
+import org.onap.policy.apex.context.test.factory.TestContextAlbumFactory;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * The Class TestConcurrentContextThread tests concurrent use of context.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class ConcurrentContextThread implements Runnable {
+    // Logger for this class
+    private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContextThread.class);
+    private final Distributor distributor;
+    private final int jvm;
+    private final int instance;
+    private final int threadLoops;
+
+    /**
+     * The Constructor.
+     *
+     * @param jvm the jvm
+     * @param instance the instance
+     * @param threadLoops the thread loops
+     * @throws ApexException the apex exception
+     */
+    public ConcurrentContextThread(final int jvm, final int instance, final int threadLoops) throws ApexException {
+        this.jvm = jvm;
+        this.instance = instance;
+        this.threadLoops = threadLoops;
+
+        final AxArtifactKey distributorKey = new AxArtifactKey("ApexDistributor_" + jvm + "_" + instance, "0.0.1");
+
+        new ContextParameters();
+        distributor = new DistributorFactory().getDistributor(distributorKey);
+        final AxContextModel albumsModel = TestContextAlbumFactory.createMultiAlbumsContextModel();
+        distributor.registerModel(albumsModel);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Runnable#run()
+     */
+    @Override
+    public void run() {
+        LOGGER.info("running TestConcurrentContextThread_" + jvm + "_" + instance + " . . .");
+
+        ContextAlbum lTypeAlbum = null;
+
+        try {
+            lTypeAlbum = distributor.createContextAlbum(new AxArtifactKey("LTypeContextAlbum", "0.0.1"));
+        } catch (final Exception e) {
+            LOGGER.error("could not get the test context album", e);
+            LOGGER.error("failed TestConcurrentContextThread_" + jvm + "_" + instance);
+            return;
+        }
+
+        if (lTypeAlbum == null) {
+            LOGGER.error("could not find the test context album");
+            LOGGER.error("failed TestConcurrentContextThread_" + jvm + "_" + instance);
+            return;
+        }
+
+        // @formatter:off
+        final AxArtifactKey[] usedArtifactStackArray = {
+                new AxArtifactKey("testC-top", "0.0.1"),
+                new AxArtifactKey("testC-next", "0.0.1"),
+                new AxArtifactKey("testC-bot", "0.0.1")
+                };
+        // @formatter:on
+
+        lTypeAlbum.setUserArtifactStack(usedArtifactStackArray);
+
+        for (int i = 0; i < threadLoops; i++) {
+            try {
+                lTypeAlbum.lockForWriting("testValue");
+                TestContextItem003 item = (TestContextItem003) lTypeAlbum.get("testValue");
+                if (item != null) {
+                    long value = item.getLongValue();
+                    item.setLongValue(++value);
+                } else {
+                    item = new TestContextItem003(0L);
+                }
+                lTypeAlbum.put("testValue", item);
+            } catch (final Exception e) {
+                LOGGER.error("could not set the value in the test context album", e);
+                LOGGER.error("failed TestConcurrentContextThread_" + jvm + "_" + instance);
+                return;
+            } finally {
+                try {
+                    lTypeAlbum.unlockForWriting("testValue");
+                } catch (final ContextException e) {
+                    LOGGER.error("could not unlock test context album item", e);
+                    LOGGER.error("failed TestConcurrentContextThread_" + jvm + "_" + instance);
+                    return;
+                }
+            }
+        }
+
+        try {
+            lTypeAlbum.lockForWriting("testValue");
+            final TestContextItem003 item = (TestContextItem003) lTypeAlbum.get("testValue");
+            final long value = item.getLongValue();
+            LOGGER.info("completed TestConcurrentContextThread_" + jvm + "_" + instance + ", value=" + value);
+        } catch (final Exception e) {
+            LOGGER.error("could not read the value in the test context album", e);
+            LOGGER.error("failed TestConcurrentContextThread_" + jvm + "_" + instance);
+        } finally {
+            try {
+                lTypeAlbum.unlockForWriting("testValue");
+                distributor.shutdown();
+            } catch (final ContextException e) {
+                LOGGER.error("could not unlock test context album item", e);
+                LOGGER.error("failed TestConcurrentContextThread_" + jvm + "_" + instance);
+            }
+        }
+    }
+}
diff --git a/context/context-test/src/main/java/org/onap/policy/apex/context/test/locking/package-info.java b/context/context-test/src/main/java/org/onap/policy/apex/context/test/locking/package-info.java
new file mode 100644
index 0000000..0e80e61
--- /dev/null
+++ b/context/context-test/src/main/java/org/onap/policy/apex/context/test/locking/package-info.java
@@ -0,0 +1,27 @@
+/*-
+ * ============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=========================================================
+ */
+
+/**
+ * Contains tests to check APEX context album distributed locking.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+
+package org.onap.policy.apex.context.test.locking;
diff --git a/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextAlbumUpdate.java b/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextAlbumUpdate.java
new file mode 100644
index 0000000..7d5693d
--- /dev/null
+++ b/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextAlbumUpdate.java
@@ -0,0 +1,65 @@
+/*-
+ * ============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.test.distribution;
+
+
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Test;
+import org.onap.policy.apex.context.parameters.ContextParameters;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+public class TestContextAlbumUpdate {
+    // Logger for this class
+    private static final XLogger logger = XLoggerFactory.getXLogger(TestContextAlbumUpdate.class);
+
+    @Test
+    public void testContextAlbumUpdateJVMLocalVarSet() throws ApexModelException, IOException, ApexException {
+        logger.debug("Running testContextAlbumUpdateJVMLocalVarSet test . . .");
+
+        final ContextParameters contextParameters = new ContextParameters();
+        contextParameters.getDistributorParameters()
+                .setPluginClass("org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor");
+        new ContextAlbumUpdate().testContextAlbumUpdate();
+
+        logger.debug("Ran testContextAlbumUpdateJVMLocalVarSet test");
+    }
+
+    @Test
+    public void testContextAlbumUpdateJVMLocalVarNotSet() throws ApexModelException, IOException, ApexException {
+        logger.debug("Running testContextAlbumUpdateJVMLocalVarNotSet test . . .");
+
+        new ContextParameters();
+        new ContextAlbumUpdate().testContextAlbumUpdate();
+
+        logger.debug("Ran testContextAlbumUpdateJVMLocalVarNotSet test");
+    }
+
+    /**
+     * Test context update cleardown.
+     */
+    @After
+    public void testContextAlbumUpdateCleardown() {}
+}
diff --git a/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextInstantiation.java b/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextInstantiation.java
new file mode 100644
index 0000000..f640b33
--- /dev/null
+++ b/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextInstantiation.java
@@ -0,0 +1,75 @@
+/*-
+ * ============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.test.distribution;
+
+
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.policy.apex.context.parameters.ContextParameters;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * The Class TestContextInstantiation.
+ *
+ * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
+ */
+public class TestContextInstantiation {
+    // Logger for this class
+    private static final XLogger logger = XLoggerFactory.getXLogger(TestContextInstantiation.class);
+
+    @Before
+    public void beforeTest() {}
+
+    /**
+     * Test context instantiation clear down.
+     */
+    @After
+    public void afterTest() {}
+
+    @Test
+    public void testContextInstantiationJVMLocalVarSet() throws ApexModelException, IOException, ApexException {
+        logger.debug("Running testContextInstantiationJVMLocalVarSet test . . .");
+
+        final ContextParameters contextParameters = new ContextParameters();
+        contextParameters.getDistributorParameters()
+                .setPluginClass("org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor");
+        new ContextInstantiation().testContextInstantiation();
+
+        logger.debug("Ran testContextInstantiationJVMLocalVarSet test");
+    }
+
+    @Test
+    public void testContextInstantiationJVMLocalVarNotSet() throws ApexModelException, IOException, ApexException {
+        logger.debug("Running testContextInstantiationJVMLocalVarNotSet test . . .");
+
+        new ContextParameters();
+        new ContextInstantiation().testContextInstantiation();
+
+        logger.debug("Ran testContextInstantiationJVMLocalVarNotSet test");
+    }
+
+}
diff --git a/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextUpdate.java b/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextUpdate.java
new file mode 100644
index 0000000..d140b0d
--- /dev/null
+++ b/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextUpdate.java
@@ -0,0 +1,62 @@
+/*-
+ * ============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.test.distribution;
+
+import java.io.IOException;
+
+import org.junit.Test;
+import org.onap.policy.apex.context.parameters.ContextParameters;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * The Class TestContextUpdate.
+ *
+ * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
+ */
+public class TestContextUpdate {
+    // Logger for this class
+    private static final XLogger logger = XLoggerFactory.getXLogger(TestContextUpdate.class);
+
+    @Test
+    public void testContextUpdateJVMLocalVarSet() throws ApexModelException, IOException, ApexException {
+        logger.debug("Running testContextUpdateJVMLocalVarSet test . . .");
+
+        final ContextParameters contextParameters = new ContextParameters();
+        contextParameters.getDistributorParameters()
+                .setPluginClass("org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor");
+        new ContextUpdate().testContextUpdate();
+
+        logger.debug("Ran testContextUpdateJVMLocalVarSet test");
+    }
+
+    @Test
+    public void testContextUpdateJVMLocalVarNotSet() throws ApexModelException, IOException, ApexException {
+        logger.debug("Running testContextUpdateJVMLocalVarNotSet test . . .");
+
+        new ContextParameters();
+        new ContextUpdate().testContextUpdate();
+
+        logger.debug("Ran testContextUpdateJVMLocalVarNotSet test");
+    }
+}
diff --git a/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestSequentialContextInstantiation.java b/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestSequentialContextInstantiation.java
new file mode 100644
index 0000000..2798759
--- /dev/null
+++ b/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestSequentialContextInstantiation.java
@@ -0,0 +1,73 @@
+/*-
+ * ============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.test.distribution;
+
+
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.policy.apex.context.parameters.ContextParameters;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * The Class TestContextInstantiation.
+ *
+ * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
+ */
+public class TestSequentialContextInstantiation {
+    // Logger for this class
+    private static final XLogger logger = XLoggerFactory.getXLogger(TestSequentialContextInstantiation.class);
+
+    @Before
+    public void beforeTest() {}
+
+    @After
+    public void afterTest() {}
+
+    @Test
+    public void testSequentialContextInstantiationJVMLocalVarSet()
+            throws ApexModelException, IOException, ApexException {
+        logger.debug("Running testSequentialContextInstantiationJVMLocalVarSet test . . .");
+
+        final ContextParameters contextParameters = new ContextParameters();
+        contextParameters.getDistributorParameters()
+                .setPluginClass("org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor");
+        new SequentialContextInstantiation().testSequentialContextInstantiation();
+
+        logger.debug("Ran testSequentialContextInstantiationJVMLocalVarSet test");
+    }
+
+    @Test
+    public void testSequentialContextInstantiationJVMLocalVarNotSet()
+            throws ApexModelException, IOException, ApexException {
+        logger.debug("Running testSequentialContextInstantiationJVMLocalVarNotSet test . . .");
+
+        new ContextParameters();
+        new SequentialContextInstantiation().testSequentialContextInstantiation();
+
+        logger.debug("Ran testSequentialContextInstantiationJVMLocalVarNotSet test");
+    }
+}
diff --git a/context/context-test/src/test/java/org/onap/policy/apex/context/test/locking/TestConcurrentContext.java b/context/context-test/src/test/java/org/onap/policy/apex/context/test/locking/TestConcurrentContext.java
new file mode 100644
index 0000000..0f6626f
--- /dev/null
+++ b/context/context-test/src/test/java/org/onap/policy/apex/context/test/locking/TestConcurrentContext.java
@@ -0,0 +1,97 @@
+/*-
+ * ============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.test.locking;
+
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.junit.Test;
+import org.onap.policy.apex.context.parameters.ContextParameters;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * The Class TestConcurrentContext tests concurrent use of context.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class TestConcurrentContext {
+    // Logger for this class
+    private static final XLogger logger = XLoggerFactory.getXLogger(TestConcurrentContext.class);
+
+    // Test parameters
+    private static final int TEST_JVM_COUNT_SINGLE_JVM = 1;
+    private static final int TEST_JVM_COUNT_MULTI_JVM = 3;
+    private static final int TEST_THREAD_COUNT_SINGLE_JVM = 64;
+    private static final int TEST_THREAD_COUNT_MULTI_JVM = 20;
+    private static final int TEST_THREAD_LOOPS = 100;
+
+    @Test
+    public void testConcurrentContextJVMLocalVarSet() throws ApexModelException, IOException, ApexException {
+        logger.debug("Running testConcurrentContextJVMLocalVarSet test . . .");
+
+        final ContextParameters contextParameters = new ContextParameters();
+        contextParameters.getLockManagerParameters()
+                .setPluginClass("org.onap.policy.apex.context.impl.locking.jvmlocal.JVMLocalLockManager");
+        final long result = new ConcurrentContext().testConcurrentContext("JVMLocalVarSet", TEST_JVM_COUNT_SINGLE_JVM,
+                TEST_THREAD_COUNT_SINGLE_JVM, TEST_THREAD_LOOPS);
+
+        assertEquals(TEST_JVM_COUNT_SINGLE_JVM * TEST_THREAD_COUNT_SINGLE_JVM * TEST_THREAD_LOOPS, result);
+
+        logger.debug("Ran testConcurrentContextJVMLocalVarSet test");
+    }
+
+    @Test
+    public void testConcurrentContextJVMLocalNoVarSet() throws ApexModelException, IOException, ApexException {
+        logger.debug("Running testConcurrentContextJVMLocalNoVarSet test . . .");
+
+        new ContextParameters();
+        final long result = new ConcurrentContext().testConcurrentContext("JVMLocalNoVarSet", TEST_JVM_COUNT_SINGLE_JVM,
+                TEST_THREAD_COUNT_SINGLE_JVM, TEST_THREAD_LOOPS);
+
+        assertEquals(TEST_JVM_COUNT_SINGLE_JVM * TEST_THREAD_COUNT_SINGLE_JVM * TEST_THREAD_LOOPS, result);
+
+        logger.debug("Ran testConcurrentContextJVMLocalNoVarSet test");
+    }
+
+    @Test
+    public void testConcurrentContextMultiJVMNoLock() throws ApexModelException, IOException, ApexException {
+        logger.debug("Running testConcurrentContextMultiJVMNoLock test . . .");
+
+        final ContextParameters contextParameters = new ContextParameters();
+        contextParameters.getDistributorParameters()
+                .setPluginClass("org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor");
+        contextParameters.getLockManagerParameters()
+                .setPluginClass("org.onap.policy.apex.context.impl.locking.jvmlocal.JVMLocalLockManager");
+
+        final long result = new ConcurrentContext().testConcurrentContext("testConcurrentContextMultiJVMNoLock",
+                TEST_JVM_COUNT_MULTI_JVM, TEST_THREAD_COUNT_MULTI_JVM, TEST_THREAD_LOOPS);
+
+        // No concurrent map so result will be zero
+        assertEquals(0, result);
+
+        logger.debug("Ran testConcurrentContextMultiJVMNoLock test");
+    }
+}
diff --git a/context/context-test/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java b/context/context-test/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java
new file mode 100644
index 0000000..db1ac47
--- /dev/null
+++ b/context/context-test/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java
@@ -0,0 +1,184 @@
+/*-
+ * ============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.test.persistence;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TimeZone;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.policy.apex.context.ContextAlbum;
+import org.onap.policy.apex.context.Distributor;
+import org.onap.policy.apex.context.impl.distribution.DistributorFactory;
+import org.onap.policy.apex.context.parameters.ContextParameters;
+import org.onap.policy.apex.context.parameters.PersistorParameters;
+import org.onap.policy.apex.context.test.concepts.TestContextItem003;
+import org.onap.policy.apex.context.test.concepts.TestContextItem008;
+import org.onap.policy.apex.context.test.concepts.TestContextItem00A;
+import org.onap.policy.apex.context.test.concepts.TestContextItem00C;
+import org.onap.policy.apex.context.test.factory.TestContextAlbumFactory;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.dao.ApexDao;
+import org.onap.policy.apex.model.basicmodel.dao.ApexDaoFactory;
+import org.onap.policy.apex.model.basicmodel.dao.DAOParameters;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
+
+/**
+ * The Class TestContextInstantiation.
+ *
+ * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
+ */
+public class TestPersistentContextInstantiation {
+    // Logger for this class
+    // private static final XLogger logger = XLoggerFactory.getXLogger(TestPersistentContextInstantiation.class);
+
+    private Connection connection;
+
+    @Before
+    public void setup() throws Exception {
+        Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
+        connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true");
+    }
+
+    @After
+    public void teardown() throws Exception {
+        connection.close();
+        new File("derby.log").delete();
+    }
+
+    @After
+    public void afterTest() throws IOException {}
+
+    @Test
+    public void testContextPersistentInstantiation() throws ApexModelException, IOException, ApexException {
+
+        final ContextParameters contextParameters = new ContextParameters();
+        contextParameters.setPersistorParameters(new PersistorParameters());
+
+        final AxArtifactKey distributorKey = new AxArtifactKey("AbstractDistributor", "0.0.1");
+        final Distributor contextDistributor = new DistributorFactory().getDistributor(distributorKey);
+
+        final AxArtifactKey[] usedArtifactStackArray = { new AxArtifactKey("testC-top", "0.0.1"),
+                new AxArtifactKey("testC-next", "0.0.1"), new AxArtifactKey("testC-bot", "0.0.1") };
+
+        final DAOParameters daoParameters = new DAOParameters();
+        daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao");
+        daoParameters.setPersistenceUnit("DAOTest");
+        final ApexDao apexDao = new ApexDaoFactory().createApexDao(daoParameters);
+        apexDao.init(daoParameters);
+
+        final AxContextModel someContextModel = TestContextAlbumFactory.createMultiAlbumsContextModel();
+
+        // Context for Storing Map values
+        final AxContextAlbum axContextAlbumForMap =
+                someContextModel.getAlbums().getAlbumsMap().get(new AxArtifactKey("MapContextAlbum", "0.0.1"));
+        apexDao.create(axContextAlbumForMap);
+        contextDistributor.registerModel(someContextModel);
+        final ContextAlbum contextAlbumForMap = contextDistributor.createContextAlbum(axContextAlbumForMap.getKey());
+        assertNotNull(contextAlbumForMap);
+        contextAlbumForMap.setUserArtifactStack(usedArtifactStackArray);
+
+        final Map<String, String> testMap = new HashMap<String, String>();
+        testMap.put("key", "This is a policy context string");
+
+        final Map<String, Object> valueMap0 = new HashMap<String, Object>();
+        valueMap0.put("TestPolicyContextItem000", new TestContextItem00C(testMap));
+
+        contextAlbumForMap.putAll(valueMap0);
+
+        assertEquals(((TestContextItem00C) contextAlbumForMap.get("TestPolicyContextItem000")).getMapValue().get("key"),
+                "This is a policy context string");
+
+        contextAlbumForMap.flush();
+
+        // Context for Storing Date values
+        final AxContextAlbum axContextAlbumForDate =
+                someContextModel.getAlbums().getAlbumsMap().get(new AxArtifactKey("DateContextAlbum", "0.0.1"));
+        apexDao.create(axContextAlbumForDate);
+        contextDistributor.registerModel(someContextModel);
+        final ContextAlbum contextAlbumForDate = contextDistributor.createContextAlbum(axContextAlbumForDate.getKey());
+        assertNotNull(contextAlbumForDate);
+        contextAlbumForDate.setUserArtifactStack(usedArtifactStackArray);
+
+        final TestContextItem008 testDate = new TestContextItem008(new Date());
+        final TestContextItem00A tci00A = new TestContextItem00A();
+        tci00A.setDateValue(testDate);
+        tci00A.setTZValue(TimeZone.getTimeZone("Europe/Dublin").toString());
+        tci00A.setDST(true);
+
+        final Map<String, Object> valueMap1 = new HashMap<String, Object>();
+        valueMap1.put("TestPolicyContextItem00A", tci00A);
+
+        contextAlbumForDate.putAll(valueMap1);
+
+        assertEquals(((TestContextItem00A) contextAlbumForDate.get("TestPolicyContextItem00A")).getDateValue(),
+                testDate);
+        assertEquals(((TestContextItem00A) contextAlbumForDate.get("TestPolicyContextItem00A")).getDST(), true);
+
+        contextAlbumForDate.flush();
+
+        // Context for Storing Long values
+        final AxContextAlbum axContextAlbumForLong =
+                someContextModel.getAlbums().getAlbumsMap().get(new AxArtifactKey("LTypeContextAlbum", "0.0.1"));
+        apexDao.create(axContextAlbumForLong);
+        contextDistributor.registerModel(someContextModel);
+        final ContextAlbum contextAlbumForLong = contextDistributor.createContextAlbum(axContextAlbumForLong.getKey());
+        assertNotNull(contextAlbumForLong);
+        contextAlbumForLong.setUserArtifactStack(usedArtifactStackArray);
+
+        final Map<String, Object> valueMap2 = new HashMap<String, Object>();
+        valueMap2.put("TestPolicyContextItem0031", new TestContextItem003(0xFFFFFFFFFFFFFFFFL));
+        valueMap2.put("TestPolicyContextItem0032", new TestContextItem003(0xFFFFFFFFFFFFFFFEL));
+        valueMap2.put("TestPolicyContextItem0033", new TestContextItem003(0xFFFFFFFFFFFFFFFDL));
+        valueMap2.put("TestPolicyContextItem0034", new TestContextItem003(0xFFFFFFFFFFFFFFFCL));
+        valueMap2.put("TestPolicyContextItem0035", new TestContextItem003(0xFFFFFFFFFFFFFFFBL));
+
+        contextAlbumForLong.putAll(valueMap2);
+
+        assertEquals(((TestContextItem003) contextAlbumForLong.get("TestPolicyContextItem0031")).getLongValue(),
+                0xFFFFFFFFFFFFFFFFL);
+        assertEquals(((TestContextItem003) contextAlbumForLong.get("TestPolicyContextItem0032")).getLongValue(),
+                0xFFFFFFFFFFFFFFFEL);
+        assertEquals(((TestContextItem003) contextAlbumForLong.get("TestPolicyContextItem0033")).getLongValue(),
+                0xFFFFFFFFFFFFFFFDL);
+        assertEquals(((TestContextItem003) contextAlbumForLong.get("TestPolicyContextItem0034")).getLongValue(),
+                0xFFFFFFFFFFFFFFFCL);
+        assertEquals(((TestContextItem003) contextAlbumForLong.get("TestPolicyContextItem0035")).getLongValue(),
+                0xFFFFFFFFFFFFFFFBL);
+
+        contextAlbumForLong.flush();
+        contextDistributor.clear();
+
+    }
+}
diff --git a/context/context-test/src/test/resources/META-INF/persistence.xml b/context/context-test/src/test/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..ec93578
--- /dev/null
+++ b/context/context-test/src/test/resources/META-INF/persistence.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ============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=========================================================
+-->
+
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
+    <persistence-unit name="DAOTest" transaction-type="RESOURCE_LOCAL">
+        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+
+        <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner</class>
+        <class>org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String</class>
+        <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class>
+        <class>org.onap.policy.apex.model.basicmodel.concepts.AxConcept</class>
+        <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class>
+        <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation</class>
+        <class>org.onap.policy.apex.model.basicmodel.concepts.AxModel</class>
+        <class>org.onap.policy.apex.model.basicmodel.concepts.TestEntity</class>
+        <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema</class>
+        <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas</class>
+        <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum</class>
+        <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums</class>
+        <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextModel</class>
+
+        <properties>
+            <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:apex_test" />
+            <property name="javax.persistence.target-database" value="Derby" />
+            <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
+
+            <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
+            <property name="eclipselink.ddl-generation.output-mode" value="database" />
+            <property name="eclipselink.logging.level" value="INFO" />
+        </properties>
+    </persistence-unit>
+</persistence>
diff --git a/context/pom.xml b/context/pom.xml
new file mode 100644
index 0000000..dad8502
--- /dev/null
+++ b/context/pom.xml
@@ -0,0 +1,40 @@
+<!--
+  ============LICENSE_START=======================================================
+   Copyright (C) 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=========================================================
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.onap.policy.apex-pdp</groupId>
+        <artifactId>apex-pdp</artifactId>
+        <version>2.0.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.onap.policy.apex-pdp.context</groupId>
+    <artifactId>context</artifactId>
+    <packaging>pom</packaging>
+
+    <name>${project.artifactId}</name>
+    <description>The context handling framework of Apex.</description>
+
+    <modules>
+        <module>context-management</module>
+        <module>context-test</module>
+    </modules>
+</project>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index fecf5e8..8863e50 100644
--- a/pom.xml
+++ b/pom.xml
@@ -121,5 +121,6 @@
 
     <modules>
         <module>model</module>
+        <module>context</module>
     </modules>
 </project>
\ No newline at end of file
