add module configuration for demo handler (#8490)
* add module configuration for demo handler Signed-off-by: Olivier Lamy <oliver.lamy@gmail.com>
This commit is contained in:
parent
bb83e835cf
commit
d11b5e0742
|
@ -0,0 +1,21 @@
|
|||
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
|
||||
|
||||
[description]
|
||||
Demo Handler
|
||||
|
||||
[tags]
|
||||
demo
|
||||
handler
|
||||
|
||||
[depends]
|
||||
server
|
||||
|
||||
[files]
|
||||
basehome:modules/demo.d/demo-handler.xml|etc/demo-handler.xml
|
||||
maven://org.eclipse.jetty.demos/jetty-demo-handler/${jetty.version}/jar|lib/jetty-demo-handler.jar
|
||||
|
||||
[xml]
|
||||
etc/demo-handler.xml
|
||||
|
||||
[lib]
|
||||
lib/jetty-demo-handler.jar
|
|
@ -1,8 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
|
||||
|
||||
<Configure id="helloDemo" class="org.eclipse.jetty.server.handler.ContextHandler">
|
||||
<Configure id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection">
|
||||
<Call name="addHandler">
|
||||
<Arg>
|
||||
<New id="helloHandler" class="org.eclipse.jetty.server.handler.ContextHandler">
|
||||
<Set name="handler">
|
||||
<New class="org.eclipse.jetty.demo.HelloHandler" />
|
||||
</Set>
|
||||
<Set name="contextPath">/demo-handler</Set>
|
||||
</New>
|
||||
</Arg>
|
||||
</Call>
|
||||
</Configure>
|
|
@ -607,47 +607,12 @@
|
|||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.eclipse.jetty</groupId>-->
|
||||
<!-- <artifactId>jetty-hazelcast</artifactId>-->
|
||||
<!-- <optional>true</optional>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.eclipse.jetty.gcloud</groupId>-->
|
||||
<!-- <artifactId>jetty-gcloud-session-manager</artifactId>-->
|
||||
<!-- <optional>true</optional>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.eclipse.jetty.memcached</groupId>-->
|
||||
<!-- <artifactId>jetty-memcached-sessions</artifactId>-->
|
||||
<!-- <optional>true</optional>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.eclipse.jetty</groupId>-->
|
||||
<!-- <artifactId>jetty-nosql</artifactId>-->
|
||||
<!-- <optional>true</optional>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.eclipse.jetty</groupId>-->
|
||||
<!-- <artifactId>jetty-hazelcast</artifactId>-->
|
||||
<!-- <optional>true</optional>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.eclipse.jetty.gcloud</groupId>-->
|
||||
<!-- <artifactId>jetty-gcloud-session-manager</artifactId>-->
|
||||
<!-- <optional>true</optional>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.eclipse.jetty.memcached</groupId>-->
|
||||
<!-- <artifactId>jetty-memcached-sessions</artifactId>-->
|
||||
<!-- <optional>true</optional>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.eclipse.jetty</groupId>-->
|
||||
<!-- <artifactId>jetty-nosql</artifactId>-->
|
||||
<!-- <optional>true</optional>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.demos</groupId>
|
||||
<artifactId>jetty-demo-handler</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.jetty.client.util.FormRequestContent;
|
|||
import org.eclipse.jetty.http.HttpStatus;
|
||||
import org.eclipse.jetty.util.Fields;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
@ -421,4 +422,45 @@ public class DemoModulesTests extends AbstractJettyHomeTest
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDemoHandler() throws Exception
|
||||
{
|
||||
Path jettyBase = newTestJettyBaseDirectory();
|
||||
String jettyVersion = System.getProperty("jettyVersion");
|
||||
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
|
||||
.jettyVersion(jettyVersion)
|
||||
.jettyBase(jettyBase)
|
||||
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
|
||||
.build();
|
||||
|
||||
int httpPort = distribution.freePort();
|
||||
|
||||
String[] argsConfig = {
|
||||
"--add-modules=http,demo-handler"
|
||||
};
|
||||
|
||||
String baseURI = "http://localhost:%d/demo-handler/".formatted(httpPort);
|
||||
|
||||
try (JettyHomeTester.Run runConfig = distribution.start(argsConfig))
|
||||
{
|
||||
assertTrue(runConfig.awaitFor(START_TIMEOUT, TimeUnit.SECONDS));
|
||||
assertEquals(0, runConfig.getExitValue());
|
||||
|
||||
String[] argsStart = {
|
||||
"jetty.http.port=" + httpPort
|
||||
};
|
||||
|
||||
try (JettyHomeTester.Run runStart = distribution.start(argsStart))
|
||||
{
|
||||
assertTrue(runStart.awaitConsoleLogsFor("Started oejs.Server@", START_TIMEOUT, TimeUnit.SECONDS));
|
||||
|
||||
startHttpClient();
|
||||
ContentResponse response = client.GET(baseURI);
|
||||
|
||||
assertEquals(HttpStatus.OK_200, response.getStatus(), new ResponseDetails(response));
|
||||
assertThat(response.getContentAsString(), containsString("Hello World"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue