diff --git a/core/src/test/java/org/apache/struts2/dispatcher/StreamResultTest.java b/core/src/test/java/org/apache/struts2/dispatcher/StreamResultTest.java index 054dbe3a9..147823db9 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/StreamResultTest.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/StreamResultTest.java @@ -21,22 +21,21 @@ package org.apache.struts2.dispatcher; +import com.opensymphony.xwork2.Action; +import com.opensymphony.xwork2.ActionContext; +import com.opensymphony.xwork2.mock.MockActionInvocation; +import com.opensymphony.xwork2.util.ClassLoaderUtil; +import com.opensymphony.xwork2.util.ValueStack; +import org.apache.struts2.ServletActionContext; +import org.apache.struts2.StrutsInternalTestCase; +import org.springframework.mock.web.MockHttpServletResponse; + import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.net.URI; import java.net.URL; -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.StrutsInternalTestCase; -import org.springframework.mock.web.MockHttpServletResponse; - -import com.opensymphony.xwork2.util.ClassLoaderUtil; -import com.opensymphony.xwork2.Action; -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.mock.MockActionInvocation; -import com.opensymphony.xwork2.util.ValueStack; - /** * Unit test for {@link StreamResult}. * @@ -249,8 +248,8 @@ public class StreamResultTest extends StrutsInternalTestCase { public class MyImageAction implements Action { public InputStream getStreamForImage() throws Exception { - // just use src/test/log4j.properties as test file - URL url = ClassLoaderUtil.getResource("log4j.properties", StreamResultTest.class); + // just use src/test/log4j2.xml as test file + URL url = ClassLoaderUtil.getResource("log4j2.xml", StreamResultTest.class); File file = new File(new URI(url.toString())); FileInputStream fis = new FileInputStream(file); return fis; @@ -261,7 +260,7 @@ public class StreamResultTest extends StrutsInternalTestCase { } public long getContentLength() throws Exception { - URL url = ClassLoaderUtil.getResource("log4j.properties", StreamResultTest.class); + URL url = ClassLoaderUtil.getResource("log4j2.xml", StreamResultTest.class); File file = new File(new URI(url.toString())); return file.length(); } diff --git a/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java index acf045ea7..9dbb11462 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java @@ -158,9 +158,9 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase { // when file is not of allowed types ValidationAwareSupport validation = new ValidationAwareSupport(); - URL url = ClassLoaderUtil.getResource("log4j.properties", FileUploadInterceptorTest.class); + URL url = ClassLoaderUtil.getResource("log4j2.xml", FileUploadInterceptorTest.class); File file = new File(new URI(url.toString())); - assertTrue("log4j.properties should be in src/test folder", file.exists()); + assertTrue("log4j2.xml should be in src/test folder", file.exists()); boolean notOk = interceptor.acceptFile(action, file, "filename", "text/html", "inputName", validation); assertFalse(notOk); @@ -169,10 +169,10 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase { List errors = (List) validation.getFieldErrors().get("inputName"); assertEquals(1, errors.size()); String msg = (String) errors.get(0); - // the error message shoul contain at least this test + // the error message should contain at least this test assertTrue(msg.startsWith("The file is to large to be uploaded")); assertTrue(msg.indexOf("inputName") > 0); - assertTrue(msg.indexOf("log4j.properties") > 0); + assertTrue(msg.indexOf("log4j2.xml") > 0); } public void testNoMultipartRequest() throws Exception { diff --git a/core/src/test/resources/log4j.properties b/core/src/test/resources/log4j.properties deleted file mode 100644 index 28ca560b7..000000000 --- a/core/src/test/resources/log4j.properties +++ /dev/null @@ -1,27 +0,0 @@ -# -# $Id$ -# -# 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. -# -log4j.rootLogger = WARN, stdout - -log4j.appender.stdout = org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Threshold = WARN -log4j.appender.stdout.Target = System.out -log4j.appender.stdout.layout = org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern = %d{ISO8601} %-5p [%F:%L] : %m%n diff --git a/core/src/test/resources/log4j2.xml b/core/src/test/resources/log4j2.xml new file mode 100644 index 000000000..4b135395c --- /dev/null +++ b/core/src/test/resources/log4j2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 9fdec9d45..f0c4be667 100644 --- a/pom.xml +++ b/pom.xml @@ -156,6 +156,7 @@ maven-surefire-plugin 2.3.1 + -Duser.language=en -Duser.region=US **/*Test.java diff --git a/xwork-core/pom.xml b/xwork-core/pom.xml index fca191230..3ba64615e 100644 --- a/xwork-core/pom.xml +++ b/xwork-core/pom.xml @@ -37,6 +37,7 @@ maven-surefire-plugin 2.6 + -Duser.language=en -Duser.region=US maven.testng.output.dir