----- Original Message -----
From: "Bill Burke" <bburke(a)redhat.com>
To: undertow-dev(a)lists.jboss.org
Sent: Friday, 31 May, 2013 9:42:13 AM
Subject: [undertow-dev] unit testing was Re: Reducing Use of Undertow IdentityManager
On 5/30/2013 4:24 PM, Anil Saldhana wrote:
> Right, Jason. It is not just Bill. I need Undertow as my embedded web
> container for junit testing. Currently I use Jetty.
>
I'm currently using Jetty for my servlet integration tests but am going
to switch to using Wildfly as soon as the next JBoss Modules is released
and shipped with Wildfly. The "mavenized modules" feature I added to
JBoss Modules allows you to run unit tests without having to extract
170m of jboss distro with each maven module you're are testing with.
I've already prototyped it and it works pretty good. Its a little
slower than Jetty, specifically in the shutdown phase, but its good
enough to be able to replace jetty.
It will also be cool to replace the TJWS micro-servlet container I use
for in-browser unit testing. But Undertow is going to have to beat the
sub-microsecond startup and shutdown time of TJWS for me to replace it.
long s = System.currentTimeMillis();
Undertow server = Undertow.builder()
.addListener(8080, "localhost")
.setDefaultHandler(new HttpHandler() {
@Override
public void handleRequest(final HttpServerExchange exchange) throws Exception
{
exchange.getResponseHeaders().put(Headers.CONTENT_TYPE,
"text/plain");
exchange.getResponseSender().send("Hello World");
}
}).build();
server.start();
long f = System.currentTimeMillis();
System.out.print("Time was " + (f - s) + "ms\n");
Results in
Time was 14ms
So way to slow, not even close to microsecond territory :-)
Not sure what the time is spend on, probably class loading and binding to the socket.
We use an embedded Undertow container in our test suite, and the servlet tests seem to
take about 0.02s accourding to JUnit, which generally involves setting up a servlet
deployment
and making at least one HTTP request.
Stuart
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
_______________________________________________
undertow-dev mailing list
undertow-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/undertow-dev