-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Std out sink to use event model #599
Changes from 3 commits
c24d8a8
cb35482
12a65e2
9c0b20e
018c35c
03e3673
f37ef25
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
|
@@ -12,21 +13,47 @@ | |
package com.amazon.dataprepper.plugins.sink; | ||
|
||
import com.amazon.dataprepper.model.configuration.PluginSetting; | ||
import com.amazon.dataprepper.model.event.Event; | ||
import com.amazon.dataprepper.model.event.JacksonEvent; | ||
import com.amazon.dataprepper.model.record.Record; | ||
import org.junit.Test; | ||
import org.junit.jupiter.api.BeforeEach; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are using two different version of Junit now. I believe this is what is impacting your test coverage. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! It's a subtle difference. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yep .90 is working again |
||
|
||
import java.util.Arrays; | ||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.UUID; | ||
|
||
public class StdOutSinkTests { | ||
private static String PLUGIN_NAME = "stdout"; | ||
|
||
private final String TEST_DATA_1 = "data_prepper"; | ||
private final String TEST_DATA_2 = "stdout_sink"; | ||
private final Record<String> TEST_RECORD_1 = new Record<>(TEST_DATA_1); | ||
private final Record<String> TEST_RECORD_2 = new Record<>(TEST_DATA_2); | ||
private final List<Record<String>> TEST_RECORDS = Arrays.asList(TEST_RECORD_1, TEST_RECORD_2); | ||
private final Map<String, Object> TEST_DATA_1 = new HashMap<>(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I recommend that you make this a non-final and initialize it in the The same goes for |
||
private final Map<String, Object> TEST_DATA_2 = new HashMap<>(); | ||
|
||
private final List<Record<Event>> TEST_RECORDS = new ArrayList<>(); | ||
|
||
|
||
@BeforeEach | ||
public void setup() { | ||
TEST_DATA_1.put(UUID.randomUUID().toString(), UUID.randomUUID().toString()); | ||
TEST_DATA_2.put(UUID.randomUUID().toString(), UUID.randomUUID().toString()); | ||
|
||
final Record<Event> TEST_RECORD_1 = new Record<>(JacksonEvent | ||
.builder() | ||
.withEventType("event") | ||
.withData(TEST_DATA_1) | ||
.build()); | ||
|
||
final Record<Event> TEST_RECORD_2 = new Record<>(JacksonEvent | ||
.builder() | ||
.withEventType("event") | ||
.withData(TEST_DATA_2) | ||
.build()); | ||
|
||
TEST_RECORDS.add(TEST_RECORD_1); | ||
TEST_RECORDS.add(TEST_RECORD_2); | ||
} | ||
|
||
@Test | ||
public void testSimple() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the threshold as is. There is nothing in this PR that requires us to lower it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You would think so, but the coverage is now .89 after this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran your changes locally addressing the Junit issue and looking at the code coverage results from the build. It is possible to achieve .90. Let's keep it at .90.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had tried this yesterday and it did fix it. Had bumped it back to 0.90 for the next revision. Interesting little thing there with the 2 different versions of Junit. Thanks for catching it!