fix: Typos in Avro module
This commit is contained in:
parent
a4f6d89cc7
commit
b62dcfbb36
|
@ -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<AvroHttpRequest> 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<AvroHttpRequest> employeeReader = new SpecificDatumReader<>(AvroHttpRequest.class);
|
||||
Decoder decoder = DecoderFactory.get()
|
||||
.binaryDecoder(data, null);
|
|
@ -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<AvroHttpRequest> 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<AvroHttpRequest> writer = new SpecificDatumWriter<>(AvroHttpRequest.class);
|
||||
byte[] data = new byte[0];
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
|
@ -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()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue