SOLR-2019: force Jetty to use insecure randomness source when running tests

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@981265 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2010-08-01 16:38:27 +00:00
parent 99bcf03162
commit 83a36503b2
5 changed files with 13 additions and 0 deletions

View File

@ -436,6 +436,7 @@
<sysproperty key="java.util.logging.config.file" value="${common-solr.dir}/testlogging.properties"/> <sysproperty key="java.util.logging.config.file" value="${common-solr.dir}/testlogging.properties"/>
<sysproperty key="tests.luceneMatchVersion" value="${tests.luceneMatchVersion}"/> <sysproperty key="tests.luceneMatchVersion" value="${tests.luceneMatchVersion}"/>
<sysproperty key="tests.codec" value="${tests.codec}"/> <sysproperty key="tests.codec" value="${tests.codec}"/>
<sysproperty key="jetty.insecurerandom" value="1"/>
<jvmarg line="${dir.prop}"/> <jvmarg line="${dir.prop}"/>
<jvmarg line="${args}"/> <jvmarg line="${args}"/>

View File

@ -151,6 +151,7 @@
dir="src/test/resources/" dir="src/test/resources/"
tempdir="${junit.output.dir}" tempdir="${junit.output.dir}"
> >
<sysproperty key="jetty.insecurerandom" value="1"/>
<formatter type="brief" usefile="false" if="junit.details"/> <formatter type="brief" usefile="false" if="junit.details"/>
<classpath refid="test.classpath"/> <classpath refid="test.classpath"/>
<formatter type="xml"/> <formatter type="xml"/>
@ -191,6 +192,7 @@
failureProperty="tests.failed" failureProperty="tests.failed"
dir="src/extras/test/resources/" dir="src/extras/test/resources/"
> >
<sysproperty key="jetty.insecurerandom" value="1"/>
<formatter type="brief" usefile="false" if="junit.details"/> <formatter type="brief" usefile="false" if="junit.details"/>
<classpath refid="test.extras.classpath"/> <classpath refid="test.extras.classpath"/>
<assertions> <assertions>

View File

@ -99,6 +99,7 @@
dir="src/test/resources/" dir="src/test/resources/"
tempdir="${junit.output.dir}" tempdir="${junit.output.dir}"
> >
<sysproperty key="jetty.insecurerandom" value="1"/>
<formatter type="brief" usefile="false" if="junit.details"/> <formatter type="brief" usefile="false" if="junit.details"/>
<classpath refid="test.classpath"/> <classpath refid="test.classpath"/>
<assertions> <assertions>

View File

@ -19,6 +19,7 @@ package org.apache.solr.client.solrj.embedded;
import java.io.File; import java.io.File;
import java.net.URL; import java.net.URL;
import java.util.Random;
import junit.framework.TestCase; import junit.framework.TestCase;
@ -26,6 +27,7 @@ import org.apache.commons.io.IOUtils;
import org.mortbay.jetty.Connector; import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server; import org.mortbay.jetty.Server;
import org.mortbay.jetty.bio.SocketConnector; import org.mortbay.jetty.bio.SocketConnector;
import org.mortbay.jetty.servlet.HashSessionIdManager;
import org.mortbay.jetty.webapp.WebAppContext; import org.mortbay.jetty.webapp.WebAppContext;
/** /**
@ -52,6 +54,8 @@ public class JettyWebappTest extends TestCase
String path = "../../webapp/web"; String path = "../../webapp/web";
server = new Server(port); server = new Server(port);
// insecure: only use for tests!!!!
server.setSessionIdManager(new HashSessionIdManager(new Random()));
new WebAppContext(server, path, context ); new WebAppContext(server, path, context );
SocketConnector connector = new SocketConnector(); SocketConnector connector = new SocketConnector();

View File

@ -20,6 +20,7 @@ package org.apache.solr.client.solrj.embedded;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.util.Random;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -31,6 +32,7 @@ import org.mortbay.jetty.Server;
import org.mortbay.jetty.Connector; import org.mortbay.jetty.Connector;
import org.mortbay.jetty.servlet.Context; import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.FilterHolder; import org.mortbay.jetty.servlet.FilterHolder;
import org.mortbay.jetty.servlet.HashSessionIdManager;
import org.mortbay.log.Logger; import org.mortbay.log.Logger;
/** /**
@ -75,6 +77,9 @@ public class JettySolrRunner
{ {
this.context = context; this.context = context;
server = new Server( port ); server = new Server( port );
if (System.getProperty("jetty.insecurerandom") != null)
server.setSessionIdManager(new HashSessionIdManager(new Random()));
server.setStopAtShutdown( true ); server.setStopAtShutdown( true );
// Initialize the servlets // Initialize the servlets