You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2018/10/30 02:49:31 UTC
[04/13] logging-log4j2 git commit: Use final. Remove trailing spaces.
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderRemapTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderRemapTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderRemapTest.java
index 3c6d301..c4d647b 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderRemapTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderRemapTest.java
@@ -35,7 +35,7 @@ import static org.junit.Assert.*;
/**
* Tests that logged strings appear in the file, that the initial file size is the specified specified region length,
* that the file is extended by region length when necessary, and that the file is shrunk to its actual usage when done.
- *
+ *
* @since 2.1
*/
public class MemoryMappedFileAppenderRemapTest {
@@ -65,7 +65,7 @@ public class MemoryMappedFileAppenderRemapTest {
log.warn(new String(text));
assertEquals("grown", 256 * 2, f.length());
-
+
log.warn(new String(text));
assertEquals("grown again", 256 * 3, f.length());
} finally {
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderSimpleTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderSimpleTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderSimpleTest.java
index 277e046..ebab4cd 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderSimpleTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderSimpleTest.java
@@ -35,7 +35,7 @@ import static org.junit.Assert.*;
* Tests that logged strings appear in the file,
* that the default file size is used if not specified
* and that the file is shrunk to its actual usage when done.
- *
+ *
* @since 2.1
*/
public class MemoryMappedFileAppenderSimpleTest {
@@ -54,13 +54,13 @@ public class MemoryMappedFileAppenderSimpleTest {
assertTrue(f.delete());
}
assertTrue(!f.exists());
-
+
final Logger log = LogManager.getLogger();
try {
log.warn("Test log1");
assertTrue(f.exists());
assertEquals("initial length", MemoryMappedFileManager.DEFAULT_REGION_LENGTH, f.length());
-
+
log.warn("Test log2");
assertEquals("not grown", MemoryMappedFileManager.DEFAULT_REGION_LENGTH, f.length());
} finally {
@@ -68,7 +68,7 @@ public class MemoryMappedFileAppenderSimpleTest {
}
final int LINESEP = System.lineSeparator().length();
assertEquals("Shrunk to actual used size", 186 + 2 * LINESEP, f.length());
-
+
String line1, line2, line3;
try (final BufferedReader reader = new BufferedReader(new FileReader(LOGFILE))) {
line1 = reader.readLine();
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ScriptAppenderSelectorTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ScriptAppenderSelectorTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ScriptAppenderSelectorTest.java
index a1fe45c..670eafc 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ScriptAppenderSelectorTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ScriptAppenderSelectorTest.java
@@ -43,7 +43,7 @@ public class ScriptAppenderSelectorTest {
@Parameterized.Parameters(name = "{0}")
public static Object[][] getParameters() {
// @formatter:off
- return new Object[][] {
+ return new Object[][] {
{ "log4j-appender-selector-groovy.xml" },
{ "log4j-appender-selector-javascript.xml" },
};
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SmtpAppenderAsyncTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SmtpAppenderAsyncTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SmtpAppenderAsyncTest.java
index 91503d3..ccac7e6 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SmtpAppenderAsyncTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SmtpAppenderAsyncTest.java
@@ -64,7 +64,7 @@ public class SmtpAppenderAsyncTest {
testSmtpAppender(ctx.getLogger("async"));
}
- private void testSmtpAppender(Logger logger) {
+ private void testSmtpAppender(final Logger logger) {
ThreadContext.put("MDC1", "mdc1");
logger.error("the message");
ctx.getLoggerContext().stop();
@@ -78,7 +78,7 @@ public class SmtpAppenderAsyncTest {
assertEquals("from@example.com", email.getHeaderValue("From"));
assertEquals("[mdc1]", email.getHeaderValue("Subject"));
- String body = email.getBody();
+ final String body = email.getBody();
if (!body.contains("Body:[mdc1]")) {
fail(body);
}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SocketAppenderTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SocketAppenderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SocketAppenderTest.java
index 08b7f20..aefc8c4 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SocketAppenderTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SocketAppenderTest.java
@@ -132,7 +132,7 @@ public class SocketAppenderTest {
.withPort(tcpTestServer.getLocalPort())
.withReconnectDelayMillis(-1).setName("test")
.withImmediateFail(false)
- .withBufferSize(bufferSize).setLayout((Layout<? extends Serializable>) JsonLayout.newBuilder().setProperties(true).build())
+ .withBufferSize(bufferSize).setLayout(JsonLayout.newBuilder().setProperties(true).build())
.build();
// @formatter:on
appender.start();
@@ -177,7 +177,7 @@ public class SocketAppenderTest {
final SocketAppender appender = SocketAppender.newBuilder()
.withPort(tcpServer.getLocalPort())
.withReconnectDelayMillis(-1).setName("test")
- .withImmediateFail(false).setLayout((Layout<? extends Serializable>) JsonLayout.newBuilder().setProperties(true).build())
+ .withImmediateFail(false).setLayout(JsonLayout.newBuilder().setProperties(true).build())
.build();
// @formatter:on
assertNotNull(appender);
@@ -197,7 +197,7 @@ public class SocketAppenderTest {
.withProtocol(Protocol.UDP)
.withPort(tcpServer.getLocalPort())
.withReconnectDelayMillis(-1).setName("test")
- .withImmediateFail(false).setLayout((Layout<? extends Serializable>) JsonLayout.newBuilder().setProperties(true).build())
+ .withImmediateFail(false).setLayout(JsonLayout.newBuilder().setProperties(true).build())
.build();
// @formatter:on
appender.start();
@@ -221,7 +221,7 @@ public class SocketAppenderTest {
.withHost("localhost")
.withPort(DYN_PORT)
.withReconnectDelayMillis(100).setName("test")
- .withImmediateFail(false).setLayout((Layout<? extends Serializable>) JsonLayout.newBuilder().setProperties(true).build())
+ .withImmediateFail(false).setLayout(JsonLayout.newBuilder().setProperties(true).build())
.build();
// @formatter:on
appender.start();
@@ -250,7 +250,7 @@ public class SocketAppenderTest {
.withHost("localhost")
.withPort(ERROR_PORT)
.withReconnectDelayMillis(100).setName("test")
- .withImmediateFail(false).setIgnoreExceptions(false).setLayout((Layout<? extends Serializable>) JsonLayout.newBuilder().setProperties(true).build())
+ .withImmediateFail(false).setIgnoreExceptions(false).setLayout(JsonLayout.newBuilder().setProperties(true).build())
.build();
// @formatter:on
appender.start();
@@ -294,7 +294,7 @@ public class SocketAppenderTest {
thread.interrupt();
try {
thread.join(100);
- } catch (InterruptedException ie) {
+ } catch (final InterruptedException ie) {
System.out.println("Unable to stop server");
}
}
@@ -361,7 +361,7 @@ public class SocketAppenderTest {
interrupt();
try {
this.join(100);
- } catch (InterruptedException ie) {
+ } catch (final InterruptedException ie) {
System.out.println("Unable to stop server");
}
}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderCustomLayoutTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderCustomLayoutTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderCustomLayoutTest.java
index 9888eb4..87e24cc 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderCustomLayoutTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderCustomLayoutTest.java
@@ -34,7 +34,7 @@ public class SyslogAppenderCustomLayoutTest extends SyslogAppenderTest {
@Override
protected Builder newSyslogAppenderBuilder(final String protocol, final String format, final boolean newLine) {
final Builder builder = super.newSyslogAppenderBuilder(protocol, format, newLine);
- builder.setLayout((Layout<? extends Serializable>) SyslogLayout.newBuilder().setFacility(Facility.LOCAL3).setIncludeNewLine(true).build());
+ builder.setLayout(SyslogLayout.newBuilder().setFacility(Facility.LOCAL3).setIncludeNewLine(true).build());
return builder;
}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/XmlCompleteFileAppenderTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/XmlCompleteFileAppenderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/XmlCompleteFileAppenderTest.java
index c77b464..9f38595 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/XmlCompleteFileAppenderTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/XmlCompleteFileAppenderTest.java
@@ -21,7 +21,6 @@ import java.io.File;
import java.io.FileReader;
import java.nio.charset.Charset;
import java.nio.file.Files;
-import java.nio.file.Paths;
import java.util.List;
import org.apache.logging.log4j.Logger;
@@ -141,7 +140,7 @@ public class XmlCompleteFileAppenderTest {
logger.info(secondLogMsg);
CoreLoggerContexts.stopLoggerContext(false, logFile); // stop async thread
- int[] indentations = {
+ final int[] indentations = {
0, //"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
0, //"<Events xmlns=\"http://logging.apache.org/log4j/2.0/events\">\n"
-1, // empty
@@ -156,15 +155,15 @@ public class XmlCompleteFileAppenderTest {
2, //" </Event>\n" +
0, //"</Events>\n";
};
- List<String> lines1 = Files.readAllLines(logFile.toPath(), Charset.forName("UTF-8"));
+ final List<String> lines1 = Files.readAllLines(logFile.toPath(), Charset.forName("UTF-8"));
assertEquals("number of lines", indentations.length, lines1.size());
for (int i = 0; i < indentations.length; i++) {
- String line = lines1.get(i);
+ final String line = lines1.get(i);
if (line.trim().isEmpty()) {
assertEquals(-1, indentations[i]);
} else {
- String padding = " ".substring(0, indentations[i]);
+ final String padding = " ".substring(0, indentations[i]);
assertTrue("Expected " + indentations[i] + " leading spaces but got: " + line, line.startsWith(padding));
}
}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/XmlFileAppenderTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/XmlFileAppenderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/XmlFileAppenderTest.java
index f9cdff3..d189860 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/XmlFileAppenderTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/XmlFileAppenderTest.java
@@ -16,9 +16,7 @@
*/
package org.apache.logging.log4j.core.appender;
-import java.io.BufferedReader;
import java.io.File;
-import java.io.FileReader;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.util.List;
@@ -56,10 +54,10 @@ public class XmlFileAppenderTest {
log.info(logMsg);
CoreLoggerContexts.stopLoggerContext(false, file); // stop async thread
- List<String> lines = Files.readAllLines(file.toPath(), Charset.forName("UTF8"));
+ final List<String> lines = Files.readAllLines(file.toPath(), Charset.forName("UTF8"));
file.delete();
- String[] expect = {
+ final String[] expect = {
"", // ? unsure why initial empty line...
"<Event ", //
"<Instant epochSecond=", //
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/AbstractDatabaseManagerTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/AbstractDatabaseManagerTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/AbstractDatabaseManagerTest.java
index 932724d..c042032 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/AbstractDatabaseManagerTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/AbstractDatabaseManagerTest.java
@@ -246,7 +246,7 @@ public class AbstractDatabaseManagerTest {
}
@Override
- protected void writeInternal(LogEvent event, Serializable serializable) {
+ protected void writeInternal(final LogEvent event, final Serializable serializable) {
// noop
}
@Override
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/DriverManagerConnectionSourceTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/DriverManagerConnectionSourceTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/DriverManagerConnectionSourceTest.java
index c6b2de1..b7ad8ac 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/DriverManagerConnectionSourceTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/DriverManagerConnectionSourceTest.java
@@ -28,14 +28,14 @@ public class DriverManagerConnectionSourceTest {
@Test
public void testH2Properties() throws SQLException {
- Property[] properties = new Property[] {
+ final Property[] properties = new Property[] {
// @formatter:off
Property.createProperty("username", JdbcH2TestHelper.USER_NAME),
Property.createProperty("password", JdbcH2TestHelper.PASSWORD),
// @formatter:on
};
// @formatter:off
- DriverManagerConnectionSource source = DriverManagerConnectionSource.newBuilder()
+ final DriverManagerConnectionSource source = DriverManagerConnectionSource.newBuilder()
.setConnectionString(JdbcH2TestHelper.CONNECTION_STRING_MEM)
.setProperties(properties)
.build();
@@ -48,7 +48,7 @@ public class DriverManagerConnectionSourceTest {
@Test
public void testH2UserAndPassword() throws SQLException {
// @formatter:off
- DriverManagerConnectionSource source = DriverManagerConnectionSource.newBuilder()
+ final DriverManagerConnectionSource source = DriverManagerConnectionSource.newBuilder()
.setConnectionString(JdbcH2TestHelper.CONNECTION_STRING_MEM)
.setUserName(JdbcH2TestHelper.USER_NAME.toCharArray())
.setPassword(JdbcH2TestHelper.PASSWORD.toCharArray())
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcAppenderMapMessageDataSourceTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcAppenderMapMessageDataSourceTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcAppenderMapMessageDataSourceTest.java
index a45139b..027919d 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcAppenderMapMessageDataSourceTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcAppenderMapMessageDataSourceTest.java
@@ -97,7 +97,7 @@ public class JdbcAppenderMapMessageDataSourceTest {
writer.close();
final Logger logger = LogManager.getLogger(this.getClass().getName() + ".testDataSourceConfig");
- MapMessage mapMessage = new MapMessage();
+ final MapMessage mapMessage = new MapMessage();
mapMessage.with("Id", 1);
mapMessage.with("ColumnA", "ValueA");
mapMessage.with("ColumnB", "ValueB");
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcAppenderStringSubstitutionTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcAppenderStringSubstitutionTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcAppenderStringSubstitutionTest.java
index f77ef56..dca7dcf 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcAppenderStringSubstitutionTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcAppenderStringSubstitutionTest.java
@@ -36,17 +36,17 @@ public class JdbcAppenderStringSubstitutionTest {
public static void afterClass() {
System.getProperties().remove(KEY);
}
-
+
@Rule
public final LoggerContextRule rule = new LoggerContextRule("org/apache/logging/log4j/core/appender/db/jdbc/log4j2-jdbc-string-substitution.xml");
@Test
public void test() throws Exception {
- JdbcAppender appender = rule.getAppender("databaseAppender", JdbcAppender.class);
+ final JdbcAppender appender = rule.getAppender("databaseAppender", JdbcAppender.class);
Assert.assertNotNull(appender);
- JdbcDatabaseManager manager = appender.getManager();
+ final JdbcDatabaseManager manager = appender.getManager();
Assert.assertNotNull(manager);
- String sqlStatement = manager.getSqlStatement();
+ final String sqlStatement = manager.getSqlStatement();
Assert.assertFalse(sqlStatement, sqlStatement.contains(KEY));
Assert.assertTrue(sqlStatement, sqlStatement.contains(VALUE));
}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/jeromq/JeroMqAppenderTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/jeromq/JeroMqAppenderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/jeromq/JeroMqAppenderTest.java
index 24b8d25..b639b4d 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/jeromq/JeroMqAppenderTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/jeromq/JeroMqAppenderTest.java
@@ -41,7 +41,7 @@ public class JeroMqAppenderTest {
private static final String APPENDER_NAME = "JeroMQAppender";
private static final int DEFAULT_TIMEOUT_MILLIS = 60000;
-
+
@ClassRule
public static LoggerContextRule ctx = new LoggerContextRule("JeroMqAppenderTest.xml");
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/jeromq/JeroMqTestClient.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/jeromq/JeroMqTestClient.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/jeromq/JeroMqTestClient.java
index ddd06ab..f35e82a 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/jeromq/JeroMqTestClient.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/jeromq/JeroMqTestClient.java
@@ -1,55 +1,55 @@
-/*
- * 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.
- */
-
-package org.apache.logging.log4j.core.appender.mom.jeromq;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.Callable;
-
-import org.zeromq.ZMQ;
-
-class JeroMqTestClient implements Callable<List<String>> {
-
- private final ZMQ.Context context;
-
- private final String endpoint;
- private final List<String> messages;
- private final int receiveCount;
-
- JeroMqTestClient(final ZMQ.Context context, final String endpoint, final int receiveCount) {
- super();
- this.context = context;
- this.endpoint = endpoint;
- this.receiveCount = receiveCount;
- this.messages = new ArrayList<>(receiveCount);
- }
-
- @Override
- public List<String> call() throws Exception {
- try (ZMQ.Socket subscriber = context.socket(ZMQ.SUB)) {
- subscriber.connect(endpoint);
- subscriber.subscribe(new byte[0]);
- for (int messageNum = 0; messageNum < receiveCount
- && !Thread.currentThread().isInterrupted(); messageNum++) {
- // Use trim to remove the tailing '0' character
- messages.add(subscriber.recvStr(0).trim());
- }
- }
- return messages;
- }
+/*
+ * 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.
+ */
+
+package org.apache.logging.log4j.core.appender.mom.jeromq;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Callable;
+
+import org.zeromq.ZMQ;
+
+class JeroMqTestClient implements Callable<List<String>> {
+
+ private final ZMQ.Context context;
+
+ private final String endpoint;
+ private final List<String> messages;
+ private final int receiveCount;
+
+ JeroMqTestClient(final ZMQ.Context context, final String endpoint, final int receiveCount) {
+ super();
+ this.context = context;
+ this.endpoint = endpoint;
+ this.receiveCount = receiveCount;
+ this.messages = new ArrayList<>(receiveCount);
+ }
+
+ @Override
+ public List<String> call() throws Exception {
+ try (ZMQ.Socket subscriber = context.socket(ZMQ.SUB)) {
+ subscriber.connect(endpoint);
+ subscriber.subscribe(new byte[0]);
+ for (int messageNum = 0; messageNum < receiveCount
+ && !Thread.currentThread().isInterrupted(); messageNum++) {
+ // Use trim to remove the tailing '0' character
+ messages.add(subscriber.recvStr(0).trim());
+ }
+ }
+ return messages;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaAppenderCloseTimeoutTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaAppenderCloseTimeoutTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaAppenderCloseTimeoutTest.java
index a8d3566..aaa5441 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaAppenderCloseTimeoutTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaAppenderCloseTimeoutTest.java
@@ -39,15 +39,15 @@ public class KafkaAppenderCloseTimeoutTest {
public void close() {
try {
Thread.sleep(3000);
- } catch (InterruptedException ignore) {
+ } catch (final InterruptedException ignore) {
}
}
@Override
- public void close(long timeout, TimeUnit timeUnit) {
+ public void close(final long timeout, final TimeUnit timeUnit) {
try {
Thread.sleep(timeUnit.toMillis(timeout));
- } catch (InterruptedException ignore) {
+ } catch (final InterruptedException ignore) {
}
}
};
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaAppenderTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaAppenderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaAppenderTest.java
index 613bd74..80a93a9 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaAppenderTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaAppenderTest.java
@@ -137,8 +137,8 @@ public class KafkaAppenderTest {
final ProducerRecord<byte[], byte[]> item = history.get(0);
assertNotNull(item);
assertEquals(TOPIC_NAME, item.topic());
- String msgKey = item.key().toString();
- byte[] keyValue = "key".getBytes(StandardCharsets.UTF_8);
+ final String msgKey = item.key().toString();
+ final byte[] keyValue = "key".getBytes(StandardCharsets.UTF_8);
assertArrayEquals(item.key(), keyValue);
assertEquals(LOG_MESSAGE, new String(item.value(), StandardCharsets.UTF_8));
}
@@ -147,15 +147,15 @@ public class KafkaAppenderTest {
public void testAppendWithKeyLookup() throws Exception {
final Appender appender = ctx.getRequiredAppender("KafkaAppenderWithKeyLookup");
final LogEvent logEvent = createLogEvent();
- Date date = new Date();
- SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");
+ final Date date = new Date();
+ final SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");
appender.append(logEvent);
final List<ProducerRecord<byte[], byte[]>> history = kafka.history();
assertEquals(1, history.size());
final ProducerRecord<byte[], byte[]> item = history.get(0);
assertNotNull(item);
assertEquals(TOPIC_NAME, item.topic());
- byte[] keyValue = format.format(date).getBytes(StandardCharsets.UTF_8);
+ final byte[] keyValue = format.format(date).getBytes(StandardCharsets.UTF_8);
assertArrayEquals(item.key(), keyValue);
assertEquals(LOG_MESSAGE, new String(item.value(), StandardCharsets.UTF_8));
}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/LoggerNameLevelRewritePolicyTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/LoggerNameLevelRewritePolicyTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/LoggerNameLevelRewritePolicyTest.java
index a30a0e6..101f8fa 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/LoggerNameLevelRewritePolicyTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/LoggerNameLevelRewritePolicyTest.java
@@ -26,7 +26,7 @@ import org.junit.Test;
/**
* Tests {@link LoggerNameLevelRewritePolicy}.
- *
+ *
* @since 2.4
*/
public class LoggerNameLevelRewritePolicyTest {
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
index 3247f82..e360f83 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
@@ -52,7 +52,7 @@ public class MapRewritePolicyTest {
public static void setupClass() {
stringMap.putValue("test1", "one");
stringMap.putValue("test2", "two");
- map = stringMap.toMap();
+ map = stringMap.toMap();
logEvent0 = Log4jLogEvent.newBuilder() //
.setLoggerName("test") //
.setContextData(stringMap) //
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/CronTriggeringPolicyTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/CronTriggeringPolicyTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/CronTriggeringPolicyTest.java
index 8bf89e0..9fce567 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/CronTriggeringPolicyTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/CronTriggeringPolicyTest.java
@@ -29,7 +29,7 @@ import org.junit.Test;
public class CronTriggeringPolicyTest {
private static final String CRON_EXPRESSION = "0 0 0 * * ?";
-
+
private NullConfiguration configuration;
// TODO Need a CleanRegexFiles("testcmd.\\.log\\..*");
@@ -96,7 +96,7 @@ public class CronTriggeringPolicyTest {
// @formatter:on
}
-
+
/**
* Tests LOG4J2-1474 CronTriggeringPolicy raise exception and fail to rollover log file when evaluateOnStartup is
* true.
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FileSizeTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FileSizeTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FileSizeTest.java
index 8121ce7..9b9bf45 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FileSizeTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FileSizeTest.java
@@ -25,7 +25,7 @@ import static org.junit.Assert.*;
public class FileSizeTest {
private final static long EXPECTED = 10 * 1024;
-
+
@Test
public void testFileSize() throws Exception {
long value = FileSize.parse("10KB", 0);
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderDeleteNestedTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderDeleteNestedTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderDeleteNestedTest.java
index 7d335f0..c1f08a6 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderDeleteNestedTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderDeleteNestedTest.java
@@ -77,7 +77,7 @@ public class RollingAppenderDeleteNestedTest {
System.out.println(file + " (" + file.length() + "B) "
+ FixedDateFormat.create(FixedFormat.ABSOLUTE).format(file.lastModified()));
}
-
+
final List<String> expected = Arrays.asList("my-1.log", "my-2.log", "my-3.log", "my-4.log", "my-5.log");
assertEquals(Arrays.toString(files), expected.size() + 3, files.length);
for (final File file : files) {
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderDirectWriteWithReconfigureTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderDirectWriteWithReconfigureTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderDirectWriteWithReconfigureTest.java
index 0d8edaf..d1398d3 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderDirectWriteWithReconfigureTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderDirectWriteWithReconfigureTest.java
@@ -57,7 +57,7 @@ public class RollingAppenderDirectWriteWithReconfigureTest {
@SuppressWarnings("resource") // managed by the rule.
final LoggerContext context = loggerContextRule.getLoggerContext();
- Configuration config = context.getConfiguration();
+ final Configuration config = context.getConfiguration();
context.setConfigLocation(new URI(CONFIG));
context.reconfigure();
logger.debug("Force a rollover");
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderUncompressedTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderUncompressedTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderUncompressedTest.java
index 730e1b2..5a45f01 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderUncompressedTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderUncompressedTest.java
@@ -41,7 +41,7 @@ public class RollingAppenderUncompressedTest {
private static final String DIR = "target/rolling4";
private final Logger logger = LogManager.getLogger(RollingAppenderUncompressedTest.class.getName());
-
+
@ClassRule
public static CleanFolders rule = new CleanFolders(CONFIG);
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderReconfigureTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderReconfigureTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderReconfigureTest.java
index 8c4657a..d1112b0 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderReconfigureTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderReconfigureTest.java
@@ -27,8 +27,8 @@ import org.junit.Test;
public class RollingFileAppenderReconfigureTest {
@Rule
- public final LoggerContextRule loggerContextRule = new LoggerContextRule("src/test/rolling-file-appender-reconfigure.xml");
-
+ public final LoggerContextRule loggerContextRule = new LoggerContextRule("src/test/rolling-file-appender-reconfigure.xml");
+
@Test
public void testReconfigure() {
loggerContextRule.reconfigure();
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderReconfigureUndefinedSystemPropertyTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderReconfigureUndefinedSystemPropertyTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderReconfigureUndefinedSystemPropertyTest.java
index 31a21b1..88b42d7 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderReconfigureUndefinedSystemPropertyTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderReconfigureUndefinedSystemPropertyTest.java
@@ -27,8 +27,8 @@ import org.junit.Test;
public class RollingFileAppenderReconfigureUndefinedSystemPropertyTest {
@Rule
- public final LoggerContextRule loggerContextRule = new LoggerContextRule("src/test/rolling-file-appender-reconfigure.original.xml");
-
+ public final LoggerContextRule loggerContextRule = new LoggerContextRule("src/test/rolling-file-appender-reconfigure.original.xml");
+
@Test
public void testReconfigure() {
loggerContextRule.reconfigure();
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/DummyFileAttributes.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/DummyFileAttributes.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/DummyFileAttributes.java
index 81e316f..c2bbb1b 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/DummyFileAttributes.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/DummyFileAttributes.java
@@ -1,86 +1,86 @@
-/*
- * 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.
- */
-
-package org.apache.logging.log4j.core.appender.rolling.action;
-
-import java.nio.file.attribute.BasicFileAttributes;
-import java.nio.file.attribute.FileTime;
-
-/**
- * Test helper class: file attributes.
- */
-public class DummyFileAttributes implements BasicFileAttributes {
-
- public FileTime lastModified;
- public FileTime lastAccessTime;
- public FileTime creationTime;
- public boolean isRegularFile;
- public boolean isDirectory;
- public boolean isSymbolicLink;
- public boolean isOther;
- public long size;
- public Object fileKey;
-
- public DummyFileAttributes() {
- }
-
- @Override
- public FileTime lastModifiedTime() {
- return lastModified;
- }
-
- @Override
- public FileTime lastAccessTime() {
- return lastAccessTime;
- }
-
- @Override
- public FileTime creationTime() {
- return creationTime;
- }
-
- @Override
- public boolean isRegularFile() {
- return isRegularFile;
- }
-
- @Override
- public boolean isDirectory() {
- return isDirectory;
- }
-
- @Override
- public boolean isSymbolicLink() {
- return isSymbolicLink;
- }
-
- @Override
- public boolean isOther() {
- return isOther;
- }
-
- @Override
- public long size() {
- return size;
- }
-
- @Override
- public Object fileKey() {
- return fileKey;
- }
-
-}
+/*
+ * 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.
+ */
+
+package org.apache.logging.log4j.core.appender.rolling.action;
+
+import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.attribute.FileTime;
+
+/**
+ * Test helper class: file attributes.
+ */
+public class DummyFileAttributes implements BasicFileAttributes {
+
+ public FileTime lastModified;
+ public FileTime lastAccessTime;
+ public FileTime creationTime;
+ public boolean isRegularFile;
+ public boolean isDirectory;
+ public boolean isSymbolicLink;
+ public boolean isOther;
+ public long size;
+ public Object fileKey;
+
+ public DummyFileAttributes() {
+ }
+
+ @Override
+ public FileTime lastModifiedTime() {
+ return lastModified;
+ }
+
+ @Override
+ public FileTime lastAccessTime() {
+ return lastAccessTime;
+ }
+
+ @Override
+ public FileTime creationTime() {
+ return creationTime;
+ }
+
+ @Override
+ public boolean isRegularFile() {
+ return isRegularFile;
+ }
+
+ @Override
+ public boolean isDirectory() {
+ return isDirectory;
+ }
+
+ @Override
+ public boolean isSymbolicLink() {
+ return isSymbolicLink;
+ }
+
+ @Override
+ public boolean isOther() {
+ return isOther;
+ }
+
+ @Override
+ public long size() {
+ return size;
+ }
+
+ @Override
+ public Object fileKey() {
+ return fileKey;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfAllTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfAllTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfAllTest.java
index 12d5a05..aa4884a 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfAllTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfAllTest.java
@@ -1,54 +1,54 @@
-/*
- * 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.
- */
-
-package org.apache.logging.log4j.core.appender.rolling.action;
-
-import org.apache.logging.log4j.core.appender.rolling.action.IfAll;
-import org.apache.logging.log4j.core.appender.rolling.action.PathCondition;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the And composite condition.
- */
-public class IfAllTest {
-
- @Test
- public void testAccept() {
- final PathCondition TRUE = new FixedCondition(true);
- final PathCondition FALSE = new FixedCondition(false);
- assertTrue(IfAll.createAndCondition(TRUE, TRUE).accept(null, null, null));
- assertFalse(IfAll.createAndCondition(FALSE, TRUE).accept(null, null, null));
- assertFalse(IfAll.createAndCondition(TRUE, FALSE).accept(null, null, null));
- assertFalse(IfAll.createAndCondition(FALSE, FALSE).accept(null, null, null));
- }
-
- @Test
- public void testEmptyIsFalse() {
- assertFalse(IfAll.createAndCondition().accept(null, null, null));
- }
-
- @Test
- public void testBeforeTreeWalk() {
- final CountingCondition counter = new CountingCondition(true);
- final IfAll and = IfAll.createAndCondition(counter, counter, counter);
- and.beforeFileTreeWalk();
- assertEquals(3, counter.getBeforeFileTreeWalkCount());
- }
-
-}
+/*
+ * 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.
+ */
+
+package org.apache.logging.log4j.core.appender.rolling.action;
+
+import org.apache.logging.log4j.core.appender.rolling.action.IfAll;
+import org.apache.logging.log4j.core.appender.rolling.action.PathCondition;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests the And composite condition.
+ */
+public class IfAllTest {
+
+ @Test
+ public void testAccept() {
+ final PathCondition TRUE = new FixedCondition(true);
+ final PathCondition FALSE = new FixedCondition(false);
+ assertTrue(IfAll.createAndCondition(TRUE, TRUE).accept(null, null, null));
+ assertFalse(IfAll.createAndCondition(FALSE, TRUE).accept(null, null, null));
+ assertFalse(IfAll.createAndCondition(TRUE, FALSE).accept(null, null, null));
+ assertFalse(IfAll.createAndCondition(FALSE, FALSE).accept(null, null, null));
+ }
+
+ @Test
+ public void testEmptyIsFalse() {
+ assertFalse(IfAll.createAndCondition().accept(null, null, null));
+ }
+
+ @Test
+ public void testBeforeTreeWalk() {
+ final CountingCondition counter = new CountingCondition(true);
+ final IfAll and = IfAll.createAndCondition(counter, counter, counter);
+ and.beforeFileTreeWalk();
+ assertEquals(3, counter.getBeforeFileTreeWalkCount());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfAnyTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfAnyTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfAnyTest.java
index 52a8b27..ba63a27 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfAnyTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfAnyTest.java
@@ -1,52 +1,52 @@
-/*
- * 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.
- */
-
-package org.apache.logging.log4j.core.appender.rolling.action;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the Or composite condition.
- */
-public class IfAnyTest {
-
- @Test
- public void test() {
- final PathCondition TRUE = new FixedCondition(true);
- final PathCondition FALSE = new FixedCondition(false);
- assertTrue(IfAny.createOrCondition(TRUE, TRUE).accept(null, null, null));
- assertTrue(IfAny.createOrCondition(FALSE, TRUE).accept(null, null, null));
- assertTrue(IfAny.createOrCondition(TRUE, FALSE).accept(null, null, null));
- assertFalse(IfAny.createOrCondition(FALSE, FALSE).accept(null, null, null));
- }
-
- @Test
- public void testEmptyIsFalse() {
- assertFalse(IfAny.createOrCondition().accept(null, null, null));
- }
-
- @Test
- public void testBeforeTreeWalk() {
- final CountingCondition counter = new CountingCondition(true);
- final IfAny or = IfAny.createOrCondition(counter, counter, counter);
- or.beforeFileTreeWalk();
- assertEquals(3, counter.getBeforeFileTreeWalkCount());
- }
-
-}
+/*
+ * 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.
+ */
+
+package org.apache.logging.log4j.core.appender.rolling.action;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests the Or composite condition.
+ */
+public class IfAnyTest {
+
+ @Test
+ public void test() {
+ final PathCondition TRUE = new FixedCondition(true);
+ final PathCondition FALSE = new FixedCondition(false);
+ assertTrue(IfAny.createOrCondition(TRUE, TRUE).accept(null, null, null));
+ assertTrue(IfAny.createOrCondition(FALSE, TRUE).accept(null, null, null));
+ assertTrue(IfAny.createOrCondition(TRUE, FALSE).accept(null, null, null));
+ assertFalse(IfAny.createOrCondition(FALSE, FALSE).accept(null, null, null));
+ }
+
+ @Test
+ public void testEmptyIsFalse() {
+ assertFalse(IfAny.createOrCondition().accept(null, null, null));
+ }
+
+ @Test
+ public void testBeforeTreeWalk() {
+ final CountingCondition counter = new CountingCondition(true);
+ final IfAny or = IfAny.createOrCondition(counter, counter, counter);
+ or.beforeFileTreeWalk();
+ assertEquals(3, counter.getBeforeFileTreeWalkCount());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfFileNameTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfFileNameTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfFileNameTest.java
index 2e84aa9..978031e 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfFileNameTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfFileNameTest.java
@@ -1,131 +1,131 @@
-/*
- * 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.
- */
-
-package org.apache.logging.log4j.core.appender.rolling.action;
-
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-public class IfFileNameTest {
-
- @Test(expected = IllegalArgumentException.class)
- public void testCreateNameConditionFailsIfBothRegexAndPathAreNull() {
- IfFileName.createNameCondition(null, null);
- }
-
- @Test()
- public void testCreateNameConditionAcceptsIfEitherRegexOrPathOrBothAreNonNull() {
- IfFileName.createNameCondition("bar", null);
- IfFileName.createNameCondition(null, "foo");
- IfFileName.createNameCondition("bar", "foo");
- }
-
- @Test
- public void testGetSyntaxAndPattern() {
- assertEquals("glob:path", IfFileName.createNameCondition("path", null).getSyntaxAndPattern());
- assertEquals("glob:path", IfFileName.createNameCondition("glob:path", null).getSyntaxAndPattern());
- assertEquals("regex:bar", IfFileName.createNameCondition(null, "bar").getSyntaxAndPattern());
- assertEquals("regex:bar", IfFileName.createNameCondition(null, "regex:bar").getSyntaxAndPattern());
- }
-
- @Test
- public void testAcceptUsesPathPatternIfExists() {
- final IfFileName filter = IfFileName.createNameCondition("path", "regex");
- final Path relativePath = Paths.get("path");
- assertTrue(filter.accept(null, relativePath, null));
-
- final Path pathMatchingRegex = Paths.get("regex");
- assertFalse(filter.accept(null, pathMatchingRegex, null));
- }
-
- @Test
- public void testAcceptUsesRegexIfNoPathPatternExists() {
- final IfFileName regexFilter = IfFileName.createNameCondition(null, "regex");
- final Path pathMatchingRegex = Paths.get("regex");
- assertTrue(regexFilter.accept(null, pathMatchingRegex, null));
-
- final Path noMatch = Paths.get("nomatch");
- assertFalse(regexFilter.accept(null, noMatch, null));
- }
-
- @Test
- public void testAcceptIgnoresBasePathAndAttributes() {
- final IfFileName pathFilter = IfFileName.createNameCondition("path", null);
- final Path relativePath = Paths.get("path");
- assertTrue(pathFilter.accept(null, relativePath, null));
-
- final IfFileName regexFilter = IfFileName.createNameCondition(null, "regex");
- final Path pathMatchingRegex = Paths.get("regex");
- assertTrue(regexFilter.accept(null, pathMatchingRegex, null));
- }
-
- @Test
- public void testAcceptCallsNestedConditionsOnlyIfPathAccepted1() {
- final CountingCondition counter = new CountingCondition(true);
- final IfFileName regexFilter = IfFileName.createNameCondition(null, "regex", counter);
- final Path pathMatchingRegex = Paths.get("regex");
-
- assertTrue(regexFilter.accept(null, pathMatchingRegex, null));
- assertEquals(1, counter.getAcceptCount());
- assertTrue(regexFilter.accept(null, pathMatchingRegex, null));
- assertEquals(2, counter.getAcceptCount());
- assertTrue(regexFilter.accept(null, pathMatchingRegex, null));
- assertEquals(3, counter.getAcceptCount());
-
- final Path noMatch = Paths.get("nomatch");
- assertFalse(regexFilter.accept(null, noMatch, null));
- assertEquals(3, counter.getAcceptCount()); // no increase
- assertFalse(regexFilter.accept(null, noMatch, null));
- assertEquals(3, counter.getAcceptCount());
- assertFalse(regexFilter.accept(null, noMatch, null));
- assertEquals(3, counter.getAcceptCount());
- }
-
- @Test
- public void testAcceptCallsNestedConditionsOnlyIfPathAccepted2() {
- final CountingCondition counter = new CountingCondition(true);
- final IfFileName globFilter = IfFileName.createNameCondition("glob", null, counter);
- final Path pathMatchingGlob = Paths.get("glob");
-
- assertTrue(globFilter.accept(null, pathMatchingGlob, null));
- assertEquals(1, counter.getAcceptCount());
- assertTrue(globFilter.accept(null, pathMatchingGlob, null));
- assertEquals(2, counter.getAcceptCount());
- assertTrue(globFilter.accept(null, pathMatchingGlob, null));
- assertEquals(3, counter.getAcceptCount());
-
- final Path noMatch = Paths.get("nomatch");
- assertFalse(globFilter.accept(null, noMatch, null));
- assertEquals(3, counter.getAcceptCount()); // no increase
- assertFalse(globFilter.accept(null, noMatch, null));
- assertEquals(3, counter.getAcceptCount());
- assertFalse(globFilter.accept(null, noMatch, null));
- assertEquals(3, counter.getAcceptCount());
- }
-
- @Test
- public void testBeforeTreeWalk() {
- final CountingCondition counter = new CountingCondition(true);
- final IfFileName pathFilter = IfFileName.createNameCondition("path", null, counter, counter, counter);
- pathFilter.beforeFileTreeWalk();
- assertEquals(3, counter.getBeforeFileTreeWalkCount());
- }
-}
+/*
+ * 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.
+ */
+
+package org.apache.logging.log4j.core.appender.rolling.action;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class IfFileNameTest {
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testCreateNameConditionFailsIfBothRegexAndPathAreNull() {
+ IfFileName.createNameCondition(null, null);
+ }
+
+ @Test()
+ public void testCreateNameConditionAcceptsIfEitherRegexOrPathOrBothAreNonNull() {
+ IfFileName.createNameCondition("bar", null);
+ IfFileName.createNameCondition(null, "foo");
+ IfFileName.createNameCondition("bar", "foo");
+ }
+
+ @Test
+ public void testGetSyntaxAndPattern() {
+ assertEquals("glob:path", IfFileName.createNameCondition("path", null).getSyntaxAndPattern());
+ assertEquals("glob:path", IfFileName.createNameCondition("glob:path", null).getSyntaxAndPattern());
+ assertEquals("regex:bar", IfFileName.createNameCondition(null, "bar").getSyntaxAndPattern());
+ assertEquals("regex:bar", IfFileName.createNameCondition(null, "regex:bar").getSyntaxAndPattern());
+ }
+
+ @Test
+ public void testAcceptUsesPathPatternIfExists() {
+ final IfFileName filter = IfFileName.createNameCondition("path", "regex");
+ final Path relativePath = Paths.get("path");
+ assertTrue(filter.accept(null, relativePath, null));
+
+ final Path pathMatchingRegex = Paths.get("regex");
+ assertFalse(filter.accept(null, pathMatchingRegex, null));
+ }
+
+ @Test
+ public void testAcceptUsesRegexIfNoPathPatternExists() {
+ final IfFileName regexFilter = IfFileName.createNameCondition(null, "regex");
+ final Path pathMatchingRegex = Paths.get("regex");
+ assertTrue(regexFilter.accept(null, pathMatchingRegex, null));
+
+ final Path noMatch = Paths.get("nomatch");
+ assertFalse(regexFilter.accept(null, noMatch, null));
+ }
+
+ @Test
+ public void testAcceptIgnoresBasePathAndAttributes() {
+ final IfFileName pathFilter = IfFileName.createNameCondition("path", null);
+ final Path relativePath = Paths.get("path");
+ assertTrue(pathFilter.accept(null, relativePath, null));
+
+ final IfFileName regexFilter = IfFileName.createNameCondition(null, "regex");
+ final Path pathMatchingRegex = Paths.get("regex");
+ assertTrue(regexFilter.accept(null, pathMatchingRegex, null));
+ }
+
+ @Test
+ public void testAcceptCallsNestedConditionsOnlyIfPathAccepted1() {
+ final CountingCondition counter = new CountingCondition(true);
+ final IfFileName regexFilter = IfFileName.createNameCondition(null, "regex", counter);
+ final Path pathMatchingRegex = Paths.get("regex");
+
+ assertTrue(regexFilter.accept(null, pathMatchingRegex, null));
+ assertEquals(1, counter.getAcceptCount());
+ assertTrue(regexFilter.accept(null, pathMatchingRegex, null));
+ assertEquals(2, counter.getAcceptCount());
+ assertTrue(regexFilter.accept(null, pathMatchingRegex, null));
+ assertEquals(3, counter.getAcceptCount());
+
+ final Path noMatch = Paths.get("nomatch");
+ assertFalse(regexFilter.accept(null, noMatch, null));
+ assertEquals(3, counter.getAcceptCount()); // no increase
+ assertFalse(regexFilter.accept(null, noMatch, null));
+ assertEquals(3, counter.getAcceptCount());
+ assertFalse(regexFilter.accept(null, noMatch, null));
+ assertEquals(3, counter.getAcceptCount());
+ }
+
+ @Test
+ public void testAcceptCallsNestedConditionsOnlyIfPathAccepted2() {
+ final CountingCondition counter = new CountingCondition(true);
+ final IfFileName globFilter = IfFileName.createNameCondition("glob", null, counter);
+ final Path pathMatchingGlob = Paths.get("glob");
+
+ assertTrue(globFilter.accept(null, pathMatchingGlob, null));
+ assertEquals(1, counter.getAcceptCount());
+ assertTrue(globFilter.accept(null, pathMatchingGlob, null));
+ assertEquals(2, counter.getAcceptCount());
+ assertTrue(globFilter.accept(null, pathMatchingGlob, null));
+ assertEquals(3, counter.getAcceptCount());
+
+ final Path noMatch = Paths.get("nomatch");
+ assertFalse(globFilter.accept(null, noMatch, null));
+ assertEquals(3, counter.getAcceptCount()); // no increase
+ assertFalse(globFilter.accept(null, noMatch, null));
+ assertEquals(3, counter.getAcceptCount());
+ assertFalse(globFilter.accept(null, noMatch, null));
+ assertEquals(3, counter.getAcceptCount());
+ }
+
+ @Test
+ public void testBeforeTreeWalk() {
+ final CountingCondition counter = new CountingCondition(true);
+ final IfFileName pathFilter = IfFileName.createNameCondition("path", null, counter, counter, counter);
+ pathFilter.beforeFileTreeWalk();
+ assertEquals(3, counter.getBeforeFileTreeWalkCount());
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModifiedTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModifiedTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModifiedTest.java
index 48d2a10..520e68d 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModifiedTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModifiedTest.java
@@ -75,7 +75,7 @@ public class IfLastModifiedTest {
assertEquals(2, counter.getAcceptCount());
assertTrue(filter.accept(null, null, attrs));
assertEquals(3, counter.getAcceptCount());
-
+
final long tooYoung = 33 * 1000 - 5;
attrs.lastModified = FileTime.fromMillis(System.currentTimeMillis() - tooYoung);
assertFalse(filter.accept(null, null, attrs));
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/PathSortByModificationTimeTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/PathSortByModificationTimeTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/PathSortByModificationTimeTest.java
index 255fec4..15b2eae 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/PathSortByModificationTimeTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/PathSortByModificationTimeTest.java
@@ -49,15 +49,15 @@ public class PathSortByModificationTimeTest {
final DummyFileAttributes a2 = new DummyFileAttributes();
a1.lastModified = FileTime.fromMillis(100);
a2.lastModified = FileTime.fromMillis(222);
-
+
assertEquals("same path, 2nd more recent", 1, sorter.compare(path(p1, a1), path(p1, a2)));
assertEquals("path ignored, 2nd more recent", 1, sorter.compare(path(p1, a1), path(p2, a2)));
assertEquals("path ignored, 2nd more recent", 1, sorter.compare(path(p2, a1), path(p1, a2)));
-
+
assertEquals("same path, 1st more recent", -1, sorter.compare(path(p1, a2), path(p1, a1)));
assertEquals("path ignored, 1st more recent", -1, sorter.compare(path(p1, a2), path(p2, a1)));
assertEquals("path ignored, 1st more recent", -1, sorter.compare(path(p2, a2), path(p1, a1)));
-
+
assertEquals("same path, same time", 0, sorter.compare(path(p1, a1), path(p1, a1)));
assertEquals("p2 < p1, same time", 1, sorter.compare(path(p1, a1), path(p2, a1)));
assertEquals("p2 < p1, same time", -1, sorter.compare(path(p2, a1), path(p1, a1)));
@@ -72,15 +72,15 @@ public class PathSortByModificationTimeTest {
final DummyFileAttributes a2 = new DummyFileAttributes();
a1.lastModified = FileTime.fromMillis(100);
a2.lastModified = FileTime.fromMillis(222);
-
+
assertEquals("same path, 2nd more recent", -1, sorter.compare(path(p1, a1), path(p1, a2)));
assertEquals("path ignored, 2nd more recent", -1, sorter.compare(path(p1, a1), path(p2, a2)));
assertEquals("path ignored, 2nd more recent", -1, sorter.compare(path(p2, a1), path(p1, a2)));
-
+
assertEquals("same path, 1st more recent", 1, sorter.compare(path(p1, a2), path(p1, a1)));
assertEquals("path ignored, 1st more recent", 1, sorter.compare(path(p1, a2), path(p2, a1)));
assertEquals("path ignored, 1st more recent", 1, sorter.compare(path(p2, a2), path(p1, a1)));
-
+
assertEquals("same path, same time", 0, sorter.compare(path(p1, a1), path(p1, a1)));
assertEquals("p1 < p2, same time", -1, sorter.compare(path(p1, a1), path(p2, a1)));
assertEquals("p1 < p2, same time", 1, sorter.compare(path(p2, a1), path(p1, a1)));
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/SortingVisitorTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/SortingVisitorTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/SortingVisitorTest.java
index dd32a0c..35cd870 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/SortingVisitorTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/SortingVisitorTest.java
@@ -36,7 +36,7 @@ import static org.junit.Assert.*;
* Tests the SortingVisitor class.
*/
public class SortingVisitorTest {
-
+
private Path base;
private Path aaa;
private Path bbb;
@@ -48,14 +48,14 @@ public class SortingVisitorTest {
aaa = Files.createTempFile(base, "aaa", null, new FileAttribute<?>[0]);
bbb = Files.createTempFile(base, "bbb", null, new FileAttribute<?>[0]);
ccc = Files.createTempFile(base, "ccc", null, new FileAttribute<?>[0]);
-
+
// lastModified granularity is 1 sec(!) on some file systems...
final long now = System.currentTimeMillis();
Files.setLastModifiedTime(aaa, FileTime.fromMillis(now));
Files.setLastModifiedTime(bbb, FileTime.fromMillis(now + 1000));
Files.setLastModifiedTime(ccc, FileTime.fromMillis(now + 2000));
}
-
+
@After
public void tearDown() throws Exception {
Files.deleteIfExists(ccc);
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/DefaultRouteScriptAppenderTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/DefaultRouteScriptAppenderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/DefaultRouteScriptAppenderTest.java
index b112fb7..c0a66e2 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/DefaultRouteScriptAppenderTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/DefaultRouteScriptAppenderTest.java
@@ -45,7 +45,7 @@ public class DefaultRouteScriptAppenderTest {
@Parameterized.Parameters(name = "{0} {1}")
public static Object[][] getParameters() {
// @formatter:off
- return new Object[][] {
+ return new Object[][] {
{ "log4j-routing-default-route-script-groovy.xml", false },
{ "log4j-routing-default-route-script-javascript.xml", false },
{ "log4j-routing-script-staticvars-javascript.xml", true },
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/RoutesScriptAppenderTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/RoutesScriptAppenderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/RoutesScriptAppenderTest.java
index 12b571f..f9bbbd9 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/RoutesScriptAppenderTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/RoutesScriptAppenderTest.java
@@ -51,7 +51,7 @@ public class RoutesScriptAppenderTest {
@Parameterized.Parameters(name = "{0} {1}")
public static Object[][] getParameters() {
// @formatter:off
- return new Object[][] {
+ return new Object[][] {
{ "log4j-routing-routes-script-groovy.xml", false },
{ "log4j-routing-routes-script-javascript.xml", false },
{ "log4j-routing-script-staticvars-javascript.xml", true },
@@ -64,7 +64,7 @@ public class RoutesScriptAppenderTest {
public final LoggerContextRule loggerContextRule;
private final boolean expectBindingEntries;
-
+
public RoutesScriptAppenderTest(final String configLocation, final boolean expectBindingEntries) {
this.loggerContextRule = new LoggerContextRule(configLocation);
this.expectBindingEntries = expectBindingEntries;
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigAutoFlushTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigAutoFlushTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigAutoFlushTest.java
index d032943..d7ae4a4 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigAutoFlushTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigAutoFlushTest.java
@@ -44,7 +44,7 @@ public class AsyncLoggerConfigAutoFlushTest {
public void testFlushAtEndOfBatch() throws Exception {
final File file = new File("target", "AsyncLoggerConfigAutoFlushTest.log");
assertTrue("Deleted old file before test", !file.exists() || file.delete());
-
+
final Logger log = LogManager.getLogger("com.foo.Bar");
final String msg = "Message flushed with immediate flush=false";
log.info(msg);
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest2.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest2.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest2.java
index 3c09ff5..6b0dc9b 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest2.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest2.java
@@ -40,7 +40,7 @@ public class AsyncLoggerConfigTest2 {
"AsyncLoggerConfigTest2.xml");
final File file = new File("target", "AsyncLoggerConfigTest2.log");
assertTrue("Deleted old file before test", !file.exists() || file.delete());
-
+
final Logger log = LogManager.getLogger("com.foo.Bar");
final String msg = "Message before reconfig";
log.info(msg);
@@ -48,7 +48,7 @@ public class AsyncLoggerConfigTest2 {
final LoggerContext ctx = LoggerContext.getContext(false);
ctx.reconfigure();
ctx.reconfigure();
-
+
final String msg2 = "Message after reconfig";
log.info(msg2);
CoreLoggerContexts.stopLoggerContext(file); // stop async thread
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest3.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest3.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest3.java
index 301fb73..1cf88c4 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest3.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest3.java
@@ -53,7 +53,7 @@ public class AsyncLoggerConfigTest3 {
}
final Message msg = new ParameterizedMessage("{}", map);
- Log4jLogEvent event = Log4jLogEvent.newBuilder()
+ final Log4jLogEvent event = Log4jLogEvent.newBuilder()
.setLevel(Level.WARN)
.setLoggerName(getClass().getName())
.setMessage(msg)
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigUseAfterShutdownTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigUseAfterShutdownTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigUseAfterShutdownTest.java
index e7dcf82..a4a2513 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigUseAfterShutdownTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigUseAfterShutdownTest.java
@@ -42,7 +42,7 @@ public class AsyncLoggerConfigUseAfterShutdownTest {
log.info("some message");
CoreLoggerContexts.stopLoggerContext(); // stop async thread
- // call the #logMessage() method to bypass the isEnabled check:
+ // call the #logMessage() method to bypass the isEnabled check:
// before the LOG4J2-639 fix this would throw a NPE
((AbstractLogger) log).logMessage("com.foo.Bar", Level.INFO, null, new SimpleMessage("msg"), null);
}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigWithAsyncEnabledTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigWithAsyncEnabledTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigWithAsyncEnabledTest.java
index 454c08e..00ddcf4 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigWithAsyncEnabledTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigWithAsyncEnabledTest.java
@@ -57,7 +57,7 @@ public class AsyncLoggerConfigWithAsyncEnabledTest {
assertTrue("Deleted old file before test", !file.exists() || file.delete());
final Logger log = LogManager.getLogger("com.foo.Bar");
- String format = "Additive logging: {} for the price of {}!";
+ final String format = "Additive logging: {} for the price of {}!";
log.info(format, 2, 1);
CoreLoggerContexts.stopLoggerContext(file); // stop async thread
@@ -67,7 +67,7 @@ public class AsyncLoggerConfigWithAsyncEnabledTest {
reader.close();
file.delete();
- String expected = "Additive logging: {} for the price of {}! [2,1] Additive logging: 2 for the price of 1!";
+ final String expected = "Additive logging: {} for the price of {}! [2,1] Additive logging: 2 for the price of 1!";
assertThat(line1, containsString(expected));
assertThat(line2, containsString(expected));
}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java
index fc5cb63..29f21a5 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java
@@ -27,7 +27,7 @@ import static org.junit.Assert.*;
@Category(AsyncLoggers.class)
public class AsyncLoggerContextSelectorTest {
-
+
private static final String FQCN = AsyncLoggerContextSelectorTest.class.getName();
@Test
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerCustomSelectorLocationTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerCustomSelectorLocationTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerCustomSelectorLocationTest.java
index 56cbfc6..e5984aa 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerCustomSelectorLocationTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerCustomSelectorLocationTest.java
@@ -88,12 +88,12 @@ public class AsyncLoggerCustomSelectorLocationTest {
public static final class CustomAsyncContextSelector implements ContextSelector {
private static final LoggerContext CONTEXT = new AsyncLoggerContext("AsyncDefault");
@Override
- public LoggerContext getContext(String fqcn, ClassLoader loader, boolean currentContext) {
+ public LoggerContext getContext(final String fqcn, final ClassLoader loader, final boolean currentContext) {
return CONTEXT;
}
@Override
- public LoggerContext getContext(String fqcn, ClassLoader loader, boolean currentContext, URI configLocation) {
+ public LoggerContext getContext(final String fqcn, final ClassLoader loader, final boolean currentContext, final URI configLocation) {
return CONTEXT;
}
@@ -103,7 +103,7 @@ public class AsyncLoggerCustomSelectorLocationTest {
}
@Override
- public void removeContext(LoggerContext context) {
+ public void removeContext(final LoggerContext context) {
// does not remove anything
}
}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java
index 5b61d8e..2642d2b 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java
@@ -41,7 +41,7 @@ public class AsyncLoggerLocationTest {
public static void beforeClass() {
final File file = new File("target", "AsyncLoggerLocationTest.log");
file.delete();
-
+
System.setProperty(Constants.LOG4J_CONTEXT_SELECTOR,
AsyncLoggerContextSelector.class.getName());
System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a8a7e7c9/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java
index aad8ce7..27c6678 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java
@@ -55,10 +55,10 @@ public class AsyncLoggerTest {
final File file = new File("target", "AsyncLoggerTest.log");
// System.out.println(f.getAbsolutePath());
file.delete();
-
+
final AsyncLogger log = (AsyncLogger) LogManager.getLogger("com.foo.Bar");
assertTrue(log.getNanoClock() instanceof DummyNanoClock);
-
+
final String msg = "Async logger msg";
log.info(msg, new InternalError("this is not a real error"));
CoreLoggerContexts.stopLoggerContext(false, file); // stop async thread