aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-09-13 15:25:32 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-09-13 15:26:47 +0100
commit4cfa2e2d98f6877d54da304ef17f096284430908 (patch)
treec9452d2bf6bb96fae9c1e8e2d8ce8f8d01e69d22 /plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test
parent0e23f7634e1e1fb31454c516974613335fcea1a4 (diff)
Sonar/Checkstyle in service/plugins
Sonar and Checkstyle changes in plugins and services, and knock on changes Issue-ID: POLICY-1034 Change-Id: Iff7df74e54fce2c661dcc2fae75ae93d4cacfe5b Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test')
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaAai.java (renamed from plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaAAI.java)24
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaArray.java38
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaEnum.java33
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaFixed.java61
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaHelperBadSchemas.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/TestAvroSchemaHelperMarshal.java139
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaHelperUnmarshal.java117
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaMap.java42
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaRecord.java64
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaUnion.java40
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestHealthCheckSchema.java47
11 files changed, 479 insertions, 142 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/TestAvroSchemaAAI.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaAai.java
index 5198e82e0..bca896d2e 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaAAI.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaAai.java
@@ -42,14 +42,21 @@ import org.onap.policy.apex.model.utilities.TextFileUtils;
import org.onap.policy.common.parameters.ParameterService;
/**
+ * The Class TestAvroSchemaAai.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
- * @version
+ * @version
*/
-public class TestAvroSchemaAAI {
+public class TestAvroSchemaAai {
private final AxKey testKey = new AxArtifactKey("AvroTest", "0.0.1");
private AxContextSchemas schemas;
private String aaiInventoryResponseSchema;
+ /**
+ * Inits the test.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Before
public void initTest() throws IOException {
schemas = new AxContextSchemas(new AxArtifactKey("AvroSchemas", "0.0.1"));
@@ -59,6 +66,9 @@ public class TestAvroSchemaAAI {
TextFileUtils.getTextFileAsString("src/test/resources/avsc/AAIInventoryResponseItemType.avsc");
}
+ /**
+ * Inits the context.
+ */
@Before
public void initContext() {
SchemaParameters schemaParameters = new SchemaParameters();
@@ -68,13 +78,21 @@ public class TestAvroSchemaAAI {
}
+ /**
+ * Clear context.
+ */
@After
public void clearContext() {
ParameterService.deregister(ContextParameterConstants.SCHEMA_GROUP_NAME);
}
+ /**
+ * Test AAI response policy.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testAAIResponsePolicy() throws IOException {
+ public void testAaiResponsePolicy() throws IOException {
final AxContextSchema avroSchema =
new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", aaiInventoryResponseSchema);
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaArray.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaArray.java
index b72b2ca10..972e0bd32 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaArray.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaArray.java
@@ -40,9 +40,12 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
import org.onap.policy.apex.model.utilities.TextFileUtils;
import org.onap.policy.common.parameters.ParameterService;
+// TODO: Auto-generated Javadoc
/**
+ * The Class TestAvroSchemaArray.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
- * @version
+ * @version
*/
public class TestAvroSchemaArray {
private final AxKey testKey = new AxArtifactKey("AvroTest", "0.0.1");
@@ -50,6 +53,11 @@ public class TestAvroSchemaArray {
private String longArraySchema;
private String addressArraySchema;
+ /**
+ * Inits the test.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Before
public void initTest() throws IOException {
schemas = new AxContextSchemas(new AxArtifactKey("AvroSchemas", "0.0.1"));
@@ -58,6 +66,9 @@ public class TestAvroSchemaArray {
addressArraySchema = TextFileUtils.getTextFileAsString("src/test/resources/avsc/ArrayExampleAddress.avsc");
}
+ /**
+ * Inits the context.
+ */
@Before
public void initContext() {
SchemaParameters schemaParameters = new SchemaParameters();
@@ -67,11 +78,19 @@ public class TestAvroSchemaArray {
}
+ /**
+ * Clear context.
+ */
@After
public void clearContext() {
ParameterService.deregister(ContextParameterConstants.SCHEMA_GROUP_NAME);
}
+ /**
+ * Test array init.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testArrayInit() throws IOException {
final AxContextSchema avroSchema =
@@ -90,6 +109,11 @@ public class TestAvroSchemaArray {
newArrayFull.get(0).toString());
}
+ /**
+ * Test long array unmarshal marshal.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testLongArrayUnmarshalMarshal() throws IOException {
final AxContextSchema avroSchema =
@@ -102,6 +126,11 @@ public class TestAvroSchemaArray {
testUnmarshalMarshal(schemaHelper, "src/test/resources/data/ArrayExampleLongFull.json");
}
+ /**
+ * Test address array unmarshal marshal.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testAddressArrayUnmarshalMarshal() throws IOException {
final AxContextSchema avroSchema =
@@ -114,6 +143,13 @@ public class TestAvroSchemaArray {
testUnmarshalMarshal(schemaHelper, "src/test/resources/data/ArrayExampleAddressFull.json");
}
+ /**
+ * Test unmarshal marshal.
+ *
+ * @param schemaHelper the schema helper
+ * @param fileName the file name
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
private void testUnmarshalMarshal(final SchemaHelper schemaHelper, final String fileName) throws IOException {
final String inString = TextFileUtils.getTextFileAsString(fileName);
final Array<?> schemaObject = (Array<?>) schemaHelper.unmarshal(inString);
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaEnum.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaEnum.java
index 47a5c969c..883f14bcb 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaEnum.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaEnum.java
@@ -41,15 +41,23 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
import org.onap.policy.apex.model.utilities.TextFileUtils;
import org.onap.policy.common.parameters.ParameterService;
+// TODO: Auto-generated Javadoc
/**
+ * The Class TestAvroSchemaEnum.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
- * @version
+ * @version
*/
public class TestAvroSchemaEnum {
private final AxKey testKey = new AxArtifactKey("AvroTest", "0.0.1");
private AxContextSchemas schemas;
private String enumSchema;
+ /**
+ * Inits the test.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Before
public void initTest() throws IOException {
schemas = new AxContextSchemas(new AxArtifactKey("AvroSchemas", "0.0.1"));
@@ -57,6 +65,9 @@ public class TestAvroSchemaEnum {
enumSchema = TextFileUtils.getTextFileAsString("src/test/resources/avsc/EnumSchema.avsc");
}
+ /**
+ * Inits the context.
+ */
@Before
public void initContext() {
SchemaParameters schemaParameters = new SchemaParameters();
@@ -66,11 +77,19 @@ public class TestAvroSchemaEnum {
}
+ /**
+ * Clear context.
+ */
@After
public void clearContext() {
ParameterService.deregister(ContextParameterConstants.SCHEMA_GROUP_NAME);
}
+ /**
+ * Test enum init.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testEnumInit() throws IOException {
final AxContextSchema avroSchema =
@@ -86,6 +105,11 @@ public class TestAvroSchemaEnum {
assertEquals("HEARTS", newEnumFull.toString());
}
+ /**
+ * Test enum unmarshal marshal.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testEnumUnmarshalMarshal() throws IOException {
final AxContextSchema avroSchema =
@@ -127,6 +151,13 @@ public class TestAvroSchemaEnum {
}
}
+ /**
+ * Test unmarshal marshal.
+ *
+ * @param schemaHelper the schema helper
+ * @param fileName the file name
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
private void testUnmarshalMarshal(final SchemaHelper schemaHelper, final String fileName) throws IOException {
final String inString = TextFileUtils.getTextFileAsString(fileName);
final EnumSymbol decodedObject = (EnumSymbol) schemaHelper.unmarshal(inString);
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaFixed.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaFixed.java
index 6d709645f..26f4ba8af 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaFixed.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaFixed.java
@@ -43,6 +43,8 @@ import org.onap.policy.apex.model.utilities.TextFileUtils;
import org.onap.policy.common.parameters.ParameterService;
/**
+ * The Class TestAvroSchemaFixed.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
* @version
*/
@@ -51,6 +53,11 @@ public class TestAvroSchemaFixed {
private AxContextSchemas schemas;
private String fixedSchema;
+ /**
+ * Inits the test.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Before
public void initTest() throws IOException {
schemas = new AxContextSchemas(new AxArtifactKey("AvroSchemas", "0.0.1"));
@@ -58,24 +65,35 @@ public class TestAvroSchemaFixed {
fixedSchema = TextFileUtils.getTextFileAsString("src/test/resources/avsc/FixedSchema.avsc");
}
+ /**
+ * Inits the context.
+ */
@Before
public void initContext() {
SchemaParameters schemaParameters = new SchemaParameters();
schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
schemaParameters.getSchemaHelperParameterMap().put("AVRO", new AvroSchemaHelperParameters());
ParameterService.register(schemaParameters);
-
+
}
+ /**
+ * Clear context.
+ */
@After
public void clearContext() {
ParameterService.deregister(ContextParameterConstants.SCHEMA_GROUP_NAME);
}
+ /**
+ * Test fixed init.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testFixedInit() throws IOException {
- final AxContextSchema avroSchema =
- new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", fixedSchema);
+ final AxContextSchema avroSchema = new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO",
+ fixedSchema);
schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema);
final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey());
@@ -84,9 +102,9 @@ public class TestAvroSchemaFixed {
schemaHelper.createNewInstance();
fail("Test should throw an exception here");
} catch (final Exception e) {
- assertEquals(
- "AvroTest:0.0.1: could not create an instance of class \"org.apache.avro.generic.GenericData.Fixed\" using the default constructor \"Fixed()\"",
- e.getMessage());
+ assertEquals("AvroTest:0.0.1: could not create an instance "
+ + "of class \"org.apache.avro.generic.GenericData.Fixed\" "
+ + "using the default constructor \"Fixed()\"", e.getMessage());
}
final String inString = TextFileUtils.getTextFileAsString("src/test/resources/data/FixedExampleGood.json");
@@ -95,10 +113,15 @@ public class TestAvroSchemaFixed {
assertTrue(newFixedFull.toString().endsWith("53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70]"));
}
+ /**
+ * Test fixed unmarshal marshal.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testFixedUnmarshalMarshal() throws IOException {
- final AxContextSchema avroSchema =
- new AxContextSchema(new AxArtifactKey("AvroArray", "0.0.1"), "AVRO", fixedSchema);
+ final AxContextSchema avroSchema = new AxContextSchema(new AxArtifactKey("AvroArray", "0.0.1"), "AVRO",
+ fixedSchema);
schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema);
final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey());
@@ -110,33 +133,39 @@ public class TestAvroSchemaFixed {
fail("This test should throw an exception here");
} catch (final Exception e) {
assertEquals("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: Expected fixed. Got VALUE_NULL",
- e.getMessage());
+ e.getMessage());
}
try {
testUnmarshalMarshal(schemaHelper, "src/test/resources/data/FixedExampleNull.json");
fail("This test should throw an exception here");
} catch (final Exception e) {
assertEquals("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: Expected fixed. Got VALUE_NULL",
- e.getMessage());
+ e.getMessage());
}
try {
testUnmarshalMarshal(schemaHelper, "src/test/resources/data/FixedExampleBad0.json");
fail("This test should throw an exception here");
} catch (final Exception e) {
- assertEquals(
- "AvroTest:0.0.1: object \"\"BADBAD\"\" Avro unmarshalling failed: Expected fixed length 64, but got6",
- e.getMessage());
+ assertEquals("AvroTest:0.0.1: object \"\"BADBAD\"\" "
+ + "Avro unmarshalling failed: Expected fixed length 64, but got6", e.getMessage());
}
try {
testUnmarshalMarshal(schemaHelper, "src/test/resources/data/FixedExampleBad1.json");
fail("This test should throw an exception here");
} catch (final Exception e) {
- assertEquals(
- "AvroTest:0.0.1: object \"\"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0\"\" Avro unmarshalling failed: Expected fixed length 64, but got65",
- e.getMessage());
+ assertEquals("AvroTest:0.0.1: object "
+ + "\"\"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0\"\" "
+ + "Avro unmarshalling failed: Expected fixed length 64, but got65", e.getMessage());
}
}
+ /**
+ * Test unmarshal marshal.
+ *
+ * @param schemaHelper the schema helper
+ * @param fileName the file name
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
private void testUnmarshalMarshal(final SchemaHelper schemaHelper, final String fileName) throws IOException {
final String inString = TextFileUtils.getTextFileAsString(fileName);
final Fixed decodedObject = (Fixed) schemaHelper.unmarshal(inString);
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaHelperBadSchemas.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaHelperBadSchemas.java
index 9cb027acf..cc79f9eb6 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaHelperBadSchemas.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaHelperBadSchemas.java
@@ -37,19 +37,27 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
import org.onap.policy.common.parameters.ParameterService;
/**
+ * The Class TestAvroSchemaHelperBadSchemas.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
- * @version
+ * @version
*/
public class TestAvroSchemaHelperBadSchemas {
private final AxKey testKey = new AxArtifactKey("AvroTest", "0.0.1");
private AxContextSchemas schemas;
+ /**
+ * Inits the test.
+ */
@Before
public void initTest() {
schemas = new AxContextSchemas(new AxArtifactKey("AvroSchemas", "0.0.1"));
ModelService.registerModel(AxContextSchemas.class, schemas);
}
+ /**
+ * Inits the context.
+ */
@Before
public void initContext() {
SchemaParameters schemaParameters = new SchemaParameters();
@@ -59,11 +67,17 @@ public class TestAvroSchemaHelperBadSchemas {
}
+ /**
+ * Clear context.
+ */
@After
public void clearContext() {
ParameterService.deregister(ContextParameterConstants.SCHEMA_GROUP_NAME);
}
+ /**
+ * Bad schema test.
+ */
@Test
public void badSchemaTest() {
final AxContextSchema avroBadSchema0 = new AxContextSchema(new AxArtifactKey("AvroBad0", "0.0.1"), "AVRO", "}");
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaHelperMarshal.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaHelperMarshal.java
index 1f078879d..86d8426de 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaHelperMarshal.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaHelperMarshal.java
@@ -39,6 +39,8 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
import org.onap.policy.common.parameters.ParameterService;
/**
+ * The Class TestAvroSchemaHelperMarshal.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
* @version
*/
@@ -46,48 +48,63 @@ public class TestAvroSchemaHelperMarshal {
private final AxKey testKey = new AxArtifactKey("AvroTest", "0.0.1");
private AxContextSchemas schemas;
+ /**
+ * Inits the test.
+ */
@Before
public void initTest() {
schemas = new AxContextSchemas(new AxArtifactKey("AvroSchemas", "0.0.1"));
ModelService.registerModel(AxContextSchemas.class, schemas);
}
+ /**
+ * Inits the context.
+ */
@Before
public void initContext() {
SchemaParameters schemaParameters = new SchemaParameters();
schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
schemaParameters.getSchemaHelperParameterMap().put("AVRO", new AvroSchemaHelperParameters());
ParameterService.register(schemaParameters);
-
+
}
+ /**
+ * Clear context.
+ */
@After
public void clearContext() {
ParameterService.deregister(ContextParameterConstants.SCHEMA_GROUP_NAME);
}
+ /**
+ * Test null marshal.
+ */
@Test
public void testNullMarshal() {
- final AxContextSchema avroNullSchema =
- new AxContextSchema(new AxArtifactKey("AvroNull", "0.0.1"), "AVRO", "{\"type\": \"null\"}");
+ final AxContextSchema avroNullSchema = new AxContextSchema(new AxArtifactKey("AvroNull", "0.0.1"), "AVRO",
+ "{\"type\": \"null\"}");
schemas.getSchemasMap().put(avroNullSchema.getKey(), avroNullSchema);
- final SchemaHelper schemaHelper0 =
- new SchemaHelperFactory().createSchemaHelper(testKey, avroNullSchema.getKey());
+ final SchemaHelper schemaHelper0 = new SchemaHelperFactory().createSchemaHelper(testKey,
+ avroNullSchema.getKey());
assertEquals("null", schemaHelper0.marshal2String(null));
assertEquals("null", schemaHelper0.marshal2String(123));
assertEquals("null", schemaHelper0.marshal2String("Everything is marshalled to Null, no matter what it is"));
}
+ /**
+ * Test boolean marshal.
+ */
@Test
public void testBooleanMarshal() {
- final AxContextSchema avroBooleanSchema =
- new AxContextSchema(new AxArtifactKey("AvroBoolean", "0.0.1"), "AVRO", "{\"type\": \"boolean\"}");
+ final AxContextSchema avroBooleanSchema = new AxContextSchema(new AxArtifactKey("AvroBoolean", "0.0.1"), "AVRO",
+ "{\"type\": \"boolean\"}");
schemas.getSchemasMap().put(avroBooleanSchema.getKey(), avroBooleanSchema);
- final SchemaHelper schemaHelper1 =
- new SchemaHelperFactory().createSchemaHelper(testKey, avroBooleanSchema.getKey());
+ final SchemaHelper schemaHelper1 = new SchemaHelperFactory().createSchemaHelper(testKey,
+ avroBooleanSchema.getKey());
assertEquals("true", schemaHelper1.marshal2String(true));
assertEquals("false", schemaHelper1.marshal2String(false));
@@ -96,29 +113,30 @@ public class TestAvroSchemaHelperMarshal {
fail("Test should throw an exception here");
} catch (final Exception e) {
e.printStackTrace();
- assertEquals(
- "AvroTest:0.0.1: object \"0\" Avro marshalling failed: java.lang.Integer cannot be cast to java.lang.Boolean",
- e.getMessage());
+ assertEquals("AvroTest:0.0.1: object \"0\" Avro marshalling failed: "
+ + "java.lang.Integer cannot be cast to java.lang.Boolean", e.getMessage());
}
try {
schemaHelper1.marshal2String("0");
fail("Test should throw an exception here");
} catch (final Exception e) {
e.printStackTrace();
- assertEquals(
- "AvroTest:0.0.1: object \"0\" Avro marshalling failed: java.lang.String cannot be cast to java.lang.Boolean",
- e.getMessage());
+ assertEquals("AvroTest:0.0.1: object \"0\" Avro marshalling failed: "
+ + "java.lang.String cannot be cast to java.lang.Boolean", e.getMessage());
}
}
+ /**
+ * Test int marshal.
+ */
@Test
public void testIntMarshal() {
- final AxContextSchema avroIntSchema =
- new AxContextSchema(new AxArtifactKey("AvroInt", "0.0.1"), "AVRO", "{\"type\": \"int\"}");
+ final AxContextSchema avroIntSchema = new AxContextSchema(new AxArtifactKey("AvroInt", "0.0.1"), "AVRO",
+ "{\"type\": \"int\"}");
schemas.getSchemasMap().put(avroIntSchema.getKey(), avroIntSchema);
- final SchemaHelper schemaHelper2 =
- new SchemaHelperFactory().createSchemaHelper(testKey, avroIntSchema.getKey());
+ final SchemaHelper schemaHelper2 = new SchemaHelperFactory().createSchemaHelper(testKey,
+ avroIntSchema.getKey());
assertEquals("0", schemaHelper2.marshal2String(0));
assertEquals("1", schemaHelper2.marshal2String(1));
@@ -131,26 +149,29 @@ public class TestAvroSchemaHelperMarshal {
schemaHelper2.marshal2String("Hello");
fail("Test should throw an exception here");
} catch (final Exception e) {
- assertTrue(e.getMessage().startsWith(
- "AvroTest:0.0.1: object \"Hello\" Avro marshalling failed: java.lang.String cannot be cast to java.lang.Number"));
+ assertTrue(e.getMessage().startsWith("AvroTest:0.0.1: object \"Hello\" Avro marshalling failed: "
+ + "java.lang.String cannot be cast to java.lang.Number"));
}
try {
schemaHelper2.marshal2String(null);
fail("Test should throw an exception here");
} catch (final Exception e) {
assertTrue(e.getMessage()
- .startsWith("AvroTest:0.0.1: cannot encode a null object of class \"java.lang.Integer\""));
+ .startsWith("AvroTest:0.0.1: cannot encode a null object of class \"java.lang.Integer\""));
}
}
+ /**
+ * Test long marshal.
+ */
@Test
public void testLongMarshal() {
- final AxContextSchema avroLongSchema =
- new AxContextSchema(new AxArtifactKey("AvroLong", "0.0.1"), "AVRO", "{\"type\": \"long\"}");
+ final AxContextSchema avroLongSchema = new AxContextSchema(new AxArtifactKey("AvroLong", "0.0.1"), "AVRO",
+ "{\"type\": \"long\"}");
schemas.getSchemasMap().put(avroLongSchema.getKey(), avroLongSchema);
- final SchemaHelper schemaHelper3 =
- new SchemaHelperFactory().createSchemaHelper(testKey, avroLongSchema.getKey());
+ final SchemaHelper schemaHelper3 = new SchemaHelperFactory().createSchemaHelper(testKey,
+ avroLongSchema.getKey());
assertEquals("0", schemaHelper3.marshal2String(0L));
assertEquals("1", schemaHelper3.marshal2String(1L));
@@ -161,26 +182,29 @@ public class TestAvroSchemaHelperMarshal {
schemaHelper3.marshal2String("Hello");
fail("Test should throw an exception here");
} catch (final Exception e) {
- assertTrue(e.getMessage().startsWith(
- "AvroTest:0.0.1: object \"Hello\" Avro marshalling failed: java.lang.String cannot be cast to java.lang.Long"));
+ assertTrue(e.getMessage().startsWith("AvroTest:0.0.1: object \"Hello\" Avro marshalling failed: "
+ + "java.lang.String cannot be cast to java.lang.Long"));
}
try {
schemaHelper3.marshal2String(null);
fail("Test should throw an exception here");
} catch (final Exception e) {
assertTrue(e.getMessage()
- .startsWith("AvroTest:0.0.1: cannot encode a null object of class \"java.lang.Long\""));
+ .startsWith("AvroTest:0.0.1: cannot encode a null object of class \"java.lang.Long\""));
}
}
+ /**
+ * Test float marshal.
+ */
@Test
public void testFloatMarshal() {
- final AxContextSchema avroFloatSchema =
- new AxContextSchema(new AxArtifactKey("AvroFloat", "0.0.1"), "AVRO", "{\"type\": \"float\"}");
+ final AxContextSchema avroFloatSchema = new AxContextSchema(new AxArtifactKey("AvroFloat", "0.0.1"), "AVRO",
+ "{\"type\": \"float\"}");
schemas.getSchemasMap().put(avroFloatSchema.getKey(), avroFloatSchema);
- final SchemaHelper schemaHelper4 =
- new SchemaHelperFactory().createSchemaHelper(testKey, avroFloatSchema.getKey());
+ final SchemaHelper schemaHelper4 = new SchemaHelperFactory().createSchemaHelper(testKey,
+ avroFloatSchema.getKey());
assertEquals("0.0", schemaHelper4.marshal2String(0F));
assertEquals("1.0", schemaHelper4.marshal2String(1F));
@@ -195,27 +219,29 @@ public class TestAvroSchemaHelperMarshal {
schemaHelper4.marshal2String("Hello");
fail("Test should throw an exception here");
} catch (final Exception e) {
- assertTrue(e.getMessage().startsWith(
- "AvroTest:0.0.1: object \"Hello\" Avro marshalling failed: java.lang.String cannot be cast to java.lang.Float"));
+ assertTrue(e.getMessage().startsWith("AvroTest:0.0.1: object \"Hello\" Avro marshalling failed: "
+ + "java.lang.String cannot be cast to java.lang.Float"));
}
try {
schemaHelper4.marshal2String(null);
fail("Test should throw an exception here");
} catch (final Exception e) {
assertTrue(e.getMessage()
- .startsWith("AvroTest:0.0.1: cannot encode a null object of class \"java.lang.Float\""));
+ .startsWith("AvroTest:0.0.1: cannot encode a null object of class \"java.lang.Float\""));
}
}
-
+ /**
+ * Test double marshal.
+ */
@Test
public void testDoubleMarshal() {
- final AxContextSchema avroDoubleSchema =
- new AxContextSchema(new AxArtifactKey("AvroDouble", "0.0.1"), "AVRO", "{\"type\": \"double\"}");
+ final AxContextSchema avroDoubleSchema = new AxContextSchema(new AxArtifactKey("AvroDouble", "0.0.1"), "AVRO",
+ "{\"type\": \"double\"}");
schemas.getSchemasMap().put(avroDoubleSchema.getKey(), avroDoubleSchema);
- final SchemaHelper schemaHelper5 =
- new SchemaHelperFactory().createSchemaHelper(testKey, avroDoubleSchema.getKey());
+ final SchemaHelper schemaHelper5 = new SchemaHelperFactory().createSchemaHelper(testKey,
+ avroDoubleSchema.getKey());
assertEquals("0.0", schemaHelper5.marshal2String(0D));
assertEquals("1.0", schemaHelper5.marshal2String(1D));
@@ -230,26 +256,29 @@ public class TestAvroSchemaHelperMarshal {
schemaHelper5.marshal2String("Hello");
fail("Test should throw an exception here");
} catch (final Exception e) {
- assertTrue(e.getMessage().startsWith(
- "AvroTest:0.0.1: object \"Hello\" Avro marshalling failed: java.lang.String cannot be cast to java.lang.Double"));
+ assertTrue(e.getMessage().startsWith("AvroTest:0.0.1: object \"Hello\" Avro marshalling failed: "
+ + "java.lang.String cannot be cast to java.lang.Double"));
}
try {
schemaHelper5.marshal2String(null);
fail("Test should throw an exception here");
} catch (final Exception e) {
assertTrue(e.getMessage()
- .startsWith("AvroTest:0.0.1: cannot encode a null object of class \"java.lang.Double\""));
+ .startsWith("AvroTest:0.0.1: cannot encode a null object of class \"java.lang.Double\""));
}
}
+ /**
+ * Test string marshal.
+ */
@Test
public void testStringMarshal() {
- final AxContextSchema avroStringSchema =
- new AxContextSchema(new AxArtifactKey("AvroString", "0.0.1"), "AVRO", "{\"type\": \"string\"}");
+ final AxContextSchema avroStringSchema = new AxContextSchema(new AxArtifactKey("AvroString", "0.0.1"), "AVRO",
+ "{\"type\": \"string\"}");
schemas.getSchemasMap().put(avroStringSchema.getKey(), avroStringSchema);
- final SchemaHelper schemaHelper7 =
- new SchemaHelperFactory().createSchemaHelper(testKey, avroStringSchema.getKey());
+ final SchemaHelper schemaHelper7 = new SchemaHelperFactory().createSchemaHelper(testKey,
+ avroStringSchema.getKey());
assertEquals("\"0\"", schemaHelper7.marshal2String("0"));
assertEquals("\"1\"", schemaHelper7.marshal2String("1"));
@@ -266,19 +295,23 @@ public class TestAvroSchemaHelperMarshal {
fail("Test should throw an exception here");
} catch (final Exception e) {
assertTrue(e.getMessage()
- .startsWith("AvroTest:0.0.1: cannot encode a null object of class \"java.lang.String\""));
+ .startsWith("AvroTest:0.0.1: cannot encode a null object of class \"java.lang.String\""));
}
}
+ /**
+ * Test bytes marshal.
+ */
@Test
public void testBytesMarshal() {
- final AxContextSchema avroSchema =
- new AxContextSchema(new AxArtifactKey("AvroString", "0.0.1"), "AVRO", "{\"type\": \"bytes\"}");
+ final AxContextSchema avroSchema = new AxContextSchema(new AxArtifactKey("AvroString", "0.0.1"), "AVRO",
+ "{\"type\": \"bytes\"}");
schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema);
final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey());
- final byte[] helloBytes = {104, 101, 108, 108, 111};
+ final byte[] helloBytes =
+ { 104, 101, 108, 108, 111 };
final String helloOut = schemaHelper.marshal2String(helloBytes);
assertEquals("\"hello\"", helloOut);
@@ -287,7 +320,7 @@ public class TestAvroSchemaHelperMarshal {
fail("Test should throw an exception here");
} catch (final Exception e) {
assertTrue(e.getMessage()
- .startsWith("AvroTest:0.0.1: cannot encode a null object of class \"java.lang.Byte[]\""));
+ .startsWith("AvroTest:0.0.1: cannot encode a null object of class \"java.lang.Byte[]\""));
}
}
}
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaHelperUnmarshal.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaHelperUnmarshal.java
index db7edd673..6dede515e 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaHelperUnmarshal.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaHelperUnmarshal.java
@@ -40,6 +40,8 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
import org.onap.policy.common.parameters.ParameterService;
/**
+ * The Class TestAvroSchemaHelperUnmarshal.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
* @version
*/
@@ -47,12 +49,18 @@ public class TestAvroSchemaHelperUnmarshal {
private final AxKey testKey = new AxArtifactKey("AvroTest", "0.0.1");
private AxContextSchemas schemas;
+ /**
+ * Inits the test.
+ */
@Before
public void initTest() {
schemas = new AxContextSchemas(new AxArtifactKey("AvroSchemas", "0.0.1"));
ModelService.registerModel(AxContextSchemas.class, schemas);
}
+ /**
+ * Inits the context.
+ */
@Before
public void initContext() {
SchemaParameters schemaParameters = new SchemaParameters();
@@ -62,11 +70,17 @@ public class TestAvroSchemaHelperUnmarshal {
}
+ /**
+ * Clear context.
+ */
@After
public void clearContext() {
ParameterService.deregister(ContextParameterConstants.SCHEMA_GROUP_NAME);
}
+ /**
+ * Test null unmarshal.
+ */
@Test
public void testNullUnmarshal() {
final AxContextSchema avroNullSchema = new AxContextSchema(new AxArtifactKey("AvroNull", "0.0.1"), "AVRO",
@@ -90,11 +104,14 @@ public class TestAvroSchemaHelperUnmarshal {
schemaHelper0.unmarshal("123");
fail("test should throw an exception here");
} catch (final Exception e) {
- assertEquals("AvroTest:0.0.1: object \"123\" Avro unmarshalling failed: Expected null. Got VALUE_NUMBER_INT",
- e.getMessage());
+ assertEquals("AvroTest:0.0.1: object \"123\" Avro unmarshalling failed: "
+ + "Expected null. Got VALUE_NUMBER_INT", e.getMessage());
}
}
+ /**
+ * Test boolean unmarshal.
+ */
@Test
public void testBooleanUnmarshal() {
final AxContextSchema avroBooleanSchema = new AxContextSchema(new AxArtifactKey("AvroBoolean", "0.0.1"), "AVRO",
@@ -108,8 +125,8 @@ public class TestAvroSchemaHelperUnmarshal {
schemaHelper1.createNewInstance();
fail("test should throw an exception here");
} catch (final Exception e) {
- assertEquals("AvroTest:0.0.1: could not create an instance of class \"java.lang.Boolean\" using the default constructor \"Boolean()\"",
- e.getMessage());
+ assertEquals("AvroTest:0.0.1: could not create an instance of class \"java.lang.Boolean\" "
+ + "using the default constructor \"Boolean()\"", e.getMessage());
}
assertEquals(true, schemaHelper1.createNewInstance("true"));
@@ -125,6 +142,9 @@ public class TestAvroSchemaHelperUnmarshal {
}
}
+ /**
+ * Test int unmarshal.
+ */
@Test
public void testIntUnmarshal() {
final AxContextSchema avroIntSchema = new AxContextSchema(new AxArtifactKey("AvroInt", "0.0.1"), "AVRO",
@@ -138,8 +158,8 @@ public class TestAvroSchemaHelperUnmarshal {
schemaHelper2.createNewInstance();
fail("test should throw an exception here");
} catch (final Exception e) {
- assertEquals("AvroTest:0.0.1: could not create an instance of class \"java.lang.Integer\" using the default constructor \"Integer()\"",
- e.getMessage());
+ assertEquals("AvroTest:0.0.1: could not create an instance of class \"java.lang.Integer\" "
+ + "using the default constructor \"Integer()\"", e.getMessage());
}
assertEquals(123, schemaHelper2.createNewInstance("123"));
@@ -154,25 +174,28 @@ public class TestAvroSchemaHelperUnmarshal {
schemaHelper2.unmarshal("2147483648");
fail("Test should throw an exception here");
} catch (final Exception e) {
- assertTrue(e.getMessage().startsWith(
- "AvroTest:0.0.1: object \"2147483648\" Avro unmarshalling failed: Numeric value (2147483648) out of range of int"));
+ assertTrue(e.getMessage().startsWith("AvroTest:0.0.1: object \"2147483648\" Avro unmarshalling failed: "
+ + "Numeric value (2147483648) out of range of int"));
}
try {
schemaHelper2.unmarshal("-2147483649");
fail("Test should throw an exception here");
} catch (final Exception e) {
- assertTrue(e.getMessage().startsWith(
- "AvroTest:0.0.1: object \"-2147483649\" Avro unmarshalling failed: Numeric value (-2147483649) out of range of int"));
+ assertTrue(e.getMessage().startsWith("AvroTest:0.0.1: object \"-2147483649\" Avro unmarshalling failed: "
+ + "Numeric value (-2147483649) out of range of int"));
}
try {
schemaHelper2.unmarshal(null);
fail("Test should throw an exception here");
} catch (final Exception e) {
- assertTrue(e.getMessage().equals(
- "AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: String to read from cannot be null!"));
+ assertTrue(e.getMessage().equals("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: "
+ + "String to read from cannot be null!"));
}
}
+ /**
+ * Test long unmarshal.
+ */
@Test
public void testLongUnmarshal() {
final AxContextSchema avroLongSchema = new AxContextSchema(new AxArtifactKey("AvroLong", "0.0.1"), "AVRO",
@@ -186,8 +209,8 @@ public class TestAvroSchemaHelperUnmarshal {
schemaHelper3.createNewInstance();
fail("test should throw an exception here");
} catch (final Exception e) {
- assertEquals("AvroTest:0.0.1: could not create an instance of class \"java.lang.Long\" using the default constructor \"Long()\"",
- e.getMessage());
+ assertEquals("AvroTest:0.0.1: could not create an instance of class \"java.lang.Long\" "
+ + "using the default constructor \"Long()\"", e.getMessage());
}
assertEquals(123456789L, schemaHelper3.createNewInstance("123456789"));
@@ -202,32 +225,37 @@ public class TestAvroSchemaHelperUnmarshal {
schemaHelper3.unmarshal("9223372036854775808");
fail("Test should throw an exception here");
} catch (final Exception e) {
- assertTrue(e.getMessage().startsWith(
- "AvroTest:0.0.1: object \"9223372036854775808\" Avro unmarshalling failed: Numeric value (9223372036854775808) out of range of long"));
+ assertTrue(e.getMessage()
+ .startsWith("AvroTest:0.0.1: object \"9223372036854775808\" Avro unmarshalling failed: "
+ + "Numeric value (9223372036854775808) out of range of long"));
}
try {
schemaHelper3.unmarshal("-9223372036854775809");
fail("Test should throw an exception here");
} catch (final Exception e) {
- assertTrue(e.getMessage().startsWith(
- "AvroTest:0.0.1: object \"-9223372036854775809\" Avro unmarshalling failed: Numeric value (-9223372036854775809) out of range of long"));
+ assertTrue(e.getMessage()
+ .startsWith("AvroTest:0.0.1: object \"-9223372036854775809\" Avro unmarshalling failed: "
+ + "Numeric value (-9223372036854775809) out of range of long"));
}
try {
schemaHelper3.unmarshal("\"Hello\"");
fail("Test should throw an exception here");
} catch (final Exception e) {
- assertTrue(e.getMessage().equals(
- "AvroTest:0.0.1: object \"\"Hello\"\" Avro unmarshalling failed: Expected long. Got VALUE_STRING"));
+ assertTrue(e.getMessage().equals("AvroTest:0.0.1: object \"\"Hello\"\" Avro unmarshalling failed: "
+ + "Expected long. Got VALUE_STRING"));
}
try {
schemaHelper3.unmarshal(null);
fail("Test should throw an exception here");
} catch (final Exception e) {
- assertTrue(e.getMessage().equals(
- "AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: String to read from cannot be null!"));
+ assertTrue(e.getMessage().equals("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: "
+ + "String to read from cannot be null!"));
}
}
+ /**
+ * Test float unmarshal.
+ */
@Test
public void testFloatUnmarshal() {
final AxContextSchema avroFloatSchema = new AxContextSchema(new AxArtifactKey("AvroFloat", "0.0.1"), "AVRO",
@@ -241,8 +269,8 @@ public class TestAvroSchemaHelperUnmarshal {
schemaHelper4.createNewInstance();
fail("test should throw an exception here");
} catch (final Exception e) {
- assertEquals("AvroTest:0.0.1: could not create an instance of class \"java.lang.Float\" using the default constructor \"Float()\"",
- e.getMessage());
+ assertEquals("AvroTest:0.0.1: could not create an instance of class \"java.lang.Float\" "
+ + "using the default constructor \"Float()\"", e.getMessage());
}
assertEquals(1.2345F, schemaHelper4.createNewInstance("1.2345"));
@@ -259,18 +287,21 @@ public class TestAvroSchemaHelperUnmarshal {
schemaHelper4.unmarshal("\"Hello\"");
fail("Test should throw an exception here");
} catch (final Exception e) {
- assertTrue(e.getMessage().equals(
- "AvroTest:0.0.1: object \"\"Hello\"\" Avro unmarshalling failed: Expected float. Got VALUE_STRING"));
+ assertTrue(e.getMessage().equals("AvroTest:0.0.1: object \"\"Hello\"\" Avro unmarshalling failed: "
+ + "Expected float. Got VALUE_STRING"));
}
try {
schemaHelper4.unmarshal(null);
fail("Test should throw an exception here");
} catch (final Exception e) {
- assertTrue(e.getMessage().equals(
- "AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: String to read from cannot be null!"));
+ assertTrue(e.getMessage().equals("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: "
+ + "String to read from cannot be null!"));
}
}
+ /**
+ * Test double unmarshal.
+ */
@Test
public void testDoubleUnmarshal() {
final AxContextSchema avroDoubleSchema = new AxContextSchema(new AxArtifactKey("AvroDouble", "0.0.1"), "AVRO",
@@ -284,8 +315,8 @@ public class TestAvroSchemaHelperUnmarshal {
schemaHelper5.createNewInstance();
fail("test should throw an exception here");
} catch (final Exception e) {
- assertEquals("AvroTest:0.0.1: could not create an instance of class \"java.lang.Double\" using the default constructor \"Double()\"",
- e.getMessage());
+ assertEquals("AvroTest:0.0.1: could not create an instance of class \"java.lang.Double\" "
+ + "using the default constructor \"Double()\"", e.getMessage());
}
assertEquals(1.2345E06, schemaHelper5.createNewInstance("1.2345E06"));
@@ -302,18 +333,21 @@ public class TestAvroSchemaHelperUnmarshal {
schemaHelper5.unmarshal("\"Hello\"");
fail("Test should throw an exception here");
} catch (final Exception e) {
- assertTrue(e.getMessage().equals(
- "AvroTest:0.0.1: object \"\"Hello\"\" Avro unmarshalling failed: Expected double. Got VALUE_STRING"));
+ assertTrue(e.getMessage().equals("AvroTest:0.0.1: object \"\"Hello\"\" Avro unmarshalling failed: "
+ + "Expected double. Got VALUE_STRING"));
}
try {
schemaHelper5.unmarshal(null);
fail("Test should throw an exception here");
} catch (final Exception e) {
- assertTrue(e.getMessage().equals(
- "AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: String to read from cannot be null!"));
+ assertTrue(e.getMessage().equals("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: "
+ + "String to read from cannot be null!"));
}
}
+ /**
+ * Test string unmarshal.
+ */
@Test
public void testStringUnmarshal() {
final AxContextSchema avroStringSchema = new AxContextSchema(new AxArtifactKey("AvroString", "0.0.1"), "AVRO",
@@ -341,11 +375,14 @@ public class TestAvroSchemaHelperUnmarshal {
schemaHelper7.unmarshal(null);
fail("Test should throw an exception here");
} catch (final Exception e) {
- assertTrue(e.getMessage().equals(
- "AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: String to read from cannot be null!"));
+ assertTrue(e.getMessage().equals("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: "
+ + "String to read from cannot be null!"));
}
}
+ /**
+ * Test bytes unmarshal.
+ */
@Test
public void testBytesUnmarshal() {
final AxContextSchema avroSchema = new AxContextSchema(new AxArtifactKey("AvroString", "0.0.1"), "AVRO",
@@ -358,8 +395,8 @@ public class TestAvroSchemaHelperUnmarshal {
schemaHelper.createNewInstance();
fail("test should throw an exception here");
} catch (final Exception e) {
- assertEquals("AvroTest:0.0.1: could not create an instance of class \"java.lang.Byte[]\" using the default constructor \"Byte[]()\"",
- e.getMessage());
+ assertEquals("AvroTest:0.0.1: could not create an instance of class \"java.lang.Byte[]\" "
+ + "using the default constructor \"Byte[]()\"", e.getMessage());
}
final byte[] newBytes = (byte[]) schemaHelper.createNewInstance("\"hello\"");
assertEquals(5, newBytes.length);
@@ -373,8 +410,8 @@ public class TestAvroSchemaHelperUnmarshal {
schemaHelper.unmarshal(null);
fail("Test should throw an exception here");
} catch (final Exception e) {
- assertTrue(e.getMessage().equals(
- "AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: String to read from cannot be null!"));
+ assertTrue(e.getMessage().equals("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: "
+ + "String to read from cannot be null!"));
}
}
}
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaMap.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaMap.java
index 7bf6b0029..9bc87cf61 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaMap.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaMap.java
@@ -43,8 +43,10 @@ import org.onap.policy.apex.model.utilities.TextFileUtils;
import org.onap.policy.common.parameters.ParameterService;
/**
+ * The Class TestAvroSchemaMap.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
- * @version
+ * @version
*/
public class TestAvroSchemaMap {
private final AxKey testKey = new AxArtifactKey("AvroTest", "0.0.1");
@@ -53,6 +55,11 @@ public class TestAvroSchemaMap {
private String addressMapSchema;
private String addressMapSchemaInvalidFields;
+ /**
+ * Inits the test.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Before
public void initTest() throws IOException {
schemas = new AxContextSchemas(new AxArtifactKey("AvroSchemas", "0.0.1"));
@@ -63,6 +70,9 @@ public class TestAvroSchemaMap {
TextFileUtils.getTextFileAsString("src/test/resources/avsc/MapExampleAddressInvalidFields.avsc");
}
+ /**
+ * Inits the context.
+ */
@Before
public void initContext() {
SchemaParameters schemaParameters = new SchemaParameters();
@@ -72,11 +82,19 @@ public class TestAvroSchemaMap {
}
+ /**
+ * Clear context.
+ */
@After
public void clearContext() {
ParameterService.deregister(ContextParameterConstants.SCHEMA_GROUP_NAME);
}
+ /**
+ * Test map init.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testMapInit() throws IOException {
final AxContextSchema avroSchema =
@@ -95,6 +113,11 @@ public class TestAvroSchemaMap {
newMapFull.get(new Utf8("address2")).toString());
}
+ /**
+ * Test long map unmarshal marshal.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testLongMapUnmarshalMarshal() throws IOException {
final AxContextSchema avroSchema =
@@ -107,6 +130,11 @@ public class TestAvroSchemaMap {
testUnmarshalMarshal(schemaHelper, "src/test/resources/data/MapExampleLongFull.json");
}
+ /**
+ * Test address map unmarshal marshal.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testAddressMapUnmarshalMarshal() throws IOException {
final AxContextSchema avroSchema =
@@ -119,6 +147,11 @@ public class TestAvroSchemaMap {
testUnmarshalMarshal(schemaHelper, "src/test/resources/data/MapExampleAddressFull.json");
}
+ /**
+ * Test address map unmarshal marshal invalid fields.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testAddressMapUnmarshalMarshalInvalidFields() throws IOException {
final AxContextSchema avroSchema =
@@ -130,6 +163,13 @@ public class TestAvroSchemaMap {
testUnmarshalMarshal(schemaHelper, "src/test/resources/data/MapExampleAddressInvalidFields.json");
}
+ /**
+ * Test unmarshal marshal.
+ *
+ * @param schemaHelper the schema helper
+ * @param fileName the file name
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
private void testUnmarshalMarshal(final SchemaHelper schemaHelper, final String fileName) throws IOException {
final String originalInString = TextFileUtils.getTextFileAsString(fileName);
final HashMap<?, ?> firstDecodedMap = (HashMap<?, ?>) schemaHelper.unmarshal(originalInString);
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaRecord.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaRecord.java
index 000dcc9fd..6b1d09eb6 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaRecord.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaRecord.java
@@ -40,29 +40,40 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
import org.onap.policy.apex.model.utilities.TextFileUtils;
import org.onap.policy.common.parameters.ParameterService;
+// TODO: Auto-generated Javadoc
/**
+ * The Class TestAvroSchemaRecord.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
- * @version
+ * @version
*/
public class TestAvroSchemaRecord {
private final AxKey testKey = new AxArtifactKey("AvroTest", "0.0.1");
private AxContextSchemas schemas;
private String recordSchema;
- private String recordSchemaVPN;
- private String recordSchemaVPNReuse;
+ private String recordSchemaVpn;
+ private String recordSchemaVpnReuse;
private String recordSchemaInvalidFields;
+ /**
+ * Inits the test.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Before
public void initTest() throws IOException {
schemas = new AxContextSchemas(new AxArtifactKey("AvroSchemas", "0.0.1"));
ModelService.registerModel(AxContextSchemas.class, schemas);
recordSchema = TextFileUtils.getTextFileAsString("src/test/resources/avsc/RecordExample.avsc");
- recordSchemaVPN = TextFileUtils.getTextFileAsString("src/test/resources/avsc/RecordExampleVPN.avsc");
- recordSchemaVPNReuse = TextFileUtils.getTextFileAsString("src/test/resources/avsc/RecordExampleVPNReuse.avsc");
+ recordSchemaVpn = TextFileUtils.getTextFileAsString("src/test/resources/avsc/RecordExampleVPN.avsc");
+ recordSchemaVpnReuse = TextFileUtils.getTextFileAsString("src/test/resources/avsc/RecordExampleVPNReuse.avsc");
recordSchemaInvalidFields =
TextFileUtils.getTextFileAsString("src/test/resources/avsc/RecordExampleInvalidFields.avsc");
}
+ /**
+ * Inits the context.
+ */
@Before
public void initContext() {
SchemaParameters schemaParameters = new SchemaParameters();
@@ -72,11 +83,19 @@ public class TestAvroSchemaRecord {
}
+ /**
+ * Clear context.
+ */
@After
public void clearContext() {
ParameterService.deregister(ContextParameterConstants.SCHEMA_GROUP_NAME);
}
+ /**
+ * Test record init.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testRecordInit() throws IOException {
final AxContextSchema avroSchema =
@@ -93,6 +112,11 @@ public class TestAvroSchemaRecord {
assertEquals("gobbledygook", newRecordFull.get("passwordHash").toString());
}
+ /**
+ * Test record unmarshal marshal.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testRecordUnmarshalMarshal() throws IOException {
final AxContextSchema avroSchema =
@@ -105,6 +129,11 @@ public class TestAvroSchemaRecord {
testUnmarshalMarshal(schemaHelper, "src/test/resources/data/RecordExampleFull.json");
}
+ /**
+ * Test record unmarshal marshal invalid.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testRecordUnmarshalMarshalInvalid() throws IOException {
final AxContextSchema avroSchema =
@@ -116,10 +145,15 @@ public class TestAvroSchemaRecord {
testUnmarshalMarshal(schemaHelper, "src/test/resources/data/RecordExampleInvalidFields.json");
}
+ /**
+ * Test VPN record unmarshal marshal.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testVPNRecordUnmarshalMarshal() throws IOException {
+ public void testVpnRecordUnmarshalMarshal() throws IOException {
final AxContextSchema avroSchema =
- new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", recordSchemaVPN);
+ new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", recordSchemaVpn);
schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema);
final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey());
@@ -127,16 +161,28 @@ public class TestAvroSchemaRecord {
testUnmarshalMarshal(schemaHelper, "src/test/resources/data/RecordExampleVPNFull.json");
}
+ /**
+ * Test VPN record reuse.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testVPNRecordReuse() throws IOException {
+ public void testVpnRecordReuse() throws IOException {
final AxContextSchema avroSchema =
- new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", recordSchemaVPNReuse);
+ new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", recordSchemaVpnReuse);
schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema);
schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema);
new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey());
}
+ /**
+ * Test unmarshal marshal.
+ *
+ * @param schemaHelper the schema helper
+ * @param fileName the file name
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
private void testUnmarshalMarshal(final SchemaHelper schemaHelper, final String fileName) throws IOException {
final String inString = TextFileUtils.getTextFileAsString(fileName);
final GenericRecord decodedObject = (GenericRecord) schemaHelper.unmarshal(inString);
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaUnion.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaUnion.java
index 33cb20328..c957d8d4c 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaUnion.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestAvroSchemaUnion.java
@@ -42,14 +42,21 @@ import org.onap.policy.apex.model.utilities.TextFileUtils;
import org.onap.policy.common.parameters.ParameterService;
/**
+ * The Class TestAvroSchemaUnion.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
- * @version
+ * @version
*/
public class TestAvroSchemaUnion {
private final AxKey testKey = new AxArtifactKey("AvroTest", "0.0.1");
private AxContextSchemas schemas;
private String uinionSchema;
+ /**
+ * Inits the test.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Before
public void initTest() throws IOException {
schemas = new AxContextSchemas(new AxArtifactKey("AvroSchemas", "0.0.1"));
@@ -57,25 +64,36 @@ public class TestAvroSchemaUnion {
uinionSchema = TextFileUtils.getTextFileAsString("src/test/resources/avsc/UnionExample.avsc");
}
+ /**
+ * Inits the context.
+ */
@Before
public void initContext() {
SchemaParameters schemaParameters = new SchemaParameters();
schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
schemaParameters.getSchemaHelperParameterMap().put("AVRO", new AvroSchemaHelperParameters());
ParameterService.register(schemaParameters);
-
+
}
+ /**
+ * Clear context.
+ */
@After
public void clearContext() {
ParameterService.deregister(ContextParameterConstants.SCHEMA_GROUP_NAME);
}
+ /**
+ * Test union all fields.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Ignore
@Test
public void testUnionAllFields() throws IOException {
final AxContextSchema avroSchema =
- new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", uinionSchema);
+ new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", uinionSchema);
schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema);
final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey());
@@ -88,17 +106,22 @@ public class TestAvroSchemaUnion {
assertEquals("red", user.get("favourite_colour").toString());
}
+ /**
+ * Test union optional field.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Ignore
@Test
public void testUnionOptionalField() throws IOException {
final AxContextSchema avroSchema =
- new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", uinionSchema);
+ new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", uinionSchema);
schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema);
final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey());
final String inString =
- TextFileUtils.getTextFileAsString("src/test/resources/data/UnionExampleOptionalField.json");
+ TextFileUtils.getTextFileAsString("src/test/resources/data/UnionExampleOptionalField.json");
final GenericRecord user = (GenericRecord) schemaHelper.createNewInstance(inString);
assertEquals("Ben", user.get("name").toString());
@@ -106,11 +129,16 @@ public class TestAvroSchemaUnion {
assertEquals("red", user.get("favourite_colour").toString());
}
+ /**
+ * Test union null field.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Ignore
@Test
public void testUnionNullField() throws IOException {
final AxContextSchema avroSchema =
- new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", uinionSchema);
+ new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", uinionSchema);
schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema);
final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey());
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestHealthCheckSchema.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestHealthCheckSchema.java
index 42764a1ca..646b8aa04 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestHealthCheckSchema.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/TestHealthCheckSchema.java
@@ -44,6 +44,8 @@ import org.onap.policy.apex.model.utilities.TextFileUtils;
import org.onap.policy.common.parameters.ParameterService;
/**
+ * The Class TestHealthCheckSchema.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class TestHealthCheckSchema {
@@ -51,6 +53,11 @@ public class TestHealthCheckSchema {
private AxContextSchemas schemas;
private String healthCheckSchema;
+ /**
+ * Inits the test.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Before
public void initTest() throws IOException {
schemas = new AxContextSchemas(new AxArtifactKey("AvroSchemas", "0.0.1"));
@@ -59,24 +66,35 @@ public class TestHealthCheckSchema {
healthCheckSchema = TextFileUtils.getTextFileAsString("src/test/resources/avsc/HealthCheckBodyType.avsc");
}
+ /**
+ * Inits the context.
+ */
@Before
public void initContext() {
SchemaParameters schemaParameters = new SchemaParameters();
schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
schemaParameters.getSchemaHelperParameterMap().put("AVRO", new AvroSchemaHelperParameters());
ParameterService.register(schemaParameters);
-
+
}
+ /**
+ * Clear context.
+ */
@After
public void clearContext() {
ParameterService.deregister(ContextParameterConstants.SCHEMA_GROUP_NAME);
}
+ /**
+ * Test health check.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testHealthCheck() throws IOException {
- final AxContextSchema avroSchema =
- new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", healthCheckSchema);
+ final AxContextSchema avroSchema = new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO",
+ healthCheckSchema);
schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema);
final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey());
@@ -89,15 +107,15 @@ public class TestHealthCheckSchema {
final GenericRecord inputRecord = new GenericData.Record(healthCheckRecordSchema.getField("input").schema());
final Schema inputRecordRecordSchema = inputRecord.getSchema();
- final GenericRecord actionIndentifiersRecord =
- new GenericData.Record(inputRecordRecordSchema.getField("action_DasH_identifiers").schema());
+ final GenericRecord actionIndentifiersRecord = new GenericData.Record(
+ inputRecordRecordSchema.getField("action_DasH_identifiers").schema());
- final GenericRecord commonHeaderRecord =
- new GenericData.Record(inputRecordRecordSchema.getField("common_DasH_header").schema());
+ final GenericRecord commonHeaderRecord = new GenericData.Record(
+ inputRecordRecordSchema.getField("common_DasH_header").schema());
final Schema commonHeaderRecordSchema = commonHeaderRecord.getSchema();
- final GenericRecord commonHeaderFlagsRecord =
- new GenericData.Record(commonHeaderRecordSchema.getField("flags").schema());
+ final GenericRecord commonHeaderFlagsRecord = new GenericData.Record(
+ commonHeaderRecordSchema.getField("flags").schema());
healthCheckRecord.put("input", inputRecord);
inputRecord.put("action_DasH_identifiers", actionIndentifiersRecord);
@@ -105,8 +123,8 @@ public class TestHealthCheckSchema {
commonHeaderRecord.put("flags", commonHeaderFlagsRecord);
inputRecord.put("action", "HealthCheck");
- inputRecord.put("payload",
- "{\"host-ip-address\":\"131.160.203.125\",\"input.url\":\"131.160.203.125/afr\",\"request-action-type\":\"GET\",\"request-action\":\"AFR\"}");
+ inputRecord.put("payload", "{\"host-ip-address\":\"131.160.203.125\",\"input.url\":\"131.160.203.125/afr\","
+ + "\"request-action-type\":\"GET\",\"request-action\":\"AFR\"}");
actionIndentifiersRecord.put("vnf_DasH_id", "49414df5-3482-4fd8-9952-c463dff2770b");
@@ -125,6 +143,13 @@ public class TestHealthCheckSchema {
assertEquals(eventString.toString().replaceAll("\\s+", ""), outString.replaceAll("\\s+", ""));
}
+ /**
+ * Test unmarshal marshal.
+ *
+ * @param schemaHelper the schema helper
+ * @param fileName the file name
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
private void testUnmarshalMarshal(final SchemaHelper schemaHelper, final String fileName) throws IOException {
final String inString = TextFileUtils.getTextFileAsString(fileName);
final GenericRecord decodedObject = (GenericRecord) schemaHelper.unmarshal(inString);