aboutsummaryrefslogtreecommitdiffstats
path: root/context/context-management/src/main/java
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-06-18 20:58:52 +0800
committerliamfallon <liam.fallon@ericsson.com>2018-06-18 21:00:31 +0800
commitc1d85d80c995f03f4d4b270fd30054c2ebd48632 (patch)
tree62b352d6724e377c98aa381cda451806fb650957 /context/context-management/src/main/java
parent8623ca6174b6d724d3d480f0bf54300f18460350 (diff)
Fix package name, Unit Test for Context Album
package org.onap.policy.core renamed to org.onap.policy.apex.core Added unit text for context exceptions and context album Issue-ID: POLICY-857 Change-Id: I24f376245d9bc46db6a6a47ac3e8e6c559a16465 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'context/context-management/src/main/java')
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/ContextAlbum.java7
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java17
2 files changed, 23 insertions, 1 deletions
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
index 73ef668a0..559139321 100644
--- 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
@@ -112,6 +112,13 @@ public interface ContextAlbum extends Map<String, Object> {
void unlockForWriting(String key) throws ContextException;
/**
+ * Get the stack of artifact keys currently using this context item.
+ *
+ * @return the keys of the artifacts using the context album at the moment
+ */
+ AxConcept[] getUserArtifactStack();
+
+ /**
* 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
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java
index a68271609..fbaeb2c91 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java
@@ -79,6 +79,10 @@ public final class ContextAlbumImpl implements ContextAlbum {
*/
public ContextAlbumImpl(final AxContextAlbum albumDefinition, final Distributor distributor,
final Map<String, Object> albumMap) throws ContextException {
+ Assertions.argumentNotNull(albumDefinition, "Context album definition may not be null");
+ Assertions.argumentNotNull(distributor, "Distributor may not be null");
+ Assertions.argumentNotNull(albumMap, "Album map may not be null");
+
this.albumDefinition = albumDefinition;
// Use the context distributor passed to us
@@ -194,6 +198,17 @@ public final class ContextAlbumImpl implements ContextAlbum {
* (non-Javadoc)
*
* @see
+ * org.onap.policy.apex.context.ContextAlbum#getUserArtifactStack()
+ */
+ @Override
+ public AxConcept[] getUserArtifactStack() {
+ return userArtifactStack;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
* org.onap.policy.apex.context.ContextAlbum#setUserArtifactStack(org.onap.policy.apex.model.basicmodel.concepts.
* AxConcept [])
*/
@@ -440,7 +455,7 @@ public final class ContextAlbumImpl implements ContextAlbum {
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;
+ + "\" remove() not allowed on read only albums for key=\"" + key + "\"";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}