jetty-9 relocated test webapp
This commit is contained in:
parent
97d2130a8f
commit
f21b74dcb1
|
@ -1,9 +1,9 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
<artifactId>jetty-project</artifactId>
|
<artifactId>examples-parent</artifactId>
|
||||||
<version>9.0.0-SNAPSHOT</version>
|
<version>9.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
<artifactId>jetty-project</artifactId>
|
<artifactId>examples-parent</artifactId>
|
||||||
<version>9.0.0-SNAPSHOT</version>
|
<version>9.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>example-jetty-embedded</artifactId>
|
<artifactId>example-jetty-embedded</artifactId>
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
// ========================================================================
|
||||||
|
// Copyright (c) Webtide LLC
|
||||||
|
//
|
||||||
|
// All rights reserved. This program and the accompanying materials
|
||||||
|
// are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
// and Apache License v2.0 which accompanies this distribution.
|
||||||
|
//
|
||||||
|
// The Eclipse Public License is available at
|
||||||
|
// http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
//
|
||||||
|
// The Apache License v2.0 is available at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0.txt
|
||||||
|
//
|
||||||
|
// You may elect to redistribute this code under either of these licenses.
|
||||||
|
// ========================================================================
|
||||||
|
-->
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
<artifactId>jetty-project</artifactId>
|
||||||
|
<version>9.0.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
<artifactId>examples-parent</artifactId>
|
||||||
|
<name>Jetty Examples :: Parent</name>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>findbugs-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<!-- No Point running Findbugs on example projects -->
|
||||||
|
<skip>true</skip>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<modules>
|
||||||
|
<module>async-rest</module>
|
||||||
|
<module>embedded</module>
|
||||||
|
</modules>
|
||||||
|
</project>
|
9
pom.xml
9
pom.xml
|
@ -392,8 +392,6 @@
|
||||||
<module>jetty-websocket</module>
|
<module>jetty-websocket</module>
|
||||||
<module>jetty-servlets</module>
|
<module>jetty-servlets</module>
|
||||||
<module>jetty-util-ajax</module>
|
<module>jetty-util-ajax</module>
|
||||||
<module>test-continuation</module>
|
|
||||||
<module>test-jetty-webapp</module>
|
|
||||||
<module>jetty-maven-plugin</module>
|
<module>jetty-maven-plugin</module>
|
||||||
<module>jetty-jspc-maven-plugin</module>
|
<module>jetty-jspc-maven-plugin</module>
|
||||||
<module>jetty-deploy</module>
|
<module>jetty-deploy</module>
|
||||||
|
@ -404,17 +402,15 @@
|
||||||
<module>jetty-jndi</module>
|
<module>jetty-jndi</module>
|
||||||
<module>jetty-jsp</module>
|
<module>jetty-jsp</module>
|
||||||
<module>jetty-jaas</module>
|
<module>jetty-jaas</module>
|
||||||
<module>jetty-distribution</module>
|
|
||||||
<module>jetty-spring</module>
|
<module>jetty-spring</module>
|
||||||
<module>jetty-client</module>
|
<module>jetty-client</module>
|
||||||
<module>jetty-jaspi</module>
|
<module>jetty-jaspi</module>
|
||||||
<module>jetty-osgi</module>
|
<module>jetty-osgi</module>
|
||||||
<module>examples/embedded</module>
|
|
||||||
<module>examples/async-rest</module>
|
|
||||||
<module>jetty-rewrite</module>
|
<module>jetty-rewrite</module>
|
||||||
<module>jetty-nosql</module>
|
<module>jetty-nosql</module>
|
||||||
|
<module>examples</module>
|
||||||
<module>tests</module>
|
<module>tests</module>
|
||||||
<!--module>dists</module-->
|
<module>jetty-distribution</module>
|
||||||
|
|
||||||
<!-- modules that need fixed and added back, or simply dropped and not maintained
|
<!-- modules that need fixed and added back, or simply dropped and not maintained
|
||||||
<module>tests</module>
|
<module>tests</module>
|
||||||
|
@ -425,7 +421,6 @@
|
||||||
<module>jetty-nested</module>
|
<module>jetty-nested</module>
|
||||||
<module>jetty-overlay-deployer</module>
|
<module>jetty-overlay-deployer</module>
|
||||||
<module>jetty-http-spi</module>
|
<module>jetty-http-spi</module>
|
||||||
<module>test-jetty-nested</module>
|
|
||||||
-->
|
-->
|
||||||
</modules>
|
</modules>
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
Manifest-Version: 1.0
|
|
||||||
Bundle-ManifestVersion: 2
|
|
||||||
Bundle-Name: TestIt
|
|
||||||
Bundle-SymbolicName: TestIt
|
|
||||||
Bundle-Version: 1.0.0.qualifier
|
|
||||||
Bundle-Activator: testit.Activator
|
|
||||||
Import-Package: javax.servlet;version="2.6",
|
|
||||||
javax.servlet.http;version="2.6",
|
|
||||||
javax.servlet.jsp,
|
|
||||||
javax.servlet.jsp.tagext
|
|
||||||
Require-Bundle: org.eclipse.jetty.client,
|
|
||||||
org.eclipse.jetty.continuation,
|
|
||||||
org.eclipse.jetty.http,
|
|
||||||
org.eclipse.jetty.io,
|
|
||||||
org.eclipse.jetty.servlets,
|
|
||||||
org.eclipse.jetty.util,
|
|
||||||
org.eclipse.jetty.websocket
|
|
||||||
Bundle-ClassPath: WEB-INF/classes
|
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
|
||||||
Bundle-ActivationPolicy: lazy
|
|
||||||
Web-ContextPath: /
|
|
||||||
Class-Path:
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
<artifactId>jetty-project</artifactId>
|
<artifactId>jetty-project</artifactId>
|
||||||
<version>9.0.0-SNAPSHOT</version>
|
<version>9.0.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>org.eclipse.jetty.tests</groupId>
|
<groupId>org.eclipse.jetty.tests</groupId>
|
||||||
<artifactId>tests-parent</artifactId>
|
<artifactId>tests-parent</artifactId>
|
||||||
|
@ -40,11 +41,10 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<modules>
|
<modules>
|
||||||
<!--
|
<!--module>test-integration</module-->
|
||||||
<module>test-integration</module>
|
|
||||||
-->
|
|
||||||
<module>test-webapps</module>
|
<module>test-webapps</module>
|
||||||
<module>test-sessions</module>
|
<module>test-sessions</module>
|
||||||
|
<module>test-continuation</module>
|
||||||
<!--
|
<!--
|
||||||
<module>test-loginservice</module>
|
<module>test-loginservice</module>
|
||||||
-->
|
-->
|
||||||
|
|
|
@ -1,8 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
// ========================================================================
|
||||||
|
// Copyright (c) Webtide LLC
|
||||||
|
//
|
||||||
|
// All rights reserved. This program and the accompanying materials
|
||||||
|
// are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
// and Apache License v2.0 which accompanies this distribution.
|
||||||
|
//
|
||||||
|
// The Eclipse Public License is available at
|
||||||
|
// http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
//
|
||||||
|
// The Apache License v2.0 is available at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0.txt
|
||||||
|
//
|
||||||
|
// You may elect to redistribute this code under either of these licenses.
|
||||||
|
// ========================================================================
|
||||||
|
-->
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty.tests</groupId>
|
||||||
<artifactId>jetty-project</artifactId>
|
<artifactId>tests-parent</artifactId>
|
||||||
<version>9.0.0-SNAPSHOT</version>
|
<version>9.0.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>test-continuation</artifactId>
|
<artifactId>test-continuation</artifactId>
|
|
@ -100,11 +100,6 @@
|
||||||
<artifactId>jetty-client</artifactId>
|
<artifactId>jetty-client</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
|
||||||
<artifactId>jetty-monitor</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||||
<artifactId>jetty-test-helper</artifactId>
|
<artifactId>jetty-test-helper</artifactId>
|
||||||
|
|
|
@ -26,7 +26,7 @@ import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.jetty.http.HttpSchemes;
|
import org.eclipse.jetty.http.HttpScheme;
|
||||||
import org.eclipse.jetty.test.support.TestableJettyServer;
|
import org.eclipse.jetty.test.support.TestableJettyServer;
|
||||||
import org.eclipse.jetty.test.support.rawhttp.HttpRequestTester;
|
import org.eclipse.jetty.test.support.rawhttp.HttpRequestTester;
|
||||||
import org.eclipse.jetty.test.support.rawhttp.HttpResponseTester;
|
import org.eclipse.jetty.test.support.rawhttp.HttpResponseTester;
|
||||||
|
@ -53,7 +53,7 @@ public class DefaultHandlerTest
|
||||||
public static void setUpServer() throws Exception
|
public static void setUpServer() throws Exception
|
||||||
{
|
{
|
||||||
server = new TestableJettyServer();
|
server = new TestableJettyServer();
|
||||||
server.setScheme(HttpSchemes.HTTP);
|
server.setScheme(HttpScheme.HTTP.asString());
|
||||||
server.addConfiguration("DefaultHandler.xml");
|
server.addConfiguration("DefaultHandler.xml");
|
||||||
|
|
||||||
server.load();
|
server.load();
|
||||||
|
|
|
@ -29,22 +29,18 @@ import javax.servlet.http.HttpServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.eclipse.jetty.client.ContentExchange;
|
|
||||||
import org.eclipse.jetty.client.HttpClient;
|
import org.eclipse.jetty.client.HttpClient;
|
||||||
import org.eclipse.jetty.client.security.Realm;
|
|
||||||
import org.eclipse.jetty.client.security.SimpleRealmResolver;
|
|
||||||
import org.eclipse.jetty.http.HttpMethods;
|
|
||||||
import org.eclipse.jetty.io.ByteArrayBuffer;
|
|
||||||
import org.eclipse.jetty.security.ConstraintMapping;
|
import org.eclipse.jetty.security.ConstraintMapping;
|
||||||
import org.eclipse.jetty.security.ConstraintSecurityHandler;
|
import org.eclipse.jetty.security.ConstraintSecurityHandler;
|
||||||
import org.eclipse.jetty.security.HashLoginService;
|
import org.eclipse.jetty.security.HashLoginService;
|
||||||
import org.eclipse.jetty.security.authentication.DigestAuthenticator;
|
import org.eclipse.jetty.security.authentication.DigestAuthenticator;
|
||||||
import org.eclipse.jetty.server.Connector;
|
import org.eclipse.jetty.server.Connector;
|
||||||
import org.eclipse.jetty.server.Handler;
|
import org.eclipse.jetty.server.Handler;
|
||||||
|
import org.eclipse.jetty.server.NetworkConnector;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
|
import org.eclipse.jetty.server.ServerConnector;
|
||||||
import org.eclipse.jetty.server.handler.DefaultHandler;
|
import org.eclipse.jetty.server.handler.DefaultHandler;
|
||||||
import org.eclipse.jetty.server.handler.HandlerCollection;
|
import org.eclipse.jetty.server.handler.HandlerCollection;
|
||||||
import org.eclipse.jetty.server.nio.SelectChannelConnector;
|
|
||||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
import org.eclipse.jetty.util.IO;
|
import org.eclipse.jetty.util.IO;
|
||||||
import org.eclipse.jetty.util.StringUtil;
|
import org.eclipse.jetty.util.StringUtil;
|
||||||
|
@ -80,8 +76,7 @@ public class DigestPostTest
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_server = new Server();
|
_server = new Server();
|
||||||
_server.setConnectors(new Connector[]
|
_server.setConnectors(new Connector[] { new ServerConnector(_server) });
|
||||||
{ new SelectChannelConnector() });
|
|
||||||
|
|
||||||
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SECURITY);
|
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SECURITY);
|
||||||
context.setContextPath("/test");
|
context.setContextPath("/test");
|
||||||
|
@ -125,13 +120,13 @@ public class DigestPostTest
|
||||||
@Test
|
@Test
|
||||||
public void testServerDirectlyHTTP10() throws Exception
|
public void testServerDirectlyHTTP10() throws Exception
|
||||||
{
|
{
|
||||||
Socket socket = new Socket("127.0.0.1",_server.getConnectors()[0].getLocalPort());
|
Socket socket = new Socket("127.0.0.1",((NetworkConnector)_server.getConnectors()[0]).getLocalPort());
|
||||||
byte[] bytes = __message.getBytes("UTF-8");
|
byte[] bytes = __message.getBytes("UTF-8");
|
||||||
|
|
||||||
_received=null;
|
_received=null;
|
||||||
socket.getOutputStream().write(
|
socket.getOutputStream().write(
|
||||||
("POST /test/ HTTP/1.0\r\n"+
|
("POST /test/ HTTP/1.0\r\n"+
|
||||||
"Host: 127.0.0.1:"+_server.getConnectors()[0].getLocalPort()+"\r\n"+
|
"Host: 127.0.0.1:"+((NetworkConnector)_server.getConnectors()[0]).getLocalPort()+"\r\n"+
|
||||||
"Content-Length: "+bytes.length+"\r\n"+
|
"Content-Length: "+bytes.length+"\r\n"+
|
||||||
"\r\n").getBytes("UTF-8"));
|
"\r\n").getBytes("UTF-8"));
|
||||||
socket.getOutputStream().write(bytes);
|
socket.getOutputStream().write(bytes);
|
||||||
|
@ -152,12 +147,12 @@ public class DigestPostTest
|
||||||
"\" qop=auth nc="+NC+" cnonce=\""+cnonce+"\"";
|
"\" qop=auth nc="+NC+" cnonce=\""+cnonce+"\"";
|
||||||
|
|
||||||
|
|
||||||
socket = new Socket("127.0.0.1",_server.getConnectors()[0].getLocalPort());
|
socket = new Socket("127.0.0.1",((NetworkConnector)_server.getConnectors()[0]).getLocalPort());
|
||||||
|
|
||||||
_received=null;
|
_received=null;
|
||||||
socket.getOutputStream().write(
|
socket.getOutputStream().write(
|
||||||
("POST /test/ HTTP/1.0\r\n"+
|
("POST /test/ HTTP/1.0\r\n"+
|
||||||
"Host: 127.0.0.1:"+_server.getConnectors()[0].getLocalPort()+"\r\n"+
|
"Host: 127.0.0.1:"+((NetworkConnector)_server.getConnectors()[0]).getLocalPort()+"\r\n"+
|
||||||
"Content-Length: "+bytes.length+"\r\n"+
|
"Content-Length: "+bytes.length+"\r\n"+
|
||||||
"Authorization: "+digest+"\r\n"+
|
"Authorization: "+digest+"\r\n"+
|
||||||
"\r\n").getBytes("UTF-8"));
|
"\r\n").getBytes("UTF-8"));
|
||||||
|
@ -173,13 +168,13 @@ public class DigestPostTest
|
||||||
@Test
|
@Test
|
||||||
public void testServerDirectlyHTTP11() throws Exception
|
public void testServerDirectlyHTTP11() throws Exception
|
||||||
{
|
{
|
||||||
Socket socket = new Socket("127.0.0.1",_server.getConnectors()[0].getLocalPort());
|
Socket socket = new Socket("127.0.0.1",((NetworkConnector)_server.getConnectors()[0]).getLocalPort());
|
||||||
byte[] bytes = __message.getBytes("UTF-8");
|
byte[] bytes = __message.getBytes("UTF-8");
|
||||||
|
|
||||||
_received=null;
|
_received=null;
|
||||||
socket.getOutputStream().write(
|
socket.getOutputStream().write(
|
||||||
("POST /test/ HTTP/1.1\r\n"+
|
("POST /test/ HTTP/1.1\r\n"+
|
||||||
"Host: 127.0.0.1:"+_server.getConnectors()[0].getLocalPort()+"\r\n"+
|
"Host: 127.0.0.1:"+((NetworkConnector)_server.getConnectors()[0]).getLocalPort()+"\r\n"+
|
||||||
"Content-Length: "+bytes.length+"\r\n"+
|
"Content-Length: "+bytes.length+"\r\n"+
|
||||||
"\r\n").getBytes("UTF-8"));
|
"\r\n").getBytes("UTF-8"));
|
||||||
socket.getOutputStream().write(bytes);
|
socket.getOutputStream().write(bytes);
|
||||||
|
@ -206,7 +201,7 @@ public class DigestPostTest
|
||||||
_received=null;
|
_received=null;
|
||||||
socket.getOutputStream().write(
|
socket.getOutputStream().write(
|
||||||
("POST /test/ HTTP/1.0\r\n"+
|
("POST /test/ HTTP/1.0\r\n"+
|
||||||
"Host: 127.0.0.1:"+_server.getConnectors()[0].getLocalPort()+"\r\n"+
|
"Host: 127.0.0.1:"+((NetworkConnector)_server.getConnectors()[0]).getLocalPort()+"\r\n"+
|
||||||
"Content-Length: "+bytes.length+"\r\n"+
|
"Content-Length: "+bytes.length+"\r\n"+
|
||||||
"Authorization: "+digest+"\r\n"+
|
"Authorization: "+digest+"\r\n"+
|
||||||
"\r\n").getBytes("UTF-8"));
|
"\r\n").getBytes("UTF-8"));
|
||||||
|
|
|
@ -1,171 +0,0 @@
|
||||||
//
|
|
||||||
// ========================================================================
|
|
||||||
// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
|
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
// All rights reserved. This program and the accompanying materials
|
|
||||||
// are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
// and Apache License v2.0 which accompanies this distribution.
|
|
||||||
//
|
|
||||||
// The Eclipse Public License is available at
|
|
||||||
// http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
//
|
|
||||||
// The Apache License v2.0 is available at
|
|
||||||
// http://www.opensource.org/licenses/apache2.0.php
|
|
||||||
//
|
|
||||||
// You may elect to redistribute this code under either of these licenses.
|
|
||||||
// ========================================================================
|
|
||||||
//
|
|
||||||
|
|
||||||
package org.eclipse.jetty.test.monitor;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.client.ContentExchange;
|
|
||||||
import org.eclipse.jetty.client.HttpClient;
|
|
||||||
import org.eclipse.jetty.http.HttpMethods;
|
|
||||||
import org.eclipse.jetty.http.HttpStatus;
|
|
||||||
import org.eclipse.jetty.monitor.JMXMonitor;
|
|
||||||
import org.eclipse.jetty.toolchain.test.JettyDistro;
|
|
||||||
import org.eclipse.jetty.toolchain.test.PropertyFlag;
|
|
||||||
import org.eclipse.jetty.util.log.Log;
|
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
|
||||||
import org.eclipse.jetty.util.resource.Resource;
|
|
||||||
import org.eclipse.jetty.util.thread.ExecutorThreadPool;
|
|
||||||
import org.eclipse.jetty.util.thread.ThreadPool;
|
|
||||||
import org.eclipse.jetty.xml.XmlConfiguration;
|
|
||||||
import org.junit.AfterClass;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public class JavaMonitorIntegrationTest
|
|
||||||
{
|
|
||||||
private static final Logger LOG = Log.getLogger(JavaMonitorIntegrationTest.class);
|
|
||||||
|
|
||||||
private static JettyDistro jetty;
|
|
||||||
|
|
||||||
@BeforeClass
|
|
||||||
public static void initJetty() throws Exception
|
|
||||||
{
|
|
||||||
PropertyFlag.assume("JAVAMONITOR");
|
|
||||||
|
|
||||||
jetty = new JettyDistro(JavaMonitorIntegrationTest.class);
|
|
||||||
|
|
||||||
jetty.delete("contexts/javadoc.xml");
|
|
||||||
|
|
||||||
jetty.overlayConfig("monitor");
|
|
||||||
|
|
||||||
jetty.start();
|
|
||||||
|
|
||||||
JMXMonitor.setServiceUrl(jetty.getJmxUrl());
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterClass
|
|
||||||
public static void shutdownJetty() throws Exception
|
|
||||||
{
|
|
||||||
if (jetty != null)
|
|
||||||
{
|
|
||||||
jetty.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setUp()
|
|
||||||
throws Exception
|
|
||||||
{
|
|
||||||
Resource configRes = Resource.newClassPathResource("/org/eclipse/jetty/monitor/java-monitor-integration.xml");
|
|
||||||
XmlConfiguration xmlConfig = new XmlConfiguration(configRes.getURL());
|
|
||||||
xmlConfig.configure();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testIntegration()
|
|
||||||
throws Exception
|
|
||||||
{
|
|
||||||
final int threadCount = 100;
|
|
||||||
final long requestCount = 500;
|
|
||||||
final String requestUrl = jetty.getBaseUri().resolve("d.txt").toASCIIString();
|
|
||||||
final CountDownLatch gate = new CountDownLatch(threadCount);
|
|
||||||
|
|
||||||
ThreadPool worker = new ExecutorThreadPool(threadCount,threadCount,60,TimeUnit.SECONDS);
|
|
||||||
for (int idx=0; idx < threadCount; idx++)
|
|
||||||
{
|
|
||||||
worker.dispatch(new Runnable() {
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
runTest(requestUrl, requestCount);
|
|
||||||
gate.countDown();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Thread.sleep(500);
|
|
||||||
}
|
|
||||||
gate.await();
|
|
||||||
assertTrue(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static void runTest(String requestUrl, long count)
|
|
||||||
{
|
|
||||||
HttpClient client = new HttpClient();
|
|
||||||
client.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
client.start();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
LOG.debug(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (client != null)
|
|
||||||
{
|
|
||||||
Random rnd = new Random();
|
|
||||||
for (long cnt=0; cnt < count; cnt++)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ContentExchange getExchange = new ContentExchange();
|
|
||||||
getExchange.setURL(requestUrl);
|
|
||||||
getExchange.setMethod(HttpMethods.GET);
|
|
||||||
|
|
||||||
client.send(getExchange);
|
|
||||||
int state = getExchange.waitForDone();
|
|
||||||
|
|
||||||
String content = "";
|
|
||||||
int responseStatus = getExchange.getResponseStatus();
|
|
||||||
if (responseStatus == HttpStatus.OK_200)
|
|
||||||
{
|
|
||||||
content = getExchange.getResponseContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
Thread.sleep(200);
|
|
||||||
}
|
|
||||||
catch (InterruptedException ex)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
LOG.debug(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
client.stop();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
LOG.debug(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,168 +0,0 @@
|
||||||
//
|
|
||||||
// ========================================================================
|
|
||||||
// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
|
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
// All rights reserved. This program and the accompanying materials
|
|
||||||
// are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
// and Apache License v2.0 which accompanies this distribution.
|
|
||||||
//
|
|
||||||
// The Eclipse Public License is available at
|
|
||||||
// http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
//
|
|
||||||
// The Apache License v2.0 is available at
|
|
||||||
// http://www.opensource.org/licenses/apache2.0.php
|
|
||||||
//
|
|
||||||
// You may elect to redistribute this code under either of these licenses.
|
|
||||||
// ========================================================================
|
|
||||||
//
|
|
||||||
|
|
||||||
package org.eclipse.jetty.test.monitor;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import javax.management.MBeanServerConnection;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.client.ContentExchange;
|
|
||||||
import org.eclipse.jetty.client.HttpClient;
|
|
||||||
import org.eclipse.jetty.http.HttpMethods;
|
|
||||||
import org.eclipse.jetty.http.HttpStatus;
|
|
||||||
import org.eclipse.jetty.monitor.JMXMonitor;
|
|
||||||
import org.eclipse.jetty.toolchain.jmx.JmxServiceConnection;
|
|
||||||
import org.eclipse.jetty.toolchain.test.JettyDistro;
|
|
||||||
import org.eclipse.jetty.util.log.Log;
|
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
|
||||||
import org.eclipse.jetty.util.resource.Resource;
|
|
||||||
import org.eclipse.jetty.util.thread.ExecutorThreadPool;
|
|
||||||
import org.eclipse.jetty.util.thread.ThreadPool;
|
|
||||||
import org.eclipse.jetty.xml.XmlConfiguration;
|
|
||||||
import org.junit.AfterClass;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public class JmxServiceTest
|
|
||||||
{
|
|
||||||
private static final Logger LOG = Log.getLogger(JmxServiceTest.class);
|
|
||||||
|
|
||||||
private static JettyDistro jetty;
|
|
||||||
|
|
||||||
@BeforeClass
|
|
||||||
public static void initJetty() throws Exception
|
|
||||||
{
|
|
||||||
jetty = new JettyDistro(JmxServiceTest.class);
|
|
||||||
|
|
||||||
jetty.delete("contexts/javadoc.xml");
|
|
||||||
|
|
||||||
jetty.overlayConfig("monitor");
|
|
||||||
|
|
||||||
jetty.start();
|
|
||||||
|
|
||||||
JMXMonitor.setServiceUrl(jetty.getJmxUrl());
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterClass
|
|
||||||
public static void shutdownJetty() throws Exception
|
|
||||||
{
|
|
||||||
if (jetty != null)
|
|
||||||
{
|
|
||||||
jetty.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setUp()
|
|
||||||
throws Exception
|
|
||||||
{
|
|
||||||
Resource configRes = Resource.newClassPathResource("/org/eclipse/jetty/monitor/jetty-monitor-service.xml");
|
|
||||||
XmlConfiguration xmlConfig = new XmlConfiguration(configRes.getURL());
|
|
||||||
xmlConfig.configure();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testThreadPoolMXBean()
|
|
||||||
throws Exception
|
|
||||||
{
|
|
||||||
final int threadCount = 100;
|
|
||||||
final long requestCount = 100;
|
|
||||||
final String requestUrl = jetty.getBaseUri().resolve("d.txt").toASCIIString();
|
|
||||||
final CountDownLatch gate = new CountDownLatch(threadCount);
|
|
||||||
ThreadPool worker = new ExecutorThreadPool(threadCount,threadCount,60,TimeUnit.SECONDS);
|
|
||||||
for (int idx=0; idx < threadCount; idx++)
|
|
||||||
{
|
|
||||||
worker.dispatch(new Runnable() {
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
runTest(requestUrl, requestCount);
|
|
||||||
gate.countDown();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Thread.sleep(100);
|
|
||||||
}
|
|
||||||
gate.await();
|
|
||||||
assertTrue(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static void runTest(String requestUrl, long count)
|
|
||||||
{
|
|
||||||
HttpClient client = new HttpClient();
|
|
||||||
client.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
client.start();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
LOG.debug(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (client != null)
|
|
||||||
{
|
|
||||||
for (long cnt=0; cnt < count; cnt++)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ContentExchange getExchange = new ContentExchange();
|
|
||||||
getExchange.setURL(requestUrl);
|
|
||||||
getExchange.setMethod(HttpMethods.GET);
|
|
||||||
|
|
||||||
client.send(getExchange);
|
|
||||||
int state = getExchange.waitForDone();
|
|
||||||
|
|
||||||
String content = "";
|
|
||||||
int responseStatus = getExchange.getResponseStatus();
|
|
||||||
if (responseStatus == HttpStatus.OK_200)
|
|
||||||
{
|
|
||||||
content = getExchange.getResponseContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
Thread.sleep(100);
|
|
||||||
}
|
|
||||||
catch (InterruptedException ex)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
LOG.debug(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
client.stop();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
LOG.debug(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,187 +0,0 @@
|
||||||
//
|
|
||||||
// ========================================================================
|
|
||||||
// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
|
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
// All rights reserved. This program and the accompanying materials
|
|
||||||
// are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
// and Apache License v2.0 which accompanies this distribution.
|
|
||||||
//
|
|
||||||
// The Eclipse Public License is available at
|
|
||||||
// http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
//
|
|
||||||
// The Apache License v2.0 is available at
|
|
||||||
// http://www.opensource.org/licenses/apache2.0.php
|
|
||||||
//
|
|
||||||
// You may elect to redistribute this code under either of these licenses.
|
|
||||||
// ========================================================================
|
|
||||||
//
|
|
||||||
|
|
||||||
package org.eclipse.jetty.test.monitor;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
|
||||||
|
|
||||||
import javax.management.MBeanServerConnection;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.client.ContentExchange;
|
|
||||||
import org.eclipse.jetty.client.HttpClient;
|
|
||||||
import org.eclipse.jetty.http.HttpMethods;
|
|
||||||
import org.eclipse.jetty.http.HttpStatus;
|
|
||||||
import org.eclipse.jetty.monitor.JMXMonitor;
|
|
||||||
import org.eclipse.jetty.monitor.jmx.ConsoleNotifier;
|
|
||||||
import org.eclipse.jetty.monitor.jmx.EventNotifier;
|
|
||||||
import org.eclipse.jetty.monitor.jmx.EventState;
|
|
||||||
import org.eclipse.jetty.monitor.jmx.EventTrigger;
|
|
||||||
import org.eclipse.jetty.monitor.jmx.MonitorAction;
|
|
||||||
import org.eclipse.jetty.monitor.triggers.GreaterThanAttrEventTrigger;
|
|
||||||
import org.eclipse.jetty.monitor.triggers.LessThanOrEqualToAttrEventTrigger;
|
|
||||||
import org.eclipse.jetty.monitor.triggers.OrEventTrigger;
|
|
||||||
import org.eclipse.jetty.toolchain.jmx.JmxServiceConnection;
|
|
||||||
import org.eclipse.jetty.toolchain.test.JettyDistro;
|
|
||||||
import org.eclipse.jetty.util.log.Log;
|
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
|
||||||
import org.eclipse.jetty.util.thread.ExecutorThreadPool;
|
|
||||||
import org.eclipse.jetty.util.thread.ThreadPool;
|
|
||||||
import org.junit.AfterClass;
|
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public class ProgramConfigTest
|
|
||||||
{
|
|
||||||
private static final Logger LOG = Log.getLogger(ProgramConfigTest.class);
|
|
||||||
|
|
||||||
private static JettyDistro jetty;
|
|
||||||
|
|
||||||
@BeforeClass
|
|
||||||
public static void initJetty() throws Exception
|
|
||||||
{
|
|
||||||
jetty = new JettyDistro(ProgramConfigTest.class);
|
|
||||||
|
|
||||||
jetty.delete("contexts/javadoc.xml");
|
|
||||||
|
|
||||||
jetty.overlayConfig("monitor");
|
|
||||||
|
|
||||||
jetty.start();
|
|
||||||
|
|
||||||
JMXMonitor.setServiceUrl(jetty.getJmxUrl());
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterClass
|
|
||||||
public static void shutdownJetty() throws Exception
|
|
||||||
{
|
|
||||||
if (jetty != null)
|
|
||||||
{
|
|
||||||
jetty.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testThreadPoolMXBean()
|
|
||||||
throws Exception
|
|
||||||
{
|
|
||||||
int testRangeLow = 4;
|
|
||||||
int testRangeHigh = 7;
|
|
||||||
|
|
||||||
LessThanOrEqualToAttrEventTrigger<Integer> trigger1 =
|
|
||||||
new LessThanOrEqualToAttrEventTrigger<Integer>("org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0", "idleThreads",
|
|
||||||
testRangeLow);
|
|
||||||
GreaterThanAttrEventTrigger<Integer> trigger2 =
|
|
||||||
new GreaterThanAttrEventTrigger<Integer>("org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0", "idleThreads",
|
|
||||||
testRangeHigh);
|
|
||||||
OrEventTrigger trigger = new OrEventTrigger(trigger1, trigger2);
|
|
||||||
EventNotifier notifier = new ConsoleNotifier("%s");
|
|
||||||
final AtomicLong counter = new AtomicLong();
|
|
||||||
MonitorAction action = new MonitorAction(trigger, notifier, 500) {
|
|
||||||
@Override
|
|
||||||
public void execute(EventTrigger trigger, EventState<?> state, long timestamp)
|
|
||||||
{
|
|
||||||
System.out.println(counter.incrementAndGet());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
JMXMonitor.addMonitorActions(action);
|
|
||||||
|
|
||||||
final int threadCount = 100;
|
|
||||||
final long requestCount = 100;
|
|
||||||
final String requestUrl = jetty.getBaseUri().resolve("d.txt").toASCIIString();
|
|
||||||
final CountDownLatch gate = new CountDownLatch(threadCount);
|
|
||||||
ThreadPool worker = new ExecutorThreadPool(threadCount,threadCount,60,TimeUnit.SECONDS);
|
|
||||||
for (int idx=0; idx < threadCount; idx++)
|
|
||||||
{
|
|
||||||
worker.dispatch(new Runnable() {
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
runTest(requestUrl, requestCount);
|
|
||||||
gate.countDown();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Thread.sleep(100);
|
|
||||||
}
|
|
||||||
gate.await();
|
|
||||||
JMXMonitor.removeMonitorActions(action);
|
|
||||||
assertTrue(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static void runTest(String requestUrl, long count)
|
|
||||||
{
|
|
||||||
HttpClient client = new HttpClient();
|
|
||||||
client.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
client.start();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
LOG.debug(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (client != null)
|
|
||||||
{
|
|
||||||
for (long cnt=0; cnt < count; cnt++)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ContentExchange getExchange = new ContentExchange();
|
|
||||||
getExchange.setURL(requestUrl);
|
|
||||||
getExchange.setMethod(HttpMethods.GET);
|
|
||||||
|
|
||||||
client.send(getExchange);
|
|
||||||
getExchange.waitForDone();
|
|
||||||
|
|
||||||
String content = "";
|
|
||||||
int responseStatus = getExchange.getResponseStatus();
|
|
||||||
if (responseStatus == HttpStatus.OK_200)
|
|
||||||
{
|
|
||||||
content = getExchange.getResponseContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
Thread.sleep(100);
|
|
||||||
}
|
|
||||||
catch (InterruptedException ex)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
LOG.debug(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
client.stop();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
LOG.debug(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,167 +0,0 @@
|
||||||
//
|
|
||||||
// ========================================================================
|
|
||||||
// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
|
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
// All rights reserved. This program and the accompanying materials
|
|
||||||
// are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
// and Apache License v2.0 which accompanies this distribution.
|
|
||||||
//
|
|
||||||
// The Eclipse Public License is available at
|
|
||||||
// http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
//
|
|
||||||
// The Apache License v2.0 is available at
|
|
||||||
// http://www.opensource.org/licenses/apache2.0.php
|
|
||||||
//
|
|
||||||
// You may elect to redistribute this code under either of these licenses.
|
|
||||||
// ========================================================================
|
|
||||||
//
|
|
||||||
|
|
||||||
package org.eclipse.jetty.test.monitor;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.client.ContentExchange;
|
|
||||||
import org.eclipse.jetty.client.HttpClient;
|
|
||||||
import org.eclipse.jetty.http.HttpMethods;
|
|
||||||
import org.eclipse.jetty.http.HttpStatus;
|
|
||||||
import org.eclipse.jetty.monitor.JMXMonitor;
|
|
||||||
import org.eclipse.jetty.toolchain.test.JettyDistro;
|
|
||||||
import org.eclipse.jetty.util.log.Log;
|
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
|
||||||
import org.eclipse.jetty.util.resource.Resource;
|
|
||||||
import org.eclipse.jetty.util.thread.ExecutorThreadPool;
|
|
||||||
import org.eclipse.jetty.util.thread.ThreadPool;
|
|
||||||
import org.eclipse.jetty.xml.XmlConfiguration;
|
|
||||||
import org.junit.AfterClass;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public class XmlConfigTest
|
|
||||||
{
|
|
||||||
private static final Logger LOG = Log.getLogger(XmlConfigTest.class);
|
|
||||||
|
|
||||||
private static JettyDistro jetty;
|
|
||||||
|
|
||||||
@BeforeClass
|
|
||||||
public static void initJetty() throws Exception
|
|
||||||
{
|
|
||||||
jetty = new JettyDistro(XmlConfigTest.class);
|
|
||||||
|
|
||||||
jetty.delete("contexts/javadoc.xml");
|
|
||||||
|
|
||||||
jetty.overlayConfig("monitor");
|
|
||||||
|
|
||||||
jetty.start();
|
|
||||||
|
|
||||||
JMXMonitor.setServiceUrl(jetty.getJmxUrl());
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterClass
|
|
||||||
public static void shutdownJetty() throws Exception
|
|
||||||
{
|
|
||||||
if (jetty != null)
|
|
||||||
{
|
|
||||||
jetty.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setUp()
|
|
||||||
throws Exception
|
|
||||||
{
|
|
||||||
Resource configRes = Resource.newClassPathResource("/org/eclipse/jetty/monitor/jetty-monitor-test.xml");
|
|
||||||
XmlConfiguration xmlConfig = new XmlConfiguration(configRes.getURL());
|
|
||||||
xmlConfig.configure();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testThreadPoolMXBean()
|
|
||||||
throws Exception
|
|
||||||
{
|
|
||||||
final int threadCount = 100;
|
|
||||||
final long requestCount = 100;
|
|
||||||
final String requestUrl = jetty.getBaseUri().resolve("d.txt").toASCIIString();
|
|
||||||
final CountDownLatch gate = new CountDownLatch(threadCount);
|
|
||||||
ThreadPool worker = new ExecutorThreadPool(threadCount,threadCount,60,TimeUnit.SECONDS);
|
|
||||||
for (int idx=0; idx < threadCount; idx++)
|
|
||||||
{
|
|
||||||
worker.dispatch(new Runnable() {
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
runTest(requestUrl, requestCount);
|
|
||||||
gate.countDown();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Thread.sleep(100);
|
|
||||||
}
|
|
||||||
gate.await();
|
|
||||||
assertTrue(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static void runTest(String requestUrl, long count)
|
|
||||||
{
|
|
||||||
HttpClient client = new HttpClient();
|
|
||||||
client.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
client.start();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
LOG.debug(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (client != null)
|
|
||||||
{
|
|
||||||
Random rnd = new Random();
|
|
||||||
for (long cnt=0; cnt < count; cnt++)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ContentExchange getExchange = new ContentExchange();
|
|
||||||
getExchange.setURL(requestUrl);
|
|
||||||
getExchange.setMethod(HttpMethods.GET);
|
|
||||||
|
|
||||||
client.send(getExchange);
|
|
||||||
int state = getExchange.waitForDone();
|
|
||||||
|
|
||||||
String content = "";
|
|
||||||
int responseStatus = getExchange.getResponseStatus();
|
|
||||||
if (responseStatus == HttpStatus.OK_200)
|
|
||||||
{
|
|
||||||
content = getExchange.getResponseContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
Thread.sleep(100);
|
|
||||||
}
|
|
||||||
catch (InterruptedException ex)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
LOG.debug(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
client.stop();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
LOG.debug(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
//
|
|
||||||
// ========================================================================
|
|
||||||
// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
|
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
// All rights reserved. This program and the accompanying materials
|
|
||||||
// are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
// and Apache License v2.0 which accompanies this distribution.
|
|
||||||
//
|
|
||||||
// The Eclipse Public License is available at
|
|
||||||
// http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
//
|
|
||||||
// The Apache License v2.0 is available at
|
|
||||||
// http://www.opensource.org/licenses/apache2.0.php
|
|
||||||
//
|
|
||||||
// You may elect to redistribute this code under either of these licenses.
|
|
||||||
// ========================================================================
|
|
||||||
//
|
|
||||||
|
|
||||||
package org.eclipse.jetty.test.rfcs;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.http.HttpSchemes;
|
|
||||||
import org.eclipse.jetty.test.support.TestableJettyServer;
|
|
||||||
import org.eclipse.jetty.test.support.rawhttp.HttpSocket;
|
|
||||||
import org.eclipse.jetty.test.support.rawhttp.HttpSocketImpl;
|
|
||||||
import org.junit.BeforeClass;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Perform the RFC2616 tests against a server running with the Jetty BIO Connector and listening on standard HTTP.
|
|
||||||
*/
|
|
||||||
public class RFC2616BIOHttpTest extends RFC2616BaseTest
|
|
||||||
{
|
|
||||||
@BeforeClass
|
|
||||||
public static void setupServer() throws Exception
|
|
||||||
{
|
|
||||||
TestableJettyServer server = new TestableJettyServer();
|
|
||||||
server.setScheme(HttpSchemes.HTTP);
|
|
||||||
server.addConfiguration("RFC2616Base.xml");
|
|
||||||
server.addConfiguration("RFC2616_Redirects.xml");
|
|
||||||
server.addConfiguration("RFC2616_Filters.xml");
|
|
||||||
server.addConfiguration("BIOHttp.xml");
|
|
||||||
setUpServer(server, RFC2616BIOHttpTest.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HttpSocket getHttpClientSocket()
|
|
||||||
{
|
|
||||||
return new HttpSocketImpl();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,50 +0,0 @@
|
||||||
//
|
|
||||||
// ========================================================================
|
|
||||||
// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
|
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
// All rights reserved. This program and the accompanying materials
|
|
||||||
// are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
// and Apache License v2.0 which accompanies this distribution.
|
|
||||||
//
|
|
||||||
// The Eclipse Public License is available at
|
|
||||||
// http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
//
|
|
||||||
// The Apache License v2.0 is available at
|
|
||||||
// http://www.opensource.org/licenses/apache2.0.php
|
|
||||||
//
|
|
||||||
// You may elect to redistribute this code under either of these licenses.
|
|
||||||
// ========================================================================
|
|
||||||
//
|
|
||||||
|
|
||||||
package org.eclipse.jetty.test.rfcs;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.http.HttpSchemes;
|
|
||||||
import org.eclipse.jetty.test.support.TestableJettyServer;
|
|
||||||
import org.eclipse.jetty.test.support.rawhttp.HttpSocket;
|
|
||||||
import org.eclipse.jetty.test.support.rawhttp.HttpsSocketImpl;
|
|
||||||
import org.junit.BeforeClass;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Perform the RFC2616 tests against a server running with the Jetty BIO Connector and listening on HTTPS (HTTP over
|
|
||||||
* SSL).
|
|
||||||
*/
|
|
||||||
public class RFC2616BIOHttpsTest extends RFC2616BaseTest
|
|
||||||
{
|
|
||||||
@BeforeClass
|
|
||||||
public static void setupServer() throws Exception
|
|
||||||
{
|
|
||||||
TestableJettyServer server = new TestableJettyServer();
|
|
||||||
server.setScheme(HttpSchemes.HTTPS);
|
|
||||||
server.addConfiguration("RFC2616Base.xml");
|
|
||||||
server.addConfiguration("RFC2616_Redirects.xml");
|
|
||||||
server.addConfiguration("RFC2616_Filters.xml");
|
|
||||||
server.addConfiguration("BIOHttps.xml");
|
|
||||||
setUpServer(server, RFC2616BIOHttpsTest.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HttpSocket getHttpClientSocket() throws Exception
|
|
||||||
{
|
|
||||||
return new HttpsSocketImpl();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.test.rfcs;
|
package org.eclipse.jetty.test.rfcs;
|
||||||
|
|
||||||
import org.eclipse.jetty.http.HttpSchemes;
|
import org.eclipse.jetty.http.HttpScheme;
|
||||||
import org.eclipse.jetty.test.support.TestableJettyServer;
|
import org.eclipse.jetty.test.support.TestableJettyServer;
|
||||||
import org.eclipse.jetty.test.support.rawhttp.HttpSocket;
|
import org.eclipse.jetty.test.support.rawhttp.HttpSocket;
|
||||||
import org.eclipse.jetty.test.support.rawhttp.HttpSocketImpl;
|
import org.eclipse.jetty.test.support.rawhttp.HttpSocketImpl;
|
||||||
|
@ -33,7 +33,7 @@ public class RFC2616NIOHttpTest extends RFC2616BaseTest
|
||||||
public static void setupServer() throws Exception
|
public static void setupServer() throws Exception
|
||||||
{
|
{
|
||||||
TestableJettyServer server = new TestableJettyServer();
|
TestableJettyServer server = new TestableJettyServer();
|
||||||
server.setScheme(HttpSchemes.HTTP);
|
server.setScheme(HttpScheme.HTTP.asString());
|
||||||
server.addConfiguration("RFC2616Base.xml");
|
server.addConfiguration("RFC2616Base.xml");
|
||||||
server.addConfiguration("RFC2616_Redirects.xml");
|
server.addConfiguration("RFC2616_Redirects.xml");
|
||||||
server.addConfiguration("RFC2616_Filters.xml");
|
server.addConfiguration("RFC2616_Filters.xml");
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.test.rfcs;
|
package org.eclipse.jetty.test.rfcs;
|
||||||
|
|
||||||
import org.eclipse.jetty.http.HttpSchemes;
|
import org.eclipse.jetty.http.HttpScheme;
|
||||||
import org.eclipse.jetty.test.support.TestableJettyServer;
|
import org.eclipse.jetty.test.support.TestableJettyServer;
|
||||||
import org.eclipse.jetty.test.support.rawhttp.HttpSocket;
|
import org.eclipse.jetty.test.support.rawhttp.HttpSocket;
|
||||||
import org.eclipse.jetty.test.support.rawhttp.HttpsSocketImpl;
|
import org.eclipse.jetty.test.support.rawhttp.HttpsSocketImpl;
|
||||||
|
@ -33,7 +33,7 @@ public class RFC2616NIOHttpsTest extends RFC2616BaseTest
|
||||||
public static void setupServer() throws Exception
|
public static void setupServer() throws Exception
|
||||||
{
|
{
|
||||||
TestableJettyServer server = new TestableJettyServer();
|
TestableJettyServer server = new TestableJettyServer();
|
||||||
server.setScheme(HttpSchemes.HTTPS);
|
server.setScheme(HttpScheme.HTTPS.asString());
|
||||||
server.addConfiguration("RFC2616Base.xml");
|
server.addConfiguration("RFC2616Base.xml");
|
||||||
server.addConfiguration("RFC2616_Redirects.xml");
|
server.addConfiguration("RFC2616_Redirects.xml");
|
||||||
server.addConfiguration("RFC2616_Filters.xml");
|
server.addConfiguration("RFC2616_Filters.xml");
|
||||||
|
|
|
@ -32,8 +32,9 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.eclipse.jetty.http.HttpSchemes;
|
import org.eclipse.jetty.http.HttpScheme;
|
||||||
import org.eclipse.jetty.server.Connector;
|
import org.eclipse.jetty.server.Connector;
|
||||||
|
import org.eclipse.jetty.server.NetworkConnector;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.xml.XmlConfiguration;
|
import org.eclipse.jetty.xml.XmlConfiguration;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
@ -49,7 +50,7 @@ public class TestableJettyServer
|
||||||
private final Map<String,String> _properties = new HashMap<String, String>();
|
private final Map<String,String> _properties = new HashMap<String, String>();
|
||||||
private Server _server;
|
private Server _server;
|
||||||
private int _serverPort;
|
private int _serverPort;
|
||||||
private String _scheme = HttpSchemes.HTTP;
|
private String _scheme = HttpScheme.HTTP.asString();
|
||||||
|
|
||||||
/* Popular Directories */
|
/* Popular Directories */
|
||||||
private File baseDir;
|
private File baseDir;
|
||||||
|
@ -154,7 +155,7 @@ public class TestableJettyServer
|
||||||
Assert.assertEquals("Server load count",1,serverCount);
|
Assert.assertEquals("Server load count",1,serverCount);
|
||||||
|
|
||||||
this._server = foundServer;
|
this._server = foundServer;
|
||||||
this._server.setGracefulShutdown(10);
|
this._server.setStopTimeout(1000);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +180,7 @@ public class TestableJettyServer
|
||||||
Connector connectors[] = _server.getConnectors();
|
Connector connectors[] = _server.getConnectors();
|
||||||
for (int i = 0; i < connectors.length; i++)
|
for (int i = 0; i < connectors.length; i++)
|
||||||
{
|
{
|
||||||
Connector connector = connectors[i];
|
NetworkConnector connector = (NetworkConnector)connectors[i];
|
||||||
if (connector.getLocalPort() > 0)
|
if (connector.getLocalPort() > 0)
|
||||||
{
|
{
|
||||||
this._serverPort = connector.getLocalPort();
|
this._serverPort = connector.getLocalPort();
|
||||||
|
|
|
@ -1,82 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
|
|
||||||
|
|
||||||
<!-- ============================================================================ -->
|
|
||||||
<!-- To correctly start Jetty with JMX module enabled, this configuration -->
|
|
||||||
<!-- file must appear first in the list of the configuration files. -->
|
|
||||||
<!-- The simplest way to achieve this is to add etc/jetty-jmx.xml as the -->
|
|
||||||
<!-- first file in configuration file list at the end of start.ini file. -->
|
|
||||||
<!-- ============================================================================ -->
|
|
||||||
<Configure id="Server" class="org.eclipse.jetty.server.Server">
|
|
||||||
|
|
||||||
<!-- =========================================================== -->
|
|
||||||
<!-- Initialize an mbean server -->
|
|
||||||
<!-- =========================================================== -->
|
|
||||||
<Call id="MBeanServer" class="java.lang.management.ManagementFactory"
|
|
||||||
name="getPlatformMBeanServer" />
|
|
||||||
|
|
||||||
<!-- =========================================================== -->
|
|
||||||
<!-- Initialize the Jetty MBean container -->
|
|
||||||
<!-- =========================================================== -->
|
|
||||||
<New id="MBeanContainer" class="org.eclipse.jetty.jmx.MBeanContainer">
|
|
||||||
<Arg>
|
|
||||||
<Ref id="MBeanServer" />
|
|
||||||
</Arg>
|
|
||||||
</New>
|
|
||||||
|
|
||||||
<!-- Add to the Server to listen for object events -->
|
|
||||||
<Get id="Container" name="container">
|
|
||||||
<Call name="addEventListener">
|
|
||||||
<Arg>
|
|
||||||
<Ref id="MBeanContainer" />
|
|
||||||
</Arg>
|
|
||||||
</Call>
|
|
||||||
</Get>
|
|
||||||
|
|
||||||
<!-- Add to the Server as a lifecycle -->
|
|
||||||
<!-- Only do this if you know you will only have a single jetty server -->
|
|
||||||
<Call name="addBean">
|
|
||||||
<Arg>
|
|
||||||
<Ref id="MBeanContainer" />
|
|
||||||
</Arg>
|
|
||||||
</Call>
|
|
||||||
|
|
||||||
<!-- Add the static log -->
|
|
||||||
<Get id="Logger" class="org.eclipse.jetty.util.log.Log" name="log" />
|
|
||||||
<Ref id="MBeanContainer">
|
|
||||||
<Call name="addBean">
|
|
||||||
<Arg>
|
|
||||||
<Ref id="Logger" />
|
|
||||||
</Arg>
|
|
||||||
</Call>
|
|
||||||
</Ref>
|
|
||||||
|
|
||||||
<!-- In order to connect to the JMX server remotely from a different
|
|
||||||
process, possibly running on a different host, Jetty JMX module
|
|
||||||
can create a remote JMX connector.
|
|
||||||
-->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Optionally add a remote JMX connector. The parameters of the constructor
|
|
||||||
below specify the JMX service URL, and the object name string for the
|
|
||||||
connector server bean. The parameters of the JMXServiceURL constructor
|
|
||||||
specify the protocol that clients will use to connect to the remote JMX
|
|
||||||
connector (RMI), the hostname of the server (local hostname), port number
|
|
||||||
(automatically assigned), and the URL path. Note that URL path contains
|
|
||||||
the RMI registry hostname and port number, that may need to be modified
|
|
||||||
in order to comply with the firewall requirements.
|
|
||||||
-->
|
|
||||||
<New id="ConnectorServer" class="org.eclipse.jetty.jmx.ConnectorServer">
|
|
||||||
<Arg>
|
|
||||||
<New class="javax.management.remote.JMXServiceURL">
|
|
||||||
<Arg type="java.lang.String">rmi</Arg>
|
|
||||||
<Arg type="java.lang.String" />
|
|
||||||
<Arg type="java.lang.Integer">0</Arg>
|
|
||||||
<Arg type="java.lang.String">/jndi/rmi://localhost:0/jettyjmx</Arg>
|
|
||||||
</New>
|
|
||||||
</Arg>
|
|
||||||
<Arg>org.eclipse.jetty:name=rmiconnectorserver</Arg>
|
|
||||||
<Call name="start" />
|
|
||||||
</New>
|
|
||||||
</Configure>
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
OPTIONS=Server,jsp,jmx,resources,websocket,ext
|
|
||||||
etc/jetty-jmx.xml
|
|
||||||
etc/jetty.xml
|
|
||||||
etc/jetty-deploy.xml
|
|
||||||
etc/jetty-webapps.xml
|
|
||||||
etc/jetty-contexts.xml
|
|
||||||
etc/jetty-testrealm.xml
|
|
|
@ -1,62 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
// ========================================================================
|
|
||||||
// Copyright (c) Webtide LLC
|
|
||||||
//
|
|
||||||
// All rights reserved. This program and the accompanying materials
|
|
||||||
// are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
// and Apache License v2.0 which accompanies this distribution.
|
|
||||||
//
|
|
||||||
// The Eclipse Public License is available at
|
|
||||||
// http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
//
|
|
||||||
// The Apache License v2.0 is available at
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0.txt
|
|
||||||
//
|
|
||||||
// You may elect to redistribute this code under either of these licenses.
|
|
||||||
// ========================================================================
|
|
||||||
-->
|
|
||||||
|
|
||||||
<Configure id="Server" class="org.eclipse.jetty.server.Server">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<Call id="MBeanServer" class="java.lang.management.ManagementFactory" name="getPlatformMBeanServer">
|
|
||||||
<Call name="registerMBean">
|
|
||||||
<Arg><New class="com.javamonitor.mbeans.DNSCachePolicy" /></Arg>
|
|
||||||
<Arg>
|
|
||||||
<New class="javax.management.ObjectName">
|
|
||||||
<Arg>com.javamonitor:type=DNSCachePolicy</Arg>
|
|
||||||
</New>
|
|
||||||
</Arg>
|
|
||||||
</Call>
|
|
||||||
<Call name="registerMBean">
|
|
||||||
<Arg><New class="com.javamonitor.mbeans.Threading" /></Arg>
|
|
||||||
<Arg>
|
|
||||||
<New class="javax.management.ObjectName">
|
|
||||||
<Arg>com.javamonitor:type=Threading</Arg>
|
|
||||||
</New>
|
|
||||||
</Arg>
|
|
||||||
</Call>
|
|
||||||
</Call>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<Call id="JMXMonitor" class="org.eclipse.jetty.monitor.JMXMonitor" name="getInstance">
|
|
||||||
<Call name="addActions">
|
|
||||||
<Arg>
|
|
||||||
<Array type="org.eclipse.jetty.monitor.jmx.MonitorAction">
|
|
||||||
<Item>
|
|
||||||
<New id="MonitorAction" class="org.eclipse.jetty.monitor.integration.JavaMonitorAction">
|
|
||||||
<Arg />
|
|
||||||
<Arg>http://194.109.206.51/lemongrass/1.1/push</Arg>
|
|
||||||
<Arg>57e48e79-f0e6-4909-a6da-e8c1267cbf49</Arg>
|
|
||||||
<Arg>8080</Arg>
|
|
||||||
<Arg type="java.lang.Integer">15000</Arg>
|
|
||||||
</New>
|
|
||||||
</Item>
|
|
||||||
</Array>
|
|
||||||
</Arg>
|
|
||||||
</Call>
|
|
||||||
</Call>
|
|
||||||
</Configure>
|
|
|
@ -1,68 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
// ========================================================================
|
|
||||||
// Copyright (c) Webtide LLC
|
|
||||||
//
|
|
||||||
// All rights reserved. This program and the accompanying materials
|
|
||||||
// are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
// and Apache License v2.0 which accompanies this distribution.
|
|
||||||
//
|
|
||||||
// The Eclipse Public License is available at
|
|
||||||
// http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
//
|
|
||||||
// The Apache License v2.0 is available at
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0.txt
|
|
||||||
//
|
|
||||||
// You may elect to redistribute this code under either of these licenses.
|
|
||||||
// ========================================================================
|
|
||||||
-->
|
|
||||||
|
|
||||||
<Configure id="Monitor" class="org.eclipse.jetty.monitor.JMXMonitor">
|
|
||||||
<Call name="setUrl">
|
|
||||||
<Arg>service:jmx:rmi://localhost/jndi/rmi://localhost:1099/jettyjmx</Arg>
|
|
||||||
</Call>
|
|
||||||
<Call name="addActions">
|
|
||||||
<Arg>
|
|
||||||
<Array type="org.eclipse.jetty.monitor.jmx.MonitorAction">
|
|
||||||
<Item>
|
|
||||||
<New class="org.eclipse.jetty.monitor.jmx.SimpleAction">
|
|
||||||
<Arg>
|
|
||||||
<New class="org.eclipse.jetty.monitor.triggers.OrEventTrigger">
|
|
||||||
<Arg>
|
|
||||||
<Array type="org.eclipse.jetty.monitor.jmx.EventTrigger">
|
|
||||||
<Item>
|
|
||||||
<New
|
|
||||||
class="org.eclipse.jetty.monitor.triggers.LessThanOrEqualToAttrEventTrigger">
|
|
||||||
<Arg>org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0
|
|
||||||
</Arg>
|
|
||||||
<Arg>idleThreads</Arg>
|
|
||||||
<Arg type="java.lang.Integer">4</Arg>
|
|
||||||
</New>
|
|
||||||
</Item>
|
|
||||||
<Item>
|
|
||||||
<New
|
|
||||||
class="org.eclipse.jetty.monitor.triggers.GreaterThanAttrEventTrigger">
|
|
||||||
<Arg>org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0
|
|
||||||
</Arg>
|
|
||||||
<Arg>idleThreads</Arg>
|
|
||||||
<Arg type="java.lang.Integer">7</Arg>
|
|
||||||
</New>
|
|
||||||
</Item>
|
|
||||||
</Array>
|
|
||||||
</Arg>
|
|
||||||
</New>
|
|
||||||
</Arg>
|
|
||||||
<Arg>
|
|
||||||
<New class="org.eclipse.jetty.monitor.jmx.ConsoleNotifier">
|
|
||||||
<Arg>%s</Arg>
|
|
||||||
</New>
|
|
||||||
</Arg>
|
|
||||||
<Arg type="java.lang.Long">500</Arg>
|
|
||||||
</New>
|
|
||||||
</Item>
|
|
||||||
</Array>
|
|
||||||
</Arg>
|
|
||||||
</Call>
|
|
||||||
</Configure>
|
|
|
@ -1,65 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
// ========================================================================
|
|
||||||
// Copyright (c) Webtide LLC
|
|
||||||
//
|
|
||||||
// All rights reserved. This program and the accompanying materials
|
|
||||||
// are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
// and Apache License v2.0 which accompanies this distribution.
|
|
||||||
//
|
|
||||||
// The Eclipse Public License is available at
|
|
||||||
// http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
//
|
|
||||||
// The Apache License v2.0 is available at
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0.txt
|
|
||||||
//
|
|
||||||
// You may elect to redistribute this code under either of these licenses.
|
|
||||||
// ========================================================================
|
|
||||||
-->
|
|
||||||
|
|
||||||
<Configure id="Monitor" class="org.eclipse.jetty.monitor.JMXMonitor">
|
|
||||||
<Call name="addActions">
|
|
||||||
<Arg>
|
|
||||||
<Array type="org.eclipse.jetty.monitor.jmx.MonitorAction">
|
|
||||||
<Item>
|
|
||||||
<New class="org.eclipse.jetty.monitor.jmx.SimpleAction">
|
|
||||||
<Arg>
|
|
||||||
<New class="org.eclipse.jetty.monitor.triggers.OrEventTrigger">
|
|
||||||
<Arg>
|
|
||||||
<Array type="org.eclipse.jetty.monitor.jmx.EventTrigger">
|
|
||||||
<Item>
|
|
||||||
<New
|
|
||||||
class="org.eclipse.jetty.monitor.triggers.LessThanOrEqualToAttrEventTrigger">
|
|
||||||
<Arg>org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0
|
|
||||||
</Arg>
|
|
||||||
<Arg>idleThreads</Arg>
|
|
||||||
<Arg type="java.lang.Integer">4</Arg>
|
|
||||||
</New>
|
|
||||||
</Item>
|
|
||||||
<Item>
|
|
||||||
<New
|
|
||||||
class="org.eclipse.jetty.monitor.triggers.GreaterThanAttrEventTrigger">
|
|
||||||
<Arg>org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0
|
|
||||||
</Arg>
|
|
||||||
<Arg>idleThreads</Arg>
|
|
||||||
<Arg type="java.lang.Integer">7</Arg>
|
|
||||||
</New>
|
|
||||||
</Item>
|
|
||||||
</Array>
|
|
||||||
</Arg>
|
|
||||||
</New>
|
|
||||||
</Arg>
|
|
||||||
<Arg>
|
|
||||||
<New class="org.eclipse.jetty.monitor.jmx.ConsoleNotifier">
|
|
||||||
<Arg>%s</Arg>
|
|
||||||
</New>
|
|
||||||
</Arg>
|
|
||||||
<Arg type="java.lang.Long">500</Arg>
|
|
||||||
</New>
|
|
||||||
</Item>
|
|
||||||
</Array>
|
|
||||||
</Arg>
|
|
||||||
</Call>
|
|
||||||
</Configure>
|
|
|
@ -22,6 +22,7 @@
|
||||||
<groupId>org.eclipse.jetty.tests</groupId>
|
<groupId>org.eclipse.jetty.tests</groupId>
|
||||||
<artifactId>tests-parent</artifactId>
|
<artifactId>tests-parent</artifactId>
|
||||||
<version>9.0.0-SNAPSHOT</version>
|
<version>9.0.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>test-webapps-parent</artifactId>
|
<artifactId>test-webapps-parent</artifactId>
|
||||||
<name>Jetty Tests :: WebApps :: Parent</name>
|
<name>Jetty Tests :: WebApps :: Parent</name>
|
||||||
|
@ -39,6 +40,7 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<modules>
|
<modules>
|
||||||
|
<module>test-jetty-webapp</module>
|
||||||
<module>test-webapp-rfc2616</module>
|
<module>test-webapp-rfc2616</module>
|
||||||
<module>test-mock-resources</module>
|
<module>test-mock-resources</module>
|
||||||
<module>test-servlet-spec</module>
|
<module>test-servlet-spec</module>
|
||||||
|
|
|
@ -1,8 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
// ========================================================================
|
||||||
|
// Copyright (c) Webtide LLC
|
||||||
|
//
|
||||||
|
// All rights reserved. This program and the accompanying materials
|
||||||
|
// are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
// and Apache License v2.0 which accompanies this distribution.
|
||||||
|
//
|
||||||
|
// The Eclipse Public License is available at
|
||||||
|
// http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
//
|
||||||
|
// The Apache License v2.0 is available at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0.txt
|
||||||
|
//
|
||||||
|
// You may elect to redistribute this code under either of these licenses.
|
||||||
|
// ========================================================================
|
||||||
|
-->
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty.tests</groupId>
|
||||||
<artifactId>jetty-project</artifactId>
|
<artifactId>test-webapps-parent</artifactId>
|
||||||
<version>9.0.0-SNAPSHOT</version>
|
<version>9.0.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>test-jetty-webapp</artifactId>
|
<artifactId>test-jetty-webapp</artifactId>
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 71 KiB |
Loading…
Reference in New Issue