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

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

commit adb5fa2b856aeb4bfa1cf8ddba452ac4cbb0dd6d
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Sep 16 18:03:51 2020 +0100

    Fix spellings in unit tests
    
    Based on a PR provided by John Bampton
---
 .../catalina/startup/TestTomcatNoServer.java       |  4 +-
 .../apache/catalina/valves/TestRemoteIpValve.java  |  6 +--
 test/org/apache/juli/TestFileHandler.java          | 44 ++++++++++++----------
 test/org/apache/naming/TesterInjectionServlet.java |  2 +-
 .../websocket/pojo/TestEncodingDecoding.java       |  7 ++--
 5 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/test/org/apache/catalina/startup/TestTomcatNoServer.java 
b/test/org/apache/catalina/startup/TestTomcatNoServer.java
index d2d61d9..c5678c1 100644
--- a/test/org/apache/catalina/startup/TestTomcatNoServer.java
+++ b/test/org/apache/catalina/startup/TestTomcatNoServer.java
@@ -71,7 +71,7 @@ public class TestTomcatNoServer {
                 System.out.println("Missing in embedded: [" + missingExtension 
+
                         "]-[" + webXmlMimeMappings.get(missingExtension) + 
"]");
             }
-            Assert.fail("Embedded is missing [" + missingInEmbedded.size() + 
"] entires compared to conf/web.xml");
+            Assert.fail("Embedded is missing [" + missingInEmbedded.size() + 
"] entries compared to conf/web.xml");
         }
 
         // Find entries present in embedded that are missing in conf/web.xml
@@ -82,7 +82,7 @@ public class TestTomcatNoServer {
                 System.out.println("Missing in embedded: [" + missingExtension 
+
                         "]-[" + ctx.findMimeMapping(missingExtension) + "]");
             }
-            Assert.fail("Embedded is missing [" + missingInWebXml.size() + "] 
entires compared to conf/web.xml");
+            Assert.fail("Embedded is missing [" + missingInWebXml.size() + "] 
entries compared to conf/web.xml");
         }
     }
 }
diff --git a/test/org/apache/catalina/valves/TestRemoteIpValve.java 
b/test/org/apache/catalina/valves/TestRemoteIpValve.java
index 4b70678..557396c 100644
--- a/test/org/apache/catalina/valves/TestRemoteIpValve.java
+++ b/test/org/apache/catalina/valves/TestRemoteIpValve.java
@@ -642,7 +642,7 @@ public class TestRemoteIpValve {
         // PREPARE
         String incomingScheme = arrivesAsSecure ? "https" : "http";
         String expectedScheme = shouldBeSecure ? "https" : "http";
-        int incommingServerPort = arrivesAsSecure ? 8443 : 8080;
+        int incomingServerPort = arrivesAsSecure ? 8443 : 8080;
         int expectedServerPort = shouldBeSecure ? 443 : 80;
         RemoteIpValve remoteIpValve = new RemoteIpValve();
         remoteIpValve.setRemoteIpHeader("x-forwarded-for");
@@ -659,7 +659,7 @@ public class TestRemoteIpValve {
         // protocol
         
request.getCoyoteRequest().getMimeHeaders().addValue("x-forwarded-proto").setString(incomingHeaderValue);
         request.setSecure(arrivesAsSecure);
-        request.setServerPort(incommingServerPort);
+        request.setServerPort(incomingServerPort);
         request.getCoyoteRequest().scheme().setString(incomingScheme);
 
         // TEST
@@ -701,7 +701,7 @@ public class TestRemoteIpValve {
                 Boolean.valueOf(arrivesAsSecure), 
Boolean.valueOf(actualPostInvokeSecure));
 
         int actualPostInvokeServerPort = request.getServerPort();
-        Assert.assertEquals("postInvoke serverPort", incommingServerPort, 
actualPostInvokeServerPort);
+        Assert.assertEquals("postInvoke serverPort", incomingServerPort, 
actualPostInvokeServerPort);
 
         String actualPostInvokeScheme = request.getScheme();
         Assert.assertEquals("postInvoke scheme", incomingScheme, 
actualPostInvokeScheme);
diff --git a/test/org/apache/juli/TestFileHandler.java 
b/test/org/apache/juli/TestFileHandler.java
index 6128d67..465231e 100644
--- a/test/org/apache/juli/TestFileHandler.java
+++ b/test/org/apache/juli/TestFileHandler.java
@@ -33,8 +33,8 @@ public class TestFileHandler {
     private static final String PREFIX_2 = "test.";
     private static final String PREFIX_3 = "";
     private static final String PREFIX_4 = "localhost1";
-    private static final String SUFIX_1 = ".log";
-    private static final String SUFIX_2 = ".txt";
+    private static final String SUFFIX_1 = ".log";
+    private static final String SUFFIX_2 = ".txt";
 
     private File logsDir;
 
@@ -46,17 +46,19 @@ public class TestFileHandler {
             Assert.fail("Unable to create logs directory.");
         }
 
-        generateLogFiles(logsDir, PREFIX_1, SUFIX_2, 3);
-        generateLogFiles(logsDir, PREFIX_2, SUFIX_1, 3);
-        generateLogFiles(logsDir, PREFIX_3, SUFIX_1, 3);
-        generateLogFiles(logsDir, PREFIX_4, SUFIX_1, 3);
+        generateLogFiles(logsDir, PREFIX_1, SUFFIX_2, 3);
+        generateLogFiles(logsDir, PREFIX_2, SUFFIX_1, 3);
+        generateLogFiles(logsDir, PREFIX_3, SUFFIX_1, 3);
+        generateLogFiles(logsDir, PREFIX_4, SUFFIX_1, 3);
 
         Calendar date = Calendar.getInstance();
         date.add(Calendar.DAY_OF_MONTH, -3);
         SimpleDateFormat formatter = new 
SimpleDateFormat("yyyy-MM-dd'T'HH-mm-ss.SSS");
-        File file = new File(logsDir, PREFIX_1 + 
formatter.format(date.getTime()) + SUFIX_1);
-        file.createNewFile();
 
+        File file = new File(logsDir, PREFIX_1 + 
formatter.format(date.getTime()) + SUFFIX_1);
+        if (!file.createNewFile()) {
+            Assert.fail("Unable to create " + file.getAbsolutePath());
+        }
     }
 
     @After
@@ -72,9 +74,9 @@ public class TestFileHandler {
 
     @Test
     public void testCleanOnInitOneHandler() throws Exception {
-        generateLogFiles(logsDir, PREFIX_1, SUFIX_1, 3);
+        generateLogFiles(logsDir, PREFIX_1, SUFFIX_1, 3);
 
-        FileHandler fh1 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_1, 
SUFIX_1, 2);
+        FileHandler fh1 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_1, 
SUFFIX_1, 2);
 
         Thread.sleep(1000);
 
@@ -85,12 +87,12 @@ public class TestFileHandler {
 
     @Test
     public void testCleanOnInitMultipleHandlers() throws Exception {
-        generateLogFiles(logsDir, PREFIX_1, SUFIX_1, 3);
+        generateLogFiles(logsDir, PREFIX_1, SUFFIX_1, 3);
 
-        FileHandler fh1 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_1, 
SUFIX_1, 2);
-        FileHandler fh2 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_1, 
SUFIX_2, 2);
-        FileHandler fh3 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_2, 
SUFIX_1, 2);
-        FileHandler fh4 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_3, 
SUFIX_1, 2);
+        FileHandler fh1 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_1, 
SUFFIX_1, 2);
+        FileHandler fh2 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_1, 
SUFFIX_2, 2);
+        FileHandler fh3 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_2, 
SUFFIX_1, 2);
+        FileHandler fh4 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_3, 
SUFFIX_1, 2);
 
         Thread.sleep(1000);
 
@@ -104,9 +106,9 @@ public class TestFileHandler {
 
     @Test
     public void testCleanDisabled() throws Exception {
-        generateLogFiles(logsDir, PREFIX_1, SUFIX_1, 3);
+        generateLogFiles(logsDir, PREFIX_1, SUFFIX_1, 3);
 
-        FileHandler fh1 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_1, 
SUFIX_1, -1);
+        FileHandler fh1 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_1, 
SUFFIX_1, -1);
 
         Thread.sleep(1000);
 
@@ -115,14 +117,16 @@ public class TestFileHandler {
         fh1.close();
     }
 
-    private void generateLogFiles(File dir, String prefix, String sufix, int 
amount)
+    private void generateLogFiles(File dir, String prefix, String suffix, int 
amount)
             throws IOException {
         Calendar cal = Calendar.getInstance();
         SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
         for (int i = 0; i < amount; i++) {
             cal.add(Calendar.DAY_OF_MONTH, -1);
-            File file = new File(dir, prefix + formatter.format(cal.getTime()) 
+ sufix);
-            file.createNewFile();
+            File file = new File(dir, prefix + formatter.format(cal.getTime()) 
+ suffix);
+            if (!file.createNewFile()) {
+                Assert.fail("Unable to create " + file.getAbsolutePath());
+            }
         }
     }
 }
diff --git a/test/org/apache/naming/TesterInjectionServlet.java 
b/test/org/apache/naming/TesterInjectionServlet.java
index 7075f5a..962504f 100644
--- a/test/org/apache/naming/TesterInjectionServlet.java
+++ b/test/org/apache/naming/TesterInjectionServlet.java
@@ -58,7 +58,7 @@ public class TesterInjectionServlet extends HttpServlet {
         PrintWriter pw = resp.getWriter();
         pw.print(IntrospectionUtils.getProperty(this, injectionName));
 
-        // The property should tyake precedence over the field and this should
+        // The property should take precedence over the field and this should
         // be null
         if (getProperty2a() != null) {
             pw.println();
diff --git a/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java 
b/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java
index 7c5d35d..65e4738 100644
--- a/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java
+++ b/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java
@@ -78,8 +78,7 @@ public class TestEncodingDecoding extends TomcatBaseTest {
         Tomcat tomcat = getTomcatInstance();
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
-        ctx.addApplicationListener(
-                ProgramaticServerEndpointConfig.class.getName());
+        
ctx.addApplicationListener(ProgrammaticServerEndpointConfig.class.getName());
         Tomcat.addServlet(ctx, "default", new DefaultServlet());
         ctx.addServletMapping("/", "default");
 
@@ -704,7 +703,7 @@ public class TestEncodingDecoding extends TomcatBaseTest {
     }
 
 
-    public static class ProgramaticServerEndpointConfig extends 
WsContextListener {
+    public static class ProgrammaticServerEndpointConfig extends 
WsContextListener {
 
         @Override
         public void contextInitialized(ServletContextEvent sce) {
@@ -767,7 +766,7 @@ public class TestEncodingDecoding extends TomcatBaseTest {
         Tomcat tomcat = getTomcatInstance();
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
-        
ctx.addApplicationListener(ProgramaticServerEndpointConfig.class.getName());
+        
ctx.addApplicationListener(ProgrammaticServerEndpointConfig.class.getName());
         Tomcat.addServlet(ctx, "default", new DefaultServlet());
         ctx.addServletMapping("/", "default");
 


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

Reply via email to