diff --git a/apache-libraries/src/main/java/com/baeldung/avro/util/serealization/AvroDeSerealizer.java b/apache-libraries/src/main/java/com/baeldung/avro/util/serialization/AvroDeSerializer.java similarity index 84% rename from apache-libraries/src/main/java/com/baeldung/avro/util/serealization/AvroDeSerealizer.java rename to apache-libraries/src/main/java/com/baeldung/avro/util/serialization/AvroDeSerializer.java index 7d30c3d1ee..cf4c360ba4 100644 --- a/apache-libraries/src/main/java/com/baeldung/avro/util/serealization/AvroDeSerealizer.java +++ b/apache-libraries/src/main/java/com/baeldung/avro/util/serialization/AvroDeSerializer.java @@ -1,4 +1,4 @@ -package com.baeldung.avro.util.serealization; +package com.baeldung.avro.util.serialization; import com.baeldung.avro.util.model.AvroHttpRequest; import org.apache.avro.io.DatumReader; @@ -10,11 +10,11 @@ import org.slf4j.LoggerFactory; import java.io.IOException; -public class AvroDeSerealizer { +public class AvroDeSerializer { - private static Logger logger = LoggerFactory.getLogger(AvroDeSerealizer.class); + private static Logger logger = LoggerFactory.getLogger(AvroDeSerializer.class); - public AvroHttpRequest deSerealizeAvroHttpRequestJSON(byte[] data) { + public AvroHttpRequest deSerializeAvroHttpRequestJSON(byte[] data) { DatumReader reader = new SpecificDatumReader<>(AvroHttpRequest.class); Decoder decoder = null; try { @@ -27,7 +27,7 @@ public class AvroDeSerealizer { return null; } - public AvroHttpRequest deSerealizeAvroHttpRequestBinary(byte[] data) { + public AvroHttpRequest deSerializeAvroHttpRequestBinary(byte[] data) { DatumReader employeeReader = new SpecificDatumReader<>(AvroHttpRequest.class); Decoder decoder = DecoderFactory.get() .binaryDecoder(data, null); diff --git a/apache-libraries/src/main/java/com/baeldung/avro/util/serealization/AvroSerealizer.java b/apache-libraries/src/main/java/com/baeldung/avro/util/serialization/AvroSerializer.java similarity index 87% rename from apache-libraries/src/main/java/com/baeldung/avro/util/serealization/AvroSerealizer.java rename to apache-libraries/src/main/java/com/baeldung/avro/util/serialization/AvroSerializer.java index 767b688dea..6d39060ec8 100644 --- a/apache-libraries/src/main/java/com/baeldung/avro/util/serealization/AvroSerealizer.java +++ b/apache-libraries/src/main/java/com/baeldung/avro/util/serialization/AvroSerializer.java @@ -1,4 +1,4 @@ -package com.baeldung.avro.util.serealization; +package com.baeldung.avro.util.serialization; import com.baeldung.avro.util.model.AvroHttpRequest; import org.apache.avro.io.*; @@ -9,11 +9,11 @@ import org.slf4j.LoggerFactory; import java.io.ByteArrayOutputStream; import java.io.IOException; -public class AvroSerealizer { +public class AvroSerializer { - private static final Logger logger = LoggerFactory.getLogger(AvroSerealizer.class); + private static final Logger logger = LoggerFactory.getLogger(AvroSerializer.class); - public byte[] serealizeAvroHttpRequestJSON(AvroHttpRequest request) { + public byte[] serializeAvroHttpRequestJSON(AvroHttpRequest request) { DatumWriter writer = new SpecificDatumWriter<>(AvroHttpRequest.class); byte[] data = new byte[0]; ByteArrayOutputStream stream = new ByteArrayOutputStream(); @@ -30,7 +30,7 @@ public class AvroSerealizer { return data; } - public byte[] serealizeAvroHttpRequestBinary(AvroHttpRequest request) { + public byte[] serializeAvroHttpRequestBinary(AvroHttpRequest request) { DatumWriter writer = new SpecificDatumWriter<>(AvroHttpRequest.class); byte[] data = new byte[0]; ByteArrayOutputStream stream = new ByteArrayOutputStream(); diff --git a/apache-libraries/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerIntegrationTest.java b/apache-libraries/src/test/java/com/baeldung/avro/util/serialization/AvroSerializerDeSerializerIntegrationTest.java similarity index 75% rename from apache-libraries/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerIntegrationTest.java rename to apache-libraries/src/test/java/com/baeldung/avro/util/serialization/AvroSerializerDeSerializerIntegrationTest.java index 3d413e1939..964eeb6d87 100644 --- a/apache-libraries/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerIntegrationTest.java +++ b/apache-libraries/src/test/java/com/baeldung/avro/util/serialization/AvroSerializerDeSerializerIntegrationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.avro.util.serealization; +package com.baeldung.avro.util.serialization; import com.baeldung.avro.util.model.Active; import com.baeldung.avro.util.model.AvroHttpRequest; @@ -13,16 +13,16 @@ import java.util.Objects; import static org.junit.Assert.*; -public class AvroSerealizerDeSerealizerIntegrationTest { +public class AvroSerializerDeSerializerIntegrationTest { - AvroSerealizer serealizer; - AvroDeSerealizer deSerealizer; + AvroSerializer serializer; + AvroDeSerializer deserializer; AvroHttpRequest request; @Before public void setUp() throws Exception { - serealizer = new AvroSerealizer(); - deSerealizer = new AvroDeSerealizer(); + serializer = new AvroSerializer(); + deserializer = new AvroDeSerializer(); ClientIdentifier clientIdentifier = ClientIdentifier.newBuilder() .setHostName("localhost") @@ -49,22 +49,22 @@ public class AvroSerealizerDeSerealizerIntegrationTest { @Test public void WhenSerializedUsingJSONEncoder_thenObjectGetsSerialized() { - byte[] data = serealizer.serealizeAvroHttpRequestJSON(request); + byte[] data = serializer.serializeAvroHttpRequestJSON(request); assertTrue(Objects.nonNull(data)); assertTrue(data.length > 0); } @Test public void WhenSerializedUsingBinaryEncoder_thenObjectGetsSerialized() { - byte[] data = serealizer.serealizeAvroHttpRequestBinary(request); + byte[] data = serializer.serializeAvroHttpRequestBinary(request); assertTrue(Objects.nonNull(data)); assertTrue(data.length > 0); } @Test public void WhenDeserializeUsingJSONDecoder_thenActualAndExpectedObjectsAreEqual() { - byte[] data = serealizer.serealizeAvroHttpRequestJSON(request); - AvroHttpRequest actualRequest = deSerealizer.deSerealizeAvroHttpRequestJSON(data); + byte[] data = serializer.serializeAvroHttpRequestJSON(request); + AvroHttpRequest actualRequest = deserializer.deSerializeAvroHttpRequestJSON(data); assertEquals(actualRequest, request); assertTrue(actualRequest.getRequestTime() .equals(request.getRequestTime())); @@ -72,12 +72,12 @@ public class AvroSerealizerDeSerealizerIntegrationTest { @Test public void WhenDeserializeUsingBinaryecoder_thenActualAndExpectedObjectsAreEqual() { - byte[] data = serealizer.serealizeAvroHttpRequestBinary(request); - AvroHttpRequest actualRequest = deSerealizer.deSerealizeAvroHttpRequestBinary(data); + byte[] data = serializer.serializeAvroHttpRequestBinary(request); + AvroHttpRequest actualRequest = deserializer.deSerializeAvroHttpRequestBinary(data); assertEquals(actualRequest, request); assertTrue(actualRequest.getRequestTime() .equals(request.getRequestTime())); } - + }