summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java
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 /plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java
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>
Diffstat (limited to 'plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java')
-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
4 files changed, 34 insertions, 59 deletions
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.");
}
}