This is an automated email from the ASF dual-hosted git repository.

pkarwasz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 1d97bcd807cab5f7e83b08decf4569dea2c6c053
Author: Gary Gregory <[email protected]>
AuthorDate: Mon Mar 7 09:48:15 2022 -0500

    Add disabled but failing tests from Log4j 1 as TODOs.
---
 .../org/apache/log4j/defaultInit/TestCase1.java    | 55 ++++++++++++++++++++
 .../org/apache/log4j/defaultInit/TestCase2.java    | 59 +++++++++++++++++++++
 .../org/apache/log4j/defaultInit/TestCase3.java    | 53 +++++++++++++++++++
 .../org/apache/log4j/defaultInit/TestCase4.java    | 60 ++++++++++++++++++++++
 4 files changed, 227 insertions(+)

diff --git 
a/log4j-1.2-api/src/test/java/org/apache/log4j/defaultInit/TestCase1.java 
b/log4j-1.2-api/src/test/java/org/apache/log4j/defaultInit/TestCase1.java
new file mode 100644
index 0000000..44f5f04
--- /dev/null
+++ b/log4j-1.2-api/src/test/java/org/apache/log4j/defaultInit/TestCase1.java
@@ -0,0 +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.log4j.defaultInit;
+
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+import org.junit.Ignore;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+@Ignore
+public class TestCase1 extends TestCase {
+
+  public TestCase1(String name) {
+    super(name);
+  }
+
+  public void setUp() {
+  }
+
+  public void tearDown() {
+    LogManager.shutdown();
+  }
+
+  public void noneTest() {
+    Logger root = Logger.getRootLogger();
+    boolean rootIsConfigured = root.getAllAppenders().hasMoreElements();
+    assertTrue(!rootIsConfigured);
+  }
+
+  public static Test suite() {
+    TestSuite suite = new TestSuite();
+    suite.addTest(new TestCase1("noneTest"));
+    return suite;
+  }
+
+}
+
diff --git 
a/log4j-1.2-api/src/test/java/org/apache/log4j/defaultInit/TestCase2.java 
b/log4j-1.2-api/src/test/java/org/apache/log4j/defaultInit/TestCase2.java
new file mode 100644
index 0000000..33b2915
--- /dev/null
+++ b/log4j-1.2-api/src/test/java/org/apache/log4j/defaultInit/TestCase2.java
@@ -0,0 +1,59 @@
+/*
+ * 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.log4j.defaultInit;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.framework.Test;
+import java.util.Enumeration;
+import org.apache.log4j.Appender;
+import org.apache.log4j.Logger;
+import org.junit.Ignore;
+import org.apache.log4j.LogManager;
+
+@Ignore
+public class TestCase2 extends TestCase {
+
+  public TestCase2(String name) {
+    super(name);
+  }
+
+  public void setUp() {
+  }
+
+  public void tearDown() {
+    LogManager.shutdown();
+  }
+
+  public void xmlTest() {
+    Logger root = Logger.getRootLogger();
+    boolean rootIsConfigured = root.getAllAppenders().hasMoreElements();
+    assertTrue(rootIsConfigured);
+    Enumeration e = root.getAllAppenders();
+    Appender appender = (Appender) e.nextElement();
+    assertEquals(appender.getName(), "D1");
+  }
+
+  public static Test suite() {
+    TestSuite suite = new TestSuite();
+    suite.addTest(new TestCase2("xmlTest"));
+    return suite;
+  }
+
+}
+
diff --git 
a/log4j-1.2-api/src/test/java/org/apache/log4j/defaultInit/TestCase3.java 
b/log4j-1.2-api/src/test/java/org/apache/log4j/defaultInit/TestCase3.java
new file mode 100644
index 0000000..73c176f
--- /dev/null
+++ b/log4j-1.2-api/src/test/java/org/apache/log4j/defaultInit/TestCase3.java
@@ -0,0 +1,53 @@
+/*
+ * 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.log4j.defaultInit;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.io.IOException;
+import java.util.Enumeration;
+
+import org.apache.log4j.Appender;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+import org.apache.log4j.config.TestConfigurator;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+@Disabled
+public class TestCase3  {
+
+    @AfterAll
+    public static void tearDown() {
+        LogManager.shutdown();
+    }
+
+    @Test
+    public void propertiesTest() throws IOException {
+        
TestConfigurator.configure("src/test/resources/log4j1-1.2.17/input/defaultInit3.properties");
+        Logger root = Logger.getRootLogger();
+        boolean rootIsConfigured = root.getAllAppenders().hasMoreElements();
+        assertTrue(rootIsConfigured);
+        Enumeration e = root.getAllAppenders();
+        Appender appender = (Appender) e.nextElement();
+        assertEquals(appender.getName(), "D3");
+    }
+
+}
diff --git 
a/log4j-1.2-api/src/test/java/org/apache/log4j/defaultInit/TestCase4.java 
b/log4j-1.2-api/src/test/java/org/apache/log4j/defaultInit/TestCase4.java
new file mode 100644
index 0000000..c44b546
--- /dev/null
+++ b/log4j-1.2-api/src/test/java/org/apache/log4j/defaultInit/TestCase4.java
@@ -0,0 +1,60 @@
+/*
+ * 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.log4j.defaultInit;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.framework.Test;
+import java.util.Enumeration;
+import org.apache.log4j.Appender;
+import org.apache.log4j.Logger;
+import org.junit.Ignore;
+import org.apache.log4j.LogManager;
+
+@Ignore
+public class TestCase4 extends TestCase {
+
+  public TestCase4(String name) {
+    super(name);
+  }
+
+  public void setUp() {
+  }
+
+  public void tearDown() {
+    LogManager.shutdown();
+  }
+
+  public void combinedTest() {
+    Logger root = Logger.getRootLogger();
+    boolean rootIsConfigured = root.getAllAppenders().hasMoreElements();
+    assertTrue(rootIsConfigured);
+    Enumeration e = root.getAllAppenders();
+    Appender appender = (Appender) e.nextElement();
+    assertEquals(appender.getName(), "D1");
+    assertEquals(e.hasMoreElements(), false);
+  }
+
+  public static Test suite() {
+    TestSuite suite = new TestSuite();
+    suite.addTest(new TestCase4("combinedTest"));
+    return suite;
+  }
+
+}
+

Reply via email to