Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Erdfelt2015-07-24 18:46:57 +0000
committerJoakim Erdfelt2015-07-24 18:46:57 +0000
commit35f6092011ee4fff3141b16f91f9d886021db69b (patch)
tree0ca73358f9f35985008c35c858e90265e1207437
parent4282d92f309b24e9bf4f3ae6f79b0013e909e8b3 (diff)
downloadorg.eclipse.jetty.project-35f6092011ee4fff3141b16f91f9d886021db69b.tar.gz
org.eclipse.jetty.project-35f6092011ee4fff3141b16f91f9d886021db69b.tar.xz
org.eclipse.jetty.project-35f6092011ee4fff3141b16f91f9d886021db69b.zip
Enabling debugging on CI for symlink quirk
-rw-r--r--jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java8
-rw-r--r--jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppClassLoaderTest.java82
-rw-r--r--jetty-webapp/src/test/resources/jetty-logging.properties2
3 files changed, 17 insertions, 75 deletions
diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java
index 4f796e0e4d..005b361b59 100644
--- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java
+++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java
@@ -257,11 +257,13 @@ public class WebAppClassLoader extends URLClassLoader
File file= resource.getFile();
if (file != null)
{
- URL url= resource.getURL();
+ URL url= resource.getURI().toURL();
addURL(url);
}
else if (resource.isDirectory())
- addURL(resource.getURL());
+ {
+ addURL(resource.getURI().toURL());
+ }
else
{
if (LOG.isDebugEnabled())
@@ -297,6 +299,8 @@ public class WebAppClassLoader extends URLClassLoader
try
{
Resource fn=lib.addPath(files[f]);
+ if(LOG.isDebugEnabled())
+ LOG.debug("addJar - {}", fn);
String fnlc=fn.getName().toLowerCase(Locale.ENGLISH);
// don't check if this is a directory, see Bug 353165
if (isFileSupported(fnlc))
diff --git a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppClassLoaderTest.java b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppClassLoaderTest.java
index 1486cbebfe..81b2edd07c 100644
--- a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppClassLoaderTest.java
+++ b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppClassLoaderTest.java
@@ -22,8 +22,6 @@ import static org.eclipse.jetty.toolchain.test.ExtraMatchers.*;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
-import java.io.PrintWriter;
-import java.io.StringWriter;
import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.IllegalClassFormatException;
import java.net.URI;
@@ -38,7 +36,6 @@ import java.util.List;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.util.resource.PathResource;
import org.eclipse.jetty.util.resource.Resource;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -58,6 +55,8 @@ public class WebAppClassLoaderTest
{
this.testWebappDir = MavenTestingUtils.getProjectDirPath("src/test/webapp");
Resource webapp = new PathResource(testWebappDir);
+
+ System.err.printf("testWebappDir = %s%n", testWebappDir);
_context = new WebAppContext();
_context.setBaseResource(webapp);
@@ -250,7 +249,7 @@ public class WebAppClassLoaderTest
URL targetTestClasses = MavenTestingUtils.getTargetDir().toPath().resolve("test-classes/org/acme/resource.txt").toUri().toURL();
_context.setParentLoaderPriority(false);
- // dump(_context);
+ dump(_context);
resources =Collections.list(_loader.getResources("org/acme/resource.txt"));
expected.clear();
@@ -275,7 +274,7 @@ public class WebAppClassLoaderTest
expected.add(webappWebInfLibAcme);
expected.add(webappWebInfClasses);
- assertOrdered("Resources Found (Parent Loader Priority == true)",expected,resources);
+ assertThat("Resources Found (Parent Loader Priority == true)",resources,ordered(expected));
// dump(resources);
// assertEquals(3,resources.size());
@@ -297,7 +296,7 @@ public class WebAppClassLoaderTest
expected.add(webappWebInfLibAcme);
expected.add(webappWebInfClasses);
- assertOrdered("Resources Found (Parent Loader Priority == true) (with serverClasses filtering)",expected,resources);
+ assertThat("Resources Found (Parent Loader Priority == true) (with serverClasses filtering)",resources,ordered(expected));
// dump(resources);
// assertEquals(2,resources.size());
@@ -318,7 +317,7 @@ public class WebAppClassLoaderTest
expected.clear();
expected.add(targetTestClasses);
- assertOrdered("Resources Found (Parent Loader Priority == true) (with systemClasses filtering)",expected,resources);
+ assertThat("Resources Found (Parent Loader Priority == true) (with systemClasses filtering)",resources,ordered(expected));
// dump(resources);
// assertEquals(1,resources.size());
@@ -327,11 +326,11 @@ public class WebAppClassLoaderTest
private void dump(WebAppContext wac)
{
- System.err.println("--Dump WebAppContext - "+wac);
+ System.err.println("--Dump WebAppContext - " + wac);
System.err.printf(" context.getClass().getClassLoader() = %s%n",wac.getClass().getClassLoader());
- dumpClassLoaderHierarchy(" ", wac.getClass().getClassLoader());
+ dumpClassLoaderHierarchy(" ",wac.getClass().getClassLoader());
System.err.printf(" context.getClassLoader() = %s%n",wac.getClassLoader());
- dumpClassLoaderHierarchy(" ", wac.getClassLoader());
+ dumpClassLoaderHierarchy(" ",wac.getClassLoader());
}
private void dumpClassLoaderHierarchy(String indent, ClassLoader classLoader)
@@ -365,67 +364,4 @@ public class WebAppClassLoaderTest
System.err.printf(" \"%s\"%n",url);
}
}
-
- /**
- * Developer Friendly list order assertion, with clear error messages indicating the full state of the expected and actual lists, along with highlighting of the problem areas.
- * @param msg the message in case of error
- * @param expectedList the expected list
- * @param actualList the actual list
- */
- public static void assertOrdered(String msg, List<?> expectedList, List<?> actualList)
- {
- // same size?
- boolean mismatch = expectedList.size() != actualList.size();
-
- // test content
- List<Integer> badEntries = new ArrayList<>();
- int min = Math.min(expectedList.size(),actualList.size());
- int max = Math.max(expectedList.size(),actualList.size());
- for (int i = 0; i < min; i++)
- {
- if (!expectedList.get(i).equals(actualList.get(i)))
- {
- badEntries.add(i);
- }
- }
- for (int i = min; i < max; i++)
- {
- badEntries.add(i);
- }
-
- if (mismatch || badEntries.size() > 0)
- {
- // build up detailed error message
- StringWriter message = new StringWriter();
- PrintWriter err = new PrintWriter(message);
-
- err.printf("%s: Assert Contains (Ordered)",msg);
- if (mismatch)
- {
- err.print(" [size mismatch]");
- }
- if (badEntries.size() >= 0)
- {
- err.printf(" [%d entries not matched]",badEntries.size());
- }
- err.println();
- err.printf("Actual Entries (size: %d)%n",actualList.size());
- for (int i = 0; i < actualList.size(); i++)
- {
- Object actualObj = actualList.get(i);
- char indicator = badEntries.contains(i)?'>':' ';
- err.printf("%s[%d] %s%n",indicator,i,actualObj==null?"<null>":actualObj.toString());
- }
-
- err.printf("Expected Entries (size: %d)%n",expectedList.size());
- for (int i = 0; i < expectedList.size(); i++)
- {
- Object expectedObj = expectedList.get(i).toString();
- char indicator = badEntries.contains(i)?'>':' ';
- err.printf("%s[%d] %s%n",indicator,i,expectedObj==null?"<null>":expectedObj.toString());
- }
- err.flush();
- Assert.fail(message.toString());
- }
- }
}
diff --git a/jetty-webapp/src/test/resources/jetty-logging.properties b/jetty-webapp/src/test/resources/jetty-logging.properties
index 23764fb542..916756286e 100644
--- a/jetty-webapp/src/test/resources/jetty-logging.properties
+++ b/jetty-webapp/src/test/resources/jetty-logging.properties
@@ -1,4 +1,6 @@
# Setup default logging implementation for during testing
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
+org.eclipse.jetty.LEVEL=INFO
+org.eclipse.jetty.webapp.WebAppClassLoader.LEVEL=DEBUG
# org.eclipse.jetty.util.LEVEL=DEBUG
# org.eclipse.jetty.util.PathWatcher.Noisy.LEVEL=OFF

Back to the top