JavaFilterExampleTest.java fails due to ContextImpl argument count
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 45/100
Research direction
Inspect src/test/java/org/logstashplugins/JavaFilterExampleTest.java, especially the ContextImpl construction in testJavaExampleFilter. Compile the test suite and confirm the constructor call matches the available ContextImpl signature; done means the test sources compile without the argument-count error.
Written by the indexing model from the issue text.
Description
After managing to get tests to run with the PR in #20, I found that with Logstash 7.9 (not sure where this change actually came about), the tests fail to run:
> Task :compileTestJava FAILED
/workspaces/logstash-filter-java_filter_example/src/test/java/org/logstashplugins/JavaFilterExampleTest.java:22: error: constructor ContextImpl in class ContextImpl cannot be applied to given types;
Context context = new ContextImpl(null);
^
required: DeadLetterQueueWriter,Metric
found: <null>
reason: actual and formal argument lists differ in length
1 error
The Javadocs (harvested from the Logstash source code) list only the following constructor:
ContextImpl(DeadLetterQueueWriter dlqWriter, Metric metric)
The following diff resolves the issue, I guess either the DeadLetterWriter or the Metrics argument was added, perhaps at the time of GA.
[builder@e4261c43934e logstash-filter-java_filter_example]$ git diff
diff --git a/src/test/java/org/logstashplugins/JavaFilterExampleTest.java b/src/test/java/org/logstashplugins/JavaFilterExampleTest.java
index aee8e2a..99ce06d 100644
--- a/src/test/java/org/logstashplugins/JavaFilterExampleTest.java
+++ b/src/test/java/org/logstashplugins/JavaFilterExampleTest.java
@@ -19,7 +19,7 @@ public class JavaFilterExampleTest {
public void testJavaExampleFilter() {
String sourceField = "foo";
Configuration config = new ConfigurationImpl(Collections.singletonMap("source", sourceField));
- Context context = new ContextImpl(null);
+ Context context = new ContextImpl(null, null);
JavaFilterExample filter = new JavaFilterExample("test-id", config, context);
Event e = new org.logstash.Event();
- Dominant language
- Java
- Stars
- 19
- Forks
- 39
- PR merge metrics
- No merged PRs in 30d
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from logstash-plugins/logstash-filter-java_filter_example
-
Difficulty 1/5 Under an hour Newbie friendliness 55/100
logstash-plugins/logstash-filter-java_filter_example#27 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Sample code and instructions for Java plugins will omit common configuration (eg. 'id', 'tags')Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
logstash-plugins/logstash-filter-java_filter_example#15 · 1 comment ·
All issues in logstash-plugins/logstash-filter-java_filter_example
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
nextcloud/notes-android#3367 ·
Maintainers usually reply within 1 day
-
Feature
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
MuntashirAkon/AppManager#2058 ·
-
SarifLogger: artifactLocation.uri is not properly encoded for file names containing '#', '?', or '%'Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
checkstyle/checkstyle#21721 ·
Maintainers usually reply within 1 day