diff --git a/.mvn/jvm.config b/.mvn/jvm.config new file mode 100644 index 0000000000..f3b9f7db5d --- /dev/null +++ b/.mvn/jvm.config @@ -0,0 +1,11 @@ +--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED +--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED +--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED +-Dfile.encoding=UTF-8 diff --git a/.rat-excludes b/.rat-excludes new file mode 100644 index 0000000000..3010146994 --- /dev/null +++ b/.rat-excludes @@ -0,0 +1,2 @@ +.rat-excludes +**/src/test/resources/test_command.ps1 \ No newline at end of file diff --git a/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestCheckpointRebuilder.java b/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestCheckpointRebuilder.java index 008c2e3ad5..7ebebc7e27 100644 --- a/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestCheckpointRebuilder.java +++ b/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestCheckpointRebuilder.java @@ -16,7 +16,10 @@ */ package org.apache.flume.channel.file; -import static org.apache.flume.channel.file.TestUtils.*; +import static org.apache.flume.channel.file.TestUtils.compareInputAndOut; +import static org.apache.flume.channel.file.TestUtils.consumeChannel; +import static org.apache.flume.channel.file.TestUtils.fillChannel; +import static org.apache.flume.channel.file.TestUtils.getAllLogs; import com.google.common.collect.Maps; import java.io.File; diff --git a/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestFileChannelRestart.java b/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestFileChannelRestart.java index 5f43bc873c..69bb9a4ba7 100644 --- a/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestFileChannelRestart.java +++ b/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestFileChannelRestart.java @@ -25,7 +25,7 @@ import static org.apache.flume.channel.file.TestUtils.putWithoutCommit; import static org.apache.flume.channel.file.TestUtils.takeEvents; import static org.apache.flume.channel.file.TestUtils.takeWithoutCommit; -import static org.fest.reflect.core.Reflection.*; +import static org.fest.reflect.core.Reflection.field; import com.google.common.collect.Lists; import com.google.common.collect.Maps; diff --git a/flume-ng-channels/flume-spillable-memory-channel/src/main/java/org/apache/flume/channel/SpillableMemoryChannel.java b/flume-ng-channels/flume-spillable-memory-channel/src/main/java/org/apache/flume/channel/SpillableMemoryChannel.java index 36bdf1924e..25c8ada3db 100644 --- a/flume-ng-channels/flume-spillable-memory-channel/src/main/java/org/apache/flume/channel/SpillableMemoryChannel.java +++ b/flume-ng-channels/flume-spillable-memory-channel/src/main/java/org/apache/flume/channel/SpillableMemoryChannel.java @@ -535,6 +535,9 @@ private void commitPutsToPrimary() { channelCounter.addToEventPutSuccessCount(putList.size()); } + // `queueLock` must not be held on blocking operations, + // and an approximate channel size is enough for the counter. + @SuppressWarnings("GuardedBy") @Override protected void doRollback() { logger.debug("Rollback() of " + (takeCalled ? " Take Tx" : (putCalled ? " Put Tx" : "Empty Tx"))); @@ -729,6 +732,8 @@ public void configure(Context context) { super.configure(context); } + // the unguarded read of `memQueue` only detects whether the queue needs resizing + @SuppressWarnings("GuardedBy") private void resizePrimaryQueue(int newMemoryCapacity) throws InterruptedException { if (memQueue != null && memoryCapacity == newMemoryCapacity) { return; @@ -765,6 +770,8 @@ private void resizePrimaryQueue(int newMemoryCapacity) throws InterruptedExcepti } } + // an approximate channel size is enough for the counter + @SuppressWarnings("GuardedBy") @Override public synchronized void start() { super.start(); @@ -779,6 +786,8 @@ public synchronized void start() { channelCounter.setChannelSize(totalCount); } + // an approximate channel size is enough for the counter + @SuppressWarnings("GuardedBy") @Override public synchronized void stop() { if (getLifecycleState() == LifecycleState.STOP) { diff --git a/flume-ng-configfilters/flume-ng-external-process-config-filter/src/test/resources/test.sh b/flume-ng-configfilters/flume-ng-external-process-config-filter/src/test/resources/test.sh index 4ebd83b14b..c7f41d4c4a 100644 --- a/flume-ng-configfilters/flume-ng-external-process-config-filter/src/test/resources/test.sh +++ b/flume-ng-configfilters/flume-ng-external-process-config-filter/src/test/resources/test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +# SPDX-License-Identifier: Apache-2.0 if [ $1 = "my_password_key" ]; then echo "filtered"; diff --git a/flume-ng-configfilters/flume-ng-external-process-config-filter/src/test/resources/test_error.sh b/flume-ng-configfilters/flume-ng-external-process-config-filter/src/test/resources/test_error.sh index 2213ac2f09..7f3a5b13f1 100644 --- a/flume-ng-configfilters/flume-ng-external-process-config-filter/src/test/resources/test_error.sh +++ b/flume-ng-configfilters/flume-ng-external-process-config-filter/src/test/resources/test_error.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash +# SPDX-License-Identifier: Apache-2.0 + echo "Error message from stderr" 1>&2 echo "Error message from stdout" diff --git a/flume-ng-configuration/src/test/java/org/apache/flume/conf/TestAgentConfiguration.java b/flume-ng-configuration/src/test/java/org/apache/flume/conf/TestAgentConfiguration.java index 0683c6d302..dccc399e28 100644 --- a/flume-ng-configuration/src/test/java/org/apache/flume/conf/TestAgentConfiguration.java +++ b/flume-ng-configuration/src/test/java/org/apache/flume/conf/TestAgentConfiguration.java @@ -17,7 +17,11 @@ package org.apache.flume.conf; import static org.apache.flume.conf.FlumeConfigurationError.ErrorOrWarning.ERROR; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import java.util.Arrays; import java.util.HashMap; diff --git a/flume-ng-configuration/src/test/java/org/apache/flume/conf/TestFlumeConfiguration.java b/flume-ng-configuration/src/test/java/org/apache/flume/conf/TestFlumeConfiguration.java index 2d250c79e0..e2b0048e8e 100644 --- a/flume-ng-configuration/src/test/java/org/apache/flume/conf/TestFlumeConfiguration.java +++ b/flume-ng-configuration/src/test/java/org/apache/flume/conf/TestFlumeConfiguration.java @@ -17,7 +17,12 @@ package org.apache.flume.conf; import static org.apache.flume.conf.FlumeConfigurationError.ErrorOrWarning.ERROR; -import static org.apache.flume.conf.FlumeConfigurationErrorType.*; +import static org.apache.flume.conf.FlumeConfigurationErrorType.AGENT_CONFIGURATION_INVALID; +import static org.apache.flume.conf.FlumeConfigurationErrorType.AGENT_NAME_MISSING; +import static org.apache.flume.conf.FlumeConfigurationErrorType.CONFIG_ERROR; +import static org.apache.flume.conf.FlumeConfigurationErrorType.INVALID_PROPERTY; +import static org.apache.flume.conf.FlumeConfigurationErrorType.PROPERTY_NAME_NULL; +import static org.apache.flume.conf.FlumeConfigurationErrorType.PROPERTY_VALUE_NULL; import static org.junit.Assert.assertEquals; import java.util.HashMap; diff --git a/flume-ng-core/pom.xml b/flume-ng-core/pom.xml index cb8129baab..61c505c9d9 100644 --- a/flume-ng-core/pom.xml +++ b/flume-ng-core/pom.xml @@ -190,7 +190,6 @@ org.apache.maven.plugins maven-antrun-plugin - ${mvn-antrun-plugin.version} generate-version @@ -213,7 +212,6 @@ org.codehaus.mojo build-helper-maven-plugin - ${mvn-build-helper-plugin} add-source @@ -246,7 +244,6 @@ org.apache.maven.plugins maven-antrun-plugin - ${mvn-antrun-plugin.version} generate-version @@ -269,7 +266,6 @@ org.codehaus.mojo build-helper-maven-plugin - ${mvn-build-helper-plugin} add-source diff --git a/flume-ng-core/src/main/java/org/apache/flume/channel/MemoryChannel.java b/flume-ng-core/src/main/java/org/apache/flume/channel/MemoryChannel.java index ac3c8cbe99..b0c6c3c6ef 100644 --- a/flume-ng-core/src/main/java/org/apache/flume/channel/MemoryChannel.java +++ b/flume-ng-core/src/main/java/org/apache/flume/channel/MemoryChannel.java @@ -110,6 +110,9 @@ protected Event doTake() throws InterruptedException { return event; } + // `queueLock` must not be held on blocking operations, + // and an approximate channel size is sufficient for the counter. + @SuppressWarnings("GuardedBy") @Override protected void doCommit() throws InterruptedException { int remainingChange = takeList.size() - putList.size(); @@ -158,6 +161,9 @@ protected void doCommit() throws InterruptedException { channelCounter.setChannelSize(queue.size()); } + // `queueLock` must not be held on blocking operations + // and an approximate channel size is sufficient for the counter. + @SuppressWarnings("GuardedBy") @Override protected void doRollback() { int takes = takeList.size(); @@ -218,6 +224,8 @@ public MemoryChannel() { *
  • byteCapacityBufferPercentage = type int that defines the percent of buffer between byteCapacity and the estimated event size. *
  • keep-alive = type int that defines the number of second to wait for a queue permit */ + // the unguarded null check on `queue` only detects whether the channel was already configured + @SuppressWarnings("GuardedBy") @Override public void configure(Context context) { Integer capacity = null; @@ -347,6 +355,8 @@ private void resizeQueue(int capacity) throws InterruptedException { } } + // an approximate channel size is sufficient for the counter + @SuppressWarnings("GuardedBy") @Override public synchronized void start() { channelCounter.start(); @@ -355,6 +365,8 @@ public synchronized void start() { super.start(); } + // an approximate channel size is sufficient for the counter + @SuppressWarnings("GuardedBy") @Override public synchronized void stop() { channelCounter.setChannelSize(queue.size()); diff --git a/flume-ng-core/src/main/java/org/apache/flume/event/EventHelper.java b/flume-ng-core/src/main/java/org/apache/flume/event/EventHelper.java index 58a010b151..733377f206 100644 --- a/flume-ng-core/src/main/java/org/apache/flume/event/EventHelper.java +++ b/flume-ng-core/src/main/java/org/apache/flume/event/EventHelper.java @@ -61,7 +61,7 @@ public static String dumpEvent(Event event, int maxBytes) { } String result = buffer.toString(); if (result.endsWith(EOL) && buffer.length() > EOL.length()) { - buffer.delete(buffer.length() - EOL.length(), buffer.length()).toString(); + buffer.delete(buffer.length() - EOL.length(), buffer.length()); } } return "{ headers:" + event.getHeaders() + " body:" + buffer + " }"; diff --git a/flume-ng-core/src/main/java/org/apache/flume/interceptor/HostInterceptor.java b/flume-ng-core/src/main/java/org/apache/flume/interceptor/HostInterceptor.java index 707109e50a..94ea167ff1 100644 --- a/flume-ng-core/src/main/java/org/apache/flume/interceptor/HostInterceptor.java +++ b/flume-ng-core/src/main/java/org/apache/flume/interceptor/HostInterceptor.java @@ -16,7 +16,12 @@ */ package org.apache.flume.interceptor; -import static org.apache.flume.interceptor.HostInterceptor.Constants.*; +import static org.apache.flume.interceptor.HostInterceptor.Constants.HOST; +import static org.apache.flume.interceptor.HostInterceptor.Constants.HOST_HEADER; +import static org.apache.flume.interceptor.HostInterceptor.Constants.PRESERVE; +import static org.apache.flume.interceptor.HostInterceptor.Constants.PRESERVE_DFLT; +import static org.apache.flume.interceptor.HostInterceptor.Constants.USE_IP; +import static org.apache.flume.interceptor.HostInterceptor.Constants.USE_IP_DFLT; import java.net.InetAddress; import java.net.UnknownHostException; diff --git a/flume-ng-core/src/main/java/org/apache/flume/interceptor/TimestampInterceptor.java b/flume-ng-core/src/main/java/org/apache/flume/interceptor/TimestampInterceptor.java index 577e61cc76..6b558850c5 100644 --- a/flume-ng-core/src/main/java/org/apache/flume/interceptor/TimestampInterceptor.java +++ b/flume-ng-core/src/main/java/org/apache/flume/interceptor/TimestampInterceptor.java @@ -16,7 +16,10 @@ */ package org.apache.flume.interceptor; -import static org.apache.flume.interceptor.TimestampInterceptor.Constants.*; +import static org.apache.flume.interceptor.TimestampInterceptor.Constants.CONFIG_HEADER_NAME; +import static org.apache.flume.interceptor.TimestampInterceptor.Constants.CONFIG_PRESERVE; +import static org.apache.flume.interceptor.TimestampInterceptor.Constants.DEFAULT_HEADER_NAME; +import static org.apache.flume.interceptor.TimestampInterceptor.Constants.DEFAULT_PRESERVE; import java.util.List; import java.util.Map; diff --git a/flume-ng-core/src/test/java/org/apache/flume/TestContext.java b/flume-ng-core/src/test/java/org/apache/flume/TestContext.java index b0935180e0..9f8ffdafce 100644 --- a/flume-ng-core/src/test/java/org/apache/flume/TestContext.java +++ b/flume-ng-core/src/test/java/org/apache/flume/TestContext.java @@ -16,7 +16,8 @@ */ package org.apache.flume; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import com.google.common.collect.ImmutableMap; import org.junit.Before; diff --git a/flume-ng-core/src/test/java/org/apache/flume/channel/TestMemoryChannel.java b/flume-ng-core/src/test/java/org/apache/flume/channel/TestMemoryChannel.java index 9987735162..b71619d112 100644 --- a/flume-ng-core/src/test/java/org/apache/flume/channel/TestMemoryChannel.java +++ b/flume-ng-core/src/test/java/org/apache/flume/channel/TestMemoryChannel.java @@ -34,6 +34,7 @@ import org.apache.flume.exception.ChannelException; import org.junit.Assert; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; public class TestMemoryChannel { @@ -298,6 +299,8 @@ public void testByteCapacityAfterRollback() { Assert.assertEquals(8, channel.getBytesRemainingValue()); } + @Test + @Ignore("TODO: document why this test is disabled and re-enable it.") public void testByteCapacityBufferEmptyingAfterTakeCommit() { Context context = new Context(); Map parms = new HashMap(); diff --git a/flume-ng-core/src/test/java/org/apache/flume/channel/TestMemoryChannelConcurrency.java b/flume-ng-core/src/test/java/org/apache/flume/channel/TestMemoryChannelConcurrency.java index 693a62ad77..8ee407a740 100644 --- a/flume-ng-core/src/test/java/org/apache/flume/channel/TestMemoryChannelConcurrency.java +++ b/flume-ng-core/src/test/java/org/apache/flume/channel/TestMemoryChannelConcurrency.java @@ -224,6 +224,7 @@ public void testConcurrentSinksAndSources() throws InterruptedException { final CountDownLatch startGate = new CountDownLatch(1); final CountDownLatch endGate = new CountDownLatch(threadCount); + final Object takeMapLock = new Object(); // start a sink and source for each for (int i = 0; i < threadCount / 2; i++) { Thread t = new Thread() { @@ -268,7 +269,6 @@ public void run() { }; // start source t.start(); - final Integer takeMapLock = 0; t = new Thread() { @Override public void run() { diff --git a/flume-ng-core/src/test/java/org/apache/flume/source/TestAbstractPollableSource.java b/flume-ng-core/src/test/java/org/apache/flume/source/TestAbstractPollableSource.java index 16991a5d66..ddea222d66 100644 --- a/flume-ng-core/src/test/java/org/apache/flume/source/TestAbstractPollableSource.java +++ b/flume-ng-core/src/test/java/org/apache/flume/source/TestAbstractPollableSource.java @@ -16,7 +16,7 @@ */ package org.apache.flume.source; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.spy; import java.util.HashMap; import org.apache.flume.Context; diff --git a/flume-ng-core/src/test/java/org/apache/flume/source/TestBasicSourceSemantics.java b/flume-ng-core/src/test/java/org/apache/flume/source/TestBasicSourceSemantics.java index 9bdeb8a1bd..6458785b28 100644 --- a/flume-ng-core/src/test/java/org/apache/flume/source/TestBasicSourceSemantics.java +++ b/flume-ng-core/src/test/java/org/apache/flume/source/TestBasicSourceSemantics.java @@ -16,7 +16,8 @@ */ package org.apache.flume.source; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; import org.apache.flume.Context; import org.apache.flume.FlumeException; diff --git a/flume-ng-core/src/test/java/org/apache/flume/tools/TestVersionInfo.java b/flume-ng-core/src/test/java/org/apache/flume/tools/TestVersionInfo.java index a71a0801b0..59457f96e8 100644 --- a/flume-ng-core/src/test/java/org/apache/flume/tools/TestVersionInfo.java +++ b/flume-ng-core/src/test/java/org/apache/flume/tools/TestVersionInfo.java @@ -16,7 +16,8 @@ */ package org.apache.flume.tools; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/flume-ng-instrumentation/flume-ganglia-monitor/pom.xml b/flume-ng-instrumentation/flume-ganglia-monitor/pom.xml index 3262d42729..2e531ee8be 100644 --- a/flume-ng-instrumentation/flume-ganglia-monitor/pom.xml +++ b/flume-ng-instrumentation/flume-ganglia-monitor/pom.xml @@ -30,6 +30,8 @@ Flume Ganglia Monitor + + false 13 org.apache.flume.instrumentation.ganglia diff --git a/flume-ng-instrumentation/flume-ganglia-monitor/src/main/resources/META-INF/services/org.apache.flume.instrumentation.MonitorService b/flume-ng-instrumentation/flume-ganglia-monitor/src/main/resources/META-INF/services/org.apache.flume.instrumentation.MonitorService index bacdb80dfb..ca6ac4a368 100644 --- a/flume-ng-instrumentation/flume-ganglia-monitor/src/main/resources/META-INF/services/org.apache.flume.instrumentation.MonitorService +++ b/flume-ng-instrumentation/flume-ganglia-monitor/src/main/resources/META-INF/services/org.apache.flume.instrumentation.MonitorService @@ -1 +1,2 @@ +# SPDX-License-Identifier: Apache-2.0 org.apache.flume.instrumentation.ganglia.GangliaServer diff --git a/flume-ng-instrumentation/flume-http-monitor/pom.xml b/flume-ng-instrumentation/flume-http-monitor/pom.xml index fdb209cb2c..6c266c6863 100644 --- a/flume-ng-instrumentation/flume-http-monitor/pom.xml +++ b/flume-ng-instrumentation/flume-http-monitor/pom.xml @@ -30,6 +30,8 @@ Flume HTTP Monitor + + false 3 org.apache.flume.instrumentation.http diff --git a/flume-ng-instrumentation/flume-http-monitor/src/main/resources/META-INF/services/org.apache.flume.instrumentation.MonitorService b/flume-ng-instrumentation/flume-http-monitor/src/main/resources/META-INF/services/org.apache.flume.instrumentation.MonitorService index 94fc8860ad..d29ea55458 100644 --- a/flume-ng-instrumentation/flume-http-monitor/src/main/resources/META-INF/services/org.apache.flume.instrumentation.MonitorService +++ b/flume-ng-instrumentation/flume-http-monitor/src/main/resources/META-INF/services/org.apache.flume.instrumentation.MonitorService @@ -1 +1,2 @@ +# SPDX-License-Identifier: Apache-2.0 org.apache.flume.instrumentation.http.HTTPMetricsServer diff --git a/flume-ng-instrumentation/flume-prometheus-monitor/pom.xml b/flume-ng-instrumentation/flume-prometheus-monitor/pom.xml index ed7a8014a4..27b90fda76 100644 --- a/flume-ng-instrumentation/flume-prometheus-monitor/pom.xml +++ b/flume-ng-instrumentation/flume-prometheus-monitor/pom.xml @@ -30,6 +30,8 @@ Flume Prometheus Monitor + + false 6 1 diff --git a/flume-ng-instrumentation/flume-prometheus-monitor/src/main/resources/META-INF/services/org.apache.flume.instrumentation.MonitorService b/flume-ng-instrumentation/flume-prometheus-monitor/src/main/resources/META-INF/services/org.apache.flume.instrumentation.MonitorService index 042e10826a..fcfbfba8f1 100644 --- a/flume-ng-instrumentation/flume-prometheus-monitor/src/main/resources/META-INF/services/org.apache.flume.instrumentation.MonitorService +++ b/flume-ng-instrumentation/flume-prometheus-monitor/src/main/resources/META-INF/services/org.apache.flume.instrumentation.MonitorService @@ -1 +1,2 @@ +# SPDX-License-Identifier: Apache-2.0 org.apache.flume.instrumentation.prometheus.PrometheusHTTPMetricsServer diff --git a/flume-ng-node/src/test/java/org/apache/flume/node/TestApplication.java b/flume-ng-node/src/test/java/org/apache/flume/node/TestApplication.java index 583fe97f97..f0bce1f510 100644 --- a/flume-ng-node/src/test/java/org/apache/flume/node/TestApplication.java +++ b/flume-ng-node/src/test/java/org/apache/flume/node/TestApplication.java @@ -16,7 +16,11 @@ */ package org.apache.flume.node; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; import com.google.common.collect.Lists; import com.google.common.eventbus.EventBus; diff --git a/flume-ng-sources/flume-http-source/pom.xml b/flume-ng-sources/flume-http-source/pom.xml index 1329f7a219..43770d964c 100644 --- a/flume-ng-sources/flume-http-source/pom.xml +++ b/flume-ng-sources/flume-http-source/pom.xml @@ -30,6 +30,8 @@ Flume HTTP Source + + false 10 2 diff --git a/flume-ng-sources/flume-http-source/src/test/java/org/apache/flume/source/http/TestHTTPSource.java b/flume-ng-sources/flume-http-source/src/test/java/org/apache/flume/source/http/TestHTTPSource.java index 42b63f6a8d..8aa5ea2e8f 100644 --- a/flume-ng-sources/flume-http-source/src/test/java/org/apache/flume/source/http/TestHTTPSource.java +++ b/flume-ng-sources/flume-http-source/src/test/java/org/apache/flume/source/http/TestHTTPSource.java @@ -385,8 +385,8 @@ public void testConfigurables() throws Exception { .size() == 0); - int newPort = findFreePort(); - Context configuredSourceContext = getDefaultNonSecureContext(newPort); + final int firstPort = findFreePort(); + Context configuredSourceContext = getDefaultNonSecureContext(firstPort); configuredSourceContext.put("HttpConfiguration.sendServerVersion", "false"); configuredSourceContext.put("HttpConfiguration.sendXPoweredBy", "true"); configuredSourceContext.put("ServerConnector.acceptQueueSize", "22"); @@ -398,7 +398,7 @@ public void testConfigurables() throws Exception { newChannel.start(); newSource.start(); - HttpPost newPostRequest = new HttpPost("http://0.0.0.0:" + newPort); + HttpPost newPostRequest = new HttpPost("http://0.0.0.0:" + firstPort); resp = httpClient.execute(newPostRequest); Assert.assertTrue(resp.getHeaders("X-Powered-By").length > 0); @@ -414,8 +414,8 @@ public void testConfigurables() throws Exception { newChannel.stop(); // Configure SslContextFactory with junk protocols (expect failure) - newPort = findFreePort(); - configuredSourceContext = getDefaultSecureContext(newPort); + final int secondPort = findFreePort(); + configuredSourceContext = getDefaultSecureContext(secondPort); configuredSourceContext.put("SslContextFactory.IncludeProtocols", "abc def"); newSource = new HTTPSource(); @@ -426,14 +426,8 @@ public void testConfigurables() throws Exception { newChannel.start(); newSource.start(); - newPostRequest = new HttpPost("http://0.0.0.0:" + newPort); - try { - doTestHttps(null, newPort, httpsChannel); - // We are testing that this fails because we've deliberately configured the wrong protocols - Assert.assertTrue(false); - } catch (AssertionError ex) { - // no-op - } + newPostRequest = new HttpPost("http://0.0.0.0:" + secondPort); + Assert.assertThrows(AssertionError.class, () -> doTestHttps(null, secondPort, httpsChannel)); newSource.stop(); newChannel.stop(); } diff --git a/flume-ng-sources/flume-netcat-source/pom.xml b/flume-ng-sources/flume-netcat-source/pom.xml index 91aca106c4..d329266189 100644 --- a/flume-ng-sources/flume-netcat-source/pom.xml +++ b/flume-ng-sources/flume-netcat-source/pom.xml @@ -30,6 +30,8 @@ Flume Netcat Source + + false 3 org.apache.flume.source.netcat diff --git a/flume-ng-sources/flume-syslog-source/pom.xml b/flume-ng-sources/flume-syslog-source/pom.xml index ec67429aef..f4bf49c18a 100644 --- a/flume-ng-sources/flume-syslog-source/pom.xml +++ b/flume-ng-sources/flume-syslog-source/pom.xml @@ -30,6 +30,8 @@ Flume Syslog Source + + false 8 org.apache.flume.source.syslog diff --git a/flume-ng-sources/flume-syslog-source/src/test/java/org/apache/flume/source/syslog/TestMultiportSyslogTCPSource.java b/flume-ng-sources/flume-syslog-source/src/test/java/org/apache/flume/source/syslog/TestMultiportSyslogTCPSource.java index b29d02edd4..4976e135e6 100644 --- a/flume-ng-sources/flume-syslog-source/src/test/java/org/apache/flume/source/syslog/TestMultiportSyslogTCPSource.java +++ b/flume-ng-sources/flume-syslog-source/src/test/java/org/apache/flume/source/syslog/TestMultiportSyslogTCPSource.java @@ -19,7 +19,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.anyList; +import static org.mockito.Mockito.doThrow; import com.google.common.base.Charsets; import com.google.common.collect.Lists; diff --git a/flume-ng-sources/flume-syslog-source/src/test/java/org/apache/flume/source/syslog/TestSyslogUtils.java b/flume-ng-sources/flume-syslog-source/src/test/java/org/apache/flume/source/syslog/TestSyslogUtils.java index 9834ca3ee5..df2ef51d13 100644 --- a/flume-ng-sources/flume-syslog-source/src/test/java/org/apache/flume/source/syslog/TestSyslogUtils.java +++ b/flume-ng-sources/flume-syslog-source/src/test/java/org/apache/flume/source/syslog/TestSyslogUtils.java @@ -16,7 +16,7 @@ */ package org.apache.flume.source.syslog; -import static io.netty.buffer.Unpooled.*; +import static io.netty.buffer.Unpooled.buffer; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; diff --git a/flume-ng-sources/flume-taildir-source/src/main/java/org/apache/flume/source/taildir/TaildirSource.java b/flume-ng-sources/flume-taildir-source/src/main/java/org/apache/flume/source/taildir/TaildirSource.java index 9ae59e6810..8d9c0ef97a 100644 --- a/flume-ng-sources/flume-taildir-source/src/main/java/org/apache/flume/source/taildir/TaildirSource.java +++ b/flume-ng-sources/flume-taildir-source/src/main/java/org/apache/flume/source/taildir/TaildirSource.java @@ -16,7 +16,29 @@ */ package org.apache.flume.source.taildir; -import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.*; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.BATCH_SIZE; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.BYTE_OFFSET_HEADER; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.CACHE_PATTERN_MATCHING; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.DEFAULT_BATCH_SIZE; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.DEFAULT_BYTE_OFFSET_HEADER; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.DEFAULT_CACHE_PATTERN_MATCHING; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.DEFAULT_FILENAME_HEADER_KEY; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.DEFAULT_FILE_HEADER; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.DEFAULT_IDLE_TIMEOUT; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.DEFAULT_MAX_BATCH_COUNT; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.DEFAULT_POSITION_FILE; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.DEFAULT_SKIP_TO_END; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.DEFAULT_WRITE_POS_INTERVAL; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.FILENAME_HEADER; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.FILENAME_HEADER_KEY; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.FILE_GROUPS; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.FILE_GROUPS_PREFIX; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.HEADERS_PREFIX; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.IDLE_TIMEOUT; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.MAX_BATCH_COUNT; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.POSITION_FILE; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.SKIP_TO_END; +import static org.apache.flume.source.taildir.TaildirSourceConfigurationConstants.WRITE_POS_INTERVAL; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; diff --git a/flume-parent/pom.xml b/flume-parent/pom.xml index 39f7e23dd3..56a3f80b89 100644 --- a/flume-parent/pom.xml +++ b/flume-parent/pom.xml @@ -15,71 +15,67 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + 4.0.0 - org.apache - apache - 23 + org.apache.logging + logging-parent + 12.1.1 + org.apache.flume flume-parent 2.0.0-SNAPSHOT pom - Apache Flume + Apache Flume Parent + Parent POM of all Apache Flume modules. + It imports the Flume BOMs and provides the common test dependencies and build configuration, also for the satellite repositories. + https://logging.apache.org/flume/2.x/index.html 2009 - - Apache Software Foundation - http://www.apache.org - - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - - - + - Flume User List - user-subscribe@flume.apache.org - user-unsubscribe@flume.apache.org - user@flume.apache.org - http://mail-archives.apache.org/mod_mbox/flume-user/ + flume-users + flume-users-subscribe@logging.apache.org + flume-users-unsubscribe@logging.apache.org + flume-users@logging.apache.org + https://lists.apache.org/list.html?flume-users@logging.apache.org - Flume Developer List - dev@logging.apache.org + dev + dev-subscribe@logging.apache.org dev-unsubscribe@logging.apache.org - dev@flume.apache.org - http://mail-archives.apache.org/mod_mbox/flume-dev/ + dev@logging.apache.org + https://lists.apache.org/list.html?dev@logging.apache.org - - scm:git:http://git-wip-us.apache.org/repos/asf/flume.git - scm:git:https://git-wip-us.apache.org/repos/asf/flume.git - https://git-wip-us.apache.org/repos/asf?p=flume.git;a=tree;h=refs/heads/trunk;hb=trunk + + scm:git:https://gitbox.apache.org/repos/asf/logging-flume.git + scm:git:https://gitbox.apache.org/repos/asf/logging-flume.git + rel/${project.version} + https://gitbox.apache.org/repos/asf/logging-flume.git - JIRA - https://issues.apache.org/jira/browse/FLUME + GitHub Issues + https://github.com/apache/logging-flume/issues - jenkins - https://builds.apache.org/job/flume-trunk + GitHub Actions + https://github.com/apache/logging-flume/actions + + 2.0.0-SNAPSHOT true @@ -88,49 +84,28 @@ UTF-8 - - 17 - - - rgoers@apache.org + + + + 17 $ **/Test*.java - ${project.basedir}/target/docs + true - 2.3.7 5.9.0 1.4.1 3.5.0 4.13.2 5.18.0 - 1.8 - - 3.2.0 - 3.0.0 1.7 - 3.1.0 - 3.8.1 - 2.8.2 - 1.6 - 3.2.2 - 3.2.0 3.15.0 - 3.9.0 - 4.9.3 - ${spotbugs.version}.0 - 3.5.5 4.35.0 0.6.1 - 0.12 - 1.53 1.7.1 - true - 3.4.0 1.19.0 - 2.90.0 @@ -282,6 +257,21 @@ 3.10.8 test + + + + com.google.errorprone + error_prone_annotations + 2.48.0 + @@ -289,75 +279,19 @@ - - org.apache.maven.plugins - maven-antrun-plugin - ${mvn-antrun-plugin.version} - - - org.apache.maven.plugins - maven-gpg-plugin - ${mvn-gpg-plugin.version} - - - **/*.sha512 - - ${GPGSigningUserName} - - - - - org.apache.maven.plugins - maven-compiler-plugin - ${mvn-compiler-plugin.version} - - ${releaseJavaVersion} - - - - - org.apache.maven.plugins - maven-jar-plugin - ${mvn-jar-plugin.version} - - - default-jar - - jar - - - - - ${project.name} - ${flume-project.version} - ${project.organization.name} - ${project.name} - ${flume-project.version} - ${project.organization.name} - org.apache - ${maven.compiler.source} - ${maven.compiler.target} - ${module.name} - - - - - - org.xolstice.maven.plugins protobuf-maven-plugin ${protobuf.plugin.version} + org.apache.maven.plugins maven-surefire-plugin - ${mvn-surefire-plugin.version} false 1 - 900 ${redirectTestOutput} -Djava.net.preferIPv4Stack=true @@ -371,121 +305,12 @@ - - org.apache.rat - apache-rat-plugin - ${rat.version} - - - **/.idea/ - **/*.iml - src/main/resources/META-INF/services/**/* - **/nb-configuration.xml - .git/ - patchprocess/ - .gitignore - **/*.yml - **/*.yaml - **/*.json - - .repository/ - **/*.diff - **/*.patch - **/*.avsc - **/*.avro - **/docs/** - **/test/resources/** - **/.settings/* - **/.classpath - **/.project - **/target/** - **/derby.log - **/metastore_db/ - .mvn/** - **/exclude-pmd.properties - - true - - - - verify.rat - - check - - verify - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - ${mvn-javadoc-plugin.version} - - ${project.build.directory}/site/apidocs - - true - - - - org.apache.flume:* - - -Xdoclint:none - - - - - org.apache.maven.plugins - maven-assembly-plugin - ${mvn-assembly-plugin.version} - - - - maven-clean-plugin - ${mvn-clean-plugin.version} - - - - docs - - ** - - - - - - - - com.github.spotbugs - spotbugs-maven-plugin - ${mvn-spotbugs-plugin.version} - - Max - Low - - - - verify.spotbugs - - check - - verify - - - - - - com.diffplug.spotless - spotless-maven-plugin - ${spotless-maven-plugin.version} - - org.apache.maven.plugins maven-pmd-plugin ${mvn-pmd-plugin.version} - ${releaseJavaVersion} + ${maven.compiler.release} ${project.build.directory}/generated-sources @@ -508,193 +333,21 @@ - - - org.apache.rat - apache-rat-plugin - - - com.github.spotbugs - spotbugs-maven-plugin - + - + com.diffplug.spotless spotless-maven-plugin - + **/source/shaded/guava/** - - - /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - - ${palantir-java-format.version} - - - - - <?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to you under the Apache License, Version 2.0 - ~ (the "License"); you may not use this file except in compliance with - ~ the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - <project - - - false - - true - - - - - - src/**/*.xml - - - - src/changelog/**/*.xml - - - - <?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to you under the Apache License, Version 2.0 - ~ (the "License"); you may not use this file except in compliance with - ~ the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - <(!DOCTYPE|\w) - - - - - - - src/**/*.properties - - - - # -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to you under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - (##|[^#]) - - - - - - - .asf.yaml - .github/**/*.yaml - .github/**/*.yml - src/**/*.yaml - src/**/*.yml - - - - # -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to you under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - (##|[^#]) - - - - - UNIX - - - - com.palantir.javaformat - palantir-java-format - ${palantir-java-format.version} - - - - - default-spotless - - check - - verify - - @@ -747,6 +400,7 @@ + kr.motd.maven @@ -757,103 +411,28 @@ - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - - - - ci-management - distribution-management - team - mailing-lists - issue-management - licenses - scm - - - - - - com.github.spotbugs - spotbugs-maven-plugin - - - org.apache.maven.plugins - maven-pmd-plugin - - - - - + - not-windows - - - !Windows - - - - - - windows + rat-excludes-file - - Windows - + + ${maven.multiModuleProjectDirectory}/.rat-excludes + - - - - sign - - - - org.apache.maven.plugins - maven-gpg-plugin - - - - sign - - verify - - ${GPGSigningUserName} - - - - - - - - - - site - - maven-javadoc-plugin + org.apache.rat + apache-rat-plugin - -Xdoclint:none + ${maven.multiModuleProjectDirectory}/.rat-excludes - - - javadoc-jar - - aggregate-jar - - package - - - @@ -862,9 +441,8 @@ true true true + true - - diff --git a/flume-third-party/pom.xml b/flume-third-party/pom.xml index 736b4afa9e..c611d0c993 100644 --- a/flume-third-party/pom.xml +++ b/flume-third-party/pom.xml @@ -71,7 +71,7 @@ 1.1.10.8 1.19.0 1.1.3 - 3.8.6 + 3.9.3 1.7.1 diff --git a/pom.xml b/pom.xml index a943877fe2..fb0c5683b5 100644 --- a/pom.xml +++ b/pom.xml @@ -113,4 +113,29 @@ true + + + + + rat-excludes-file + + + ${maven.multiModuleProjectDirectory}/.rat-excludes + + + + + + org.apache.rat + apache-rat-plugin + + ${maven.multiModuleProjectDirectory}/.rat-excludes + + + + + + +