You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/07/20 16:55:14 UTC
[11/24] incubator-ignite git commit: # ignite-788: tests
# ignite-788: tests
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f524d3fd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f524d3fd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f524d3fd
Branch: refs/heads/ignite-788-last-review
Commit: f524d3fdac80d9631f10869b05620ad3eb9f8571
Parents: 86b47a0
Author: ashutak <as...@gridgain.com>
Authored: Wed Jul 15 20:53:55 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Wed Jul 15 20:53:55 2015 +0300
----------------------------------------------------------------------
config/ignite-log4j2.xml | 32 ++++++-
modules/core/src/test/config/log4j2-test.xml | 56 ++++++++++++
.../log4j2/GridLog4j2CorrectFileNameTest.java | 81 ++++-------------
.../log4j2/GridLog4j2InitializedTest.java | 15 +---
.../log4j2/GridLog4j2InitiallizationTest.java | 94 ++++++++++++++++++++
.../log4j2/GridLog4j2LoggingFileTest.java | 59 ------------
.../log4j2/GridLog4j2LoggingPathTest.java | 52 -----------
.../logger/log4j2/GridLog4j2LoggingUrlTest.java | 59 ------------
.../log4j2/GridLog4j2NotInitializedTest.java | 2 +-
.../testsuites/IgniteLog4j2TestSuite.java | 6 ++
10 files changed, 207 insertions(+), 249 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f524d3fd/config/ignite-log4j2.xml
----------------------------------------------------------------------
diff --git a/config/ignite-log4j2.xml b/config/ignite-log4j2.xml
index b24c57b..c1393aa 100644
--- a/config/ignite-log4j2.xml
+++ b/config/ignite-log4j2.xml
@@ -17,8 +17,12 @@
limitations under the License.
-->
-<Configuration status="info">
+<Configuration>
<Appenders>
+ <Console name="CONSOLE" target="SYSTEM_OUT">
+ <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ </Console>
+
<Console name="CONSOLE_ERR" target="SYSTEM_ERR">
<PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
</Console>
@@ -53,15 +57,37 @@
</Appenders>
<Loggers>
+ <!--
+ <Logger name="org.apache.ignite" level=DEBUG/>
+ -->
+
+ <!--
+ Uncomment to disable courtesy notices, such as SPI configuration
+ consistency warnings.
+ -->
+ <!--
+ <Logger name="org.apache.ignite.CourtesyConfigNotice" level=OFF/>
+ -->
+
<Logger name="org.springframework" level="WARN"/>
<Logger name="org.eclipse.jetty" level="WARN"/>
+
+ <!--
+ Avoid warnings about failed bind attempt when multiple nodes running on the same host.
+ -->
<Logger name="org.eclipse.jetty.util.log" level="ERROR"/>
<Logger name="org.eclipse.jetty.util.component" level="ERROR"/>
+
<Logger name="com.amazonaws" level="WARN"/>
<Root level="INFO">
- <AppenderRef ref="CONSOLE_ERR"/>
- <AppenderRef ref="Routing"/>
+ <!-- Uncomment to enable logging to console. -->
+ <!--
+ <AppenderRef ref="CONSOLE" level="DEBUG"/>
+ -->
+
+ <AppenderRef ref="CONSOLE_ERR" level="ERROR"/>
+ <AppenderRef ref="Routing" level="DEBUG"/>
</Root>
</Loggers>
</Configuration>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f524d3fd/modules/core/src/test/config/log4j2-test.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/log4j2-test.xml b/modules/core/src/test/config/log4j2-test.xml
new file mode 100644
index 0000000..b95709b
--- /dev/null
+++ b/modules/core/src/test/config/log4j2-test.xml
@@ -0,0 +1,56 @@
+<?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.
+-->
+
+<Configuration status="info">
+ <Appenders>
+ <Console name="CONSOLE" target="SYSTEM_OUT">
+ <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ </Console>
+
+ <Console name="CONSOLE_ERR" target="SYSTEM_ERR">
+ <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ </Console>
+
+ <Routing name="FILE">
+ <Routes pattern="$${ctx:nodeId}">
+ <Route>
+ <RollingFile name="Rolling-${ctx:nodeId}" fileName="work/log/ignite-${ctx:nodeId}.log"
+ filePattern="work/log/ignite-${ctx:nodeId}-%i-%d{yyyy-MM-dd}.log.gz">
+ <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <Policies>
+ <TimeBasedTriggeringPolicy interval="6" modulate="true" />
+ <SizeBasedTriggeringPolicy size="10 MB" />
+ </Policies>
+ </RollingFile>
+ </Route>
+ </Routes>
+ </Routing>
+ </Appenders>
+
+ <Loggers>
+ <Logger name="org" level="INFO"/>
+ <Logger name="org.eclipse.jetty" level="INFO"/>
+
+ <Root level="INFO">
+ <AppenderRef ref="CONSOLE" level="DEBUG"/>
+ <AppenderRef ref="CONSOLE_ERR" level="WARN"/>
+ <AppenderRef ref="FILE" level="DEBUG"/>
+ </Root>
+ </Loggers>
+</Configuration>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f524d3fd/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2CorrectFileNameTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2CorrectFileNameTest.java b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2CorrectFileNameTest.java
index 4699ab8..7a968d4 100644
--- a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2CorrectFileNameTest.java
+++ b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2CorrectFileNameTest.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.ignite.logger.log4j2;
import junit.framework.*;
@@ -25,39 +24,12 @@ import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.testframework.junits.common.*;
import java.io.*;
-import java.util.*;
/**
* Tests that several grids log to files with correct names.
*/
@GridCommonTest(group = "Logger")
public class GridLog4j2CorrectFileNameTest extends TestCase {
- /** Appender */
- private Log4jRollingFileAppender appender;
-
- /** {@inheritDoc} */
- @Override protected void setUp() throws Exception {
- Logger root = Logger.getRootLogger();
-
- for (Enumeration appenders = root.getAllAppenders(); appenders.hasMoreElements(); ) {
- if (appenders.nextElement() instanceof Log4jRollingFileAppender)
- return;
- }
-
- appender = createAppender();
-
- root.addAppender(appender);
- }
-
- /** {@inheritDoc} */
- @Override public void tearDown() {
- if (appender != null) {
- Logger.getRootLogger().removeAppender(Log4jRollingFileAppender.class.getSimpleName());
-
- Log4JLogger.removeAppender(appender);
- }
- }
-
/**
* Tests correct behaviour in case 2 local nodes are started.
*
@@ -76,19 +48,24 @@ public class GridLog4j2CorrectFileNameTest extends TestCase {
* @throws Exception If error occurred.
*/
private void checkOneNode(int id) throws Exception {
+ String id8 = null;
+
try (Ignite ignite = G.start(getConfiguration("grid" + id))) {
- String id8 = U.id8(ignite.cluster().localNode().id());
- String logPath = "work/log/ignite-" + id8 + ".log";
- File logFile = U.resolveIgnitePath(logPath);
+ id8 = U.id8(ignite.cluster().localNode().id());
+ }
- assertNotNull("Failed to resolve path: " + logPath, logFile);
- assertTrue("Log file does not exist: " + logFile, logFile.exists());
+ String logPath = "work/log/ignite-" + id8 + ".log";
+ File logFile = U.resolveIgnitePath(logPath);
- String logContent = U.readFileToString(logFile.getAbsolutePath(), "UTF-8");
+ assertNotNull("Failed to resolve path: " + logPath, logFile);
+ assertTrue("Log file does not exist: " + logFile, logFile.exists());
+ // We have a row in log with the following content
+ // con >>> Local node [ID=NodeId ]
+ String logContent = U.readFileToString(logFile.getAbsolutePath(), "UTF-8");
+
+ assertTrue("Log file does not contain it's node ID: " + logFile,
+ logContent.contains(">>> Local node [ID="+ id8.toUpperCase()));
- assertTrue("Log file does not contain it's node ID: " + logFile,
- logContent.contains(">>> Local node [ID=" + id8.toUpperCase()));
- }
}
/**
@@ -98,37 +75,15 @@ public class GridLog4j2CorrectFileNameTest extends TestCase {
* @return Grid configuration.
* @throws Exception If error occurred.
*/
- private static IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ private static IgniteConfiguration getConfiguration(String gridName)
+ throws Exception {
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setGridName(gridName);
- cfg.setGridLogger(new Log4JLogger());
+
+ cfg.setGridLogger(new Log4J2Logger("config/ignite-log4j2.xml"));
cfg.setConnectorConfiguration(null);
return cfg;
}
-
- /**
- * Creates new GridLog4jRollingFileAppender.
- *
- * @return GridLog4jRollingFileAppender.
- * @throws Exception If error occurred.
- */
- private static Log4jRollingFileAppender createAppender() throws Exception {
- Log4jRollingFileAppender appender = new Log4jRollingFileAppender();
-
- appender.setLayout(new PatternLayout("[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"));
- appender.setFile("work/log/ignite.log");
- appender.setName(Log4jRollingFileAppender.class.getSimpleName());
-
- LevelRangeFilter lvlFilter = new LevelRangeFilter();
-
- lvlFilter.setLevelMin(Level.DEBUG);
- lvlFilter.setLevelMax(Level.INFO);
-
- appender.addFilter(lvlFilter);
-
- return appender;
- }
}
-
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f524d3fd/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2InitializedTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2InitializedTest.java b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2InitializedTest.java
index 107ec38..78a53b6 100644
--- a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2InitializedTest.java
+++ b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2InitializedTest.java
@@ -26,19 +26,11 @@ import org.apache.ignite.testframework.junits.common.*;
*/
@GridCommonTest(group = "Logger")
public class GridLog4j2InitializedTest extends TestCase {
-
- /**
- * @throws Exception If failed.
- */
- @Override protected void setUp() throws Exception {
- BasicConfigurator.configure();
- }
-
/** */
public void testLogInitialize() {
- IgniteLogger log = new Log4JLogger();
+ IgniteLogger log = new Log4J2Logger();
- assert log.isInfoEnabled() == true;
+ assert log.isInfoEnabled();
if (log.isDebugEnabled())
log.debug("This is 'debug' message.");
@@ -47,8 +39,7 @@ public class GridLog4j2InitializedTest extends TestCase {
log.warning("This is 'warning' message.");
log.warning("This is 'warning' message.", new Exception("It's a test warning exception"));
log.error("This is 'error' message.");
- log.error("This is 'error' message.", new Exception("It's a test error exception"));
- assert log.getLogger(GridLog4j2InitializedTest.class.getName()) instanceof Log4JLogger;
+ assert log.getLogger(GridLog4j2InitializedTest.class.getName()) instanceof Log4J2Logger;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f524d3fd/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2InitiallizationTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2InitiallizationTest.java b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2InitiallizationTest.java
new file mode 100644
index 0000000..c2fb7ca
--- /dev/null
+++ b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2InitiallizationTest.java
@@ -0,0 +1,94 @@
+/*
+ * 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.ignite.logger.log4j2;
+
+import junit.framework.*;
+import org.apache.ignite.*;
+import org.apache.ignite.logger.*;
+import org.apache.ignite.testframework.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Grid Log4j2 SPI test.
+ */
+@GridCommonTest(group = "Logger")
+public class GridLog4j2InitiallizationTest extends TestCase {
+ /** */
+ public static final String LOG_PATH = "modules/core/src/test/config/log4j2-test.xml";
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testFile() throws Exception {
+ File xml = GridTestUtils.resolveIgnitePath(LOG_PATH);
+
+ assert xml != null;
+ assert xml.exists();
+
+ IgniteLogger log = new Log4J2Logger(xml).getLogger(getClass());
+
+ ((LoggerNodeIdAware) log).setNodeId(UUID.randomUUID());
+
+ checkLog(log);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testUrl() throws Exception {
+ File xml = GridTestUtils.resolveIgnitePath(LOG_PATH);
+
+ assert xml != null;
+ assert xml.exists();
+
+ IgniteLogger log = new Log4J2Logger(xml.toURI().toURL()).getLogger(getClass());
+
+ ((LoggerNodeIdAware) log).setNodeId(UUID.randomUUID());
+
+ checkLog(log);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPath() throws Exception {
+ IgniteLogger log = new Log4J2Logger(LOG_PATH).getLogger(getClass());
+
+ ((LoggerNodeIdAware) log).setNodeId(UUID.randomUUID());
+
+ checkLog(log);
+ }
+
+ /**
+ * Tests log4j logging SPI.
+ */
+ private void checkLog(IgniteLogger log) {
+ assert !log.isDebugEnabled();
+ assert log.isInfoEnabled();
+
+ log.debug("This is 'debug' message.");
+ log.info("This is 'info' message.");
+ log.warning("This is 'warning' message.");
+ log.warning("This is 'warning' message.", new Exception("It's a test warning exception"));
+ log.error("This is 'error' message.");
+ log.error("This is 'error' message.", new Exception("It's a test error exception"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f524d3fd/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingFileTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingFileTest.java b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingFileTest.java
deleted file mode 100644
index e52e58f..0000000
--- a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingFileTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.ignite.logger.log4j2;
-
-import junit.framework.*;
-import org.apache.ignite.*;
-import org.apache.ignite.testframework.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.io.*;
-
-/**
- * Grid Log4j SPI test.
- */
-@GridCommonTest(group = "Logger")
-public class GridLog4j2LoggingFileTest extends TestCase {
- /** */
- private IgniteLogger log;
-
- /** {@inheritDoc} */
- @Override protected void setUp() throws Exception {
- File xml = GridTestUtils.resolveIgnitePath("modules/core/src/test/config/log4j-test.xml");
-
- assert xml != null;
- assert xml.exists() == true;
-
- log = new Log4JLogger(xml).getLogger(getClass());
- }
-
- /**
- * Tests log4j logging SPI.
- */
- public void testLog() {
- assert log.isDebugEnabled() == true;
- assert log.isInfoEnabled() == true;
-
- log.debug("This is 'debug' message.");
- log.info("This is 'info' message.");
- log.warning("This is 'warning' message.");
- log.warning("This is 'warning' message.", new Exception("It's a test warning exception"));
- log.error("This is 'error' message.");
- log.error("This is 'error' message.", new Exception("It's a test error exception"));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f524d3fd/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingPathTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingPathTest.java b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingPathTest.java
deleted file mode 100644
index 7477528..0000000
--- a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingPathTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.ignite.logger.log4j2;
-
-import junit.framework.*;
-import org.apache.ignite.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-/**
- * Grid Log4j SPI test.
- */
-@GridCommonTest(group = "Logger")
-public class GridLog4j2LoggingPathTest extends TestCase {
- /** */
- private IgniteLogger log;
-
- /** {@inheritDoc} */
- @Override protected void setUp() throws Exception {
- log = new Log4JLogger("modules/core/src/test/config/log4j-test.xml").getLogger(getClass());
- }
-
- /**
- * Tests log4j logging SPI.
- */
- public void testLog() {
- assert log.isInfoEnabled() == true;
-
- if (log.isDebugEnabled())
- log.debug("This is 'debug' message.");
-
- log.info("This is 'info' message.");
- log.warning("This is 'warning' message.");
- log.warning("This is 'warning' message.", new Exception("It's a test warning exception"));
- log.error("This is 'error' message.");
- log.error("This is 'error' message.", new Exception("It's a test error exception"));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f524d3fd/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingUrlTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingUrlTest.java b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingUrlTest.java
deleted file mode 100644
index 03ff4ba..0000000
--- a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingUrlTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.ignite.logger.log4j2;
-
-import junit.framework.*;
-import org.apache.ignite.*;
-import org.apache.ignite.testframework.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.io.*;
-
-/**
- * Grid Log4j SPI test.
- */
-@GridCommonTest(group = "Logger")
-public class GridLog4j2LoggingUrlTest extends TestCase {
- /** */
- private IgniteLogger log;
-
- /** {@inheritDoc} */
- @Override protected void setUp() throws Exception {
- File xml = GridTestUtils.resolveIgnitePath("modules/core/src/test/config/log4j-test.xml");
-
- assert xml != null;
- assert xml.exists();
-
- log = new Log4JLogger(xml.toURI().toURL()).getLogger(getClass());
- }
-
- /**
- * Tests log4j logging SPI.
- */
- public void testLog() {
- assert log.isDebugEnabled();
- assert log.isInfoEnabled();
-
- log.debug("This is 'debug' message.");
- log.info("This is 'info' message.");
- log.warning("This is 'warning' message.");
- log.warning("This is 'warning' message.", new Exception("It's a test warning exception"));
- log.error("This is 'error' message.");
- log.error("This is 'error' message.", new Exception("It's a test error exception"));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f524d3fd/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2NotInitializedTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2NotInitializedTest.java b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2NotInitializedTest.java
index 10bf0a1..6db58bf 100644
--- a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2NotInitializedTest.java
+++ b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2NotInitializedTest.java
@@ -28,7 +28,7 @@ import org.apache.ignite.testframework.junits.common.*;
public class GridLog4j2NotInitializedTest extends TestCase {
/** */
public void testLogInitialize() {
- IgniteLogger log = new Log4JLogger().getLogger(GridLog4j2NotInitializedTest.class);
+ IgniteLogger log = new Log4J2Logger().getLogger(GridLog4j2NotInitializedTest.class);
if (log.isDebugEnabled())
log.debug("This is 'debug' message.");
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f524d3fd/modules/log4j2/src/test/java/org/apache/ignite/testsuites/IgniteLog4j2TestSuite.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/testsuites/IgniteLog4j2TestSuite.java b/modules/log4j2/src/test/java/org/apache/ignite/testsuites/IgniteLog4j2TestSuite.java
index 23fef9a..4cc7c1a 100644
--- a/modules/log4j2/src/test/java/org/apache/ignite/testsuites/IgniteLog4j2TestSuite.java
+++ b/modules/log4j2/src/test/java/org/apache/ignite/testsuites/IgniteLog4j2TestSuite.java
@@ -18,6 +18,7 @@
package org.apache.ignite.testsuites;
import junit.framework.*;
+import org.apache.ignite.logger.log4j2.*;
/**
* Log4j2 logging tests.
@@ -30,6 +31,11 @@ public class IgniteLog4j2TestSuite extends TestSuite {
public static TestSuite suite() throws Exception {
TestSuite suite = new TestSuite("Log4j2 Logging Test Suite");
+// suite.addTest(new TestSuite(GridLog4j2InitializedTest.class));
+ suite.addTest(new TestSuite(GridLog4j2NotInitializedTest.class));
+ suite.addTest(new TestSuite(GridLog4j2CorrectFileNameTest.class));
+ suite.addTest(new TestSuite(GridLog4j2InitiallizationTest.class));
+
return suite;
}
}