Skip to content

Commit

Permalink
Renamed JsonObjDecoder to JsonObjectDecoder
Browse files Browse the repository at this point in the history
Signed-off-by: Krishna Kondaka <[email protected]>
  • Loading branch information
Krishna Kondaka committed Mar 13, 2024
1 parent 65cb603 commit 427429f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.util.Objects;
import java.util.function.Consumer;

public class JsonObjDecoder implements ByteDecoder {
public class JsonObjectDecoder implements ByteDecoder {
private final ObjectMapper objectMapper = new ObjectMapper();
private final JsonFactory jsonFactory = new JsonFactory();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,29 @@

import org.junit.jupiter.api.BeforeEach;

public class JsonObjDecoderTest {
private JsonObjDecoder jsonObjDecoder;
public class JsonObjectDecoderTest {
private JsonObjectDecoder jsonObjectDecoder;
private Record<Event> receivedRecord;
private Instant receivedTime;

private JsonObjDecoder createObjectUnderTest() {
return new JsonObjDecoder();
private JsonObjectDecoder createObjectUnderTest() {
return new JsonObjectDecoder();
}

@BeforeEach
void setup() {
jsonObjDecoder = createObjectUnderTest();
jsonObjectDecoder = createObjectUnderTest();
receivedRecord = null;
}

@Test
void test_basicJsonObjDecoder() {
void test_basicJsonObjectDecoder() {
String stringValue = UUID.randomUUID().toString();
Random r = new Random();
int intValue = r.nextInt();
String inputString = "{\"key1\":\""+stringValue+"\", \"key2\":"+intValue+"}";
try {
jsonObjDecoder.parse(new ByteArrayInputStream(inputString.getBytes()), null, (record) -> {
jsonObjectDecoder.parse(new ByteArrayInputStream(inputString.getBytes()), null, (record) -> {
receivedRecord = record;
});
} catch (Exception e){}
Expand All @@ -51,15 +51,15 @@ void test_basicJsonObjDecoder() {
}

@Test
void test_basicJsonObjDecoder_withTimeReceived() {
void test_basicJsonObjectDecoder_withTimeReceived() {
String stringValue = UUID.randomUUID().toString();
Random r = new Random();
int intValue = r.nextInt();

String inputString = "{\"key1\":\""+stringValue+"\", \"key2\":"+intValue+"}";
final Instant now = Instant.now();
try {
jsonObjDecoder.parse(new ByteArrayInputStream(inputString.getBytes()), now, (record) -> {
jsonObjectDecoder.parse(new ByteArrayInputStream(inputString.getBytes()), now, (record) -> {
receivedRecord = record;
receivedTime = ((DefaultEventHandle)(((Event)record.getData()).getEventHandle())).getInternalOriginationTime();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.opensearch.dataprepper.model.record.Record;
import org.opensearch.dataprepper.model.source.Source;
import org.opensearch.dataprepper.model.codec.ByteDecoder;
import org.opensearch.dataprepper.model.codec.JsonObjDecoder;
import org.opensearch.dataprepper.model.codec.JsonObjectDecoder;
import com.linecorp.armeria.server.HttpService;
import com.linecorp.armeria.server.Server;
import com.linecorp.armeria.server.ServerBuilder;
Expand Down Expand Up @@ -64,7 +64,7 @@ public HTTPSource(final HTTPSourceConfig sourceConfig, final PluginMetrics plugi
this.sourceConfig = sourceConfig;
this.pluginMetrics = pluginMetrics;
this.pipelineName = pipelineDescription.getPipelineName();
this.byteDecoder = new JsonObjDecoder();
this.byteDecoder = new JsonObjectDecoder();
this.certificateProviderFactory = new CertificateProviderFactory(sourceConfig);
final PluginModel authenticationConfiguration = sourceConfig.getAuthentication();
final PluginSetting authenticationPluginSetting;
Expand Down

0 comments on commit 427429f

Please sign in to comment.