diff options
author | liamfallon <liam.fallon@est.tech> | 2022-02-10 12:06:25 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2022-02-10 13:48:15 +0000 |
commit | 8534756d13531ffec9c2d7b2ffe0a53ee1d3aaef (patch) | |
tree | a35f6b3f7766d47900ee6691111acff1418bb747 /model/event-model | |
parent | 2f2c5465cd23c8c3300a5c3d185806bb3e7d73c1 (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/event-model')
14 files changed, 0 insertions, 2970 deletions
diff --git a/model/event-model/pom.xml b/model/event-model/pom.xml deleted file mode 100644 index 813ebb8bb..000000000 --- a/model/event-model/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ -<!-- - ============LICENSE_START======================================================= - Copyright (C) 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>event-model</artifactId> - <name>${project.artifactId}</name> - <description>Event Models used in Apex</description> - - <dependencies> - <dependency> - <groupId>org.onap.policy.apex-pdp.model</groupId> - <artifactId>context-model</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> -</project> diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java deleted file mode 100644 index a4c0e9db1..000000000 --- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java +++ /dev/null @@ -1,547 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019-2020,2022 Nordix Foundation. - * Modifications Copyright (C) 2022 Bell Canada. - * ================================================================================ - * 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.eventmodel.concepts; - -import com.google.common.base.Strings; -import com.google.gson.annotations.SerializedName; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.SortedMap; -import java.util.TreeMap; -import java.util.TreeSet; -import org.apache.commons.lang3.EnumUtils; -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.AxToscaPolicyProcessingStatus; -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 defines an Apex event. An {@link AxEvent} is used to kick off execution of policies in Apex and is emitted - * by policies when they complete execution. In addition, Apex uses {@link AxEvent} instances internally to pass - * control from one Apex state to the next during execution. - * - * <p>The {@link AxArtifactKey} of an event uniquely identifies it in an Apex system and the name field in the key is - * the name of the event. - * - * <p>Each {@link AxEvent} has a name space, which is usually set to identify the domain of application of an event. For - * example a 4G cell power event might have the name space {@code org.onap.radio.4g} and the name {@code PowerEvent}. - * The source and target of the event are reserved to hold an identifier that defines the sender and receiver of an - * event respectively. The definition and structure of these fields is reserved for future use and their use by - * applications is currently not recommended. - * - * <p>The parameters that an event has are defined as a map of {@link AxField} instances. - * - * <p>Validation checks that the event key is valid. If name space is a blank string, a warning is issued. Blank source - * or target fields result in observations being issued. An event may not have any parameters. If it has parameters, the - * name and value of each parameter entry is checked to ensure they are not null. Then the local name of each parameter - * is checked to ensure it matches the event parameter key on the event. Finally, the parent key of each parameter is - * checked to ensure it matches the event key. - */ -public class AxEvent extends AxConcept { - private static final long serialVersionUID = -1460388382582984269L; - - private static final String WHITESPACE_REGEXP = "\\s+$"; - - /** The key of the event, unique in the Apex system. */ - // CHECKSTYLE:OFF: checkstyle:VisibilityMonitor - protected AxArtifactKey key; - // CHECKSTYLE:ON: checkstyle:VisibilityMonitor - - private String nameSpace; - private String source; - private String target; - - @SerializedName("parameter") - private Map<String, AxField> parameterMap; - private String toscaPolicyState; - - /** - * The default constructor creates an event with a null artifact key. The event name space, source, and target are - * all defined as empty strings and the parameter map is initialized as an empty map. - */ - public AxEvent() { - this(new AxArtifactKey()); - } - - /** - * Copy constructor. - * - * @param copyConcept the concept to copy from - */ - public AxEvent(final AxEvent copyConcept) { - super(copyConcept); - } - - /** - * The default constructor creates an event with the given artifact key. The event name space, source, and target - * are all defined as empty strings and the parameter map is initialized as an empty map. - * - * @param key the key of the event - */ - public AxEvent(final AxArtifactKey key) { - this(key, "", "", "", new TreeMap<>(), ""); - } - - /** - * This constructor creates an event with the given artifact key and name space. The event source, and target are - * all defined as empty strings and the parameter map is initialized as an empty map. - * - * @param key the key of the event - * @param nameSpace the name space of the event - */ - public AxEvent(final AxArtifactKey key, final String nameSpace) { - this(key, nameSpace, "", "", new TreeMap<>(), ""); - } - - /** - * This constructor creates an event with the given artifact key, name space, source and target. The parameter map - * is initialized as an empty map. - * - * @param key the key of the event - * @param nameSpace the name space of the event - * @param source the source of the event - * @param target the target of the event - */ - public AxEvent(final AxArtifactKey key, final String nameSpace, final String source, final String target) { - this(key, nameSpace, source, target, new TreeMap<>(), ""); - } - - /** - * This constructor creates an event with all its fields defined. - * - * @param key the key of the event - * @param nameSpace the name space of the event - * @param source the source of the event - * @param target the target of the event - * @param parameterMap the map of parameters that the event has - * @param toscaPolicyState the TOSCA policy processing status that event is flagged with - */ - public AxEvent(final AxArtifactKey key, final String nameSpace, final String source, final String target, - final SortedMap<String, AxField> parameterMap, final String toscaPolicyState) { - super(); - Assertions.argumentNotNull(key, "key may not be null"); - Assertions.argumentNotNull(nameSpace, "nameSpace may not be null"); - Assertions.argumentNotNull(source, "source may not be null"); - Assertions.argumentNotNull(target, "target may not be null"); - Assertions.argumentNotNull(parameterMap, "parameterMap may not be null"); - - this.key = key; - this.nameSpace = nameSpace; - this.source = source; - this.target = target; - this.parameterMap = parameterMap; - this.toscaPolicyState = toscaPolicyState; - } - - /** - * This method checks that an event has all the fields in the {@code otherFieldSet} set defined on it. - * - * @param otherFieldSet the set of fields to check for existence on this event - * @return true, if all the {@code otherFieldSet} fields are defined on this event - */ - public boolean hasFields(final Set<AxField> otherFieldSet) { - return parameterMap.values().containsAll(otherFieldSet); - } - - /** - * {@inheritDoc}. - */ - @Override - public void buildReferences() { - for (final AxField parameter : parameterMap.values()) { - parameter.getKey().setParentArtifactKey(key); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public AxArtifactKey getKey() { - return key; - } - - /** - * {@inheritDoc}. - */ - @Override - public List<AxKey> getKeys() { - final List<AxKey> keyList = key.getKeys(); - - for (final AxField field : parameterMap.values()) { - keyList.addAll(field.getKeys()); - } - return keyList; - } - - /** - * Sets the key of the event. - * - * @param key the key of the event - */ - public void setKey(final AxArtifactKey key) { - Assertions.argumentNotNull(key, "key may not be null"); - this.key = key; - - for (final AxField parameter : parameterMap.values()) { - parameter.getKey().setParentArtifactKey(key); - } - } - - /** - * Gets the name space of the event. - * - * @return the name space of the event - */ - public String getNameSpace() { - return nameSpace; - } - - /** - * Sets the name space of the event. - * - * @param nameSpace the name space of the event - */ - public void setNameSpace(final String nameSpace) { - Assertions.argumentNotNull(nameSpace, "nameSpace may not be null"); - this.nameSpace = nameSpace.trim(); - } - - /** - * Gets the source of the event. - * - * @return the source of the event - */ - public String getSource() { - return source; - } - - /** - * Sets the source of the event. - * - * @param source the source of the event - */ - public void setSource(final String source) { - Assertions.argumentNotNull(source, "source may not be null"); - this.source = source.trim(); - } - - /** - * Gets the target of the event. - * - * @return the target of the event - */ - public String getTarget() { - return target; - } - - /** - * Sets the target of the event. - * - * @param target the target of the event - */ - public void setTarget(final String target) { - Assertions.argumentNotNull(target, "target may not be null"); - this.target = target.trim(); - } - - /** - * Gets the event parameter map. - * - * @return the event parameter map - */ - public Map<String, AxField> getParameterMap() { - return parameterMap; - } - - /** - * Gets the fields defined on the event as a set. - * - * @return the fields defined on the event as a set - */ - public Set<AxField> getFields() { - return new TreeSet<>(parameterMap.values()); - } - - /** - * Sets the event parameter map, containing all the fields of the event. - * - * @param parameterMap the event parameter map - */ - public void setParameterMap(final Map<String, AxField> parameterMap) { - Assertions.argumentNotNull(parameterMap, "parameterMap may not be null"); - this.parameterMap = parameterMap; - } - - /** - * Gets the TOSCA policy processing status from the event. - * - * @return the TOSCA policy processing status - */ - public String getToscaPolicyState() { - return toscaPolicyState; - } - - /** - * Sets the TOSCA policy processing status on the event. - * - * @param toscaPolicyState the TOSCA policy processing status - */ - public void setToscaPolicyState(String toscaPolicyState) { - this.toscaPolicyState = toscaPolicyState; - } - - /** - * {@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 (nameSpace.replaceAll(WHITESPACE_REGEXP, "").length() == 0) { - result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.WARNING, - "nameSpace on event is blank")); - } - - if (source.replaceAll(WHITESPACE_REGEXP, "").length() == 0) { - result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.OBSERVATION, - "source on event is blank")); - } - - if (target.replaceAll(WHITESPACE_REGEXP, "").length() == 0) { - result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.OBSERVATION, - "target on event is blank")); - } - - for (final Entry<String, AxField> eventParameterEntry : parameterMap.entrySet()) { - if (eventParameterEntry.getKey() == null || eventParameterEntry.getKey().equals(AxKey.NULL_KEY_NAME)) { - result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key on parameter " + eventParameterEntry.getKey() + " may not be the null key")); - } else if (eventParameterEntry.getValue() == null) { - result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "value on parameter " + eventParameterEntry.getKey() + " may not be null")); - } else { - result = validateEventParameters(eventParameterEntry, result); - } - } - - if (!Strings.isNullOrEmpty(toscaPolicyState) - && !EnumUtils.isValidEnum(AxToscaPolicyProcessingStatus.class, toscaPolicyState)) { - result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "toscaPolicyState on event is not a valid enum. Valid values are: " - + Arrays.asList(AxToscaPolicyProcessingStatus.values()))); - } - - return result; - } - - /** - * Validate an event parameter entry. - * - * @param eventParameterEntry the event parameter entry - * @param result the validation result to append to - * @return The validation result - */ - private AxValidationResult validateEventParameters(final Entry<String, AxField> eventParameterEntry, - final AxValidationResult result) { - if (!eventParameterEntry.getKey().equals(eventParameterEntry.getValue().getKey().getLocalName())) { - result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key on parameter " + eventParameterEntry.getKey() - + " does not equal parameter field local name " - + eventParameterEntry.getValue().getKey().getLocalName())); - } - - if (!eventParameterEntry.getValue().getKey().getParentArtifactKey().equals(key)) { - result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "parent key on parameter field " + eventParameterEntry.getValue().getKey() - + " does not equal event key")); - } - - return eventParameterEntry.getValue().validate(result); - } - - /** - * {@inheritDoc}. - */ - @Override - public void clean() { - key.clean(); - nameSpace = nameSpace.trim(); - source = source.trim(); - target = target.trim(); - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append(this.getClass().getSimpleName()); - builder.append(":("); - builder.append("key="); - builder.append(key); - builder.append(",nameSpace="); - builder.append(nameSpace); - builder.append(",source="); - builder.append(source); - builder.append(",target="); - builder.append(target); - builder.append(",parameter="); - builder.append(parameterMap); - builder.append(",toscaPolicyState="); - builder.append(toscaPolicyState); - builder.append(")"); - return builder.toString(); - } - - /** - * {@inheritDoc}. - */ - @Override - public AxConcept copyTo(final AxConcept targetObject) { - Assertions.argumentNotNull(targetObject, "targetObject may not be null"); - - final Object copyObject = targetObject; - Assertions.instanceOf(copyObject, AxEvent.class); - - final AxEvent copy = (AxEvent) copyObject; - - final Map<String, AxField> newParameterMap = new TreeMap<>(); - for (final Entry<String, AxField> eventParameterMapEntry : parameterMap.entrySet()) { - newParameterMap.put(eventParameterMapEntry.getKey(), new AxField(eventParameterMapEntry.getValue())); - } - copy.setParameterMap(newParameterMap); - - copy.setKey(new AxArtifactKey(key)); - copy.setNameSpace(nameSpace); - copy.setSource(source); - copy.setTarget(target); - copy.setToscaPolicyState(toscaPolicyState); - - return copy; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + key.hashCode(); - result = prime * result + nameSpace.hashCode(); - result = prime * result + source.hashCode(); - result = prime * result + target.hashCode(); - result = prime * result + parameterMap.hashCode(); - result = prime * result + toscaPolicyState.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 AxEvent other = (AxEvent) obj; - if (!key.equals(other.key)) { - return false; - } - if (!nameSpace.equals(other.nameSpace)) { - return false; - } - if (!source.equals(other.source)) { - return false; - } - if (!target.equals(other.target)) { - return false; - } - if (!toscaPolicyState.equals(other.toscaPolicyState)) { - return false; - } - return parameterMap.equals(other.parameterMap); - } - - /** - * {@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 AxEvent other = (AxEvent) otherObj; - if (!key.equals(other.key)) { - return key.compareTo(other.key); - } - if (!nameSpace.equals(other.nameSpace)) { - return nameSpace.compareTo(other.nameSpace); - } - if (!source.equals(other.source)) { - return source.compareTo(other.source); - } - if (!target.equals(other.target)) { - return target.compareTo(other.target); - } - if (!parameterMap.equals(other.parameterMap)) { - return (parameterMap.hashCode() - other.parameterMap.hashCode()); - } - if (!toscaPolicyState.equals(other.toscaPolicyState)) { - return toscaPolicyState.compareTo(other.toscaPolicyState); - } - - return 0; - } -} diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java deleted file mode 100644 index b91712c9d..000000000 --- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java +++ /dev/null @@ -1,276 +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.eventmodel.concepts; - -import java.util.List; -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.apex.model.contextmodel.concepts.AxContextSchemas; -import org.onap.policy.common.utils.validation.Assertions; - -/** - * A container class for an Apex event model. This class is a container class that allows an Apex model to be - * constructed that contains events and context and the key information for those events and context. The model contains - * schema definitions and the definitions of events that use those schemas. - * - * <p>Validation runs {@link AxModel} validation on the model. In addition, the {@link AxContextSchemas} and - * {@link AxEvents} validation is run on the context schemas and events in the model. - */ -public class AxEventModel extends AxModel { - private static final long serialVersionUID = 8800599637708309945L; - - private AxContextSchemas schemas; - private AxEvents events; - - /** - * The Default Constructor creates a {@link AxEventModel} object with a null artifact key and creates an empty event - * model. - */ - public AxEventModel() { - this(new AxArtifactKey()); - } - - /** - * Copy constructor. - * - * @param copyConcept the concept to copy from - */ - public AxEventModel(final AxEventModel copyConcept) { - super(copyConcept); - } - - /** - * The Key Constructor creates a {@link AxEventModel} object with the given artifact key and creates an empty event - * model. - * - * @param key the event model key - */ - public AxEventModel(final AxArtifactKey key) { - this(key, new AxContextSchemas(new AxArtifactKey(key.getName() + "_Schemas", key.getVersion())), - new AxKeyInformation(new AxArtifactKey(key.getName() + "_KeyInfo", key.getVersion())), - new AxEvents(new AxArtifactKey(key.getName() + "_Events", key.getVersion()))); - } - - /** - * Constructor that initiates a {@link AxEventModel} with all its fields. - * - * @param key the event model key - * @param schemas the schemas for events in the event model - * @param keyInformation the key information for context schemas and events in the event model - * @param events the events in the event model - */ - public AxEventModel(final AxArtifactKey key, final AxContextSchemas schemas, final AxKeyInformation keyInformation, - final AxEvents events) { - super(key, keyInformation); - Assertions.argumentNotNull(events, "events may not be null"); - - this.schemas = schemas; - this.events = events; - } - - /** - * {@inheritDoc}. - */ - @Override - public void register() { - super.register(); - ModelService.registerModel(AxContextSchemas.class, getSchemas()); - ModelService.registerModel(AxEvents.class, getEvents()); - } - - /** - * {@inheritDoc}. - */ - @Override - public List<AxKey> getKeys() { - final List<AxKey> keyList = super.getKeys(); - - keyList.addAll(schemas.getKeys()); - keyList.addAll(events.getKeys()); - - return keyList; - } - - /** - * Gets the context schemas. - * - * @return the context schemas - */ - public AxContextSchemas getSchemas() { - return schemas; - } - - /** - * Sets the context schemas. - * - * @param schemas the context schemas - */ - public void setSchemas(final AxContextSchemas schemas) { - Assertions.argumentNotNull(schemas, "schemas may not be null"); - this.schemas = schemas; - } - - /** - * Gets the events from the model. - * - * @return the events - */ - public AxEvents getEvents() { - return events; - } - - /** - * Sets the events in the model. - * - * @param events the events - */ - public void setEvents(final AxEvents events) { - Assertions.argumentNotNull(events, "events may not be null"); - this.events = events; - } - - /** - * {@inheritDoc}. - */ - @Override - public AxValidationResult validate(final AxValidationResult resultIn) { - AxValidationResult result = resultIn; - - result = super.validate(result); - result = schemas.validate(result); - return events.validate(result); - } - - /** - * {@inheritDoc}. - */ - @Override - public void clean() { - super.clean(); - schemas.clean(); - events.clean(); - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append(this.getClass().getSimpleName()); - builder.append(":("); - builder.append(super.toString()); - builder.append(",schemas="); - builder.append(schemas); - builder.append(",events="); - builder.append(events); - builder.append(")"); - return builder.toString(); - } - - /** - * {@inheritDoc}. - */ - @Override - public AxConcept copyTo(final AxConcept targetObject) { - Assertions.argumentNotNull(targetObject, "target may not be null"); - - final Object copyObject = targetObject; - Assertions.instanceOf(copyObject, AxEventModel.class); - - final AxEventModel copy = ((AxEventModel) copyObject); - super.copyTo(targetObject); - copy.setSchemas(new AxContextSchemas(schemas)); - copy.setEvents(new AxEvents(events)); - - return copy; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + super.hashCode(); - result = prime * result + schemas.hashCode(); - result = prime * result + events.hashCode(); - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(final Object obj) { - if (obj == null) { - throw new IllegalArgumentException("comparison object may not be null"); - } - - if (this == obj) { - return true; - } - if (getClass() != obj.getClass()) { - return false; - } - - final AxEventModel other = (AxEventModel) obj; - if (!super.equals(other)) { - return false; - } - if (!schemas.equals(other.schemas)) { - return false; - } - return events.equals(other.events); - } - - /** - * {@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 AxEventModel other = (AxEventModel) otherObj; - if (!super.equals(other)) { - return super.compareTo(other); - } - if (!schemas.equals(other.schemas)) { - return schemas.compareTo(other.schemas); - } - return events.compareTo(other.events); - } -} diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java deleted file mode 100644 index aac1562de..000000000 --- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java +++ /dev/null @@ -1,351 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019-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.eventmodel.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 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 an event container and holds a map of the events for an entire Apex model. All Apex models that use - * events must have an {@link AxEvents} field. The {@link AxEvents} class implements the helper methods of the - * {@link AxConceptGetter} interface to allow {@link AxEvents} 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 events are defined in the - * container. Each event 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 event entry is then validated individually. - */ -public class AxEvents extends AxConcept implements AxConceptGetter<AxEvent> { - private static final long serialVersionUID = 4290442590545820316L; - - private AxArtifactKey key; - private Map<AxArtifactKey, AxEvent> eventMap; - - /** - * The Default Constructor creates a {@link AxEvents} object with a null artifact key and creates an empty event - * map. - */ - public AxEvents() { - this(new AxArtifactKey()); - } - - /** - * Copy constructor. - * - * @param copyConcept the concept to copy from - */ - public AxEvents(final AxEvents copyConcept) { - super(copyConcept); - } - - /** - * The Key Constructor creates a {@link AxEvents} object with the given artifact key and creates an empty event map. - * - * @param key the event container key - */ - public AxEvents(final AxArtifactKey key) { - this(key, new TreeMap<>()); - } - - /** - * This Constructor creates an event container with all of its fields defined. - * - * @param key the event container key - * @param eventMap the events to be stored in the event container - */ - public AxEvents(final AxArtifactKey key, final Map<AxArtifactKey, AxEvent> eventMap) { - super(); - Assertions.argumentNotNull(key, "key may not be null"); - Assertions.argumentNotNull(eventMap, "eventMap may not be null"); - - this.key = key; - this.eventMap = new TreeMap<>(); - this.eventMap.putAll(eventMap); - } - - /** - * {@inheritDoc}. - */ - @Override - public AxArtifactKey getKey() { - return key; - } - - /** - * {@inheritDoc}. - */ - @Override - public List<AxKey> getKeys() { - final List<AxKey> keyList = key.getKeys(); - - for (final AxEvent event : eventMap.values()) { - keyList.addAll(event.getKeys()); - } - - return keyList; - } - - /** - * {@inheritDoc}. - */ - @Override - public void buildReferences() { - eventMap.values().stream().forEach(event -> event.buildReferences()); - } - - /** - * Sets the key of the event container. - * - * @param key the event container key - */ - public void setKey(final AxArtifactKey key) { - Assertions.argumentNotNull(key, "key may not be null"); - this.key = key; - } - - /** - * Gets the event map containing the events in the event container. - * - * @return the event map with all the events in the event container - */ - public Map<AxArtifactKey, AxEvent> getEventMap() { - return eventMap; - } - - /** - * Sets the event map containing the events in the event container. - * - * @param eventMap the event map containing the events in the event container - */ - public void setEventMap(final Map<AxArtifactKey, AxEvent> eventMap) { - Assertions.argumentNotNull(eventMap, "eventMap may not be null"); - this.eventMap = new TreeMap<>(); - this.eventMap.putAll(eventMap); - } - - /** - * {@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 (eventMap.size() == 0) { - result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "eventMap may not be empty")); - } else { - for (final Entry<AxArtifactKey, AxEvent> eventEntry : eventMap.entrySet()) { - if (eventEntry.getKey().equals(AxArtifactKey.getNullKey())) { - result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key on event entry " + eventEntry.getKey() + " may not be the null key")); - } else if (eventEntry.getValue() == null) { - result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "value on event entry " + eventEntry.getKey() + " may not be null")); - } else { - if (!eventEntry.getKey().equals(eventEntry.getValue().getKey())) { - result.addValidationMessage( - new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key on event entry key " + eventEntry.getKey() - + " does not equal event value key " - + eventEntry.getValue().getKey())); - } - - result = eventEntry.getValue().validate(result); - } - } - } - - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public void clean() { - key.clean(); - for (final Entry<AxArtifactKey, AxEvent> eventEntry : eventMap.entrySet()) { - eventEntry.getKey().clean(); - eventEntry.getValue().clean(); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append(this.getClass().getSimpleName()); - builder.append(":("); - builder.append("key="); - builder.append(key); - builder.append(",eventMap="); - builder.append(eventMap); - builder.append(")"); - return builder.toString(); - } - - /** - * {@inheritDoc}. - */ - @Override - public AxConcept copyTo(final AxConcept targetObject) { - Assertions.argumentNotNull(targetObject, "target may not be null"); - - final Object copyObject = targetObject; - Assertions.instanceOf(copyObject, AxEvents.class); - - final AxEvents copy = (AxEvents) copyObject; - copy.setKey(new AxArtifactKey(key)); - final Map<AxArtifactKey, AxEvent> newEventMap = new TreeMap<>(); - for (final Entry<AxArtifactKey, AxEvent> eventMapEntry : eventMap.entrySet()) { - newEventMap.put(new AxArtifactKey(eventMapEntry.getKey()), new AxEvent(eventMapEntry.getValue())); - } - copy.setEventMap(newEventMap); - - return copy; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + key.hashCode(); - result = prime * result + eventMap.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 AxEvents other = (AxEvents) obj; - if (!key.equals(other.key)) { - return false; - } - return eventMap.equals(other.eventMap); - } - - /** - * {@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 AxEvents other = (AxEvents) otherObj; - if (!key.equals(other.key)) { - return key.compareTo(other.key); - } - if (!eventMap.equals(other.eventMap)) { - return (eventMap.hashCode() - other.eventMap.hashCode()); - } - - return 0; - } - - /** - * {@inheritDoc}. - */ - @Override - public AxEvent get(final AxArtifactKey conceptKey) { - return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxEvent>) eventMap).get(conceptKey); - } - - /** - * {@inheritDoc}. - */ - @Override - public AxEvent get(final String conceptKeyName) { - return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxEvent>) eventMap).get(conceptKeyName); - } - - /** - * {@inheritDoc}. - */ - @Override - public AxEvent get(final String conceptKeyName, final String conceptKeyVersion) { - return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxEvent>) eventMap).get(conceptKeyName, - conceptKeyVersion); - } - - /** - * {@inheritDoc}. - */ - @Override - public Set<AxEvent> getAll(final String conceptKeyName) { - return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxEvent>) eventMap).getAll(conceptKeyName); - } - - /** - * {@inheritDoc}. - */ - @Override - public Set<AxEvent> getAll(final String conceptKeyName, final String conceptKeyVersion) { - return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxEvent>) eventMap).getAll(conceptKeyName, - conceptKeyVersion); - } -} diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java deleted file mode 100644 index 26511c9d1..000000000 --- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java +++ /dev/null @@ -1,347 +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.eventmodel.concepts; - -import java.util.List; -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.AxReferenceKey; -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; - -/** - * In Apex, a field is an input or output parameter to or from a concept. For example, the parameters of an event are - * fields and the input and output of a task is defined as a collection of fields. - * - * <p>A field has an {@link AxReferenceKey} key that defines its name and parent, and a {@link AxArtifactKey} key to a - * context schema that defines the structure of the data atom that holds the value of the field. Fields can be specified - * as being optional but are mandatory by default. - * - * <p>Validation checks that the field key and the field schema reference key are not null. - */ -public class AxField extends AxConcept { - private static final String KEY_MAY_NOT_BE_NULL = "key may not be null"; - private static final String FIELD_SCHEMA_KEY_MAY_NOT_BE_NULL = "fieldSchemaKey may not be null"; - - private static final long serialVersionUID = -6443016863162692288L; - - private static final int HASH_PRIME_0 = 1231; - private static final int HASH_PRIME_1 = 1237; - - private AxReferenceKey key; - private AxArtifactKey fieldSchemaKey; - private boolean optional; - - /** - * The default constructor creates a field with a null artifact and schema key. - */ - public AxField() { - this(new AxReferenceKey()); - optional = false; - } - - /** - * The default constructor creates a field with the given artifact key and a null schema key. - * - * @param key the field key - */ - public AxField(final AxReferenceKey key) { - this(key, new AxArtifactKey()); - } - - /** - * Copy constructor. - * - * @param copyConcept the concept to copy from - */ - public AxField(final AxField copyConcept) { - super(copyConcept); - } - - /** - * Constructor to create the field with both its keys defined. - * - * @param key the field key - * @param fieldSchemaKey the key of the field schema to use for this field - */ - public AxField(final AxReferenceKey key, final AxArtifactKey fieldSchemaKey) { - super(); - Assertions.argumentNotNull(key, KEY_MAY_NOT_BE_NULL); - Assertions.argumentNotNull(fieldSchemaKey, FIELD_SCHEMA_KEY_MAY_NOT_BE_NULL); - - this.key = key; - this.fieldSchemaKey = fieldSchemaKey; - } - - /** - * Constructor to create the field with all its fields defined. - * - * @param key the field key - * @param fieldSchemaKey the key of the field schema to use for this field - * @param optional true if this field is optional - */ - public AxField(final AxReferenceKey key, final AxArtifactKey fieldSchemaKey, final boolean optional) { - super(); - Assertions.argumentNotNull(key, KEY_MAY_NOT_BE_NULL); - Assertions.argumentNotNull(fieldSchemaKey, FIELD_SCHEMA_KEY_MAY_NOT_BE_NULL); - - this.key = key; - this.fieldSchemaKey = fieldSchemaKey; - this.optional = optional; - } - - /** - * Constructor to create the field with the local name of its reference key defined and its schema key defined. - * - * @param localName the local name of the field reference key - * @param fieldSchemaKey the key of the field schema to use for this field - */ - public AxField(final String localName, final AxArtifactKey fieldSchemaKey) { - super(); - Assertions.argumentNotNull(localName, "localName may not be null"); - Assertions.argumentNotNull(fieldSchemaKey, FIELD_SCHEMA_KEY_MAY_NOT_BE_NULL); - - key = new AxReferenceKey(); - key.setLocalName(localName); - this.fieldSchemaKey = fieldSchemaKey; - } - - /** - * Constructor to create the field with the local name of its reference key defined, its schema key and optionality - * defined. - * - * @param localName the local name of the field reference key - * @param fieldSchemaKey the key of the field schema to use for this field - * @param optional true if this field is optional - */ - public AxField(final String localName, final AxArtifactKey fieldSchemaKey, final boolean optional) { - super(); - Assertions.argumentNotNull(localName, "localName may not be null"); - Assertions.argumentNotNull(fieldSchemaKey, FIELD_SCHEMA_KEY_MAY_NOT_BE_NULL); - - key = new AxReferenceKey(); - key.setLocalName(localName); - this.fieldSchemaKey = fieldSchemaKey; - this.optional = optional; - } - - /** - * {@inheritDoc}. - */ - @Override - public AxReferenceKey getKey() { - return key; - } - - /** - * {@inheritDoc}. - */ - @Override - public List<AxKey> getKeys() { - final List<AxKey> keyList = key.getKeys(); - keyList.add(new AxKeyUse(fieldSchemaKey)); - return keyList; - } - - /** - * Sets the reference key of the field. - * - * @param key the field reference key - */ - public void setKey(final AxReferenceKey key) { - Assertions.argumentNotNull(key, KEY_MAY_NOT_BE_NULL); - this.key = key; - } - - /** - * Gets the key of the field schema. - * - * @return the field schema key - */ - public AxArtifactKey getSchema() { - return fieldSchemaKey; - } - - /** - * Sets the key of the field schema. - * - * @param schema the field schema key - */ - public void setSchema(final AxArtifactKey schema) { - Assertions.argumentNotNull(schema, "schema may not be null"); - this.fieldSchemaKey = schema; - } - - /** - * Gets the optionality of the field. - * - * @return the field optional flag - */ - public boolean getOptional() { - return optional; - } - - /** - * Sets the optionality of the field. - * - * @param optional the optionality of the field - */ - public void setOptional(final boolean optional) { - this.optional = optional; - } - - /** - * {@inheritDoc}. - */ - @Override - public AxValidationResult validate(final AxValidationResult resultIn) { - AxValidationResult result = resultIn; - - if (key.equals(AxReferenceKey.getNullKey())) { - result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key is a null key")); - } - - result = key.validate(result); - - if (fieldSchemaKey.equals(AxArtifactKey.getNullKey())) { - result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "fieldSchemaKey is a null key: " + fieldSchemaKey)); - } - return fieldSchemaKey.validate(result); - } - - /** - * {@inheritDoc}. - */ - @Override - public void clean() { - key.clean(); - fieldSchemaKey.clean(); - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append(this.getClass().getSimpleName()); - builder.append(":("); - builder.append("key="); - builder.append(key); - builder.append(",fieldSchemaKey="); - builder.append(fieldSchemaKey); - builder.append(",optional="); - builder.append(optional); - builder.append(")"); - return builder.toString(); - } - - /** - * {@inheritDoc}. - */ - @Override - public AxConcept copyTo(final AxConcept targetObject) { - Assertions.argumentNotNull(targetObject, "target may not be null"); - - final Object copyObject = targetObject; - Assertions.instanceOf(copyObject, AxField.class); - - final AxField copy = ((AxField) copyObject); - copy.setKey(new AxReferenceKey(key)); - copy.setSchema(new AxArtifactKey(fieldSchemaKey)); - copy.setOptional(optional); - return copy; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + key.hashCode(); - result = prime * result + fieldSchemaKey.hashCode(); - result = prime * result + (optional ? HASH_PRIME_0 : HASH_PRIME_1); - return result; - } - - /* - * (nonJavadoc) - * - * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang.Object) - */ - @Override - public boolean equals(final Object obj) { - if (obj == null) { - return false; - } - if (this == obj) { - return true; - } - - if (!(obj instanceof AxField)) { - return false; - } - - final AxField other = (AxField) obj; - if (!key.getLocalName().equals(other.key.getLocalName())) { - return false; - } - if (optional != other.optional) { - return false; - } - return fieldSchemaKey.equals(other.fieldSchemaKey); - } - - /** - * {@inheritDoc}. - */ - @Override - public int compareTo(final AxConcept otherObj) { - if (otherObj == null) { - return 1; - } - if (this == otherObj) { - return 0; - } - if (!(otherObj instanceof AxField)) { - return this.hashCode() - otherObj.hashCode(); - } - - final AxField other = (AxField) otherObj; - if (!key.getLocalName().equals(other.key.getLocalName())) { - return key.getLocalName().compareTo(other.key.getLocalName()); - } - if (optional != other.optional) { - return (optional ? 1 : -1); - } - return fieldSchemaKey.compareTo(other.fieldSchemaKey); - } -} diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxInputField.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxInputField.java deleted file mode 100644 index 6155c7186..000000000 --- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxInputField.java +++ /dev/null @@ -1,88 +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========================================================= - */ - -package org.onap.policy.apex.model.eventmodel.concepts; - -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; -import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; - -/** - * This class specializes the {@link AxField} class for use as input fields on events. - */ -public class AxInputField extends AxField { - private static final long serialVersionUID = 2090324845463750391L; - - /** - * The default constructor creates a field with a null artifact and schema key. - */ - public AxInputField() { - super(); - } - - /** - * The default constructor creates a field with the given artifact key and a null schema key. - * - * @param key the field key - */ - public AxInputField(final AxReferenceKey key) { - super(key); - } - - /** - * Constructor to create the field with both its keys defined. - * - * @param key the field key - * @param fieldSchemaKey the key of the field schema to use for this field - */ - public AxInputField(final AxReferenceKey key, final AxArtifactKey fieldSchemaKey) { - super(key, fieldSchemaKey); - } - - /** - * Constructor to create the field with both its keys defined and optional flag specified. - * - * @param key the field key - * @param fieldSchemaKey the key of the field schema to use for this field - * @param optional true if the task field is optional, false otherwise - */ - public AxInputField(final AxReferenceKey key, final AxArtifactKey fieldSchemaKey, final boolean optional) { - super(key, fieldSchemaKey, optional); - } - - /** - * Constructor to create the field with the local name of its reference key defined and its schema key defined. - * - * @param localName the local name of the field reference key - * @param fieldSchemaKey the key of the field schema to use for this field - */ - public AxInputField(final String localName, final AxArtifactKey fieldSchemaKey) { - super(localName, fieldSchemaKey); - } - - /** - * Copy constructor, create an input field as a copy of another input field. - * - * @param field the input field to copy from - */ - public AxInputField(final AxInputField field) { - super(new AxReferenceKey(field.getKey()), new AxArtifactKey(field.getSchema()), field.getOptional()); - } -} diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxOutputField.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxOutputField.java deleted file mode 100644 index 7f3437617..000000000 --- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxOutputField.java +++ /dev/null @@ -1,88 +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========================================================= - */ - -package org.onap.policy.apex.model.eventmodel.concepts; - -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; -import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; - -/** - * This class specializes the {@link AxField} class for use as output fields on events. - */ -public class AxOutputField extends AxField { - private static final long serialVersionUID = 2090324845463750391L; - - /** - * The default constructor creates a field with a null artifact and schema key. - */ - public AxOutputField() { - super(); - } - - /** - * The default constructor creates a field with the given artifact key and a null schema key. - * - * @param key the field key - */ - public AxOutputField(final AxReferenceKey key) { - super(key); - } - - /** - * Constructor to create the field with both its keys defined. - * - * @param key the field key - * @param fieldSchemaKey the key of the field schema to use for this field - */ - public AxOutputField(final AxReferenceKey key, final AxArtifactKey fieldSchemaKey) { - super(key, fieldSchemaKey); - } - - /** - * Constructor to create the field with both its keys defined and optional flag specified. - * - * @param key the field key - * @param fieldSchemaKey the key of the field schema to use for this field - * @param optional true if the task field is optional, false otherwise - */ - public AxOutputField(final AxReferenceKey key, final AxArtifactKey fieldSchemaKey, final boolean optional) { - super(key, fieldSchemaKey, optional); - } - - /** - * Constructor to create the field with the local name of its reference key defined and its schema key defined. - * - * @param localName the local name of the field reference key - * @param fieldSchemaKey the key of the field schema to use for this field - */ - public AxOutputField(final String localName, final AxArtifactKey fieldSchemaKey) { - super(localName, fieldSchemaKey); - } - - /** - * Copy constructor, create an output field as a copy of another output field. - * - * @param field the output field to copy from - */ - public AxOutputField(final AxOutputField field) { - super(new AxReferenceKey(field.getKey()), new AxArtifactKey(field.getSchema()), field.getOptional()); - } -} diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/package-info.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/package-info.java deleted file mode 100644 index 414d22d0e..000000000 --- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/package-info.java +++ /dev/null @@ -1,27 +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========================================================= - */ - -/** - * Contains the concepts required to manage events in APEX. It defines the main Apex concepts of events and fields. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -package org.onap.policy.apex.model.eventmodel.concepts; diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventModelTest.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventModelTest.java deleted file mode 100644 index cdc5fecf6..000000000 --- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventModelTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019-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.eventmodel.concepts; - -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; -import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; - -/** - * Test event models. - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class EventModelTest { - - @Test - public void testEventModel() { - assertNotNull(new AxEventModel()); - assertNotNull(new AxEventModel(new AxArtifactKey())); - assertNotNull( - new AxEventModel(new AxArtifactKey(), new AxContextSchemas(), new AxKeyInformation(), new AxEvents())); - - final AxArtifactKey modelKey = new AxArtifactKey("ModelKey", "0.0.1"); - final AxArtifactKey schemasKey = new AxArtifactKey("SchemasKey", "0.0.1"); - final AxArtifactKey eventsKey = new AxArtifactKey("EventsKey", "0.0.1"); - final AxArtifactKey keyInfoKey = new AxArtifactKey("SchemasKey", "0.0.1"); - final AxEventModel model = new AxEventModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey)); - model.register(); - - model.clean(); - assertNotNull(model); - assertEquals("AxEventModel:(AxEventModel:(key=AxArtifactKey:(nam", model.toString().substring(0, 50)); - - final AxEventModel clonedModel = new AxEventModel(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 AxEventModel(new AxArtifactKey())); - assertNotEquals(model, new AxEventModel(modelKey, new AxContextSchemas(), new AxKeyInformation(keyInfoKey), - new AxEvents(eventsKey))); - assertNotEquals(model, new AxEventModel(modelKey, new AxContextSchemas(schemasKey), new AxKeyInformation(), - new AxEvents(eventsKey))); - assertNotEquals(model, new AxEventModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents())); - assertEquals(model, new AxEventModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey))); - - assertEquals(0, model.compareTo(model)); - assertEquals(0, model.compareTo(clonedModel)); - assertNotEquals(0, model.compareTo(new AxArtifactKey())); - assertNotEquals(0, model.compareTo(new AxEventModel(modelKey, new AxContextSchemas(), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey)))); - assertNotEquals(0, model.compareTo(new AxEventModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(), new AxEvents(eventsKey)))); - assertNotEquals(0, model.compareTo(new AxEventModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents()))); - assertEquals(0, model.compareTo(new AxEventModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey)))); - } -} diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventsTest.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventsTest.java deleted file mode 100644 index 7062fcb3c..000000000 --- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventsTest.java +++ /dev/null @@ -1,323 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019-2020,2022 Nordix Foundation. - * Modifications Copyright (C) 2022 Bell Canada. - * ================================================================================ - * 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.eventmodel.concepts; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.TreeMap; -import java.util.TreeSet; -import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; -import org.onap.policy.apex.model.basicmodel.concepts.AxKey; -import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; -import org.onap.policy.apex.model.basicmodel.concepts.AxToscaPolicyProcessingStatus; -import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; -import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult; - -/** - * Test events. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class EventsTest { - - @Test - public void testEvents() { - final TreeMap<String, AxField> parameterMap = new TreeMap<>(); - final TreeMap<String, AxField> parameterMapEmpty = new TreeMap<>(); - - assertNotNull(new AxEvent()); - assertNotNull(new AxEvent(new AxArtifactKey())); - assertNotNull(new AxEvent(new AxArtifactKey(), "namespace")); - assertNotNull(new AxEvent(new AxArtifactKey(), "namespace", "source", "target")); - assertNotNull(new AxEvent(new AxArtifactKey(), "namespace", "source", "target")); - assertNotNull(new AxEvent(new AxArtifactKey(), "namespace", "source", "target", parameterMap, "")); - - final AxEvent event = new AxEvent(); - - final AxArtifactKey eventKey = new AxArtifactKey("EventName", "0.0.1"); - event.setKey(eventKey); - assertEquals("EventName:0.0.1", event.getKey().getId()); - assertEquals("EventName:0.0.1", event.getKeys().get(0).getId()); - - event.setNameSpace("namespace"); - assertEquals("namespace", event.getNameSpace()); - - event.setSource("source"); - assertEquals("source", event.getSource()); - - event.setTarget("target"); - assertEquals("target", event.getTarget()); - - event.setParameterMap(parameterMap); - assertEquals(0, event.getParameterMap().size()); - - event.setToscaPolicyState(AxToscaPolicyProcessingStatus.ENTRY.name()); - assertEquals(AxToscaPolicyProcessingStatus.ENTRY.name(), event.getToscaPolicyState()); - - final AxField eventField = - new AxField(new AxReferenceKey(eventKey, "Field0"), new AxArtifactKey("Field0Schema", "0.0.1")); - event.getParameterMap().put(eventField.getKey().getLocalName(), eventField); - assertEquals(1, event.getParameterMap().size()); - - final AxField eventFieldBadParent = - new AxField(new AxReferenceKey(new AxArtifactKey("OtherEvent", "0.0.01"), "Field0"), - new AxArtifactKey("Field0Schema", "0.0.1")); - - final AxArtifactKey newEventKey = new AxArtifactKey("NewEventName", "0.0.1"); - event.setKey(newEventKey); - assertEquals("NewEventName:0.0.1", event.getKey().getId()); - assertEquals("NewEventName:0.0.1", event.getKeys().get(0).getId()); - assertEquals("NewEventName:0.0.1", - event.getParameterMap().get("Field0").getKey().getParentArtifactKey().getId()); - event.setKey(eventKey); - assertEquals("EventName:0.0.1", event.getKey().getId()); - assertEquals("EventName:0.0.1", event.getKeys().get(0).getId()); - - assertTrue("Field0", event.getFields().contains(eventField)); - assertTrue(event.hasFields(new TreeSet<AxField>(parameterMap.values()))); - - AxValidationResult result = new AxValidationResult(); - result = event.validate(result); - assertEquals(AxValidationResult.ValidationResult.VALID, result.getValidationResult()); - - event.setKey(AxArtifactKey.getNullKey()); - result = new AxValidationResult(); - result = event.validate(result); - assertEquals(ValidationResult.INVALID, result.getValidationResult()); - - event.setKey(eventKey); - result = new AxValidationResult(); - result = event.validate(result); - assertEquals(ValidationResult.VALID, result.getValidationResult()); - - event.setNameSpace(""); - result = new AxValidationResult(); - result = event.validate(result); - assertEquals(ValidationResult.WARNING, result.getValidationResult()); - - event.setNameSpace("namespace"); - result = new AxValidationResult(); - result = event.validate(result); - assertEquals(ValidationResult.VALID, result.getValidationResult()); - - event.setSource(""); - result = new AxValidationResult(); - result = event.validate(result); - assertEquals(ValidationResult.OBSERVATION, result.getValidationResult()); - - event.setSource("source"); - result = new AxValidationResult(); - result = event.validate(result); - assertEquals(ValidationResult.VALID, result.getValidationResult()); - - event.setTarget(""); - result = new AxValidationResult(); - result = event.validate(result); - assertEquals(ValidationResult.OBSERVATION, result.getValidationResult()); - - event.setTarget("target"); - result = new AxValidationResult(); - result = event.validate(result); - assertEquals(ValidationResult.VALID, result.getValidationResult()); - - event.getParameterMap().put(AxKey.NULL_KEY_NAME, null); - result = new AxValidationResult(); - result = event.validate(result); - assertEquals(ValidationResult.INVALID, result.getValidationResult()); - - event.getParameterMap().remove(AxKey.NULL_KEY_NAME); - result = new AxValidationResult(); - result = event.validate(result); - assertEquals(ValidationResult.VALID, result.getValidationResult()); - - event.getParameterMap().put("NullField", null); - result = new AxValidationResult(); - result = event.validate(result); - assertEquals(ValidationResult.INVALID, result.getValidationResult()); - - event.getParameterMap().remove("NullField"); - result = new AxValidationResult(); - result = event.validate(result); - assertEquals(ValidationResult.VALID, result.getValidationResult()); - - event.getParameterMap().put("NullField", eventField); - result = new AxValidationResult(); - result = event.validate(result); - assertEquals(ValidationResult.INVALID, result.getValidationResult()); - - event.getParameterMap().remove("NullField"); - result = new AxValidationResult(); - result = event.validate(result); - assertEquals(ValidationResult.VALID, result.getValidationResult()); - - event.getParameterMap().put("BadParent", eventFieldBadParent); - result = new AxValidationResult(); - result = event.validate(result); - assertEquals(ValidationResult.INVALID, result.getValidationResult()); - - event.getParameterMap().remove("BadParent"); - result = new AxValidationResult(); - result = event.validate(result); - assertEquals(ValidationResult.VALID, result.getValidationResult()); - - event.setToscaPolicyState("invalid_enum"); - result = new AxValidationResult(); - result = event.validate(result); - assertEquals(ValidationResult.INVALID, result.getValidationResult()); - event.setToscaPolicyState(AxToscaPolicyProcessingStatus.ENTRY.name()); - - event.clean(); - event.buildReferences(); - assertNotEquals(AxKey.NULL_KEY_NAME, - event.getParameterMap().values().iterator().next().getKey().getParentKeyName()); - - final AxEvent clonedEvent = new AxEvent(event); - assertEquals("AxEvent:(key=AxArtifactKey:(name=EventName,version=0.0.1),nameSpace=namespace", - clonedEvent.toString().substring(0, 77)); - - assertNotEquals(0, event.hashCode()); - - // disabling sonar because this code tests the equals() method - assertEquals(event, event); // NOSONAR - assertEquals(event, clonedEvent); - assertNotNull(event); - - Object helloObj = "Hello"; - assertNotEquals(event, helloObj); - assertNotEquals(event, new AxEvent(AxArtifactKey.getNullKey(), "namespace", "source", "target", parameterMap, - AxToscaPolicyProcessingStatus.ENTRY.name())); - assertNotEquals(event, new AxEvent(eventKey, "namespace1", "source", "target", parameterMap, - AxToscaPolicyProcessingStatus.ENTRY.name())); - assertNotEquals(event, new AxEvent(eventKey, "namespace", "source2", "target", parameterMap, - AxToscaPolicyProcessingStatus.ENTRY.name())); - assertNotEquals(event, new AxEvent(eventKey, "namespace", "source", "target3", parameterMap, - AxToscaPolicyProcessingStatus.ENTRY.name())); - assertNotEquals(event, new AxEvent(eventKey, "namespace", "source", "target", parameterMapEmpty, - AxToscaPolicyProcessingStatus.ENTRY.name())); - assertEquals(event, new AxEvent(eventKey, "namespace", "source", "target", parameterMap, - AxToscaPolicyProcessingStatus.ENTRY.name())); - - assertEquals(0, event.compareTo(event)); - assertEquals(0, event.compareTo(clonedEvent)); - assertNotEquals(0, event.compareTo(new AxArtifactKey())); - assertNotEquals(0, event.compareTo(null)); - assertNotEquals(0, event.compareTo(new AxEvent(AxArtifactKey.getNullKey(), "namespace", "source", "target", - parameterMap, AxToscaPolicyProcessingStatus.ENTRY.name()))); - assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace1", "source", "target", parameterMap, - AxToscaPolicyProcessingStatus.ENTRY.name()))); - assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source2", "target", parameterMap, - AxToscaPolicyProcessingStatus.ENTRY.name()))); - assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source", "target3", parameterMap, - AxToscaPolicyProcessingStatus.ENTRY.name()))); - assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source", "target", parameterMapEmpty, - AxToscaPolicyProcessingStatus.ENTRY.name()))); - assertEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source", "target", parameterMap, - AxToscaPolicyProcessingStatus.ENTRY.name()))); - - assertNotNull(event.getKeys()); - - final AxEvents events = new AxEvents(); - result = new AxValidationResult(); - result = events.validate(result); - assertEquals(ValidationResult.INVALID, result.getValidationResult()); - - // Invalid, no events in event map - events.setKey(new AxArtifactKey("EventsKey", "0.0.1")); - assertEquals("EventsKey:0.0.1", events.getKey().getId()); - - result = new AxValidationResult(); - result = events.validate(result); - assertEquals(ValidationResult.INVALID, result.getValidationResult()); - - events.getEventMap().put(eventKey, event); - result = new AxValidationResult(); - result = events.validate(result); - assertEquals(ValidationResult.VALID, result.getValidationResult()); - - events.getEventMap().put(AxArtifactKey.getNullKey(), null); - result = new AxValidationResult(); - result = events.validate(result); - assertEquals(ValidationResult.INVALID, result.getValidationResult()); - - events.getEventMap().remove(AxArtifactKey.getNullKey()); - result = new AxValidationResult(); - result = events.validate(result); - assertEquals(ValidationResult.VALID, result.getValidationResult()); - - events.getEventMap().put(new AxArtifactKey("NullValueKey", "0.0.1"), null); - result = new AxValidationResult(); - result = events.validate(result); - assertEquals(ValidationResult.INVALID, result.getValidationResult()); - - events.getEventMap().remove(new AxArtifactKey("NullValueKey", "0.0.1")); - result = new AxValidationResult(); - result = events.validate(result); - assertEquals(ValidationResult.VALID, result.getValidationResult()); - - events.getEventMap().put(new AxArtifactKey("BadEventKey", "0.0.1"), event); - result = new AxValidationResult(); - result = events.validate(result); - assertEquals(ValidationResult.INVALID, result.getValidationResult()); - - events.getEventMap().remove(new AxArtifactKey("BadEventKey", "0.0.1")); - result = new AxValidationResult(); - result = events.validate(result); - assertEquals(ValidationResult.VALID, result.getValidationResult()); - - events.clean(); - event.buildReferences(); - assertNotEquals(AxKey.NULL_KEY_NAME, - event.getParameterMap().values().iterator().next().getKey().getParentKeyName()); - - final AxEvents clonedEvents = new AxEvents(events); - assertEquals("AxEvents:(key=AxArtifactKey:(name=EventsKey,version=0.0.1),e", - clonedEvents.toString().substring(0, 60)); - - assertNotEquals(0, events.hashCode()); - - assertEquals(events, clonedEvents); - assertNotNull(events); - assertNotEquals(event, helloObj); - assertNotEquals(events, new AxEvents(new AxArtifactKey())); - - assertEquals(0, events.compareTo(events)); - assertEquals(0, events.compareTo(clonedEvents)); - assertNotEquals(0, events.compareTo(null)); - assertNotEquals(0, events.compareTo(new AxArtifactKey())); - assertNotEquals(0, events.compareTo(new AxEvents(new AxArtifactKey()))); - - clonedEvents.get(eventKey).setSource("AnotherSource"); - assertNotEquals(0, events.compareTo(clonedEvents)); - - assertEquals(events.getKey(), events.getKeys().get(0)); - - assertEquals("EventName", events.get("EventName").getKey().getName()); - assertEquals("EventName", events.get("EventName", "0.0.1").getKey().getName()); - assertEquals(1, events.getAll("EventName", "0.0.1").size()); - assertEquals(0, events.getAll("NonExistantEventsName").size()); - } -} diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/FieldTest.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/FieldTest.java deleted file mode 100644 index 6ec46dbd5..000000000 --- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/FieldTest.java +++ /dev/null @@ -1,134 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019-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.eventmodel.concepts; - -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.AxReferenceKey; -import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; -import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult; - -/** - * Test fields. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class FieldTest { - - @Test - public void testField() { - assertNotNull(new AxField()); - assertNotNull(new AxField(new AxReferenceKey())); - assertNotNull(new AxField(new AxReferenceKey(), new AxArtifactKey())); - assertNotNull(new AxField(new AxReferenceKey(), new AxArtifactKey(), false)); - assertNotNull(new AxField("LocalName", new AxArtifactKey(), false)); - assertNotNull(new AxField("LocalName", new AxArtifactKey())); - assertNotNull(new AxField("LocalName", new AxArtifactKey(), false)); - - assertNotNull(new AxInputField()); - assertNotNull(new AxInputField(new AxReferenceKey())); - assertNotNull(new AxInputField(new AxReferenceKey(), new AxArtifactKey())); - assertNotNull(new AxInputField(new AxReferenceKey(), new AxArtifactKey(), true)); - assertNotNull(new AxInputField("LocalName", new AxArtifactKey())); - assertNotNull(new AxInputField(new AxInputField())); - - assertNotNull(new AxOutputField()); - assertNotNull(new AxOutputField(new AxReferenceKey())); - assertNotNull(new AxOutputField(new AxReferenceKey(), new AxArtifactKey())); - assertNotNull(new AxOutputField(new AxReferenceKey(), new AxArtifactKey(), false)); - assertNotNull(new AxOutputField("LocalName", new AxArtifactKey())); - assertNotNull(new AxOutputField(new AxOutputField())); - - final AxField field = new AxField(); - - final AxReferenceKey fieldKey = new AxReferenceKey("FieldName", "0.0.1", "PLN", "LN"); - field.setKey(fieldKey); - assertEquals("FieldName:0.0.1:PLN:LN", field.getKey().getId()); - assertEquals("FieldName:0.0.1:PLN:LN", field.getKeys().get(0).getId()); - - final AxArtifactKey schemaKey = new AxArtifactKey("SchemaName", "0.0.1"); - field.setSchema(schemaKey); - assertEquals("SchemaName:0.0.1", field.getSchema().getId()); - - assertEquals(false, field.getOptional()); - field.setOptional(true); - assertEquals(true, field.getOptional()); - - AxValidationResult result = new AxValidationResult(); - result = field.validate(result); - assertEquals(AxValidationResult.ValidationResult.VALID, result.getValidationResult()); - - field.setKey(AxReferenceKey.getNullKey()); - result = new AxValidationResult(); - result = field.validate(result); - assertEquals(ValidationResult.INVALID, result.getValidationResult()); - - field.setKey(fieldKey); - result = new AxValidationResult(); - result = field.validate(result); - assertEquals(ValidationResult.VALID, result.getValidationResult()); - - field.setSchema(AxArtifactKey.getNullKey()); - result = new AxValidationResult(); - result = field.validate(result); - assertEquals(ValidationResult.INVALID, result.getValidationResult()); - - field.setSchema(schemaKey); - result = new AxValidationResult(); - result = field.validate(result); - assertEquals(ValidationResult.VALID, result.getValidationResult()); - - field.clean(); - - final AxField clonedField = new AxField(field); - assertEquals("AxField:(key=AxReferenceKey:(parentKeyName=FieldName,parentKeyVersion=0.0.1," - + "parentLocalName=PLN,localName=LN),fieldSchemaKey=" - + "AxArtifactKey:(name=SchemaName,version=0.0.1),optional=true)", clonedField.toString()); - - assertNotEquals(0, field.hashCode()); - // disabling sonar because this code tests the equals() method - assertEquals(field, field); // NOSONAR - assertEquals(field, clonedField); - assertNotNull(field); - assertNotEquals(field, (Object) "Hello"); - assertNotEquals(field, new AxField(AxReferenceKey.getNullKey(), AxArtifactKey.getNullKey(), false)); - assertNotEquals(field, new AxField(fieldKey, AxArtifactKey.getNullKey(), false)); - assertNotEquals(field, new AxField(fieldKey, schemaKey, false)); - assertEquals(field, new AxField(fieldKey, schemaKey, true)); - - assertEquals(0, field.compareTo(field)); - assertEquals(0, field.compareTo(clonedField)); - assertNotEquals(0, field.compareTo(new AxArtifactKey())); - assertNotEquals(0, field.compareTo(null)); - assertNotEquals(0, - field.compareTo(new AxField(AxReferenceKey.getNullKey(), AxArtifactKey.getNullKey(), false))); - assertNotEquals(0, field.compareTo(new AxField(fieldKey, AxArtifactKey.getNullKey(), false))); - assertNotEquals(0, field.compareTo(new AxField(fieldKey, schemaKey, false))); - assertEquals(0, field.compareTo(new AxField(fieldKey, schemaKey, true))); - - assertNotNull(field.getKeys()); - } -} diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java deleted file mode 100644 index 21b97c454..000000000 --- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java +++ /dev/null @@ -1,279 +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.eventmodel.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.eventmodel.concepts.AxEventModel; - -public class ApexEventModelTest { - 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=event0,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event0,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "AxArtifactKey:(name=event2,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event2,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "********************************"; - - private static final String WARNING_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n" - + "AxArtifactKey:(name=event0,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:WARNING:nameSpace on event is blank\n" - + "AxArtifactKey:(name=event0,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event0,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:WARNING:nameSpace on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "AxArtifactKey:(name=event2,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:WARNING:nameSpace on event is blank\n" - + "AxArtifactKey:(name=event2,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event2,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "********************************"; - - private static final String INVALID_MODEL_STRING = "\n" + "***validation of model failed***\n" - + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):" - + "org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation:INVALID:" - + "keyInfoMap may not be empty\n" + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=smallEventModel,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=Schemas,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=BigIntType,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=BooleanType,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=IntType,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=MapType,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=SetType,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=StringType,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=smallEventMap,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=event0,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for parent key of key AxReferenceKey:" - + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par0)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for parent key of key AxReferenceKey:" - + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for parent key of key AxReferenceKey:" - + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par2)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for parent key of key AxReferenceKey:" - + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par3)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for parent key of key AxReferenceKey:" - + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par4)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for parent key of key AxReferenceKey:" - + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par5)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for parent key of key AxReferenceKey:" - + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par6)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for parent key of key AxReferenceKey:" - + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "duplicate key AxArtifactKey:(name=event1,version=0.0.1) found\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "duplicate key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL," - + "localName=theOnlyPar) found\n" + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for parent key of key AxReferenceKey:" - + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n" - + "AxArtifactKey:(name=event0,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event0,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:INVALID:" - + "parent key on parameter field AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1," - + "parentLocalName=NULL,localName=theOnlyPar) does not equal event key\n" - + "AxArtifactKey:(name=smallEventMap,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvents:INVALID:" - + "key on event entry key AxArtifactKey:(name=event2,version=0.0.1) does not equal event value key " - + "AxArtifactKey:(name=event1,version=0.0.1)\n" + "AxArtifactKey:(name=event1,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:INVALID:" - + "parent key on parameter field AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1," - + "parentLocalName=NULL,localName=theOnlyPar) does not equal event key\n" - + "********************************"; - - private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" + "***validation of model failed***\n" - + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):" - + "org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation:INVALID:" - + "keyInfoMap may not be empty\n" + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=smallEventModel,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=Schemas,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=SetType,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=smallEventMap,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for parent key of key AxReferenceKey:" - + "(parentKeyName=event1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "duplicate key AxArtifactKey:(name=event1,version=0.0.1) found\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "duplicate key AxReferenceKey:(parentKeyName=event1,parentKeyVersion=0.0.1," - + "parentLocalName=NULL,localName=theOnlyPar) found\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" - + "key information not found for parent key of key AxReferenceKey:" - + "(parentKeyName=event1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n" - + "AxArtifactKey:(name=event1,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "AxArtifactKey:(name=smallEventMap,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvents:INVALID:" - + "key on event entry key AxArtifactKey:(name=event2,version=0.0.1) does not equal event value key " - + "AxArtifactKey:(name=event1,version=0.0.1)\n" + "AxArtifactKey:(name=event1,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):" - + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "********************************"; - - TestApexModel<AxEventModel> testApexModel; - - /** - * Set up the test. - * - * @throws Exception exceptions from the test - */ - @Before - public void setup() throws Exception { - testApexModel = new TestApexModel<AxEventModel>(AxEventModel.class, new DummyTestApexEventModelCreator()); - } - - @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/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/DummyTestApexEventModelCreator.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/DummyTestApexEventModelCreator.java deleted file mode 100644 index 11685a6b4..000000000 --- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/DummyTestApexEventModelCreator.java +++ /dev/null @@ -1,309 +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.eventmodel.handling; - -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; -import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation; -import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; -import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; -import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator; -import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; -import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; -import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; -import org.onap.policy.apex.model.eventmodel.concepts.AxEventModel; -import org.onap.policy.apex.model.eventmodel.concepts.AxEvents; -import org.onap.policy.apex.model.eventmodel.concepts.AxField; - -public class DummyTestApexEventModelCreator implements TestApexModelCreator<AxEventModel> { - - @Override - public AxEventModel getModel() { - final AxContextSchema axSchema0 = - new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Boolean"); - final AxContextSchema axSchema1 = - new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer"); - final AxContextSchema axSchema2 = - new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema axSchema3 = new AxContextSchema(new AxArtifactKey("KeyType", "0.0.1"), "Java", - "org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey"); - final AxContextSchema axSchema4 = new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", - "org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation"); - final AxContextSchema axSchema5 = - new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger"); - final AxContextSchema axSchema6 = new AxContextSchema(new AxArtifactKey("ModelType", "0.0.1"), "Java", - "org.onap.policy.apex.model.basicmodel.concepts.AxModel"); - - final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1")); - dataTypes.getSchemasMap().put(axSchema0.getKey(), axSchema0); - dataTypes.getSchemasMap().put(axSchema1.getKey(), axSchema1); - dataTypes.getSchemasMap().put(axSchema2.getKey(), axSchema2); - dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3); - dataTypes.getSchemasMap().put(axSchema4.getKey(), axSchema4); - dataTypes.getSchemasMap().put(axSchema5.getKey(), axSchema5); - dataTypes.getSchemasMap().put(axSchema6.getKey(), axSchema6); - - final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1")); - - final AxEvent event0 = new AxEvent(new AxArtifactKey("event0", "0.0.1"), - "org.onap.policy.apex.model.eventmodel.events", "Source", "Target"); - event0.getParameterMap().put("par0", - new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey())); - event0.getParameterMap().put("par1", - new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey())); - event0.getParameterMap().put("par2", - new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey())); - event0.getParameterMap().put("par3", - new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema6.getKey())); - event0.getParameterMap().put("par4", - new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey())); - event0.getParameterMap().put("par5", - new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey())); - event0.getParameterMap().put("par6", - new AxField(new AxReferenceKey(event0.getKey(), "par6"), axSchema5.getKey())); - eventMap.getEventMap().put(event0.getKey(), event0); - - final AxEvent event1 = new AxEvent(new AxArtifactKey("event1", "0.0.1"), - "org.onap.policy.apex.model.eventmodel.events", "Source", "Target"); - event1.getParameterMap().put("theOnlyPar", - new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey())); - eventMap.getEventMap().put(event1.getKey(), event1); - - final AxEvent event2 = new AxEvent(new AxArtifactKey("event2", "0.0.1"), - "org.onap.policy.apex.model.eventmodel.events", "Source", "Target"); - eventMap.getEventMap().put(event2.getKey(), event2); - - final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")); - - final AxEventModel eventModel = - new AxEventModel(new AxArtifactKey("EventModel", "0.0.1"), dataTypes, keyInformation, eventMap); - keyInformation.generateKeyInfo(eventModel); - - eventModel.validate(new AxValidationResult()); - return eventModel; - } - - @Override - public AxEventModel getInvalidModel() { - final AxContextSchema axSchema0 = - new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Zoolean"); - final AxContextSchema axSchema1 = - new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer"); - final AxContextSchema axSchema2 = - new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema axSchema3 = - new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set"); - final AxContextSchema axSchema4 = - new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", "java.util.Map"); - final AxContextSchema axSchema5 = - new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger"); - - final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1")); - dataTypes.getSchemasMap().put(axSchema0.getKey(), axSchema0); - dataTypes.getSchemasMap().put(axSchema1.getKey(), axSchema1); - dataTypes.getSchemasMap().put(axSchema2.getKey(), axSchema2); - dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3); - dataTypes.getSchemasMap().put(axSchema4.getKey(), axSchema4); - dataTypes.getSchemasMap().put(axSchema5.getKey(), axSchema5); - - final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1")); - - final AxEvent event0 = - new AxEvent(new AxArtifactKey("event0", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); - event0.getParameterMap().put("par0", - new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey())); - event0.getParameterMap().put("par1", - new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey())); - event0.getParameterMap().put("par2", - new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey())); - event0.getParameterMap().put("par3", - new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema3.getKey())); - event0.getParameterMap().put("par4", - new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey())); - event0.getParameterMap().put("par5", - new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey())); - event0.getParameterMap().put("par6", - new AxField(new AxReferenceKey(event0.getKey(), "par6"), axSchema5.getKey())); - eventMap.getEventMap().put(event0.getKey(), event0); - - final AxEvent event1 = - new AxEvent(new AxArtifactKey("event1", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); - event1.getParameterMap().put("theOnlyPar", - new AxField(new AxReferenceKey(event0.getKey(), "theOnlyPar"), axSchema3.getKey())); - eventMap.getEventMap().put(event1.getKey(), event1); - - final AxEvent event2 = - new AxEvent(new AxArtifactKey("event2", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); - eventMap.getEventMap().put(event2.getKey(), event1); - - final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")); - - final AxEventModel eventModel = - new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), dataTypes, keyInformation, eventMap); - - return eventModel; - } - - @Override - public AxEventModel getMalstructuredModel() { - final AxContextSchema axSchema3 = - new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set"); - final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1")); - dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3); - - final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1")); - - final AxEvent event1 = - new AxEvent(new AxArtifactKey("event1", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); - event1.getParameterMap().put("theOnlyPar", - new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey())); - eventMap.getEventMap().put(event1.getKey(), event1); - - final AxEvent event2 = - new AxEvent(new AxArtifactKey("event2", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); - eventMap.getEventMap().put(event2.getKey(), event1); - - final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")); - - final AxEventModel eventModel = - new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), dataTypes, keyInformation, eventMap); - - eventModel.validate(new AxValidationResult()); - - return eventModel; - } - - @Override - public AxEventModel getWarningModel() { - final AxContextSchema axSchema0 = - new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Boolean"); - final AxContextSchema axSchema1 = - new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer"); - final AxContextSchema axSchema2 = - new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema axSchema3 = - new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set"); - final AxContextSchema axSchema4 = - new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", "java.util.Map"); - final AxContextSchema axSchema5 = - new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger"); - final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1")); - dataTypes.getSchemasMap().put(axSchema0.getKey(), axSchema0); - dataTypes.getSchemasMap().put(axSchema1.getKey(), axSchema1); - dataTypes.getSchemasMap().put(axSchema2.getKey(), axSchema2); - dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3); - dataTypes.getSchemasMap().put(axSchema4.getKey(), axSchema4); - dataTypes.getSchemasMap().put(axSchema5.getKey(), axSchema5); - - final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1")); - - final AxEvent event0 = new AxEvent(new AxArtifactKey("event0", "0.0.1"), ""); - event0.getParameterMap().put("par0", - new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey())); - event0.getParameterMap().put("par1", - new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey())); - event0.getParameterMap().put("par2", - new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey())); - event0.getParameterMap().put("par3", - new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema3.getKey())); - event0.getParameterMap().put("par4", - new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey())); - event0.getParameterMap().put("par5", - new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey())); - eventMap.getEventMap().put(event0.getKey(), event0); - - final AxEvent event1 = new AxEvent(new AxArtifactKey("event1", "0.0.1"), ""); - event1.getParameterMap().put("theOnlyPar", - new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey())); - eventMap.getEventMap().put(event1.getKey(), event1); - - final AxEvent event2 = new AxEvent(new AxArtifactKey("event2", "0.0.1"), ""); - eventMap.getEventMap().put(event2.getKey(), event2); - - final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")); - - final AxEventModel eventModel = - new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), dataTypes, keyInformation, eventMap); - eventModel.getKeyInformation().generateKeyInfo(eventModel); - eventModel.validate(new AxValidationResult()); - - return eventModel; - } - - @Override - public AxEventModel getObservationModel() { - final AxContextSchema axSchema0 = - new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Boolean"); - final AxContextSchema axSchema1 = - new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer"); - final AxContextSchema axSchema2 = - new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema axSchema3 = - new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set"); - final AxContextSchema axSchema4 = - new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", "java.util.Map"); - final AxContextSchema axSchema5 = - new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger"); - final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1")); - schemas.getSchemasMap().put(axSchema0.getKey(), axSchema0); - schemas.getSchemasMap().put(axSchema1.getKey(), axSchema1); - schemas.getSchemasMap().put(axSchema2.getKey(), axSchema2); - schemas.getSchemasMap().put(axSchema3.getKey(), axSchema3); - schemas.getSchemasMap().put(axSchema4.getKey(), axSchema4); - schemas.getSchemasMap().put(axSchema5.getKey(), axSchema5); - - final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1")); - - final AxEvent event0 = - new AxEvent(new AxArtifactKey("event0", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); - event0.getParameterMap().put("par0", - new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey())); - event0.getParameterMap().put("par1", - new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey())); - event0.getParameterMap().put("par2", - new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey())); - event0.getParameterMap().put("par3", - new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema3.getKey())); - event0.getParameterMap().put("par4", - new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey())); - event0.getParameterMap().put("par5", - new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey())); - eventMap.getEventMap().put(event0.getKey(), event0); - - final AxEvent event1 = - new AxEvent(new AxArtifactKey("event1", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); - event1.getParameterMap().put("theOnlyPar", - new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey())); - eventMap.getEventMap().put(event1.getKey(), event1); - - final AxEvent event2 = - new AxEvent(new AxArtifactKey("event2", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); - eventMap.getEventMap().put(event2.getKey(), event2); - - final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")); - - final AxEventModel eventModel = - new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), schemas, keyInformation, eventMap); - eventModel.getKeyInformation().generateKeyInfo(eventModel); - eventModel.validate(new AxValidationResult()); - - return eventModel; - } -} diff --git a/model/event-model/src/test/resources/logback-test.xml b/model/event-model/src/test/resources/logback-test.xml deleted file mode 100644 index 2aff4c2e9..000000000 --- a/model/event-model/src/test/resources/logback-test.xml +++ /dev/null @@ -1,74 +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.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> |