aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Becker2013-06-12 04:53:12 (EDT)
committerThomas Becker2013-06-12 04:54:57 (EDT)
commit9501ef339250382226f3a024c9f76d10c3f6e180 (patch)
treeeeb888a9fb7bd179fef1e9d41225c6ded2610bd3
parentf116d76290539f52047f102d5a8e8988519760ef (diff)
downloadorg.eclipse.jetty.project-9501ef339250382226f3a024c9f76d10c3f6e180.zip
org.eclipse.jetty.project-9501ef339250382226f3a024c9f76d10c3f6e180.tar.gz
org.eclipse.jetty.project-9501ef339250382226f3a024c9f76d10c3f6e180.tar.bz2
409796 fix intermittent test issue in ReferrerPushStrategy.testResourceOrder. Happened when the client got closed before the server finished sending all data frames. Client waits now until all data is received.
-rw-r--r--jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/http/ReferrerPushStrategyTest.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/http/ReferrerPushStrategyTest.java b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/http/ReferrerPushStrategyTest.java
index ed0220c..5b501fe 100644
--- a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/http/ReferrerPushStrategyTest.java
+++ b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/http/ReferrerPushStrategyTest.java
@@ -67,7 +67,6 @@ import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
-@Ignore
public class ReferrerPushStrategyTest extends AbstractHTTPSPDYTest
{
private static final Logger LOG = Log.getLogger(ReferrerPushStrategyTest.class);
@@ -260,6 +259,7 @@ public class ReferrerPushStrategyTest extends AbstractHTTPSPDYTest
public void testPushResourceOrder() throws Exception
{
final CountDownLatch allExpectedPushesReceivedLatch = new CountDownLatch(4);
+ final CountDownLatch allPushDataReceivedLatch = new CountDownLatch(4);
Session pushCacheBuildSession = startClient(version, serverAddress, null);
@@ -296,12 +296,22 @@ public class ReferrerPushStrategyTest extends AbstractHTTPSPDYTest
break;
}
allExpectedPushesReceivedLatch.countDown();
- return super.onPush(stream, pushInfo);
+ return new Adapter()
+ {
+ @Override
+ public void onData(Stream stream, DataInfo dataInfo)
+ {
+ if(dataInfo.isClose())
+ allPushDataReceivedLatch.countDown();
+ }
+ };
}
});
assertThat("All expected push resources have been received", allExpectedPushesReceivedLatch.await(5,
TimeUnit.SECONDS), is(true));
+ assertThat("All push data has been fully received", allPushDataReceivedLatch.await(5, TimeUnit.SECONDS),
+ is(true));
}
@Test
@@ -451,7 +461,6 @@ public class ReferrerPushStrategyTest extends AbstractHTTPSPDYTest
private void sendRequest(Session session, Fields requestHeaders, final CountDownLatch pushSynHeadersValid,
final CountDownLatch pushDataLatch, final boolean resetPush) throws InterruptedException
{
- LOG.info("sendRequest. headers={},resetPush={}", requestHeaders, resetPush);
final CountDownLatch dataReceivedLatch = new CountDownLatch(1);
session.syn(new SynInfo(requestHeaders, true), new StreamFrameListener.Adapter()
{
@@ -496,7 +505,6 @@ public class ReferrerPushStrategyTest extends AbstractHTTPSPDYTest
}
}, new Promise.Adapter<Stream>());
assertThat(dataReceivedLatch.await(5, TimeUnit.SECONDS), is(true));
- LOG.info("sendRequest done");
}
private void run2ndClientRequests(final boolean validateHeaders,