Moved version() method to base test class, and using HTTPSPDYHeader instead of hardcoded strings.

This commit is contained in:
Simone Bordet 2012-06-05 12:32:07 +02:00
parent b9a3c98055
commit f5d63e8626
4 changed files with 13 additions and 20 deletions

View File

@ -113,4 +113,9 @@ public abstract class AbstractHTTPSPDYTest
server.join(); server.join();
} }
} }
protected short version()
{
return SPDY.V2;
}
} }

View File

@ -73,10 +73,10 @@ public class ConcurrentStreamsTest extends AbstractHTTPSPDYTest
// Perform slow request. This will wait on server side until the fast request wakes it up // Perform slow request. This will wait on server side until the fast request wakes it up
Headers headers = new Headers(); Headers headers = new Headers();
headers.put("method", "GET"); headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put("url", "/slow"); headers.put(HTTPSPDYHeader.URI.name(version()), "/slow");
headers.put("version", "HTTP/1.1"); headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put("host", "localhost:" + connector.getLocalPort()); headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
final CountDownLatch slowClientLatch = new CountDownLatch(1); final CountDownLatch slowClientLatch = new CountDownLatch(1);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter() session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
{ {
@ -91,10 +91,10 @@ public class ConcurrentStreamsTest extends AbstractHTTPSPDYTest
// Perform the fast request. This will wake up the slow request // Perform the fast request. This will wake up the slow request
headers.clear(); headers.clear();
headers.put("method", "GET"); headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put("url", "/fast"); headers.put(HTTPSPDYHeader.URI.name(version()), "/fast");
headers.put("version", "HTTP/1.1"); headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put("host", "localhost:" + connector.getLocalPort()); headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
final CountDownLatch fastClientLatch = new CountDownLatch(1); final CountDownLatch fastClientLatch = new CountDownLatch(1);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter() session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
{ {

View File

@ -38,7 +38,6 @@ import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.spdy.AsyncConnectionFactory; import org.eclipse.jetty.spdy.AsyncConnectionFactory;
import org.eclipse.jetty.spdy.api.DataInfo; import org.eclipse.jetty.spdy.api.DataInfo;
import org.eclipse.jetty.spdy.api.Headers; import org.eclipse.jetty.spdy.api.Headers;
import org.eclipse.jetty.spdy.api.SPDY;
import org.eclipse.jetty.spdy.api.Session; import org.eclipse.jetty.spdy.api.Session;
import org.eclipse.jetty.spdy.api.SessionFrameListener; import org.eclipse.jetty.spdy.api.SessionFrameListener;
import org.eclipse.jetty.spdy.api.Stream; import org.eclipse.jetty.spdy.api.Stream;
@ -62,11 +61,6 @@ public class PushStrategyBenchmarkTest extends AbstractHTTPSPDYTest
private final long roundtrip = 100; private final long roundtrip = 100;
private final int runs = 10; private final int runs = 10;
protected short version()
{
return SPDY.V2;
}
@Test @Test
public void benchmarkPushStrategy() throws Exception public void benchmarkPushStrategy() throws Exception
{ {

View File

@ -41,7 +41,6 @@ import org.eclipse.jetty.spdy.api.BytesDataInfo;
import org.eclipse.jetty.spdy.api.DataInfo; import org.eclipse.jetty.spdy.api.DataInfo;
import org.eclipse.jetty.spdy.api.Headers; import org.eclipse.jetty.spdy.api.Headers;
import org.eclipse.jetty.spdy.api.ReplyInfo; import org.eclipse.jetty.spdy.api.ReplyInfo;
import org.eclipse.jetty.spdy.api.SPDY;
import org.eclipse.jetty.spdy.api.Session; import org.eclipse.jetty.spdy.api.Session;
import org.eclipse.jetty.spdy.api.Stream; import org.eclipse.jetty.spdy.api.Stream;
import org.eclipse.jetty.spdy.api.StreamFrameListener; import org.eclipse.jetty.spdy.api.StreamFrameListener;
@ -52,11 +51,6 @@ import org.junit.Test;
public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{ {
protected short version()
{
return SPDY.V2;
}
@Test @Test
public void testSimpleGET() throws Exception public void testSimpleGET() throws Exception
{ {