You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/01/16 20:57:05 UTC

[tomcat] branch master updated (f4a23e1 -> 912abf6)

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

markt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


    from f4a23e1  Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=53620 log files
     new ddbfaa7  Update test for WebappServiceLoader changes
     new 912abf6  Update tests after BZ 56320 changes (only open when data to log)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../catalina/startup/TestWebappServiceLoader.java      | 18 ++++++++++++++++++
 test/org/apache/juli/TestFileHandler.java              |  6 ++++++
 test/org/apache/juli/TestFileHandlerNonRotatable.java  |  3 +++
 3 files changed, 27 insertions(+)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 02/02: Update tests after BZ 56320 changes (only open when data to log)

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 912abf63d51997be156ae52aac55bacb9ce27a87
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jan 16 20:56:51 2020 +0000

    Update tests after BZ 56320 changes (only open when data to log)
---
 test/org/apache/juli/TestFileHandler.java             | 6 ++++++
 test/org/apache/juli/TestFileHandlerNonRotatable.java | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/test/org/apache/juli/TestFileHandler.java b/test/org/apache/juli/TestFileHandler.java
index 1ca4675..d8840f9 100644
--- a/test/org/apache/juli/TestFileHandler.java
+++ b/test/org/apache/juli/TestFileHandler.java
@@ -78,6 +78,7 @@ public class TestFileHandler {
         generateLogFiles(logsDir, PREFIX_1, SUFIX_1, 3);
 
         FileHandler fh1 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_1, SUFIX_1, Integer.valueOf(2));
+        fh1.open();
 
         Thread.sleep(1000);
 
@@ -94,6 +95,10 @@ public class TestFileHandler {
         FileHandler fh2 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_1, SUFIX_2, Integer.valueOf(2));
         FileHandler fh3 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_2, SUFIX_1, Integer.valueOf(2));
         FileHandler fh4 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_3, SUFIX_1, Integer.valueOf(2));
+        fh1.open();
+        fh2.open();
+        fh3.open();
+        fh4.open();
 
         Thread.sleep(1000);
 
@@ -110,6 +115,7 @@ public class TestFileHandler {
         generateLogFiles(logsDir, PREFIX_1, SUFIX_1, 3);
 
         FileHandler fh1 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_1, SUFIX_1, null);
+        fh1.open();
 
         Thread.sleep(1000);
 
diff --git a/test/org/apache/juli/TestFileHandlerNonRotatable.java b/test/org/apache/juli/TestFileHandlerNonRotatable.java
index 5b91245..a5affe8 100644
--- a/test/org/apache/juli/TestFileHandlerNonRotatable.java
+++ b/test/org/apache/juli/TestFileHandlerNonRotatable.java
@@ -55,6 +55,7 @@ public class TestFileHandlerNonRotatable extends LoggingBaseTest {
     public void testBug61232() throws Exception {
         testHandler = new FileHandler(this.getTemporaryDirectory().toString(),
                 "juli.", ".log");
+        testHandler.open();
 
         File logFile = new File(this.getTemporaryDirectory(), "juli.log");
         Assert.assertTrue(logFile.exists());
@@ -64,6 +65,7 @@ public class TestFileHandlerNonRotatable extends LoggingBaseTest {
     public void testCustomSuffixWithoutSeparator() throws Exception {
         testHandler = new FileHandler(this.getTemporaryDirectory().toString(),
                 "juli.", "log");
+        testHandler.open();
 
         File logFile = new File(this.getTemporaryDirectory(), "juli.log");
         Assert.assertTrue(logFile.exists());
@@ -73,6 +75,7 @@ public class TestFileHandlerNonRotatable extends LoggingBaseTest {
     public void testCustomPrefixWithoutSeparator() throws Exception {
         testHandler = new FileHandler(this.getTemporaryDirectory().toString(),
                 "juli", ".log");
+        testHandler.open();
 
         File logFile = new File(this.getTemporaryDirectory(), "juli.log");
         Assert.assertTrue(logFile.exists());


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 01/02: Update test for WebappServiceLoader changes

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit ddbfaa752c40065324ba5d71e9ec2bc9065131da
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jan 16 20:55:36 2020 +0000

    Update test for WebappServiceLoader changes
---
 .../catalina/startup/TestWebappServiceLoader.java      | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/test/org/apache/catalina/startup/TestWebappServiceLoader.java b/test/org/apache/catalina/startup/TestWebappServiceLoader.java
index 8260bd0..e3f3dda 100644
--- a/test/org/apache/catalina/startup/TestWebappServiceLoader.java
+++ b/test/org/apache/catalina/startup/TestWebappServiceLoader.java
@@ -32,6 +32,9 @@ import org.junit.Before;
 import org.junit.Test;
 
 import org.apache.catalina.Context;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.WebResourceRoot;
+import org.apache.catalina.webresources.StandardRoot;
 import org.apache.tomcat.unittest.TesterContext;
 import org.easymock.EasyMock;
 import org.easymock.IMocksControl;
@@ -101,6 +104,8 @@ public class TestWebappServiceLoader {
         List<String> jars = Arrays.asList("jar1.jar", "dir/");
         EasyMock.expect(servletContext.getAttribute(ServletContext.ORDERED_LIBS))
                 .andReturn(jars);
+        EasyMock.expect(servletContext.getResource("/WEB-INF/classes/" + CONFIG_FILE))
+                .andReturn(null);
         EasyMock.expect(servletContext.getResource("/WEB-INF/lib/jar1.jar"))
                 .andReturn(url1);
         loader.parseConfigFile(EasyMock.isA(LinkedHashSet.class), EasyMock.eq(sci1));
@@ -181,10 +186,19 @@ public class TestWebappServiceLoader {
     private static class ExtendedTesterContext extends TesterContext {
         private final ServletContext servletContext;
         private final ClassLoader parent;
+        private final WebResourceRoot resources;
 
         public ExtendedTesterContext(ServletContext servletContext, ClassLoader parent) {
             this.servletContext = servletContext;
             this.parent = parent;
+            // Empty resources - any non-null returns will be mocked on the
+            // ServletContext
+            this.resources = new StandardRoot(this);
+            try {
+                this.resources.start();
+            } catch (LifecycleException e) {
+                throw new IllegalStateException(e);
+            }
         }
 
         @Override
@@ -202,5 +216,9 @@ public class TestWebappServiceLoader {
             return parent;
         }
 
+        @Override
+        public WebResourceRoot getResources() {
+            return resources;
+        }
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org