This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new 880c808 Refactor unit tests to make it easier to configure the Http2Protocol 880c808 is described below commit 880c808ba19fa7eb08e1da280e156e7e645ca485 Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu May 30 21:29:31 2019 +0100 Refactor unit tests to make it easier to configure the Http2Protocol --- test/org/apache/coyote/http2/Http2TestBase.java | 6 +++++- test/org/apache/coyote/http2/TestAbortedUpload.java | 2 -- test/org/apache/coyote/http2/TestHttp2Limits.java | 4 ---- test/org/apache/coyote/http2/TestHttp2Section_6_8.java | 17 ++--------------- test/org/apache/coyote/http2/TestHttp2Section_8_1.java | 2 -- 5 files changed, 7 insertions(+), 24 deletions(-) diff --git a/test/org/apache/coyote/http2/Http2TestBase.java b/test/org/apache/coyote/http2/Http2TestBase.java index db5451b..0361296 100644 --- a/test/org/apache/coyote/http2/Http2TestBase.java +++ b/test/org/apache/coyote/http2/Http2TestBase.java @@ -78,6 +78,7 @@ public abstract class Http2TestBase extends TomcatBaseTest { protected static final String TRAILER_HEADER_NAME = "X-TrailerTest"; protected static final String TRAILER_HEADER_VALUE = "test"; + // Client private Socket s; protected HpackEncoder hpackEncoder; protected Input input; @@ -85,6 +86,9 @@ public abstract class Http2TestBase extends TomcatBaseTest { protected Http2Parser parser; protected OutputStream os; + // Server + protected Http2Protocol http2Protocol; + private long pingAckDelayMillis = 0; @@ -533,7 +537,7 @@ public abstract class Http2TestBase extends TomcatBaseTest { protected void enableHttp2(long maxConcurrentStreams) { Connector connector = getTomcatInstance().getConnector(); - Http2Protocol http2Protocol = new Http2Protocol(); + http2Protocol = new Http2Protocol(); // Short timeouts for now. May need to increase these for CI systems. http2Protocol.setReadTimeout(6000); http2Protocol.setWriteTimeout(6000); diff --git a/test/org/apache/coyote/http2/TestAbortedUpload.java b/test/org/apache/coyote/http2/TestAbortedUpload.java index 403d0db..69e093b 100644 --- a/test/org/apache/coyote/http2/TestAbortedUpload.java +++ b/test/org/apache/coyote/http2/TestAbortedUpload.java @@ -37,8 +37,6 @@ public class TestAbortedUpload extends Http2TestBase { public void testAbortedRequest() throws Exception { http2Connect(); - Http2Protocol http2Protocol = - (Http2Protocol) getTomcatInstance().getConnector().findUpgradeProtocols()[0]; http2Protocol.setAllowedTrailerHeaders(TRAILER_HEADER_NAME); int bodySize = 8192; diff --git a/test/org/apache/coyote/http2/TestHttp2Limits.java b/test/org/apache/coyote/http2/TestHttp2Limits.java index 91b59b0..97f7b4e 100644 --- a/test/org/apache/coyote/http2/TestHttp2Limits.java +++ b/test/org/apache/coyote/http2/TestHttp2Limits.java @@ -193,8 +193,6 @@ public class TestHttp2Limits extends Http2TestBase { enableHttp2(); - Http2Protocol http2Protocol = - (Http2Protocol) getTomcatInstance().getConnector().findUpgradeProtocols()[0]; http2Protocol.setMaxHeaderCount(maxHeaderCount); http2Protocol.setMaxHeaderSize(maxHeaderSize); @@ -432,8 +430,6 @@ public class TestHttp2Limits extends Http2TestBase { FailureMode failMode) throws Exception { enableHttp2(); - Http2Protocol http2Protocol = - (Http2Protocol) getTomcatInstance().getConnector().findUpgradeProtocols()[0]; http2Protocol.setAllowedTrailerHeaders(TRAILER_HEADER_NAME); http2Protocol.setMaxTrailerCount(maxTrailerCount); http2Protocol.setMaxTrailerSize(maxTrailerSize); diff --git a/test/org/apache/coyote/http2/TestHttp2Section_6_8.java b/test/org/apache/coyote/http2/TestHttp2Section_6_8.java index 7105bc1..c43a0b5 100644 --- a/test/org/apache/coyote/http2/TestHttp2Section_6_8.java +++ b/test/org/apache/coyote/http2/TestHttp2Section_6_8.java @@ -19,8 +19,6 @@ package org.apache.coyote.http2; import org.junit.Assert; import org.junit.Test; -import org.apache.catalina.connector.Connector; - /** * Unit tests for Section 6.8 of * <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>. @@ -40,20 +38,9 @@ public class TestHttp2Section_6_8 extends Http2TestBase { public void testGoawayIgnoreNewStreams() throws Exception { setPingAckDelayMillis(PING_ACK_DELAY_MS); - // HTTP2 upgrade - need longer timeouts for this test - Connector connector = getTomcatInstance().getConnector(); - Http2Protocol http2Protocol = new Http2Protocol(); - // Short timeouts for now. May need to increase these for CI systems. - http2Protocol.setReadTimeout(5000); - http2Protocol.setKeepAliveTimeout(10000); - http2Protocol.setWriteTimeout(5000); + http2Connect(); + http2Protocol.setMaxConcurrentStreams(200); - connector.addUpgradeProtocol(http2Protocol); - configureAndStartWebApplication(); - openClientConnection(); - doHttpUpgrade(); - sendClientPreface(); - validateHttp2InitialResponse(); Thread.sleep(PING_ACK_DELAY_MS + TIMING_MARGIN_MS); diff --git a/test/org/apache/coyote/http2/TestHttp2Section_8_1.java b/test/org/apache/coyote/http2/TestHttp2Section_8_1.java index 5eb0606..cd44280 100644 --- a/test/org/apache/coyote/http2/TestHttp2Section_8_1.java +++ b/test/org/apache/coyote/http2/TestHttp2Section_8_1.java @@ -47,8 +47,6 @@ public class TestHttp2Section_8_1 extends Http2TestBase { private void doTestPostWithTrailerHeaders(boolean allowTrailerHeader) throws Exception{ http2Connect(); if (allowTrailerHeader) { - Http2Protocol http2Protocol = - (Http2Protocol) getTomcatInstance().getConnector().findUpgradeProtocols()[0]; http2Protocol.setAllowedTrailerHeaders(TRAILER_HEADER_NAME); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org