jetty-9 jetty-deployer passing tests
This commit is contained in:
parent
98a7f19ff9
commit
792509d459
|
@ -90,11 +90,12 @@
|
|||
<version>${project.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-websocket</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependency> -->
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -33,7 +33,7 @@ import java.util.Map;
|
|||
import java.util.Properties;
|
||||
|
||||
import org.eclipse.jetty.deploy.DeploymentManager;
|
||||
import org.eclipse.jetty.http.HttpSchemes;
|
||||
import org.eclipse.jetty.http.HttpScheme;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
|
@ -56,7 +56,7 @@ public class XmlConfiguredJetty
|
|||
private Map<String,String> _properties = new HashMap<String,String>();
|
||||
private Server _server;
|
||||
private int _serverPort;
|
||||
private String _scheme = HttpSchemes.HTTP;
|
||||
private String _scheme = HttpScheme.HTTP.asString();
|
||||
private File _jettyHome;
|
||||
|
||||
public XmlConfiguredJetty(TestingDir testdir) throws IOException
|
||||
|
@ -408,15 +408,15 @@ public class XmlConfiguredJetty
|
|||
_server.start();
|
||||
|
||||
// Find the active server port.
|
||||
this._serverPort = (-1);
|
||||
_serverPort = -1;
|
||||
Connector connectors[] = _server.getConnectors();
|
||||
for (int i = 0; i < connectors.length; i++)
|
||||
for (int i = 0; _serverPort<0 && i < connectors.length; i++)
|
||||
{
|
||||
Connector connector = connectors[i];
|
||||
if (connector.getLocalPort() > 0)
|
||||
if (connectors[i] instanceof Connector.NetConnector)
|
||||
{
|
||||
this._serverPort = connector.getLocalPort();
|
||||
break;
|
||||
int port = ((Connector.NetConnector)connectors[i]).getLocalPort();
|
||||
if (port>0)
|
||||
_serverPort=port;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
|
||||
|
||||
<Configure id="Server" class="org.eclipse.jetty.server.Server">
|
||||
|
||||
<Call name="addLifeCycle">
|
||||
<Call name="addBean">
|
||||
<Arg>
|
||||
<New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
|
||||
<Set name="contexts">
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
<!-- Default queued blocking threadpool
|
||||
-->
|
||||
<New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
|
||||
<Set name="minThreads">10</Set>
|
||||
<Set name="maxThreads">200</Set>
|
||||
<Set name="minThreads">10</Set>
|
||||
</New>
|
||||
|
||||
<!-- Optional Java 5 bounded threadpool with job queue
|
||||
|
@ -40,11 +40,7 @@
|
|||
<Set name="host"></Set>
|
||||
<Set name="port">0</Set>
|
||||
<Set name="maxIdleTime">300000</Set>
|
||||
<Set name="Acceptors">2</Set>
|
||||
<Set name="statsOn">false</Set>
|
||||
<Set name="confidentialPort">8443</Set>
|
||||
<Set name="lowResourcesConnections">20000</Set>
|
||||
<Set name="lowResourcesMaxIdleTime">5000</Set>
|
||||
</New>
|
||||
</Arg>
|
||||
</Call>
|
||||
|
|
|
@ -83,7 +83,7 @@ public class StressTest
|
|||
@BeforeClass
|
||||
public static void init() throws Exception
|
||||
{
|
||||
_threads = new QueuedThreadPool(new BlockingArrayQueue<Runnable>(4,4));
|
||||
_threads = new QueuedThreadPool();
|
||||
_threads.setMaxThreads(200);
|
||||
|
||||
_server = new Server();
|
||||
|
|
|
@ -47,8 +47,8 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo
|
|||
private BlockingQueue<Runnable> _jobs;
|
||||
private String _name;
|
||||
private int _maxIdleTimeMs=60000;
|
||||
private int _maxThreads=254;
|
||||
private int _minThreads=8;
|
||||
private int _maxThreads;
|
||||
private int _minThreads;
|
||||
private int _maxQueued=-1;
|
||||
private int _priority=Thread.NORM_PRIORITY;
|
||||
private boolean _daemon=false;
|
||||
|
@ -60,7 +60,7 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo
|
|||
*/
|
||||
public QueuedThreadPool()
|
||||
{
|
||||
_name="qtp"+super.hashCode();
|
||||
this(200,8,60000);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
|
@ -68,20 +68,27 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo
|
|||
*/
|
||||
public QueuedThreadPool(int maxThreads)
|
||||
{
|
||||
this();
|
||||
setMaxThreads(maxThreads);
|
||||
this(maxThreads,8,60000);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
/** Construct
|
||||
*/
|
||||
public QueuedThreadPool(BlockingQueue<Runnable> jobQ)
|
||||
public QueuedThreadPool(int maxThreads, int minThreads)
|
||||
{
|
||||
this();
|
||||
_jobs=jobQ;
|
||||
_jobs.clear();
|
||||
this(maxThreads,8,60000);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
/** Construct
|
||||
*/
|
||||
public QueuedThreadPool(int maxThreads, int minThreads, int maxIdleTimeMs)
|
||||
{
|
||||
_name="qtp"+super.hashCode();
|
||||
setMaxThreads(minThreads);
|
||||
setMaxThreads(maxThreads);
|
||||
setMaxIdleTimeMs(maxIdleTimeMs);
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
|
|
|
@ -992,7 +992,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
case WebFragment:
|
||||
{
|
||||
//a web-fragment set the value, all web-fragments must have the same value
|
||||
if (!context.getMimeTypes().getMimeByExtension("."+extension).equals(context.getMimeTypes().CACHE.lookup(mimeType)))
|
||||
if (!context.getMimeTypes().getMimeByExtension("."+extension).equals(mimeType))
|
||||
throw new IllegalStateException("Conflicting mime-type "+mimeType+" for extension "+extension+" in "+descriptor.getResource());
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -595,19 +595,25 @@ public class WebInfConfiguration extends AbstractConfiguration
|
|||
if (connectors.length>0)
|
||||
{
|
||||
//Get the host
|
||||
String host = (connectors==null||connectors[0]==null?"":connectors[0].getHost());
|
||||
String host=null;
|
||||
int port=0;
|
||||
if (connectors!=null && (connectors[0] instanceof Connector.NetConnector))
|
||||
{
|
||||
Connector.NetConnector connector = (Connector.NetConnector)connectors[0];
|
||||
host=connector.getHost();
|
||||
port=connector.getLocalPort();
|
||||
if (port < 0)
|
||||
port = connector.getPort();
|
||||
}
|
||||
if (host == null)
|
||||
host = "0.0.0.0";
|
||||
canonicalName.append(host);
|
||||
|
||||
//Get the port
|
||||
canonicalName.append("-");
|
||||
//try getting the real port being listened on
|
||||
int port = (connectors==null||connectors[0]==null?0:connectors[0].getLocalPort());
|
||||
|
||||
//if not available (eg no connectors or connector not started),
|
||||
//try getting one that was configured.
|
||||
if (port < 0)
|
||||
port = connectors[0].getPort();
|
||||
canonicalName.append(port);
|
||||
canonicalName.append("-");
|
||||
}
|
||||
|
|
|
@ -296,12 +296,14 @@ public class XmlConfiguration
|
|||
/* ------------------------------------------------------------ */
|
||||
private static class JettyXmlConfiguration implements ConfigurationProcessor
|
||||
{
|
||||
XmlParser.Node _config;
|
||||
Map<String, Object> _idMap;
|
||||
Map<String, String> _propertyMap;
|
||||
private String _url;
|
||||
private XmlParser.Node _config;
|
||||
private Map<String, Object> _idMap;
|
||||
private Map<String, String> _propertyMap;
|
||||
|
||||
public void init(URL url, XmlParser.Node config, Map<String, Object> idMap, Map<String, String> properties)
|
||||
{
|
||||
_url=url.toString();
|
||||
_config=config;
|
||||
_idMap=idMap;
|
||||
_propertyMap=properties;
|
||||
|
@ -315,7 +317,7 @@ public class XmlConfiguration
|
|||
if (oClass != null && !oClass.isInstance(obj))
|
||||
{
|
||||
String loaders = (oClass.getClassLoader()==obj.getClass().getClassLoader())?"":"Object Class and type Class are from different loaders.";
|
||||
throw new IllegalArgumentException("Object of class '"+obj.getClass().getCanonicalName()+"' is not of type '" + oClass.getCanonicalName()+"'. "+loaders);
|
||||
throw new IllegalArgumentException("Object of class '"+obj.getClass().getCanonicalName()+"' is not of type '" + oClass.getCanonicalName()+"'. "+loaders+" in "+_url);
|
||||
}
|
||||
configure(obj,_config,0);
|
||||
return obj;
|
||||
|
@ -333,7 +335,7 @@ public class XmlConfiguration
|
|||
obj = oClass.newInstance();
|
||||
|
||||
if (oClass != null && !oClass.isInstance(obj))
|
||||
throw new ClassCastException(oClass.toString());
|
||||
throw new ClassCastException(oClass.toString()+" in "+_url);
|
||||
|
||||
configure(obj,_config,0);
|
||||
return obj;
|
||||
|
@ -391,11 +393,11 @@ public class XmlConfiguration
|
|||
else if ("Property".equals(tag))
|
||||
propertyObj(obj,node);
|
||||
else
|
||||
throw new IllegalStateException("Unknown tag: " + tag);
|
||||
throw new IllegalStateException("Unknown tag: " + tag+" in "+_url);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOG.warn("Config error at " + node,e.toString());
|
||||
LOG.warn("Config error at " + node,e.toString()+" in "+_url);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
6
pom.xml
6
pom.xml
|
@ -344,18 +344,18 @@
|
|||
<module>jetty-jmx</module>
|
||||
<module>jetty-io</module>
|
||||
<module>jetty-http</module>
|
||||
<module>jetty-websocket</module>
|
||||
<module>jetty-continuation</module>
|
||||
<module>jetty-server</module>
|
||||
<module>jetty-xml</module>
|
||||
<module>jetty-security</module>
|
||||
<module>jetty-servlet</module>
|
||||
<module>jetty-webapp</module>
|
||||
<module>jetty-deploy</module>
|
||||
<!--
|
||||
<module>jetty-websocket</module>
|
||||
<module>jetty-jaspi</module>
|
||||
<module>jetty-client</module>
|
||||
<module>jetty-webapp</module>
|
||||
<module>jetty-servlets</module>
|
||||
<module>jetty-deploy</module>
|
||||
<module>jetty-ajp</module>
|
||||
<module>jetty-jndi</module>
|
||||
<module>jetty-annotations</module>
|
||||
|
|
Loading…
Reference in New Issue