summaryrefslogtreecommitdiffstats
path: root/model/context-model
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2022-02-10 12:06:25 +0000
committerliamfallon <liam.fallon@est.tech>2022-02-10 13:48:15 +0000
commit8534756d13531ffec9c2d7b2ffe0a53ee1d3aaef (patch)
treea35f6b3f7766d47900ee6691111acff1418bb747 /model/context-model
parent2f2c5465cd23c8c3300a5c3d185806bb3e7d73c1 (diff)
Collapse apex-pdp maven model submodules
This review collapses all the code in six podel submodules into a single model module. There are no code changes, just files moved around. This change reduces the complexity of the code structure and speeds up the build. Issue-ID: POLICY-1820 Change-Id: Ifb644e8ec85ae6d0987378f4616fbc8a8858a9a8 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'model/context-model')
-rw-r--r--model/context-model/pom.xml40
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java268
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java310
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java222
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java299
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java304
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/package-info.java28
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/handling/ContextComparer.java70
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/handling/package-info.java27
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextAlbumsTest.java248
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextModelTest.java95
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextSchemasTest.java229
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ApexContextModelTest.java124
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ContextComparisonTest.java189
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModelCreator.java122
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparisonFactory.java148
-rw-r--r--model/context-model/src/test/resources/logback-test.xml78
17 files changed, 0 insertions, 2801 deletions
diff --git a/model/context-model/pom.xml b/model/context-model/pom.xml
deleted file mode 100644
index f20808186..000000000
--- a/model/context-model/pom.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<!--
- ============LICENSE_START=======================================================
- Copyright (C) 2016-2018 Ericsson. All rights reserved.
- Modifications Copyright (C) 2022 Nordix Foundation.
- ================================================================================
- 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.model</groupId>
- <artifactId>model</artifactId>
- <version>2.7.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>context-model</artifactId>
- <name>${project.artifactId}</name>
- <description>Context Models used in Apex</description>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.policy.apex-pdp.model</groupId>
- <artifactId>basic-model</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java
deleted file mode 100644
index db64f8847..000000000
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2022 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.model.contextmodel.concepts;
-
-import java.util.List;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
-import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxKeyUse;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-import org.onap.policy.common.utils.validation.Assertions;
-
-/**
- * This class is used to define an album of context.
- *
- * <p>A context album is a distributed map of context that will be distributed across all process instances that require
- * access to it. This class defines the schema (structure) of the items in the context album, whether the items on the
- * context album are writable or not, and what the scope of the context album is.
- *
- * <p>The structure of items (objects) the context album is defined as a schema, which is understood by whatever schema
- * implementation is being used for the context album.
- *
- * <p>The scope of a context album is a string field, understood by whatever distribution mechanism is being used for
- * the context album. The distribution mechanism uses the scope of the context album to decide to which executable
- * entities a given context album is distributed.
- *
- * <p>The writable flag on a context album defines whether users of a context album can write to the context album or
- * just read objects from the context album.
- *
- * <p>Validation checks that the album key and the context schema key are not null and that the scope field is not
- * undefined and matches the regular expression SCOPE_REGEXP.
- */
-
-@Getter
-@ToString
-@EqualsAndHashCode(callSuper = false)
-
-public class AxContextAlbum extends AxConcept {
- private static final String SCOPE_STRING = "scope";
-
- private static final long serialVersionUID = 4290442590545820316L;
-
- /**
- * The legal values for the scope of a context album is constrained by this regular expression.
- */
- public static final String SCOPE_REGEXP = "[A-Za-z0-9\\-_]+";
-
- /** The value of scope for a context album for which a scope has not been specified. */
- public static final String SCOPE_UNDEFINED = "UNDEFINED";
-
- private AxArtifactKey key;
- private String scope;
-
- @Setter
- private boolean isWritable;
-
- private AxArtifactKey itemSchema;
-
- /**
- * The default constructor creates a context album with a null artifact key. The scope of the context album is set
- * as SCOPE_UNDEFINED, the album is writable, and the artifact key of the context schema is set to the null artifact
- * key.
- */
- public AxContextAlbum() {
- this(new AxArtifactKey());
- scope = SCOPE_UNDEFINED;
- isWritable = true;
- itemSchema = AxArtifactKey.getNullKey();
- }
-
- /**
- * Copy constructor.
- *
- * @param copyConcept the concept to copy from
- */
- public AxContextAlbum(final AxContextAlbum copyConcept) {
- super(copyConcept);
- }
-
- /**
- * The keyed constructor creates a context album with the specified artifact key. The scope of the context album is
- * set as SCOPE_UNDEFINED, the album is writable, and the artifact key of the context schema is set to the null
- * artifact key.
- *
- * @param key the key of the context album
- */
- public AxContextAlbum(final AxArtifactKey key) {
- this(key, SCOPE_UNDEFINED, true, AxArtifactKey.getNullKey());
- }
-
- /**
- * Constructor that sets all the fields of the context album.
- *
- * @param key the key of the context album
- * @param scope the scope field, must match the regular expression SCOPE_REGEXP
- * @param isWritable specifies whether the context album will be writable or not
- * @param itemSchema the artifact key of the context schema to use for this context album
- */
- public AxContextAlbum(final AxArtifactKey key, final String scope, final boolean isWritable,
- final AxArtifactKey itemSchema) {
- super();
- Assertions.argumentNotNull(key, "key may not be null");
- Assertions.argumentNotNull(scope, "scope may not be null");
- Assertions.argumentNotNull(itemSchema, "itemSchema may not be null");
-
- this.key = key;
- this.scope = Assertions.validateStringParameter(SCOPE_STRING, scope, SCOPE_REGEXP);
- this.isWritable = isWritable;
- this.itemSchema = itemSchema;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public List<AxKey> getKeys() {
- final List<AxKey> keyList = key.getKeys();
- keyList.add(new AxKeyUse(itemSchema.getKey()));
-
- return keyList;
- }
-
- /**
- * Sets the key of the context album.
- *
- * @param key the context album key
- */
- public void setKey(final AxArtifactKey key) {
- Assertions.argumentNotNull(key, "key may not be null");
- this.key = key;
- }
-
- /**
- * Sets the scope of the context album.
- *
- * @param scope the context album scope
- */
- public void setScope(final String scope) {
- Assertions.argumentNotNull(scope, "scope may not be null");
- this.scope = Assertions.validateStringParameter(SCOPE_STRING, scope, SCOPE_REGEXP);
- }
-
- /**
- * Sets the artifact key of the item schema of this context album.
- *
- * @param itemSchema the item schema key
- */
- public void setItemSchema(final AxArtifactKey itemSchema) {
- Assertions.argumentNotNull(itemSchema, "itemSchema key may not be null");
- this.itemSchema = itemSchema;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public AxValidationResult validate(final AxValidationResult resultIn) {
- AxValidationResult result = resultIn;
-
- if (key.equals(AxArtifactKey.getNullKey())) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key is a null key"));
- }
- result = key.validate(result);
-
- if (scope.replaceAll("\\s+$", "").length() == 0 || scope.equals(SCOPE_UNDEFINED)) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "scope is not defined"));
- }
-
- var stringCheckResult = Assertions.getStringParameterValidationMessage(SCOPE_STRING, scope, SCOPE_REGEXP);
- if (stringCheckResult != null) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "scope invalid-" + stringCheckResult));
- }
-
- if (itemSchema.equals(AxArtifactKey.getNullKey())) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "itemSchema reference is a null key, an item schema must be specified"));
- }
- result = itemSchema.validate(result);
-
- return result;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void clean() {
- key.clean();
- scope = Assertions.validateStringParameter(SCOPE_STRING, scope, SCOPE_REGEXP);
- itemSchema.clean();
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public AxConcept copyTo(final AxConcept target) {
- Assertions.argumentNotNull(target, "targetObject may not be null");
-
- final Object copyObject = target;
- Assertions.instanceOf(copyObject, AxContextAlbum.class);
-
- final AxContextAlbum copy = ((AxContextAlbum) copyObject);
- copy.setKey(new AxArtifactKey(key));
- copy.setScope(scope);
- copy.setWritable(isWritable);
- copy.setItemSchema(new AxArtifactKey(itemSchema));
-
- return copy;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public int compareTo(final AxConcept otherObj) {
- if (otherObj == null) {
- return -1;
- }
- if (this == otherObj) {
- return 0;
- }
- if (getClass() != otherObj.getClass()) {
- return this.hashCode() - otherObj.hashCode();
- }
-
- final AxContextAlbum other = (AxContextAlbum) otherObj;
- if (!key.equals(other.key)) {
- return key.compareTo(other.key);
- }
- if (!scope.equals(other.scope)) {
- return scope.compareTo(other.scope);
- }
- if (isWritable != other.isWritable) {
- return (isWritable ? 1 : -1);
- }
- return itemSchema.compareTo(other.itemSchema);
- }
-}
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java
deleted file mode 100644
index 54e3ce44b..000000000
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2022 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.model.contextmodel.concepts;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.NavigableMap;
-import java.util.Set;
-import java.util.TreeMap;
-import lombok.AccessLevel;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.ToString;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
-import org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter;
-import org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetterImpl;
-import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-import org.onap.policy.common.utils.validation.Assertions;
-
-/**
- * This class is a context album container and holds a map of the context albums for an entire Apex model. All Apex
- * models that use context albums must have an {@link AxContextAlbums} field. The {@link AxContextAlbums} class
- * implements the helper methods of the {@link AxConceptGetter} interface to allow {@link AxContextAlbum} instances to
- * be retrieved by calling methods directly on this class without referencing the contained map.
- *
- * <p>Validation checks that the container key is not null. An observation is issued if no context albums are defined in
- * the container. If context albums do exist, they are checked to ensure that keys and values are not null and that the
- * map key matches the key in the map value for all album entries. Each context album entry is then validated
- * individually.
- */
-@Getter
-@ToString
-@EqualsAndHashCode(callSuper = false)
-public final class AxContextAlbums extends AxConcept implements AxConceptGetter<AxContextAlbum> {
- private static final long serialVersionUID = -4844259809024470975L;
-
- private AxArtifactKey key;
-
- @Getter(AccessLevel.NONE)
- private Map<AxArtifactKey, AxContextAlbum> albums;
-
- /**
- * The Default Constructor creates a {@link AxContextAlbums} object with a null artifact key and creates an empty
- * context album map.
- */
- public AxContextAlbums() {
- this(new AxArtifactKey());
- }
-
- /**
- * Copy constructor.
- *
- * @param copyConcept the concept to copy from
- */
- public AxContextAlbums(final AxContextAlbums copyConcept) {
- super(copyConcept);
- }
-
- /**
- * The Key Constructor creates a {@link AxContextAlbums} object with the given artifact key and creates an empty
- * context album map.
- *
- * @param key the key of the context album container
- */
- public AxContextAlbums(final AxArtifactKey key) {
- this(key, new TreeMap<>());
- }
-
- /**
- * Constructor that creates the context album map with the given albums and key.
- *
- * @param key the key of the context album container
- * @param albums the context albums to place in this context album container
- */
- public AxContextAlbums(final AxArtifactKey key, final Map<AxArtifactKey, AxContextAlbum> albums) {
- super();
- Assertions.argumentNotNull(key, "key may not be null");
- Assertions.argumentNotNull(albums, "albums may not be null");
-
- this.key = key;
- this.albums = new TreeMap<>();
- this.albums.putAll(albums);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public List<AxKey> getKeys() {
- final List<AxKey> keyList = key.getKeys();
-
- for (final AxContextAlbum contextAlbum : albums.values()) {
- keyList.addAll(contextAlbum.getKeys());
- }
-
- return keyList;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void buildReferences() {
- albums.values().stream().forEach(album -> album.buildReferences());
- }
-
- /**
- * Sets the key of the context album container.
- *
- * @param key the context album container key
- */
- public void setKey(final AxArtifactKey key) {
- Assertions.argumentNotNull(key, "key may not be null");
- this.key = key;
- }
-
- /**
- * Gets the map of context albums from the context album container.
- *
- * @return the context album map
- */
- public Map<AxArtifactKey, AxContextAlbum> getAlbumsMap() {
- return albums;
- }
-
- /**
- * Sets the map of context albums from the context album container.
- *
- * @param albumsMap the map of context albums to place in the container
- */
- public void setAlbumsMap(final Map<AxArtifactKey, AxContextAlbum> albumsMap) {
- Assertions.argumentNotNull(albumsMap, "albums may not be null");
- this.albums = new TreeMap<>();
- this.albums.putAll(albumsMap);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void clean() {
- key.clean();
- for (final Entry<AxArtifactKey, AxContextAlbum> contextAlbumEntry : albums.entrySet()) {
- contextAlbumEntry.getKey().clean();
- contextAlbumEntry.getValue().clean();
- }
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public AxValidationResult validate(final AxValidationResult resultIn) {
- AxValidationResult result = resultIn;
-
- if (key.equals(AxArtifactKey.getNullKey())) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key is a null key"));
- }
-
- result = key.validate(result);
-
- if (albums.size() == 0) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.OBSERVATION,
- "albums are empty"));
- } else {
- for (final Entry<AxArtifactKey, AxContextAlbum> contextAlbumEntry : albums.entrySet()) {
- if (contextAlbumEntry.getKey().equals(AxArtifactKey.getNullKey())) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key on context album entry " + contextAlbumEntry.getKey()
- + " may not be the null key"));
- } else if (contextAlbumEntry.getValue() == null) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "value on context album entry " + contextAlbumEntry.getKey() + " may not be null"));
- } else {
- validateContextAlbumKey(result, contextAlbumEntry);
-
- result = contextAlbumEntry.getValue().validate(result);
- }
- }
- }
-
- return result;
- }
-
- private void validateContextAlbumKey(final AxValidationResult result,
- final Entry<AxArtifactKey, AxContextAlbum> contextAlbumEntry) {
- if (!contextAlbumEntry.getKey().equals(contextAlbumEntry.getValue().getKey())) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key on context album entry key " + contextAlbumEntry.getKey()
- + " does not equal context album value key "
- + contextAlbumEntry.getValue().getKey()));
- }
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public AxConcept copyTo(final AxConcept target) {
- Assertions.argumentNotNull(target, "target may not be null");
-
- final Object copyObject = target;
- Assertions.instanceOf(copyObject, AxContextAlbums.class);
-
- final AxContextAlbums copy = ((AxContextAlbums) copyObject);
- copy.setKey(key);
- final Map<AxArtifactKey, AxContextAlbum> newContextAlbum = new TreeMap<>();
- for (final Entry<AxArtifactKey, AxContextAlbum> contextAlbumEntry : albums.entrySet()) {
- newContextAlbum.put(new AxArtifactKey(contextAlbumEntry.getKey()),
- new AxContextAlbum(contextAlbumEntry.getValue()));
- }
- copy.setAlbumsMap(newContextAlbum);
-
- return copy;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public int compareTo(final AxConcept otherObj) {
- if (otherObj == null) {
- return -1;
- }
- if (this == otherObj) {
- return 0;
- }
- if (getClass() != otherObj.getClass()) {
- return this.hashCode() - otherObj.hashCode();
- }
-
- final AxContextAlbums other = (AxContextAlbums) otherObj;
- if (!key.equals(other.key)) {
- return key.compareTo(other.key);
- }
- if (!albums.equals(other.albums)) {
- return (albums.hashCode() - other.albums.hashCode());
- }
-
- return 0;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public AxContextAlbum get(final AxArtifactKey conceptKey) {
- return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxContextAlbum>) albums).get(conceptKey);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public AxContextAlbum get(final String conceptKeyName) {
- return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxContextAlbum>) albums).get(conceptKeyName);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public AxContextAlbum get(final String conceptKeyName, final String conceptKeyVersion) {
- return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxContextAlbum>) albums).get(conceptKeyName,
- conceptKeyVersion);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public Set<AxContextAlbum> getAll(final String conceptKeyName) {
- return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxContextAlbum>) albums).getAll(conceptKeyName);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public Set<AxContextAlbum> getAll(final String conceptKeyName, final String conceptKeyVersion) {
- return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxContextAlbum>) albums).getAll(conceptKeyName,
- conceptKeyVersion);
- }
-}
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java
deleted file mode 100644
index 1effe8079..000000000
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2022 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.model.contextmodel.concepts;
-
-import java.util.List;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.ToString;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
-import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
-import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.policy.apex.model.basicmodel.service.ModelService;
-import org.onap.policy.common.utils.validation.Assertions;
-
-/**
- * A container class for an Apex context model. This class is a container class that allows an Apex model to be
- * constructed that just contains context and the key information for that context. The model contains schema
- * definitions and the definitions of context albums that use those schemas. In the case where Apex context is being
- * used without policy or independent of policy, an Apex context model is sufficient to get Apex context working.
- *
- * <p>Validation runs {@link AxModel} validation on the model. In addition, the {@link AxContextSchemas} and
- * {@link AxContextAlbums} validation is run on the context schemas and albums in the model.
- */
-@Getter
-@ToString(callSuper = true)
-@EqualsAndHashCode(callSuper = true)
-public class AxContextModel extends AxModel {
- private static final long serialVersionUID = 8800599637708309945L;
-
- private AxContextSchemas schemas;
- private AxContextAlbums albums;
-
- /**
- * The Default Constructor creates a {@link AxContextModel} object with a null artifact key and creates an empty
- * context model.
- */
- public AxContextModel() {
- this(new AxArtifactKey());
- }
-
- /**
- * The Key Constructor creates a {@link AxContextModel} object with the given artifact key and creates an empty
- * context model.
- *
- * @param key the key of the context model
- */
- public AxContextModel(final AxArtifactKey key) {
- this(key, new AxContextSchemas(new AxArtifactKey(key.getName() + "_Schemas", key.getVersion())),
- new AxContextAlbums(new AxArtifactKey(key.getName() + "_Albums", key.getVersion())),
- new AxKeyInformation(new AxArtifactKey(key.getName() + "_KeyInfo", key.getVersion())));
- }
-
- /**
- * Copy constructor.
- *
- * @param copyConcept the concept to copy from
- */
- public AxContextModel(final AxContextModel copyConcept) {
- super(copyConcept);
- }
-
- /**
- * Constructor that initiates a {@link AxContextModel} with schemas and keys for those schemas. An empty
- * {@link AxContextAlbums} container is created.
- *
- * @param key the key of the context model
- * @param schemas the context schema definitions
- * @param keyInformation the key information for those context schemas
- */
- public AxContextModel(final AxArtifactKey key, final AxContextSchemas schemas,
- final AxKeyInformation keyInformation) {
- this(key, schemas, new AxContextAlbums(new AxArtifactKey(key.getName() + "_Albums", key.getVersion())),
- keyInformation);
- }
-
- /**
- * Constructor that initiates a {@link AxContextModel} with all its fields.
- *
- * @param key the key of the context model
- * @param schemas the context schema definitions
- * @param albums the context album container containing context albums
- * @param keyInformation the key information for those context schemas
- */
- public AxContextModel(final AxArtifactKey key, final AxContextSchemas schemas, final AxContextAlbums albums,
- final AxKeyInformation keyInformation) {
- super(key, keyInformation);
- Assertions.argumentNotNull(schemas, "schemas may not be null");
- Assertions.argumentNotNull(albums, "albums may not be null");
- this.schemas = schemas;
- this.albums = albums;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void register() {
- super.register();
- ModelService.registerModel(AxContextSchemas.class, getSchemas());
- ModelService.registerModel(AxContextAlbums.class, getAlbums());
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public List<AxKey> getKeys() {
- final List<AxKey> keyList = super.getKeys();
-
- keyList.addAll(schemas.getKeys());
- keyList.addAll(albums.getKeys());
-
- return keyList;
- }
-
- /**
- * Sets the context schemas on the model.
- *
- * @param schemas the context schemas
- */
- public void setSchemas(final AxContextSchemas schemas) {
- Assertions.argumentNotNull(schemas, "schemas may not be null");
- this.schemas = schemas;
- }
-
- /**
- * Sets the context albums on the model.
- *
- * @param albums the context albums
- */
- public void setAlbums(final AxContextAlbums albums) {
- Assertions.argumentNotNull(albums, "albums may not be null");
- this.albums = albums;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public AxValidationResult validate(final AxValidationResult resultIn) {
- AxValidationResult result = resultIn;
-
- result = super.validate(result);
- result = schemas.validate(result);
- return albums.validate(result);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void clean() {
- super.clean();
- schemas.clean();
- albums.clean();
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public AxConcept copyTo(final AxConcept target) {
- Assertions.argumentNotNull(target, "target may not be null");
-
- final Object copyObject = target;
- Assertions.instanceOf(copyObject, AxContextModel.class);
-
- final AxContextModel copy = ((AxContextModel) copyObject);
- super.copyTo(target);
- copy.setSchemas(new AxContextSchemas(schemas));
- copy.setAlbums(new AxContextAlbums(albums));
-
- return copy;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public int compareTo(final AxConcept otherObj) {
- Assertions.argumentNotNull(otherObj, "comparison object may not be null");
-
- if (this == otherObj) {
- return 0;
- }
- if (getClass() != otherObj.getClass()) {
- return this.hashCode() - otherObj.hashCode();
- }
-
- final AxContextModel other = (AxContextModel) otherObj;
- if (!super.equals(other)) {
- return super.compareTo(other);
- }
- if (!schemas.equals(other.schemas)) {
- return schemas.compareTo(other.schemas);
- }
- return albums.compareTo(other.albums);
- }
-}
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java
deleted file mode 100644
index 61434ca67..000000000
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2022 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.model.contextmodel.concepts;
-
-import java.util.List;
-import lombok.AccessLevel;
-import lombok.Getter;
-import lombok.ToString;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
-import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-import org.onap.policy.common.utils.validation.Assertions;
-
-/**
- * This class holds a data schema definition in Apex. A data schema describes the structure of a single atom of data
- * handled by Apex. This atom of data can be a primitive type such as an integer or a string, or it can be a more
- * complex data type such as a Java object or an object described using a data definition language such as Avro. The
- * schema flavour defines the type of schema being defined and the schema itself defines the schema. The schema flavour
- * is used by Apex to look up and load a plugin class that understands and interprets the schema definition and can
- * create instances of classes for the schema.
- *
- * <p>An {@link AxContextSchema} is used to define each parameter in Apex events, the messages that enter, exit, and are
- * passed internally in Apex. In addition, an Apex {@link AxContextAlbum} instances hold a map of
- * {@link AxContextSchema} instances to represent the context being managed as an {@link AxContextAlbum}. For example,
- * the state of all cells in a mobile network might be represented as an {@link AxContextAlbum} with its
- * {@link AxContextSchema} being defined as @code cell} objects.
- *
- * <p>Validation checks that the schema key is not null. It also checks that the schema flavour is defined and matches
- * the regular expression SCHEMA_FLAVOUR_REGEXP. Finally, validation checks that the defined schema is not a blank or
- * empty string.
- */
-@Getter
-@ToString
-public class AxContextSchema extends AxConcept {
- private static final String SCHEMA_FLAVOUR = "schemaFlavour";
- private static final String WHITESPACE_REGEXP = "\\s+$";
-
- private static final long serialVersionUID = -6443016863162692288L;
-
- /** Regular expression that constrains what values a schema flavour can have. */
- public static final String SCHEMA_FLAVOUR_REGEXP = "[A-Za-z0-9\\-_]+";
-
- /** An undefined schema flavour has this value. */
- public static final String SCHEMA_FLAVOUR_UNDEFINED = "UNDEFINED";
-
- /** The maximum permissible size of a schema definition. */
- public static final int MAX_SCHEMA_SIZE = 32672; // The maximum size supported by Apache Derby
-
- private AxArtifactKey key;
- private String schemaFlavour;
-
- @Getter(AccessLevel.NONE)
- private String schemaDefinition;
-
- /**
- * The default constructor creates a context schema with a null artifact key. The flavour of the context album is
- * set as SCHEMA_FLAVOUR_UNDEFINED and the schema itself is defined as an empty string.
- */
- public AxContextSchema() {
- this(new AxArtifactKey());
- schemaFlavour = SCHEMA_FLAVOUR_UNDEFINED;
- }
-
- /**
- * Copy constructor.
- *
- * @param copyConcept the concept to copy from
- */
- public AxContextSchema(final AxContextSchema copyConcept) {
- super(copyConcept);
- }
-
- /**
- * The key constructor creates a context schema with the given artifact key. The flavour of the context album is set
- * as SCHEMA_FLAVOUR_UNDEFINED and the schema itself is defined as an empty string.
- *
- * @param key the key
- */
- public AxContextSchema(final AxArtifactKey key) {
- this(key, SCHEMA_FLAVOUR_UNDEFINED, "");
- }
-
- /**
- * This Constructor creates a context schema with all of its fields defined.
- *
- * @param key the key
- * @param schemaFlavour the schema flavour
- * @param schemaDefinition the schema definition
- */
- public AxContextSchema(final AxArtifactKey key, final String schemaFlavour, final String schemaDefinition) {
- super();
- Assertions.argumentNotNull(key, "key may not be null");
- Assertions.argumentNotNull(schemaFlavour, "schemaFlavour may not be null");
- Assertions.argumentNotNull(schemaDefinition, "schemaDefinition may not be null");
-
- this.key = key;
- this.schemaFlavour = Assertions.validateStringParameter(SCHEMA_FLAVOUR, schemaFlavour, SCHEMA_FLAVOUR_REGEXP);
- this.schemaDefinition = schemaDefinition.replaceAll(WHITESPACE_REGEXP, "");
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public List<AxKey> getKeys() {
- return key.getKeys();
- }
-
- /**
- * Sets the key of the context schema.
- *
- * @param key the key of the context schema
- */
- public void setKey(final AxArtifactKey key) {
- Assertions.argumentNotNull(key, "key may not be null");
- this.key = key;
- }
-
- /**
- * Sets the schema flavour, which defines the type of schema definition being used.
- *
- * @param schemaFlavour the schema flavour
- */
- public void setSchemaFlavour(final String schemaFlavour) {
- this.schemaFlavour = Assertions.validateStringParameter(SCHEMA_FLAVOUR, schemaFlavour, SCHEMA_FLAVOUR_REGEXP);
- }
-
- /**
- * Gets the schema, which defines the structure of this data schema atom.
- *
- * @return the schema definition
- */
- public String getSchema() {
- return schemaDefinition;
- }
-
- /**
- * Sets the schema, which defines the structure of this data schema atom.
- *
- * @param schema the schema definition
- */
- public void setSchema(final String schema) {
- Assertions.argumentNotNull(schema, "schema may not be null");
- this.schemaDefinition = schema.replaceAll(WHITESPACE_REGEXP, "");
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public AxValidationResult validate(final AxValidationResult resultIn) {
- AxValidationResult result = resultIn;
-
- if (key.equals(AxArtifactKey.getNullKey())) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key is a null key"));
- }
-
- result = key.validate(result);
-
- if (schemaFlavour.replaceAll(WHITESPACE_REGEXP, "").length() == 0
- || schemaFlavour.equals(SCHEMA_FLAVOUR_UNDEFINED)) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "schema flavour is not defined"));
- }
-
- var flavourValidationResult = Assertions.getStringParameterValidationMessage(SCHEMA_FLAVOUR, schemaFlavour,
- SCHEMA_FLAVOUR_REGEXP);
- if (flavourValidationResult != null) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "schema flavour invalid-" + flavourValidationResult));
- }
-
- if (schemaDefinition.replaceAll(WHITESPACE_REGEXP, "").length() == 0) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "no schemaDefinition specified, schemaDefinition may not be blank"));
- }
-
- return result;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void clean() {
- key.clean();
- schemaFlavour = Assertions.validateStringParameter(SCHEMA_FLAVOUR, schemaFlavour, SCHEMA_FLAVOUR_REGEXP);
- schemaDefinition = schemaDefinition.replaceAll(WHITESPACE_REGEXP, "");
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public AxConcept copyTo(final AxConcept target) {
- Assertions.argumentNotNull(target, "target may not be null");
-
- final Object copyObject = target;
- Assertions.instanceOf(copyObject, AxContextSchema.class);
-
- final AxContextSchema copy = ((AxContextSchema) copyObject);
- copy.setKey(new AxArtifactKey(key));
- copy.setSchemaFlavour(schemaFlavour);
- copy.setSchema(schemaDefinition);
-
- return copy;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public int hashCode() {
- final var prime = 31;
- var result = 1;
- result = prime * result + key.hashCode();
- result = prime * result + schemaFlavour.hashCode();
-
- final String thisSchema = schemaDefinition.replace("\n", "");
- result = prime * result + thisSchema.hashCode();
- return result;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public boolean equals(final Object obj) {
- if (obj == null) {
- return false;
- }
- if (this == obj) {
- return true;
- }
-
- if (getClass() != obj.getClass()) {
- return false;
- }
-
- final AxContextSchema other = (AxContextSchema) obj;
-
- if (!key.equals(other.key)) {
- return false;
- }
- if (!schemaFlavour.equals(other.schemaFlavour)) {
- return false;
- }
- return schemaDefinition.equals(other.schemaDefinition);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public int compareTo(final AxConcept otherObj) {
- if (otherObj == null) {
- return -1;
- }
- if (this == otherObj) {
- return 0;
- }
- if (getClass() != otherObj.getClass()) {
- return this.hashCode() - otherObj.hashCode();
- }
-
- final AxContextSchema other = (AxContextSchema) otherObj;
- if (!key.equals(other.key)) {
- return key.compareTo(other.key);
- }
- if (!schemaFlavour.equals(other.schemaFlavour)) {
- return schemaFlavour.compareTo(other.schemaFlavour);
- }
- return schemaDefinition.compareTo(other.schemaDefinition);
- }
-}
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java
deleted file mode 100644
index 5b79a3dcb..000000000
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2022 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.model.contextmodel.concepts;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.NavigableMap;
-import java.util.Set;
-import java.util.TreeMap;
-import lombok.AccessLevel;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.ToString;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
-import org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter;
-import org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetterImpl;
-import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-import org.onap.policy.common.utils.validation.Assertions;
-
-/**
- * This class is a context schema container and holds a map of the context schemas for an entire Apex model. All Apex
- * models that use context schemas must have an {@link AxContextSchemas} field. The {@link AxContextSchemas} class
- * implements the helper methods of the {@link AxConceptGetter} interface to allow {@link AxContextSchema} instances to
- * be retrieved by calling methods directly on this class without referencing the contained map.
- *
- * <p>Validation checks that the container key is not null. An error is issued if no context schemas are defined in the
- * container. Each context schema entry is checked to ensure that its key and value are not null and that the key
- * matches the key in the map value. Each context schema entry is then validated individually.
- */
-@Getter
-@ToString
-@EqualsAndHashCode(callSuper = false)
-public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxContextSchema> {
- private static final long serialVersionUID = -3203734282886453582L;
-
- private AxArtifactKey key;
-
- @Getter(AccessLevel.NONE)
- private Map<AxArtifactKey, AxContextSchema> schemas;
-
- /**
- * The Default Constructor creates a {@link AxContextSchemas} object with a null artifact key and creates an empty
- * context schemas map.
- */
- public AxContextSchemas() {
- this(new AxArtifactKey());
- }
-
- /**
- * Copy constructor.
- *
- * @param copyConcept the concept to copy from
- */
- public AxContextSchemas(final AxContextSchemas copyConcept) {
- super(copyConcept);
- }
-
- /**
- * The Key Constructor creates a {@link AxContextSchemas} object with the given artifact key and creates an empty
- * context schemas map.
- *
- * @param key the key of the context album container
- */
- public AxContextSchemas(final AxArtifactKey key) {
- this(key, new TreeMap<>());
- }
-
- /**
- * This Constructor creates a {@link AxContextSchemas} object with all its fields defined.
- *
- * @param key the key of the context schema container
- * @param schemas a map of the schemas to insert in the context schema container
- */
- public AxContextSchemas(final AxArtifactKey key, final Map<AxArtifactKey, AxContextSchema> schemas) {
- super();
- Assertions.argumentNotNull(key, "key may not be null");
- Assertions.argumentNotNull(schemas, "schemas may not be null");
-
- this.key = key;
- this.schemas = new TreeMap<>();
- this.schemas.putAll(schemas);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public List<AxKey> getKeys() {
- final List<AxKey> keyList = key.getKeys();
- keyList.addAll(schemas.keySet());
-
- return keyList;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void buildReferences() {
- schemas.values().stream().forEach(schema -> schema.buildReferences());
- }
-
- /**
- * Sets the key of the context schema container.
- *
- * @param key the key of the container
- */
- public void setKey(final AxArtifactKey key) {
- Assertions.argumentNotNull(key, "key may not be null");
- this.key = key;
- }
-
- /**
- * Gets the map of context schemas in this container.
- *
- * @return the map of schemas
- */
- public Map<AxArtifactKey, AxContextSchema> getSchemasMap() {
- return schemas;
- }
-
- /**
- * Sets the map of context schemas in this container.
- *
- * @param schemasMap the map of schemas
- */
- public void setSchemasMap(final Map<AxArtifactKey, AxContextSchema> schemasMap) {
- Assertions.argumentNotNull(schemasMap, "schemasMap may not be null");
-
- this.schemas = new TreeMap<>();
- this.schemas.putAll(schemasMap);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public AxValidationResult validate(final AxValidationResult resultIn) {
- AxValidationResult result = resultIn;
-
- if (key.equals(AxArtifactKey.getNullKey())) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key is a null key"));
- }
-
- result = key.validate(result);
-
- if (schemas.size() == 0) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "contextSchemas may not be empty"));
- } else {
- for (final Entry<AxArtifactKey, AxContextSchema> contextSchemaEntry : schemas.entrySet()) {
- if (contextSchemaEntry.getKey().equals(AxArtifactKey.getNullKey())) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key on schemas entry " + contextSchemaEntry.getKey()
- + " may not be the null key"));
- } else if (contextSchemaEntry.getValue() == null) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "value on schemas entry " + contextSchemaEntry.getKey() + " may not be null"));
- } else {
- if (!contextSchemaEntry.getKey().equals(contextSchemaEntry.getValue().getKey())) {
- result.addValidationMessage(
- new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key on schemas entry " + contextSchemaEntry.getKey()
- + " does not equal entry key "
- + contextSchemaEntry.getValue().getKey()));
- }
-
- result = contextSchemaEntry.getValue().validate(result);
- }
- }
- }
-
- return result;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void clean() {
- key.clean();
- for (final Entry<AxArtifactKey, AxContextSchema> contextSchemaEntry : schemas.entrySet()) {
- contextSchemaEntry.getKey().clean();
- contextSchemaEntry.getValue().clean();
- }
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public AxConcept copyTo(final AxConcept target) {
- Assertions.argumentNotNull(target, "target may not be null");
-
- final Object copyObject = target;
- Assertions.instanceOf(copyObject, AxContextSchemas.class);
-
- final AxContextSchemas copy = ((AxContextSchemas) copyObject);
- copy.setKey(new AxArtifactKey(key));
-
- final Map<AxArtifactKey, AxContextSchema> newcontextSchemas = new TreeMap<>();
- for (final Entry<AxArtifactKey, AxContextSchema> contextSchemasEntry : schemas.entrySet()) {
- newcontextSchemas.put(new AxArtifactKey(contextSchemasEntry.getKey()),
- new AxContextSchema(contextSchemasEntry.getValue()));
- }
- copy.setSchemasMap(newcontextSchemas);
-
- return copy;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public int compareTo(final AxConcept otherObj) {
- if (otherObj == null) {
- return -1;
- }
- if (this == otherObj) {
- return 0;
- }
- if (getClass() != otherObj.getClass()) {
- return this.hashCode() - otherObj.hashCode();
- }
-
- final AxContextSchemas other = (AxContextSchemas) otherObj;
- if (!key.equals(other.key)) {
- return key.compareTo(other.key);
- }
- if (!schemas.equals(other.schemas)) {
- return (schemas.hashCode() - other.schemas.hashCode());
- }
-
- return 0;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public AxContextSchema get(final AxArtifactKey conceptKey) {
- return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxContextSchema>) schemas).get(conceptKey);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public AxContextSchema get(final String conceptKeyName) {
- return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxContextSchema>) schemas).get(conceptKeyName);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public AxContextSchema get(final String conceptKeyName, final String conceptKeyVersion) {
- return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxContextSchema>) schemas).get(conceptKeyName,
- conceptKeyVersion);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public Set<AxContextSchema> getAll(final String conceptKeyName) {
- return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxContextSchema>) schemas).getAll(conceptKeyName);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public Set<AxContextSchema> getAll(final String conceptKeyName, final String conceptKeyVersion) {
- return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxContextSchema>) schemas).getAll(conceptKeyName,
- conceptKeyVersion);
- }
-}
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/package-info.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/package-info.java
deleted file mode 100644
index a7aa3a5ad..000000000
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/package-info.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-/**
- * Contains the concepts required to manage context in APEX. It defines the main APEX concepts of Context Schemas and
- * Context Albums.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-
-package org.onap.policy.apex.model.contextmodel.concepts;
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/handling/ContextComparer.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/handling/ContextComparer.java
deleted file mode 100644
index 7a5ebfd22..000000000
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/handling/ContextComparer.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.model.contextmodel.handling;
-
-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.AxContextAlbums;
-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.comparison.KeyedMapComparer;
-import org.onap.policy.apex.model.utilities.comparison.KeyedMapDifference;
-
-/**
- * This class compares the context in two AxContext objects and returns the differences. The
- * differences are returned in a {@link KeyedMapDifference} object that contains the left, equal,
- * and right context schemas or albums.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class ContextComparer {
-
- /**
- * Compare two {@link AxContextAlbums} objects, comparing their context albums one after
- * another.
- *
- * @param left the left context
- * @param right the right context
- * @return the difference
- */
- public KeyedMapDifference<AxArtifactKey, AxContextAlbum> compare(final AxContextAlbums left,
- final AxContextAlbums right) {
- // Find the difference between the AxContext objects
- return new KeyedMapComparer<AxArtifactKey, AxContextAlbum>().compareMaps(left.getAlbumsMap(),
- right.getAlbumsMap());
- }
-
- /**
- * Compare two {@link AxContextSchema} objects, comparing their context schemas one after
- * another.
- *
- * @param left the left context
- * @param right the right context
- * @return the difference
- */
- public KeyedMapDifference<AxArtifactKey, AxContextSchema> compare(final AxContextSchemas left,
- final AxContextSchemas right) {
- // Find the difference between the AxContext objects
- return new KeyedMapComparer<AxArtifactKey, AxContextSchema>().compareMaps(left.getSchemasMap(),
- right.getSchemasMap());
- }
-
-}
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/handling/package-info.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/handling/package-info.java
deleted file mode 100644
index ec1fa893f..000000000
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/handling/package-info.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-/**
- * Provides some helper classes for handling context, including a utility class for comparing two
- * context objects.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-package org.onap.policy.apex.model.contextmodel.handling;
diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextAlbumsTest.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextAlbumsTest.java
deleted file mode 100644
index 44161b329..000000000
--- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextAlbumsTest.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2021 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.model.contextmodel.concepts;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Test;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-
-/**
- * Context album tests.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class ContextAlbumsTest {
-
- @Test
- public void testNewAxContectAlbum() {
- assertNotNull(new AxContextAlbum());
- assertNotNull(new AxContextAlbum(new AxArtifactKey()));
- assertNotNull(new AxContextAlbum(new AxArtifactKey(), "AlbumScope", false, new AxArtifactKey()));
- }
-
- @Test
- public void testContextAlbums() {
- final AxArtifactKey albumKey = new AxArtifactKey("AlbumName", "0.0.1");
- final AxArtifactKey albumSchemaKey = new AxArtifactKey("AlbumSchemaName", "0.0.1");
-
- final AxContextAlbum album = new AxContextAlbum(albumKey, "AlbumScope", false, albumSchemaKey);
- assertNotNull(album);
-
- final AxArtifactKey newKey = new AxArtifactKey("NewAlbumName", "0.0.1");
- album.setKey(newKey);
- assertEquals("NewAlbumName:0.0.1", album.getKey().getId());
- assertEquals("NewAlbumName:0.0.1", album.getKeys().get(0).getId());
- album.setKey(albumKey);
-
- assertThatThrownBy(() -> album.setScope(""))
- .hasMessage("parameter \"scope\": value \"\", does not match regular expression "
- + "\"[A-Za-z0-9\\-_]+\"");
-
- album.setScope("NewAlbumScope");
- assertEquals("NewAlbumScope", album.getScope());
-
- assertEquals(false, album.isWritable());
- album.setWritable(true);
- assertEquals(true, album.isWritable());
-
- final AxArtifactKey newSchemaKey = new AxArtifactKey("NewAlbumSchemaName", "0.0.1");
- album.setItemSchema(newSchemaKey);
- assertEquals("NewAlbumSchemaName:0.0.1", album.getItemSchema().getId());
- album.setItemSchema(albumSchemaKey);
- }
-
- private AxContextAlbum setTestAlbum() {
- final AxArtifactKey newKey = new AxArtifactKey("NewAlbumName", "0.0.1");
- final AxArtifactKey newSchemaKey = new AxArtifactKey("NewAlbumSchemaName", "0.0.1");
-
- final AxContextAlbum album = new AxContextAlbum(newKey, "AlbumScope", false, newSchemaKey);
-
- album.setScope("NewAlbumScope");
- album.setWritable(true);
-
- return album;
- }
-
- @Test
- public void testAxvalidationAlbum() {
- final AxContextAlbum album = setTestAlbum();
- AxValidationResult result = new AxValidationResult();
- result = album.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- album.setKey(AxArtifactKey.getNullKey());
- result = new AxValidationResult();
- result = album.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- final AxArtifactKey newKey = new AxArtifactKey("NewAlbumName", "0.0.1");
- album.setKey(newKey);
- result = new AxValidationResult();
- result = album.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- album.setScope("UNDEFINED");
- result = new AxValidationResult();
- result = album.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- album.setScope("NewAlbumScope");
- result = new AxValidationResult();
- result = album.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- album.setItemSchema(AxArtifactKey.getNullKey());
- result = new AxValidationResult();
- result = album.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- final AxArtifactKey albumSchemaKey = new AxArtifactKey("AlbumSchemaName", "0.0.1");
- album.setItemSchema(albumSchemaKey);
- result = new AxValidationResult();
- result = album.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- }
-
- @Test
- public void testEqualsAlbum() {
- final AxContextAlbum album = setTestAlbum();
- final AxArtifactKey newKey = new AxArtifactKey("NewAlbumName", "0.0.1");
- final AxArtifactKey albumSchemaKey = new AxArtifactKey("AlbumSchemaName", "0.0.1");
- album.setItemSchema(albumSchemaKey);
-
- final AxContextAlbum clonedAlbum = new AxContextAlbum(album);
- assertEquals("AxContextAlbum(key=AxArtifactKey:(name=NewAlbumName,version=0.0.1), "
- + "scope=NewAlbumScope, isWritable=true, itemSchema="
- + "AxArtifactKey:(name=AlbumSchemaName,version=0.0.1))", clonedAlbum.toString());
-
- assertNotEquals(0, album.hashCode());
- // disabling sonar because this code tests the equals() method
- assertEquals(album, album); // NOSONAR
- assertEquals(album, clonedAlbum);
- assertNotNull(album);
- assertNotEquals(album, (Object) "Hello");
- assertNotEquals(album, new AxContextAlbum(new AxArtifactKey(), "Scope", false, AxArtifactKey.getNullKey()));
- assertNotEquals(album, new AxContextAlbum(newKey, "Scope", false, AxArtifactKey.getNullKey()));
- assertNotEquals(album, new AxContextAlbum(newKey, "NewAlbumScope", false, AxArtifactKey.getNullKey()));
- assertNotEquals(album, new AxContextAlbum(newKey, "NewAlbumScope", true, AxArtifactKey.getNullKey()));
- assertEquals(album, new AxContextAlbum(newKey, "NewAlbumScope", true, albumSchemaKey));
-
- assertEquals(0, album.compareTo(album));
- assertEquals(0, album.compareTo(clonedAlbum));
- assertNotEquals(0, album.compareTo(null));
- assertNotEquals(0, album.compareTo(new AxArtifactKey()));
- assertNotEquals(0, album.compareTo(
- new AxContextAlbum(new AxArtifactKey(), "Scope", false, AxArtifactKey.getNullKey())));
- assertNotEquals(0, album.compareTo(new AxContextAlbum(newKey, "Scope", false, AxArtifactKey.getNullKey())));
- assertNotEquals(0, album
- .compareTo(new AxContextAlbum(newKey, "NewAlbumScope", false, AxArtifactKey.getNullKey())));
- assertNotEquals(0,
- album.compareTo(new AxContextAlbum(newKey, "NewAlbumScope", true, AxArtifactKey.getNullKey())));
- assertEquals(0, album.compareTo(new AxContextAlbum(newKey, "NewAlbumScope", true, albumSchemaKey)));
- }
-
- @Test
- public void testMultipleAlbums() {
- final AxContextAlbums albums = new AxContextAlbums();
- final AxContextAlbum album = setTestAlbum();
- final AxArtifactKey newKey = new AxArtifactKey("NewAlbumName", "0.0.1");
- AxValidationResult result = new AxValidationResult();
- result = albums.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- // Observation, no albums in album map
- albums.setKey(new AxArtifactKey("AlbumsKey", "0.0.1"));
- result = new AxValidationResult();
- result = albums.validate(result);
- assertEquals(ValidationResult.OBSERVATION, result.getValidationResult());
-
- albums.getAlbumsMap().put(newKey, album);
- result = new AxValidationResult();
- result = albums.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- albums.getAlbumsMap().put(AxArtifactKey.getNullKey(), null);
- result = new AxValidationResult();
- result = albums.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- albums.getAlbumsMap().remove(AxArtifactKey.getNullKey());
- result = new AxValidationResult();
- result = albums.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- albums.getAlbumsMap().put(new AxArtifactKey("NullValueKey", "0.0.1"), null);
- result = new AxValidationResult();
- result = albums.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- albums.getAlbumsMap().remove(new AxArtifactKey("NullValueKey", "0.0.1"));
- result = new AxValidationResult();
- result = albums.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- }
-
- @Test
- public void testClonedAlbums() {
- final AxContextAlbums albums = new AxContextAlbums();
- final AxContextAlbum album = setTestAlbum();
- final AxArtifactKey newKey = new AxArtifactKey("NewAlbumName", "0.0.1");
- albums.setKey(new AxArtifactKey("AlbumsKey", "0.0.1"));
- albums.getAlbumsMap().put(newKey, album);
- albums.clean();
-
- final AxContextAlbums clonedAlbums = new AxContextAlbums(albums);
- assertThat(clonedAlbums.toString()).startsWith(
- "AxContextAlbums(key=AxArtifactKey:(name=AlbumsKey,version=0.0.1)");
-
- assertNotEquals(0, albums.hashCode());
-
- assertEquals(albums, clonedAlbums);
- assertNotNull(albums);
- assertNotEquals(albums, (Object) "Hello");
- assertNotEquals(albums, new AxContextAlbums(new AxArtifactKey()));
-
- assertEquals(0, albums.compareTo(albums));
- assertEquals(0, albums.compareTo(clonedAlbums));
- assertNotEquals(0, albums.compareTo(null));
- assertNotEquals(0, albums.compareTo(new AxArtifactKey()));
- assertNotEquals(0, albums.compareTo(new AxContextAlbums(new AxArtifactKey())));
-
- clonedAlbums.get(newKey).setScope("YetAnotherScope");
- assertNotEquals(0, albums.compareTo(clonedAlbums));
-
- assertEquals("NewAlbumName", albums.get("NewAlbumName").getKey().getName());
- assertEquals("NewAlbumName", albums.get("NewAlbumName", "0.0.1").getKey().getName());
- assertEquals(1, albums.getAll("NewAlbumName", "0.0.1").size());
- assertEquals(0, albums.getAll("NonExistantAlbumName").size());
- }
-}
diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextModelTest.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextModelTest.java
deleted file mode 100644
index b148ef6be..000000000
--- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextModelTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2020 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.model.contextmodel.concepts;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Test;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
-
-/**
- * Context model tests.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class ContextModelTest {
-
- @Test
- public void test() {
- assertNotNull(new AxContextModel());
- assertNotNull(new AxContextModel(new AxArtifactKey()));
- assertNotNull(new AxContextModel(new AxArtifactKey(), new AxContextSchemas(), new AxKeyInformation()));
- assertNotNull(new AxContextModel(new AxArtifactKey(), new AxContextSchemas(), new AxContextAlbums(),
- new AxKeyInformation()));
-
- final AxArtifactKey modelKey = new AxArtifactKey("ModelKey", "0.0.1");
- final AxArtifactKey schemasKey = new AxArtifactKey("SchemasKey", "0.0.1");
- final AxArtifactKey albumsKey = new AxArtifactKey("SchemasKey", "0.0.1");
- final AxArtifactKey keyInfoKey = new AxArtifactKey("SchemasKey", "0.0.1");
- final AxContextModel model = new AxContextModel(modelKey, new AxContextSchemas(schemasKey),
- new AxContextAlbums(albumsKey), new AxKeyInformation(keyInfoKey));
- model.register();
-
- model.clean();
- assertNotNull(model);
- assertThat(model.toString()).startsWith("AxContextModel(super=AxContextModel:(key=AxArtifactKey:");
-
- final AxContextModel clonedModel = new AxContextModel(model);
-
- assertNotEquals(0, model.hashCode());
-
- // disabling sonar because this code tests the equals() method
- assertEquals(model, model); // NOSONAR
- assertEquals(model, clonedModel);
- assertNotEquals(model, (Object) "Hello");
- assertNotEquals(model, new AxContextModel(new AxArtifactKey()));
- assertNotEquals(model, new AxContextModel(new AxArtifactKey(), new AxContextSchemas(), new AxContextAlbums(),
- new AxKeyInformation()));
- assertNotEquals(model, new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(),
- new AxKeyInformation()));
- assertNotEquals(model, new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(),
- new AxKeyInformation(keyInfoKey)));
- assertNotEquals(model, new AxContextModel(modelKey, new AxContextSchemas(schemasKey), new AxContextAlbums(),
- new AxKeyInformation(keyInfoKey)));
- assertEquals(model, new AxContextModel(modelKey, new AxContextSchemas(schemasKey),
- new AxContextAlbums(albumsKey), new AxKeyInformation(keyInfoKey)));
-
- assertEquals(0, model.compareTo(model));
- assertEquals(0, model.compareTo(clonedModel));
- assertNotEquals(0, model.compareTo(new AxArtifactKey()));
- assertNotEquals(0, model.compareTo(new AxContextModel(new AxArtifactKey(), new AxContextSchemas(),
- new AxContextAlbums(), new AxKeyInformation())));
- assertNotEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(),
- new AxKeyInformation())));
- assertNotEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(),
- new AxKeyInformation(keyInfoKey))));
- assertNotEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(schemasKey),
- new AxContextAlbums(), new AxKeyInformation(keyInfoKey))));
- assertEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(schemasKey),
- new AxContextAlbums(albumsKey), new AxKeyInformation(keyInfoKey))));
- }
-}
diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextSchemasTest.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextSchemasTest.java
deleted file mode 100644
index 52cca14bf..000000000
--- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextSchemasTest.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020-2021 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.model.contextmodel.concepts;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Test;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-
-/**
- * Context schema tests.
- */
-public class ContextSchemasTest {
-
- @Test
- public void testNewAxContextSchema() {
- assertNotNull(new AxContextSchema());
- assertNotNull(new AxContextSchema(new AxArtifactKey(), "SchemaFlavour", "SchemaDefinition"));
-
- }
-
- @Test
- public void testContextSchemas() {
- final AxContextSchema schema = new AxContextSchema(new AxArtifactKey("SchemaName", "0.0.1"), "SchemaFlavour",
- "SchemaDefinition");
- assertNotNull(schema);
-
- final AxArtifactKey newKey = new AxArtifactKey("NewSchemaName", "0.0.1");
- schema.setKey(newKey);
- assertEquals("NewSchemaName:0.0.1", schema.getKey().getId());
- assertEquals("NewSchemaName:0.0.1", schema.getKeys().get(0).getId());
-
- assertThatThrownBy(() -> schema.setSchemaFlavour(""))
- .hasMessage("parameter \"schemaFlavour\": value \"\", "
- + "does not match regular expression \"[A-Za-z0-9\\-_]+\"");
- schema.setSchemaFlavour("NewSchemaFlavour");
- assertEquals("NewSchemaFlavour", schema.getSchemaFlavour());
-
- schema.setSchema("NewSchemaDefinition");
- assertEquals("NewSchemaDefinition", schema.getSchema());
- }
-
- private AxContextSchema setTestSchema() {
- final AxContextSchema schema = new AxContextSchema(new AxArtifactKey("SchemaName", "0.0.1"), "SchemaFlavour",
- "SchemaDefinition");
- final AxArtifactKey newKey = new AxArtifactKey("NewSchemaName", "0.0.1");
- schema.setKey(newKey);
- schema.setSchemaFlavour("NewSchemaFlavour");
- schema.setSchema("NewSchemaDefinition");
-
- return schema;
- }
-
- @Test
- public void testAxvalidationSchema() {
- AxContextSchema schema = setTestSchema();
- AxValidationResult result = new AxValidationResult();
- result = schema.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- schema.setKey(AxArtifactKey.getNullKey());
- result = new AxValidationResult();
- result = schema.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- final AxArtifactKey newKey = new AxArtifactKey("NewSchemaName", "0.0.1");
- schema.setKey(newKey);
- result = new AxValidationResult();
- result = schema.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- schema.setSchemaFlavour("UNDEFINED");
- result = new AxValidationResult();
- result = schema.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- schema.setSchemaFlavour("NewSchemaFlavour");
- result = new AxValidationResult();
- result = schema.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- schema.setSchema("");
- result = new AxValidationResult();
- result = schema.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- schema.setSchema("NewSchemaDefinition");
- result = new AxValidationResult();
- result = schema.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
- }
-
- @Test
- public void testEqualsSchema() {
- AxContextSchema schema = setTestSchema();
- schema.clean();
-
- final AxContextSchema clonedSchema = new AxContextSchema(schema);
- assertEquals("AxContextSchema(key=AxArtifactKey:(name=NewSchemaName,version=0.0.1), "
- + "schemaFlavour=NewSchemaFlavour, schemaDefinition=NewSchemaDefinition)",
- clonedSchema.toString());
-
- assertNotEquals(0, schema.hashCode());
-
- // disabling sonar because this code tests the equals() method
- assertEquals(schema, schema); // NOSONAR
- assertEquals(schema, clonedSchema);
- assertNotNull(schema);
- assertNotEquals(schema, (Object) "Hello");
- assertNotEquals(schema, new AxContextSchema(new AxArtifactKey(), "Flavour", "Def"));
-
- final AxArtifactKey newKey = new AxArtifactKey("NewSchemaName", "0.0.1");
- assertNotEquals(schema, new AxContextSchema(newKey, "Flavour", "Def"));
- assertNotEquals(schema, new AxContextSchema(newKey, "NewSchemaFlavour", "Def"));
- assertEquals(schema, new AxContextSchema(newKey, "NewSchemaFlavour", "NewSchemaDefinition"));
-
- assertEquals(0, schema.compareTo(schema));
- assertEquals(0, schema.compareTo(clonedSchema));
- assertNotEquals(0, schema.compareTo(null));
- assertNotEquals(0, schema.compareTo(new AxArtifactKey()));
- assertNotEquals(0, schema.compareTo(new AxContextSchema(new AxArtifactKey(), "Flavour", "Def")));
- assertNotEquals(0, schema.compareTo(new AxContextSchema(newKey, "Flavour", "Def")));
- assertNotEquals(0, schema.compareTo(new AxContextSchema(newKey, "NewSchemaFlavour", "Def")));
- assertEquals(0, schema.compareTo(new AxContextSchema(newKey, "NewSchemaFlavour", "NewSchemaDefinition")));
- }
-
- @Test
- public void testMultipleSchemas() {
- final AxContextSchemas schemas = new AxContextSchemas();
- AxValidationResult result = new AxValidationResult();
- result = schemas.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- // Still invalid, no schemas in schema map
- schemas.setKey(new AxArtifactKey("SchemasKey", "0.0.1"));
- result = new AxValidationResult();
- result = schemas.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- AxContextSchema schema = setTestSchema();
- final AxArtifactKey newKey = new AxArtifactKey("NewSchemaName", "0.0.1");
- schemas.getSchemasMap().put(newKey, schema);
- result = new AxValidationResult();
- result = schemas.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- schemas.getSchemasMap().put(AxArtifactKey.getNullKey(), null);
- result = new AxValidationResult();
- result = schemas.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- schemas.getSchemasMap().remove(AxArtifactKey.getNullKey());
- result = new AxValidationResult();
- result = schemas.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- schemas.getSchemasMap().put(new AxArtifactKey("NullValueKey", "0.0.1"), null);
- result = new AxValidationResult();
- result = schemas.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- schemas.getSchemasMap().remove(new AxArtifactKey("NullValueKey", "0.0.1"));
- result = new AxValidationResult();
- result = schemas.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- }
-
- @Test
- public void testClonedSchemas() {
- final AxContextSchemas schemas = new AxContextSchemas();
- AxContextSchema schema = setTestSchema();
- final AxArtifactKey newKey = new AxArtifactKey("NewSchemaName", "0.0.1");
- schemas.setKey(new AxArtifactKey("SchemasKey", "0.0.1"));
- schemas.getSchemasMap().put(newKey, schema);
- schemas.clean();
-
- final AxContextSchemas clonedSchemas = new AxContextSchemas(schemas);
- assertThat(clonedSchemas.toString())
- .startsWith("AxContextSchemas(key=AxArtifactKey:(name=SchemasKey,version=0.0.1),");
-
- assertNotEquals(0, schemas.hashCode());
-
- assertEquals(schemas, clonedSchemas);
- assertNotNull(schemas);
- assertNotEquals(schemas, (Object) "Hello");
- assertNotEquals(schemas, new AxContextSchemas(new AxArtifactKey()));
-
- assertEquals(0, schemas.compareTo(schemas));
- assertEquals(0, schemas.compareTo(clonedSchemas));
- assertNotEquals(0, schemas.compareTo(null));
- assertNotEquals(0, schemas.compareTo(new AxArtifactKey()));
- assertNotEquals(0, schemas.compareTo(new AxContextSchemas(new AxArtifactKey())));
-
- clonedSchemas.get(newKey).setSchemaFlavour("YetAnotherFlavour");
- assertNotEquals(0, schemas.compareTo(clonedSchemas));
-
- assertEquals("NewSchemaName", schemas.get("NewSchemaName").getKey().getName());
- assertEquals("NewSchemaName", schemas.get("NewSchemaName", "0.0.1").getKey().getName());
- assertEquals(1, schemas.getAll("NewSchemaName", "0.0.1").size());
- assertEquals(0, schemas.getAll("NonExistantSchemaName").size());
- }
-}
diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ApexContextModelTest.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ApexContextModelTest.java
deleted file mode 100644
index 998469bac..000000000
--- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ApexContextModelTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020,2022 Nordix Foundation.
- * ================================================================================
- * 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.model.contextmodel.handling;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
-
-/**
- * Apex context model tests.
- *
- * @author liam
- *
- */
-public class ApexContextModelTest {
-
- private static final String VALID_MODEL_STRING = "***validation of model successful***";
-
- private static final String OBSERVATION_MODEL_STRING = "\n"
- + "***observations noted during validation of model***\n"
- + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):"
- + "org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo:OBSERVATION:description is blank\n"
- + "********************************";
-
- private static final String WARNING_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n"
- + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):"
- + "org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo:WARNING:"
- + "UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n"
- + "********************************";
-
- private static final String INVALID_MODEL_STRING = "\n" + "***validation of model failed***\n"
- + "AxArtifactKey:(name=StringType,version=0.0.1):"
- + "org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema:INVALID:"
- + "no schemaDefinition specified, schemaDefinition may not be blank\n"
- + "AxArtifactKey:(name=contextAlbum0,version=0.0.1):"
- + "org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum:INVALID:"
- + "scope is not defined\n" + "********************************";
-
- private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" + "***validation of model failed***\n"
- + "AxArtifactKey:(name=ContextModel,version=0.0.1):"
- + "org.onap.policy.apex.model.contextmodel.concepts.AxContextModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=contextAlbum1,version=0.0.2)\n"
- + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):"
- + "org.onap.policy.apex.model.contextmodel.concepts.AxContextModel:WARNING:"
- + "key not found for key information entry\n" + "AxArtifactKey:(name=ContextSchemas,version=0.0.1):"
- + "org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas:INVALID:"
- + "key on schemas entry AxArtifactKey:(name=MapType,version=0.0.1) "
- + "does not equal entry key AxArtifactKey:(name=MapType,version=0.0.2)\n"
- + "AxArtifactKey:(name=contextAlbums,version=0.0.1):"
- + "org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums:INVALID:"
- + "key on context album entry key AxArtifactKey:(name=contextAlbum1,version=0.0.1) "
- + "does not equal context album value key AxArtifactKey:(name=contextAlbum1,version=0.0.2)\n"
- + "********************************";
-
- TestApexModel<AxContextModel> testApexModel;
-
- /**
- * Set up tests.
- *
- * @throws Exception a testing exception
- */
- @Before
- public void setup() throws Exception {
- testApexModel = new TestApexModel<AxContextModel>(AxContextModel.class, new TestApexContextModelCreator());
- }
-
- @Test
- public void testModelValid() throws Exception {
- final AxValidationResult result = testApexModel.testApexModelValid();
- assertEquals(VALID_MODEL_STRING, result.toString());
- }
-
- @Test
- public void testApexModelVaidateObservation() throws Exception {
- final AxValidationResult result = testApexModel.testApexModelVaidateObservation();
- assertEquals(OBSERVATION_MODEL_STRING, result.toString());
- }
-
- @Test
- public void testApexModelVaidateWarning() throws Exception {
- final AxValidationResult result = testApexModel.testApexModelVaidateWarning();
- assertEquals(WARNING_MODEL_STRING, result.toString());
- }
-
- @Test
- public void testModelVaidateInvalidModel() throws Exception {
- final AxValidationResult result = testApexModel.testApexModelVaidateInvalidModel();
- assertEquals(INVALID_MODEL_STRING, result.toString());
- }
-
- @Test
- public void testModelVaidateMalstructured() throws Exception {
- final AxValidationResult result = testApexModel.testApexModelVaidateMalstructured();
- assertEquals(INVALID_MODEL_MALSTRUCTURED_STRING, result.toString());
- }
-
- @Test
- public void testModelWriteReadJson() throws Exception {
- testApexModel.testApexModelWriteReadJson();
- }
-}
diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ContextComparisonTest.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ContextComparisonTest.java
deleted file mode 100644
index 483bc3661..000000000
--- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ContextComparisonTest.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Nordix Foundation.
- * ================================================================================
- * 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.model.contextmodel.handling;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Before;
-import org.junit.Test;
-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;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
-import org.onap.policy.apex.model.utilities.comparison.KeyedMapDifference;
-
-/**
- * Test context comparisons.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class ContextComparisonTest {
- private AxContextModel emptyModel;
- private AxContextModel fullModel;
- private AxContextModel noGlobalContextModel;
- private AxContextModel shellModel;
- private AxContextModel singleEntryModel;
-
- /**
- * Set up tests.
- */
- @Before
- public void getContext() {
- final TestContextComparisonFactory factory = new TestContextComparisonFactory();
- emptyModel = factory.getEmptyModel();
- fullModel = factory.getFullModel();
- noGlobalContextModel = factory.getNoGlobalContextModel();
- shellModel = factory.getShellModel();
- singleEntryModel = factory.getSingleEntryModel();
- }
-
- @Test
- public void testEmptyEmpty() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
- .compare(emptyModel.getSchemas(), emptyModel.getSchemas());
- assertNotNull(schemaResult);
- assertEquals(emptyModel.getSchemas().getSchemasMap(), schemaResult.getIdenticalValues());
-
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
- .compare(emptyModel.getAlbums(), emptyModel.getAlbums());
- assertNotNull(albumResult);
- assertEquals(emptyModel.getAlbums().getAlbumsMap(), albumResult.getIdenticalValues());
- }
-
- @Test
- public void testEmptyFull() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
- .compare(emptyModel.getSchemas(), fullModel.getSchemas());
- assertNotNull(schemaResult);
- assertEquals(fullModel.getSchemas().getSchemasMap(), schemaResult.getRightOnly());
-
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
- .compare(emptyModel.getAlbums(), fullModel.getAlbums());
- assertNotNull(albumResult);
- assertEquals(fullModel.getAlbums().getAlbumsMap(), albumResult.getRightOnly());
- }
-
- @Test
- public void testFullEmpty() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
- .compare(fullModel.getSchemas(), emptyModel.getSchemas());
- assertNotNull(schemaResult);
- assertEquals(fullModel.getSchemas().getSchemasMap(), schemaResult.getLeftOnly());
-
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
- .compare(fullModel.getAlbums(), emptyModel.getAlbums());
- assertNotNull(albumResult);
- assertEquals(fullModel.getAlbums().getAlbumsMap(), albumResult.getLeftOnly());
- }
-
- @Test
- public void testEmptyNoGlobalContext() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
- .compare(emptyModel.getSchemas(), noGlobalContextModel.getSchemas());
- assertNotNull(schemaResult);
- assertEquals(noGlobalContextModel.getSchemas().getSchemasMap(), schemaResult.getRightOnly());
-
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
- .compare(emptyModel.getAlbums(), noGlobalContextModel.getAlbums());
- assertNotNull(albumResult);
- assertEquals(noGlobalContextModel.getAlbums().getAlbumsMap(), albumResult.getRightOnly());
- }
-
- @Test
- public void testNoGlobalContextEmpty() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
- .compare(noGlobalContextModel.getSchemas(), emptyModel.getSchemas());
- assertNotNull(schemaResult);
- assertEquals(noGlobalContextModel.getSchemas().getSchemasMap(), schemaResult.getLeftOnly());
-
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
- .compare(noGlobalContextModel.getAlbums(), emptyModel.getAlbums());
- assertNotNull(albumResult);
- assertEquals(noGlobalContextModel.getAlbums().getAlbumsMap(), albumResult.getLeftOnly());
- }
-
- @Test
- public void testEmptyShell() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
- .compare(emptyModel.getSchemas(), shellModel.getSchemas());
- assertNotNull(schemaResult);
- assertEquals(shellModel.getSchemas().getSchemasMap(), schemaResult.getRightOnly());
-
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
- .compare(emptyModel.getAlbums(), shellModel.getAlbums());
- assertNotNull(albumResult);
- assertEquals(shellModel.getAlbums().getAlbumsMap(), albumResult.getRightOnly());
- }
-
- @Test
- public void testShellEmpty() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
- .compare(shellModel.getSchemas(), emptyModel.getSchemas());
- assertNotNull(schemaResult);
- assertEquals(shellModel.getSchemas().getSchemasMap(), schemaResult.getLeftOnly());
-
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
- .compare(shellModel.getAlbums(), emptyModel.getAlbums());
- assertNotNull(albumResult);
- assertEquals(shellModel.getAlbums().getAlbumsMap(), albumResult.getLeftOnly());
- }
-
- @Test
- public void testEmptySingleEntry() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
- .compare(emptyModel.getSchemas(), singleEntryModel.getSchemas());
- assertNotNull(schemaResult);
- assertEquals(singleEntryModel.getSchemas().getSchemasMap(), schemaResult.getRightOnly());
-
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
- .compare(emptyModel.getAlbums(), singleEntryModel.getAlbums());
- assertNotNull(albumResult);
- assertEquals(singleEntryModel.getAlbums().getAlbumsMap(), albumResult.getRightOnly());
- }
-
- @Test
- public void testSingleEntryEmpty() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
- .compare(singleEntryModel.getSchemas(), emptyModel.getSchemas());
- assertNotNull(schemaResult);
- assertEquals(singleEntryModel.getSchemas().getSchemasMap(), schemaResult.getLeftOnly());
-
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
- .compare(singleEntryModel.getAlbums(), emptyModel.getAlbums());
- assertNotNull(albumResult);
- assertEquals(singleEntryModel.getAlbums().getAlbumsMap(), albumResult.getLeftOnly());
- }
-
- @Test
- public void testFullFull() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
- .compare(fullModel.getSchemas(), fullModel.getSchemas());
- assertNotNull(schemaResult);
- assertEquals(fullModel.getSchemas().getSchemasMap(), schemaResult.getIdenticalValues());
-
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
- .compare(fullModel.getAlbums(), fullModel.getAlbums());
- assertNotNull(albumResult);
- assertEquals(fullModel.getAlbums().getAlbumsMap(), albumResult.getIdenticalValues());
- }
-}
diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModelCreator.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModelCreator.java
deleted file mode 100644
index 3fe7e3aa2..000000000
--- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModelCreator.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.model.contextmodel.handling;
-
-import java.util.UUID;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo;
-import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
-import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator;
-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;
-
-public class TestApexContextModelCreator implements TestApexModelCreator<AxContextModel> {
-
- @Override
- public AxContextModel getModel() {
- final AxContextSchema schema0 = new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java",
- "org.onap.policy.apex.concept.TestContextItem000");
- final AxContextSchema schema1 = new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java",
- "org.onap.policy.apex.concept.TestContextItem00A");
-
- final AxContextSchemas contextSchemas = new AxContextSchemas(new AxArtifactKey("ContextSchemas", "0.0.1"));
- contextSchemas.getSchemasMap().put(schema0.getKey(), schema0);
- contextSchemas.getSchemasMap().put(schema1.getKey(), schema1);
-
- final AxContextAlbum contextAlbum0 =
- new AxContextAlbum(new AxArtifactKey("contextAlbum0", "0.0.1"), "APPLICATION", true, schema0.getKey());
- final AxContextAlbum contextAlbum1 =
- new AxContextAlbum(new AxArtifactKey("contextAlbum1", "0.0.1"), "GLOBAL", false, schema1.getKey());
-
- final AxContextAlbums axContext = new AxContextAlbums(new AxArtifactKey("contextAlbums", "0.0.1"));
- axContext.getAlbumsMap().put(contextAlbum0.getKey(), contextAlbum0);
- axContext.getAlbumsMap().put(contextAlbum1.getKey(), contextAlbum1);
-
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
- final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"),
- contextSchemas, axContext, keyInformation);
-
- contextModel.setKeyInformation(keyInformation);
- contextModel.getKeyInformation().getKeyInfoMap().put(schema0.getKey(), new AxKeyInfo(schema0.getKey(),
- UUID.fromString("00000000-0000-0000-0000-000000000001"), "axContextSchema0"));
- contextModel.getKeyInformation().getKeyInfoMap().put(schema1.getKey(), new AxKeyInfo(schema1.getKey(),
- UUID.fromString("00000000-0000-0000-0000-000000000002"), "axContextSchema1"));
- contextModel.getKeyInformation().getKeyInfoMap().put(contextSchemas.getKey(), new AxKeyInfo(
- contextSchemas.getKey(), UUID.fromString("00000000-0000-0000-0000-000000000003"), "ContextSchemas"));
- contextModel.getKeyInformation().getKeyInfoMap().put(contextAlbum0.getKey(), new AxKeyInfo(
- contextAlbum0.getKey(), UUID.fromString("00000000-0000-0000-0000-000000000004"), "contextAlbum0"));
- contextModel.getKeyInformation().getKeyInfoMap().put(contextAlbum1.getKey(), new AxKeyInfo(
- contextAlbum1.getKey(), UUID.fromString("00000000-0000-0000-0000-000000000005"), "contextAlbum1"));
- contextModel.getKeyInformation().getKeyInfoMap().put(axContext.getKey(), new AxKeyInfo(axContext.getKey(),
- UUID.fromString("00000000-0000-0000-0000-000000000006"), "axContext"));
- contextModel.getKeyInformation().getKeyInfoMap().put(contextModel.getKey(), new AxKeyInfo(contextModel.getKey(),
- UUID.fromString("00000000-0000-0000-0000-000000000007"), "contextModel"));
- contextModel.getKeyInformation().getKeyInfoMap().put(keyInformation.getKey(), new AxKeyInfo(
- keyInformation.getKey(), UUID.fromString("00000000-0000-0000-0000-000000000008"), "keyInformation"));
-
- return contextModel;
- }
-
- @Override
- public AxContextModel getInvalidModel() {
- final AxContextModel contextModel = getModel();
-
- contextModel.getAlbums().get(new AxArtifactKey("contextAlbum0", "0.0.1")).setScope("UNDEFINED");
-
- contextModel.getSchemas().get(new AxArtifactKey("StringType", "0.0.1")).setSchema("");
-
- return contextModel;
- }
-
- @Override
- public AxContextModel getMalstructuredModel() {
- final AxContextModel contextModel = getModel();
-
- contextModel.getAlbums().get(new AxArtifactKey("contextAlbum1", "0.0.1"))
- .setKey(new AxArtifactKey("contextAlbum1", "0.0.2"));;
- contextModel.getSchemas().get(new AxArtifactKey("MapType", "0.0.1"))
- .setKey(new AxArtifactKey("MapType", "0.0.2"));;
-
- return contextModel;
- }
-
- @Override
- public AxContextModel getObservationModel() {
- final AxContextModel contextModel = getModel();
-
- contextModel.getKeyInformation().get("contextAlbum1", "0.0.1").setDescription("");
-
- return contextModel;
- }
-
- @Override
- public AxContextModel getWarningModel() {
- final AxContextModel contextModel = getModel();
-
- contextModel.getKeyInformation().get("contextAlbum1", "0.0.1")
- .setUuid(UUID.fromString("00000000-0000-0000-0000-000000000000"));
-
- return contextModel;
- }
-}
diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparisonFactory.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparisonFactory.java
deleted file mode 100644
index f7c7a1345..000000000
--- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparisonFactory.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.model.contextmodel.handling;
-
-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;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
-
-/**
- * This class creates sample Policy Models.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class TestContextComparisonFactory {
-
- /**
- * Get a full context model.
- * @return the model
- */
- public AxContextModel getFullModel() {
- final AxContextSchema testContextSchema000 =
- new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
- "org.onap.policy.apex.concept.TestContextSchema000");
- final AxContextSchema testContextSchema00A =
- new AxContextSchema(new AxArtifactKey("TestContextSchema00A", "0.0.1"), "JAVA",
- "org.onap.policy.apex.concept.TestContextSchema00A");
- final AxContextSchema testContextSchema00C =
- new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
- "org.onap.policy.apex.concept.TestContextSchema00C");
-
- final AxContextAlbum externalContextAlbum = new AxContextAlbum(
- new AxArtifactKey("ExternalContextAlbum", "0.0.1"), "EXTERNAL", false, testContextSchema000.getKey());
- final AxContextAlbum globalContextAlbum = new AxContextAlbum(new AxArtifactKey("GlobalContextAlbum", "0.0.1"),
- "GLOBAL", true, testContextSchema00A.getKey());
- final AxContextAlbum policy0ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy0ContextAlbum", "0.0.1"),
- "APPLICATION", true, testContextSchema00C.getKey());
- final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(
- new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true, testContextSchema00C.getKey());
-
- final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
- contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
- contextModel.getSchemas().getSchemasMap().put(testContextSchema00A.getKey(), testContextSchema00A);
- contextModel.getSchemas().getSchemasMap().put(testContextSchema00C.getKey(), testContextSchema00C);
-
- contextModel.getAlbums().getAlbumsMap().put(externalContextAlbum.getKey(), externalContextAlbum);
- contextModel.getAlbums().getAlbumsMap().put(globalContextAlbum.getKey(), globalContextAlbum);
- contextModel.getAlbums().getAlbumsMap().put(policy0ContextAlbum.getKey(), policy0ContextAlbum);
- contextModel.getAlbums().getAlbumsMap().put(policy1ContextAlbum.getKey(), policy1ContextAlbum);
-
- return contextModel;
- }
-
- public AxContextModel getEmptyModel() {
- return new AxContextModel(new AxArtifactKey("Context", "0.0.1"));
- }
-
- /**
- * Get a skeleton model.
- * @return The model
- */
- public AxContextModel getShellModel() {
- final AxContextSchema testContextSchema000 =
- new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
- "org.onap.policy.apex.concept.TestContextSchema000");
- final AxContextSchema testContextSchema00A =
- new AxContextSchema(new AxArtifactKey("TestContextSchema00A", "0.0.1"), "JAVA",
- "org.onap.policy.apex.concept.TestContextSchema00A");
- final AxContextSchema testContextSchema00C =
- new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
- "org.onap.policy.apex.concept.TestContextSchema00C");
-
- final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
- contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
- contextModel.getSchemas().getSchemasMap().put(testContextSchema00A.getKey(), testContextSchema00A);
- contextModel.getSchemas().getSchemasMap().put(testContextSchema00C.getKey(), testContextSchema00C);
-
- return contextModel;
- }
-
- /**
- * Get a single entry model.
- * @return The single entry model
- */
- public AxContextModel getSingleEntryModel() {
- final AxContextSchema testContextSchema000 =
- new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
- "org.onap.policy.apex.concept.TestContextSchema000");
-
- final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(
- new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true, testContextSchema000.getKey());
-
- final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
- contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
-
- contextModel.getAlbums().getAlbumsMap().put(policy1ContextAlbum.getKey(), policy1ContextAlbum);
-
- return contextModel;
- }
-
- /**
- * Get a model with no global entries.
- * @return the model
- */
- public AxContextModel getNoGlobalContextModel() {
- final AxContextSchema testContextSchema000 =
- new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
- "org.onap.policy.apex.concept.TestContextSchema000");
- final AxContextSchema testContextSchema00C =
- new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
- "org.onap.policy.apex.concept.TestContextSchema00C");
-
- final AxContextAlbum externalContextAlbum = new AxContextAlbum(
- new AxArtifactKey("ExternalContextAlbum", "0.0.1"), "EXTERNAL", false, testContextSchema000.getKey());
- final AxContextAlbum policy0ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy0ContextAlbum", "0.0.1"),
- "APPLICATION", true, testContextSchema00C.getKey());
- final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(
- new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true, testContextSchema00C.getKey());
-
- final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
- contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
- contextModel.getSchemas().getSchemasMap().put(testContextSchema00C.getKey(), testContextSchema00C);
-
- contextModel.getAlbums().getAlbumsMap().put(externalContextAlbum.getKey(), externalContextAlbum);
- contextModel.getAlbums().getAlbumsMap().put(policy0ContextAlbum.getKey(), policy0ContextAlbum);
- contextModel.getAlbums().getAlbumsMap().put(policy1ContextAlbum.getKey(), policy1ContextAlbum);
-
- return contextModel;
- }
-}
diff --git a/model/context-model/src/test/resources/logback-test.xml b/model/context-model/src/test/resources/logback-test.xml
deleted file mode 100644
index af4993550..000000000
--- a/model/context-model/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?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="INFO">
- <appender-ref ref="STDOUT" />
- </root>
-
- <logger name="org.infinispan" level="INFO" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="org.onap.policy.apex.core.contextmodel" level="INFO" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="org.apache.zookeeper.ClientCnxn" level="OFF" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="org.onap.policy.apex.core" level="INFO" 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="INFO" additivity="false">
- <appender-ref ref="CTXT_FILE" />
- </logger>
-
- <logger name="org.onap.policy.apex.core.context" level="INFO" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-</configuration>