summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@bell.ca>2021-01-13 12:26:35 +0000
committera.sreekumar <ajith.sreekumar@bell.ca>2021-01-13 17:53:17 +0000
commit5f233e2e307e5202bfe1f319185f0880d354cb67 (patch)
treeb64ef887a5a7a82699806955bca528d382853c30
parentd05021ebfc7a7f57cb88a5e380b403118ceeaa13 (diff)
Avoiding unwanted logging in APEX during event processing
Change-Id: If0c93bfea08025c6c10e3f4572a14088990f415f Issue-ID: POLICY-2885 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java23
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaEnumTest.java13
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaFixedTest.java16
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperMarshalTest.java21
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperUnmarshalTest.java43
-rw-r--r--plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java6
-rw-r--r--plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsTextEventConverter.java7
-rw-r--r--plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/main/java/org/onap/policy/apex/plugins/event/protocol/xml/Apex2XmlEventConverter.java10
-rw-r--r--plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/Apex2YamlEventConverter.java7
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/apexprotocolplugin/Apex2ApexEventConverter.java12
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/enevent/ApexEvent2EnEventConverter.java8
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java13
12 files changed, 52 insertions, 127 deletions
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java
index 194856fad..020cc1520 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,8 +44,6 @@ import org.onap.policy.apex.context.impl.schema.AbstractSchemaHelper;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
/**
* This class is the implementation of the {@link org.onap.policy.apex.context.SchemaHelper} interface for Avro schemas.
@@ -53,7 +52,6 @@ import org.slf4j.ext.XLoggerFactory;
*/
public class AvroSchemaHelper extends AbstractSchemaHelper {
// Get a reference to the logger
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(AvroSchemaHelper.class);
// Recurring string constants
private static final String OBJECT_TAG = ": object \"";
@@ -73,9 +71,8 @@ public class AvroSchemaHelper extends AbstractSchemaHelper {
avroSchema = new Schema.Parser().parse(schema.getSchema());
} catch (final Exception e) {
final String resultSting = userKey.getId() + ": avro context schema \"" + schema.getId()
- + "\" schema is invalid: " + e.getMessage() + ", schema: " + schema.getSchema();
- LOGGER.warn(resultSting, e);
- throw new ContextRuntimeException(resultSting);
+ + "\" schema is invalid, schema: " + schema.getSchema();
+ throw new ContextRuntimeException(resultSting, e);
}
// Get the object mapper for the schema type to a Java class
@@ -128,7 +125,6 @@ public class AvroSchemaHelper extends AbstractSchemaHelper {
} else {
final String returnString =
getUserKey().getId() + ": the object \"" + incomingObject + "\" is not an instance of JsonObject";
- LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
}
@@ -144,7 +140,6 @@ public class AvroSchemaHelper extends AbstractSchemaHelper {
} else {
final String returnString = getUserKey().getId() + ": the schema \"" + avroSchema.getName()
+ "\" does not have a subtype of type \"" + subInstanceType + "\"";
- LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
}
@@ -232,9 +227,8 @@ public class AvroSchemaHelper extends AbstractSchemaHelper {
final JsonDecoder jsonDecoder = DecoderFactory.get().jsonDecoder(avroSchema, objectString);
decodedObject = new GenericDatumReader<GenericRecord>(avroSchema).read(null, jsonDecoder);
} catch (final Exception e) {
- final String returnString = getUserKey().getId() + OBJECT_TAG + objectString
- + "\" Avro unmarshalling failed: " + e.getMessage();
- LOGGER.warn(returnString, e);
+ final String returnString =
+ getUserKey().getId() + OBJECT_TAG + objectString + "\" Avro unmarshalling failed.";
throw new ContextRuntimeException(returnString, e);
}
@@ -259,8 +253,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper {
final String returnString = getUserKey().getId() + OBJECT_TAG + object + "\" of type \""
+ (object != null ? object.getClass().getName() : "null") + "\" must be assignable to \""
+ getSchemaClass().getName() + "\" or be a Json string representation of it for Avro unmarshalling";
- LOGGER.warn(returnString, e);
- throw new ContextRuntimeException(returnString);
+ throw new ContextRuntimeException(returnString, e);
}
}
@@ -311,9 +304,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper {
jsonEncoder.flush();
return new String(output.toByteArray());
} catch (final Exception e) {
- final String returnString =
- getUserKey().getId() + OBJECT_TAG + object + "\" Avro marshalling failed: " + e.getMessage();
- LOGGER.warn(returnString);
+ final String returnString = getUserKey().getId() + OBJECT_TAG + object + "\" Avro marshalling failed.";
throw new ContextRuntimeException(returnString, e);
}
}
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaEnumTest.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaEnumTest.java
index e4a336676..d3cd7a482 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaEnumTest.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaEnumTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -121,17 +122,13 @@ public class AvroSchemaEnumTest {
testUnmarshalMarshal(schemaHelper, "src/test/resources/data/EnumExampleHearts.json");
assertThatThrownBy(() -> testUnmarshalMarshal(schemaHelper, "src/test/resources/data/EnumExampleNull.json"))
- .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: Expected fixed. "
- + "Got VALUE_NULL");
+ .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed.");
assertThatThrownBy(() -> testUnmarshalMarshal(schemaHelper, "src/test/resources/data/EnumExampleNull.json"))
- .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: Expected fixed. "
- + "Got VALUE_NULL");
+ .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed.");
assertThatThrownBy(() -> testUnmarshalMarshal(schemaHelper, "src/test/resources/data/EnumExampleBad0.json"))
- .hasMessage("AvroTest:0.0.1: object \"\"TWEED\"\" Avro unmarshalling failed: Unknown symbol "
- + "in enum TWEED");
+ .hasMessage("AvroTest:0.0.1: object \"\"TWEED\"\" Avro unmarshalling failed.");
assertThatThrownBy(() -> testUnmarshalMarshal(schemaHelper, "src/test/resources/data/EnumExampleBad1.json"))
- .hasMessage("AvroTest:0.0.1: object \"\"Hearts\"\" Avro unmarshalling failed: Unknown symbol "
- + "in enum Hearts");
+ .hasMessage("AvroTest:0.0.1: object \"\"Hearts\"\" Avro unmarshalling failed.");
}
/**
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaFixedTest.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaFixedTest.java
index 368619ee8..93797fba1 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaFixedTest.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaFixedTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -124,18 +125,15 @@ public class AvroSchemaFixedTest {
testUnmarshalMarshal(schemaHelper, "src/test/resources/data/FixedExampleGood.json");
assertThatThrownBy(() -> testUnmarshalMarshal(schemaHelper, "src/test/resources/data/FixedExampleNull.json"))
- .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: Expected fixed. "
- + "Got VALUE_NULL");
+ .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed.");
assertThatThrownBy(() -> testUnmarshalMarshal(schemaHelper, "src/test/resources/data/FixedExampleNull.json"))
- .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: Expected fixed. "
- + "Got VALUE_NULL");
+ .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed.");
assertThatThrownBy(() -> testUnmarshalMarshal(schemaHelper, "src/test/resources/data/FixedExampleBad0.json"))
- .hasMessage("AvroTest:0.0.1: object \"\"BADBAD\"\" "
- + "Avro unmarshalling failed: Expected fixed length 64, but got6");
+ .hasMessage("AvroTest:0.0.1: object \"\"BADBAD\"\" " + "Avro unmarshalling failed.");
assertThatThrownBy(() -> testUnmarshalMarshal(schemaHelper, "src/test/resources/data/FixedExampleBad1.json"))
- .hasMessage("AvroTest:0.0.1: object "
- + "\"\"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0\"\" "
- + "Avro unmarshalling failed: Expected fixed length 64, but got65");
+ .hasMessage(
+ "AvroTest:0.0.1: object " + "\"\"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0\"\" "
+ + "Avro unmarshalling failed.");
}
/**
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperMarshalTest.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperMarshalTest.java
index d84481da8..06848c9a9 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperMarshalTest.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperMarshalTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -109,13 +110,9 @@ public class AvroSchemaHelperMarshalTest {
assertEquals("true", schemaHelper1.marshal2String(true));
assertEquals("false", schemaHelper1.marshal2String(false));
assertThatThrownBy(() -> schemaHelper1.marshal2String(0))
- .hasMessage("AvroTest:0.0.1: object \"0\" Avro marshalling failed: "
- + "class java.lang.Integer cannot be cast to class java.lang.Boolean (java.lang.Integer and "
- + "java.lang.Boolean are in module java.base of loader 'bootstrap')");
+ .hasMessage("AvroTest:0.0.1: object \"0\" Avro marshalling failed.");
assertThatThrownBy(() -> schemaHelper1.marshal2String("0"))
- .hasMessage("AvroTest:0.0.1: object \"0\" Avro marshalling failed: class java.lang.String "
- + "cannot be cast to class java.lang.Boolean (java.lang.String and java.lang.Boolean are in module"
- + " java.base of loader 'bootstrap')");
+ .hasMessage("AvroTest:0.0.1: object \"0\" Avro marshalling failed.");
}
/**
@@ -138,8 +135,7 @@ public class AvroSchemaHelperMarshalTest {
assertEquals("2147483647", schemaHelper2.marshal2String(2147483647));
assertEquals("-2147483648", schemaHelper2.marshal2String(-2147483648));
assertThatThrownBy(() -> schemaHelper2.marshal2String("Hello"))
- .hasMessageStartingWith("AvroTest:0.0.1: object \"Hello\" Avro marshalling failed: "
- + "class java.lang.String cannot be cast to class java.lang.Number");
+ .hasMessageStartingWith("AvroTest:0.0.1: object \"Hello\" Avro marshalling failed.");
assertThatThrownBy(() -> schemaHelper2.marshal2String(null))
.hasMessageStartingWith("AvroTest:0.0.1: cannot encode a null object of class \"java.lang.Integer\"");
}
@@ -162,8 +158,7 @@ public class AvroSchemaHelperMarshalTest {
assertEquals("9223372036854775807", schemaHelper3.marshal2String(9223372036854775807L));
assertEquals("-9223372036854775808", schemaHelper3.marshal2String(-9223372036854775808L));
assertThatThrownBy(() -> schemaHelper3.marshal2String("Hello"))
- .hasMessageStartingWith("AvroTest:0.0.1: object \"Hello\" Avro marshalling failed: "
- + "class java.lang.String cannot be cast to class java.lang.Long");
+ .hasMessageStartingWith("AvroTest:0.0.1: object \"Hello\" Avro marshalling failed.");
assertThatThrownBy(() -> schemaHelper3.marshal2String(null))
.hasMessageStartingWith("AvroTest:0.0.1: cannot encode a null object of class \"java.lang.Long\"");
}
@@ -190,8 +185,7 @@ public class AvroSchemaHelperMarshalTest {
assertEquals("9.223372E18", schemaHelper4.marshal2String(9.223372E18F));
assertEquals("-9.223372E18", schemaHelper4.marshal2String(-9.223372E18F));
assertThatThrownBy(() -> schemaHelper4.marshal2String("Hello"))
- .hasMessageStartingWith("AvroTest:0.0.1: object \"Hello\" Avro marshalling failed: "
- + "class java.lang.String cannot be cast to class java.lang.Float");
+ .hasMessageStartingWith("AvroTest:0.0.1: object \"Hello\" Avro marshalling failed.");
assertThatThrownBy(() -> schemaHelper4.marshal2String(null))
.hasMessageStartingWith("AvroTest:0.0.1: cannot encode a null object of class \"java.lang.Float\"");
}
@@ -218,8 +212,7 @@ public class AvroSchemaHelperMarshalTest {
assertEquals("9.223372036854776E18", schemaHelper5.marshal2String(9.223372036854776E18));
assertEquals("-9.223372036854776E18", schemaHelper5.marshal2String(-9.223372036854776E18));
assertThatThrownBy(() -> schemaHelper5.marshal2String("Hello"))
- .hasMessageStartingWith("AvroTest:0.0.1: object \"Hello\" Avro marshalling failed: "
- + "class java.lang.String cannot be cast to class java.lang.Double");
+ .hasMessageStartingWith("AvroTest:0.0.1: object \"Hello\" Avro marshalling failed.");
assertThatThrownBy(() -> schemaHelper5.marshal2String(null))
.hasMessageStartingWith("AvroTest:0.0.1: cannot encode a null object of class \"java.lang.Double\"");
}
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperUnmarshalTest.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperUnmarshalTest.java
index 2b6050acc..23ac9a855 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperUnmarshalTest.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperUnmarshalTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -95,8 +96,7 @@ public class AvroSchemaHelperUnmarshalTest {
assertEquals(null, schemaHelper0.unmarshal("null"));
assertThatThrownBy(() -> schemaHelper0.unmarshal("123"))
- .hasMessage("AvroTest:0.0.1: object \"123\" Avro unmarshalling failed: "
- + "Expected null. Got VALUE_NUMBER_INT");
+ .hasMessage("AvroTest:0.0.1: object \"123\" Avro unmarshalling failed.");
}
/**
@@ -149,14 +149,11 @@ public class AvroSchemaHelperUnmarshalTest {
assertEquals(2147483647, schemaHelper2.unmarshal("2147483647"));
assertEquals(-2147483648, schemaHelper2.unmarshal("-2147483648"));
assertThatThrownBy(() -> schemaHelper2.unmarshal("2147483648"))
- .hasMessageStartingWith("AvroTest:0.0.1: object \"2147483648\" Avro unmarshalling failed: "
- + "Numeric value (2147483648) out of range of int");
+ .hasMessageStartingWith("AvroTest:0.0.1: object \"2147483648\" Avro unmarshalling failed.");
assertThatThrownBy(() -> schemaHelper2.unmarshal("-2147483649"))
- .hasMessageStartingWith("AvroTest:0.0.1: object \"-2147483649\" Avro unmarshalling failed: "
- + "Numeric value (-2147483649) out of range of int");
+ .hasMessageStartingWith("AvroTest:0.0.1: object \"-2147483649\" Avro unmarshalling failed.");
assertThatThrownBy(() -> schemaHelper2.unmarshal(null))
- .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: "
- + "String to read from cannot be null!");
+ .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed.");
}
/**
@@ -184,17 +181,13 @@ public class AvroSchemaHelperUnmarshalTest {
assertEquals(9223372036854775807L, schemaHelper3.unmarshal("9223372036854775807"));
assertEquals(-9223372036854775808L, schemaHelper3.unmarshal("-9223372036854775808"));
assertThatThrownBy(() -> schemaHelper3.unmarshal("9223372036854775808"))
- .hasMessageStartingWith("AvroTest:0.0.1: object \"9223372036854775808\" Avro unmarshalling failed: "
- + "Numeric value (9223372036854775808) out of range of long");
+ .hasMessageStartingWith("AvroTest:0.0.1: object \"9223372036854775808\" Avro unmarshalling failed.");
assertThatThrownBy(() -> schemaHelper3.unmarshal("-9223372036854775809"))
- .hasMessageStartingWith("AvroTest:0.0.1: object \"-9223372036854775809\" Avro unmarshalling failed: "
- + "Numeric value (-9223372036854775809) out of range of long");
+ .hasMessageStartingWith("AvroTest:0.0.1: object \"-9223372036854775809\" Avro unmarshalling failed.");
assertThatThrownBy(() -> schemaHelper3.unmarshal("\"Hello\""))
- .hasMessage("AvroTest:0.0.1: object \"\"Hello\"\" Avro unmarshalling failed: "
- + "Expected long. Got VALUE_STRING");
+ .hasMessage("AvroTest:0.0.1: object \"\"Hello\"\" Avro unmarshalling failed.");
assertThatThrownBy(() -> schemaHelper3.unmarshal(null))
- .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: "
- + "String to read from cannot be null!");
+ .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed.");
}
/**
@@ -224,11 +217,9 @@ public class AvroSchemaHelperUnmarshalTest {
assertEquals(9.223372E18F, schemaHelper4.unmarshal("9223372036854775808"));
assertEquals(-9.223372E18F, schemaHelper4.unmarshal("-9223372036854775809"));
assertThatThrownBy(() -> schemaHelper4.unmarshal("\"Hello\""))
- .hasMessage("AvroTest:0.0.1: object \"\"Hello\"\" Avro unmarshalling failed: "
- + "Expected float. Got VALUE_STRING");
+ .hasMessage("AvroTest:0.0.1: object \"\"Hello\"\" Avro unmarshalling failed.");
assertThatThrownBy(() -> schemaHelper4.unmarshal(null))
- .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: "
- + "String to read from cannot be null!");
+ .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed.");
}
/**
@@ -258,11 +249,9 @@ public class AvroSchemaHelperUnmarshalTest {
assertEquals(9.223372036854776E18, schemaHelper5.unmarshal("9223372036854775808"));
assertEquals(-9.223372036854776E18, schemaHelper5.unmarshal("-9223372036854775809"));
assertThatThrownBy(() -> schemaHelper5.unmarshal("\"Hello\""))
- .hasMessage("AvroTest:0.0.1: object \"\"Hello\"\" Avro unmarshalling failed: "
- + "Expected double. Got VALUE_STRING");
+ .hasMessage("AvroTest:0.0.1: object \"\"Hello\"\" Avro unmarshalling failed.");
assertThatThrownBy(() -> schemaHelper5.unmarshal(null))
- .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: "
- + "String to read from cannot be null!");
+ .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed.");
}
/**
@@ -292,8 +281,7 @@ public class AvroSchemaHelperUnmarshalTest {
assertEquals("Hello", schemaHelper7.unmarshal("Hello"));
assertEquals("Hello", schemaHelper7.unmarshal(new Utf8("Hello")));
assertThatThrownBy(() -> schemaHelper7.unmarshal(null))
- .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: "
- + "String to read from cannot be null!");
+ .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed.");
}
/**
@@ -319,7 +307,6 @@ public class AvroSchemaHelperUnmarshalTest {
assertEquals(111, newBytes[4]);
assertThatThrownBy(() -> schemaHelper.unmarshal(null))
- .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: "
- + "String to read from cannot be null!");
+ .hasMessage("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed.");
}
}
diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java
index f50a1dc1d..0f3a21bdc 100644
--- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java
+++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -82,7 +83,6 @@ public final class Apex2JmsObjectEventConverter implements ApexEventProtocolConv
} catch (Exception e) {
final String errorMessage = "message \"" + eventObject
+ "\" received from JMS does not have a \"getObject()\" method";
- LOGGER.warn(errorMessage, e);
throw new ApexEventRuntimeException(errorMessage);
}
@@ -92,7 +92,6 @@ public final class Apex2JmsObjectEventConverter implements ApexEventProtocolConv
} catch (final Exception e) {
final String errorMessage = "object contained in message \"" + eventObject
+ "\" received from JMS could not be retrieved as a Java object";
- LOGGER.debug(errorMessage, e);
throw new ApexEventRuntimeException(errorMessage, e);
}
@@ -100,7 +99,6 @@ public final class Apex2JmsObjectEventConverter implements ApexEventProtocolConv
if (eventProtocolParameters == null) {
final String errorMessage = "consumer parameters for JMS events consumed by "
+ "Apex are not set in the Apex configuration for this engine";
- LOGGER.debug(errorMessage);
throw new ApexEventRuntimeException(errorMessage);
}
@@ -130,7 +128,6 @@ public final class Apex2JmsObjectEventConverter implements ApexEventProtocolConv
public Object fromApexEvent(final ApexEvent apexEvent) throws ApexEventException {
// Check the Apex event
if (apexEvent == null) {
- LOGGER.warn("event processing failed, Apex event is null");
throw new ApexEventException("event processing failed, Apex event is null");
}
@@ -138,7 +135,6 @@ public final class Apex2JmsObjectEventConverter implements ApexEventProtocolConv
if (apexEvent.size() != 1) {
final String errorMessage = "event processing failed, "
+ "Apex event must have one and only one parameter for JMS Object handling";
- LOGGER.warn(errorMessage);
throw new ApexEventException(errorMessage);
}
diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsTextEventConverter.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsTextEventConverter.java
index fcd54978e..e9f9109c0 100644
--- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsTextEventConverter.java
+++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsTextEventConverter.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,8 +27,6 @@ import org.onap.policy.apex.service.engine.event.ApexEvent;
import org.onap.policy.apex.service.engine.event.ApexEventException;
import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException;
import org.onap.policy.apex.service.engine.event.impl.jsonprotocolplugin.Apex2JsonEventConverter;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
/**
* The Class Apex2JMSTextEventConverter converts {@link ApexEvent} instances into string instances of
@@ -37,7 +36,6 @@ import org.slf4j.ext.XLoggerFactory;
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public final class Apex2JmsTextEventConverter extends Apex2JsonEventConverter {
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(Apex2JmsTextEventConverter.class);
/**
* {@inheritDoc}.
@@ -52,7 +50,6 @@ public final class Apex2JmsTextEventConverter extends Apex2JsonEventConverter {
} catch (Exception e) {
final String errorMessage = "message \"" + eventObject
+ "\" received from JMS does not have a \"getText()\" method";
- LOGGER.warn(errorMessage, e);
throw new ApexEventRuntimeException(errorMessage);
}
@@ -63,7 +60,6 @@ public final class Apex2JmsTextEventConverter extends Apex2JsonEventConverter {
} catch (final Exception e) {
final String errorMessage = "object contained in message \"" + eventObject
+ "\" received from JMS could not be retrieved as a Java String";
- LOGGER.debug(errorMessage, e);
throw new ApexEventRuntimeException(errorMessage, e);
}
@@ -78,7 +74,6 @@ public final class Apex2JmsTextEventConverter extends Apex2JsonEventConverter {
public Object fromApexEvent(final ApexEvent apexEvent) throws ApexEventException {
// Check the Apex event
if (apexEvent == null) {
- LOGGER.warn("event processing failed, Apex event is null");
throw new ApexEventException("event processing failed, Apex event is null");
}
diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/main/java/org/onap/policy/apex/plugins/event/protocol/xml/Apex2XmlEventConverter.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/main/java/org/onap/policy/apex/plugins/event/protocol/xml/Apex2XmlEventConverter.java
index 0f6735e0e..af4b7815a 100644
--- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/main/java/org/onap/policy/apex/plugins/event/protocol/xml/Apex2XmlEventConverter.java
+++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/main/java/org/onap/policy/apex/plugins/event/protocol/xml/Apex2XmlEventConverter.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,8 +45,6 @@ import org.onap.policy.apex.service.engine.event.ApexEventProtocolConverter;
import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException;
import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolParameters;
import org.onap.policy.common.utils.resources.ResourceUtils;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
import org.xml.sax.SAXException;
/**
@@ -55,7 +54,6 @@ import org.xml.sax.SAXException;
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public final class Apex2XmlEventConverter implements ApexEventProtocolConverter {
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(Apex2XmlEventConverter.class);
private static final String MODEL_SCHEMA_NAME = "xml/apex-event.xsd";
@@ -87,7 +85,6 @@ public final class Apex2XmlEventConverter implements ApexEventProtocolConverter
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.setSchema(apexEventSchema);
} catch (JAXBException | SAXException e) {
- LOGGER.error("Unable to set up marshalling and unmarshalling for XML events", e);
throw new ApexEventException("Unable to set up marshalling and unmarshalling for XML events", e);
}
}
@@ -107,7 +104,6 @@ public final class Apex2XmlEventConverter implements ApexEventProtocolConverter
public List<ApexEvent> toApexEvent(final String eventName, final Object eventObject) throws ApexEventException {
// Check the XML event
if (eventObject == null) {
- LOGGER.warn("event processing failed, XML event is null");
throw new ApexEventException("event processing failed, XML event is null");
}
@@ -117,7 +113,6 @@ public final class Apex2XmlEventConverter implements ApexEventProtocolConverter
xmlEventString = (String) eventObject;
} catch (final Exception e) {
final String errorMessage = "error converting event \"" + eventObject + "\" to a string";
- LOGGER.debug(errorMessage, e);
throw new ApexEventRuntimeException(errorMessage, e);
}
@@ -155,7 +150,6 @@ public final class Apex2XmlEventConverter implements ApexEventProtocolConverter
public String fromApexEvent(final ApexEvent apexEvent) throws ApexEventException {
// Check the Apex event
if (apexEvent == null) {
- LOGGER.warn("event processing failed, Apex event is null");
throw new ApexEventException("event processing failed, Apex event is null");
}
@@ -172,7 +166,6 @@ public final class Apex2XmlEventConverter implements ApexEventProtocolConverter
}
}
} catch (final Exception e) {
- LOGGER.warn("Unable to transfer Apex event data to XML\n" + apexEvent, e);
throw new ApexEventException("Unable to transfer Apex event data to XML\n" + apexEvent, e);
}
@@ -189,7 +182,6 @@ public final class Apex2XmlEventConverter implements ApexEventProtocolConverter
// Return the event as XML in a string
return writer.toString();
} catch (final JAXBException e) {
- LOGGER.warn("Unable to unmarshal Apex event to XML\n" + apexEvent, e);
throw new ApexEventException("Unable to unmarshal Apex event to XML\n" + apexEvent, e);
}
}
diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/Apex2YamlEventConverter.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/Apex2YamlEventConverter.java
index 59c9c21c1..faae7527c 100644
--- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/Apex2YamlEventConverter.java
+++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/Apex2YamlEventConverter.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,7 +62,6 @@ public class Apex2YamlEventConverter implements ApexEventProtocolConverter {
// Check and get the YAML parameters
if (!(parameters instanceof YamlEventProtocolParameters)) {
final String errorMessage = "specified consumer properties are not applicable to the YAML event protocol";
- LOGGER.warn(errorMessage);
throw new ApexEventRuntimeException(errorMessage);
}
@@ -75,7 +75,6 @@ public class Apex2YamlEventConverter implements ApexEventProtocolConverter {
public List<ApexEvent> toApexEvent(final String eventName, final Object eventObject) throws ApexEventException {
// Check the event eventObject
if (eventObject == null) {
- LOGGER.warn("event processing failed, event is null");
throw new ApexEventException("event processing failed, event is null");
}
@@ -83,7 +82,6 @@ public class Apex2YamlEventConverter implements ApexEventProtocolConverter {
// always work
if (!(eventObject instanceof String)) {
final String errorMessage = "error converting event \"" + eventObject + "\" to a string";
- LOGGER.debug(errorMessage);
throw new ApexEventException(errorMessage);
}
@@ -127,7 +125,6 @@ public class Apex2YamlEventConverter implements ApexEventProtocolConverter {
public Object fromApexEvent(final ApexEvent apexEvent) throws ApexEventException {
// Check the Apex event
if (apexEvent == null) {
- LOGGER.warn("event processing failed, Apex event is null");
throw new ApexEventException("event processing failed, Apex event is null");
}
@@ -155,7 +152,6 @@ public class Apex2YamlEventConverter implements ApexEventProtocolConverter {
if (!eventField.getOptional()) {
final String errorMessage = "error parsing " + eventDefinition.getId() + " event to Json. "
+ "Field \"" + fieldName + "\" is missing, but is mandatory. Fields: " + apexEvent;
- LOGGER.debug(errorMessage);
throw new ApexEventRuntimeException(errorMessage);
}
continue;
@@ -192,7 +188,6 @@ public class Apex2YamlEventConverter implements ApexEventProtocolConverter {
if (!eventField.getOptional()) {
final String errorMessage = "error parsing " + eventDefinition.getId() + " event from Json. "
+ "Field \"" + fieldName + "\" is missing, but is mandatory.";
- LOGGER.debug(errorMessage);
throw new ApexEventException(errorMessage);
}
continue;
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/apexprotocolplugin/Apex2ApexEventConverter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/apexprotocolplugin/Apex2ApexEventConverter.java
index 6e4c6d5d2..5f44be82f 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/apexprotocolplugin/Apex2ApexEventConverter.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/apexprotocolplugin/Apex2ApexEventConverter.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -60,7 +61,6 @@ public class Apex2ApexEventConverter implements ApexEventProtocolConverter {
public List<ApexEvent> toApexEvent(final String eventName, final Object eventObject) throws ApexEventException {
// Check the event eventObject
if (eventObject == null) {
- LOGGER.warn("event processing failed, event is null");
throw new ApexEventException("event processing failed, event is null");
}
@@ -102,8 +102,7 @@ public class Apex2ApexEventConverter implements ApexEventProtocolConverter {
eventList.add(event);
}
} catch (final Exception e) {
- final String errorString = "Failed to unmarshal APEX event: " + e.getMessage() + ", event=" + eventObject;
- LOGGER.warn(errorString, e);
+ final String errorString = "Failed to unmarshal APEX event, event=" + eventObject;
throw new ApexEventException(errorString, e);
}
@@ -118,7 +117,6 @@ public class Apex2ApexEventConverter implements ApexEventProtocolConverter {
public Object fromApexEvent(final ApexEvent apexEvent) throws ApexEventException {
// Check the Apex event
if (apexEvent == null) {
- LOGGER.warn("event processing failed, Apex event is null");
throw new ApexEventException("event processing failed, Apex event is null");
}
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 1cca52a3d..db9a7663c 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
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,8 +33,6 @@ import org.onap.policy.apex.service.engine.event.ApexEvent;
import org.onap.policy.apex.service.engine.event.ApexEventConverter;
import org.onap.policy.apex.service.engine.event.ApexEventException;
import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
/**
* The Class ApexEvent2EnEventConverter converts externally facing {@link ApexEvent} instances to
@@ -42,7 +41,6 @@ import org.slf4j.ext.XLoggerFactory;
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public final class ApexEvent2EnEventConverter implements ApexEventConverter {
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(ApexEvent2EnEventConverter.class);
// The Apex engine with its event definitions
private final ApexEngine apexEngine;
@@ -63,7 +61,6 @@ public final class ApexEvent2EnEventConverter implements ApexEventConverter {
public List<ApexEvent> toApexEvent(final String eventName, final Object event) throws ApexException {
// Check the Engine event
if (event == null) {
- LOGGER.warn("event processing failed, engine event is null");
throw new ApexEventException("event processing failed, engine event is null");
}
@@ -74,7 +71,6 @@ public final class ApexEvent2EnEventConverter implements ApexEventConverter {
enEvent = (EnEvent) event;
} catch (final Exception e) {
final String errorMessage = "error transferring event \"" + event + "\" to the Apex engine";
- LOGGER.debug(errorMessage, e);
throw new ApexEventRuntimeException(errorMessage, e);
}
@@ -107,14 +103,12 @@ public final class ApexEvent2EnEventConverter implements ApexEventConverter {
public EnEvent fromApexEvent(final ApexEvent apexEvent) throws ApexException {
// Check the Apex model
if (apexEngine == null) {
- LOGGER.warn("event processing failed, apex engine is null");
throw new ApexEventException("event processing failed, apex engine is null");
}
// Get the event definition
final AxEvent eventDefinition = ModelService.getModel(AxEvents.class).get(apexEvent.getName());
if (eventDefinition == null) {
- LOGGER.warn("event processing failed, event \"" + apexEvent.getName() + "\" not found in apex model");
throw new ApexEventException(
"event processing failed, event \"" + apexEvent.getName() + "\" not found in apex model");
}
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java
index e8e592b09..06d9b477f 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -67,7 +68,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
// Check and get the JSON parameters
if (!(parameters instanceof JsonEventProtocolParameters)) {
final String errorMessage = "specified consumer properties are not applicable to the JSON event protocol";
- LOGGER.warn(errorMessage);
throw new ApexEventRuntimeException(errorMessage);
}
@@ -81,7 +81,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
public List<ApexEvent> toApexEvent(final String eventName, final Object eventObject) throws ApexEventException {
// Check the event eventObject
if (eventObject == null) {
- LOGGER.warn("event processing failed, event is null");
throw new ApexEventException("event processing failed, event is null");
}
@@ -92,7 +91,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
jsonEventString = (String) eventObject;
} catch (final Exception e) {
final String errorMessage = "error converting event \"" + eventObject + "\" to a string";
- LOGGER.debug(errorMessage, e);
throw new ApexEventRuntimeException(errorMessage, e);
}
@@ -160,7 +158,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
public Object fromApexEvent(final ApexEvent apexEvent) throws ApexEventException {
// Check the Apex event
if (apexEvent == null) {
- LOGGER.warn("event processing failed, Apex event is null");
throw new ApexEventException("event processing failed, Apex event is null");
}
@@ -204,7 +201,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
if (!eventField.getOptional()) {
final String errorMessage = ERROR_CODING + eventDefinition.getId() + " event to Json. " + "Field \""
+ fieldName + "\" is missing, but is mandatory. Fields: " + apexEvent;
- LOGGER.debug(errorMessage);
throw new ApexEventRuntimeException(errorMessage);
}
continue;
@@ -237,7 +233,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
if (eventDefinition.getFields().isEmpty()) {
final String errorMessage = ERROR_CODING + eventDefinition.getId() + " event to Json, Field "
+ jsonPars.getPojoField() + " not found, no fields defined on event.";
- LOGGER.debug(errorMessage);
throw new ApexEventException(errorMessage);
}
@@ -245,7 +240,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
final String errorMessage = ERROR_CODING + eventDefinition.getId() + " event to Json, Field "
+ jsonPars.getPojoField() + ", "
+ " one and only one field may be defined on a POJO event definition.";
- LOGGER.debug(errorMessage);
throw new ApexEventException(errorMessage);
}
@@ -254,7 +248,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
if (!jsonPars.getPojoField().equals(pojoFieldDefinition.getKey().getLocalName())) {
final String errorMessage = ERROR_CODING + eventDefinition.getId() + " event to Json. Field "
+ jsonPars.getPojoField() + " not found on POJO event definition.";
- LOGGER.debug(errorMessage);
throw new ApexEventException(errorMessage);
}
@@ -332,7 +325,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
if (!eventField.getOptional()) {
final String errorMessage = ERROR_PARSING + eventDefinition.getId() + " event from Json. "
+ "Field \"" + fieldName + "\" is missing, but is mandatory.";
- LOGGER.debug(errorMessage);
throw new ApexEventException(errorMessage);
}
continue;
@@ -365,7 +357,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
if (eventDefinition.getFields().isEmpty()) {
final String errorMessage = ERROR_PARSING + eventDefinition.getId() + " event from Json, Field "
+ jsonPars.getPojoField() + " not found, no fields defined on event.";
- LOGGER.debug(errorMessage);
throw new ApexEventException(errorMessage);
}
@@ -373,7 +364,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
final String errorMessage = ERROR_PARSING + eventDefinition.getId() + " event from Json, Field "
+ jsonPars.getPojoField()
+ ", one and only one field may be defined on a POJO event definition.";
- LOGGER.debug(errorMessage);
throw new ApexEventException(errorMessage);
}
@@ -382,7 +372,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
if (!jsonPars.getPojoField().equals(pojoFieldDefinition.getKey().getLocalName())) {
final String errorMessage = ERROR_PARSING + eventDefinition.getId() + " event from Json. Field "
+ jsonPars.getPojoField() + " not found on POJO event definition.";
- LOGGER.debug(errorMessage);
throw new ApexEventException(errorMessage);
}