summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-09-12 23:29:25 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-09-12 23:54:51 +0100
commit0e23f7634e1e1fb31454c516974613335fcea1a4 (patch)
treebedf0e52104e62599dd091eb6292de5dc7d57f49
parent3ccc3d9ecd4bcd8960a2da6ecbdc7f3ac806fc67 (diff)
Sonar/Checkstyle in model/context/core
Checkstyle and sonar changes in the model, contexot and core modules. Issue-ID: POLICY-1034 Change-Id: I2d40bc877f3a548844470fc290fc89d63fa465ae Signed-off-by: liamfallon <liam.fallon@ericsson.com>
-rw-r--r--auth/cli-codegen/src/main/resources/org/onap/policy/apex/auth/clicodegen/cli-editor.stg2
-rw-r--r--client/client-editor/src/main/resources/webapp/js/ApexPolicyEditForm.js2
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/SchemaHelper.java2
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java24
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/AbstractDistributor.java28
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java24
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/AbstractLockManager.java48
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java2
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/ContextMonitor.java27
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java2
-rw-r--r--context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java51
-rw-r--r--core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java13
-rw-r--r--core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/DeploymentClient.java12
-rw-r--r--core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/EngineServiceFacade.java140
-rw-r--r--core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/PeriodicEventManager.java5
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java2
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java2
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/ApexEngine.java2
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java99
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java13
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java41
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java32
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java20
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java76
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java10
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java33
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java12
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java6
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java10
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java14
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java14
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java9
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/JavaHandlingException.java12
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java41
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassBuilder.java24
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassByteCodeFileObject.java2
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleFileManager.java2
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageHolder.java15
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageListener.java6
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingService.java10
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingServiceFactory.java8
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java67
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/WebSocketMessageListener.java8
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/InternalMessageBusClient.java16
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/MessagingClient.java12
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlock.java10
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlockHandler.java12
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/InternalMessageBusServer.java36
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/MessageServerImpl.java31
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageClient.java (renamed from core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WSStringMessageClient.java)34
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageListener.java (renamed from core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WSStringMessageListener.java)2
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageServer.java (renamed from core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WSStringMessageServer.java)18
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessager.java (renamed from core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WSStringMessager.java)4
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java11
-rw-r--r--core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java22
-rw-r--r--core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/StringTestServer.java45
-rw-r--r--examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java18
-rw-r--r--examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTslUseCase.java2
-rw-r--r--examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTslUseCase.java2
-rw-r--r--examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpUseCase.java40
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelReader.java6
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelWriter.java13
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModel.java25
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java4
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java25
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java3
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyLogicReader.java5
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelMerger.java12
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitter.java7
-rw-r--r--plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributor.java8
-rw-r--r--plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanDistributorParameters.java2
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/AAIInventoryResponseItemType.avsc136
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/ArrayExampleAddress.avsc16
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/ArrayExampleLong.avsc2
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/EnumSchema.avsc6
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/FixedSchema.avsc6
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/HealthCheckBodyType.avsc148
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/MapExampleAddress.avsc16
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/MapExampleAddressInvalidFields.avsc16
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/MapExampleLong.avsc2
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExample.avsc336
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExampleInvalidFields.avsc336
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExampleVPN.avsc6
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExampleVPNReuse.avsc64
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/UnionExample.avsc56
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/AAIResponse4Policy.json36
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/AAIResponse4VNF.json600
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/AAIResponseExample.json414
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/HealthCheckEvent.json38
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/MapExampleAddressFull.json32
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/MapExampleAddressInvalidFields.json32
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/RecordExampleVPNFull.json2
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/UnionExampleNullField.json8
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/UnionExampleOptionalField.json6
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumer.java16
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducer.java16
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexPeriodicEventGenerator.java2
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/enevent/ApexEvent2EnEventConverter.java4
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java16
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/DefaultState_Logic.javascript2
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/DefaultTask_Logic.javascript2
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/EvalState_Logic.javascript2
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/EvalTask_Logic.javascript2
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/DefaultState_Logic.jython2
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/DefaultTask_Logic.jython2
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/EvalState_Logic.jython2
-rw-r--r--testsuites/integration/integration-executor-test/src/test/resources/logback-test.xml2
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerClient.java10
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerServer.java10
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberClient.java10
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberServer.java10
-rw-r--r--tools/tools-common/src/site-docs/adoc/fragments/example-cli.adoc4
112 files changed, 1947 insertions, 1878 deletions
diff --git a/auth/cli-codegen/src/main/resources/org/onap/policy/apex/auth/clicodegen/cli-editor.stg b/auth/cli-codegen/src/main/resources/org/onap/policy/apex/auth/clicodegen/cli-editor.stg
index 5f05f3933..c3d386606 100644
--- a/auth/cli-codegen/src/main/resources/org/onap/policy/apex/auth/clicodegen/cli-editor.stg
+++ b/auth/cli-codegen/src/main/resources/org/onap/policy/apex/auth/clicodegen/cli-editor.stg
@@ -21,7 +21,7 @@
/*
* Template for creating APEX CLI Editor Commands.
*
- * @package com.ericsson.apex.apps.pdsls.base
+ * @package org.onap.policy.apex.apps.pdsls.base
* @author Sven van der Meer &lt;sven.van.der.meer@ericsson.com&gt;
*/
diff --git a/client/client-editor/src/main/resources/webapp/js/ApexPolicyEditForm.js b/client/client-editor/src/main/resources/webapp/js/ApexPolicyEditForm.js
index fd34f0057..79985828d 100644
--- a/client/client-editor/src/main/resources/webapp/js/ApexPolicyEditForm.js
+++ b/client/client-editor/src/main/resources/webapp/js/ApexPolicyEditForm.js
@@ -376,7 +376,7 @@ function editPolicyForm_activate(parent, operation, policy, tasks, events, conte
name : "PeriodicEvent",
version : "0.0.1"
},
- nameSpace : "com.ericsson.apex.domains.aadm.events",
+ nameSpace : "org.onap.policy.apex.domains.aadm.events",
parameter : {
entry : [ {
key : "PERIODIC_EVENT_COUNT",
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/SchemaHelper.java b/context/context-management/src/main/java/org/onap/policy/apex/context/SchemaHelper.java
index 30af48195..44ec06c6d 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/SchemaHelper.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/SchemaHelper.java
@@ -38,7 +38,7 @@ public interface SchemaHelper {
* @param schema the schema
* @throws ContextRuntimeException the context runtime exception
*/
- void init(AxKey userKey, AxContextSchema schema) throws ContextRuntimeException;
+ void init(AxKey userKey, AxContextSchema schema);
/**
* Get the user key of the schema helper.
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java
index 0f991ba36..6382992d9 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java
@@ -51,6 +51,10 @@ public final class ContextAlbumImpl implements ContextAlbum {
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(ContextAlbumImpl.class);
+ // Recurring string constants
+ private static final String NULL_VALUES_ILLEGAL = "null values are illegal on method parameter \"key\"";
+ private static final String ALBUM = "album \"";
+
// The definition of this context album
private final AxContextAlbum albumDefinition;
@@ -259,8 +263,8 @@ public final class ContextAlbumImpl implements ContextAlbum {
@Override
public boolean containsKey(final Object key) {
if (key == null) {
- LOGGER.warn("null values are illegal on method parameter \"key\"");
- throw new ContextRuntimeException("null values are illegal on method parameter \"key\"");
+ LOGGER.warn(NULL_VALUES_ILLEGAL);
+ throw new ContextRuntimeException(NULL_VALUES_ILLEGAL);
}
return albumMap.containsKey(key);
@@ -290,7 +294,7 @@ public final class ContextAlbumImpl implements ContextAlbum {
public Object get(final Object key) {
if (key == null) {
final String returnString =
- "album \"" + albumDefinition.getId() + "\" null keys are illegal on keys for get()";
+ ALBUM + albumDefinition.getId() + "\" null keys are illegal on keys for get()";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
@@ -365,20 +369,20 @@ public final class ContextAlbumImpl implements ContextAlbum {
public Object put(final String key, final Object incomingValue) {
if (key == null) {
final String returnString =
- "album \"" + albumDefinition.getId() + "\" null keys are illegal on keys for put()";
+ ALBUM + albumDefinition.getId() + "\" null keys are illegal on keys for put()";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
if (incomingValue == null) {
- final String returnString = "album \"" + albumDefinition.getId() + "\" null values are illegal on key \""
+ final String returnString = ALBUM + albumDefinition.getId() + "\" null values are illegal on key \""
+ key + "\" for put()";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
if (!albumDefinition.isWritable()) {
- final String returnString = "album \"" + albumDefinition.getId()
+ final String returnString = ALBUM + albumDefinition.getId()
+ "\" put() not allowed on read only albums for key=\"" + key + "\", value=\"" + incomingValue;
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
@@ -418,7 +422,7 @@ public final class ContextAlbumImpl implements ContextAlbum {
public void putAll(final Map<? extends String, ? extends Object> incomingContextAlbum) {
if (!albumDefinition.isWritable()) {
final String returnString =
- "album \"" + albumDefinition.getId() + "\" putAll() not allowed on read only albums";
+ ALBUM + albumDefinition.getId() + "\" putAll() not allowed on read only albums";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
@@ -454,14 +458,14 @@ public final class ContextAlbumImpl implements ContextAlbum {
@Override
public Object remove(final Object key) {
if (!albumDefinition.isWritable()) {
- final String returnString = "album \"" + albumDefinition.getId()
+ final String returnString = ALBUM + albumDefinition.getId()
+ "\" remove() not allowed on read only albums for key=\"" + key + "\"";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
if (key == null) {
- LOGGER.warn("null values are illegal on method parameter \"key\"");
+ LOGGER.warn(NULL_VALUES_ILLEGAL);
throw new ContextRuntimeException("null values are illegal on method parameter \"keyID\"");
}
@@ -483,7 +487,7 @@ public final class ContextAlbumImpl implements ContextAlbum {
public void clear() {
if (!albumDefinition.isWritable()) {
final String returnString =
- "album \"" + albumDefinition.getId() + "\" clear() not allowed on read only albums";
+ ALBUM + albumDefinition.getId() + "\" clear() not allowed on read only albums";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/AbstractDistributor.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/AbstractDistributor.java
index e40646d56..042b2c22a 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/AbstractDistributor.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/AbstractDistributor.java
@@ -94,12 +94,12 @@ public abstract class AbstractDistributor implements Distributor {
// Create the lock manager if it doesn't already exist
if (lockManager == null) {
- lockManager = new LockManagerFactory().createLockManager(key);
+ setLockManager(new LockManagerFactory().createLockManager(key));
}
// Set up flushing on the context distributor if its not set up already
if (flushTimer == null) {
- flushTimer = new DistributorFlushTimerTask(this);
+ setFlushTimer(new DistributorFlushTimerTask(this));
}
// Create a new persistor for this key
@@ -107,6 +107,22 @@ public abstract class AbstractDistributor implements Distributor {
LOGGER.exit("init(" + key + ")");
}
+ /**
+ * Set the static lock manager
+ * @param incomingLockManager the lock manager value
+ */
+ private static void setLockManager(final LockManager incomingLockManager) {
+ lockManager = incomingLockManager;
+ }
+
+ /**
+ * Set the static flush timer
+ * @param incomingFlushTimer the flush timer value
+ */
+ private static void setFlushTimer(final DistributorFlushTimerTask incomingFlushTimer) {
+ flushTimer = incomingFlushTimer;
+ }
+
/*
* (non-Javadoc)
*
@@ -191,8 +207,7 @@ public abstract class AbstractDistributor implements Distributor {
// another process,
// if not, we have to try to read the content from persistence
if (newContextAlbumMap.isEmpty()) {
- // Read entries from persistence
- // TODO: READ ITEMS FROM PRESISTENCE!!!!
+ // Read entries from persistence, (Not implemented yet)
}
// Create the context album and put the context album object onto the distributor
@@ -232,8 +247,7 @@ public abstract class AbstractDistributor implements Distributor {
for (final Entry<AxArtifactKey, ContextAlbum> distributorMapEntry : albumMaps.entrySet()) {
// Let the persistor write each of the entries
for (final Object contextItem : distributorMapEntry.getValue().values()) {
- LOGGER.debug(contextItem.toString());
- // persistor.writeContextItem((AxContextSchema) contextItem);
+ persistor.writeContextItem((AxContextSchema) contextItem);
}
}
}
@@ -312,7 +326,7 @@ public abstract class AbstractDistributor implements Distributor {
// Shut down the lock manager
if (lockManager != null) {
lockManager.shutdown();
- lockManager = null;
+ setLockManager(null);
}
albumMaps.clear();
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java
index 2c3661822..0dd1d9966 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java
@@ -46,7 +46,7 @@ public class DistributorFlushTimerTask extends TimerTask {
private final Distributor contextDistributor;
// Timing information
- private long period = 0;
+ private long flushPeriod = 0;
private long flushCount = 0;
/**
@@ -62,14 +62,14 @@ public class DistributorFlushTimerTask extends TimerTask {
// Set the period for persistence flushing
final PersistorParameters persistorParameters = ParameterService
.get(ContextParameterConstants.PERSISTENCE_GROUP_NAME);
- period = persistorParameters.getFlushPeriod();
+ flushPeriod = persistorParameters.getFlushPeriod();
// Set up the timer
timer = new Timer(DistributorFlushTimerTask.class.getSimpleName(), true);
- timer.schedule(this, period, period);
+ timer.schedule(this, flushPeriod, flushPeriod);
- LOGGER.debug("context distributor " + contextDistributor.getKey().getId() + " flushing set up with interval: "
- + period + "ms");
+ LOGGER.debug("context distributor {} flushing set up with interval: {} ms", contextDistributor.getKey().getId(),
+ flushPeriod);
}
/**
@@ -80,15 +80,15 @@ public class DistributorFlushTimerTask extends TimerTask {
// Increment the flush counter
flushCount++;
- LOGGER.debug("context distributor " + contextDistributor.getKey().getId() + " flushing: period=" + period
- + ": count=" + flushCount);
+ LOGGER.debug("context distributor {} flushing: period={}: count={}", contextDistributor.getKey().getId(),
+ flushPeriod, flushCount);
try {
contextDistributor.flush();
- LOGGER.debug("context distributor " + contextDistributor.getKey().getId() + " flushed: period=" + period
- + ": count=" + flushCount);
+ LOGGER.debug("context distributor {} flushed: period={}: count={}", contextDistributor.getKey().getId(),
+ flushPeriod, flushCount);
} catch (final ContextException e) {
- LOGGER.error("flush error on context distributor " + contextDistributor.getKey().getId() + ": period="
- + period + ": count=" + flushCount, e);
+ LOGGER.error("flush error on context distributor {}: period={}: count={}",
+ contextDistributor.getKey().getId(), flushPeriod, flushCount, e);
}
}
@@ -113,6 +113,6 @@ public class DistributorFlushTimerTask extends TimerTask {
*/
@Override
public String toString() {
- return "ContextDistributorFlushTimerTask [period=" + period + ", flushCount=" + flushCount + "]";
+ return "ContextDistributorFlushTimerTask [period=" + flushPeriod + ", flushCount=" + flushCount + "]";
}
}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/AbstractLockManager.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/AbstractLockManager.java
index 4f197e2d3..88908b965 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/AbstractLockManager.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/AbstractLockManager.java
@@ -41,12 +41,15 @@ public abstract class AbstractLockManager implements LockManager {
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(AbstractLockManager.class);
+ // Recurring string constants
+ private static final String CONTEXT_ITEM = " context item ";
+
// The key of this lock manager
private AxArtifactKey key = null;
// Map of locks in use on this distributor for each context map
- private final Map<String, Map<String, ReadWriteLock>> lockMaps =
- Collections.synchronizedMap(new HashMap<String, Map<String, ReadWriteLock>>());
+ private final Map<String, Map<String, ReadWriteLock>> lockMaps = Collections
+ .synchronizedMap(new HashMap<String, Map<String, ReadWriteLock>>());
/*
* (non-Javadoc)
@@ -85,9 +88,9 @@ public abstract class AbstractLockManager implements LockManager {
lock.readLock().lock();
LOGGER.exit("lockForReading(" + lockTypeKey + "_" + lockKey + ")");
} catch (final Exception e) {
- LOGGER.warn("error acquiring read lock on context map " + lockTypeKey + " context item " + lockKey, e);
+ LOGGER.warn("error acquiring read lock on context map " + lockTypeKey + CONTEXT_ITEM + lockKey, e);
throw new ContextException(
- "error acquiring read lock on context map " + lockTypeKey + " context item " + lockKey, e);
+ "error acquiring read lock on context map " + lockTypeKey + CONTEXT_ITEM + lockKey, e);
}
}
@@ -107,9 +110,9 @@ public abstract class AbstractLockManager implements LockManager {
lock.writeLock().lock();
LOGGER.exit("lockForWriting(" + lockTypeKey + "_" + lockKey + ")");
} catch (final Exception e) {
- LOGGER.warn("error acquiring write lock on context map " + lockTypeKey + " context item " + lockKey, e);
+ LOGGER.warn("error acquiring write lock on context map " + lockTypeKey + CONTEXT_ITEM + lockKey, e);
throw new ContextException(
- "error acquiring write lock on context map " + lockTypeKey + " context item " + lockKey, e);
+ "error acquiring write lock on context map " + lockTypeKey + CONTEXT_ITEM + lockKey, e);
}
}
@@ -129,9 +132,9 @@ public abstract class AbstractLockManager implements LockManager {
lock.readLock().unlock();
LOGGER.exit("unlockForReading(" + lockTypeKey + "_" + lockKey + ")");
} catch (final Exception e) {
- LOGGER.warn("error releasing read lock on context map " + lockTypeKey + " context item " + lockKey, e);
+ LOGGER.warn("error releasing read lock on context map " + lockTypeKey + CONTEXT_ITEM + lockKey, e);
throw new ContextException(
- "error releasing read lock on context map " + lockTypeKey + " context item " + lockKey, e);
+ "error releasing read lock on context map " + lockTypeKey + CONTEXT_ITEM + lockKey, e);
}
}
@@ -151,20 +154,12 @@ public abstract class AbstractLockManager implements LockManager {
lock.writeLock().unlock();
LOGGER.exit("unlockForWriting(" + lockTypeKey + "_" + lockKey + ")");
} catch (final Exception e) {
- LOGGER.warn("error releasing write lock on context map " + lockTypeKey + " context item " + lockKey, e);
+ LOGGER.warn("error releasing write lock on context map " + lockTypeKey + CONTEXT_ITEM + lockKey, e);
throw new ContextException(
- "error releasing write lock on context map " + lockTypeKey + " context item " + lockKey, e);
+ "error releasing write lock on context map " + lockTypeKey + CONTEXT_ITEM + lockKey, e);
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.core.context.LockManager#shutdown()
- */
- @Override
- public abstract void shutdown();
-
/**
* Get a reentrant read write lock from whatever locking mechanism is in use.
*
@@ -184,7 +179,7 @@ public abstract class AbstractLockManager implements LockManager {
* @throws ContextException On errors getting the lock
*/
private ReadWriteLock getLock(final String lockTypeKey, final String lockKey, final boolean createMode)
- throws ContextException {
+ throws ContextException {
// Check if we have a lock type map for this lock type yet
if (!lockMaps.containsKey(lockTypeKey)) {
// Create a lock type map for the lock type
@@ -198,11 +193,11 @@ public abstract class AbstractLockManager implements LockManager {
}
// Should we create a lock?
+ String errorMessage = "error getting lock on context map " + lockTypeKey + CONTEXT_ITEM + lockKey;
if (!createMode) {
- LOGGER.warn("error getting lock on context map " + lockTypeKey + " context item " + lockKey
- + ", lock does not exist");
- throw new ContextException("error getting lock on context map " + lockTypeKey + " context item " + lockKey
- + ", lock does not exist");
+ String message = errorMessage + ", lock does not exist";
+ LOGGER.warn(message);
+ throw new ContextException(message);
}
try {
@@ -213,13 +208,12 @@ public abstract class AbstractLockManager implements LockManager {
lockMaps.get(lockTypeKey).put(lockKey, lock);
if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("created lock " + lockTypeKey + "_" + lockKey);
+ LOGGER.trace("created lock {}_{}", lockTypeKey, lockKey);
}
return lock;
} catch (final Exception e) {
- LOGGER.warn("error getting lock on context map " + lockTypeKey + " context item " + lockKey, e);
- throw new ContextException("error getting lock on context map " + lockTypeKey + " context item " + lockKey,
- e);
+ LOGGER.warn(errorMessage, e);
+ throw new ContextException(errorMessage, e);
}
}
}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java
index bb22827cd..f50eb5914 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java
@@ -66,7 +66,7 @@ public abstract class AbstractSchemaHelper implements SchemaHelper {
* org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema)
*/
@Override
- public void init(final AxKey incomingUserKey, final AxContextSchema incomingSchema) throws ContextRuntimeException {
+ public void init(final AxKey incomingUserKey, final AxContextSchema incomingSchema) {
Assertions.argumentOfClassNotNull(incomingUserKey, ContextRuntimeException.class,
"incomingUserKey may not be null");
Assertions.argumentOfClassNotNull(incomingSchema, ContextRuntimeException.class,
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/ContextMonitor.java b/context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/ContextMonitor.java
index e3b335697..c37323759 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/ContextMonitor.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/ContextMonitor.java
@@ -46,7 +46,8 @@ public class ContextMonitor {
*/
public void monitorInit(final AxArtifactKey albumKey, final AxArtifactKey schemaKey, final String name,
final Object value) {
- LOGGER.trace(monitor("INIT", null, albumKey, schemaKey, name, value));
+ String monitorInitString = monitor("INIT", null, albumKey, schemaKey, name, value);
+ LOGGER.trace(monitorInitString);
}
/**
@@ -60,7 +61,8 @@ public class ContextMonitor {
*/
public void monitorInit(final AxArtifactKey albumKey, final AxArtifactKey schemaKey, final String name,
final Object value, final AxConcept[] userArtifactStack) {
- LOGGER.trace(monitor("INIT", userArtifactStack, albumKey, schemaKey, name, value));
+ String monitorInitString = monitor("INIT", userArtifactStack, albumKey, schemaKey, name, value);
+ LOGGER.trace(monitorInitString);
}
/**
@@ -74,7 +76,8 @@ public class ContextMonitor {
*/
public void monitorDelete(final AxArtifactKey albumKey, final AxArtifactKey schemaKey, final String name,
final Object value, final AxConcept[] userArtifactStack) {
- LOGGER.trace(monitor("DEL", userArtifactStack, albumKey, schemaKey, name, value));
+ String monitorDeleteString = monitor("DEL", userArtifactStack, albumKey, schemaKey, name, value);
+ LOGGER.trace(monitorDeleteString);
}
/**
@@ -88,7 +91,8 @@ public class ContextMonitor {
*/
public void monitorGet(final AxArtifactKey albumKey, final AxArtifactKey schemaKey, final String name,
final Object value, final AxConcept[] userArtifactStack) {
- LOGGER.trace(monitor("GET", userArtifactStack, albumKey, schemaKey, name, value));
+ String monitorGetString = monitor("GET", userArtifactStack, albumKey, schemaKey, name, value);
+ LOGGER.trace(monitorGetString);
}
/**
@@ -102,7 +106,8 @@ public class ContextMonitor {
*/
public void monitorSet(final AxArtifactKey albumKey, final AxArtifactKey schemaKey, final String name,
final Object value, final AxConcept[] userArtifactStack) {
- LOGGER.trace(monitor("SET", userArtifactStack, albumKey, schemaKey, name, value));
+ String monitorSetString = monitor("SET", userArtifactStack, albumKey, schemaKey, name, value);
+ LOGGER.trace(monitorSetString);
}
/**
@@ -115,7 +120,8 @@ public class ContextMonitor {
*/
public void monitorReadLock(final AxArtifactKey albumKey, final AxArtifactKey schemaKey, final String name,
final AxConcept[] userArtifactStack) {
- LOGGER.trace(monitor("READLOCK", userArtifactStack, albumKey, schemaKey, name, null));
+ String monitorReadLockString = monitor("READLOCK", userArtifactStack, albumKey, schemaKey, name, null);
+ LOGGER.trace(monitorReadLockString);
}
/**
@@ -128,7 +134,8 @@ public class ContextMonitor {
*/
public void monitorWriteLock(final AxArtifactKey albumKey, final AxArtifactKey schemaKey, final String name,
final AxConcept[] userArtifactStack) {
- LOGGER.trace(monitor("WRITELOCK", userArtifactStack, albumKey, schemaKey, name, null));
+ String writeLockMonitorString = monitor("WRITELOCK", userArtifactStack, albumKey, schemaKey, name, null);
+ LOGGER.trace(writeLockMonitorString);
}
/**
@@ -141,7 +148,8 @@ public class ContextMonitor {
*/
public void monitorReadUnlock(final AxArtifactKey albumKey, final AxArtifactKey schemaKey, final String name,
final AxConcept[] userArtifactStack) {
- LOGGER.trace(monitor("READUNLOCK", userArtifactStack, albumKey, schemaKey, name, null));
+ String monitorReadUnlockString = monitor("READUNLOCK", userArtifactStack, albumKey, schemaKey, name, null);
+ LOGGER.trace(monitorReadUnlockString);
}
/**
@@ -154,7 +162,8 @@ public class ContextMonitor {
*/
public void monitorWriteUnlock(final AxArtifactKey albumKey, final AxArtifactKey schemaKey, final String name,
final AxConcept[] userArtifactStack) {
- LOGGER.trace(monitor("WRITEUNLOCK", userArtifactStack, albumKey, schemaKey, name, null));
+ String monitorWriteUnlockString = monitor("WRITEUNLOCK", userArtifactStack, albumKey, schemaKey, name, null);
+ LOGGER.trace(monitorWriteUnlockString);
}
/**
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java
index 084220c2f..75c615898 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java
@@ -150,7 +150,7 @@ public class ContextInstantiation {
assertDouble(contextItem.getTestPolicyContextItem002().getDoubleValue(), PI_VAL);
assertTrue(contextItem.getTestPolicyContextItem003().getFlag());
assertEquals(contextItem.getTestPolicyContextItem004().getLongValue(), testDate.getTime());
- assertEquals(contextItem.getTestPolicyContextItem005().getMapValue(), TEST_HASH_MAP);
+ assertEquals(TEST_HASH_MAP, contextItem.getTestPolicyContextItem005().getMapValue());
final TestGlobalContextItem globalContext =
getTestGlobalContextItem(contextDistributor, testDate, tci9, tciA);
diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java
index 9aad0ad78..290f22794 100644
--- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java
+++ b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java
@@ -99,7 +99,7 @@ public class TestPersistentContextInstantiation {
ParameterService.register(contextParameters.getDistributorParameters());
ParameterService.register(contextParameters.getLockManagerParameters());
ParameterService.register(contextParameters.getPersistorParameters());
-
+
schemaParameters = new SchemaParameters();
schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
@@ -126,8 +126,9 @@ public class TestPersistentContextInstantiation {
final AxArtifactKey distributorKey = new AxArtifactKey("AbstractDistributor", "0.0.1");
final Distributor contextDistributor = new DistributorFactory().getDistributor(distributorKey);
- final AxArtifactKey[] usedArtifactStackArray = {new AxArtifactKey("testC-top", "0.0.1"),
- new AxArtifactKey("testC-next", "0.0.1"), new AxArtifactKey("testC-bot", "0.0.1")};
+ final AxArtifactKey[] usedArtifactStackArray =
+ { new AxArtifactKey("testC-top", "0.0.1"), new AxArtifactKey("testC-next", "0.0.1"),
+ new AxArtifactKey("testC-bot", "0.0.1") };
final DaoParameters DaoParameters = new DaoParameters();
DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao");
@@ -138,8 +139,8 @@ public class TestPersistentContextInstantiation {
final AxContextModel someContextModel = TestContextAlbumFactory.createMultiAlbumsContextModel();
// Context for Storing Map values
- final AxContextAlbum axContextAlbumForMap =
- someContextModel.getAlbums().getAlbumsMap().get(new AxArtifactKey("MapContextAlbum", "0.0.1"));
+ final AxContextAlbum axContextAlbumForMap = someContextModel.getAlbums().getAlbumsMap()
+ .get(new AxArtifactKey("MapContextAlbum", "0.0.1"));
apexDao.create(axContextAlbumForMap);
contextDistributor.registerModel(someContextModel);
final ContextAlbum contextAlbumForMap = contextDistributor.createContextAlbum(axContextAlbumForMap.getKey());
@@ -154,15 +155,15 @@ public class TestPersistentContextInstantiation {
contextAlbumForMap.putAll(valueMap0);
- assertEquals(
- ((TestContextTreeMapItem) contextAlbumForMap.get("TestPolicyContextItem000")).getMapValue().get("key"),
- "This is a policy context string");
+ assertEquals("This is a policy context string",
+ ((TestContextTreeMapItem) contextAlbumForMap.get("TestPolicyContextItem000")).getMapValue()
+ .get("key"));
contextAlbumForMap.flush();
// Context for Storing Date values
- final AxContextAlbum axContextAlbumForDate =
- someContextModel.getAlbums().getAlbumsMap().get(new AxArtifactKey("DateContextAlbum", "0.0.1"));
+ final AxContextAlbum axContextAlbumForDate = someContextModel.getAlbums().getAlbumsMap()
+ .get(new AxArtifactKey("DateContextAlbum", "0.0.1"));
apexDao.create(axContextAlbumForDate);
contextDistributor.registerModel(someContextModel);
final ContextAlbum contextAlbumForDate = contextDistributor.createContextAlbum(axContextAlbumForDate.getKey());
@@ -180,15 +181,15 @@ public class TestPersistentContextInstantiation {
contextAlbumForDate.putAll(valueMap1);
- assertEquals(((TestContextDateLocaleItem) contextAlbumForDate.get("TestPolicyContextItem00A")).getDateValue(),
- testDate);
- assertEquals(((TestContextDateLocaleItem) contextAlbumForDate.get("TestPolicyContextItem00A")).getDst(), true);
+ assertEquals(testDate, ((TestContextDateLocaleItem) contextAlbumForDate.get("TestPolicyContextItem00A"))
+ .getDateValue());
+ assertEquals(true, ((TestContextDateLocaleItem) contextAlbumForDate.get("TestPolicyContextItem00A")).getDst());
contextAlbumForDate.flush();
// Context for Storing Long values
- final AxContextAlbum axContextAlbumForLong =
- someContextModel.getAlbums().getAlbumsMap().get(new AxArtifactKey("LTypeContextAlbum", "0.0.1"));
+ final AxContextAlbum axContextAlbumForLong = someContextModel.getAlbums().getAlbumsMap()
+ .get(new AxArtifactKey("LTypeContextAlbum", "0.0.1"));
apexDao.create(axContextAlbumForLong);
contextDistributor.registerModel(someContextModel);
final ContextAlbum contextAlbumForLong = contextDistributor.createContextAlbum(axContextAlbumForLong.getKey());
@@ -204,16 +205,16 @@ public class TestPersistentContextInstantiation {
contextAlbumForLong.putAll(valueMap2);
- assertEquals(((TestContextLongItem) contextAlbumForLong.get("TestPolicyContextItem0031")).getLongValue(),
- 0xFFFFFFFFFFFFFFFFL);
- assertEquals(((TestContextLongItem) contextAlbumForLong.get("TestPolicyContextItem0032")).getLongValue(),
- 0xFFFFFFFFFFFFFFFEL);
- assertEquals(((TestContextLongItem) contextAlbumForLong.get("TestPolicyContextItem0033")).getLongValue(),
- 0xFFFFFFFFFFFFFFFDL);
- assertEquals(((TestContextLongItem) contextAlbumForLong.get("TestPolicyContextItem0034")).getLongValue(),
- 0xFFFFFFFFFFFFFFFCL);
- assertEquals(((TestContextLongItem) contextAlbumForLong.get("TestPolicyContextItem0035")).getLongValue(),
- 0xFFFFFFFFFFFFFFFBL);
+ assertEquals(0xFFFFFFFFFFFFFFFFL,
+ ((TestContextLongItem) contextAlbumForLong.get("TestPolicyContextItem0031")).getLongValue());
+ assertEquals(0xFFFFFFFFFFFFFFFEL,
+ ((TestContextLongItem) contextAlbumForLong.get("TestPolicyContextItem0032")).getLongValue());
+ assertEquals(0xFFFFFFFFFFFFFFFDL,
+ ((TestContextLongItem) contextAlbumForLong.get("TestPolicyContextItem0033")).getLongValue());
+ assertEquals(0xFFFFFFFFFFFFFFFCL,
+ ((TestContextLongItem) contextAlbumForLong.get("TestPolicyContextItem0034")).getLongValue());
+ assertEquals(0xFFFFFFFFFFFFFFFBL,
+ ((TestContextLongItem) contextAlbumForLong.get("TestPolicyContextItem0035")).getLongValue());
contextAlbumForLong.flush();
contextDistributor.clear();
diff --git a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java
index 499644fd9..8bfb15025 100644
--- a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java
+++ b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java
@@ -33,8 +33,8 @@ import org.slf4j.ext.XLoggerFactory;
* The Class {@link BatchDeployer} deploys an Apex model held as an XML or Json file onto an Apex engine. It uses the
* EngDep protocol to communicate with the engine, with the EngDep protocol being carried on Java web sockets.
*
- * This deployer is a simple command line deployer that reads the communication parameters and the location of the Apex
- * model file as arguments.
+ * <p>This deployer is a simple command line deployer that reads the communication parameters and the location of the
+ * Apex model file as arguments.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@@ -55,8 +55,9 @@ public class BatchDeployer {
*/
public static void main(final String[] args) {
if (args.length != NUM_ARGUMENTS) {
- LOGGER.error("invalid arguments: " + Arrays.toString(args));
- LOGGER.error("usage: Deployer <server address> <port address> <Apex Model file location>");
+ String message = "invalid arguments: " + Arrays.toString(args)
+ + "usage: Deployer <server address> <port address> <Apex Model file location>";
+ LOGGER.error(message);
return;
}
@@ -112,7 +113,7 @@ public class BatchDeployer {
* @throws IOException on IO exceptions from the operating system
*/
public void deployModel(final String modelFileName, final boolean ignoreConflicts, final boolean force)
- throws ApexException, IOException {
+ throws ApexException, IOException {
engineServiceFacade.deployModel(modelFileName, ignoreConflicts, force);
}
@@ -126,7 +127,7 @@ public class BatchDeployer {
* @throws IOException on IO exceptions from the operating system
*/
public void deployModel(final AxPolicyModel policyModel, final boolean ignoreConflicts, final boolean force)
- throws ApexException, IOException {
+ throws ApexException, IOException {
engineServiceFacade.deployModel(policyModel, ignoreConflicts, force);
}
diff --git a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/DeploymentClient.java b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/DeploymentClient.java
index 5fc7dc8c6..d0af94930 100644
--- a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/DeploymentClient.java
+++ b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/DeploymentClient.java
@@ -20,6 +20,8 @@
package org.onap.policy.apex.core.deployment;
+import com.google.common.eventbus.Subscribe;
+
import java.net.URI;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
@@ -35,8 +37,6 @@ import org.onap.policy.apex.core.protocols.Message;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
-import com.google.common.eventbus.Subscribe;
-
/**
* The Class DeploymentClient handles the client side of an EngDep communication session with an
* Apex server. It runs a thread to handle message sending and session monitoring. It uses a sending
@@ -84,7 +84,7 @@ public class DeploymentClient implements Runnable {
*/
@Override
public void run() {
- LOGGER.debug("engine<-->deployment to \"ws://" + host + ":" + port + "\" thread starting . . .");
+ LOGGER.debug("engine<-->deployment to \"ws://{}:{}\" thread starting . . .", host, port);
// Set up the thread name
thisThread = Thread.currentThread();
@@ -104,7 +104,7 @@ public class DeploymentClient implements Runnable {
return;
}
// Loop forever, sending messages as they appear on the queue
- while (true) {
+ while (started) {
try {
final Message messageForSending = sendQueue.take();
sendMessage(messageForSending);
@@ -143,9 +143,7 @@ public class DeploymentClient implements Runnable {
thisThread.interrupt();
// Wait for the thread to stop
- while (thisThread != null && thisThread.isAlive()) {
- ThreadUtilities.sleep(CLIENT_STOP_WAIT_INTERVAL);
- }
+ ThreadUtilities.sleep(CLIENT_STOP_WAIT_INTERVAL);
// Close the Web Services connection
service.stopConnection();
diff --git a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/EngineServiceFacade.java b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/EngineServiceFacade.java
index f0616e20a..9b24bcd96 100644
--- a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/EngineServiceFacade.java
+++ b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/EngineServiceFacade.java
@@ -50,12 +50,11 @@ import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
/**
- * The Class Deployer deploys an Apex model held as an XML file onto an Apex engine. It uses the
- * EngDep protocol to communicate with the engine, with the EngDep protocol being carried on Java
- * web sockets.
+ * The Class Deployer deploys an Apex model held as an XML file onto an Apex engine. It uses the EngDep protocol to
+ * communicate with the engine, with the EngDep protocol being carried on Java web sockets.
*
- * This deployer is a simple command line deployer that reads the communication parameters and the
- * location of the XML model file as arguments.
+ * <p>his deployer is a simple command line deployer that reads the communication parameters and the location of the XML
+ * model file as arguments.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@@ -63,6 +62,10 @@ public class EngineServiceFacade {
// Get a reference to the logger
private static final XLogger LOGGER = XLoggerFactory.getXLogger(EngineServiceFacade.class);
+ // Repeated string constants
+ private static final String RECEIVED_FROM_SERVER = " received from server";
+ private static final String FAILED_RESPONSE = "failed response ";
+
// The default message timeout and timeout increment (the amount of time between polls) in
// milliseconds
private static final int CLIENT_START_WAIT_INTERVAL = 100;
@@ -125,12 +128,12 @@ public class EngineServiceFacade {
// Get engine service information to see what engines we're dealing with
final GetEngineServiceInfo engineServiceInfo = new GetEngineServiceInfo(null);
LOGGER.debug("sending get engine service info message {} to server {}:{} . . .", engineServiceInfo,
- hostName, port);
+ hostName, port);
client.sendMessage(engineServiceInfo);
LOGGER.debug("sent get engine service info message to server {}:{} . . .", hostName, port);
- final EngineServiceInfoResponse engineServiceInfoResponse =
- (EngineServiceInfoResponse) getResponse(engineServiceInfo);
+ final EngineServiceInfoResponse engineServiceInfoResponse = (EngineServiceInfoResponse) getResponse(
+ engineServiceInfo);
if (engineServiceInfoResponse.isSuccessful()) {
engineServiceKey = engineServiceInfoResponse.getEngineServiceKey();
engineKeyArray = engineServiceInfoResponse.getEngineKeyArray();
@@ -187,30 +190,29 @@ public class EngineServiceFacade {
*
* @param modelFileName the name of the model file containing the model to deploy
* @param ignoreConflicts true if conflicts between context in polices is to be ignored
- * @param force true if the model is to be applied even if it is incompatible with the existing
- * model
+ * @param force true if the model is to be applied even if it is incompatible with the existing model
* @throws ApexException on Apex errors
* @throws IOException on IO exceptions from the operating system
*/
public void deployModel(final String modelFileName, final boolean ignoreConflicts, final boolean force)
- throws ApexException, IOException {
+ throws ApexException, IOException {
if (engineServiceKey == null || engineKeyArray == null || engineKeyArray.length == 0) {
LOGGER.error("cound not deploy apex model, deployer is not initialized");
throw new ApexDeploymentException("cound not deploy apex model, deployer is not initialized");
}
// Get the model file as a string
- URL apexModelURL = ResourceUtils.getLocalFile(modelFileName);
- if (apexModelURL == null) {
- apexModelURL = ResourceUtils.getUrlResource(modelFileName);
- if (apexModelURL == null) {
+ URL apexModelUrl = ResourceUtils.getLocalFile(modelFileName);
+ if (apexModelUrl == null) {
+ apexModelUrl = ResourceUtils.getUrlResource(modelFileName);
+ if (apexModelUrl == null) {
LOGGER.error("cound not create apex model, could not read from XML file {}", modelFileName);
throw new ApexDeploymentException(
- "cound not create apex model, could not read XML file " + modelFileName);
+ "cound not create apex model, could not read XML file " + modelFileName);
}
}
- deployModel(modelFileName, apexModelURL.openStream(), ignoreConflicts, force);
+ deployModel(modelFileName, apexModelUrl.openStream(), ignoreConflicts, force);
}
/**
@@ -219,12 +221,11 @@ public class EngineServiceFacade {
* @param modelFileName the name of the model file containing the model to deploy
* @param modelInputStream the stream that holds the Apex model
* @param ignoreConflicts true if conflicts between context in polices is to be ignored
- * @param force true if the model is to be applied even if it is incompatible with the existing
- * model
+ * @param force true if the model is to be applied even if it is incompatible with the existing model
* @throws ApexException on model deployment errors
*/
public void deployModel(final String modelFileName, final InputStream modelInputStream,
- final boolean ignoreConflicts, final boolean force) throws ApexException {
+ final boolean ignoreConflicts, final boolean force) throws ApexException {
// Read the policy model from the stream
final ApexModelReader<AxPolicyModel> modelReader = new ApexModelReader<>(AxPolicyModel.class);
modelReader.setValidateFlag(!ignoreConflicts);
@@ -243,20 +244,19 @@ public class EngineServiceFacade {
*
* @param apexPolicyModel the name of the model to deploy
* @param ignoreConflicts true if conflicts between context in polices is to be ignored
- * @param force true if the model is to be applied even if it is incompatible with the existing
- * model
+ * @param force true if the model is to be applied even if it is incompatible with the existing model
* @throws ApexException on model deployment errors
*/
public void deployModel(final AxPolicyModel apexPolicyModel, final boolean ignoreConflicts, final boolean force)
- throws ApexException {
+ throws ApexException {
// Write the model into a byte array
final ByteArrayOutputStream baOutputStream = new ByteArrayOutputStream();
final ApexModelWriter<AxPolicyModel> modelWriter = new ApexModelWriter<>(AxPolicyModel.class);
modelWriter.write(apexPolicyModel, baOutputStream);
// Create and send Update message
- final UpdateModel umMessage =
- new UpdateModel(engineServiceKey, baOutputStream.toString(), ignoreConflicts, force);
+ final UpdateModel umMessage = new UpdateModel(engineServiceKey, baOutputStream.toString(), ignoreConflicts,
+ force);
LOGGER.debug("sending update message {} to server {}:{} . . .", umMessage, hostName, port);
client.sendMessage(umMessage);
@@ -264,12 +264,10 @@ public class EngineServiceFacade {
// Check if we got a response
final Response response = getResponse(umMessage);
- if (response.isSuccessful()) {
- LOGGER.debug(response.toString());
- } else {
- LOGGER.warn("failed response {} received from server {}:{}", response.getMessageData(), hostName, port);
- throw new ApexException(
- "failed response " + response.getMessageData() + " received from server" + hostName + ':' + port);
+ if (!response.isSuccessful()) {
+ LOGGER.warn(FAILED_RESPONSE + "{} received from server {}:{}", response.getMessageData(), hostName, port);
+ throw new ApexException(FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER + hostName
+ + ':' + port);
}
}
@@ -287,12 +285,11 @@ public class EngineServiceFacade {
// Check if we got a response
final Response response = getResponse(startEngineMessage);
- if (response.isSuccessful()) {
- LOGGER.debug(response.toString());
- } else {
- LOGGER.warn("failed response {} received from server {}:{}", response.getMessageData(), hostName, port);
- throw new ApexDeploymentException(
- "failed response " + response.getMessageData() + " received from server" + hostName + ':' + port);
+ if (!response.isSuccessful()) {
+ String message = FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER
+ + hostName + ':' + port;
+ LOGGER.warn(message);
+ throw new ApexDeploymentException(message);
}
}
@@ -310,12 +307,11 @@ public class EngineServiceFacade {
// Check if we got a response
final Response response = getResponse(stopEngineMessage);
- if (response.isSuccessful()) {
- LOGGER.debug(response.toString());
- } else {
- LOGGER.warn("failed response {} received from server {}:{}", response.getMessageData(), hostName, port);
- throw new ApexDeploymentException(
- "failed response " + response.getMessageData() + " received from server" + hostName + ':' + port);
+ if (!response.isSuccessful()) {
+ String message = FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER
+ + hostName + ':' + port;
+ LOGGER.warn(message);
+ throw new ApexDeploymentException(message);
}
}
@@ -330,18 +326,17 @@ public class EngineServiceFacade {
final StartPeriodicEvents startPerioidicEventsMessage = new StartPeriodicEvents(engineKey);
startPerioidicEventsMessage.setMessageData(Long.toString(period));
LOGGER.debug("sending start perioidic events {} to server {}:{} . . .", startPerioidicEventsMessage, hostName,
- port);
+ port);
client.sendMessage(startPerioidicEventsMessage);
LOGGER.debug("sent start perioidic events message to server {}:{} . . .", hostName, port);
// Check if we got a response
final Response response = getResponse(startPerioidicEventsMessage);
- if (response.isSuccessful()) {
- LOGGER.debug(response.toString());
- } else {
- LOGGER.warn("failed response {} received from server {}:{}", response.getMessageData(), hostName, port);
- throw new ApexDeploymentException(
- "failed response " + response.getMessageData() + " received from server" + hostName + ':' + port);
+ if (!response.isSuccessful()) {
+ String message = FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER
+ + hostName + ':' + port;
+ LOGGER.warn(message);
+ throw new ApexDeploymentException(message);
}
}
@@ -354,18 +349,17 @@ public class EngineServiceFacade {
public void stopPerioidicEvents(final AxArtifactKey engineKey) throws ApexDeploymentException {
final StopPeriodicEvents stopPerioidicEventsMessage = new StopPeriodicEvents(engineKey);
LOGGER.debug("sending stop perioidic events {} to server {}:{} . . .", stopPerioidicEventsMessage, hostName,
- port);
+ port);
client.sendMessage(stopPerioidicEventsMessage);
LOGGER.debug("sent stop perioidic events message to server {}:{} . . .", hostName, port);
// Check if we got a response
final Response response = getResponse(stopPerioidicEventsMessage);
- if (response.isSuccessful()) {
- LOGGER.debug(response.toString());
- } else {
- LOGGER.warn("failed response {} received from server {}:{}", response.getMessageData(), hostName, port);
- throw new ApexDeploymentException(
- "failed response " + response.getMessageData() + " received from server" + hostName + ':' + port);
+ if (!response.isSuccessful()) {
+ String message = FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER
+ + hostName + ':' + port;
+ LOGGER.warn(message);
+ throw new ApexDeploymentException(message);
}
}
@@ -385,9 +379,10 @@ public class EngineServiceFacade {
// Check if we got a response
final Response response = getResponse(engineStatusMessage);
if (!response.isSuccessful()) {
- LOGGER.warn("failed response {} received from server {}:{}", response.getMessageData(), hostName, port);
- throw new ApexException(
- "failed response " + response.getMessageData() + " received from server" + hostName + ':' + port);
+ String message = FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER + hostName
+ + ':' + port;
+ LOGGER.warn(message);
+ throw new ApexException(message);
}
final ByteArrayInputStream baInputStream = new ByteArrayInputStream(response.getMessageData().getBytes());
@@ -406,16 +401,17 @@ public class EngineServiceFacade {
public String getEngineInfo(final AxArtifactKey engineKey) throws ApexException {
final GetEngineInfo engineInfoMessage = new GetEngineInfo(engineKey);
LOGGER.debug("sending get engine information message {} to server {}:{} . . .", engineInfoMessage, hostName,
- port);
+ port);
client.sendMessage(engineInfoMessage);
LOGGER.debug("sent get engine information message to server {}:{} . . .", hostName, port);
// Check if we got a response
final Response response = getResponse(engineInfoMessage);
if (!response.isSuccessful()) {
- LOGGER.warn("failed response {} received from server {}:{}", response.getMessageData(), hostName, port);
- throw new ApexException(
- "failed response " + response.getMessageData() + " received from server" + hostName + ':' + port);
+ String message = FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER + hostName
+ + ':' + port;
+ LOGGER.warn(message);
+ throw new ApexException(message);
}
return response.getMessageData();
@@ -437,8 +433,8 @@ public class EngineServiceFacade {
// Wait for the required amount of milliseconds for the response from the Apex server
Message receivedMessage = null;
- for (int timeWaitedSoFar = 0; receivedMessage == null && timeWaitedSoFar < timeoutTime; timeWaitedSoFar +=
- REPLY_MESSAGE_TIMEOUT_INCREMENT) {
+ for (int timeWaitedSoFar = 0; receivedMessage == null
+ && timeWaitedSoFar < timeoutTime; timeWaitedSoFar += REPLY_MESSAGE_TIMEOUT_INCREMENT) {
try {
receivedMessage = client.getReceiveQueue().poll(REPLY_MESSAGE_TIMEOUT_INCREMENT, TimeUnit.MILLISECONDS);
} catch (final InterruptedException e) {
@@ -446,7 +442,7 @@ public class EngineServiceFacade {
Thread.currentThread().interrupt();
LOGGER.warn("reception of response from server interrupted {}:{}", hostName, port, e);
throw new ApexDeploymentException(
- "reception of response from server interrupted " + hostName + ':' + port, e);
+ "reception of response from server interrupted " + hostName + ':' + port, e);
}
}
@@ -459,9 +455,9 @@ public class EngineServiceFacade {
// Check instance is a response message
if (!(receivedMessage instanceof Response)) {
LOGGER.warn("response received from server is of incorrect type {}, should be of type {}",
- receivedMessage.getClass().getName(), Response.class.getName());
+ receivedMessage.getClass().getName(), Response.class.getName());
throw new ApexDeploymentException("response received from server is of incorrect type "
- + receivedMessage.getClass().getName() + ", should be of type " + Response.class.getName());
+ + receivedMessage.getClass().getName() + ", should be of type " + Response.class.getName());
}
// Cast the response message
@@ -471,16 +467,16 @@ public class EngineServiceFacade {
if (!responseMessage.getResponseTo().equals(sentMessage)) {
LOGGER.warn("response received is not response to sent message " + sentMessage.getAction());
throw new ApexDeploymentException(
- "response received is not correct response to sent message " + sentMessage.getAction());
+ "response received is not correct response to sent message " + sentMessage.getAction());
}
// Check if successful
if (responseMessage.isSuccessful()) {
LOGGER.debug("response received: {} message was succssful: {}", sentMessage.getAction(),
- responseMessage.getMessageData());
+ responseMessage.getMessageData());
} else {
LOGGER.debug("response received: {} message failed: {}", sentMessage.getAction(),
- responseMessage.getMessageData());
+ responseMessage.getMessageData());
}
return responseMessage;
diff --git a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/PeriodicEventManager.java b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/PeriodicEventManager.java
index bfaece4c6..a1db5ef07 100644
--- a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/PeriodicEventManager.java
+++ b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/PeriodicEventManager.java
@@ -48,8 +48,9 @@ public class PeriodicEventManager {
*/
public static void main(final String[] args) {
if (args.length != NUM_ARGUMENTS) {
- LOGGER.error("invalid arguments: " + Arrays.toString(args));
- LOGGER.error("usage: Deployer <server address> <port address> <start/stop> <periods in ms>");
+ String message = "invalid arguments: " + Arrays.toString(args)
+ + "\nusage: Deployer <server address> <port address> <start/stop> <periods in ms>";
+ LOGGER.error(message);
return;
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java
index 1678f57c7..96a83f3a6 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java
@@ -28,7 +28,7 @@ public abstract class EngineParameterConstants {
public static final String EXECUTOR_GROUP_NAME = "EXECUTOR_PARAMETERS";
/**
- * Private default constructor to prevent subclassing
+ * Private default constructor to prevent subclassing.
*/
private EngineParameterConstants() {
// Prevents subclassing
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java
index 85e45f718..8bbb333b5 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java
@@ -63,7 +63,7 @@ public final class ApexInternalContext implements AxConceptGetter<ContextAlbum>
private Distributor contextDistributor = null;
// The key of the current policy, used to return the correct policy context album to the user
- private final AxArtifactKey currentPolicyKey = null;
+ private AxArtifactKey currentPolicyKey = null;
/**
* Constructor, instantiate the context object from the Apex model.
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/ApexEngine.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/ApexEngine.java
index b25192cd0..b2978a0c0 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/ApexEngine.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/ApexEngine.java
@@ -46,7 +46,7 @@ public interface ApexEngine {
* The amount of milliseconds to wait for the current Apex engine to timeout on engine stop
* requests. If the timeout is exceeded, the stop aborts.
*/
- int APEX_ENGINE_STOP_EXECUTION_WAIT_TIMEOUT = 3000;
+ int STOP_EXECUTION_WAIT_TIMEOUT = 3000;
/** The wait increment (or pause time) when waiting for the Apex engine to stop. */
int APEX_ENGINE_STOP_EXECUTION_WAIT_INCREMENT = 100;
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java
index 3497ed660..6f2bab0b9 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java
@@ -56,6 +56,11 @@ public class ApexEngineImpl implements ApexEngine {
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(ApexEngineImpl.class);
+ // Recurring string constants
+ private static final String UPDATE_MODEL = "updateModel()<-";
+ private static final String START = "start()<-";
+ private static final String STOP = "stop()<-";
+
// The artifact key of this engine
private final AxArtifactKey key;
@@ -63,7 +68,7 @@ public class ApexEngineImpl implements ApexEngine {
private AxEngineState state = AxEngineState.STOPPED;
// call back listeners
- private final Map<String, EnEventListener> eventListeners = new LinkedHashMap<String, EnEventListener>();
+ private final Map<String, EnEventListener> eventListeners = new LinkedHashMap<>();
// The context of this engine
private ApexInternalContext internalContext = null;
@@ -105,15 +110,14 @@ public class ApexEngineImpl implements ApexEngine {
if (apexModel != null) {
LOGGER.entry("updateModel()->" + key.getId() + ", apexPolicyModel=" + apexModel.getKey().getId());
} else {
- LOGGER.warn("updateModel()<-" + key.getId() + ", Apex model not set");
- throw new ApexException(
- "updateModel()<-" + key.getId() + ", Apex model is not defined, it has a null value");
+ LOGGER.warn(UPDATE_MODEL + key.getId() + ", Apex model not set");
+ throw new ApexException(UPDATE_MODEL + key.getId() + ", Apex model is not defined, it has a null value");
}
// The engine must be stopped in order to do a model update
if (!state.equals(AxEngineState.STOPPED)) {
- throw new ApexException("updateModel()<-" + key.getId()
- + ", cannot update model, engine should be stopped but is in state " + state);
+ throw new ApexException(UPDATE_MODEL + key.getId()
+ + ", cannot update model, engine should be stopped but is in state " + state);
}
// Create new internal context or update the existing one
@@ -126,12 +130,10 @@ public class ApexEngineImpl implements ApexEngine {
internalContext.update(apexModel);
}
} catch (final ContextException e) {
- LOGGER.warn(
- "updateModel()<-" + key.getId() + ", error setting the context for engine \"" + key.getId() + "\"",
- e);
- throw new ApexException(
- "updateModel()<-" + key.getId() + ", error setting the context for engine \"" + key.getId() + "\"",
- e);
+ LOGGER.warn(UPDATE_MODEL + key.getId() + ", error setting the context for engine \"" + key.getId() + "\"",
+ e);
+ throw new ApexException(UPDATE_MODEL + key.getId() + ", error setting the context for engine \""
+ + key.getId() + "\"", e);
}
// Set up the state machines
@@ -140,13 +142,13 @@ public class ApexEngineImpl implements ApexEngine {
// always set up as new
stateMachineHandler = new StateMachineHandler(internalContext);
} catch (final StateMachineException e) {
- LOGGER.warn("updateModel()<-" + key.getId() + ", error setting up the engine state machines \""
- + key.getId() + "\"", e);
- throw new ApexException("updateModel()<-" + key.getId() + ", error setting up the engine state machines \""
- + key.getId() + "\"", e);
+ LOGGER.warn(UPDATE_MODEL + key.getId() + ", error setting up the engine state machines \"" + key.getId()
+ + "\"", e);
+ throw new ApexException(UPDATE_MODEL + key.getId() + ", error setting up the engine state machines \""
+ + key.getId() + "\"", e);
}
- LOGGER.exit("updateModel()<-" + key.getId());
+ LOGGER.exit(UPDATE_MODEL + key.getId());
}
/*
@@ -159,16 +161,18 @@ public class ApexEngineImpl implements ApexEngine {
LOGGER.entry("start()" + key);
if (state != AxEngineState.STOPPED) {
- LOGGER.warn("start()<-" + key.getId() + "," + state + ", cannot start engine, engine not in state STOPPED");
- throw new ApexException(
- "start()<-" + key.getId() + "," + state + ", cannot start engine, engine not in state STOPPED");
+ String message = START + key.getId() + "," + state
+ + ", cannot start engine, engine not in state STOPPED";
+ LOGGER.warn(message);
+ throw new ApexException(message);
}
if (stateMachineHandler == null || internalContext == null) {
- LOGGER.warn("start()<-" + key.getId() + "," + state
- + ", cannot start engine, engine has not been initialized, its model is not loaded");
- throw new ApexException("start()<-" + key.getId() + "," + state
- + ", cannot start engine, engine has not been initialized, its model is not loaded");
+ String message = START + key.getId() + "," + state
+ + ", cannot start engine, engine has not been initialized, its model is not loaded";
+ LOGGER.warn(message);
+ throw new ApexException(START + key.getId() + "," + state
+ + ", cannot start engine, engine has not been initialized, its model is not loaded");
}
// Set up the state machines
@@ -177,10 +181,10 @@ public class ApexEngineImpl implements ApexEngine {
stateMachineHandler.start();
engineStats.engineStart();
} catch (final StateMachineException e) {
- LOGGER.warn("updateModel()<-" + key.getId() + ", error starting the engine state machines \"" + key.getId()
- + "\"", e);
- throw new ApexException("updateModel()<-" + key.getId() + ", error starting the engine state machines \""
- + key.getId() + "\"", e);
+ String message = UPDATE_MODEL + key.getId() + ", error starting the engine state machines \"" + key.getId()
+ + "\"";
+ LOGGER.warn(message, e);
+ throw new ApexException(message, e);
}
// OK, we are good to go
@@ -199,15 +203,14 @@ public class ApexEngineImpl implements ApexEngine {
LOGGER.entry("stop()->" + key);
// Stop the engine if it is in state READY, if it is in state EXECUTING, wait for execution to finish
- for (int increment = APEX_ENGINE_STOP_EXECUTION_WAIT_TIMEOUT; increment > 0; increment =
- APEX_ENGINE_STOP_EXECUTION_WAIT_INCREMENT) {
+ for (int increment = STOP_EXECUTION_WAIT_TIMEOUT; increment > 0; increment = STOP_EXECUTION_WAIT_TIMEOUT) {
synchronized (state) {
switch (state) {
// Already stopped
case STOPPED:
- throw new ApexException("stop()<-" + key.getId() + "," + state
- + ", cannot stop engine, engine is already stopped");
+ throw new ApexException(STOP + key.getId() + "," + state
+ + ", cannot stop engine, engine is already stopped");
// The normal case, the engine wasn't doing anything or it was executing
case READY:
case STOPPING:
@@ -222,13 +225,13 @@ public class ApexEngineImpl implements ApexEngine {
state = AxEngineState.STOPPING;
break;
default:
- throw new ApexException("stop()<-" + key.getId() + "," + state
- + ", cannot stop engine, engine is in an undefined state");
+ throw new ApexException(STOP + key.getId() + "," + state
+ + ", cannot stop engine, engine is in an undefined state");
}
}
}
- throw new ApexException("stop()<-" + key.getId() + "," + state + ", cannot stop engine, engine stop timed out");
+ throw new ApexException(STOP + key.getId() + "," + state + ", cannot stop engine, engine stop timed out");
}
/*
@@ -240,8 +243,8 @@ public class ApexEngineImpl implements ApexEngine {
public void clear() throws ApexException {
LOGGER.entry("clear()->" + key);
if (state != AxEngineState.STOPPED) {
- throw new ApexException(
- "clear" + "()<-" + key.getId() + "," + state + ", cannot clear engine, engine is not stopped");
+ throw new ApexException("clear" + "()<-" + key.getId() + "," + state
+ + ", cannot clear engine, engine is not stopped");
}
// Clear everything
@@ -263,8 +266,7 @@ public class ApexEngineImpl implements ApexEngine {
@Override
public EnEvent createEvent(final AxArtifactKey eventKey) {
if (state != AxEngineState.READY && state != AxEngineState.EXECUTING) {
- LOGGER.warn(
- "createEvent()<-" + key.getId() + "," + state + ", cannot create event, engine not in state READY");
+ LOGGER.warn("createEvent()<-{},{}, cannot create event, engine not in state READY", key.getId(), state);
return null;
}
@@ -287,21 +289,21 @@ public class ApexEngineImpl implements ApexEngine {
public boolean handleEvent(final EnEvent incomingEvent) {
boolean ret = false;
if (incomingEvent == null) {
- LOGGER.warn("handleEvent()<-" + key.getId() + "," + state + ", cannot run engine, incoming event is null");
+ LOGGER.warn("handleEvent()<-{},{}, cannot run engine, incoming event is null", key.getId(), state);
return ret;
}
synchronized (state) {
if (state != AxEngineState.READY) {
- LOGGER.warn("handleEvent()<-" + key.getId() + "," + state
- + ", cannot run engine, engine not in state READY");
+ LOGGER.warn("handleEvent()<-{},{}, cannot run engine, engine not in state READY", key.getId(), state);
return ret;
}
state = AxEngineState.EXECUTING;
}
- LOGGER.debug("execute(): triggered by event " + incomingEvent.toString());
+ String message = "execute(): triggered by event " + incomingEvent.toString();
+ LOGGER.debug(message);
// By default we return a null event on errors
EnEvent outgoingEvent = null;
@@ -311,7 +313,7 @@ public class ApexEngineImpl implements ApexEngine {
engineStats.executionExit();
ret = true;
} catch (final StateMachineException e) {
- LOGGER.warn("handleEvent()<-" + key.getId() + "," + state + ", engine execution error: ", e);
+ LOGGER.warn("handleEvent()<-{},{}, engine execution error: ", key.getId(), state, e);
// Create an exception return event
outgoingEvent = createExceptionEvent(incomingEvent, e);
@@ -321,8 +323,8 @@ public class ApexEngineImpl implements ApexEngine {
try {
synchronized (eventListeners) {
if (eventListeners.isEmpty()) {
- LOGGER.debug("handleEvent()<-" + key.getId() + "," + state
- + ", There is no listener registered to recieve outgoing event: " + outgoingEvent);
+ LOGGER.debug("handleEvent()<-{},{}, There is no listener registered to recieve outgoing event: {}",
+ key.getId(), state, outgoingEvent);
}
for (final EnEventListener axEventListener : eventListeners.values()) {
axEventListener.onEnEvent(outgoingEvent);
@@ -403,11 +405,10 @@ public class ApexEngineImpl implements ApexEngine {
*/
@Override
public Map<AxArtifactKey, Map<String, Object>> getEngineContext() {
- final Map<AxArtifactKey, Map<String, Object>> currentContext =
- new LinkedHashMap<AxArtifactKey, Map<String, Object>>();
+ final Map<AxArtifactKey, Map<String, Object>> currentContext = new LinkedHashMap<>();
for (final Entry<AxArtifactKey, ContextAlbum> contextAlbumEntry : internalContext.getContextAlbums()
- .entrySet()) {
+ .entrySet()) {
currentContext.put(contextAlbumEntry.getKey(), contextAlbumEntry.getValue());
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java
index 5ade06537..636f87af3 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java
@@ -124,10 +124,11 @@ public class StateMachineHandler {
try {
smExecutor.prepare();
} catch (final StateMachineException e) {
- final String stateMachineID = smExecutor.getContext().getKey().getId();
- LOGGER.warn("start()<-" + key.getId() + ", start failed, state machine \"" + stateMachineID + "\"", e);
+ final String stateMachineId = smExecutor.getContext().getKey().getId();
+ String message = "start()<-" + key.getId() + ", start failed, state machine \"" + stateMachineId + "\"";
+ LOGGER.warn(message, e);
throw new StateMachineException(
- "start()<-" + key.getId() + ", start failed, state machine \"" + stateMachineID + "\"", e);
+ message, e);
}
}
@@ -158,7 +159,7 @@ public class StateMachineHandler {
// Run the state machine
try {
LOGGER.debug("execute(): state machine \"{}\" execution starting . . .", stateMachineExecutor);
- final EnEvent outputObject = stateMachineExecutor.execute(event.getExecutionID(), event);
+ final EnEvent outputObject = stateMachineExecutor.execute(event.getExecutionId(), event);
LOGGER.debug("execute()<-: state machine \"{}\" execution completed", stateMachineExecutor);
return outputObject;
@@ -180,8 +181,8 @@ public class StateMachineHandler {
try {
smExecutor.cleanUp();
} catch (final StateMachineException e) {
- final String smID = smExecutor.getContext().getKey().getId();
- LOGGER.warn("stop()<-clean up failed, state machine \"" + smID + "\" cleanup failed", e);
+ final String smId = smExecutor.getContext().getKey().getId();
+ LOGGER.warn("stop()<-clean up failed, state machine \"" + smId + "\" cleanup failed", e);
}
}
LOGGER.exit("stop()<-");
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java
index 109240c0d..7c49af965 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java
@@ -51,6 +51,9 @@ public class EnEvent extends HashMap<String, Object> {
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(EnEvent.class);
+ // Repeasted string constants
+ private static final String NULL_KEYS_ILLEGAL = "null keys are illegal on method parameter \"key\"";
+
// The definition of this event in the Apex model
private final AxEvent axEvent;
@@ -65,7 +68,7 @@ public class EnEvent extends HashMap<String, Object> {
// An identifier for the current event execution. The default value here will always be a random
// number, and should
// be reset
- private long executionID = rand.nextLong();
+ private long executionId = rand.nextLong();
// A string holding a message that indicates why processing of this event threw an exception
private String exceptionMessage;
@@ -122,7 +125,7 @@ public class EnEvent extends HashMap<String, Object> {
*
* @return the event key
*/
- public String getID() {
+ public String getId() {
return axEvent.getKey().getId();
}
@@ -135,8 +138,8 @@ public class EnEvent extends HashMap<String, Object> {
*
* @return the currently set value for the ExecutionID for this event.
*/
- public long getExecutionID() {
- return executionID;
+ public long getExecutionId() {
+ return executionId;
}
/**
@@ -146,10 +149,10 @@ public class EnEvent extends HashMap<String, Object> {
* particular input event. The default initialised value for the ExecutionID is always unique in
* a single JVM.
*
- * @param executionID the new value for the ExecutionID for this event.
+ * @param executionId the new value for the ExecutionID for this event.
*/
- public void setExecutionID(final long executionID) {
- this.executionID = executionID;
+ public void setExecutionId(final long executionId) {
+ this.executionId = executionId;
}
/**
@@ -194,8 +197,9 @@ public class EnEvent extends HashMap<String, Object> {
// Check if this key is a parameter on our event
final AxField eventParameter = axEvent.getParameterMap().get(key);
if (eventParameter == null) {
- LOGGER.warn("parameter with key " + key + " not defined on this event");
- throw new EnException("parameter with key " + key + " not defined on this event");
+ String message = "parameter with key " + key + " not defined on this event";
+ LOGGER.warn(message);
+ throw new EnException(message);
}
// Get the item
@@ -250,15 +254,17 @@ public class EnEvent extends HashMap<String, Object> {
@Override
public Object put(final String key, final Object incomingValue) {
if (key == null) {
- LOGGER.warn("null keys are illegal on method parameter \"key\"");
- throw new EnException("null keys are illegal on method parameter \"key\"");
+ String message = NULL_KEYS_ILLEGAL;
+ LOGGER.warn(message);
+ throw new EnException(message);
}
// Check if this key is a parameter on our event
final AxField eventParameter = axEvent.getParameterMap().get(key);
if (eventParameter == null) {
- LOGGER.warn("parameter with key \"" + key + "\" not defined on event \"" + getName() + "\"");
- throw new EnException("parameter with key \"" + key + "\" not defined on event \"" + getName() + "\"");
+ String message = "parameter with key \"" + key + "\" not defined on event \"" + getName() + "\"";
+ LOGGER.warn(message);
+ throw new EnException(message);
}
// We allow null values
@@ -296,15 +302,16 @@ public class EnEvent extends HashMap<String, Object> {
@Override
public Object remove(final Object key) {
if (key == null) {
- LOGGER.warn("null keys are illegal on method parameter \"key\"");
- throw new EnException("null keys are illegal on method parameter \"key\"");
+ LOGGER.warn(NULL_KEYS_ILLEGAL);
+ throw new EnException(NULL_KEYS_ILLEGAL);
}
// Check if this key is a parameter on our event
final AxField eventParameter = axEvent.getParameterMap().get(key);
if (eventParameter == null) {
- LOGGER.warn("parameter with key " + key + " not defined on this event");
- throw new EnException("parameter with key " + key + " not defined on this event");
+ String message = "parameter with key " + key + " not defined on this event";
+ LOGGER.warn(message);
+ throw new EnException(message);
}
final Object removedValue = super.remove(key);
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java
index 4c969f76e..9941c6de8 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java
@@ -37,13 +37,13 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
* @author Sven van der Meer (sven.van.der.meer@ericsson.com)
* @author Liam Fallon (liam.fallon@ericsson.com)
*
- * @param <IN> type of the incoming entity
- * @param <OUT> type of the outgoing entity
- * @param <SUBJECT> type that is the subject of execution
- * @param <CONTEXT> context holding the context of execution
+ * @param <I> type of the incoming entity
+ * @param <O> type of the outgoing entity
+ * @param <S> type that is the subject of execution
+ * @param <C> context holding the context of execution
*/
-public interface Executor<IN, OUT, SUBJECT, CONTEXT> {
+public interface Executor<I, O, S, C> {
/**
* Save the subject and context of the executor.
*
@@ -52,7 +52,7 @@ public interface Executor<IN, OUT, SUBJECT, CONTEXT> {
* @param executorSubject the executor subject, the subject of execution
* @param executorContext the executor context, the context in which execution takes place
*/
- void setContext(Executor<?, ?, ?, ?> parent, SUBJECT executorSubject, CONTEXT executorContext);
+ void setContext(Executor<?, ?, ?, ?> parent, S executorSubject, C executorContext);
/**
* Prepares the processing.
@@ -64,23 +64,23 @@ public interface Executor<IN, OUT, SUBJECT, CONTEXT> {
/**
* Executes the executor, running through its context in its natural order.
*
- * @param executionID the execution ID of the current APEX execution policy thread
+ * @param executionId the execution ID of the current APEX execution policy thread
* @param incomingEntity the incoming entity that triggers execution
* @return The outgoing entity that is the result of execution
* @throws StateMachineException on an execution error
* @throws ContextException on context errors
*/
- OUT execute(long executionID, IN incomingEntity) throws StateMachineException, ContextException;
+ O execute(long executionId, I incomingEntity) throws StateMachineException, ContextException;
/**
* Carry out the preparatory work for execution.
*
- * @param executionID the execution ID of the current APEX execution policy thread
+ * @param executionId the execution ID of the current APEX execution policy thread
* @param incomingEntity the incoming entity that triggers execution
* @throws StateMachineException on an execution error
* @throws ContextException on context errors
*/
- void executePre(long executionID, IN incomingEntity) throws StateMachineException, ContextException;
+ void executePre(long executionId, I incomingEntity) throws StateMachineException, ContextException;
/**
* Carry out the post work for execution, the returning entity should be set by the child
@@ -119,42 +119,42 @@ public interface Executor<IN, OUT, SUBJECT, CONTEXT> {
*
* @return The subject for the executor
*/
- SUBJECT getSubject();
+ S getSubject();
/**
* Get the context of the executor.
*
* @return The context for the executor
*/
- CONTEXT getContext();
+ C getContext();
/**
* Get the incoming object of the executor.
*
* @return The incoming object for the executor
*/
- IN getIncoming();
+ I getIncoming();
/**
* Get the outgoing object of the executor.
*
* @return The outgoing object for the executor
*/
- OUT getOutgoing();
+ O getOutgoing();
/**
* Save the next executor for this executor.
*
* @param nextExecutor the next executor
*/
- void setNext(Executor<IN, OUT, SUBJECT, CONTEXT> nextExecutor);
+ void setNext(Executor<I, O, S, C> nextExecutor);
/**
* Get the next executor to be run after this executor completes its execution.
*
* @return The next executor
*/
- Executor<IN, OUT, SUBJECT, CONTEXT> getNext();
+ Executor<I, O, S, C> getNext();
/**
* Set parameters for this executor, overloaded by executors that use parameters.
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java
index 9cf7d90e3..28ea13ea7 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java
@@ -171,13 +171,13 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap
* java.lang.Object)
*/
@Override
- public StateOutput execute(final long executionID, final EnEvent incomingEvent)
+ public StateOutput execute(final long executionId, final EnEvent incomingEvent)
throws StateMachineException, ContextException {
this.lastIncomingEvent = incomingEvent;
// Check that the incoming event matches the trigger for this state
if (!incomingEvent.getAxEvent().getKey().equals(axState.getTrigger())) {
- throw new StateMachineException("incoming event \"" + incomingEvent.getID() + "\" does not match trigger \""
+ throw new StateMachineException("incoming event \"" + incomingEvent.getId() + "\" does not match trigger \""
+ axState.getTrigger().getId() + "\" of state \"" + axState.getId() + "\"");
}
@@ -188,7 +188,7 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap
// There may be no task selection logic, in which case just return the default task
if (taskSelectExecutor != null) {
// Fire the task selector to find the task to run
- taskKey = taskSelectExecutor.execute(executionID, incomingEvent);
+ taskKey = taskSelectExecutor.execute(executionId, incomingEvent);
}
// If there's no task selection logic or the TSL returned no task, just use the default
@@ -201,7 +201,7 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap
final TreeMap<String, Object> incomingValues = new TreeMap<>();
incomingValues.putAll(incomingEvent);
final Map<String, Object> taskExecutionResultMap =
- taskExecutorMap.get(taskKey).execute(executionID, incomingValues);
+ taskExecutorMap.get(taskKey).execute(executionId, incomingValues);
final AxTask task = taskExecutorMap.get(taskKey).getSubject();
// Check if this task has direct output
@@ -220,7 +220,7 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap
// Execute the state finalizer logic to select a state output and to adjust the
// taskExecutionResultMap
stateOutputName =
- finalizerLogicExecutor.execute(incomingEvent.getExecutionID(), taskExecutionResultMap);
+ finalizerLogicExecutor.execute(incomingEvent.getExecutionId(), taskExecutionResultMap);
}
// Now look up the the actual state output
@@ -240,8 +240,8 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap
stateOutput.copyUnsetFields(incomingEvent);
// Set the ExecutionID for the outgoing event to the value in the incoming event.
- if (stateOutput != null && stateOutput.getOutputEvent() != null) {
- stateOutput.getOutputEvent().setExecutionID(incomingEvent.getExecutionID());
+ if (stateOutput.getOutputEvent() != null) {
+ stateOutput.getOutputEvent().setExecutionId(incomingEvent.getExecutionId());
}
// That's it, the state execution is complete
@@ -262,7 +262,7 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap
* java.lang.Object)
*/
@Override
- public final void executePre(final long executionID, final EnEvent incomingEntity) throws StateMachineException {
+ public final void executePre(final long executionId, final EnEvent incomingEntity) throws StateMachineException {
throw new StateMachineException("execution pre work not implemented on class");
}
@@ -384,5 +384,7 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap
* engine. ExecutorParameters)
*/
@Override
- public void setParameters(final ExecutorParameters parameters) {}
+ public void setParameters(final ExecutorParameters parameters) {
+ // Not implemented in this class
+ }
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java
index 687c3b305..1c225f7b8 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java
@@ -36,17 +36,20 @@ import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
/**
- * This abstract class executes state finalizer logic in a state of an Apex policy and is
- * specialized by classes that implement execution of state finalizer logic.
+ * This abstract class executes state finalizer logic in a state of an Apex policy and is specialized by classes that
+ * implement execution of state finalizer logic.
*
* @author Sven van der Meer (sven.van.der.meer@ericsson.com)
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public abstract class StateFinalizerExecutor
- implements Executor<Map<String, Object>, String, AxStateFinalizerLogic, ApexInternalContext> {
+ implements Executor<Map<String, Object>, String, AxStateFinalizerLogic, ApexInternalContext> {
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(StateFinalizerExecutor.class);
+ // Repeated string constants
+ private static final String EXECUTE_POST_SFL = "execute-post: state finalizer logic \"";
+
// Hold the state and context definitions
private Executor<?, ?, ?, ?> parent = null;
private AxState axState = null;
@@ -81,7 +84,8 @@ public abstract class StateFinalizerExecutor
*/
@Override
public void setContext(final Executor<?, ?, ?, ?> incomingParent,
- final AxStateFinalizerLogic incomingFinalizerLogic, final ApexInternalContext incomingInternalContext) {
+ final AxStateFinalizerLogic incomingFinalizerLogic,
+ final ApexInternalContext incomingInternalContext) {
this.parent = incomingParent;
axState = (AxState) parent.getSubject();
this.finalizerLogic = incomingFinalizerLogic;
@@ -96,41 +100,39 @@ public abstract class StateFinalizerExecutor
@Override
public void prepare() throws StateMachineException {
LOGGER.debug("prepare:" + finalizerLogic.getId() + "," + finalizerLogic.getLogicFlavour() + ","
- + finalizerLogic.getLogic());
+ + finalizerLogic.getLogic());
argumentOfClassNotNull(finalizerLogic.getLogic(), StateMachineException.class, "task logic cannot be null.");
}
/*
* (non-Javadoc)
*
- * @see org.onap.policy.apex.core.engine.executor.Executor#execute(java.lang.long,
- * java.lang.Object)
+ * @see org.onap.policy.apex.core.engine.executor.Executor#execute(java.lang.long, java.lang.Object)
*/
@Override
- public String execute(final long executionID, final Map<String, Object> newIncomingFields)
- throws StateMachineException, ContextException {
- throw new StateMachineException(
- "execute() not implemented on abstract StateFinalizerExecutionContext class, only on its subclasses");
+ public String execute(final long executionId, final Map<String, Object> newIncomingFields)
+ throws StateMachineException, ContextException {
+ throw new StateMachineException("execute() not implemented on abstract StateFinalizerExecutionContext class, "
+ + "only on its subclasses");
}
/*
* (non-Javadoc)
*
- * @see org.onap.policy.apex.core.engine.executor.Executor#executePre(java.lang.long,
- * java.lang.Object)
+ * @see org.onap.policy.apex.core.engine.executor.Executor#executePre(java.lang.long, java.lang.Object)
*/
@Override
- public final void executePre(final long executionID, final Map<String, Object> newIncomingFields)
- throws StateMachineException, ContextException {
+ public final void executePre(final long executionId, final Map<String, Object> newIncomingFields)
+ throws StateMachineException, ContextException {
LOGGER.debug("execute-pre:" + finalizerLogic.getLogicFlavour() + "," + getSubject().getId() + ","
- + finalizerLogic.getLogic());
+ + finalizerLogic.getLogic());
// Record the incoming fields
this.incomingFields = newIncomingFields;
// Get state finalizer context object
- executionContext = new StateFinalizerExecutionContext(this, executionID, axState, getIncoming(),
- axState.getStateOutputs().keySet(), getContext());
+ executionContext = new StateFinalizerExecutionContext(this, executionId, axState, getIncoming(),
+ axState.getStateOutputs().keySet(), getContext());
}
/*
@@ -142,7 +144,7 @@ public abstract class StateFinalizerExecutor
public final void executePost(final boolean returnValue) throws StateMachineException, ContextException {
if (!returnValue) {
String errorMessage = "execute-post: state finalizer logic execution failure on state \"" + axState.getId()
- + "\" on finalizer logic " + finalizerLogic.getId();
+ + "\" on finalizer logic " + finalizerLogic.getId();
if (executionContext.getMessage() != null) {
errorMessage += ", user message: " + executionContext.getMessage();
}
@@ -152,23 +154,20 @@ public abstract class StateFinalizerExecutor
// Check a state output has been selected
if (getOutgoing() == null) {
- LOGGER.warn("execute-post: state finalizer logic \"" + finalizerLogic.getId()
- + "\" did not select an output state");
- throw new StateMachineException("execute-post: state finalizer logic \"" + finalizerLogic.getId()
- + "\" did not select an output state");
+ String message = EXECUTE_POST_SFL + finalizerLogic.getId() + "\" did not select an output state";
+ LOGGER.warn(message);
+ throw new StateMachineException(message);
}
if (!axState.getStateOutputs().keySet().contains(getOutgoing())) {
- LOGGER.warn(
- "execute-post: state finalizer logic \"" + finalizerLogic.getId() + "\" selected output state \""
- + getOutgoing() + "\" that does not exsist on state \"" + axState.getId() + "\"");
- throw new StateMachineException(
- "execute-post: state finalizer logic \"" + finalizerLogic.getId() + "\" selected output state \""
+ LOGGER.warn(EXECUTE_POST_SFL + finalizerLogic.getId() + "\" selected output state \"" + getOutgoing()
+ + "\" that does not exsist on state \"" + axState.getId() + "\"");
+ throw new StateMachineException(EXECUTE_POST_SFL + finalizerLogic.getId() + "\" selected output state \""
+ getOutgoing() + "\" that does not exsist on state \"" + axState.getId() + "\"");
}
- LOGGER.debug("execute-post:" + finalizerLogic.getId() + ", returning state output \"" + getOutgoing()
- + " and fields " + incomingFields);
+ LOGGER.debug("execute-post:{}, returning state output \"{}\" and fields {}", finalizerLogic.getId(),
+ getOutgoing(), incomingFields);
}
/*
@@ -244,14 +243,13 @@ public abstract class StateFinalizerExecutor
/*
* (non-Javadoc)
*
- * @see
- * org.onap.policy.apex.core.engine.executor.Executor#setNext(org.onap.policy.apex.core.engine.
+ * @see org.onap.policy.apex.core.engine.executor.Executor#setNext(org.onap.policy.apex.core.engine.
* executor.Executor)
*/
@Override
- public void setNext(final Executor<Map<String, Object>, String, AxStateFinalizerLogic, ApexInternalContext>
- incomingNextExecutor) {
- this.nextExecutor = incomingNextExecutor;
+ public void setNext(
+ final Executor<Map<String, Object>, String, AxStateFinalizerLogic, ApexInternalContext> inNextEx) {
+ this.nextExecutor = inNextEx;
}
/*
@@ -267,10 +265,10 @@ public abstract class StateFinalizerExecutor
/*
* (non-Javadoc)
*
- * @see
- * org.onap.policy.apex.core.engine.executor.Executor#setParameters(org.onap.policy.apex.core.
- * engine. ExecutorParameters)
+ * @see org.onap.policy.apex.core.engine.executor.Executor#setParameters(org.onap.policy.apex.core. engine.
+ * ExecutorParameters)
*/
@Override
- public void setParameters(final ExecutorParameters parameters) {}
+ public void setParameters(final ExecutorParameters parameters) {
+ }
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java
index 07ef8d6d6..97d51bf78 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java
@@ -128,7 +128,7 @@ public class StateMachineExecutor implements Executor<EnEvent, EnEvent, AxPolicy
* java.lang.Object)
*/
@Override
- public EnEvent execute(final long executionID, final EnEvent incomingEvent)
+ public EnEvent execute(final long executionId, final EnEvent incomingEvent)
throws StateMachineException, ContextException {
// Check if there are any states on the state machine
if (stateExecutorMap.size() == 0) {
@@ -147,7 +147,7 @@ public class StateMachineExecutor implements Executor<EnEvent, EnEvent, AxPolicy
incomingEvent.getKey(), firstExecutor.getSubject().getKey()), incomingEvent);
while (true) {
// Execute the state
- stateOutput = stateExecutor.execute(executionID, stateOutput.getOutputEvent());
+ stateOutput = stateExecutor.execute(executionId, stateOutput.getOutputEvent());
if (stateOutput == null) {
throw new StateMachineException("state execution failed, invalid state output returned");
}
@@ -175,7 +175,7 @@ public class StateMachineExecutor implements Executor<EnEvent, EnEvent, AxPolicy
* java.lang.Object)
*/
@Override
- public final void executePre(final long executionID, final EnEvent incomingEntity) throws StateMachineException {
+ public final void executePre(final long executionId, final EnEvent incomingEntity) throws StateMachineException {
throw new StateMachineException("execution pre work not implemented on class");
}
@@ -291,5 +291,7 @@ public class StateMachineExecutor implements Executor<EnEvent, EnEvent, AxPolicy
* engine. ExecutorParameters)
*/
@Override
- public void setParameters(final ExecutorParameters parameters) {}
+ public void setParameters(final ExecutorParameters parameters) {
+ // Not implemented in this class
+ }
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java
index 65cb0d2b8..837347174 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java
@@ -34,8 +34,7 @@ import org.onap.policy.apex.model.policymodel.concepts.AxStateOutput;
import org.onap.policy.apex.model.utilities.Assertions;
/**
- * This class is the output of a state, and is used by the engine to decide what the next state for
- * execution is.
+ * This class is the output of a state, and is used by the engine to decide what the next state for execution is.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@@ -104,14 +103,14 @@ public class StateOutput {
* @throws StateMachineException on errors populating the event fields
*/
public void setEventFields(final Map<String, AxField> incomingFieldDefinitionMap,
- final Map<String, Object> eventFieldMap) throws StateMachineException {
+ final Map<String, Object> eventFieldMap) throws StateMachineException {
Assertions.argumentNotNull(incomingFieldDefinitionMap, "incomingFieldDefinitionMap may not be null");
Assertions.argumentNotNull(eventFieldMap, "eventFieldMap may not be null");
if (!incomingFieldDefinitionMap.keySet().equals(eventFieldMap.keySet())) {
throw new StateMachineException(
- "field definitions and values do not match for event " + outputEventDef.getId() + '\n'
- + incomingFieldDefinitionMap.keySet() + '\n' + eventFieldMap.keySet());
+ "field definitions and values do not match for event " + outputEventDef.getId() + '\n'
+ + incomingFieldDefinitionMap.keySet() + '\n' + eventFieldMap.keySet());
}
for (final Entry<String, Object> incomingFieldEntry : eventFieldMap.entrySet()) {
final String fieldName = incomingFieldEntry.getKey();
@@ -119,8 +118,8 @@ public class StateOutput {
// Check if this field is a field in the event
if (!outputEventDef.getFields().contains(fieldDef)) {
- throw new StateMachineException(
- "field \"" + fieldName + "\" does not exist on event \"" + outputEventDef.getId() + "\"");
+ throw new StateMachineException("field \"" + fieldName + "\" does not exist on event \""
+ + outputEventDef.getId() + "\"");
}
// Set the value in the output event
@@ -129,8 +128,8 @@ public class StateOutput {
}
/**
- * This method copies any fields that exist on the input event that also exist on the output
- * event if they are not set on the output event.
+ * This method copies any fields that exist on the input event that also exist on the output event if they are not
+ * set on the output event.
*
* @param incomingEvent The incoming event to copy from
*/
@@ -141,18 +140,14 @@ public class StateOutput {
final String fieldName = incomingField.getKey();
// Check if the field exists on the outgoing event
- if (!outputEventDef.getParameterMap().containsKey(fieldName)) {
- continue;
- }
+ if ((!outputEventDef.getParameterMap().containsKey(fieldName))
- // Check if the field is set on the outgoing event
- if (outputEvent.containsKey(fieldName)) {
- continue;
- }
+ // Check if the field is set on the outgoing event
+ || (outputEvent.containsKey(fieldName))
- // Now, check the fields have the same type
- if (!incomingEvent.getAxEvent().getParameterMap().get(fieldName)
- .equals(outputEvent.getAxEvent().getParameterMap().get(fieldName))) {
+ // Now, check the fields have the same type
+ || (!incomingEvent.getAxEvent().getParameterMap().get(fieldName)
+ .equals(outputEvent.getAxEvent().getParameterMap().get(fieldName)))) {
continue;
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java
index de2f7b821..814f257f7 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java
@@ -101,7 +101,8 @@ public abstract class TaskExecutor
public void prepare() throws StateMachineException {
LOGGER.debug("prepare:" + axTask.getKey().getId() + "," + axTask.getTaskLogic().getLogicFlavour() + ","
+ axTask.getTaskLogic().getLogic());
- argumentOfClassNotNull(axTask.getTaskLogic().getLogic(), StateMachineException.class, "task logic cannot be null.");
+ argumentOfClassNotNull(axTask.getTaskLogic().getLogic(), StateMachineException.class,
+ "task logic cannot be null.");
}
/*
@@ -111,7 +112,7 @@ public abstract class TaskExecutor
* java.lang.Object)
*/
@Override
- public Map<String, Object> execute(final long executionID, final Map<String, Object> newIncomingFields)
+ public Map<String, Object> execute(final long executionId, final Map<String, Object> newIncomingFields)
throws StateMachineException, ContextException {
throw new StateMachineException(
"execute() not implemented on abstract TaskExecutor class, only on its subclasses");
@@ -124,7 +125,7 @@ public abstract class TaskExecutor
* java.lang.Object)
*/
@Override
- public final void executePre(final long executionID, final Map<String, Object> newIncomingFields)
+ public final void executePre(final long executionId, final Map<String, Object> newIncomingFields)
throws StateMachineException, ContextException {
LOGGER.debug("execute-pre:" + getSubject().getTaskLogic().getLogicFlavour() + ","
+ getSubject().getKey().getId() + "," + getSubject().getTaskLogic().getLogic());
@@ -157,7 +158,7 @@ public abstract class TaskExecutor
// Get task context object
executionContext =
- new TaskExecutionContext(this, executionID, getSubject(), getIncoming(), getOutgoing(), getContext());
+ new TaskExecutionContext(this, executionId, getSubject(), getIncoming(), getOutgoing(), getContext());
}
/*
@@ -228,7 +229,8 @@ public abstract class TaskExecutor
+ "\" are unwanted for task \"" + axTask.getKey().getId() + "\"");
}
- LOGGER.debug("execute-post:" + axTask.getKey().getId() + ", returning fields " + outgoingFields.toString());
+ String message = "execute-post:" + axTask.getKey().getId() + ", returning fields " + outgoingFields.toString();
+ LOGGER.debug(message);
}
/*
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java
index cda0ac549..5d24f0d4a 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java
@@ -104,7 +104,7 @@ public abstract class TaskSelectExecutor implements Executor<EnEvent, AxArtifact
* java.lang.Object)
*/
@Override
- public AxArtifactKey execute(final long executionID, final EnEvent newIncomingEvent)
+ public AxArtifactKey execute(final long executionId, final EnEvent newIncomingEvent)
throws StateMachineException, ContextException {
throw new StateMachineException("execute() not implemented on class");
}
@@ -116,7 +116,7 @@ public abstract class TaskSelectExecutor implements Executor<EnEvent, AxArtifact
* java.lang.Object)
*/
@Override
- public final void executePre(final long executionID, final EnEvent newIncomingEvent) throws StateMachineException {
+ public final void executePre(final long executionId, final EnEvent newIncomingEvent) throws StateMachineException {
LOGGER.debug("execute-pre:" + axState.getKey().getId() + "," + axState.getTaskSelectionLogic().getLogicFlavour()
+ "," + axState.getTaskSelectionLogic().getLogic());
@@ -126,7 +126,7 @@ public abstract class TaskSelectExecutor implements Executor<EnEvent, AxArtifact
outgoingTaskKey = new AxArtifactKey();
// Get task selection context object
- executionContext = new TaskSelectionExecutionContext(this, executionID, getSubject(), getIncoming(),
+ executionContext = new TaskSelectionExecutionContext(this, executionId, getSubject(), getIncoming(),
getOutgoing(), getContext());
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java
index be1b311c2..460639b90 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java
@@ -58,7 +58,7 @@ public class StateFinalizerExecutionContext {
public final AxStateFacade subject;
/** the execution ID for the current APEX policy execution instance. */
- public final Long executionID;
+ public final Long executionId;
/**
* The list of state outputs for this state finalizer. The purpose of a state finalizer is to
@@ -99,7 +99,7 @@ public class StateFinalizerExecutionContext {
* Instantiates a new state finalizer execution context.
*
* @param stateFinalizerExecutor the state finalizer executor that requires context
- * @param executionID the execution ID for the current APEX policy execution instance
+ * @param executionId the execution ID for the current APEX policy execution instance
* @param axState the state definition that is the subject of execution
* @param fields the fields to be manipulated by the state finalizer
* @param stateOutputNames the state output names, one of which will be selected by the state
@@ -107,13 +107,13 @@ public class StateFinalizerExecutionContext {
* @param internalContext the execution context of the Apex engine in which the task is being
* executed
*/
- public StateFinalizerExecutionContext(final StateFinalizerExecutor stateFinalizerExecutor, final long executionID,
+ public StateFinalizerExecutionContext(final StateFinalizerExecutor stateFinalizerExecutor, final long executionId,
final AxState axState, final Map<String, Object> fields, final Set<String> stateOutputNames,
final ApexInternalContext internalContext) {
subject = new AxStateFacade(axState);
// Execution ID is the current policy execution instance
- this.executionID = executionID;
+ this.executionId = executionId;
this.fields = fields;
this.stateOutputNames = stateOutputNames;
@@ -150,7 +150,7 @@ public class StateFinalizerExecutionContext {
* @throws ContextRuntimeException if the context album does not exist on the state for this
* executor
*/
- public ContextAlbum getContextAlbum(final String contextAlbumName) throws ContextRuntimeException {
+ public ContextAlbum getContextAlbum(final String contextAlbumName) {
// Find the context album
final ContextAlbum foundContextAlbum = context.get(contextAlbumName);
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java
index a9a157082..4a9e83063 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java
@@ -52,18 +52,18 @@ public class TaskExecutionContext {
// CHECKSTYLE:OFF: checkstyle:VisibilityModifier Logic has access to these field
/** A constant <code>boolean true</code> value available for reuse e.g., for the return value */
- public final Boolean TRUE = true;
+ public final Boolean isTrue = true;
/**
* A constant <code>boolean false</code> value available for reuse e.g., for the return value
*/
- public final Boolean FALSE = false;
+ public final Boolean isFalse = false;
/** A facade to the full task definition for the task logic being executed. */
public final AxTaskFacade subject;
/** the execution ID for the current APEX policy execution instance. */
- public final Long executionID;
+ public final Long executionId;
/**
* The incoming fields from the trigger event for the task. The task logic can access these
@@ -97,21 +97,21 @@ public class TaskExecutionContext {
* Instantiates a new task execution context.
*
* @param taskExecutor the task executor that requires context
- * @param executionID the execution ID for the current APEX policy execution instance
+ * @param executionId the execution ID for the current APEX policy execution instance
* @param axTask the task definition that is the subject of execution
* @param inFields the in fields
* @param outFields the out fields
* @param internalContext the execution context of the Apex engine in which the task is being
* executed
*/
- public TaskExecutionContext(final TaskExecutor taskExecutor, final long executionID, final AxTask axTask,
+ public TaskExecutionContext(final TaskExecutor taskExecutor, final long executionId, final AxTask axTask,
final Map<String, Object> inFields, final Map<String, Object> outFields,
final ApexInternalContext internalContext) {
// The subject is the task definition
subject = new AxTaskFacade(axTask);
// Execution ID is the current policy execution instance
- this.executionID = executionID;
+ this.executionId = executionId;
// The input and output fields
this.inFields = Collections.unmodifiableMap(inFields);
@@ -147,7 +147,7 @@ public class TaskExecutionContext {
* @throws ContextRuntimeException if the context album does not exist on the task for this
* executor
*/
- public ContextAlbum getContextAlbum(final String contextAlbumName) throws ContextRuntimeException {
+ public ContextAlbum getContextAlbum(final String contextAlbumName) {
// Find the context album
final ContextAlbum foundContextAlbum = context.get(contextAlbumName);
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java
index 3194e3fce..63052348a 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java
@@ -52,18 +52,18 @@ public class TaskSelectionExecutionContext {
// CHECKSTYLE:OFF: checkstyle:VisibilityModifier Logic has access to these field
/** A constant <code>boolean true</code> value available for reuse e.g., for the return value */
- public final Boolean TRUE = true;
+ public final Boolean isTrue = true;
/**
* A constant <code>boolean false</code> value available for reuse e.g., for the return value
*/
- public final Boolean FALSE = false;
+ public final Boolean isFalse = false;
/** A facade to the full state definition for the task selection logic being executed. */
public final AxStateFacade subject;
/** the execution ID for the current APEX policy execution instance. */
- public final Long executionID;
+ public final Long executionId;
/**
* The incoming fields from the trigger event for the state. The task selection logic can access
@@ -96,21 +96,21 @@ public class TaskSelectionExecutionContext {
* Instantiates a new task selection execution context.
*
* @param taskSelectExecutor the task selection executor that requires context
- * @param executionID the execution identifier
+ * @param executionId the execution identifier
* @param axState the state definition that is the subject of execution
* @param incomingEvent the incoming event for the state
* @param outgoingKey the outgoing key for the task to execute in this state
* @param internalContext the execution context of the Apex engine in which the task is being
* executed
*/
- public TaskSelectionExecutionContext(final TaskSelectExecutor taskSelectExecutor, final long executionID,
+ public TaskSelectionExecutionContext(final TaskSelectExecutor taskSelectExecutor, final long executionId,
final AxState axState, final EnEvent incomingEvent, final AxArtifactKey outgoingKey,
final ApexInternalContext internalContext) {
// The subject is the state definition
subject = new AxStateFacade(axState);
// Execution ID is the current policy execution instance
- this.executionID = executionID;
+ this.executionId = executionId;
// The events
inFields = incomingEvent;
@@ -153,7 +153,7 @@ public class TaskSelectionExecutionContext {
* @throws ContextRuntimeException if the context album does not exist on the state for this
* executor
*/
- public ContextAlbum getContextAlbum(final String contextAlbumName) throws ContextRuntimeException {
+ public ContextAlbum getContextAlbum(final String contextAlbumName) {
// Find the context album
final ContextAlbum foundContextAlbum = context.get(contextAlbumName);
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java
index c1c9ce949..de2639dcb 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java
@@ -44,7 +44,8 @@ public class EventMonitor {
* @param userArtifactStack the keys of the artifacts using the event at the moment
*/
public void monitorGet(final AxField eventParameter, final Object value, final AxConcept[] userArtifactStack) {
- LOGGER.trace(monitor("GET", userArtifactStack, eventParameter, value));
+ String monitorGetString = monitor("GET", userArtifactStack, eventParameter, value);
+ LOGGER.trace(monitorGetString);
}
/**
@@ -55,7 +56,8 @@ public class EventMonitor {
* @param userArtifactStack the keys of the artifacts using the event at the moment
*/
public void monitorSet(final AxField eventParameter, final Object value, final AxConcept[] userArtifactStack) {
- LOGGER.trace(monitor("SET", userArtifactStack, eventParameter, value));
+ String monitorSetString = monitor("SET", userArtifactStack, eventParameter, value);
+ LOGGER.trace(monitorSetString);
}
/**
@@ -67,7 +69,8 @@ public class EventMonitor {
*/
public void monitorRemove(final AxField eventParameter, final Object removedValue,
final AxConcept[] userArtifactStack) {
- LOGGER.trace(monitor("REMOVE", userArtifactStack, eventParameter, removedValue));
+ String monitorRemoveString = monitor("REMOVE", userArtifactStack, eventParameter, removedValue);
+ LOGGER.trace(monitorRemoveString);
}
/**
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/JavaHandlingException.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/JavaHandlingException.java
index f6ef68105..63bd1c477 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/JavaHandlingException.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/JavaHandlingException.java
@@ -40,19 +40,19 @@ public class JavaHandlingException extends Exception {
/**
* Instantiates a new Java handling exception.
*
- * @param e the exception to wrap
+ * @param exception the exception to wrap
*/
- public JavaHandlingException(final Exception e) {
- super(e);
+ public JavaHandlingException(final Exception exception) {
+ super(exception);
}
/**
* Instantiates a new Java handling exception.
*
* @param message the message
- * @param e the exception to wrap
+ * @param exception the exception to wrap
*/
- public JavaHandlingException(final String message, final Exception e) {
- super(message, e);
+ public JavaHandlingException(final String message, final Exception exception) {
+ super(message, exception);
}
}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java
index 919d1b122..16a3369fb 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java
@@ -22,6 +22,7 @@ package org.onap.policy.apex.core.infrastructure.java.classes;
import java.io.File;
import java.io.FileInputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.net.URL;
@@ -44,6 +45,9 @@ public abstract class ClassUtils {
// Get a reference to the logger
private static final XLogger LOGGER = XLoggerFactory.getXLogger(ClassUtils.class);
+ // Repeated string constants
+ private static final String CLASS_PATTERN = "\\.class$";
+
// The boot directory in Java for predefined JARs
private static final String SUN_BOOT_LIBRARY_PATH = "sun.boot.library.path";
@@ -89,16 +93,13 @@ public abstract class ClassUtils {
try {
final Class<?> nullclassloader = Class.forName("sun.misc.Launcher");
if (nullclassloader != null) {
- // There a long way and a short way, Short way: causes a warning that cannot be suppressed
- // URL[] moreurls = sun.misc.Launcher.getBootstrapClassPath().getURLs();
- // long way:
- Method m = nullclassloader.getMethod("getBootstrapClassPath");
- if (m != null) {
- final Object cp = m.invoke(null, (Object[]) null);
+ Method mmethod = nullclassloader.getMethod("getBootstrapClassPath");
+ if (mmethod != null) {
+ final Object cp = mmethod.invoke(null, (Object[]) null);
if (cp != null) {
- m = cp.getClass().getMethod("getURLs");
- if (m != null) {
- final URL[] moreurls = (URL[]) (m.invoke(cp, (Object[]) null));
+ mmethod = cp.getClass().getMethod("getURLs");
+ if (mmethod != null) {
+ final URL[] moreurls = (URL[]) (mmethod.invoke(cp, (Object[]) null));
if (moreurls != null && moreurls.length > 0) {
if (urls.length == 0) {
urls = moreurls;
@@ -130,10 +131,8 @@ public abstract class ClassUtils {
// JARs are processed as well
else if (url.getFile().endsWith(".jar")) {
classNameSet.addAll(processJar(urlFile));
- } else {
- // It's a resource or some other non-executable thing
- continue;
}
+ // It's a resource or some other non-executable thing
}
} catch (final Exception e) {
LOGGER.warn("could not get the names of Java classes", e);
@@ -168,9 +167,7 @@ public abstract class ClassUtils {
} else if (child.getName().endsWith(".class") && !child.getName().contains("$")) {
// Process the ".class" file
classNameSet.add(
- child.getAbsolutePath().replace(rootDir, "").replaceFirst("\\.class$", "").replace('/', '.'));
- } else {
- continue;
+ child.getAbsolutePath().replace(rootDir, "").replaceFirst(CLASS_PATTERN, "").replace('/', '.'));
}
}
return classNameSet;
@@ -194,7 +191,7 @@ public abstract class ClassUtils {
fileName = fileName.substring(classesPos + CLASSES_TOKEN.length());
}
- return fileName.replaceFirst("\\.class$", "").replace('/', '.');
+ return fileName.replaceFirst(CLASS_PATTERN, "").replace('/', '.');
}
/**
@@ -202,9 +199,9 @@ public abstract class ClassUtils {
*
* @param jarFile the JAR file
* @return a set of class names
- * @throws Exception on errors processing JARs
+ * @throws IOException on errors processing JARs
*/
- public static Set<String> processJar(final File jarFile) throws Exception {
+ public static Set<String> processJar(final File jarFile) throws IOException {
// Pass the file as an input stream
return processJar(new FileInputStream(jarFile.getAbsolutePath()));
}
@@ -214,9 +211,9 @@ public abstract class ClassUtils {
*
* @param jarInputStream the JAR input stream
* @return a set of class names
- * @throws Exception on errors processing JARs
+ * @throws IOException on errors processing JARs
*/
- public static Set<String> processJar(final InputStream jarInputStream) throws Exception {
+ public static Set<String> processJar(final InputStream jarInputStream) throws IOException {
// The return set
final TreeSet<String> classPathSet = new TreeSet<>();
@@ -229,7 +226,7 @@ public abstract class ClassUtils {
// Iterate over each entry in the JAR
for (ZipEntry entry = zip.getNextEntry(); entry != null; entry = zip.getNextEntry()) {
if (!entry.isDirectory() && entry.getName().endsWith(".class") && !entry.getName().contains("$")) {
- classPathSet.add(entry.getName().replaceFirst("\\.class$", "").replace('/', '.'));
+ classPathSet.add(entry.getName().replaceFirst(CLASS_PATTERN, "").replace('/', '.'));
}
}
zip.close();
@@ -243,7 +240,7 @@ public abstract class ClassUtils {
*/
public static void main(final String[] args) {
for (final String clz : getClassNames()) {
- System.out.println("Found class: " + clz);
+ LOGGER.info("Found class: {}", clz);
}
}
}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassBuilder.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassBuilder.java
index 7a0b6048e..464a601e1 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassBuilder.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassBuilder.java
@@ -69,8 +69,8 @@ public class SingleClassBuilder {
*/
public void compile() throws JavaHandlingException {
// Get the list of compilation units, there is only one here
- final List<? extends JavaFileObject> compilationUnits =
- Arrays.asList(new SingleClassCompilationUnit(className, sourceCode));
+ final List<? extends JavaFileObject> compilationUnits = Arrays
+ .asList(new SingleClassCompilationUnit(className, sourceCode));
// Allows us to get diagnostics from the compilation
final DiagnosticCollector<JavaFileObject> diagnosticListener = new DiagnosticCollector<>();
@@ -80,8 +80,8 @@ public class SingleClassBuilder {
// Set up the target file manager and call the compiler
singleFileManager = new SingleFileManager(compiler, new SingleClassByteCodeFileObject(className));
- final JavaCompiler.CompilationTask task =
- compiler.getTask(null, singleFileManager, diagnosticListener, null, null, compilationUnits);
+ final JavaCompiler.CompilationTask task = compiler.getTask(null, singleFileManager, diagnosticListener, null,
+ null, compilationUnits);
// Check if the compilation worked
if (!task.call()) {
@@ -104,9 +104,9 @@ public class SingleClassBuilder {
builder.append("\n");
}
- LOGGER.warn("error compiling Java code for class \"" + className + "\": " + builder.toString());
- throw new JavaHandlingException(
- "error compiling Java code for class \"" + className + "\": " + builder.toString());
+ String message = "error compiling Java code for class \"" + className + "\": " + builder.toString();
+ LOGGER.warn(message);
+ throw new JavaHandlingException(message);
}
}
@@ -120,12 +120,12 @@ public class SingleClassBuilder {
* @throws ClassNotFoundException the byte code for the class is not found in the class loader
* @throws JavaHandlingException the java handling exception if the Java class source code is not compiled
*/
- public Object createObject()
- throws InstantiationException, IllegalAccessException, ClassNotFoundException, JavaHandlingException {
+ public Object createObject() throws InstantiationException, IllegalAccessException, ClassNotFoundException,
+ JavaHandlingException {
if (singleFileManager == null) {
- LOGGER.warn("error instantiating instance for class \"" + className + "\": code may not be compiled");
- throw new JavaHandlingException(
- "error instantiating instance for class \"" + className + "\": code may not be compiled");
+ String message = "error instantiating instance for class \"" + className + "\": code may not be compiled";
+ LOGGER.warn(message);
+ throw new JavaHandlingException(message);
}
return singleFileManager.getClassLoader(null).findClass(className).newInstance();
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassByteCodeFileObject.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassByteCodeFileObject.java
index 4b7225267..043657854 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassByteCodeFileObject.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassByteCodeFileObject.java
@@ -35,7 +35,7 @@ import javax.tools.SimpleJavaFileObject;
* basis for {@code JavaFileObject} implementations. Subclasses can override the implementation and specification of any
* method of this class as long as the general contract of {@code JavaFileObject} is obeyed.
*
- * This class holds the byte code for a single class in memory.
+ * <p>This class holds the byte code for a single class in memory.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleFileManager.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleFileManager.java
index cd14b1a06..066765504 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleFileManager.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleFileManager.java
@@ -34,7 +34,7 @@ import javax.tools.StandardJavaFileManager;
* is an implementation of {@code JavaFileManager} that forwards the {@code JavaFileManager} methods to a given file
* manager.
*
- * This class instantiates and forwards those requests to a {@link StandardJavaFileManager} instance to act as a
+ * <p>This class instantiates and forwards those requests to a {@link StandardJavaFileManager} instance to act as a
* {@code JavaFileManager} for a Java single file, managing class loading for the class.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageHolder.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageHolder.java
index f74ffa0b3..243e057be 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageHolder.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageHolder.java
@@ -33,9 +33,9 @@ import org.slf4j.ext.XLoggerFactory;
* implementation.
*
* @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <MESSAGE> the generic type of message being handled by a message holder instance
+ * @param <M> the generic type of message being handled by a message holder instance
*/
-public class MessageHolder<MESSAGE> implements Serializable {
+public class MessageHolder<M> implements Serializable {
private static final int HASH_PRIME = 31;
private static final int FOUR_BYTES = 32;
@@ -50,7 +50,7 @@ public class MessageHolder<MESSAGE> implements Serializable {
private final InetAddress senderHostAddress;
// Sequence of message in the message holder
- private final List<MESSAGE> messages;
+ private final List<M> messages;
/**
* Constructor, create the message holder.
@@ -69,7 +69,7 @@ public class MessageHolder<MESSAGE> implements Serializable {
*
* @return the messages
*/
- public List<MESSAGE> getMessages() {
+ public List<M> getMessages() {
return messages;
}
@@ -78,7 +78,7 @@ public class MessageHolder<MESSAGE> implements Serializable {
*
* @param message the message to add
*/
- public void addMessage(final MESSAGE message) {
+ public void addMessage(final M message) {
if (!messages.contains(message)) {
messages.add(message);
} else {
@@ -160,9 +160,6 @@ public class MessageHolder<MESSAGE> implements Serializable {
} else if (!messages.equals(other.messages)) {
return false;
}
- if (creationTime != other.creationTime) {
- return false;
- }
- return true;
+ return creationTime == other.creationTime;
}
}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageListener.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageListener.java
index c8b132423..0aab650d3 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageListener.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageListener.java
@@ -27,16 +27,16 @@ import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.M
* implements this interface.
*
* @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <MESSAGE> of message of any given type that is being listened for and handled
+ * @param <M> of message of any given type that is being listened for and handled
*/
-public interface MessageListener<MESSAGE> {
+public interface MessageListener<M> {
/**
* This method is called when a message block is received on a web socket and is to be forwarded to a listener.
*
* @param data the message data containing a message
*/
- void onMessage(MessageBlock<MESSAGE> data);
+ void onMessage(MessageBlock<M> data);
/**
* This method is called when a string message is received on a web socket and is to be forwarded to a listener.
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingService.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingService.java
index 7e91b95ea..352e70806 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingService.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingService.java
@@ -25,9 +25,9 @@ package org.onap.policy.apex.core.infrastructure.messaging;
* messaging.
*
* @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <MESSAGE> the type of message being passed by an implementation of Apex messaging
+ * @param <M> the type of message being passed by an implementation of Apex messaging
*/
-public interface MessagingService<MESSAGE> {
+public interface MessagingService<M> {
/**
* Start the messaging connection.
@@ -51,7 +51,7 @@ public interface MessagingService<MESSAGE> {
*
* @param messageHolder The message holder holding the messages to be sent
*/
- void send(MessageHolder<MESSAGE> messageHolder);
+ void send(MessageHolder<M> messageHolder);
/**
* Send a string message on the connection.
@@ -65,12 +65,12 @@ public interface MessagingService<MESSAGE> {
*
* @param messageListener the message listener
*/
- void addMessageListener(MessageListener<MESSAGE> messageListener);
+ void addMessageListener(MessageListener<M> messageListener);
/**
* Removes the message listener.
*
* @param messageListener the message listener
*/
- void removeMessageListener(MessageListener<MESSAGE> messageListener);
+ void removeMessageListener(MessageListener<M> messageListener);
}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingServiceFactory.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingServiceFactory.java
index 1d08fac74..b38b32f0e 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingServiceFactory.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingServiceFactory.java
@@ -30,9 +30,9 @@ import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.server.Message
* A factory class to create a "server" or "client" type Messaging Service.
*
* @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <MESSAGE> the generic type of message to be handled by this messaging service
+ * @param <M> the generic type of message to be handled by this messaging service
*/
-public class MessagingServiceFactory<MESSAGE> {
+public class MessagingServiceFactory<M> {
/**
* Create a web socket server instance and returns to the caller.
@@ -40,7 +40,7 @@ public class MessagingServiceFactory<MESSAGE> {
* @param address the address of the server machine
* @return the messaging service
*/
- public MessagingService<MESSAGE> createServer(final InetSocketAddress address) {
+ public MessagingService<M> createServer(final InetSocketAddress address) {
return new MessageServerImpl<>(address);
}
@@ -50,7 +50,7 @@ public class MessagingServiceFactory<MESSAGE> {
* @param uri the URI of the server to connect to
* @return an instance of {@link MessagingService}
*/
- public MessagingService<MESSAGE> createClient(final URI uri) {
+ public MessagingService<M> createClient(final URI uri) {
if (uri == null) {
throw new IllegalArgumentException("URI cannot be null");
}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java
index 7e9a31a4f..e0bf0ea6b 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java
@@ -20,6 +20,8 @@
package org.onap.policy.apex.core.infrastructure.messaging.impl.ws;
+import com.google.common.eventbus.Subscribe;
+
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
@@ -38,19 +40,20 @@ import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
-import com.google.common.eventbus.Subscribe;
-
/**
- * The Class RawMessageHandler handles raw messages being received on a Java web socket and forwards
- * the messages to the DataHandler instance that has subscribed to the RawMessageHandler instance.
+ * The Class RawMessageHandler handles raw messages being received on a Java web socket and forwards the messages to the
+ * DataHandler instance that has subscribed to the RawMessageHandler instance.
*
* @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <MESSAGE> the generic type of message being received
+ * @param <M> the generic type of message being received
*/
-public class RawMessageHandler<MESSAGE> implements WebSocketMessageListener<MESSAGE>, Runnable {
+public class RawMessageHandler<M> implements WebSocketMessageListener<M>, Runnable {
// The logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(RawMessageHandler.class);
+ // Repeated string constants
+ private static final String RAW_MESSAGE_LISTENING_INTERRUPTED = "raw message listening has been interrupted";
+
// The amount of time to sleep during shutdown for the thread of this message handler to stop
private static final int SHUTDOWN_WAIT_TIME = 10;
@@ -58,13 +61,13 @@ public class RawMessageHandler<MESSAGE> implements WebSocketMessageListener<MESS
private static final long QUEUE_POLL_TIMEOUT = 50;
// A queue that temporarily holds message blocks
- private final BlockingQueue<MessageBlock<MESSAGE>> messageBlockQueue = new LinkedBlockingDeque<>();
+ private final BlockingQueue<MessageBlock<M>> messageBlockQueue = new LinkedBlockingDeque<>();
// A queue that temporarily holds message blocks
private final BlockingQueue<String> stringMessageQueue = new LinkedBlockingDeque<>();
// Client applications that have subscribed for messages
- private final MessageBlockHandler<MESSAGE> dataHandler = new MessageBlockHandler<MESSAGE>("data-processor");
+ private final MessageBlockHandler<M> dataHandler = new MessageBlockHandler<>("data-processor");
// The thread that the raw message handler is receiving messages on
private Thread thisThread = null;
@@ -90,19 +93,19 @@ public class RawMessageHandler<MESSAGE> implements WebSocketMessageListener<MESS
// processing thread
try (final ByteArrayInputStream stream = new ByteArrayInputStream(dataByteBuffer.array());
- final ObjectInputStream ois = new ObjectInputStream(stream);) {
+ final ObjectInputStream ois = new ObjectInputStream(stream);) {
@SuppressWarnings("unchecked")
- final MessageHolder<MESSAGE> messageHolder = (MessageHolder<MESSAGE>) ois.readObject();
+ final MessageHolder<M> messageHolder = (MessageHolder<M>) ois.readObject();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("message {} recieved from the client {} ", messageHolder,
- messageHolder == null ? "Apex Engine " : messageHolder.getSenderHostAddress());
+ messageHolder == null ? "Apex Engine " : messageHolder.getSenderHostAddress());
}
if (messageHolder != null) {
- final List<MESSAGE> messages = messageHolder.getMessages();
+ final List<M> messages = messageHolder.getMessages();
if (messages != null) {
- messageBlockQueue.add(new MessageBlock<MESSAGE>(messages, incomingData.getConn()));
+ messageBlockQueue.add(new MessageBlock<M>(messages, incomingData.getConn()));
}
}
} catch (final IOException | ClassNotFoundException e) {
@@ -112,8 +115,7 @@ public class RawMessageHandler<MESSAGE> implements WebSocketMessageListener<MESS
}
/**
- * This method is called when a string message is received on a web socket and is to be
- * forwarded to a listener.
+ * This method is called when a string message is received on a web socket and is to be forwarded to a listener.
*
* @param messageString the message string
*/
@@ -130,6 +132,16 @@ public class RawMessageHandler<MESSAGE> implements WebSocketMessageListener<MESS
}
/**
+ * This method is called when a message is received on a web socket and is to be forwarded to a listener.
+ *
+ * @param data the message data containing a message
+ */
+ @Override
+ public void onMessage(final MessageBlock<M> data) {
+ throw new UnsupportedOperationException("this operation is not supported");
+ }
+
+ /**
* This thread monitors the message queue and processes messages as they appear on the queue.
*
* @see java.lang.Runnable#run()
@@ -143,14 +155,14 @@ public class RawMessageHandler<MESSAGE> implements WebSocketMessageListener<MESS
while (thisThread.isAlive() && !thisThread.isInterrupted()) {
try {
// Read message block messages from the queue and pass it to the data handler
- MessageBlock<MESSAGE> messageBlock = null;
+ MessageBlock<M> messageBlock = null;
while ((messageBlock = messageBlockQueue.poll(1, TimeUnit.MILLISECONDS)) != null) {
dataHandler.post(messageBlock);
}
} catch (final InterruptedException e) {
// restore the interrupt status
Thread.currentThread().interrupt();
- LOGGER.debug("raw message listening has been interrupted");
+ LOGGER.debug(RAW_MESSAGE_LISTENING_INTERRUPTED);
break;
}
@@ -163,7 +175,7 @@ public class RawMessageHandler<MESSAGE> implements WebSocketMessageListener<MESS
} catch (final InterruptedException e) {
// restore the interrupt status
Thread.currentThread().interrupt();
- LOGGER.debug("raw message listening has been interrupted");
+ LOGGER.debug(RAW_MESSAGE_LISTENING_INTERRUPTED);
break;
}
@@ -173,7 +185,7 @@ public class RawMessageHandler<MESSAGE> implements WebSocketMessageListener<MESS
} catch (final InterruptedException e) {
// restore the interrupt status
Thread.currentThread().interrupt();
- LOGGER.debug("raw message listening has been interrupted");
+ LOGGER.debug(RAW_MESSAGE_LISTENING_INTERRUPTED);
break;
}
}
@@ -199,23 +211,12 @@ public class RawMessageHandler<MESSAGE> implements WebSocketMessageListener<MESS
}
/**
- * This method is called when a message is received on a web socket and is to be forwarded to a
- * listener.
- *
- * @param data the message data containing a message
- */
- @Override
- public void onMessage(final MessageBlock<MESSAGE> data) {
- throw new UnsupportedOperationException("this operation is not supported");
- }
-
- /**
* Register a data forwarder to which messages coming in on the web socket will be forwarded.
*
* @param listener The listener to register
*/
@Override
- public void registerDataForwarder(final MessageListener<MESSAGE> listener) {
+ public void registerDataForwarder(final MessageListener<M> listener) {
stateCheck(listener);
dataHandler.registerMessageHandler(listener);
}
@@ -226,7 +227,7 @@ public class RawMessageHandler<MESSAGE> implements WebSocketMessageListener<MESS
* @param listener The listener to unregister
*/
@Override
- public void unRegisterDataForwarder(final MessageListener<MESSAGE> listener) {
+ public void unRegisterDataForwarder(final MessageListener<M> listener) {
stateCheck(listener);
dataHandler.unRegisterMessageHandler(listener);
}
@@ -236,7 +237,7 @@ public class RawMessageHandler<MESSAGE> implements WebSocketMessageListener<MESS
*
* @param listener the listener to check
*/
- private void stateCheck(final MessageListener<MESSAGE> listener) {
+ private void stateCheck(final MessageListener<M> listener) {
if (listener == null) {
throw new IllegalArgumentException("The listener object cannot be null");
}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/WebSocketMessageListener.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/WebSocketMessageListener.java
index aa951b4ec..529e887e4 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/WebSocketMessageListener.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/WebSocketMessageListener.java
@@ -30,10 +30,10 @@ import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.R
* object's appropriate method is invoked.
*
* @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <MESSAGE> the generic type
+ * @param <M> the generic type
* @see RawMessageBlock
*/
-public interface WebSocketMessageListener<MESSAGE> extends MessageListener<MESSAGE>, Runnable {
+public interface WebSocketMessageListener<M> extends MessageListener<M>, Runnable {
/**
* This method is called by the class with which this message listener has been registered.
@@ -47,12 +47,12 @@ public interface WebSocketMessageListener<MESSAGE> extends MessageListener<MESSA
*
* @param listener The listener to register
*/
- void registerDataForwarder(MessageListener<MESSAGE> listener);
+ void registerDataForwarder(MessageListener<M> listener);
/**
* Unregister a data forwarder that was previously registered on the web socket listener.
*
* @param listener The listener to unregister
*/
- void unRegisterDataForwarder(MessageListener<MESSAGE> listener);
+ void unRegisterDataForwarder(MessageListener<M> listener);
}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/InternalMessageBusClient.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/InternalMessageBusClient.java
index 9f7f89d8c..17391fb89 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/InternalMessageBusClient.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/InternalMessageBusClient.java
@@ -36,9 +36,9 @@ import org.slf4j.ext.XLoggerFactory;
* receive messages on the web socket.
*
* @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <MESSAGE> the generic type of message being handled
+ * @param <M> the generic type of message being handled
*/
-abstract class InternalMessageBusClient<MESSAGE> extends WebSocketClientImpl {
+abstract class InternalMessageBusClient<M> extends WebSocketClientImpl {
private static final int THREAD_FACTORY_STACK_SIZE = 256;
// The logger for this class
@@ -48,15 +48,15 @@ abstract class InternalMessageBusClient<MESSAGE> extends WebSocketClientImpl {
private static final String RAW_EVENT_BUS = "Raw-Event-Bus";
// This instance handles the raw data received from the web socket
- private final RawMessageHandler<MESSAGE> rawMessageHandler = new RawMessageHandler<>();
+ private final RawMessageHandler<M> rawMessageHandler = new RawMessageHandler<>();
// The message block handler to which to pass messages coming in on this client
- private MessageBlockHandler<MESSAGE> messageBlockHandler = null;
+ private MessageBlockHandler<M> messageBlockHandler = null;
// The raw message handler uses a thread to process incoming events off a queue, this class owns and controls that
// thread. These fields hold the thread and
// the thread factory for creating threads.
- private ApplicationThreadFactory tFactory =
+ private ApplicationThreadFactory threadFactory =
new ApplicationThreadFactory("ws-client-thread", THREAD_FACTORY_STACK_SIZE);
private Thread forwarderThread = null;
@@ -75,7 +75,7 @@ abstract class InternalMessageBusClient<MESSAGE> extends WebSocketClientImpl {
messageBlockHandler.registerMessageHandler(rawMessageHandler);
// Create the thread that manages the queue in the data handler
- forwarderThread = tFactory.newThread(rawMessageHandler);
+ forwarderThread = threadFactory.newThread(rawMessageHandler);
forwarderThread.start();
LOGGER.exit();
@@ -109,7 +109,7 @@ abstract class InternalMessageBusClient<MESSAGE> extends WebSocketClientImpl {
*
* @param listener a simple class, that listens for the events from Event
*/
- public void addMessageListener(final MessageListener<MESSAGE> listener) {
+ public void addMessageListener(final MessageListener<M> listener) {
rawMessageHandler.registerDataForwarder(listener);
}
@@ -118,7 +118,7 @@ abstract class InternalMessageBusClient<MESSAGE> extends WebSocketClientImpl {
*
* @param listener the listener
*/
- public void removeMessageListener(final MessageListener<MESSAGE> listener) {
+ public void removeMessageListener(final MessageListener<M> listener) {
rawMessageHandler.unRegisterDataForwarder(listener);
}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/MessagingClient.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/MessagingClient.java
index 36ad3b163..dd9aac122 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/MessagingClient.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/MessagingClient.java
@@ -33,9 +33,9 @@ import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
* message reception on the client side of a web socket in Apex.
*
* @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <MESSAGE> the generic type
+ * @param <M> the generic type
*/
-public class MessagingClient<MESSAGE> extends InternalMessageBusClient<MESSAGE> implements MessagingService<MESSAGE> {
+public class MessagingClient<M> extends InternalMessageBusClient<M> implements MessagingService<M> {
// The length of time to wait for a connection to a web socket server before aborting
private static final int CONNECTION_TIMEOUT_TIME_MS = 3000;
@@ -102,7 +102,7 @@ public class MessagingClient<MESSAGE> extends InternalMessageBusClient<MESSAGE>
*/
private boolean waitforConnection(final WebSocket connection) {
// The total time we have before timeout
- int timeoutMSCounter = CONNECTION_TIMEOUT_TIME_MS;
+ int timeoutMsCounter = CONNECTION_TIMEOUT_TIME_MS;
// Check the connection state
do {
@@ -112,7 +112,7 @@ public class MessagingClient<MESSAGE> extends InternalMessageBusClient<MESSAGE>
case CLOSING:
// Not connected yet so wait for the try interval
ThreadUtilities.sleep(CONNECTION_TRY_INTERVAL_MS);
- timeoutMSCounter -= CONNECTION_TRY_INTERVAL_MS;
+ timeoutMsCounter -= CONNECTION_TRY_INTERVAL_MS;
break;
case OPEN:
// Connection is open, happy days
@@ -125,7 +125,7 @@ public class MessagingClient<MESSAGE> extends InternalMessageBusClient<MESSAGE>
}
}
// While the timeout value has not expired
- while (timeoutMSCounter > 0);
+ while (timeoutMsCounter > 0);
// We have timed out
return false;
@@ -139,7 +139,7 @@ public class MessagingClient<MESSAGE> extends InternalMessageBusClient<MESSAGE>
* .core. infrastructure. messaging.MessageHolder)
*/
@Override
- public void send(final MessageHolder<MESSAGE> commands) {
+ public void send(final MessageHolder<M> commands) {
// Get the connection and send the message
final WebSocket connection = super.getConnection();
connection.send(MessagingUtils.serializeObject(commands));
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlock.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlock.java
index 70b1d2c3a..1c6852686 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlock.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlock.java
@@ -28,12 +28,12 @@ import org.java_websocket.WebSocket;
* This class encapsulate messages and the web socket on which they are handled.
*
* @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <MESSAGE> the generic type of message being handled
+ * @param <M> the generic type of message being handled
*/
-public final class MessageBlock<MESSAGE> {
+public final class MessageBlock<M> {
// List of Messages received on a web socket
- private final List<MESSAGE> messages;
+ private final List<M> messages;
// The web socket on which the messages are handled
private final WebSocket webSocket;
@@ -44,7 +44,7 @@ public final class MessageBlock<MESSAGE> {
* @param messages the messages in the message block
* @param webSocket the web socket used to handle the message block
*/
- public MessageBlock(final List<MESSAGE> messages, final WebSocket webSocket) {
+ public MessageBlock(final List<M> messages, final WebSocket webSocket) {
this.messages = messages;
this.webSocket = webSocket;
}
@@ -54,7 +54,7 @@ public final class MessageBlock<MESSAGE> {
*
* @return the messages
*/
- public List<MESSAGE> getMessages() {
+ public List<M> getMessages() {
return messages;
}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlockHandler.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlockHandler.java
index 4265718db..123305b07 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlockHandler.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlockHandler.java
@@ -31,9 +31,9 @@ import org.slf4j.ext.XLoggerFactory;
* event bus.
*
* @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <MESSAGE> the generic type
+ * @param <M> the generic type
*/
-public class MessageBlockHandler<MESSAGE> {
+public class MessageBlockHandler<M> {
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(MessageBlockHandler.class);
@@ -72,7 +72,7 @@ public class MessageBlockHandler<MESSAGE> {
*
* @param messageBlock the block containing typed messages
*/
- public void post(final MessageBlock<MESSAGE> messageBlock) {
+ public void post(final MessageBlock<M> messageBlock) {
if (messageBlock.getMessages() != null) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("new data message recieved from {}", messageBlock.getConnection() == null ? "server"
@@ -90,7 +90,7 @@ public class MessageBlockHandler<MESSAGE> {
public void post(final String messageString) {
if (messageString != null) {
if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("new string message recieved from server: " + messageString);
+ LOGGER.debug("new string message recieved from server: {}", messageString);
}
eventBus.post(messageString);
}
@@ -101,7 +101,7 @@ public class MessageBlockHandler<MESSAGE> {
*
* @param listener is an instance of WebSocketMessageListener
*/
- public void registerMessageHandler(final MessageListener<MESSAGE> listener) {
+ public void registerMessageHandler(final MessageListener<M> listener) {
LOGGER.entry(listener);
if (listener == null) {
throw new IllegalArgumentException("listener object cannot be null");
@@ -116,7 +116,7 @@ public class MessageBlockHandler<MESSAGE> {
*
* @param listener the listener
*/
- public void unRegisterMessageHandler(final MessageListener<MESSAGE> listener) {
+ public void unRegisterMessageHandler(final MessageListener<M> listener) {
if (listener == null) {
throw new IllegalArgumentException("listener object cannot be null");
}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/InternalMessageBusServer.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/InternalMessageBusServer.java
index 8e65bbf98..a436bd7e3 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/InternalMessageBusServer.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/InternalMessageBusServer.java
@@ -38,9 +38,9 @@ import org.slf4j.ext.XLoggerFactory;
* receive messages on the web socket.
*
* @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <MESSAGE> the generic type
+ * @param <M> the generic type
*/
-abstract class InternalMessageBusServer<MESSAGE> extends WebSocketServerImpl implements MessagingService<MESSAGE> {
+abstract class InternalMessageBusServer<M> extends WebSocketServerImpl implements MessagingService<M> {
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(InternalMessageBusServer.class);
@@ -50,15 +50,15 @@ abstract class InternalMessageBusServer<MESSAGE> extends WebSocketServerImpl imp
private static final String RAW_EVENT_BUS = "Raw-Event-Bus";
// This instance handles the raw data received from the web socket
- private final RawMessageHandler<MESSAGE> rawMessageHandler = new RawMessageHandler<>();
+ private final RawMessageHandler<M> rawMessageHandler = new RawMessageHandler<>();
// The message block handler to which to pass messages coming in on this client
- private MessageBlockHandler<MESSAGE> messageBlockHandler = null;
+ private MessageBlockHandler<M> messageBlockHandler = null;
// The raw message handler uses a thread to process incoming events off a queue, this class owns and controls that
// thread. These fields hold the thread and
// the thread factory for creating threads.
- private ApplicationThreadFactory tFactory =
+ private ApplicationThreadFactory threadFactory =
new ApplicationThreadFactory("ws-server-thread", THREAD_FACTORY_STACK_SIZE);
private Thread forwarderThread = null;
@@ -77,7 +77,7 @@ abstract class InternalMessageBusServer<MESSAGE> extends WebSocketServerImpl imp
messageBlockHandler.registerMessageHandler(rawMessageHandler);
// Create the thread that manages the queue in the data handler
- forwarderThread = tFactory.newThread(rawMessageHandler);
+ forwarderThread = threadFactory.newThread(rawMessageHandler);
forwarderThread.start();
LOGGER.exit();
@@ -95,13 +95,23 @@ abstract class InternalMessageBusServer<MESSAGE> extends WebSocketServerImpl imp
messageBlockHandler.post(new RawMessageBlock(rawMessage, webSocket));
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.java_websocket.server.WebSocketServer#onMessage(org.java_websocket.WebSocket, java.lang.String)
+ */
+ @Override
+ public void onMessage(final WebSocket webSocket, final String stringMessage) {
+ messageBlockHandler.post(stringMessage);
+ }
+
/**
* Register a subscriber class to the raw message handler.
*
* @param subscriber the subscriber
*/
@Override
- public void addMessageListener(final MessageListener<MESSAGE> subscriber) {
+ public void addMessageListener(final MessageListener<M> subscriber) {
rawMessageHandler.registerDataForwarder(subscriber);
}
@@ -111,20 +121,10 @@ abstract class InternalMessageBusServer<MESSAGE> extends WebSocketServerImpl imp
* @param subscriber the subscriber
*/
@Override
- public void removeMessageListener(final MessageListener<MESSAGE> subscriber) {
+ public void removeMessageListener(final MessageListener<M> subscriber) {
rawMessageHandler.unRegisterDataForwarder(subscriber);
}
- /*
- * (non-Javadoc)
- *
- * @see org.java_websocket.server.WebSocketServer#onMessage(org.java_websocket.WebSocket, java.lang.String)
- */
- @Override
- public void onMessage(final WebSocket webSocket, final String stringMessage) {
- messageBlockHandler.post(stringMessage);
- }
-
/**
* Stop the thread handling message forwarding.
*/
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/MessageServerImpl.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/MessageServerImpl.java
index 389d04dcc..d5ef40b5b 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/MessageServerImpl.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/MessageServerImpl.java
@@ -34,9 +34,9 @@ import org.slf4j.ext.XLoggerFactory;
* A messaging server implementation using web socket.
*
* @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <MESSAGE> the generic type of message being passed
+ * @param <M> the generic type of message being passed
*/
-public class MessageServerImpl<MESSAGE> extends InternalMessageBusServer<MESSAGE> {
+public class MessageServerImpl<M> extends InternalMessageBusServer<M> {
// The logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(MessageServerImpl.class);
@@ -44,7 +44,7 @@ public class MessageServerImpl<MESSAGE> extends InternalMessageBusServer<MESSAGE
private static final String PROTOCOL = "ws://";
// URI of this server
- private final String connectionURI;
+ private final String connectionUri;
// Indicates if the web socket server is started or not
private boolean isStarted = false;
@@ -60,8 +60,8 @@ public class MessageServerImpl<MESSAGE> extends InternalMessageBusServer<MESSAGE
LOGGER.entry(address);
// Compose the Web Socket URI
- connectionURI = PROTOCOL + address.getHostString() + ":" + address.getPort();
- LOGGER.debug("Server connection URI: {}", connectionURI);
+ connectionUri = PROTOCOL + address.getHostString() + ":" + address.getPort();
+ LOGGER.debug("Server connection URI: {}", connectionUri);
LOGGER.exit();
}
@@ -106,27 +106,25 @@ public class MessageServerImpl<MESSAGE> extends InternalMessageBusServer<MESSAGE
}
/**
- * This method returns the current connection URI , if the server started otherwise it throws
- * {@link IllegalStateException}.
+ * Return the current connection URI.
*
* @return connection URI
*/
- public String getConnectionURI() {
- if (connectionURI == null) {
+ public String getConnectionUrl() {
+ if (connectionUri == null) {
throw new IllegalStateException("URI not set - The server is not started");
}
- return connectionURI;
+ return connectionUri;
}
/*
* (non-Javadoc)
*
- * @see
- * org.onap.policy.apex.core.infrastructure.messaging.MessagingService#send(org.onap.policy.apex
- * .core. infrastructure. messaging.MessageHolder)
+ * @see org.onap.policy.apex.core.infrastructure.messaging.MessagingService#send(org.onap.policy.apex .core.
+ * infrastructure. messaging.MessageHolder)
*/
@Override
- public void send(final MessageHolder<MESSAGE> message) {
+ public void send(final MessageHolder<M> message) {
// Send the incoming message to all clients connected to this web socket
final Collection<WebSocket> connections = getConnections();
for (final WebSocket webSocket : connections) {
@@ -137,8 +135,7 @@ public class MessageServerImpl<MESSAGE> extends InternalMessageBusServer<MESSAGE
/*
* (non-Javadoc)
*
- * @see
- * org.onap.policy.apex.core.infrastructure.messaging.MessagingService#send(java.lang.String)
+ * @see org.onap.policy.apex.core.infrastructure.messaging.MessagingService#send(java.lang.String)
*/
@Override
public void send(final String messageString) {
@@ -160,6 +157,6 @@ public class MessageServerImpl<MESSAGE> extends InternalMessageBusServer<MESSAGE
@Override
public void onStart() {
- LOGGER.debug("started deployment server on URI: {}", connectionURI);
+ LOGGER.debug("started deployment server on URI: {}", connectionUri);
}
}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WSStringMessageClient.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageClient.java
index 00ade8047..28afde03b 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WSStringMessageClient.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageClient.java
@@ -37,15 +37,18 @@ import org.slf4j.ext.XLoggerFactory;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-public class WSStringMessageClient implements WSStringMessager {
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(WSStringMessageClient.class);
+public class WsStringMessageClient implements WsStringMessager {
+ private static final XLogger LOGGER = XLoggerFactory.getXLogger(WsStringMessageClient.class);
+
+ // Repeated string constants
+ private static final String MESSAGE_PREAMBLE = "web socket event consumer client to \"";
// Message service factory and the message service itself
private final MessagingServiceFactory<String> factory = new MessagingServiceFactory<>();
private MessagingService<String> service = null;
// The listener to use for reception of strings
- private WSStringMessageListener wsStringMessageListener;
+ private WsStringMessageListener wsStringMessageListener;
// Address of the server
private final String host;
@@ -58,7 +61,7 @@ public class WSStringMessageClient implements WSStringMessager {
* @param host the host of the server
* @param port the port of the server
*/
- public WSStringMessageClient(final String host, final int port) {
+ public WsStringMessageClient(final String host, final int port) {
this.host = host;
this.port = port;
}
@@ -71,22 +74,24 @@ public class WSStringMessageClient implements WSStringMessager {
* apex. core.infrastructure.messaging. stringmessaging.WSStringMessageListener)
*/
@Override
- public void start(final WSStringMessageListener newWsStringMessageListener) throws MessagingException {
+ public void start(final WsStringMessageListener newWsStringMessageListener) throws MessagingException {
this.wsStringMessageListener = newWsStringMessageListener;
uriString = "ws://" + host + ":" + port;
- LOGGER.entry("web socket event consumer client to \"" + uriString + "\" starting . . .");
+ String messagePreamble = MESSAGE_PREAMBLE + uriString + "\" ";
+ LOGGER.entry(messagePreamble + "starting . . .");
try {
service = factory.createClient(new URI(uriString));
- service.addMessageListener(new WSStringMessageClientListener());
+ service.addMessageListener(new WsStringMessageClientListener());
service.startConnection();
} catch (final Exception e) {
- LOGGER.warn("web socket event consumer client to \"" + uriString + "\" start failed", e);
- throw new MessagingException("web socket event consumer client to \"" + uriString + "\" start failed", e);
+ String message = messagePreamble + "start failed";
+ LOGGER.warn(message, e);
+ throw new MessagingException(message, e);
}
- LOGGER.exit("web socket event consumer client to \"" + uriString + "\" started");
+ LOGGER.exit(messagePreamble + "started");
}
/*
@@ -96,9 +101,9 @@ public class WSStringMessageClient implements WSStringMessager {
*/
@Override
public void stop() {
- LOGGER.entry("web socket event consumer client to \"" + uriString + "\" stopping . . .");
+ LOGGER.entry(MESSAGE_PREAMBLE + uriString + "\" stopping . . .");
service.stopConnection();
- LOGGER.exit("web socket event consumer client to \"" + uriString + "\" stopped");
+ LOGGER.exit(MESSAGE_PREAMBLE + uriString + "\" stopped");
}
/*
@@ -113,14 +118,15 @@ public class WSStringMessageClient implements WSStringMessager {
service.send(stringMessage);
if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("message sent to server: " + stringMessage);
+ String message = "message sent to server: " + stringMessage;
+ LOGGER.debug(message);
}
}
/**
* The Class WSStringMessageClientListener.
*/
- private class WSStringMessageClientListener implements MessageListener<String> {
+ private class WsStringMessageClientListener implements MessageListener<String> {
/*
* (non-Javadoc)
*
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WSStringMessageListener.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageListener.java
index e524b43d7..0a5e147cc 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WSStringMessageListener.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageListener.java
@@ -25,7 +25,7 @@ package org.onap.policy.apex.core.infrastructure.messaging.stringmessaging;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-public interface WSStringMessageListener {
+public interface WsStringMessageListener {
/**
* Receive a string coming off a web socket.
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WSStringMessageServer.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageServer.java
index 4da478f6a..3e8db268c 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WSStringMessageServer.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageServer.java
@@ -39,15 +39,15 @@ import org.slf4j.ext.XLoggerFactory;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-public class WSStringMessageServer implements WSStringMessager {
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(WSStringMessageServer.class);
+public class WsStringMessageServer implements WsStringMessager {
+ private static final XLogger LOGGER = XLoggerFactory.getXLogger(WsStringMessageServer.class);
// Message service factory and the message service itself
private final MessagingServiceFactory<String> factory = new MessagingServiceFactory<>();
private MessagingService<String> service = null;
// The listener to use for reception of strings
- private WSStringMessageListener wsStringMessageListener;
+ private WsStringMessageListener wsStringMessageListener;
// Address of the server
private final int port;
@@ -57,7 +57,7 @@ public class WSStringMessageServer implements WSStringMessager {
*
* @param port the port of the server
*/
- public WSStringMessageServer(final int port) {
+ public WsStringMessageServer(final int port) {
this.port = port;
}
@@ -69,19 +69,19 @@ public class WSStringMessageServer implements WSStringMessager {
* apex. core.infrastructure.messaging. stringmessaging.WSStringMessageListener)
*/
@Override
- public void start(final WSStringMessageListener newWsStringMessageListener) throws MessagingException {
+ public void start(final WsStringMessageListener newWsStringMessageListener) throws MessagingException {
this.wsStringMessageListener = newWsStringMessageListener;
LOGGER.entry("web socket event consumer server starting . . .");
try {
- final InetAddress addrLan = MessagingUtils.getLocalHostLANAddress();
+ final InetAddress addrLan = MessagingUtils.getLocalHostLanAddress();
LOGGER.debug("web socket string message server LAN address=" + addrLan.getHostAddress());
final InetAddress addr = InetAddress.getLocalHost();
LOGGER.debug("web socket string message server host address=" + addr.getHostAddress());
service = factory.createServer(new InetSocketAddress(port));
- service.addMessageListener(new WSStringMessageServerListener());
+ service.addMessageListener(new WsStringMessageServerListener());
service.startConnection();
} catch (final Exception e) {
@@ -115,14 +115,14 @@ public class WSStringMessageServer implements WSStringMessager {
public void sendString(final String stringMessage) {
service.send(stringMessage);
if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("server sent message: " + stringMessage);
+ LOGGER.debug("server sent message: {}", stringMessage);
}
}
/**
* The listener for strings coming into the server.
*/
- private class WSStringMessageServerListener implements MessageListener<String> {
+ private class WsStringMessageServerListener implements MessageListener<String> {
/*
* (non-Javadoc)
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WSStringMessager.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessager.java
index a2781e932..2a731b0eb 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WSStringMessager.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessager.java
@@ -27,7 +27,7 @@ import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-public interface WSStringMessager {
+public interface WsStringMessager {
/**
* Start the string message sender.
@@ -35,7 +35,7 @@ public interface WSStringMessager {
* @param wsStringMessageListener the listener to use for listening for string messages
* @throws MessagingException the messaging exception
*/
- void start(WSStringMessageListener wsStringMessageListener) throws MessagingException;
+ void start(WsStringMessageListener wsStringMessageListener) throws MessagingException;
/**
* Stop the string messaging sender.
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java
index 66edd2f1d..a501a66d6 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java
@@ -43,7 +43,7 @@ public final class MessagingUtils {
private static final int LOWEST_USER_PORT = 1024;
/**
- * Port number is an unsigned 16-bit integer, so maximum port is 65535
+ * Port number is an unsigned 16-bit integer, so maximum port is 65535.
*/
private static final int MAX_PORT_RANGE = 65535;
@@ -71,7 +71,7 @@ public final class MessagingUtils {
return port;
}
LOGGER.debug("Port {} is not available", port);
- throw new RuntimeException("could not allocate requested port: " + port);
+ throw new IllegalArgumentException("could not allocate requested port: " + port);
}
/**
@@ -96,7 +96,7 @@ public final class MessagingUtils {
LOGGER.debug("Port {} is not available", availablePort);
availablePort++;
}
- throw new RuntimeException("could not find free available");
+ throw new IllegalArgumentException("could not find free available");
}
/**
@@ -149,7 +149,7 @@ public final class MessagingUtils {
* @return an Internet address
* @throws UnknownHostException if the address of the local host cannot be found
*/
- public static InetAddress getLocalHostLANAddress() throws UnknownHostException {
+ public static InetAddress getLocalHostLanAddress() throws UnknownHostException {
try {
InetAddress candidateAddress = null;
// Iterate all NICs (network interface cards)...
@@ -225,8 +225,7 @@ public final class MessagingUtils {
} finally {
flushAndClose(oos, bytesOut);
}
- final byte[] bytes = bytesOut.toByteArray();
- return bytes;
+ return bytesOut.toByteArray();
}
/**
diff --git a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java
index 21c5ee984..c9d56ef2c 100644
--- a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java
+++ b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java
@@ -24,9 +24,9 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessageClient;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessageListener;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessageServer;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageClient;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageListener;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageServer;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
@@ -40,22 +40,22 @@ public class EndToEndStringMessagingTest {
// Logger for this class
private static final XLogger logger = XLoggerFactory.getXLogger(EndToEndStringMessagingTest.class);
- private WSStringMessageServer server;
- private WSStringMessageClient client;
+ private WsStringMessageServer server;
+ private WsStringMessageClient client;
private boolean finished = false;
@Test
public void testEndToEndMessaging() throws MessagingException {
logger.debug("end to end messaging test starting . . .");
- server = new WSStringMessageServer(44441);
+ server = new WsStringMessageServer(44441);
assertNotNull(server);
- server.start(new WSStringServerMessageListener());
+ server.start(new WsStringServerMessageListener());
try {
- client = new WSStringMessageClient("localhost", 44441);
+ client = new WsStringMessageClient("localhost", 44441);
assertNotNull(client);
- client.start(new WSStringClientMessageListener());
+ client.start(new WsStringClientMessageListener());
client.sendString("Hello, client here");
@@ -74,7 +74,7 @@ public class EndToEndStringMessagingTest {
logger.debug("end to end messaging test finished");
}
- private class WSStringServerMessageListener implements WSStringMessageListener {
+ private class WsStringServerMessageListener implements WsStringMessageListener {
@Override
public void receiveString(final String stringMessage) {
logger.debug(stringMessage);
@@ -83,7 +83,7 @@ public class EndToEndStringMessagingTest {
}
}
- private class WSStringClientMessageListener implements WSStringMessageListener {
+ private class WsStringClientMessageListener implements WsStringMessageListener {
@Override
public void receiveString(final String stringMessage) {
logger.debug(stringMessage);
diff --git a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/StringTestServer.java b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/StringTestServer.java
index 09fa62d59..30590c0c0 100644
--- a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/StringTestServer.java
+++ b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/StringTestServer.java
@@ -22,18 +22,29 @@ package org.onap.policy.apex.core.infrastructure.messaging;
import static org.junit.Assert.assertNotNull;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessageListener;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessageServer;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageListener;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageServer;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class StringTestServer.
+ */
public class StringTestServer {
- private WSStringMessageServer server;
+ private WsStringMessageServer server;
+ /**
+ * Create a string test server.
+ *
+ * @param port port to use
+ * @param timeToLive time to live
+ * @throws MessagingException exceptions on messages
+ */
public StringTestServer(final int port, long timeToLive) throws MessagingException {
System.out.println("StringTestServer starting on port " + port + " for " + timeToLive + " seconds . . .");
- server = new WSStringMessageServer(port);
+ server = new WsStringMessageServer(port);
assertNotNull(server);
- server.start(new WSStringServerMessageListener());
+ server.start(new WsStringServerMessageListener());
System.out.println("StringTestServer started on port " + port + " for " + timeToLive + " seconds");
@@ -45,7 +56,23 @@ public class StringTestServer {
System.out.println("StringTestServer completed");
}
- private class WSStringServerMessageListener implements WSStringMessageListener {
+ /**
+ * The listener interface for receiving WSStringServerMessage events. The class that is interested in processing a
+ * WSStringServerMessage event implements this interface, and the object created with that class is registered with
+ * a component using the component's <code>addWSStringServerMessageListener</code> method. When the
+ * WSStringServerMessage event occurs, that object's appropriate method is invoked.
+ *
+ * @see WSStringServerMessageEvent
+ */
+ private class WsStringServerMessageListener implements WsStringMessageListener {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageListener#receiveString(java
+ * .lang.String)
+ */
@Override
public void receiveString(final String stringMessage) {
System.out.println("Server received string \"" + stringMessage + "\"");
@@ -53,6 +80,12 @@ public class StringTestServer {
}
}
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ * @throws MessagingException the messaging exception
+ */
public static void main(final String[] args) throws MessagingException {
if (args.length != 2) {
System.err.println("Usage: StringTestServer port timeToLive");
diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java
index 5ff70d1af..21f240ba8 100644
--- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java
+++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java
@@ -150,7 +150,7 @@ public class TestAADMUseCase {
apexEngine.handleEvent(event);
EnEvent result = listener.getResult();
assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
- assertEquals("ExecutionIDs are different", event.getExecutionID(), result.getExecutionID());
+ assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
// no DOS_IN_eNodeB set so return probe action
assertTrue(result.get("ACTTASK").equals("probe"));
assertTrue((boolean) result.get("TCP_ON"));
@@ -188,7 +188,7 @@ public class TestAADMUseCase {
apexEngine.handleEvent(event);
result = listener.getResult();
assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
- assertEquals("ExecutionIDs are different", event.getExecutionID(), result.getExecutionID());
+ assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
// DOS_IN_eNodeB set to be more than throughput so return act action
assertTrue(result.get("ACTTASK").equals("act"));
// only one imsi was sent to process, so stop probe and tcp
@@ -226,7 +226,7 @@ public class TestAADMUseCase {
apexEngine.handleEvent(event);
result = listener.getResult();
assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
- assertEquals("ExecutionIDs are different", event.getExecutionID(), result.getExecutionID());
+ assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
assertTrue(result.get("ACTTASK").equals("probe"));
assertTrue((boolean) result.get("TCP_ON"));
assertTrue((boolean) result.get("PROBE_ON"));
@@ -261,7 +261,7 @@ public class TestAADMUseCase {
apexEngine.handleEvent(event);
result = listener.getResult();
assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
- assertEquals("ExecutionIDs are different", event.getExecutionID(), result.getExecutionID());
+ assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
assertTrue(result.get("ACTTASK").equals("act"));
assertTrue(!(boolean) result.get("TCP_ON"));
assertTrue(!(boolean) result.get("PROBE_ON"));
@@ -298,7 +298,7 @@ public class TestAADMUseCase {
apexEngine.handleEvent(event);
result = listener.getResult();
assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
- assertEquals("ExecutionIDs are different", event.getExecutionID(), result.getExecutionID());
+ assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
assertTrue(result.get("ACTTASK").equals("act"));
assertTrue(!(boolean) result.get("TCP_ON"));
assertTrue(!(boolean) result.get("PROBE_ON"));
@@ -331,7 +331,7 @@ public class TestAADMUseCase {
apexEngine.handleEvent(event);
result = listener.getResult();
assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
- assertEquals("ExecutionIDs are different", event.getExecutionID(), result.getExecutionID());
+ assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
assertTrue(result.get("ACTTASK").equals("probe"));
assertTrue((boolean) result.get("TCP_ON"));
assertTrue((boolean) result.get("PROBE_ON"));
@@ -369,7 +369,7 @@ public class TestAADMUseCase {
apexEngine.handleEvent(event);
result = listener.getResult();
assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
- assertEquals("ExecutionIDs are different", event.getExecutionID(), result.getExecutionID());
+ assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
assertTrue(result.get("ACTTASK").equals("probe"));
assertTrue((boolean) result.get("TCP_ON"));
assertTrue((boolean) result.get("PROBE_ON"));
@@ -402,7 +402,7 @@ public class TestAADMUseCase {
apexEngine.handleEvent(event);
result = listener.getResult();
assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
- assertEquals("ExecutionIDs are different", event.getExecutionID(), result.getExecutionID());
+ assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
assertTrue(result.get("ACTTASK").equals("probe"));
assertTrue((boolean) result.get("TCP_ON"));
assertTrue((boolean) result.get("PROBE_ON"));
@@ -424,7 +424,7 @@ public class TestAADMUseCase {
apexEngine.handleEvent(event);
result = listener.getResult();
assertTrue(result.getName().startsWith("SAPCBlacklistSubscriberEvent"));
- assertEquals("ExecutionIDs are different", event.getExecutionID(), result.getExecutionID());
+ assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
assertEquals(0L, result.get("IMSI"));
assertTrue(result.get("PROFILE").equals("ServiceA"));
assertTrue(result.get("BLACKLIST_ON").equals(false));
diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTslUseCase.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTslUseCase.java
index 1925a53f5..4b66eb116 100644
--- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTslUseCase.java
+++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTslUseCase.java
@@ -132,7 +132,7 @@ public class TestAnomalyDetectionTslUseCase {
apexEngine1.handleEvent(triggerEvent);
final EnEvent result = listener1.getResult();
LOGGER.info("Receiving action event {} ", result);
- assertEquals("ExecutionIDs are different", triggerEvent.getExecutionID(), result.getExecutionID());
+ assertEquals("ExecutionIDs are different", triggerEvent.getExecutionId(), result.getExecutionId());
triggerEvent.clear();
result.clear();
Thread.sleep(1);
diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTslUseCase.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTslUseCase.java
index ce9a07e16..632ae623e 100644
--- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTslUseCase.java
+++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTslUseCase.java
@@ -129,7 +129,7 @@ public class TestAutoLearnTslUseCase {
apexEngine1.handleEvent(triggerEvent);
final EnEvent result = listener1.getResult();
LOGGER.info("Receiving action event {} ", result);
- assertEquals("ExecutionIDs are different", triggerEvent.getExecutionID(), result.getExecutionID());
+ assertEquals("ExecutionIDs are different", triggerEvent.getExecutionId(), result.getExecutionId());
triggerEvent.clear();
result.clear();
Thread.sleep(1);
diff --git a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpUseCase.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpUseCase.java
index 0d6328286..ec5d9e0c9 100644
--- a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpUseCase.java
+++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpUseCase.java
@@ -149,7 +149,7 @@ public class TestMfpUseCase {
resulexpected =
fillResultEvent(axEventout, "examples/events/MyFirstPolicy/1/EventOut_BoozeItem_201713GMT.json");
assertEquals(resulexpected, resultout);
- assertEquals("ExecutionIDs are different", event.getExecutionID(), resultout.getExecutionID());
+ assertEquals("ExecutionIDs are different", event.getExecutionId(), resultout.getExecutionId());
event = fillTriggerEvent(axEventin, "examples/events/MyFirstPolicy/1/EventIn_NonBoozeItem_101309GMT.json");
apexEngine.handleEvent(event);
@@ -157,7 +157,7 @@ public class TestMfpUseCase {
resulexpected =
fillResultEvent(axEventout, "examples/events/MyFirstPolicy/1/EventOut_NonBoozeItem_101309GMT.json");
assertEquals(resulexpected, resultout);
- assertEquals("ExecutionIDs are different", event.getExecutionID(), resultout.getExecutionID());
+ assertEquals("ExecutionIDs are different", event.getExecutionId(), resultout.getExecutionId());
apexEngine.stop();
}
@@ -187,50 +187,50 @@ public class TestMfpUseCase {
EnEvent event = fillTriggerEvent(axEventin, "examples/events/MyFirstPolicy/1/EventIn_BoozeItem_084106GMT.json");
apexEngine.handleEvent(event);
EnEvent resultout = listener.getResult();
- EnEvent resulexpected =
+ EnEvent resultexpected =
fillResultEvent(axEventout, "examples/events/MyFirstPolicy/1/EventOut_BoozeItem_084106GMT.json");
- assertEquals(resulexpected, resultout);
- assertEquals("ExecutionIDs are different", event.getExecutionID(), resultout.getExecutionID());
+ assertEquals(resultexpected, resultout);
+ assertEquals("ExecutionIDs are different", event.getExecutionId(), resultout.getExecutionId());
event = fillTriggerEvent(axEventin, "examples/events/MyFirstPolicy/1/EventIn_BoozeItem_201713GMT.json");
apexEngine.handleEvent(event);
resultout = listener.getResult();
- resulexpected =
+ resultexpected =
fillResultEvent(axEventout, "examples/events/MyFirstPolicy/1/EventOut_BoozeItem_201713GMT.json");
- assertEquals(resulexpected, resultout);
- assertEquals("ExecutionIDs are different", event.getExecutionID(), resultout.getExecutionID());
+ assertEquals(resultexpected, resultout);
+ assertEquals("ExecutionIDs are different", event.getExecutionId(), resultout.getExecutionId());
event = fillTriggerEvent(axEventin, "examples/events/MyFirstPolicy/1/EventIn_NonBoozeItem_101309GMT.json");
apexEngine.handleEvent(event);
resultout = listener.getResult();
- resulexpected =
+ resultexpected =
fillResultEvent(axEventout, "examples/events/MyFirstPolicy/1/EventOut_NonBoozeItem_101309GMT.json");
- assertEquals(resulexpected, resultout);
- assertEquals("ExecutionIDs are different", event.getExecutionID(), resultout.getExecutionID());
+ assertEquals(resultexpected, resultout);
+ assertEquals("ExecutionIDs are different", event.getExecutionId(), resultout.getExecutionId());
event = fillTriggerEvent(axEventin, "examples/events/MyFirstPolicy/2/EventIn_BoozeItem_101433CET_thurs.json");
apexEngine.handleEvent(event);
resultout = listener.getResult();
- resulexpected =
+ resultexpected =
fillResultEvent(axEventout, "examples/events/MyFirstPolicy/2/EventOut_BoozeItem_101433CET_thurs.json");
- assertEquals(resulexpected, resultout);
- assertEquals("ExecutionIDs are different", event.getExecutionID(), resultout.getExecutionID());
+ assertEquals(resultexpected, resultout);
+ assertEquals("ExecutionIDs are different", event.getExecutionId(), resultout.getExecutionId());
event = fillTriggerEvent(axEventin, "examples/events/MyFirstPolicy/2/EventIn_BoozeItem_171937CET_sun.json");
apexEngine.handleEvent(event);
resultout = listener.getResult();
- resulexpected =
+ resultexpected =
fillResultEvent(axEventout, "examples/events/MyFirstPolicy/2/EventOut_BoozeItem_171937CET_sun.json");
- assertEquals(resulexpected, resultout);
- assertEquals("ExecutionIDs are different", event.getExecutionID(), resultout.getExecutionID());
+ assertEquals(resultexpected, resultout);
+ assertEquals("ExecutionIDs are different", event.getExecutionId(), resultout.getExecutionId());
event = fillTriggerEvent(axEventin, "examples/events/MyFirstPolicy/2/EventIn_NonBoozeItem_111309CET_mon.json");
apexEngine.handleEvent(event);
resultout = listener.getResult();
- resulexpected =
+ resultexpected =
fillResultEvent(axEventout, "examples/events/MyFirstPolicy/2/EventOut_NonBoozeItem_111309CET_mon.json");
- assertEquals(resulexpected, resultout);
- assertEquals("ExecutionIDs are different", event.getExecutionID(), resultout.getExecutionID());
+ assertEquals(resultexpected, resultout);
+ assertEquals("ExecutionIDs are different", event.getExecutionId(), resultout.getExecutionId());
apexEngine.stop();
}
diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelReader.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelReader.java
index ce2c9fc56..e76d00e12 100644
--- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelReader.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelReader.java
@@ -211,13 +211,13 @@ public class ApexModelReader<C extends AxConcept> {
if (validateFlag) {
// Validate the configuration file
final AxValidationResult validationResult = apexConcept.validate(new AxValidationResult());
- LOGGER.debug(validationResult.toString());
if (validationResult.isValid()) {
return apexConcept;
}
else {
- LOGGER.error("Apex concept validation failed" + validationResult.toString());
- throw new ApexModelException("Apex concept validation failed" + validationResult.toString());
+ String message = "Apex concept validation failed" + validationResult.toString();
+ LOGGER.error(message);
+ throw new ApexModelException(message);
}
}
else {
diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelWriter.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelWriter.java
index 977a8e7c6..6cc542270 100644
--- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelWriter.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelWriter.java
@@ -86,7 +86,8 @@ public class ApexModelWriter<C extends AxConcept> {
System.setProperty("javax.xml.bind.context.factory", "org.eclipse.persistence.jaxb.JAXBContextFactory");
try {
- final JAXBContext jaxbContext = JAXBContextFactory.createContext(new Class[] {rootConceptClass}, null);
+ final JAXBContext jaxbContext = JAXBContextFactory.createContext(new Class[]
+ { rootConceptClass }, null);
// Set up the unmarshaller to carry out validation
marshaller = jaxbContext.createMarshaller();
@@ -173,10 +174,11 @@ public class ApexModelWriter<C extends AxConcept> {
if (validateFlag) {
// Validate the concept first
final AxValidationResult validationResult = concept.validate(new AxValidationResult());
- LOGGER.debug(validationResult.toString());
if (!validationResult.isValid()) {
- LOGGER.warn(validationResult.toString());
- throw new ApexModelException("Apex concept xml (" + concept.getKey().getId() + ") validation failed");
+ String message = "Apex concept xml (" + concept.getKey().getId() + ") validation failed: "
+ + validationResult.toString();
+ LOGGER.warn(message);
+ throw new ApexModelException(message);
}
}
@@ -212,7 +214,7 @@ public class ApexModelWriter<C extends AxConcept> {
// Convert the cDataFieldSet into a space delimited string
domTransformer.setOutputProperty(OutputKeys.CDATA_SECTION_ELEMENTS,
- cdataFieldSet.toString().replaceAll("[\\[\\]\\,]", " "));
+ cdataFieldSet.toString().replaceAll("[\\[\\]\\,]", " "));
domTransformer.transform(new DOMSource(document), new StreamResult(apexConceptWriter));
} catch (JAXBException | TransformerException | ParserConfigurationException e) {
LOGGER.warn("Unable to marshal Apex concept XML", e);
@@ -221,7 +223,6 @@ public class ApexModelWriter<C extends AxConcept> {
LOGGER.debug("wrote Apex concept XML");
}
-
private Transformer getTransformer() throws TransformerConfigurationException {
// Transform the DOM to the output stream
final TransformerFactory transformerFactory = TransformerFactory.newInstance();
diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModel.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModel.java
index 81b3373e1..24c682de4 100644
--- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModel.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModel.java
@@ -225,8 +225,9 @@ public class TestApexModel<M extends AxModel> {
final AxValidationResult result = model.validate(new AxValidationResult());
if (!result.isValid()) {
- LOGGER.warn(MODEL_IS_INVALID + result.toString());
- throw new ApexException(MODEL_IS_INVALID + result.toString());
+ String message = MODEL_IS_INVALID + result.toString();
+ LOGGER.warn(message);
+ throw new ApexException(message);
}
LOGGER.debug("ran testApexModelVaid");
@@ -246,8 +247,9 @@ public class TestApexModel<M extends AxModel> {
final AxValidationResult result = model.validate(new AxValidationResult());
if (result.isValid()) {
- LOGGER.warn("model should not be valid " + result.toString());
- throw new ApexException("should not be valid " + result.toString());
+ String message = "model should not be valid " + result.toString();
+ LOGGER.warn(message);
+ throw new ApexException(message);
}
LOGGER.debug("ran testApexModelVaidateMalstructured");
@@ -267,8 +269,9 @@ public class TestApexModel<M extends AxModel> {
final AxValidationResult result = model.validate(new AxValidationResult());
if (!result.isValid()) {
- LOGGER.warn(MODEL_IS_INVALID + result.toString());
- throw new ApexException(MODEL_IS_INVALID + result.toString());
+ String message = MODEL_IS_INVALID + result.toString();
+ LOGGER.warn(message);
+ throw new ApexException(message);
}
if (!result.getValidationResult().equals(AxValidationResult.ValidationResult.OBSERVATION)) {
@@ -293,8 +296,9 @@ public class TestApexModel<M extends AxModel> {
final AxValidationResult result = model.validate(new AxValidationResult());
if (!result.isValid()) {
- LOGGER.warn(MODEL_IS_INVALID + result.toString());
- throw new ApexException(MODEL_IS_INVALID + result.toString());
+ String message = MODEL_IS_INVALID + result.toString();
+ LOGGER.warn(message);
+ throw new ApexException(message);
}
if (!result.getValidationResult().equals(AxValidationResult.ValidationResult.WARNING)) {
@@ -319,8 +323,9 @@ public class TestApexModel<M extends AxModel> {
final AxValidationResult result = model.validate(new AxValidationResult());
if (result.isValid()) {
- LOGGER.warn("model should not be valid " + result.toString());
- throw new ApexException("should not be valid " + result.toString());
+ String message = "model should not be valid " + result.toString();
+ LOGGER.warn(message);
+ throw new ApexException(message);
}
LOGGER.debug("ran testApexModelVaidateInvalidModel");
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java
index 9ced9d84b..905f9e16b 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java
@@ -73,13 +73,13 @@ public class TestBasicModelTest {
testApexModel.testApexModelVaidateInvalidModel();
fail("Test should throw an exception");
} catch (final Exception e) {
- assertEquals("should not be valid ***validation of model successful***", e.getMessage());
+ assertEquals("model should not be valid ***validation of model successful***", e.getMessage());
}
try {
testApexModel.testApexModelVaidateMalstructured();
fail("Test should throw an exception");
} catch (final Exception e) {
- assertEquals("should not be valid ***validation of model successful***", e.getMessage());
+ assertEquals("model should not be valid ***validation of model successful***", e.getMessage());
}
}
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java
index 648194a52..57c30db11 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java
@@ -38,57 +38,54 @@ public class TestModelWriter {
@Test
public void testModelWriter() throws IOException, ApexException {
ApexModelWriter<AxModel> modelWriter = new ApexModelWriter<AxModel>(AxModel.class);
-
+
modelWriter.setValidateFlag(true);
assertTrue(modelWriter.getValidateFlag());
assertEquals(0, modelWriter.getCDataFieldSet().size());
-
+
assertFalse(modelWriter.isJsonOutput());
modelWriter.setJsonOutput(true);
assertTrue(modelWriter.isJsonOutput());
modelWriter.setJsonOutput(false);
assertFalse(modelWriter.isJsonOutput());
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
AxModel model = new TestApexBasicModelCreator().getModel();
-
+
modelWriter.write(model, baos);
modelWriter.setJsonOutput(true);
modelWriter.write(model, baos);
modelWriter.setJsonOutput(false);
-
+
modelWriter.setValidateFlag(false);
modelWriter.write(model, baos);
modelWriter.setJsonOutput(true);
modelWriter.write(model, baos);
modelWriter.setJsonOutput(false);
-
+
modelWriter.setValidateFlag(true);
model.getKeyInformation().getKeyInfoMap().clear();
try {
modelWriter.write(model, baos);
fail("Test should throw an exception here");
- }
- catch (Exception e) {
- assertEquals("Apex concept xml (BasicModel:0.0.1) validation failed", e.getMessage());
+ } catch (Exception e) {
+ assertEquals("Apex concept xml (BasicModel:0.0.1) validation failed", e.getMessage().substring(0, 53));
}
model.getKeyInformation().generateKeyInfo(model);
try {
modelWriter.write(null, baos);
fail("Test should throw an exception here");
- }
- catch (Exception e) {
+ } catch (Exception e) {
assertEquals("concept may not be null", e.getMessage());
}
-
+
try {
ByteArrayOutputStream nullBaos = null;
modelWriter.write(model, nullBaos);
fail("Test should throw an exception here");
- }
- catch (Exception e) {
+ } catch (Exception e) {
assertEquals("concept stream may not be null", e.getMessage());
}
}
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java
index 9df11ae25..cd452cae1 100644
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java
@@ -135,6 +135,9 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
* @param parent the parent object of this object in the unmarshaler
*/
public void afterUnmarshal(final Unmarshaller unmarsaller, final Object parent) {
+ Assertions.argumentNotNull(unmarsaller, "unmarsaller should not be null");
+ Assertions.argumentNotNull(parent, "parent should not be null");
+
// The map must be navigable to allow name and version searching, unmarshaling returns a
// hash map
final NavigableMap<AxArtifactKey, AxContextAlbum> navigableAlbums = new TreeMap<>();
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyLogicReader.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyLogicReader.java
index 822a803bf..aa57be552 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyLogicReader.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyLogicReader.java
@@ -143,8 +143,9 @@ public class PolicyLogicReader implements AxLogicReader {
// Check if the logic was found
if (logicString == null || logicString.length() == 0) {
- LOGGER.warn("logic not found for logic \"" + fullLogicFilePath + "\"");
- throw new PolicyRuntimeException("logic not found for logic \"" + fullLogicFilePath + "\"");
+ String errorMessage = "logic not found for logic \"" + fullLogicFilePath + "\"";
+ LOGGER.warn(errorMessage);
+ throw new PolicyRuntimeException(errorMessage);
}
// Return the right trimmed logic string
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelMerger.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelMerger.java
index 091f20462..28133cefa 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelMerger.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelMerger.java
@@ -80,8 +80,9 @@ public final class PolicyModelMerger {
final AxValidationResult leftValidationResult = new AxValidationResult();
leftPolicyModel.validate(leftValidationResult);
if (!leftValidationResult.isValid()) {
- LOGGER.warn("left model is invalid: " + leftValidationResult.toString());
- throw new ApexModelException("left model is invalid: " + leftValidationResult.toString());
+ String message = "left model is invalid: " + leftValidationResult.toString();
+ LOGGER.warn(message);
+ throw new ApexModelException(message);
}
}
@@ -90,13 +91,14 @@ public final class PolicyModelMerger {
final AxValidationResult rightValidationResult = new AxValidationResult();
rightPolicyModel.validate(rightValidationResult);
if (!rightValidationResult.isValid()) {
- LOGGER.warn("right model is invalid: " + rightValidationResult.toString());
- throw new ApexModelException("right model is invalid: " + rightValidationResult.toString());
+ String message = "right model is invalid: " + rightValidationResult.toString();
+ LOGGER.warn(message);
+ throw new ApexModelException(message);
}
}
// The new policy model uses the favoured copy side as its base
- final AxPolicyModel mergedPolicyModel = (AxPolicyModel) (useLeftOnMatches ? new AxPolicyModel(leftPolicyModel)
+ final AxPolicyModel mergedPolicyModel = (useLeftOnMatches ? new AxPolicyModel(leftPolicyModel)
: new AxPolicyModel(rightPolicyModel));
// The Compared to policy model is the unfavoured side
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitter.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitter.java
index 586d0706e..7ecb8fb0f 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitter.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitter.java
@@ -77,8 +77,9 @@ public final class PolicyModelSplitter {
final AxValidationResult sourceValidationResult = new AxValidationResult();
sourcePolicyModel.validate(sourceValidationResult);
if (!sourceValidationResult.isValid()) {
- LOGGER.warn("source model is invalid: " + sourceValidationResult.toString());
- throw new ApexModelException("source model is invalid: " + sourceValidationResult.toString());
+ String message = "source model is invalid: " + sourceValidationResult.toString();
+ LOGGER.warn(message);
+ throw new ApexModelException(message);
}
}
@@ -103,7 +104,7 @@ public final class PolicyModelSplitter {
for (final AxArtifactKey subPolicyKey : subPolicies) {
final AxPolicy subPolicy = sourcePolicyModel.getPolicies().getPolicyMap().get(subPolicyKey);
if (subPolicy == null) {
- LOGGER.warn("source sub policy not found: " + subPolicyKey);
+ LOGGER.warn("source sub policy not found: {}", subPolicyKey);
continue;
}
diff --git a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributor.java b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributor.java
index 9f1327df1..c8b1cedce 100644
--- a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributor.java
+++ b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributor.java
@@ -59,7 +59,7 @@ public class InfinispanContextDistributor extends AbstractDistributor {
* (non-Javadoc)
*
* @see
- * com.ericsson.apex.context.impl.distribution.AbstractContextDistributor#init(com.ericsson.apex
+ * org.onap.policy.apex.context.impl.distribution.AbstractContextDistributor#init(org.onap.policy.apex
* .model.basicmodel.concepts.AxArtifactKey)
*/
@Override
@@ -86,8 +86,8 @@ public class InfinispanContextDistributor extends AbstractDistributor {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.core.context.impl.distribution.AbstractContextDistributor#
- * getContextAlbumMap(com.ericsson.apex.core.model.concepts.AxArtifactKey)
+ * @see org.onap.policy.apex.core.context.impl.distribution.AbstractContextDistributor#
+ * getContextAlbumMap(org.onap.policy.apex.core.model.concepts.AxArtifactKey)
*/
@Override
public Map<String, Object> getContextAlbumMap(final AxArtifactKey contextAlbumKey) {
@@ -103,7 +103,7 @@ public class InfinispanContextDistributor extends AbstractDistributor {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.core.context.impl.distribution.AbstractContextDistributor#shutdown()
+ * @see org.onap.policy.apex.core.context.impl.distribution.AbstractContextDistributor#shutdown()
*/
@Override
public void shutdown() {
diff --git a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanDistributorParameters.java b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanDistributorParameters.java
index 539a732cf..16fdd85ac 100644
--- a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanDistributorParameters.java
+++ b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanDistributorParameters.java
@@ -131,7 +131,7 @@ public class InfinispanDistributorParameters extends DistributorParameters {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.context.parameters.DistributorParameters#toString()
+ * @see org.onap.policy.apex.context.parameters.DistributorParameters#toString()
*/
@Override
public String toString() {
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/AAIInventoryResponseItemType.avsc b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/AAIInventoryResponseItemType.avsc
index d4ae592a1..e64d0e36a 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/AAIInventoryResponseItemType.avsc
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/AAIInventoryResponseItemType.avsc
@@ -1,70 +1,70 @@
{
- "type": "array",
- "items": {
- "type": "record",
- "name": "AAIInventoryResponseItem_Type",
- "fields": [
- {
- "name": "model_DasH_name",
- "type": "string"
- },
- {
- "name": "extra_DasH_properties",
- "type": {
- "type": "record",
- "name": "AAIInventoryResponseItemExtraProperties_Type",
- "fields": []
- }
- },
- {
- "name": "generic_DasH_vnf",
- "type": {
- "type": "record",
- "name": "AAIInventoryResponseItemGenericVNF_Type",
- "fields": [
- {
- "name": "vnf_DasH_id",
- "type": "string"
- },
- {
- "name": "vnf_DasH_name",
- "type": "string"
- },
- {
- "name": "vnf_DasH_type",
- "type": "string"
- },
- {
- "name": "service_DasH_id",
- "type": "string"
- },
- {
- "name": "orchestration_DasH_status",
- "type": "string"
- },
- {
- "name": "in_DasH_maint",
- "type": "boolean"
- },
- {
- "name": "is_DasH_closed_DasH_loop_DasH_disabled",
- "type": "boolean"
- },
- {
- "name": "resource_DasH_version",
- "type": "string"
- },
- {
- "name": "model_DasH_invariant_DasH_id",
- "type": "string"
- },
- {
- "name": "model_DasH_version_DasH_id",
- "type": "string"
- }
- ]
- }
- }
- ]
- }
+ "type": "array",
+ "items": {
+ "type": "record",
+ "name": "AAIInventoryResponseItem_Type",
+ "fields": [
+ {
+ "name": "model_DasH_name",
+ "type": "string"
+ },
+ {
+ "name": "extra_DasH_properties",
+ "type": {
+ "type": "record",
+ "name": "AAIInventoryResponseItemExtraProperties_Type",
+ "fields": []
+ }
+ },
+ {
+ "name": "generic_DasH_vnf",
+ "type": {
+ "type": "record",
+ "name": "AAIInventoryResponseItemGenericVNF_Type",
+ "fields": [
+ {
+ "name": "vnf_DasH_id",
+ "type": "string"
+ },
+ {
+ "name": "vnf_DasH_name",
+ "type": "string"
+ },
+ {
+ "name": "vnf_DasH_type",
+ "type": "string"
+ },
+ {
+ "name": "service_DasH_id",
+ "type": "string"
+ },
+ {
+ "name": "orchestration_DasH_status",
+ "type": "string"
+ },
+ {
+ "name": "in_DasH_maint",
+ "type": "boolean"
+ },
+ {
+ "name": "is_DasH_closed_DasH_loop_DasH_disabled",
+ "type": "boolean"
+ },
+ {
+ "name": "resource_DasH_version",
+ "type": "string"
+ },
+ {
+ "name": "model_DasH_invariant_DasH_id",
+ "type": "string"
+ },
+ {
+ "name": "model_DasH_version_DasH_id",
+ "type": "string"
+ }
+ ]
+ }
+ }
+ ]
+ }
}
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/ArrayExampleAddress.avsc b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/ArrayExampleAddress.avsc
index 0967d6210..b3f154542 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/ArrayExampleAddress.avsc
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/ArrayExampleAddress.avsc
@@ -1,10 +1,10 @@
{
- "type": "array", "items": {
- "type" : "record",
- "name" : "AddressUSRecord",
- "fields" : [
- {"name": "streetaddress", "type": "string"},
- {"name": "city", "type": "string"}
- ]
- }
+ "type": "array", "items": {
+ "type" : "record",
+ "name" : "AddressUSRecord",
+ "fields" : [
+ {"name": "streetaddress", "type": "string"},
+ {"name": "city", "type": "string"}
+ ]
+ }
} \ No newline at end of file
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/ArrayExampleLong.avsc b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/ArrayExampleLong.avsc
index 91f391a89..2ff82f51f 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/ArrayExampleLong.avsc
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/ArrayExampleLong.avsc
@@ -1,3 +1,3 @@
{
- "type": "array", "items": "long"
+ "type": "array", "items": "long"
} \ No newline at end of file
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/EnumSchema.avsc b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/EnumSchema.avsc
index ea5c5b7b1..a698923bb 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/EnumSchema.avsc
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/EnumSchema.avsc
@@ -1,5 +1,5 @@
{
- "type": "enum",
- "name": "Suit",
- "symbols" : ["SPADES", "HEARTS", "DIAMONDS", "CLUBS"]
+ "type": "enum",
+ "name": "Suit",
+ "symbols" : ["SPADES", "HEARTS", "DIAMONDS", "CLUBS"]
} \ No newline at end of file
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/FixedSchema.avsc b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/FixedSchema.avsc
index 4642ef577..49c837cf4 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/FixedSchema.avsc
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/FixedSchema.avsc
@@ -1,5 +1,5 @@
{
- "type" : "fixed",
- "name" : "binaryData",
- "size" : 64
+ "type" : "fixed",
+ "name" : "binaryData",
+ "size" : 64
} \ No newline at end of file
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/HealthCheckBodyType.avsc b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/HealthCheckBodyType.avsc
index 2db1d696d..28071488b 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/HealthCheckBodyType.avsc
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/HealthCheckBodyType.avsc
@@ -1,76 +1,76 @@
{
- "type" : "record",
- "name" : "HealthCheckBody_Type",
- "namespace" : "com.ericsson.apex.onap.tlgoal2017",
- "fields" : [
- {
- "name": "input",
- "type": {
- "type" : "record",
- "name" : "InputRecord",
- "fields" : [
- {
- "name": "action", "type": "string"
- },
- {
- "name": "action_DasH_identifiers",
- "type": {
- "type" : "record",
- "name" : "ActionIdentifiersRecord",
- "fields" : [
- {
- "name": "vnf_DasH_id", "type": "string"
- }
- ]
- }
- },
- {
- "name": "common_DasH_header",
- "type": {
- "type" : "record",
- "name" : "CommonHeaderRecord",
- "fields" : [
- {
- "name": "request_DasH_id", "type": "string"
- },
- {
- "name": "originator_DasH_id", "type": "string"
- },
- {
- "name": "api_DasH_ver", "type": "string"
- },
- {
- "name": "sub_DasH_request_DasH_id", "type": "string"
- },
- {
- "name": "timestamp", "type": "string"
- },
- {
- "name": "flags",
- "type": {
- "type" : "record",
- "name" : "FlagsRecord",
- "fields" : [
- {
- "name": "ttl", "type": "string"
- },
- {
- "name": "force", "type": "string"
- },
- {
- "name": "mode", "type": "string"
- }
- ]
- }
- }
- ]
- }
- },
- {
- "name": "payload", "type": "string"
- }
- ]
- }
- }
- ]
+ "type" : "record",
+ "name" : "HealthCheckBody_Type",
+ "namespace" : "org.onap.policy.apex.onap.tlgoal2017",
+ "fields" : [
+ {
+ "name": "input",
+ "type": {
+ "type" : "record",
+ "name" : "InputRecord",
+ "fields" : [
+ {
+ "name": "action", "type": "string"
+ },
+ {
+ "name": "action_DasH_identifiers",
+ "type": {
+ "type" : "record",
+ "name" : "ActionIdentifiersRecord",
+ "fields" : [
+ {
+ "name": "vnf_DasH_id", "type": "string"
+ }
+ ]
+ }
+ },
+ {
+ "name": "common_DasH_header",
+ "type": {
+ "type" : "record",
+ "name" : "CommonHeaderRecord",
+ "fields" : [
+ {
+ "name": "request_DasH_id", "type": "string"
+ },
+ {
+ "name": "originator_DasH_id", "type": "string"
+ },
+ {
+ "name": "api_DasH_ver", "type": "string"
+ },
+ {
+ "name": "sub_DasH_request_DasH_id", "type": "string"
+ },
+ {
+ "name": "timestamp", "type": "string"
+ },
+ {
+ "name": "flags",
+ "type": {
+ "type" : "record",
+ "name" : "FlagsRecord",
+ "fields" : [
+ {
+ "name": "ttl", "type": "string"
+ },
+ {
+ "name": "force", "type": "string"
+ },
+ {
+ "name": "mode", "type": "string"
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "payload", "type": "string"
+ }
+ ]
+ }
+ }
+ ]
}
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/MapExampleAddress.avsc b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/MapExampleAddress.avsc
index f8457c690..5728fef62 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/MapExampleAddress.avsc
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/MapExampleAddress.avsc
@@ -1,10 +1,10 @@
{
- "type": "map", "values": {
- "type" : "record",
- "name" : "AddressUSRecord",
- "fields" : [
- {"name": "streetaddress", "type": "string"},
- {"name": "city", "type": "string"}
- ]
- }
+ "type": "map", "values": {
+ "type" : "record",
+ "name" : "AddressUSRecord",
+ "fields" : [
+ {"name": "streetaddress", "type": "string"},
+ {"name": "city", "type": "string"}
+ ]
+ }
} \ No newline at end of file
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/MapExampleAddressInvalidFields.avsc b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/MapExampleAddressInvalidFields.avsc
index 48c476065..ddffb4bbc 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/MapExampleAddressInvalidFields.avsc
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/MapExampleAddressInvalidFields.avsc
@@ -1,10 +1,10 @@
{
- "type": "map", "values": {
- "type" : "record",
- "name" : "AddressUSRecord",
- "fields" : [
- {"name": "street_DasH_address", "type": "string"},
- {"name": "the_DoT_city", "type": "string"}
- ]
- }
+ "type": "map", "values": {
+ "type" : "record",
+ "name" : "AddressUSRecord",
+ "fields" : [
+ {"name": "street_DasH_address", "type": "string"},
+ {"name": "the_DoT_city", "type": "string"}
+ ]
+ }
} \ No newline at end of file
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/MapExampleLong.avsc b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/MapExampleLong.avsc
index 0bb3729ed..5717ee47e 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/MapExampleLong.avsc
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/MapExampleLong.avsc
@@ -1,3 +1,3 @@
{
- "type": "map", "values": "long"
+ "type": "map", "values": "long"
} \ No newline at end of file
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExample.avsc b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExample.avsc
index 274735532..9790e6c8e 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExample.avsc
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExample.avsc
@@ -1,172 +1,172 @@
{
- "type": "record",
- "name": "User",
- "namespace": "com.example.avro",
- "doc": "This is a user record in a fictitious to-do-list management app. It supports arbitrary grouping and nesting of items, and allows you to add items by email or by tweeting.\n\nNote this app doesn't actually exist. The schema is just a demo for [Avrodoc](https://github.com/ept/avrodoc)!",
- "fields": [
+ "type": "record",
+ "name": "User",
+ "namespace": "com.example.avro",
+ "doc": "This is a user record in a fictitious to-do-list management app. It supports arbitrary grouping and nesting of items, and allows you to add items by email or by tweeting.\n\nNote this app doesn't actually exist. The schema is just a demo for [Avrodoc](https://github.com/ept/avrodoc)!",
+ "fields": [
{"name": "firstname", "type": "string"},
{"name": "lastname", "type": "string"},
- {
- "name": "address",
- "type": {
- "type" : "record",
- "name" : "AddressUSRecord",
- "fields" : [
- {"name": "streetaddress", "type": "string"},
- {"name": "city", "type": "string"}
- ]
- }
- },
- {
- "name": "id",
- "doc": "System-assigned numeric user ID. Cannot be changed by the user.",
- "type": "int"
- },
- {
- "name": "username",
- "doc": "The username chosen by the user. Can be changed by the user.",
- "type": "string"
- },
- {
- "name": "passwordHash",
- "doc": "The user's password, hashed using [scrypt](http://www.tarsnap.com/scrypt.html).",
- "type": "string"
- },
- {
- "name": "signupDate",
- "doc": "Timestamp (milliseconds since epoch) when the user signed up",
- "type": "long"
- },
- {
- "name": "emailAddresses",
- "doc": "All email addresses on the user's account",
- "type": {
- "type": "array",
- "items": {
- "type": "record",
- "name": "EmailAddress",
- "doc": "Stores details about an email address that a user has associated with their account.",
- "fields": [
- {
- "name": "address",
- "doc": "The email address, e.g. `foo@example.com`",
- "type": "string"
- },
- {
- "name": "verified",
- "doc": "true if the user has clicked the link in a confirmation email to this address.",
- "type": "boolean",
- "default": false
- },
- {
- "name": "dateAdded",
- "doc": "Timestamp (milliseconds since epoch) when the email address was added to the account.",
- "type": "long"
- },
- {
- "name": "dateBounced",
- "doc": "Timestamp (milliseconds since epoch) when an email sent to this address last bounced. Reset to null when the address no longer bounces.",
- "type": ["null", "long"]
- }
- ]
- }
- }
- },
- {
- "name": "twitterAccounts",
- "doc": "All Twitter accounts that the user has OAuthed",
- "type": {
- "type": "array",
- "items": {
- "type": "record",
- "name": "TwitterAccount",
- "doc": "Stores access credentials for one Twitter account, as granted to us by the user by OAuth.",
- "fields": [
- {
- "name": "status",
- "doc": "Indicator of whether this authorization is currently active, or has been revoked",
- "type": {
- "type": "enum",
- "name": "OAuthStatus",
- "doc": "* `PENDING`: the user has started authorizing, but not yet finished\n* `ACTIVE`: the token should work\n* `DENIED`: the user declined the authorization\n* `EXPIRED`: the token used to work, but now it doesn't\n* `REVOKED`: the user has explicitly revoked the token",
- "symbols": ["PENDING", "ACTIVE", "DENIED", "EXPIRED", "REVOKED"]
- }
- },
- {
- "name": "userId",
- "doc": "Twitter's numeric ID for this user",
- "type": "long"
- },
- {
- "name": "screenName",
- "doc": "The twitter username for this account (can be changed by the user)",
- "type": "string"
- },
- {
- "name": "oauthToken",
- "doc": "The OAuth token for this Twitter account",
- "type": "string"
- },
- {
- "name": "oauthTokenSecret",
- "doc": "The OAuth secret, used for signing requests on behalf of this Twitter account. `null` whilst the OAuth flow is not yet complete.",
- "type": ["null", "string"]
- },
- {
- "name": "dateAuthorized",
- "doc": "Timestamp (milliseconds since epoch) when the user last authorized this Twitter account",
- "type": "long"
- }
- ]
- }
- }
- },
- {
- "name": "toDoItems",
- "doc": "The top-level items in the user's to-do list",
- "type": {
- "type": "array",
- "items": {
- "type": "record",
- "name": "ToDoItem",
- "doc": "A record is one node in a To-Do item tree (every record can contain nested sub-records).",
- "fields": [
- {
- "name": "status",
- "doc": "User-selected state for this item (e.g. whether or not it is marked as done)",
- "type": {
- "type": "enum",
- "name": "ToDoStatus",
- "doc": "* `HIDDEN`: not currently visible, e.g. because it becomes actionable in future\n* `ACTIONABLE`: appears in the current to-do list\n* `DONE`: marked as done, but still appears in the list\n* `ARCHIVED`: marked as done and no longer visible\n* `DELETED`: not done and removed from list (preserved for undo purposes)",
- "symbols": ["HIDDEN", "ACTIONABLE", "DONE", "ARCHIVED", "DELETED"]
- }
- },
- {
- "name": "title",
- "doc": "One-line summary of the item",
- "type": "string"
- },
- {
- "name": "description",
- "doc": "Detailed description (may contain HTML markup)",
- "type": ["null", "string"]
- },
- {
- "name": "snoozeDate",
- "doc": "Timestamp (milliseconds since epoch) at which the item should go from `HIDDEN` to `ACTIONABLE` status",
- "type": ["null", "long"]
- },
- {
- "name": "subItems",
- "doc": "List of children of this to-do tree node",
- "type": {
- "type": "array",
- "items": "ToDoItem"
- }
- }
- ]
- }
- }
- }
- ]
+ {
+ "name": "address",
+ "type": {
+ "type" : "record",
+ "name" : "AddressUSRecord",
+ "fields" : [
+ {"name": "streetaddress", "type": "string"},
+ {"name": "city", "type": "string"}
+ ]
+ }
+ },
+ {
+ "name": "id",
+ "doc": "System-assigned numeric user ID. Cannot be changed by the user.",
+ "type": "int"
+ },
+ {
+ "name": "username",
+ "doc": "The username chosen by the user. Can be changed by the user.",
+ "type": "string"
+ },
+ {
+ "name": "passwordHash",
+ "doc": "The user's password, hashed using [scrypt](http://www.tarsnap.com/scrypt.html).",
+ "type": "string"
+ },
+ {
+ "name": "signupDate",
+ "doc": "Timestamp (milliseconds since epoch) when the user signed up",
+ "type": "long"
+ },
+ {
+ "name": "emailAddresses",
+ "doc": "All email addresses on the user's account",
+ "type": {
+ "type": "array",
+ "items": {
+ "type": "record",
+ "name": "EmailAddress",
+ "doc": "Stores details about an email address that a user has associated with their account.",
+ "fields": [
+ {
+ "name": "address",
+ "doc": "The email address, e.g. `foo@example.com`",
+ "type": "string"
+ },
+ {
+ "name": "verified",
+ "doc": "true if the user has clicked the link in a confirmation email to this address.",
+ "type": "boolean",
+ "default": false
+ },
+ {
+ "name": "dateAdded",
+ "doc": "Timestamp (milliseconds since epoch) when the email address was added to the account.",
+ "type": "long"
+ },
+ {
+ "name": "dateBounced",
+ "doc": "Timestamp (milliseconds since epoch) when an email sent to this address last bounced. Reset to null when the address no longer bounces.",
+ "type": ["null", "long"]
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "twitterAccounts",
+ "doc": "All Twitter accounts that the user has OAuthed",
+ "type": {
+ "type": "array",
+ "items": {
+ "type": "record",
+ "name": "TwitterAccount",
+ "doc": "Stores access credentials for one Twitter account, as granted to us by the user by OAuth.",
+ "fields": [
+ {
+ "name": "status",
+ "doc": "Indicator of whether this authorization is currently active, or has been revoked",
+ "type": {
+ "type": "enum",
+ "name": "OAuthStatus",
+ "doc": "* `PENDING`: the user has started authorizing, but not yet finished\n* `ACTIVE`: the token should work\n* `DENIED`: the user declined the authorization\n* `EXPIRED`: the token used to work, but now it doesn't\n* `REVOKED`: the user has explicitly revoked the token",
+ "symbols": ["PENDING", "ACTIVE", "DENIED", "EXPIRED", "REVOKED"]
+ }
+ },
+ {
+ "name": "userId",
+ "doc": "Twitter's numeric ID for this user",
+ "type": "long"
+ },
+ {
+ "name": "screenName",
+ "doc": "The twitter username for this account (can be changed by the user)",
+ "type": "string"
+ },
+ {
+ "name": "oauthToken",
+ "doc": "The OAuth token for this Twitter account",
+ "type": "string"
+ },
+ {
+ "name": "oauthTokenSecret",
+ "doc": "The OAuth secret, used for signing requests on behalf of this Twitter account. `null` whilst the OAuth flow is not yet complete.",
+ "type": ["null", "string"]
+ },
+ {
+ "name": "dateAuthorized",
+ "doc": "Timestamp (milliseconds since epoch) when the user last authorized this Twitter account",
+ "type": "long"
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "toDoItems",
+ "doc": "The top-level items in the user's to-do list",
+ "type": {
+ "type": "array",
+ "items": {
+ "type": "record",
+ "name": "ToDoItem",
+ "doc": "A record is one node in a To-Do item tree (every record can contain nested sub-records).",
+ "fields": [
+ {
+ "name": "status",
+ "doc": "User-selected state for this item (e.g. whether or not it is marked as done)",
+ "type": {
+ "type": "enum",
+ "name": "ToDoStatus",
+ "doc": "* `HIDDEN`: not currently visible, e.g. because it becomes actionable in future\n* `ACTIONABLE`: appears in the current to-do list\n* `DONE`: marked as done, but still appears in the list\n* `ARCHIVED`: marked as done and no longer visible\n* `DELETED`: not done and removed from list (preserved for undo purposes)",
+ "symbols": ["HIDDEN", "ACTIONABLE", "DONE", "ARCHIVED", "DELETED"]
+ }
+ },
+ {
+ "name": "title",
+ "doc": "One-line summary of the item",
+ "type": "string"
+ },
+ {
+ "name": "description",
+ "doc": "Detailed description (may contain HTML markup)",
+ "type": ["null", "string"]
+ },
+ {
+ "name": "snoozeDate",
+ "doc": "Timestamp (milliseconds since epoch) at which the item should go from `HIDDEN` to `ACTIONABLE` status",
+ "type": ["null", "long"]
+ },
+ {
+ "name": "subItems",
+ "doc": "List of children of this to-do tree node",
+ "type": {
+ "type": "array",
+ "items": "ToDoItem"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
}
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExampleInvalidFields.avsc b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExampleInvalidFields.avsc
index 102641b44..cb8b4e29e 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExampleInvalidFields.avsc
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExampleInvalidFields.avsc
@@ -1,172 +1,172 @@
{
- "type": "record",
- "name": "User",
- "namespace": "com.example.avro",
- "doc": "This is a user record in a fictitious to-do-list management app. It supports arbitrary grouping and nesting of items, and allows you to add items by email or by tweeting.\n\nNote this app doesn't actually exist. The schema is just a demo for [Avrodoc](https://github.com/ept/avrodoc)!",
- "fields": [
+ "type": "record",
+ "name": "User",
+ "namespace": "com.example.avro",
+ "doc": "This is a user record in a fictitious to-do-list management app. It supports arbitrary grouping and nesting of items, and allows you to add items by email or by tweeting.\n\nNote this app doesn't actually exist. The schema is just a demo for [Avrodoc](https://github.com/ept/avrodoc)!",
+ "fields": [
{"name": "firstname", "type": "string"},
{"name": "lastname", "type": "string"},
- {
- "name": "address",
- "type": {
- "type" : "record",
- "name" : "AddressUSRecord",
- "fields" : [
- {"name": "streetaddress_DasH_1", "type": "string"},
- {"name": "city", "type": "string"}
- ]
- }
- },
- {
- "name": "id",
- "doc": "System-assigned numeric user ID. Cannot be changed by the user.",
- "type": "int"
- },
- {
- "name": "username",
- "doc": "The username chosen by the user. Can be changed by the user.",
- "type": "string"
- },
- {
- "name": "passwordHash",
- "doc": "The user's password, hashed using [scrypt](http://www.tarsnap.com/scrypt.html).",
- "type": "string"
- },
- {
- "name": "signupDate",
- "doc": "Timestamp (milliseconds since epoch) when the user signed up",
- "type": "long"
- },
- {
- "name": "email_DoT_Addresses",
- "doc": "All email addresses on the user's account",
- "type": {
- "type": "array",
- "items": {
- "type": "record",
- "name": "EmailAddress",
- "doc": "Stores details about an email address that a user has associated with their account.",
- "fields": [
- {
- "name": "address",
- "doc": "The email address, e.g. `foo@example.com`",
- "type": "string"
- },
- {
- "name": "verified",
- "doc": "true if the user has clicked the link in a confirmation email to this address.",
- "type": "boolean",
- "default": false
- },
- {
- "name": "dateAdded",
- "doc": "Timestamp (milliseconds since epoch) when the email address was added to the account.",
- "type": "long"
- },
- {
- "name": "dateBounced",
- "doc": "Timestamp (milliseconds since epoch) when an email sent to this address last bounced. Reset to null when the address no longer bounces.",
- "type": ["null", "long"]
- }
- ]
- }
- }
- },
- {
- "name": "twitterAccounts",
- "doc": "All Twitter accounts that the user has OAuthed",
- "type": {
- "type": "array",
- "items": {
- "type": "record",
- "name": "TwitterAccount",
- "doc": "Stores access credentials for one Twitter account, as granted to us by the user by OAuth.",
- "fields": [
- {
- "name": "status",
- "doc": "Indicator of whether this authorization is currently active, or has been revoked",
- "type": {
- "type": "enum",
- "name": "OAuthStatus",
- "doc": "* `PENDING`: the user has started authorizing, but not yet finished\n* `ACTIVE`: the token should work\n* `DENIED`: the user declined the authorization\n* `EXPIRED`: the token used to work, but now it doesn't\n* `REVOKED`: the user has explicitly revoked the token",
- "symbols": ["PENDING", "ACTIVE", "DENIED", "EXPIRED", "REVOKED"]
- }
- },
- {
- "name": "userId",
- "doc": "Twitter's numeric ID for this user",
- "type": "long"
- },
- {
- "name": "screenName",
- "doc": "The twitter username for this account (can be changed by the user)",
- "type": "string"
- },
- {
- "name": "oauthToken",
- "doc": "The OAuth token for this Twitter account",
- "type": "string"
- },
- {
- "name": "oauthTokenSecret",
- "doc": "The OAuth secret, used for signing requests on behalf of this Twitter account. `null` whilst the OAuth flow is not yet complete.",
- "type": ["null", "string"]
- },
- {
- "name": "dateAuthorized",
- "doc": "Timestamp (milliseconds since epoch) when the user last authorized this Twitter account",
- "type": "long"
- }
- ]
- }
- }
- },
- {
- "name": "toDoItems",
- "doc": "The top-level items in the user's to-do list",
- "type": {
- "type": "array",
- "items": {
- "type": "record",
- "name": "ToDoItem",
- "doc": "A record is one node in a To-Do item tree (every record can contain nested sub-records).",
- "fields": [
- {
- "name": "status",
- "doc": "User-selected state for this item (e.g. whether or not it is marked as done)",
- "type": {
- "type": "enum",
- "name": "ToDoStatus",
- "doc": "* `HIDDEN`: not currently visible, e.g. because it becomes actionable in future\n* `ACTIONABLE`: appears in the current to-do list\n* `DONE`: marked as done, but still appears in the list\n* `ARCHIVED`: marked as done and no longer visible\n* `DELETED`: not done and removed from list (preserved for undo purposes)",
- "symbols": ["HIDDEN", "ACTIONABLE", "DONE", "ARCHIVED", "DELETED"]
- }
- },
- {
- "name": "title_DasH_long",
- "doc": "One-line summary of the item",
- "type": "string"
- },
- {
- "name": "description",
- "doc": "Detailed description (may contain HTML markup)",
- "type": ["null", "string"]
- },
- {
- "name": "snoozeDate",
- "doc": "Timestamp (milliseconds since epoch) at which the item should go from `HIDDEN` to `ACTIONABLE` status",
- "type": ["null", "long"]
- },
- {
- "name": "subItems",
- "doc": "List of children of this to-do tree node",
- "type": {
- "type": "array",
- "items": "ToDoItem"
- }
- }
- ]
- }
- }
- }
- ]
+ {
+ "name": "address",
+ "type": {
+ "type" : "record",
+ "name" : "AddressUSRecord",
+ "fields" : [
+ {"name": "streetaddress_DasH_1", "type": "string"},
+ {"name": "city", "type": "string"}
+ ]
+ }
+ },
+ {
+ "name": "id",
+ "doc": "System-assigned numeric user ID. Cannot be changed by the user.",
+ "type": "int"
+ },
+ {
+ "name": "username",
+ "doc": "The username chosen by the user. Can be changed by the user.",
+ "type": "string"
+ },
+ {
+ "name": "passwordHash",
+ "doc": "The user's password, hashed using [scrypt](http://www.tarsnap.com/scrypt.html).",
+ "type": "string"
+ },
+ {
+ "name": "signupDate",
+ "doc": "Timestamp (milliseconds since epoch) when the user signed up",
+ "type": "long"
+ },
+ {
+ "name": "email_DoT_Addresses",
+ "doc": "All email addresses on the user's account",
+ "type": {
+ "type": "array",
+ "items": {
+ "type": "record",
+ "name": "EmailAddress",
+ "doc": "Stores details about an email address that a user has associated with their account.",
+ "fields": [
+ {
+ "name": "address",
+ "doc": "The email address, e.g. `foo@example.com`",
+ "type": "string"
+ },
+ {
+ "name": "verified",
+ "doc": "true if the user has clicked the link in a confirmation email to this address.",
+ "type": "boolean",
+ "default": false
+ },
+ {
+ "name": "dateAdded",
+ "doc": "Timestamp (milliseconds since epoch) when the email address was added to the account.",
+ "type": "long"
+ },
+ {
+ "name": "dateBounced",
+ "doc": "Timestamp (milliseconds since epoch) when an email sent to this address last bounced. Reset to null when the address no longer bounces.",
+ "type": ["null", "long"]
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "twitterAccounts",
+ "doc": "All Twitter accounts that the user has OAuthed",
+ "type": {
+ "type": "array",
+ "items": {
+ "type": "record",
+ "name": "TwitterAccount",
+ "doc": "Stores access credentials for one Twitter account, as granted to us by the user by OAuth.",
+ "fields": [
+ {
+ "name": "status",
+ "doc": "Indicator of whether this authorization is currently active, or has been revoked",
+ "type": {
+ "type": "enum",
+ "name": "OAuthStatus",
+ "doc": "* `PENDING`: the user has started authorizing, but not yet finished\n* `ACTIVE`: the token should work\n* `DENIED`: the user declined the authorization\n* `EXPIRED`: the token used to work, but now it doesn't\n* `REVOKED`: the user has explicitly revoked the token",
+ "symbols": ["PENDING", "ACTIVE", "DENIED", "EXPIRED", "REVOKED"]
+ }
+ },
+ {
+ "name": "userId",
+ "doc": "Twitter's numeric ID for this user",
+ "type": "long"
+ },
+ {
+ "name": "screenName",
+ "doc": "The twitter username for this account (can be changed by the user)",
+ "type": "string"
+ },
+ {
+ "name": "oauthToken",
+ "doc": "The OAuth token for this Twitter account",
+ "type": "string"
+ },
+ {
+ "name": "oauthTokenSecret",
+ "doc": "The OAuth secret, used for signing requests on behalf of this Twitter account. `null` whilst the OAuth flow is not yet complete.",
+ "type": ["null", "string"]
+ },
+ {
+ "name": "dateAuthorized",
+ "doc": "Timestamp (milliseconds since epoch) when the user last authorized this Twitter account",
+ "type": "long"
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "toDoItems",
+ "doc": "The top-level items in the user's to-do list",
+ "type": {
+ "type": "array",
+ "items": {
+ "type": "record",
+ "name": "ToDoItem",
+ "doc": "A record is one node in a To-Do item tree (every record can contain nested sub-records).",
+ "fields": [
+ {
+ "name": "status",
+ "doc": "User-selected state for this item (e.g. whether or not it is marked as done)",
+ "type": {
+ "type": "enum",
+ "name": "ToDoStatus",
+ "doc": "* `HIDDEN`: not currently visible, e.g. because it becomes actionable in future\n* `ACTIONABLE`: appears in the current to-do list\n* `DONE`: marked as done, but still appears in the list\n* `ARCHIVED`: marked as done and no longer visible\n* `DELETED`: not done and removed from list (preserved for undo purposes)",
+ "symbols": ["HIDDEN", "ACTIONABLE", "DONE", "ARCHIVED", "DELETED"]
+ }
+ },
+ {
+ "name": "title_DasH_long",
+ "doc": "One-line summary of the item",
+ "type": "string"
+ },
+ {
+ "name": "description",
+ "doc": "Detailed description (may contain HTML markup)",
+ "type": ["null", "string"]
+ },
+ {
+ "name": "snoozeDate",
+ "doc": "Timestamp (milliseconds since epoch) at which the item should go from `HIDDEN` to `ACTIONABLE` status",
+ "type": ["null", "long"]
+ },
+ {
+ "name": "subItems",
+ "doc": "List of children of this to-do tree node",
+ "type": {
+ "type": "array",
+ "items": "ToDoItem"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
}
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExampleVPN.avsc b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExampleVPN.avsc
index b9aac36f9..3a3297d0b 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExampleVPN.avsc
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExampleVPN.avsc
@@ -1,7 +1,7 @@
{
"type" : "record",
"name" : "VPNActEvent",
- "namespace" : "com.ericsson.apex.domains.vpn.events",
+ "namespace" : "org.onap.policy.apex.domains.vpn.events",
"fields" : [
{"name": "nameSpace", "type": "string"},
{"name": "name", "type": "string"},
@@ -11,14 +11,14 @@
{"name": "LinkMap", "type": {
"type" : "record",
"name" : "LinkMap",
- "namespace" : "com.ericsson.apex.domains.vpn",
+ "namespace" : "org.onap.policy.apex.domains.vpn",
"fields" : [ ]
}
},
{"name": "CustomerMap", "type": {
"type" : "record",
"name" : "CustomerMap",
- "namespace" : "com.ericsson.apex.domains.vpn",
+ "namespace" : "org.onap.policy.apex.domains.vpn",
"fields" : [ ]
}
}
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExampleVPNReuse.avsc b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExampleVPNReuse.avsc
index 5936bb21f..16afc712e 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExampleVPNReuse.avsc
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/RecordExampleVPNReuse.avsc
@@ -1,34 +1,34 @@
{
- "type" : "record",
- "name" : "VPNActEvent",
- "namespace" : "com.ericsson.apex.domains.vpn.events",
- "fields" : [
- {"name": "nameSpace", "type": "string"},
- {"name": "name", "type": "string"},
- {"name": "version", "type": "string"},
- {"name": "source", "type": "string"},
- {"name": "target", "type": "string"},
- {"name": "LinkMap", "type": {
- "type" : "record",
- "name" : "LinkMap",
- "namespace" : "com.ericsson.apex.domains.vpn",
- "fields" : [ ]
- }
- },
- {"name": "CustomerMap", "type": {
- "type" : "record",
- "name" : "CustomerMap",
- "namespace" : "com.ericsson.apex.domains.vpn",
- "fields" : [ ]
- }
- },
- {"name": "CustomerMap1", "type": "com.ericsson.apex.domains.vpn.CustomerMap"},
- {
- "name" : "CustomerMapArray",
- "type": {
- "type": "array",
- "items": "com.ericsson.apex.domains.vpn.CustomerMap"
- }
- }
- ]
+ "type" : "record",
+ "name" : "VPNActEvent",
+ "namespace" : "org.onap.policy.apex.domains.vpn.events",
+ "fields" : [
+ {"name": "nameSpace", "type": "string"},
+ {"name": "name", "type": "string"},
+ {"name": "version", "type": "string"},
+ {"name": "source", "type": "string"},
+ {"name": "target", "type": "string"},
+ {"name": "LinkMap", "type": {
+ "type" : "record",
+ "name" : "LinkMap",
+ "namespace" : "org.onap.policy.apex.domains.vpn",
+ "fields" : [ ]
+ }
+ },
+ {"name": "CustomerMap", "type": {
+ "type" : "record",
+ "name" : "CustomerMap",
+ "namespace" : "org.onap.policy.apex.domains.vpn",
+ "fields" : [ ]
+ }
+ },
+ {"name": "CustomerMap1", "type": "org.onap.policy.apex.domains.vpn.CustomerMap"},
+ {
+ "name" : "CustomerMapArray",
+ "type": {
+ "type": "array",
+ "items": "org.onap.policy.apex.domains.vpn.CustomerMap"
+ }
+ }
+ ]
}
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/UnionExample.avsc b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/UnionExample.avsc
index 96b6050fb..01774133c 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/UnionExample.avsc
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/avsc/UnionExample.avsc
@@ -1,30 +1,30 @@
{
- "namespace": "example.avro",
- "type": "record",
- "name": "User",
- "fields": [
- {
- "name": "name",
- "type": "string"
- },
- {
- "name": "favourite_number",
- "type": [
- "null",
- "int"
- ]
- },
- {
- "name": "favourite_colour",
- "type": [
- "null",
- "string"
- ]
- },
- {
- "name": "favourite_group",
- "type": ["null", "string"],
- "default": "null"
- }
- ]
+ "namespace": "example.avro",
+ "type": "record",
+ "name": "User",
+ "fields": [
+ {
+ "name": "name",
+ "type": "string"
+ },
+ {
+ "name": "favourite_number",
+ "type": [
+ "null",
+ "int"
+ ]
+ },
+ {
+ "name": "favourite_colour",
+ "type": [
+ "null",
+ "string"
+ ]
+ },
+ {
+ "name": "favourite_group",
+ "type": ["null", "string"],
+ "default": "null"
+ }
+ ]
} \ No newline at end of file
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/AAIResponse4Policy.json b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/AAIResponse4Policy.json
index 25ca3af8a..f690d6b42 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/AAIResponse4Policy.json
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/AAIResponse4Policy.json
@@ -1,20 +1,20 @@
[
- {
- "model-name": "service-instance",
- "generic-vnf": {
- "vnf-id": "de7cc3ab-0212-47df-9e64-da1c79234deb",
- "vnf-name": "ZRDM2MMEX39",
- "vnf-type": "vMME Svc Jul 14/vMME VF Jul 14 1",
- "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
- "orchestration-status": "active",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1503082370097",
- "model-invariant-id": "82194af1-3c2c-485a-8f44-420e22a9eaa4",
- "model-version-id": "46b92144-923a-4d20-b85a-3cbd847668a9"
- },
- "extra-properties": {
-
- }
- }
+ {
+ "model-name": "service-instance",
+ "generic-vnf": {
+ "vnf-id": "de7cc3ab-0212-47df-9e64-da1c79234deb",
+ "vnf-name": "ZRDM2MMEX39",
+ "vnf-type": "vMME Svc Jul 14/vMME VF Jul 14 1",
+ "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "orchestration-status": "active",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1503082370097",
+ "model-invariant-id": "82194af1-3c2c-485a-8f44-420e22a9eaa4",
+ "model-version-id": "46b92144-923a-4d20-b85a-3cbd847668a9"
+ },
+ "extra-properties": {
+
+ }
+ }
]
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/AAIResponse4VNF.json b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/AAIResponse4VNF.json
index 41cfc5c17..59615b824 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/AAIResponse4VNF.json
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/AAIResponse4VNF.json
@@ -1,302 +1,302 @@
[
- {
- "model-name": "vFW",
- "generic-vnf": {
- "vnf-id": "vFirewall_demo_app",
- "vnf-name": "vFirewall_demo_app",
- "vnf-type": "vFW",
- "service-id": "vFirewall_demo_app",
- "orchestration-status": "running",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1509456799110",
- "model-invariant-id": "vFirewall",
- "model-version-id": "vFW"
- },
- "extra-properties": {
-
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "vserver": {
- "vserver-id": "5b06cf36-40a0-4bcb-bde9-849aa4702d67",
- "vserver-name": "vFW",
- "vserver-name2": "vFW",
- "prov-status": "Running",
- "vserver-selflink": "http://10.12.25.2:8774/v2.1/466979b815b5415ba14ada713e6e1846/servers/5b06cf36-40a0-4bcb-bde9-849aa4702d67",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1509047869791"
- },
- "extra-properties": {
-
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "vnfc": {
- "vnfc-name": "VNFC_vGMUX_demo_app2",
- "nfc-naming-code": "vGMUXCODE2",
- "nfc-function": "vGMUX",
- "prov-status": "Running",
- "orchestration-status": "Error",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1509407048855"
- },
- "extra-properties": {
-
- }
- },
- {
- "tenant": {
- "tenant-id": "466979b815b5415ba14ada713e6e1846",
- "tenant-name": "Integration",
- "resource-version": "1508920100541"
- },
- "extra-properties": {
-
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "cloud-region": {
- "cloud-owner": "pod25",
- "cloud-region-id": "RegionOne",
- "identity-url": "http://10.12.25.2:5000/v3",
- "sriov-automation": false,
- "resource-version": "1509048416263"
- },
- "extra-properties": {
-
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "esr-system-info": {
- "esr-system-info-id": "432ac032-e996-41f2-84ed-9c7a1766eb29",
- "system-name": "example-system-name-val-29070",
- "type": "example-type-val-85254",
- "vendor": "example-vendor-val-94515",
- "version": "example-version-val-71880",
- "service-url": "http://10.12.25.2:5000/v3",
- "user-name": "demo",
- "password": "onapdemo",
- "system-type": "VIM",
- "ssl-cacert": "example-ssl-cacert-val-75021",
- "ssl-insecure": true,
- "ip-address": "example-ip-address-val-44431",
- "port": "example-port-val-93234",
- "cloud-domain": "Default",
- "default-tenant": "Integration",
- "resource-version": "1508920101033"
- },
- "extra-properties": {
-
- }
- }
- ]
- }
- }
- ]
- }
- }
- ]
- }
- },
- {
- "vserver": {
- "vserver-id": "0c52905c-f682-42cf-bd52-e7f8953e80e3",
- "vserver-name": "vFW",
- "vserver-name2": "vFW",
- "prov-status": "Running",
- "vserver-selflink": "http://10.12.25.2:8774/v2.1/466979b815b5415ba14ada713e6e1846/servers/0c52905c-f682-42cf-bd52-e7f8953e80e3",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1509047548567"
- },
- "extra-properties": {
-
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "vnfc": {
- "vnfc-name": "VNFC_vGMUX_demo_app3",
- "nfc-naming-code": "vGMUXCODE3",
- "nfc-function": "vGMUX",
- "prov-status": "Running",
- "orchestration-status": "Running",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1509041912808"
- },
- "extra-properties": {
-
- }
- },
- {
- "tenant": {
- "tenant-id": "466979b815b5415ba14ada713e6e1846",
- "tenant-name": "Integration",
- "resource-version": "1508920100541"
- },
- "extra-properties": {
-
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "cloud-region": {
- "cloud-owner": "pod25",
- "cloud-region-id": "RegionOne",
- "identity-url": "http://10.12.25.2:5000/v3",
- "sriov-automation": false,
- "resource-version": "1509048416263"
- },
- "extra-properties": {
-
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "esr-system-info": {
- "esr-system-info-id": "432ac032-e996-41f2-84ed-9c7a1766eb29",
- "system-name": "example-system-name-val-29070",
- "type": "example-type-val-85254",
- "vendor": "example-vendor-val-94515",
- "version": "example-version-val-71880",
- "service-url": "http://10.12.25.2:5000/v3",
- "user-name": "demo",
- "password": "onapdemo",
- "system-type": "VIM",
- "ssl-cacert": "example-ssl-cacert-val-75021",
- "ssl-insecure": true,
- "ip-address": "example-ip-address-val-44431",
- "port": "example-port-val-93234",
- "cloud-domain": "Default",
- "default-tenant": "Integration",
- "resource-version": "1508920101033"
- },
- "extra-properties": {
-
- }
- }
- ]
- }
- }
- ]
- }
- }
- ]
- }
- },
- {
- "vserver": {
- "vserver-id": "33e16e02-098a-4f4e-a37f-b4e0307596c0",
- "vserver-name": "vFW",
- "vserver-name2": "vFW",
- "prov-status": "Running",
- "vserver-selflink": "http://10.12.25.2:8774/v2.1/466979b815b5415ba14ada713e6e1846/servers/33e16e02-098a-4f4e-a37f-b4e0307596c0",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1509047285114"
- },
- "extra-properties": {
-
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "vnfc": {
- "vnfc-name": "vnfc-related-to-vserver-example",
- "nfc-naming-code": "example-nfc-naming-code-val-78172",
- "nfc-function": "example-nfc-function-val-56352",
- "prov-status": "example-prov-status-val-10699",
- "orchestration-status": "example-orchestration-status-val-68896",
- "ipaddress-v4-oam-vip": "example-ipaddress-v4-oam-vip-val-71483",
- "in-maint": true,
- "is-closed-loop-disabled": true,
- "group-notation": "example-group-notation-val-31912",
- "resource-version": "1508800709772"
- },
- "extra-properties": {
-
- }
- },
- {
- "vnfc": {
- "vnfc-name": "VNFC_vGMUX_demo_app",
- "nfc-naming-code": "vGMUXCODE",
- "nfc-function": "vGMUX",
- "prov-status": "Running",
- "orchestration-status": "Running",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1509041573965"
- },
- "extra-properties": {
-
- }
- },
- {
- "tenant": {
- "tenant-id": "466979b815b5415ba14ada713e6e1846",
- "tenant-name": "Integration",
- "resource-version": "1508920100541"
- },
- "extra-properties": {
-
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "cloud-region": {
- "cloud-owner": "pod25",
- "cloud-region-id": "RegionOne",
- "identity-url": "http://10.12.25.2:5000/v3",
- "sriov-automation": false,
- "resource-version": "1509048416263"
- },
- "extra-properties": {
-
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "esr-system-info": {
- "esr-system-info-id": "432ac032-e996-41f2-84ed-9c7a1766eb29",
- "system-name": "example-system-name-val-29070",
- "type": "example-type-val-85254",
- "vendor": "example-vendor-val-94515",
- "version": "example-version-val-71880",
- "service-url": "http://10.12.25.2:5000/v3",
- "user-name": "demo",
- "password": "onapdemo",
- "system-type": "VIM",
- "ssl-cacert": "example-ssl-cacert-val-75021",
- "ssl-insecure": true,
- "ip-address": "example-ip-address-val-44431",
- "port": "example-port-val-93234",
- "cloud-domain": "Default",
- "default-tenant": "Integration",
- "resource-version": "1508920101033"
- },
- "extra-properties": {
-
- }
- }
- ]
- }
- }
- ]
- }
- }
- ]
- }
- }
- ]
- }
- }
+ {
+ "model-name": "vFW",
+ "generic-vnf": {
+ "vnf-id": "vFirewall_demo_app",
+ "vnf-name": "vFirewall_demo_app",
+ "vnf-type": "vFW",
+ "service-id": "vFirewall_demo_app",
+ "orchestration-status": "running",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1509456799110",
+ "model-invariant-id": "vFirewall",
+ "model-version-id": "vFW"
+ },
+ "extra-properties": {
+
+ },
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "vserver": {
+ "vserver-id": "5b06cf36-40a0-4bcb-bde9-849aa4702d67",
+ "vserver-name": "vFW",
+ "vserver-name2": "vFW",
+ "prov-status": "Running",
+ "vserver-selflink": "http://10.12.25.2:8774/v2.1/466979b815b5415ba14ada713e6e1846/servers/5b06cf36-40a0-4bcb-bde9-849aa4702d67",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1509047869791"
+ },
+ "extra-properties": {
+
+ },
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "vnfc": {
+ "vnfc-name": "VNFC_vGMUX_demo_app2",
+ "nfc-naming-code": "vGMUXCODE2",
+ "nfc-function": "vGMUX",
+ "prov-status": "Running",
+ "orchestration-status": "Error",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1509407048855"
+ },
+ "extra-properties": {
+
+ }
+ },
+ {
+ "tenant": {
+ "tenant-id": "466979b815b5415ba14ada713e6e1846",
+ "tenant-name": "Integration",
+ "resource-version": "1508920100541"
+ },
+ "extra-properties": {
+
+ },
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "cloud-region": {
+ "cloud-owner": "pod25",
+ "cloud-region-id": "RegionOne",
+ "identity-url": "http://10.12.25.2:5000/v3",
+ "sriov-automation": false,
+ "resource-version": "1509048416263"
+ },
+ "extra-properties": {
+
+ },
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "esr-system-info": {
+ "esr-system-info-id": "432ac032-e996-41f2-84ed-9c7a1766eb29",
+ "system-name": "example-system-name-val-29070",
+ "type": "example-type-val-85254",
+ "vendor": "example-vendor-val-94515",
+ "version": "example-version-val-71880",
+ "service-url": "http://10.12.25.2:5000/v3",
+ "user-name": "demo",
+ "password": "onapdemo",
+ "system-type": "VIM",
+ "ssl-cacert": "example-ssl-cacert-val-75021",
+ "ssl-insecure": true,
+ "ip-address": "example-ip-address-val-44431",
+ "port": "example-port-val-93234",
+ "cloud-domain": "Default",
+ "default-tenant": "Integration",
+ "resource-version": "1508920101033"
+ },
+ "extra-properties": {
+
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ {
+ "vserver": {
+ "vserver-id": "0c52905c-f682-42cf-bd52-e7f8953e80e3",
+ "vserver-name": "vFW",
+ "vserver-name2": "vFW",
+ "prov-status": "Running",
+ "vserver-selflink": "http://10.12.25.2:8774/v2.1/466979b815b5415ba14ada713e6e1846/servers/0c52905c-f682-42cf-bd52-e7f8953e80e3",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1509047548567"
+ },
+ "extra-properties": {
+
+ },
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "vnfc": {
+ "vnfc-name": "VNFC_vGMUX_demo_app3",
+ "nfc-naming-code": "vGMUXCODE3",
+ "nfc-function": "vGMUX",
+ "prov-status": "Running",
+ "orchestration-status": "Running",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1509041912808"
+ },
+ "extra-properties": {
+
+ }
+ },
+ {
+ "tenant": {
+ "tenant-id": "466979b815b5415ba14ada713e6e1846",
+ "tenant-name": "Integration",
+ "resource-version": "1508920100541"
+ },
+ "extra-properties": {
+
+ },
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "cloud-region": {
+ "cloud-owner": "pod25",
+ "cloud-region-id": "RegionOne",
+ "identity-url": "http://10.12.25.2:5000/v3",
+ "sriov-automation": false,
+ "resource-version": "1509048416263"
+ },
+ "extra-properties": {
+
+ },
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "esr-system-info": {
+ "esr-system-info-id": "432ac032-e996-41f2-84ed-9c7a1766eb29",
+ "system-name": "example-system-name-val-29070",
+ "type": "example-type-val-85254",
+ "vendor": "example-vendor-val-94515",
+ "version": "example-version-val-71880",
+ "service-url": "http://10.12.25.2:5000/v3",
+ "user-name": "demo",
+ "password": "onapdemo",
+ "system-type": "VIM",
+ "ssl-cacert": "example-ssl-cacert-val-75021",
+ "ssl-insecure": true,
+ "ip-address": "example-ip-address-val-44431",
+ "port": "example-port-val-93234",
+ "cloud-domain": "Default",
+ "default-tenant": "Integration",
+ "resource-version": "1508920101033"
+ },
+ "extra-properties": {
+
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ {
+ "vserver": {
+ "vserver-id": "33e16e02-098a-4f4e-a37f-b4e0307596c0",
+ "vserver-name": "vFW",
+ "vserver-name2": "vFW",
+ "prov-status": "Running",
+ "vserver-selflink": "http://10.12.25.2:8774/v2.1/466979b815b5415ba14ada713e6e1846/servers/33e16e02-098a-4f4e-a37f-b4e0307596c0",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1509047285114"
+ },
+ "extra-properties": {
+
+ },
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "vnfc": {
+ "vnfc-name": "vnfc-related-to-vserver-example",
+ "nfc-naming-code": "example-nfc-naming-code-val-78172",
+ "nfc-function": "example-nfc-function-val-56352",
+ "prov-status": "example-prov-status-val-10699",
+ "orchestration-status": "example-orchestration-status-val-68896",
+ "ipaddress-v4-oam-vip": "example-ipaddress-v4-oam-vip-val-71483",
+ "in-maint": true,
+ "is-closed-loop-disabled": true,
+ "group-notation": "example-group-notation-val-31912",
+ "resource-version": "1508800709772"
+ },
+ "extra-properties": {
+
+ }
+ },
+ {
+ "vnfc": {
+ "vnfc-name": "VNFC_vGMUX_demo_app",
+ "nfc-naming-code": "vGMUXCODE",
+ "nfc-function": "vGMUX",
+ "prov-status": "Running",
+ "orchestration-status": "Running",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1509041573965"
+ },
+ "extra-properties": {
+
+ }
+ },
+ {
+ "tenant": {
+ "tenant-id": "466979b815b5415ba14ada713e6e1846",
+ "tenant-name": "Integration",
+ "resource-version": "1508920100541"
+ },
+ "extra-properties": {
+
+ },
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "cloud-region": {
+ "cloud-owner": "pod25",
+ "cloud-region-id": "RegionOne",
+ "identity-url": "http://10.12.25.2:5000/v3",
+ "sriov-automation": false,
+ "resource-version": "1509048416263"
+ },
+ "extra-properties": {
+
+ },
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "esr-system-info": {
+ "esr-system-info-id": "432ac032-e996-41f2-84ed-9c7a1766eb29",
+ "system-name": "example-system-name-val-29070",
+ "type": "example-type-val-85254",
+ "vendor": "example-vendor-val-94515",
+ "version": "example-version-val-71880",
+ "service-url": "http://10.12.25.2:5000/v3",
+ "user-name": "demo",
+ "password": "onapdemo",
+ "system-type": "VIM",
+ "ssl-cacert": "example-ssl-cacert-val-75021",
+ "ssl-insecure": true,
+ "ip-address": "example-ip-address-val-44431",
+ "port": "example-port-val-93234",
+ "cloud-domain": "Default",
+ "default-tenant": "Integration",
+ "resource-version": "1508920101033"
+ },
+ "extra-properties": {
+
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
]
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/AAIResponseExample.json b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/AAIResponseExample.json
index a1a1e19bc..95517266d 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/AAIResponseExample.json
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/AAIResponseExample.json
@@ -1,209 +1,209 @@
{
- "inventory-response-item": [
- {
- "vserver": {
- "vserver-id": "6ed3642c-f7a1-4a7c-9290-3d51fe1531eb",
- "vserver-name": "zdfw1lb01lb02",
- "vserver-name2": "zdfw1lb01lb02",
- "prov-status": "ACTIVE",
- "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/6ed3642c-f7a1-4a7c-9290-3d51fe1531eb",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1510606403522"
- },
- "extra-properties": {
-
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "model-name": "vLoadBalancer",
- "generic-vnf": {
- "vnf-id": "db373a8d-f7be-4d02-8ac8-6ca4c305d144",
- "vnf-name": "Vfmodule_vLB1113",
- "vnf-type": "vLoadBalancer-1106/vLoadBalancer 0",
- "service-id": "66f157fc-4148-4880-95f5-e120677e98d1",
- "prov-status": "PREPROV",
- "orchestration-status": "Created",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1510604011851",
- "model-invariant-id": "cee050ed-92a5-494f-ab04-234307a846dc",
- "model-version-id": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2",
- "model-customization-id": "1983c783-444f-4e79-af3a-85e5d49628f3",
- "nf-type": "",
- "nf-function": "",
- "nf-role": "",
- "nf-naming-code": ""
- },
- "extra-properties": {
- "extra-property": [
- {
- "property-name": "model-ver.model-version-id",
- "property-value": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2"
- },
- {
- "property-name": "model-ver.model-name",
- "property-value": "vLoadBalancer"
- },
- {
- "property-name": "model.model-type",
- "property-value": "resource"
- },
- {
- "property-name": "model.model-invariant-id",
- "property-value": "cee050ed-92a5-494f-ab04-234307a846dc"
- },
- {
- "property-name": "model-ver.model-version",
- "property-value": "1.0"
- }
- ]
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "model-name": "vLoadBalancer-1106",
- "service-instance": {
- "service-instance-id": "3b12f31f-8f2d-4f5c-b875-61ff1194b941",
- "service-instance-name": "vLoadBalancer-1113",
- "model-invariant-id": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a",
- "model-version-id": "732d4692-4b97-46f9-a996-0b3339e88c50",
- "resource-version": "1510603936425"
- },
- "extra-properties": {
- "extra-property": [
- {
- "property-name": "model-ver.model-version-id",
- "property-value": "732d4692-4b97-46f9-a996-0b3339e88c50"
- },
- {
- "property-name": "model-ver.model-name",
- "property-value": "vLoadBalancer-1106"
- },
- {
- "property-name": "model.model-type",
- "property-value": "service"
- },
- {
- "property-name": "model.model-invariant-id",
- "property-value": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a"
- },
- {
- "property-name": "model-ver.model-version",
- "property-value": "1.0"
- }
- ]
- }
- },
- {
- "model-name": "Vloadbalancer..base_vlb..module-0",
- "vf-module": {
- "vf-module-id": "e6b3e3eb-34e1-4c00-b8c1-2a4fbe479b12",
- "vf-module-name": "Vfmodule_vLB1113-1",
- "heat-stack-id": "Vfmodule_vLB1113-1/3dd6d900-772f-4fcc-a0cb-e250ab2bb4db",
- "orchestration-status": "active",
- "is-base-vf-module": true,
- "resource-version": "1510604612557",
- "model-invariant-id": "6d760188-9a24-451a-b05b-e08b86cb94f2",
- "model-version-id": "93facad9-55f2-4fe0-9574-814c2bc2d071",
- "model-customization-id": "93fd5bd4-8051-4074-8530-c0c504604df5",
- "module-index": 0
- },
- "extra-properties": {
- "extra-property": [
- {
- "property-name": "model-ver.model-version-id",
- "property-value": "93facad9-55f2-4fe0-9574-814c2bc2d071"
- },
- {
- "property-name": "model-ver.model-name",
- "property-value": "Vloadbalancer..base_vlb..module-0"
- },
- {
- "property-name": "model.model-type",
- "property-value": "resource"
- },
- {
- "property-name": "model.model-invariant-id",
- "property-value": "6d760188-9a24-451a-b05b-e08b86cb94f2"
- },
- {
- "property-name": "model-ver.model-version",
- "property-value": "1"
- }
- ]
- }
- },
- {
- "model-name": "Vloadbalancer..dnsscaling..module-1",
- "vf-module": {
- "vf-module-id": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144",
- "vf-module-name": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144",
- "is-base-vf-module": false,
- "resource-version": "1510610079687",
- "model-invariant-id": "356a1cff-71f2-4086-9980-a2927ce11c1c",
- "model-version-id": "6b93d804-cfc8-4be3-92cc-9336d135859a"
- },
- "extra-properties": {
- "extra-property": [
- {
- "property-name": "model-ver.model-version-id",
- "property-value": "6b93d804-cfc8-4be3-92cc-9336d135859a"
- },
- {
- "property-name": "model-ver.model-name",
- "property-value": "Vloadbalancer..dnsscaling..module-1"
- },
- {
- "property-name": "model.model-type",
- "property-value": "resource"
- },
- {
- "property-name": "model.model-invariant-id",
- "property-value": "356a1cff-71f2-4086-9980-a2927ce11c1c"
- },
- {
- "property-name": "model-ver.model-version",
- "property-value": "1"
- }
- ]
- }
- }
- ]
- }
- },
- {
- "tenant": {
- "tenant-id": "41d6d38489bd40b09ea8a6b6b852dcbd",
- "tenant-name": "Integration-SB-00",
- "resource-version": "1509587770200"
- },
- "extra-properties": {
-
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "cloud-region": {
- "cloud-owner": "CloudOwner",
- "cloud-region-id": "RegionOne",
- "cloud-type": "SharedNode",
- "owner-defined-type": "OwnerType",
- "cloud-region-version": "v1",
- "cloud-zone": "CloudZone",
- "sriov-automation": false,
- "resource-version": "1509587770092"
- },
- "extra-properties": {
-
- }
- }
- ]
- }
- }
- ]
- }
- }
- ]
+ "inventory-response-item": [
+ {
+ "vserver": {
+ "vserver-id": "6ed3642c-f7a1-4a7c-9290-3d51fe1531eb",
+ "vserver-name": "zdfw1lb01lb02",
+ "vserver-name2": "zdfw1lb01lb02",
+ "prov-status": "ACTIVE",
+ "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/6ed3642c-f7a1-4a7c-9290-3d51fe1531eb",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1510606403522"
+ },
+ "extra-properties": {
+
+ },
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "model-name": "vLoadBalancer",
+ "generic-vnf": {
+ "vnf-id": "db373a8d-f7be-4d02-8ac8-6ca4c305d144",
+ "vnf-name": "Vfmodule_vLB1113",
+ "vnf-type": "vLoadBalancer-1106/vLoadBalancer 0",
+ "service-id": "66f157fc-4148-4880-95f5-e120677e98d1",
+ "prov-status": "PREPROV",
+ "orchestration-status": "Created",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1510604011851",
+ "model-invariant-id": "cee050ed-92a5-494f-ab04-234307a846dc",
+ "model-version-id": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2",
+ "model-customization-id": "1983c783-444f-4e79-af3a-85e5d49628f3",
+ "nf-type": "",
+ "nf-function": "",
+ "nf-role": "",
+ "nf-naming-code": ""
+ },
+ "extra-properties": {
+ "extra-property": [
+ {
+ "property-name": "model-ver.model-version-id",
+ "property-value": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2"
+ },
+ {
+ "property-name": "model-ver.model-name",
+ "property-value": "vLoadBalancer"
+ },
+ {
+ "property-name": "model.model-type",
+ "property-value": "resource"
+ },
+ {
+ "property-name": "model.model-invariant-id",
+ "property-value": "cee050ed-92a5-494f-ab04-234307a846dc"
+ },
+ {
+ "property-name": "model-ver.model-version",
+ "property-value": "1.0"
+ }
+ ]
+ },
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "model-name": "vLoadBalancer-1106",
+ "service-instance": {
+ "service-instance-id": "3b12f31f-8f2d-4f5c-b875-61ff1194b941",
+ "service-instance-name": "vLoadBalancer-1113",
+ "model-invariant-id": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a",
+ "model-version-id": "732d4692-4b97-46f9-a996-0b3339e88c50",
+ "resource-version": "1510603936425"
+ },
+ "extra-properties": {
+ "extra-property": [
+ {
+ "property-name": "model-ver.model-version-id",
+ "property-value": "732d4692-4b97-46f9-a996-0b3339e88c50"
+ },
+ {
+ "property-name": "model-ver.model-name",
+ "property-value": "vLoadBalancer-1106"
+ },
+ {
+ "property-name": "model.model-type",
+ "property-value": "service"
+ },
+ {
+ "property-name": "model.model-invariant-id",
+ "property-value": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a"
+ },
+ {
+ "property-name": "model-ver.model-version",
+ "property-value": "1.0"
+ }
+ ]
+ }
+ },
+ {
+ "model-name": "Vloadbalancer..base_vlb..module-0",
+ "vf-module": {
+ "vf-module-id": "e6b3e3eb-34e1-4c00-b8c1-2a4fbe479b12",
+ "vf-module-name": "Vfmodule_vLB1113-1",
+ "heat-stack-id": "Vfmodule_vLB1113-1/3dd6d900-772f-4fcc-a0cb-e250ab2bb4db",
+ "orchestration-status": "active",
+ "is-base-vf-module": true,
+ "resource-version": "1510604612557",
+ "model-invariant-id": "6d760188-9a24-451a-b05b-e08b86cb94f2",
+ "model-version-id": "93facad9-55f2-4fe0-9574-814c2bc2d071",
+ "model-customization-id": "93fd5bd4-8051-4074-8530-c0c504604df5",
+ "module-index": 0
+ },
+ "extra-properties": {
+ "extra-property": [
+ {
+ "property-name": "model-ver.model-version-id",
+ "property-value": "93facad9-55f2-4fe0-9574-814c2bc2d071"
+ },
+ {
+ "property-name": "model-ver.model-name",
+ "property-value": "Vloadbalancer..base_vlb..module-0"
+ },
+ {
+ "property-name": "model.model-type",
+ "property-value": "resource"
+ },
+ {
+ "property-name": "model.model-invariant-id",
+ "property-value": "6d760188-9a24-451a-b05b-e08b86cb94f2"
+ },
+ {
+ "property-name": "model-ver.model-version",
+ "property-value": "1"
+ }
+ ]
+ }
+ },
+ {
+ "model-name": "Vloadbalancer..dnsscaling..module-1",
+ "vf-module": {
+ "vf-module-id": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144",
+ "vf-module-name": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144",
+ "is-base-vf-module": false,
+ "resource-version": "1510610079687",
+ "model-invariant-id": "356a1cff-71f2-4086-9980-a2927ce11c1c",
+ "model-version-id": "6b93d804-cfc8-4be3-92cc-9336d135859a"
+ },
+ "extra-properties": {
+ "extra-property": [
+ {
+ "property-name": "model-ver.model-version-id",
+ "property-value": "6b93d804-cfc8-4be3-92cc-9336d135859a"
+ },
+ {
+ "property-name": "model-ver.model-name",
+ "property-value": "Vloadbalancer..dnsscaling..module-1"
+ },
+ {
+ "property-name": "model.model-type",
+ "property-value": "resource"
+ },
+ {
+ "property-name": "model.model-invariant-id",
+ "property-value": "356a1cff-71f2-4086-9980-a2927ce11c1c"
+ },
+ {
+ "property-name": "model-ver.model-version",
+ "property-value": "1"
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ {
+ "tenant": {
+ "tenant-id": "41d6d38489bd40b09ea8a6b6b852dcbd",
+ "tenant-name": "Integration-SB-00",
+ "resource-version": "1509587770200"
+ },
+ "extra-properties": {
+
+ },
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "cloud-region": {
+ "cloud-owner": "CloudOwner",
+ "cloud-region-id": "RegionOne",
+ "cloud-type": "SharedNode",
+ "owner-defined-type": "OwnerType",
+ "cloud-region-version": "v1",
+ "cloud-zone": "CloudZone",
+ "sriov-automation": false,
+ "resource-version": "1509587770092"
+ },
+ "extra-properties": {
+
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
}
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/HealthCheckEvent.json b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/HealthCheckEvent.json
index 4233f3b57..9a501e44d 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/HealthCheckEvent.json
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/HealthCheckEvent.json
@@ -1,22 +1,22 @@
{
- "input": {
- "action": "HealthCheck",
- "action-identifiers": {
- "vnf-id": "49414df5-3482-4fd8-9952-c463dff2770b"
- },
- "common-header": {
- "request-id": "afr-request3",
- "originator-id": "AFR",
- "api-ver": "2.15",
- "sub-request-id": "AFR-subrequest",
- "timestamp": "2017-11-06T15:15:18.97Z",
- "flags": {
- "ttl": "10000",
- "force": "TRUE",
- "mode": "EXCLUSIVE"
- }
- },
- "payload": "{\"host-ip-address\":\"131.160.203.125\",\"input.url\":\"131.160.203.125/afr\",\"request-action-type\":\"GET\",\"request-action\":\"AFR\"}"
- }
+ "input": {
+ "action": "HealthCheck",
+ "action-identifiers": {
+ "vnf-id": "49414df5-3482-4fd8-9952-c463dff2770b"
+ },
+ "common-header": {
+ "request-id": "afr-request3",
+ "originator-id": "AFR",
+ "api-ver": "2.15",
+ "sub-request-id": "AFR-subrequest",
+ "timestamp": "2017-11-06T15:15:18.97Z",
+ "flags": {
+ "ttl": "10000",
+ "force": "TRUE",
+ "mode": "EXCLUSIVE"
+ }
+ },
+ "payload": "{\"host-ip-address\":\"131.160.203.125\",\"input.url\":\"131.160.203.125/afr\",\"request-action-type\":\"GET\",\"request-action\":\"AFR\"}"
+ }
}
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/MapExampleAddressFull.json b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/MapExampleAddressFull.json
index 2a1911445..e9972131e 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/MapExampleAddressFull.json
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/MapExampleAddressFull.json
@@ -1,18 +1,18 @@
{
- "address0" : {
- "streetaddress" : "1600 Pennsylvania Avenue",
- "city" : "Washington DC"
- },
- "address1" : {
- "streetaddress" : "Somewhere",
- "city" : "Over the rainbow"
- },
- "address2" : {
- "streetaddress" : "221 B Baker St.",
- "city" : "London"
- },
- "address3" : {
- "streetaddress" : "Wayne Manor",
- "city" : "Gotham City"
- }
+ "address0" : {
+ "streetaddress" : "1600 Pennsylvania Avenue",
+ "city" : "Washington DC"
+ },
+ "address1" : {
+ "streetaddress" : "Somewhere",
+ "city" : "Over the rainbow"
+ },
+ "address2" : {
+ "streetaddress" : "221 B Baker St.",
+ "city" : "London"
+ },
+ "address3" : {
+ "streetaddress" : "Wayne Manor",
+ "city" : "Gotham City"
+ }
} \ No newline at end of file
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/MapExampleAddressInvalidFields.json b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/MapExampleAddressInvalidFields.json
index fa23c8328..6116db4f3 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/MapExampleAddressInvalidFields.json
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/MapExampleAddressInvalidFields.json
@@ -1,18 +1,18 @@
{
- "address.0" : {
- "street-address" : "1600 Pennsylvania Avenue",
- "the.city" : "Washington DC"
- },
- "address.1" : {
- "street-address" : "Somewhere",
- "the.city" : "Over the rainbow"
- },
- "address.2" : {
- "street-address" : "221 B Baker St.",
- "the.city" : "London"
- },
- "address.3" : {
- "street-address" : "Wayne Manor",
- "the.city" : "Gotham City"
- }
+ "address.0" : {
+ "street-address" : "1600 Pennsylvania Avenue",
+ "the.city" : "Washington DC"
+ },
+ "address.1" : {
+ "street-address" : "Somewhere",
+ "the.city" : "Over the rainbow"
+ },
+ "address.2" : {
+ "street-address" : "221 B Baker St.",
+ "the.city" : "London"
+ },
+ "address.3" : {
+ "street-address" : "Wayne Manor",
+ "the.city" : "Gotham City"
+ }
} \ No newline at end of file
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/RecordExampleVPNFull.json b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/RecordExampleVPNFull.json
index 7e4da3391..1d0c6e2a1 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/RecordExampleVPNFull.json
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/RecordExampleVPNFull.json
@@ -1,5 +1,5 @@
{
- "nameSpace" : "com.ericsson.apex.domains.vpn.events",
+ "nameSpace" : "org.onap.policy.apex.domains.vpn.events",
"name" : "VPNTriggerEvent",
"version" : "0.0.1",
"source" : "VPNSLA",
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/UnionExampleNullField.json b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/UnionExampleNullField.json
index 4fd33a6eb..67f03344b 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/UnionExampleNullField.json
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/UnionExampleNullField.json
@@ -1,6 +1,6 @@
{
- "name": "Alyssa",
- "favourite_number": 256,
- "favourite_colour": null,
- "favourite_group": "U2"
+ "name": "Alyssa",
+ "favourite_number": 256,
+ "favourite_colour": null,
+ "favourite_group": "U2"
} \ No newline at end of file
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/UnionExampleOptionalField.json b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/UnionExampleOptionalField.json
index f62d25b31..35d20579f 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/UnionExampleOptionalField.json
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/data/UnionExampleOptionalField.json
@@ -1,5 +1,5 @@
{
- "name": "Claire",
- "favourite_number": 123,
- "favourite_colour": null
+ "name": "Claire",
+ "favourite_number": 123,
+ "favourite_colour": null
} \ No newline at end of file
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumer.java
index f2c59453c..e80efa2ee 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumer.java
@@ -24,10 +24,10 @@ import java.util.EnumMap;
import java.util.Map;
import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessageClient;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessageListener;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessageServer;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessager;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageClient;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageListener;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageServer;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessager;
import org.onap.policy.apex.core.infrastructure.threading.ApplicationThreadFactory;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.service.engine.event.ApexEventConsumer;
@@ -44,7 +44,7 @@ import org.slf4j.LoggerFactory;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-public class ApexWebSocketConsumer implements ApexEventConsumer, WSStringMessageListener, Runnable {
+public class ApexWebSocketConsumer implements ApexEventConsumer, WsStringMessageListener, Runnable {
private static final int WEB_SOCKET_WAIT_SLEEP_TIME = 100;
// Get a reference to the logger
@@ -54,7 +54,7 @@ public class ApexWebSocketConsumer implements ApexEventConsumer, WSStringMessage
private WEBSOCKETCarrierTechnologyParameters webSocketConsumerProperties;
// The web socket messager, may be WS a server or a client
- private WSStringMessager wsStringMessager;
+ private WsStringMessager wsStringMessager;
// The event receiver that will receive events from this consumer
private ApexEventReceiver eventReceiver;
@@ -89,10 +89,10 @@ public class ApexWebSocketConsumer implements ApexEventConsumer, WSStringMessage
// Check if this is a server or a client Web Socket
if (webSocketConsumerProperties.isWsClient()) {
// Create a WS client
- wsStringMessager = new WSStringMessageClient(webSocketConsumerProperties.getHost(),
+ wsStringMessager = new WsStringMessageClient(webSocketConsumerProperties.getHost(),
webSocketConsumerProperties.getPort());
} else {
- wsStringMessager = new WSStringMessageServer(webSocketConsumerProperties.getPort());
+ wsStringMessager = new WsStringMessageServer(webSocketConsumerProperties.getPort());
}
// Start reception of event strings on the web socket
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducer.java
index 1fd146824..6be8a3d1a 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducer.java
@@ -24,10 +24,10 @@ import java.util.EnumMap;
import java.util.Map;
import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessageClient;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessageListener;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessageServer;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessager;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageClient;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageListener;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageServer;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessager;
import org.onap.policy.apex.service.engine.event.ApexEventException;
import org.onap.policy.apex.service.engine.event.ApexEventProducer;
import org.onap.policy.apex.service.engine.event.PeeredReference;
@@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-public class ApexWebSocketProducer implements ApexEventProducer, WSStringMessageListener {
+public class ApexWebSocketProducer implements ApexEventProducer, WsStringMessageListener {
// Get a reference to the logger
private static final Logger LOGGER = LoggerFactory.getLogger(ApexWebSocketProducer.class);
@@ -50,7 +50,7 @@ public class ApexWebSocketProducer implements ApexEventProducer, WSStringMessage
private WEBSOCKETCarrierTechnologyParameters webSocketProducerProperties;
// The web socket messager, may be WS a server or a client
- private WSStringMessager wsStringMessager;
+ private WsStringMessager wsStringMessager;
// The name for this producer
private String name = null;
@@ -75,10 +75,10 @@ public class ApexWebSocketProducer implements ApexEventProducer, WSStringMessage
// Check if this is a server or a client Web Socket
if (webSocketProducerProperties.isWsClient()) {
// Create a WS client
- wsStringMessager = new WSStringMessageClient(webSocketProducerProperties.getHost(),
+ wsStringMessager = new WsStringMessageClient(webSocketProducerProperties.getHost(),
webSocketProducerProperties.getPort());
} else {
- wsStringMessager = new WSStringMessageServer(webSocketProducerProperties.getPort());
+ wsStringMessager = new WsStringMessageServer(webSocketProducerProperties.getPort());
}
// Start reception of event strings on the web socket
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexPeriodicEventGenerator.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexPeriodicEventGenerator.java
index 62663b9f1..b34d5185c 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexPeriodicEventGenerator.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexPeriodicEventGenerator.java
@@ -45,7 +45,7 @@ public class ApexPeriodicEventGenerator extends TimerTask {
public static final String PERIODIC_EVENT_VERSION = "0.0.1";
/** The name space of the periodic event. */
- public static final String PERIODIC_EVENT_NAMESPACE = "com.ericsson.apex.service.engine.event";
+ public static final String PERIODIC_EVENT_NAMESPACE = "org.onap.policy.apex.service.engine.event";
/** The source of the periodic event. */
public static final String PERIODIC_EVENT_SOURCE = "internal";
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/enevent/ApexEvent2EnEventConverter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/enevent/ApexEvent2EnEventConverter.java
index 90a19fff2..34690cc7d 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/enevent/ApexEvent2EnEventConverter.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/enevent/ApexEvent2EnEventConverter.java
@@ -90,7 +90,7 @@ public final class ApexEvent2EnEventConverter implements ApexEventConverter {
axEvent.getNameSpace(), axEvent.getSource(), axEvent.getTarget());
// Copy the ExecutionID from the EnEvent into the ApexEvent
- apexEvent.setExecutionID(enEvent.getExecutionID());
+ apexEvent.setExecutionID(enEvent.getExecutionId());
// Copy he exception message to the Apex event if it is set
if (enEvent.getExceptionMessage() != null) {
@@ -136,7 +136,7 @@ public final class ApexEvent2EnEventConverter implements ApexEventConverter {
enEvent.putAll(apexEvent);
// copy the ExecutionID from the ApexEvent into the EnEvent
- enEvent.setExecutionID(apexEvent.getExecutionID());
+ enEvent.setExecutionId(apexEvent.getExecutionID());
return enEvent;
}
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java
index bfd651025..b30ad1846 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java
@@ -43,8 +43,8 @@ public class SuperDooperEventProducer implements ApexEventProducer {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.service.engine.event.ApexEventProducer#init(java.lang.String,
- * com.ericsson.apex.service.parameters.producer.ProducerParameters)
+ * @see org.onap.policy.apex.service.engine.event.ApexEventProducer#init(java.lang.String,
+ * org.onap.policy.apex.service.parameters.producer.ProducerParameters)
*/
@Override
public void init(final String name, final EventHandlerParameters producerParameters) throws ApexEventException {
@@ -54,7 +54,7 @@ public class SuperDooperEventProducer implements ApexEventProducer {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.service.engine.event.ApexEventProducer#getName()
+ * @see org.onap.policy.apex.service.engine.event.ApexEventProducer#getName()
*/
@Override
public String getName() {
@@ -65,7 +65,7 @@ public class SuperDooperEventProducer implements ApexEventProducer {
* (non-Javadoc)
*
* @see
- * com.ericsson.apex.service.engine.event.ApexEventProducer#getPeeredReference(com.ericsson.apex
+ * org.onap.policy.apex.service.engine.event.ApexEventProducer#getPeeredReference(org.onap.policy.apex
* .service.parameters.eventhandler.EventHandlerPeeredMode)
*/
@Override
@@ -77,9 +77,9 @@ public class SuperDooperEventProducer implements ApexEventProducer {
* (non-Javadoc)
*
* @see
- * com.ericsson.apex.service.engine.event.ApexEventProducer#setPeeredReference(com.ericsson.apex
+ * org.onap.policy.apex.service.engine.event.ApexEventProducer#setPeeredReference(org.onap.policy.apex
* .service.parameters.eventhandler.EventHandlerPeeredMode,
- * com.ericsson.apex.service.engine.event.PeeredReference)
+ * org.onap.policy.apex.service.engine.event.PeeredReference)
*/
@Override
public void setPeeredReference(final EventHandlerPeeredMode peeredMode, final PeeredReference peeredReference) {}
@@ -88,7 +88,7 @@ public class SuperDooperEventProducer implements ApexEventProducer {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.service.engine.event.ApexEventProducer#sendEvent(long,
+ * @see org.onap.policy.apex.service.engine.event.ApexEventProducer#sendEvent(long,
* java.lang.String, java.lang.Object)
*/
@Override
@@ -100,7 +100,7 @@ public class SuperDooperEventProducer implements ApexEventProducer {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.service.engine.event.ApexEventProducer#stop()
+ * @see org.onap.policy.apex.service.engine.event.ApexEventProducer#stop()
*/
@Override
public void stop() {}
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/DefaultState_Logic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/DefaultState_Logic.javascript
index c8d212111..e25cb9c6e 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/DefaultState_Logic.javascript
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/DefaultState_Logic.javascript
@@ -23,5 +23,5 @@ var gc = executor.getContextAlbum("GlobalContextAlbum");
executor.logger.debug(gc.name);
executor.subject.defaultTaskKey.copyTo(executor.selectedTask)
-var returnValue = executor.TRUE;
+var returnValue = executor.isTrue;
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/DefaultTask_Logic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/DefaultTask_Logic.javascript
index 79ea95919..f98e16555 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/DefaultTask_Logic.javascript
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/DefaultTask_Logic.javascript
@@ -31,4 +31,4 @@ timeNow = new JavaDate();
executor.outFields.put("Test<STATE_NAME>StateTime", timeNow.getTime());
executor.logger.debug(executor.eo);
-var returnValue = executor.TRUE;
+var returnValue = executor.isTrue;
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/EvalState_Logic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/EvalState_Logic.javascript
index 4c6e66d36..535cad595 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/EvalState_Logic.javascript
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/EvalState_Logic.javascript
@@ -21,5 +21,5 @@
executor.logger.debug(executor.subject.id);
executor.subject.defaultTaskKey.copyTo(executor.selectedTask);
-var returnValue = executor.TRUE;
+var returnValue = executor.isTrue;
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/EvalTask_Logic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/EvalTask_Logic.javascript
index 2c9bc6d2d..b0756504c 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/EvalTask_Logic.javascript
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/EvalTask_Logic.javascript
@@ -26,4 +26,4 @@ timeNow = new JavaDate();
executor.outFields.put("State<STATE_NUMBER>Timestamp", timeNow.getTime());
executor.logger.debug(executor.outFields);
-var returnValue = executor.TRUE;
+var returnValue = executor.isTrue;
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/DefaultState_Logic.jython b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/DefaultState_Logic.jython
index 265316e1f..9752f057d 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/DefaultState_Logic.jython
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/DefaultState_Logic.jython
@@ -24,4 +24,4 @@ executor.logger.debug('id: ' + executor.subject.id)
executor.logger.debug('ctxt name: ' + executor.getContextAlbum("GlobalContextAlbum").name)
executor.subject.defaultTaskKey.copyTo(executor.selectedTask)
-returnValue = executor.TRUE
+returnValue = executor.isTrue
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/DefaultTask_Logic.jython b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/DefaultTask_Logic.jython
index 16993d0df..f57ce3f0a 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/DefaultTask_Logic.jython
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/DefaultTask_Logic.jython
@@ -32,4 +32,4 @@ executor.outFields["Test<STATE_NAME>CaseSelected"] = Byte("<RANDOM_BYTE_VALUE>")
timeValue = Long(Date().getTime());
executor.outFields["Test<STATE_NAME>StateTime"] = timeValue
executor.logger.debug('outFields: ' + executor.outFields.toString())
-returnValue = executor.TRUE
+returnValue = executor.isTrue
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/EvalState_Logic.jython b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/EvalState_Logic.jython
index 9a0102866..94f90b258 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/EvalState_Logic.jython
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/EvalState_Logic.jython
@@ -22,4 +22,4 @@ executor.logger.debug('id: ' + executor.subject.id);
executor.subject.defaultTaskKey.copyTo(executor.selectedTask);
-returnValue = executor.TRUE;
+returnValue = executor.isTrue;
diff --git a/testsuites/integration/integration-executor-test/src/test/resources/logback-test.xml b/testsuites/integration/integration-executor-test/src/test/resources/logback-test.xml
index b0fa687ce..549fb1912 100644
--- a/testsuites/integration/integration-executor-test/src/test/resources/logback-test.xml
+++ b/testsuites/integration/integration-executor-test/src/test/resources/logback-test.xml
@@ -72,7 +72,7 @@
<appender-ref ref="STDOUT" />
</logger>
- <logger name="com.ericsson.apex" level="INFO" additivity="false">
+ <logger name="org.onap.policy.apex" level="INFO" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
</configuration>
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerClient.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerClient.java
index dc186a1e8..bda312c42 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerClient.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerClient.java
@@ -22,11 +22,11 @@ package org.onap.policy.apex.apps.uservice.test.adapt.websocket;
import org.onap.policy.apex.apps.uservice.test.adapt.events.EventGenerator;
import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessageClient;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessageListener;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageClient;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageListener;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
-public class WebSocketEventProducerClient implements WSStringMessageListener {
+public class WebSocketEventProducerClient implements WsStringMessageListener {
private final String host;
private final int port;
private final int eventCount;
@@ -34,7 +34,7 @@ public class WebSocketEventProducerClient implements WSStringMessageListener {
private final long eventInterval;
private long eventsSentCount = 0;
- WSStringMessageClient client;
+ WsStringMessageClient client;
public WebSocketEventProducerClient(final String host, final int port, final int eventCount,
final boolean xmlEvents, final long eventInterval) throws MessagingException {
@@ -44,7 +44,7 @@ public class WebSocketEventProducerClient implements WSStringMessageListener {
this.xmlEvents = xmlEvents;
this.eventInterval = eventInterval;
- client = new WSStringMessageClient(host, port);
+ client = new WsStringMessageClient(host, port);
client.start(this);
System.out.println(WebSocketEventProducerClient.class.getCanonicalName() + ": host " + host + ", port " + port
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerServer.java
index 32b463d6f..a36c4d61e 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerServer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerServer.java
@@ -22,18 +22,18 @@ package org.onap.policy.apex.apps.uservice.test.adapt.websocket;
import org.onap.policy.apex.apps.uservice.test.adapt.events.EventGenerator;
import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessageListener;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessageServer;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageListener;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageServer;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
-public class WebSocketEventProducerServer implements WSStringMessageListener {
+public class WebSocketEventProducerServer implements WsStringMessageListener {
private final int port;
private final int eventCount;
private final boolean xmlEvents;
private final long eventInterval;
private long eventsSentCount = 0;
- WSStringMessageServer server;
+ WsStringMessageServer server;
public WebSocketEventProducerServer(final int port, final int eventCount, final boolean xmlEvents,
final long eventInterval) throws MessagingException {
@@ -42,7 +42,7 @@ public class WebSocketEventProducerServer implements WSStringMessageListener {
this.xmlEvents = xmlEvents;
this.eventInterval = eventInterval;
- server = new WSStringMessageServer(port);
+ server = new WsStringMessageServer(port);
server.start(this);
System.out.println(WebSocketEventProducerServer.class.getCanonicalName() + ": port " + port + ", event count "
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberClient.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberClient.java
index 639d7ae77..48ca9c884 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberClient.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberClient.java
@@ -21,19 +21,19 @@
package org.onap.policy.apex.apps.uservice.test.adapt.websocket;
import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessageClient;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessageListener;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageClient;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageListener;
-public class WebSocketEventSubscriberClient implements WSStringMessageListener {
+public class WebSocketEventSubscriberClient implements WsStringMessageListener {
private final int port;
private long eventsReceivedCount = 0;
- private final WSStringMessageClient client;
+ private final WsStringMessageClient client;
public WebSocketEventSubscriberClient(final String host, final int port) throws MessagingException {
this.port = port;
- client = new WSStringMessageClient(host, port);
+ client = new WsStringMessageClient(host, port);
client.start(this);
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberServer.java
index bfa543774..83e324b9c 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberServer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberServer.java
@@ -21,19 +21,19 @@
package org.onap.policy.apex.apps.uservice.test.adapt.websocket;
import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessageListener;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WSStringMessageServer;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageListener;
+import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageServer;
-public class WebSocketEventSubscriberServer implements WSStringMessageListener {
+public class WebSocketEventSubscriberServer implements WsStringMessageListener {
private final int port;
private long eventsReceivedCount = 0;
- private final WSStringMessageServer server;
+ private final WsStringMessageServer server;
public WebSocketEventSubscriberServer(final int port) throws MessagingException {
this.port = port;
- server = new WSStringMessageServer(port);
+ server = new WsStringMessageServer(port);
server.start(this);
System.out.println(
diff --git a/tools/tools-common/src/site-docs/adoc/fragments/example-cli.adoc b/tools/tools-common/src/site-docs/adoc/fragments/example-cli.adoc
index 3755502ef..32a0e957b 100644
--- a/tools/tools-common/src/site-docs/adoc/fragments/example-cli.adoc
+++ b/tools/tools-common/src/site-docs/adoc/fragments/example-cli.adoc
@@ -19,8 +19,8 @@ First, add the dependency of the utility project to your POM file.
[source,xml,subs="attributes+"]
----
<dependency>
- <groupId>com.ericsson.apex.apps</groupId>
- <artifactId>apex-apps</artifactId>
+ <groupId>org.onap.policy.apex-pdp.tools</groupId>
+ <artifactId>tools-common</artifactId>
<version>{release-version}</version>
</dependency>
----