JDK5 build fix with Resource caching and path lookups

This commit is contained in:
Joakim Erdfelt 2013-06-04 10:42:32 -07:00
parent 559069cdd6
commit 4b458792c9
2 changed files with 14 additions and 17 deletions

View File

@ -18,9 +18,7 @@
package org.eclipse.jetty.server.session; package org.eclipse.jetty.server.session;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.*;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
@ -32,35 +30,32 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.client.ContentExchange; import org.eclipse.jetty.client.ContentExchange;
import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.http.HttpMethods; import org.eclipse.jetty.http.HttpMethods;
import org.eclipse.jetty.util.IO; import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.toolchain.test.TestingDir;
import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.StdErrLog; import org.eclipse.jetty.util.log.StdErrLog;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.webapp.WebAppContext; import org.eclipse.jetty.webapp.WebAppContext;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
/** /**
* ReloadedSessionMissingClassTest * ReloadedSessionMissingClassTest
*
*
*
*/ */
public class ReloadedSessionMissingClassTest public class ReloadedSessionMissingClassTest
{ {
@Rule
public TestingDir testdir = new TestingDir();
@Test @Test
public void testSessionReloadWithMissingClass() throws Exception public void testSessionReloadWithMissingClass() throws Exception
{ {
((StdErrLog)Log.getLogger(org.eclipse.jetty.server.session.JDBCSessionManager.class)).setHideStacks(true); ((StdErrLog)Log.getLogger(org.eclipse.jetty.server.session.JDBCSessionManager.class)).setHideStacks(true);
Resource.setDefaultUseCaches(false);
String contextPath = "/foo"; String contextPath = "/foo";
File srcDir = new File(System.getProperty("basedir"), "src");
File targetDir = new File(System.getProperty("basedir"), "target");
File testDir = new File (srcDir, "test");
File resourcesDir = new File (testDir, "resources");
File unpackedWarDir = new File (targetDir, "foo"); File unpackedWarDir = testdir.getDir();
if (unpackedWarDir.exists()) testdir.ensureEmpty();
IO.delete(unpackedWarDir);
unpackedWarDir.mkdir();
File webInfDir = new File (unpackedWarDir, "WEB-INF"); File webInfDir = new File (unpackedWarDir, "WEB-INF");
webInfDir.mkdir(); webInfDir.mkdir();
@ -81,8 +76,8 @@ public class ReloadedSessionMissingClassTest
w.write(xml); w.write(xml);
w.close(); w.close();
File foobarJar = new File (resourcesDir, "foobar.jar"); File foobarJar = MavenTestingUtils.getTestResourceFile("foobar.jar");
File foobarNOfooJar = new File (resourcesDir, "foobarNOfoo.jar"); File foobarNOfooJar = MavenTestingUtils.getTestResourceFile("foobarNOfoo.jar");
URL[] foobarUrls = new URL[]{foobarJar.toURI().toURL()}; URL[] foobarUrls = new URL[]{foobarJar.toURI().toURL()};
URL[] barUrls = new URL[]{foobarNOfooJar.toURI().toURL()}; URL[] barUrls = new URL[]{foobarNOfooJar.toURI().toURL()};

View File

@ -18,6 +18,7 @@
package org.eclipse.jetty.server.session; package org.eclipse.jetty.server.session;
import org.eclipse.jetty.util.resource.Resource;
import org.junit.Test; import org.junit.Test;
/** /**
@ -30,6 +31,7 @@ public class WebAppObjectInSessionTest extends AbstractWebAppObjectInSessionTest
public AbstractTestServer createServer(int port) public AbstractTestServer createServer(int port)
{ {
Resource.setDefaultUseCaches(false);
return new JdbcTestServer(port); return new JdbcTestServer(port);
} }