-
Notifications
You must be signed in to change notification settings - Fork 207
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
Updated the PipelineModel to return a SinkModel for sinks #1802
Updated the PipelineModel to return a SinkModel for sinks #1802
Conversation
…des fields for conditional routing. Signed-off-by: David Venable <[email protected]>
@@ -144,6 +146,11 @@ void deserialize_PipelinesDataFlowModel_with_route() throws IOException { | |||
assertThat(pipelineModel.getSinks().size(), equalTo(1)); | |||
assertThat(pipelineModel.getSinks().get(0), notNullValue()); | |||
assertThat(pipelineModel.getSinks().get(0).getPluginName(), equalTo("testSink")); | |||
assertThat(pipelineModel.getSinks().get(0).getRoutes(), notNullValue()); | |||
assertAll( |
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.
👍
@@ -116,6 +117,11 @@ private static PluginSetting getPluginSettingFromPluginModel(final PluginModel p | |||
return new PluginSetting(pluginModel.getPluginName(), settingsMap == null ? new HashMap<>() : settingsMap); | |||
} | |||
|
|||
private static RoutedPluginSetting getRoutedPluginSettingFromSinkModel(final SinkModel sinkModel) { | |||
final Map<String, Object> settingsMap = sinkModel.getPluginSettings(); | |||
return new RoutedPluginSetting(sinkModel.getPluginName(), settingsMap == null ? new HashMap<>() : settingsMap, sinkModel.getRoutes()); |
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.
nit: The inline operator argument could be moved to its own line.
Another alternative is Optional
public static String bar(final String arg) {
return arg;
}
public static void main(String[] args) {
final var foo = Optional.ofNullable(bar(args[0]));
System.out.println(foo.orElse("default"));
}
@Test | ||
void testSinksWithRoutes() { | ||
final List<Collection<String>> orderedSinkRoutes = new ArrayList<>(); | ||
for (SinkModel sink : sinks) { |
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.
sink can be final
Signed-off-by: David Venable <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #1802 +/- ##
============================================
- Coverage 93.96% 93.94% -0.03%
- Complexity 1457 1478 +21
============================================
Files 188 189 +1
Lines 4275 4326 +51
Branches 347 354 +7
============================================
+ Hits 4017 4064 +47
- Misses 177 179 +2
- Partials 81 83 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Description
The primary goal of this PR is to build up the changes that propagate routes from the
PipelineModel
from the API level to thePipelineConfiguration
in data-prepper-core. This is accomplished mainly through two changes.PipelineModel
to returnSinkModel
for the sinks. This is an API change.RoutedPluginSettings
within data-prepper-core to support propagation of this information.Issues Resolved
Contributes toward #1337 .
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.