summaryrefslogtreecommitdiffstats
path: root/sparkybe-onap-service/src
diff options
context:
space:
mode:
Diffstat (limited to 'sparkybe-onap-service/src')
-rw-r--r--sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewandinspect/services/BaseGizmoVisualizationContext.java20
-rw-r--r--sparkybe-onap-service/src/main/resources/logging/AAIUIMsgs.properties8
-rw-r--r--sparkybe-onap-service/src/test/java/org/onap/aai/sparky/logging/util/LoggingMessageTemplateTest.java62
3 files changed, 75 insertions, 15 deletions
diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewandinspect/services/BaseGizmoVisualizationContext.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewandinspect/services/BaseGizmoVisualizationContext.java
index 4177b44..11a771b 100644
--- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewandinspect/services/BaseGizmoVisualizationContext.java
+++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewandinspect/services/BaseGizmoVisualizationContext.java
@@ -194,8 +194,8 @@ public class BaseGizmoVisualizationContext implements VisualizationContext {
ain.setEntityType(gizmoEntity.getType());
ain.setPrimaryKeyName(getEntityTypePrimaryKeyName(gizmoEntity.getType()));
-
- OxmEntityDescriptor descriptor = oxmEntityLookup.getEntityDescriptors().get(gizmoEntity);
+
+ OxmEntityDescriptor descriptor = oxmEntityLookup.getEntityDescriptors().get(gizmoEntity.getType());
if (descriptor != null) {
ain.setPrimaryKeyValue(getPrimaryKeyValues(gizmoEntity.getProperties(),
@@ -203,7 +203,7 @@ public class BaseGizmoVisualizationContext implements VisualizationContext {
} else {
LOG.error(AaiUiMsgs.ERROR_GENERIC, "Could not determine oxm descriptor for entity type = " + gizmoEntity.getType());
}
-
+
gizmoEntity.getProperties().forEach((key, value) -> {
ain.getProperties().put(key, value);
});
@@ -212,8 +212,6 @@ public class BaseGizmoVisualizationContext implements VisualizationContext {
if (ain.getSelfLink() != null) {
ain.addProperty(SparkyConstants.URI_ATTR_NAME, ain.getSelfLink());
}
-
-
/*
* Only discover neighbors if our depth is less than the Max-Traversal-Depth
@@ -223,7 +221,7 @@ public class BaseGizmoVisualizationContext implements VisualizationContext {
/*
* I think the next thing to do is:
- *
+ *
* 1. Calculate the source / target node id 2. Add the nodeId to the incoming / outgoing links
* collection 3. Add the node to the node cache for processing
*/
@@ -598,7 +596,7 @@ public class BaseGizmoVisualizationContext implements VisualizationContext {
break;
}
- case READY:
+ case READY:
case ERROR: {
break;
}
@@ -618,7 +616,7 @@ public class BaseGizmoVisualizationContext implements VisualizationContext {
}
}
-
+
dumpThrottledWorkOnHandLog();
}
@@ -773,7 +771,7 @@ public class BaseGizmoVisualizationContext implements VisualizationContext {
}
}
-
+
return (aaiWorkOnHand.get() + numNodesWithPendingStates);
}
@@ -803,14 +801,14 @@ public class BaseGizmoVisualizationContext implements VisualizationContext {
}
}
-
+
dumpThrottledWorkOnHandLog(true);
}
/*
* (non-Javadoc)
- *
+ *
* @see
* org.onap.aai.sparky.viewandinspect.services.VisualizationContext#processSelfLinks(org.onap.aai.
* sparky.sync.entity.SearchableEntity, org.onap.aai.sparky.viewandinspect.entity.QueryParams)
diff --git a/sparkybe-onap-service/src/main/resources/logging/AAIUIMsgs.properties b/sparkybe-onap-service/src/main/resources/logging/AAIUIMsgs.properties
index a3fb16c..94196e2 100644
--- a/sparkybe-onap-service/src/main/resources/logging/AAIUIMsgs.properties
+++ b/sparkybe-onap-service/src/main/resources/logging/AAIUIMsgs.properties
@@ -434,7 +434,7 @@ ES_ABORT_CROSS_ENTITY_REF_SYNC=\
Error extracting {0} from response, aborting cross entity ref sync of {1}. Error : {2}
MISSING_ENTITY_DESCRIPTOR=\
- AAIUI30030E
+ AAIUI30030E|\
Missing entity descriptor for type : {0}
SELF_LINK_GET=\
@@ -462,7 +462,7 @@ ERROR_GENERIC=\
{0}
ERROR_PROCESSING_REQUEST=\
- AAIUI30037E\
+ AAIUI30037E|\
Failure to process request with error: {1}
ERROR_CSP_CONFIG_FILE=\
@@ -754,11 +754,11 @@ FAILED_TO_PROCESS_NODE_INTEGRITY=\
Failed to process node integrity: {0}
FAILURE_TO_PROCESS_REQUEST=\
- AAIUI300111E\
+ AAIUI300111E|\
Failure to process request. {0}
FAILED_TO_DETERMINE=\
- AAIUI300112E\
+ AAIUI300112E|\
Failed to determine {0}
FAILED_TO_ANALYZE=\
diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/logging/util/LoggingMessageTemplateTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/logging/util/LoggingMessageTemplateTest.java
new file mode 100644
index 0000000..e75b8ef
--- /dev/null
+++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/logging/util/LoggingMessageTemplateTest.java
@@ -0,0 +1,62 @@
+package org.onap.aai.sparky.logging.util;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.aai.sparky.logging.AaiUiMsgs;
+
+import com.att.eelf.i18n.EELFResourceManager;
+
+public class LoggingMessageTemplateTest {
+
+ @Test
+ public void validateAllMessageEnumsHaveValidMessageFormats() {
+
+ /*
+ * I discovered that some of the message formats had missing characters
+ * which made the EELFResourceManager interpret the message format as null
+ * which would inturn randomly geneate Null-Pointer-Exceptions while trying
+ * log formatted messages.
+ *
+ * Two concrete examples of this issue are as follows, from the AaiUiMsgs.properties
+ *
+ * ERROR_PROCESSING_REQUEST=\
+ * AAIUI30037E
+ * Failure to process request with error: {1}
+ *
+ * ERROR_PROCESSING_REQUEST=\
+ * AAIUI30037E\
+ * Failure to process request with error: {1}
+ *
+ * Both of these formats look valid except for the second line. The code is expected to be terminated with a |\
+ * and this character sequence was missing from 4 of the message enums in our file. I created this
+ * test case to catch any future formatting errors of the message templates. There is no obvious error that
+ * exposes this problem until we experience an NPE at runtime, but even then it's not clear as to why it happened.
+ * Hopefully now we will be able to at least catch those issues before they happen.
+ */
+
+
+ int numMessageTemplatesWithMissingFormats = 0;
+
+ for ( AaiUiMsgs x : AaiUiMsgs.values() ) {
+
+ if (x != null) {
+
+ String format = EELFResourceManager.getMessage(x);
+
+ if (format == null) {
+
+ numMessageTemplatesWithMissingFormats++;
+ System.out
+ .println("Message enum = " + x + " has a missing message format.");
+ }
+ }
+ }
+
+ assertEquals(0, numMessageTemplatesWithMissingFormats);
+
+ }
+
+
+
+}