Addressing Checkstyle violations in src/test/java
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
parent
a7b9df96fd
commit
8c65309963
|
@ -26,13 +26,13 @@ public class DemoServer
|
|||
public static void main(String[] args)
|
||||
throws Exception
|
||||
{
|
||||
String jetty_home = System.getProperty("jetty.home", ".");
|
||||
String jettyHome = System.getProperty("jetty.home", ".");
|
||||
|
||||
Server server = new Server(Integer.getInteger("jetty.http.port", 8080).intValue());
|
||||
|
||||
WebAppContext webapp = new WebAppContext();
|
||||
webapp.setContextPath("/");
|
||||
webapp.setWar(jetty_home + "/target/async-rest/");
|
||||
webapp.setWar(jettyHome + "/target/async-rest/");
|
||||
webapp.setParentLoaderPriority(true);
|
||||
webapp.setServerClasses(new String[]{});
|
||||
server.setHandler(webapp);
|
||||
|
|
|
@ -220,7 +220,7 @@ public class TestAnnotationParser
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testJep238MultiReleaseInJar_JDK10() throws Exception
|
||||
public void testJep238MultiReleaseInJarJDK10() throws Exception
|
||||
{
|
||||
File jdk10Jar = MavenTestingUtils.getTestResourceFile("jdk10/multirelease-10.jar");
|
||||
AnnotationParser parser = new AnnotationParser();
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.io.InterruptedIOException;
|
|||
import java.nio.ByteBuffer;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletInputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
@ -50,13 +49,13 @@ public class ClientConnectionCloseTest extends AbstractHttpClientServerTest
|
|||
{
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_ClientConnectionClose_ServerConnectionClose_ClientClosesAfterExchange(Scenario scenario) throws Exception
|
||||
public void testClientConnectionCloseServerConnectionCloseClientClosesAfterExchange(Scenario scenario) throws Exception
|
||||
{
|
||||
byte[] data = new byte[128 * 1024];
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
|
||||
|
@ -107,12 +106,12 @@ public class ClientConnectionCloseTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_ClientConnectionClose_ServerDoesNotRespond_ClientIdleTimeout(Scenario scenario) throws Exception
|
||||
public void testClientConnectionCloseServerDoesNotRespondClientIdleTimeout(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
request.startAsync();
|
||||
|
@ -149,13 +148,13 @@ public class ClientConnectionCloseTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_ClientConnectionClose_ServerPartialResponse_ClientIdleTimeout(Scenario scenario) throws Exception
|
||||
public void testClientConnectionCloseServerPartialResponseClientIdleTimeout(Scenario scenario) throws Exception
|
||||
{
|
||||
long idleTimeout = 1000;
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
|
||||
|
@ -213,12 +212,12 @@ public class ClientConnectionCloseTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_ClientConnectionClose_ServerNoConnectionClose_ClientCloses(Scenario scenario) throws Exception
|
||||
public void testClientConnectionCloseServerNoConnectionCloseClientCloses(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.setContentLength(0);
|
||||
|
|
|
@ -115,51 +115,51 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_BasicAuthentication(Scenario scenario) throws Exception
|
||||
public void testBasicAuthentication(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler());
|
||||
URI uri = URI.create(scenario.getScheme() + "://localhost:" + connector.getLocalPort());
|
||||
test_Authentication(scenario, new BasicAuthentication(uri, realm, "basic", "basic"));
|
||||
testAuthentication(scenario, new BasicAuthentication(uri, realm, "basic", "basic"));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_BasicEmptyRealm(Scenario scenario) throws Exception
|
||||
public void testBasicEmptyRealm(Scenario scenario) throws Exception
|
||||
{
|
||||
realm = "";
|
||||
startBasic(scenario, new EmptyServerHandler());
|
||||
URI uri = URI.create(scenario.getScheme() + "://localhost:" + connector.getLocalPort());
|
||||
test_Authentication(scenario, new BasicAuthentication(uri, realm, "basic", "basic"));
|
||||
testAuthentication(scenario, new BasicAuthentication(uri, realm, "basic", "basic"));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_BasicAnyRealm(Scenario scenario) throws Exception
|
||||
public void testBasicAnyRealm(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler());
|
||||
URI uri = URI.create(scenario.getScheme() + "://localhost:" + connector.getLocalPort());
|
||||
test_Authentication(scenario, new BasicAuthentication(uri, ANY_REALM, "basic", "basic"));
|
||||
testAuthentication(scenario, new BasicAuthentication(uri, ANY_REALM, "basic", "basic"));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_DigestAuthentication(Scenario scenario) throws Exception
|
||||
public void testDigestAuthentication(Scenario scenario) throws Exception
|
||||
{
|
||||
startDigest(scenario, new EmptyServerHandler());
|
||||
URI uri = URI.create(scenario.getScheme() + "://localhost:" + connector.getLocalPort());
|
||||
test_Authentication(scenario, new DigestAuthentication(uri, realm, "digest", "digest"));
|
||||
testAuthentication(scenario, new DigestAuthentication(uri, realm, "digest", "digest"));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_DigestAnyRealm(Scenario scenario) throws Exception
|
||||
public void testDigestAnyRealm(Scenario scenario) throws Exception
|
||||
{
|
||||
startDigest(scenario, new EmptyServerHandler());
|
||||
URI uri = URI.create(scenario.getScheme() + "://localhost:" + connector.getLocalPort());
|
||||
test_Authentication(scenario, new DigestAuthentication(uri, ANY_REALM, "digest", "digest"));
|
||||
testAuthentication(scenario, new DigestAuthentication(uri, ANY_REALM, "digest", "digest"));
|
||||
}
|
||||
|
||||
private void test_Authentication(final Scenario scenario, Authentication authentication) throws Exception
|
||||
private void testAuthentication(final Scenario scenario, Authentication authentication) throws Exception
|
||||
{
|
||||
AuthenticationStore authenticationStore = client.getAuthenticationStore();
|
||||
|
||||
|
@ -226,7 +226,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_BasicAuthentication_ThenRedirect(Scenario scenario) throws Exception
|
||||
public void testBasicAuthenticationThenRedirect(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler()
|
||||
{
|
||||
|
@ -271,7 +271,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_Redirect_ThenBasicAuthentication(Scenario scenario) throws Exception
|
||||
public void testRedirectThenBasicAuthentication(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler()
|
||||
{
|
||||
|
@ -310,7 +310,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_BasicAuthentication_WithAuthenticationRemoved(Scenario scenario) throws Exception
|
||||
public void testBasicAuthenticationWithAuthenticationRemoved(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -359,7 +359,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_BasicAuthentication_WithWrongPassword(Scenario scenario) throws Exception
|
||||
public void testBasicAuthenticationWithWrongPassword(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -379,7 +379,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_Authentication_ThrowsException(Scenario scenario) throws Exception
|
||||
public void testAuthenticationThrowsException(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -419,7 +419,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_PreemptedAuthentication(Scenario scenario) throws Exception
|
||||
public void testPreemptedAuthentication(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -449,7 +449,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_NonReproducibleContent(Scenario scenario) throws Exception
|
||||
public void testNonReproducibleContent(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -484,7 +484,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_RequestFailsAfterResponse(Scenario scenario) throws Exception
|
||||
public void testRequestFailsAfterResponse(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler()
|
||||
{
|
||||
|
@ -576,7 +576,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_InfiniteAuthentication(Scenario scenario) throws Exception
|
||||
public void testInfiniteAuthentication(Scenario scenario) throws Exception
|
||||
{
|
||||
String authType = "Authenticate";
|
||||
start(scenario, new EmptyServerHandler()
|
||||
|
|
|
@ -63,7 +63,7 @@ public class HttpClientChunkedContentTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Server_HeadersPauseTerminal_Client_Response() throws Exception
|
||||
public void testServerHeadersPauseTerminalClientResponse() throws Exception
|
||||
{
|
||||
startClient();
|
||||
|
||||
|
@ -115,7 +115,7 @@ public class HttpClientChunkedContentTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Server_ContentTerminal_Client_ContentDelay() throws Exception
|
||||
public void testServerContentTerminalClientContentDelay() throws Exception
|
||||
{
|
||||
startClient();
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest
|
|||
{
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_303(Scenario scenario) throws Exception
|
||||
public void test303(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new RedirectHandler());
|
||||
|
||||
|
@ -75,7 +75,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_303_302(Scenario scenario) throws Exception
|
||||
public void test303302(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new RedirectHandler());
|
||||
|
||||
|
@ -91,7 +91,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_303_302_OnDifferentDestinations(Scenario scenario) throws Exception
|
||||
public void test303302OnDifferentDestinations(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new RedirectHandler());
|
||||
|
||||
|
@ -107,7 +107,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_301(Scenario scenario) throws Exception
|
||||
public void test301(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new RedirectHandler());
|
||||
|
||||
|
@ -124,7 +124,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_301_WithWrongMethod(Scenario scenario) throws Exception
|
||||
public void test301WithWrongMethod(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new RedirectHandler());
|
||||
|
||||
|
@ -144,7 +144,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_307_WithRequestContent(Scenario scenario) throws Exception
|
||||
public void test307WithRequestContent(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new RedirectHandler());
|
||||
|
||||
|
@ -184,7 +184,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_303_WithConnectionClose_WithBigRequest(Scenario scenario) throws Exception
|
||||
public void test303WithConnectionCloseWithBigRequest(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new RedirectHandler());
|
||||
|
||||
|
@ -314,84 +314,84 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_HEAD_301(Scenario scenario) throws Exception
|
||||
public void testHEAD301(Scenario scenario) throws Exception
|
||||
{
|
||||
testSameMethodRedirect(scenario, HttpMethod.HEAD, HttpStatus.MOVED_PERMANENTLY_301);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_POST_301(Scenario scenario) throws Exception
|
||||
public void testPOST301(Scenario scenario) throws Exception
|
||||
{
|
||||
testGETRedirect(scenario, HttpMethod.POST, HttpStatus.MOVED_PERMANENTLY_301);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_PUT_301(Scenario scenario) throws Exception
|
||||
public void testPUT301(Scenario scenario) throws Exception
|
||||
{
|
||||
testSameMethodRedirect(scenario, HttpMethod.PUT, HttpStatus.MOVED_PERMANENTLY_301);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_HEAD_302(Scenario scenario) throws Exception
|
||||
public void testHEAD302(Scenario scenario) throws Exception
|
||||
{
|
||||
testSameMethodRedirect(scenario, HttpMethod.HEAD, HttpStatus.FOUND_302);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_POST_302(Scenario scenario) throws Exception
|
||||
public void testPOST302(Scenario scenario) throws Exception
|
||||
{
|
||||
testGETRedirect(scenario, HttpMethod.POST, HttpStatus.FOUND_302);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_PUT_302(Scenario scenario) throws Exception
|
||||
public void testPUT302(Scenario scenario) throws Exception
|
||||
{
|
||||
testSameMethodRedirect(scenario, HttpMethod.PUT, HttpStatus.FOUND_302);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_HEAD_303(Scenario scenario) throws Exception
|
||||
public void testHEAD303(Scenario scenario) throws Exception
|
||||
{
|
||||
testSameMethodRedirect(scenario, HttpMethod.HEAD, HttpStatus.SEE_OTHER_303);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_POST_303(Scenario scenario) throws Exception
|
||||
public void testPOST303(Scenario scenario) throws Exception
|
||||
{
|
||||
testGETRedirect(scenario, HttpMethod.POST, HttpStatus.SEE_OTHER_303);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_PUT_303(Scenario scenario) throws Exception
|
||||
public void testPUT303(Scenario scenario) throws Exception
|
||||
{
|
||||
testGETRedirect(scenario, HttpMethod.PUT, HttpStatus.SEE_OTHER_303);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_HEAD_307(Scenario scenario) throws Exception
|
||||
public void testHEAD307(Scenario scenario) throws Exception
|
||||
{
|
||||
testSameMethodRedirect(scenario, HttpMethod.HEAD, HttpStatus.TEMPORARY_REDIRECT_307);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_POST_307(Scenario scenario) throws Exception
|
||||
public void testPOST307(Scenario scenario) throws Exception
|
||||
{
|
||||
testSameMethodRedirect(scenario, HttpMethod.POST, HttpStatus.TEMPORARY_REDIRECT_307);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_PUT_307(Scenario scenario) throws Exception
|
||||
public void testPUT307(Scenario scenario) throws Exception
|
||||
{
|
||||
testSameMethodRedirect(scenario, HttpMethod.PUT, HttpStatus.TEMPORARY_REDIRECT_307);
|
||||
}
|
||||
|
|
|
@ -112,6 +112,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
@ExtendWith(WorkDirExtension.class)
|
||||
public class HttpClientTest extends AbstractHttpClientServerTest
|
||||
{
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
public WorkDir testdir;
|
||||
|
||||
@ParameterizedTest
|
||||
|
@ -151,7 +152,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_DestinationCount(Scenario scenario) throws Exception
|
||||
public void testDestinationCount(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -171,7 +172,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_GET_ResponseWithoutContent(Scenario scenario) throws Exception
|
||||
public void testGETResponseWithoutContent(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -183,7 +184,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_GET_ResponseWithContent(Scenario scenario) throws Exception
|
||||
public void testGETResponseWithContent(Scenario scenario) throws Exception
|
||||
{
|
||||
final byte[] data = new byte[]{0, 1, 2, 3, 4, 5, 6, 7};
|
||||
start(scenario, new AbstractHandler()
|
||||
|
@ -207,7 +208,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_GET_WithParameters_ResponseWithContent(Scenario scenario) throws Exception
|
||||
public void testGETWithParametersResponseWithContent(Scenario scenario) throws Exception
|
||||
{
|
||||
final String paramName1 = "a";
|
||||
final String paramName2 = "b";
|
||||
|
@ -240,7 +241,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_GET_WithParametersMultiValued_ResponseWithContent(Scenario scenario) throws Exception
|
||||
public void testGETWithParametersMultiValuedResponseWithContent(Scenario scenario) throws Exception
|
||||
{
|
||||
final String paramName1 = "a";
|
||||
final String paramName2 = "b";
|
||||
|
@ -279,7 +280,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_POST_WithParameters(Scenario scenario) throws Exception
|
||||
public void testPOSTWithParameters(Scenario scenario) throws Exception
|
||||
{
|
||||
final String paramName = "a";
|
||||
final String paramValue = "\u20AC";
|
||||
|
@ -311,7 +312,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_PUT_WithParameters(Scenario scenario) throws Exception
|
||||
public void testPUTWithParameters(Scenario scenario) throws Exception
|
||||
{
|
||||
final String paramName = "a";
|
||||
final String paramValue = "\u20AC";
|
||||
|
@ -345,7 +346,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_POST_WithParameters_WithContent(Scenario scenario) throws Exception
|
||||
public void testPOSTWithParametersWithContent(Scenario scenario) throws Exception
|
||||
{
|
||||
final byte[] content = {0, 1, 2, 3};
|
||||
final String paramName = "a";
|
||||
|
@ -380,7 +381,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_POST_WithContent_NotifiesRequestContentListener(Scenario scenario) throws Exception
|
||||
public void testPOSTWithContentNotifiesRequestContentListener(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
|
@ -411,7 +412,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_POST_WithContent_TracksProgress(Scenario scenario) throws Exception
|
||||
public void testPOSTWithContentTracksProgress(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
|
@ -445,7 +446,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_QueuedRequest_IsSent_WhenPreviousRequestSucceeded(Scenario scenario) throws Exception
|
||||
public void testQueuedRequestIsSentWhenPreviousRequestSucceeded(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -494,7 +495,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_QueuedRequest_IsSent_WhenPreviousRequestClosedConnection(Scenario scenario) throws Exception
|
||||
public void testQueuedRequestIsSentWhenPreviousRequestClosedConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
|
@ -510,7 +511,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
client.setMaxConnectionsPerDestination(1);
|
||||
|
||||
try (StacklessLogging stackless = new StacklessLogging(org.eclipse.jetty.server.HttpChannel.class))
|
||||
try (StacklessLogging ignored = new StacklessLogging(org.eclipse.jetty.server.HttpChannel.class))
|
||||
{
|
||||
final CountDownLatch latch = new CountDownLatch(2);
|
||||
client.newRequest("localhost", connector.getLocalPort())
|
||||
|
@ -535,7 +536,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_ExchangeIsComplete_OnlyWhenBothRequestAndResponseAreComplete(Scenario scenario) throws Exception
|
||||
public void testExchangeIsCompleteOnlyWhenBothRequestAndResponseAreComplete(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
|
@ -614,7 +615,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_ExchangeIsComplete_WhenRequestFailsMidway_WithResponse(Scenario scenario) throws Exception
|
||||
public void testExchangeIsCompleteWhenRequestFailsMidwayWithResponse(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
|
@ -677,7 +678,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_ExchangeIsComplete_WhenRequestFails_WithNoResponse(Scenario scenario) throws Exception
|
||||
public void testExchangeIsCompleteWhenRequestFailsWithNoResponse(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -707,7 +708,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
@DisabledIfSystemProperty(named = "env", matches = "ci") // TODO: SLOW, needs review
|
||||
public void test_Request_IdleTimeout(Scenario scenario) throws Exception
|
||||
public void testRequestIdleTimeout(Scenario scenario) throws Exception
|
||||
{
|
||||
final long idleTimeout = 1000;
|
||||
start(scenario, new AbstractHandler()
|
||||
|
@ -824,7 +825,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_HEAD_With_ResponseContentLength(Scenario scenario) throws Exception
|
||||
public void testHEADWithResponseContentLength(Scenario scenario) throws Exception
|
||||
{
|
||||
final int length = 1024;
|
||||
start(scenario, new AbstractHandler()
|
||||
|
@ -1328,7 +1329,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
request.startAsync();
|
||||
|
@ -1355,7 +1356,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void testSmallContentDelimitedByEOFWithSlowRequestHTTP10(Scenario scenario) throws Exception
|
||||
public void testSmallContentDelimitedByEOFWithSlowRequestHTTP10(Scenario scenario)
|
||||
{
|
||||
Assumptions.assumeTrue(HttpScheme.HTTP.is(scenario.getScheme()));
|
||||
|
||||
|
@ -1370,7 +1371,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(NonSslScenarioProvider.class)
|
||||
public void testBigContentDelimitedByEOFWithSlowRequestHTTP10(Scenario scenario) throws Exception
|
||||
public void testBigContentDelimitedByEOFWithSlowRequestHTTP10(Scenario scenario)
|
||||
{
|
||||
ExecutionException e = assertThrows(ExecutionException.class, () ->
|
||||
{
|
||||
|
@ -1409,7 +1410,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
// Send Connection: close to avoid that the server chunks the content with HTTP 1.1.
|
||||
|
@ -1445,7 +1446,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
int count = requests.incrementAndGet();
|
||||
if (count == maxRetries)
|
||||
|
@ -1474,7 +1475,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
ServletOutputStream output = response.getOutputStream();
|
||||
|
@ -1524,7 +1525,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
startServer(scenario, new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
}
|
||||
|
@ -1628,13 +1629,13 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_IPv6_Host(Scenario scenario) throws Exception
|
||||
public void testIPv6Host(Scenario scenario) throws Exception
|
||||
{
|
||||
Assumptions.assumeTrue(Net.isIpv6InterfaceAvailable());
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.setContentType("text/plain");
|
||||
|
@ -1709,7 +1710,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
assertThat(request.getHeader("Host"), Matchers.notNullValue());
|
||||
|
|
|
@ -59,6 +59,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
|
||||
public class HttpClientURITest extends AbstractHttpClientServerTest
|
||||
{
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void testIPv6Host(Scenario scenario) throws Exception
|
||||
|
|
|
@ -18,14 +18,12 @@
|
|||
|
||||
package org.eclipse.jetty.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
@ -62,7 +60,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_SuccessfulRequest_ReturnsConnection(Scenario scenario) throws Exception
|
||||
public void testSuccessfulRequestReturnsConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -113,7 +111,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_FailedRequest_RemovesConnection(Scenario scenario) throws Exception
|
||||
public void testFailedRequestRemovesConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -165,7 +163,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_BadRequest_RemovesConnection(Scenario scenario) throws Exception
|
||||
public void testBadRequestRemovesConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -227,7 +225,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
@ArgumentsSource(ScenarioProvider.class)
|
||||
@Tag("Slow")
|
||||
@DisabledIfSystemProperty(named = "env", matches = "ci") // TODO: SLOW, needs review
|
||||
public void test_BadRequest_WithSlowRequest_RemovesConnection(Scenario scenario) throws Exception
|
||||
public void testBadRequestWithSlowRequestRemovesConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -301,7 +299,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_ConnectionFailure_RemovesConnection(Scenario scenario) throws Exception
|
||||
public void testConnectionFailureRemovesConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -336,12 +334,12 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_ResponseWithConnectionCloseHeader_RemovesConnection(Scenario scenario) throws Exception
|
||||
public void testResponseWithConnectionCloseHeaderRemovesConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
response.setHeader("Connection", "close");
|
||||
baseRequest.setHandled(true);
|
||||
|
@ -382,14 +380,14 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_BigRequestContent_ResponseWithConnectionCloseHeader_RemovesConnection(Scenario scenario) throws Exception
|
||||
public void testBigRequestContentResponseWithConnectionCloseHeaderRemovesConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
try (StacklessLogging ignore = new StacklessLogging(HttpConnection.class))
|
||||
{
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
response.setHeader("Connection", "close");
|
||||
baseRequest.setHandled(true);
|
||||
|
@ -441,7 +439,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
@ArgumentsSource(ScenarioProvider.class)
|
||||
@Tag("Slow")
|
||||
@DisabledIfSystemProperty(named = "env", matches = "ci") // TODO: SLOW, needs review
|
||||
public void test_IdleConnection_IsClosed_OnRemoteClose(Scenario scenario) throws Exception
|
||||
public void testIdleConnectionIsClosedOnRemoteClose(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
package org.eclipse.jetty.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.HttpCookie;
|
||||
import java.net.URI;
|
||||
import java.util.Arrays;
|
||||
|
@ -27,7 +26,6 @@ import java.util.List;
|
|||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
@ -52,14 +50,14 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_CookieIsStored(Scenario scenario) throws Exception
|
||||
public void testCookieIsStored(Scenario scenario) throws Exception
|
||||
{
|
||||
final String name = "foo";
|
||||
final String value = "bar";
|
||||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
response.addCookie(new Cookie(name, value));
|
||||
}
|
||||
|
@ -82,14 +80,14 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_CookieIsSent(Scenario scenario) throws Exception
|
||||
public void testCookieIsSent(Scenario scenario) throws Exception
|
||||
{
|
||||
final String name = "foo";
|
||||
final String value = "bar";
|
||||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
Cookie[] cookies = request.getCookies();
|
||||
assertNotNull(cookies);
|
||||
|
@ -113,12 +111,12 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_CookieWithoutValue(Scenario scenario) throws Exception
|
||||
public void testCookieWithoutValue(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
response.addHeader("Set-Cookie", "");
|
||||
}
|
||||
|
@ -133,14 +131,14 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_PerRequestCookieIsSent(Scenario scenario) throws Exception
|
||||
public void testPerRequestCookieIsSent(Scenario scenario) throws Exception
|
||||
{
|
||||
final String name = "foo";
|
||||
final String value = "bar";
|
||||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
Cookie[] cookies = request.getCookies();
|
||||
assertNotNull(cookies);
|
||||
|
@ -161,7 +159,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_SetCookieWithoutPath_RequestURIWithOneSegment(Scenario scenario) throws Exception
|
||||
public void testSetCookieWithoutPathRequestURIWithOneSegment(Scenario scenario) throws Exception
|
||||
{
|
||||
String headerName = "X-Request";
|
||||
String cookieName = "a";
|
||||
|
@ -169,7 +167,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
int r = request.getIntHeader(headerName);
|
||||
if ("/foo".equals(target) && r == 0)
|
||||
|
@ -217,7 +215,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_SetCookieWithoutPath_RequestURIWithTwoSegments(Scenario scenario) throws Exception
|
||||
public void testSetCookieWithoutPathRequestURIWithTwoSegments(Scenario scenario) throws Exception
|
||||
{
|
||||
String headerName = "X-Request";
|
||||
String cookieName = "a";
|
||||
|
@ -225,7 +223,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
int r = request.getIntHeader(headerName);
|
||||
if ("/foo/bar".equals(target) && r == 0)
|
||||
|
@ -278,7 +276,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_SetCookieWithLongerPath(Scenario scenario) throws Exception
|
||||
public void testSetCookieWithLongerPath(Scenario scenario) throws Exception
|
||||
{
|
||||
String headerName = "X-Request";
|
||||
String cookieName = "a";
|
||||
|
@ -286,7 +284,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
int r = request.getIntHeader(headerName);
|
||||
if ("/foo".equals(target) && r == 0)
|
||||
|
@ -339,7 +337,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_SetCookieWithShorterPath(Scenario scenario) throws Exception
|
||||
public void testSetCookieWithShorterPath(Scenario scenario) throws Exception
|
||||
{
|
||||
String headerName = "X-Request";
|
||||
String cookieName = "a";
|
||||
|
@ -347,7 +345,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
int r = request.getIntHeader(headerName);
|
||||
if ("/foo/bar".equals(target) && r == 0)
|
||||
|
@ -400,7 +398,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_TwoSetCookieWithSameNameSamePath(Scenario scenario) throws Exception
|
||||
public void testTwoSetCookieWithSameNameSamePath(Scenario scenario) throws Exception
|
||||
{
|
||||
String headerName = "X-Request";
|
||||
String cookieName = "a";
|
||||
|
@ -409,7 +407,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
int r = request.getIntHeader(headerName);
|
||||
if ("/foo".equals(target) && r == 0)
|
||||
|
@ -463,7 +461,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_TwoSetCookieWithSameNameDifferentPath(Scenario scenario) throws Exception
|
||||
public void testTwoSetCookieWithSameNameDifferentPath(Scenario scenario) throws Exception
|
||||
{
|
||||
String headerName = "X-Request";
|
||||
String cookieName = "a";
|
||||
|
@ -472,7 +470,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
int r = request.getIntHeader(headerName);
|
||||
if ("/foo".equals(target) && r == 0)
|
||||
|
@ -533,7 +531,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_TwoSetCookieWithSameNamePath1PrefixOfPath2(Scenario scenario) throws Exception
|
||||
public void testTwoSetCookieWithSameNamePath1PrefixOfPath2(Scenario scenario) throws Exception
|
||||
{
|
||||
String headerName = "X-Request";
|
||||
String cookieName = "a";
|
||||
|
@ -542,7 +540,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
int r = request.getIntHeader(headerName);
|
||||
if ("/foo".equals(target) && r == 0)
|
||||
|
@ -606,7 +604,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_CookiePathWithTrailingSlash(Scenario scenario) throws Exception
|
||||
public void testCookiePathWithTrailingSlash(Scenario scenario) throws Exception
|
||||
{
|
||||
String headerName = "X-Request";
|
||||
String cookieName = "a";
|
||||
|
@ -614,7 +612,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
int r = request.getIntHeader(headerName);
|
||||
if ("/foo/bar".equals(target) && r == 0)
|
||||
|
|
|
@ -49,10 +49,11 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
@Disabled
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
public class Usage
|
||||
{
|
||||
@Test
|
||||
public void testGETBlocking_ShortAPI() throws Exception
|
||||
public void testGETBlockingShortAPI() throws Exception
|
||||
{
|
||||
HttpClient client = new HttpClient();
|
||||
client.start();
|
||||
|
@ -120,7 +121,7 @@ public class Usage
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testPOSTWithParams_ShortAPI() throws Exception
|
||||
public void testPOSTWithParamsShortAPI() throws Exception
|
||||
{
|
||||
HttpClient client = new HttpClient();
|
||||
client.start();
|
||||
|
|
|
@ -52,7 +52,7 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest
|
|||
{
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_FirstAcquire_WithEmptyQueue(Scenario scenario) throws Exception
|
||||
public void testFirstAcquireWithEmptyQueue(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -72,7 +72,7 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_SecondAcquire_AfterFirstAcquire_WithEmptyQueue_ReturnsSameConnection(Scenario scenario) throws Exception
|
||||
public void testSecondAcquireAfterFirstAcquireWithEmptyQueueReturnsSameConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -96,7 +96,7 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_SecondAcquire_ConcurrentWithFirstAcquire_WithEmptyQueue_CreatesTwoConnections(Scenario scenario) throws Exception
|
||||
public void testSecondAcquireConcurrentWithFirstAcquireWithEmptyQueueCreatesTwoConnections(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -154,7 +154,7 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_Acquire_Process_Release_Acquire_ReturnsSameConnection(Scenario scenario) throws Exception
|
||||
public void testAcquireProcessReleaseAcquireReturnsSameConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -181,7 +181,7 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_IdleConnection_IdleTimeout(Scenario scenario) throws Exception
|
||||
public void testIdleConnectionIdleTimeout(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -209,7 +209,7 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_Request_Failed_If_MaxRequestsQueuedPerDestination_Exceeded(Scenario scenario) throws Exception
|
||||
public void testRequestFailedIfMaxRequestsQueuedPerDestinationExceeded(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
String scheme = scenario.getScheme();
|
||||
|
|
|
@ -61,7 +61,7 @@ public class HttpReceiverOverHTTPTest
|
|||
private ByteArrayEndPoint endPoint;
|
||||
private HttpConnectionOverHTTP connection;
|
||||
|
||||
public static Stream<Arguments> complianceModes() throws Exception
|
||||
public static Stream<Arguments> complianceModes()
|
||||
{
|
||||
return Stream.of(
|
||||
HttpCompliance.LEGACY,
|
||||
|
@ -102,7 +102,7 @@ public class HttpReceiverOverHTTPTest
|
|||
|
||||
@ParameterizedTest
|
||||
@MethodSource("complianceModes")
|
||||
public void test_Receive_NoResponseContent(HttpCompliance compliance) throws Exception
|
||||
public void testReceiveNoResponseContent(HttpCompliance compliance) throws Exception
|
||||
{
|
||||
init(compliance);
|
||||
endPoint.addInput(
|
||||
|
@ -126,7 +126,7 @@ public class HttpReceiverOverHTTPTest
|
|||
|
||||
@ParameterizedTest
|
||||
@MethodSource("complianceModes")
|
||||
public void test_Receive_ResponseContent(HttpCompliance compliance) throws Exception
|
||||
public void testReceiveResponseContent(HttpCompliance compliance) throws Exception
|
||||
{
|
||||
init(compliance);
|
||||
String content = "0123456789ABCDEF";
|
||||
|
@ -154,7 +154,7 @@ public class HttpReceiverOverHTTPTest
|
|||
|
||||
@ParameterizedTest
|
||||
@MethodSource("complianceModes")
|
||||
public void test_Receive_ResponseContent_EarlyEOF(HttpCompliance compliance) throws Exception
|
||||
public void testReceiveResponseContentEarlyEOF(HttpCompliance compliance) throws Exception
|
||||
{
|
||||
init(compliance);
|
||||
String content1 = "0123456789";
|
||||
|
@ -176,7 +176,7 @@ public class HttpReceiverOverHTTPTest
|
|||
|
||||
@ParameterizedTest
|
||||
@MethodSource("complianceModes")
|
||||
public void test_Receive_ResponseContent_IdleTimeout(HttpCompliance compliance) throws Exception
|
||||
public void testReceiveResponseContentIdleTimeout(HttpCompliance compliance) throws Exception
|
||||
{
|
||||
init(compliance);
|
||||
endPoint.addInput(
|
||||
|
@ -197,7 +197,7 @@ public class HttpReceiverOverHTTPTest
|
|||
|
||||
@ParameterizedTest
|
||||
@MethodSource("complianceModes")
|
||||
public void test_Receive_BadResponse(HttpCompliance compliance) throws Exception
|
||||
public void testReceiveBadResponse(HttpCompliance compliance) throws Exception
|
||||
{
|
||||
init(compliance);
|
||||
endPoint.addInput(
|
||||
|
@ -216,7 +216,7 @@ public class HttpReceiverOverHTTPTest
|
|||
|
||||
@ParameterizedTest
|
||||
@MethodSource("complianceModes")
|
||||
public void test_FillInterested_RacingWith_BufferRelease(HttpCompliance compliance) throws Exception
|
||||
public void testFillInterestedRacingWithBufferRelease(HttpCompliance compliance) throws Exception
|
||||
{
|
||||
init(compliance);
|
||||
connection = new HttpConnectionOverHTTP(endPoint, destination, new Promise.Adapter<>())
|
||||
|
|
|
@ -61,7 +61,7 @@ public class HttpSenderOverHTTPTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Send_NoRequestContent() throws Exception
|
||||
public void testSendNoRequestContent() throws Exception
|
||||
{
|
||||
ByteArrayEndPoint endPoint = new ByteArrayEndPoint();
|
||||
HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", 8080));
|
||||
|
@ -95,7 +95,7 @@ public class HttpSenderOverHTTPTest
|
|||
|
||||
@Test
|
||||
@DisabledIfSystemProperty(named = "env", matches = "ci") // TODO: SLOW, needs review
|
||||
public void test_Send_NoRequestContent_IncompleteFlush() throws Exception
|
||||
public void testSendNoRequestContentIncompleteFlush() throws Exception
|
||||
{
|
||||
ByteArrayEndPoint endPoint = new ByteArrayEndPoint("", 16);
|
||||
HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", 8080));
|
||||
|
@ -123,7 +123,7 @@ public class HttpSenderOverHTTPTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Send_NoRequestContent_Exception() throws Exception
|
||||
public void testSendNoRequestContentException() throws Exception
|
||||
{
|
||||
ByteArrayEndPoint endPoint = new ByteArrayEndPoint();
|
||||
// Shutdown output to trigger the exception on write
|
||||
|
@ -155,7 +155,7 @@ public class HttpSenderOverHTTPTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Send_NoRequestContent_IncompleteFlush_Exception() throws Exception
|
||||
public void testSendNoRequestContentIncompleteFlushException() throws Exception
|
||||
{
|
||||
ByteArrayEndPoint endPoint = new ByteArrayEndPoint("", 16);
|
||||
HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", 8080));
|
||||
|
@ -191,7 +191,7 @@ public class HttpSenderOverHTTPTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Send_SmallRequestContent_InOneBuffer() throws Exception
|
||||
public void testSendSmallRequestContentInOneBuffer() throws Exception
|
||||
{
|
||||
ByteArrayEndPoint endPoint = new ByteArrayEndPoint();
|
||||
HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", 8080));
|
||||
|
@ -226,7 +226,7 @@ public class HttpSenderOverHTTPTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Send_SmallRequestContent_InTwoBuffers() throws Exception
|
||||
public void testSendSmallRequestContentInTwoBuffers() throws Exception
|
||||
{
|
||||
ByteArrayEndPoint endPoint = new ByteArrayEndPoint();
|
||||
HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", 8080));
|
||||
|
@ -262,7 +262,7 @@ public class HttpSenderOverHTTPTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Send_SmallRequestContent_Chunked_InTwoChunks() throws Exception
|
||||
public void testSendSmallRequestContentChunkedInTwoChunks() throws Exception
|
||||
{
|
||||
ByteArrayEndPoint endPoint = new ByteArrayEndPoint();
|
||||
HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", 8080));
|
||||
|
|
|
@ -62,6 +62,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
public class MultiPartContentProviderTest extends AbstractHttpClientServerTest
|
||||
{
|
||||
@ParameterizedTest
|
||||
|
|
|
@ -51,6 +51,7 @@ public class TypedContentProviderTest extends AbstractHttpClientServerTest
|
|||
final String value1 = "1";
|
||||
final String name2 = "b";
|
||||
final String value2 = "2";
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
final String value3 = "\u20AC";
|
||||
|
||||
start(scenario, new AbstractHandler()
|
||||
|
|
|
@ -86,13 +86,13 @@ public class AppLifeCycleTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFindPath_Deployed_Deployed()
|
||||
public void testFindPathDeployedDeployed()
|
||||
{
|
||||
assertNoPath("deployed", "deployed");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindPath_Deployed_Started()
|
||||
public void testFindPathDeployedStarted()
|
||||
{
|
||||
List<String> expected = new ArrayList<String>();
|
||||
expected.add("deployed");
|
||||
|
@ -102,7 +102,7 @@ public class AppLifeCycleTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFindPath_Deployed_Undeployed()
|
||||
public void testFindPathDeployedUndeployed()
|
||||
{
|
||||
List<String> expected = new ArrayList<String>();
|
||||
expected.add("deployed");
|
||||
|
@ -112,7 +112,7 @@ public class AppLifeCycleTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFindPath_Started_Deployed()
|
||||
public void testFindPathStartedDeployed()
|
||||
{
|
||||
List<String> expected = new ArrayList<String>();
|
||||
expected.add("started");
|
||||
|
@ -122,13 +122,13 @@ public class AppLifeCycleTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFindPath_Started_Started()
|
||||
public void testFindPathStartedStarted()
|
||||
{
|
||||
assertNoPath("started", "started");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindPath_Started_Undeployed()
|
||||
public void testFindPathStartedUndeployed()
|
||||
{
|
||||
List<String> expected = new ArrayList<String>();
|
||||
expected.add("started");
|
||||
|
@ -140,7 +140,7 @@ public class AppLifeCycleTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFindPath_Undeployed_Deployed()
|
||||
public void testFindPathUndeployedDeployed()
|
||||
{
|
||||
List<String> expected = new ArrayList<String>();
|
||||
expected.add("undeployed");
|
||||
|
@ -150,7 +150,7 @@ public class AppLifeCycleTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFindPath_Undeployed_Started()
|
||||
public void testFindPathUndeployedStarted()
|
||||
{
|
||||
List<String> expected = new ArrayList<String>();
|
||||
expected.add("undeployed");
|
||||
|
@ -162,7 +162,7 @@ public class AppLifeCycleTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFindPath_Undeployed_Uavailable()
|
||||
public void testFindPathUndeployedUnavailable()
|
||||
{
|
||||
assertNoPath("undeployed", "undeployed");
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class BadAppDeployTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBadApp_ThrowOnUnavailableTrue_XmlOrder() throws Exception
|
||||
public void testBadAppThrowOnUnavailableTrueXmlOrder() throws Exception
|
||||
{
|
||||
/* Non-working Bean Order as reported in Issue #3620
|
||||
It is important that this Order be maintained for an accurate test case.
|
||||
|
@ -116,7 +116,7 @@ public class BadAppDeployTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBadApp_ThrowOnUnavailableTrue_EmbeddedOrder() throws Exception
|
||||
public void testBadAppThrowOnUnavailableTrueEmbeddedOrder() throws Exception
|
||||
{
|
||||
/* Working Bean Order
|
||||
### BEAN: QueuedThreadPool[qtp1530388690]@5b37e0d2{STOPPED,8<=0<=200,i=0,r=-1,q=0}[NO_TRY]
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.junit.jupiter.api.Test;
|
|||
public class DeploymentManagerLifeCyclePathTest
|
||||
{
|
||||
@Test
|
||||
public void testStateTransition_NewToDeployed() throws Exception
|
||||
public void testStateTransitionNewToDeployed() throws Exception
|
||||
{
|
||||
DeploymentManager depman = new DeploymentManager();
|
||||
depman.setContexts(new ContextHandlerCollection());
|
||||
|
@ -64,7 +64,7 @@ public class DeploymentManagerLifeCyclePathTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testStateTransition_Receive() throws Exception
|
||||
public void testStateTransitionReceive() throws Exception
|
||||
{
|
||||
DeploymentManager depman = new DeploymentManager();
|
||||
depman.setContexts(new ContextHandlerCollection());
|
||||
|
@ -90,7 +90,7 @@ public class DeploymentManagerLifeCyclePathTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testStateTransition_DeployedToUndeployed() throws Exception
|
||||
public void testStateTransitionDeployedToUndeployed() throws Exception
|
||||
{
|
||||
DeploymentManager depman = new DeploymentManager();
|
||||
depman.setDefaultLifeCycleGoal(null); // no default
|
||||
|
|
|
@ -65,6 +65,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
|
||||
public class HttpClientTest extends AbstractHttpClientServerTest
|
||||
{
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
|
||||
@Test
|
||||
public void testGETResponseWithoutContent() throws Exception
|
||||
{
|
||||
|
|
|
@ -47,11 +47,11 @@ public class DrupalHTTP2FastCGIProxyServer
|
|||
|
||||
// HTTP(S) Configuration
|
||||
HttpConfiguration config = new HttpConfiguration();
|
||||
HttpConfiguration https_config = new HttpConfiguration(config);
|
||||
https_config.addCustomizer(new SecureRequestCustomizer());
|
||||
HttpConfiguration httpsConfig = new HttpConfiguration(config);
|
||||
httpsConfig.addCustomizer(new SecureRequestCustomizer());
|
||||
|
||||
// HTTP2 factory
|
||||
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(https_config);
|
||||
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(httpsConfig);
|
||||
ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory();
|
||||
alpn.setDefaultProtocol(h2.getProtocol());
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class DrupalHTTP2FastCGIProxyServer
|
|||
|
||||
// HTTP2 Connector
|
||||
ServerConnector http2Connector =
|
||||
new ServerConnector(server, ssl, alpn, h2, new HttpConnectionFactory(https_config));
|
||||
new ServerConnector(server, ssl, alpn, h2, new HttpConnectionFactory(httpsConfig));
|
||||
http2Connector.setPort(8443);
|
||||
http2Connector.setIdleTimeout(15000);
|
||||
server.addConnector(http2Connector);
|
||||
|
|
|
@ -52,12 +52,12 @@ public class WordPressHTTP2FastCGIProxyServer
|
|||
Server server = new Server();
|
||||
|
||||
// HTTP(S) Configuration
|
||||
HttpConfiguration config = new HttpConfiguration();
|
||||
HttpConfiguration https_config = new HttpConfiguration(config);
|
||||
https_config.addCustomizer(new SecureRequestCustomizer());
|
||||
HttpConfiguration httpConfig = new HttpConfiguration();
|
||||
HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig);
|
||||
httpsConfig.addCustomizer(new SecureRequestCustomizer());
|
||||
|
||||
// HTTP2 factory
|
||||
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(https_config);
|
||||
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(httpsConfig);
|
||||
ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory();
|
||||
alpn.setDefaultProtocol(h2.getProtocol());
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class WordPressHTTP2FastCGIProxyServer
|
|||
|
||||
// HTTP2 Connector
|
||||
ServerConnector http2Connector =
|
||||
new ServerConnector(server, ssl, alpn, h2, new HttpConnectionFactory(https_config));
|
||||
new ServerConnector(server, ssl, alpn, h2, new HttpConnectionFactory(httpsConfig));
|
||||
http2Connector.setPort(tlsPort);
|
||||
http2Connector.setIdleTimeout(15000);
|
||||
server.addConnector(http2Connector);
|
||||
|
|
|
@ -45,13 +45,13 @@ public class TestEndpointMultiplePublishProblem
|
|||
private static String default_impl = System.getProperty("com.sun.net.httpserver.HttpServerProvider");
|
||||
|
||||
@BeforeAll
|
||||
public static void change_Impl()
|
||||
public static void changeImpl()
|
||||
{
|
||||
System.setProperty("com.sun.net.httpserver.HttpServerProvider", JettyHttpServerProvider.class.getName());
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void restore_Impl()
|
||||
public static void restoreImpl()
|
||||
{
|
||||
if (default_impl != null)
|
||||
{
|
||||
|
|
|
@ -359,10 +359,10 @@ public class GZIPContentDecoderTest
|
|||
}
|
||||
|
||||
// Signed Integer Max
|
||||
final long INT_MAX = Integer.MAX_VALUE;
|
||||
static final long INT_MAX = Integer.MAX_VALUE;
|
||||
|
||||
// Unsigned Integer Max == 2^32
|
||||
final long UINT_MAX = 0xFFFFFFFFL;
|
||||
static final long UINT_MAX = 0xFFFFFFFFL;
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(longs = {INT_MAX, INT_MAX + 1, UINT_MAX, UINT_MAX + 1})
|
||||
|
|
|
@ -32,9 +32,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
|
||||
public class HttpFieldTest
|
||||
{
|
||||
|
||||
@Test
|
||||
public void testContainsSimple() throws Exception
|
||||
public void testContainsSimple()
|
||||
{
|
||||
HttpField field = new HttpField("name", "SomeValue");
|
||||
assertTrue(field.contains("somevalue"));
|
||||
|
@ -50,7 +49,7 @@ public class HttpFieldTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCaseInsensitiveHashcode_KnownField() throws Exception
|
||||
public void testCaseInsensitiveHashcodeKnownField()
|
||||
{
|
||||
HttpField fieldFoo1 = new HttpField("Cookie", "foo");
|
||||
HttpField fieldFoo2 = new HttpField("cookie", "foo");
|
||||
|
@ -59,7 +58,7 @@ public class HttpFieldTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCaseInsensitiveHashcode_UnknownField() throws Exception
|
||||
public void testCaseInsensitiveHashcodeUnknownField()
|
||||
{
|
||||
HttpField fieldFoo1 = new HttpField("X-Foo", "bar");
|
||||
HttpField fieldFoo2 = new HttpField("x-foo", "bar");
|
||||
|
@ -68,7 +67,7 @@ public class HttpFieldTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testContainsList() throws Exception
|
||||
public void testContainsList()
|
||||
{
|
||||
HttpField field = new HttpField("name", ",aaa,Bbb,CCC, ddd , e e, \"\\\"f,f\\\"\", ");
|
||||
assertTrue(field.contains("aaa"));
|
||||
|
@ -91,7 +90,7 @@ public class HttpFieldTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testQualityContainsList() throws Exception
|
||||
public void testQualityContainsList()
|
||||
{
|
||||
HttpField field;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
|||
public class HttpGeneratorServerTest
|
||||
{
|
||||
@Test
|
||||
public void test_0_9() throws Exception
|
||||
public void test09() throws Exception
|
||||
{
|
||||
ByteBuffer header = BufferUtil.allocate(8096);
|
||||
ByteBuffer content = BufferUtil.toBuffer("0123456789");
|
||||
|
|
|
@ -48,6 +48,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
|
||||
public class HttpParserTest
|
||||
{
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
|
||||
static
|
||||
{
|
||||
HttpCompliance.CUSTOM0.sections().remove(HttpComplianceSection.NO_WS_AFTER_FIELD_NAME);
|
||||
|
@ -72,16 +74,16 @@ public class HttpParserTest
|
|||
int remaining = buffer.remaining();
|
||||
while (!parser.isState(State.END) && remaining > 0)
|
||||
{
|
||||
int was_remaining = remaining;
|
||||
int wasRemaining = remaining;
|
||||
parser.parseNext(buffer);
|
||||
remaining = buffer.remaining();
|
||||
if (remaining == was_remaining)
|
||||
if (remaining == wasRemaining)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void HttpMethodTest()
|
||||
public void httpMethodTest()
|
||||
{
|
||||
assertNull(HttpMethod.lookAheadGet(BufferUtil.toBuffer("Wibble ")));
|
||||
assertNull(HttpMethod.lookAheadGet(BufferUtil.toBuffer("GET")));
|
||||
|
@ -831,8 +833,8 @@ public class HttpParserTest
|
|||
"Foo\"Bar: value\r\n",
|
||||
"Foo/Bar: value\r\n",
|
||||
"Foo]Bar: value\r\n",
|
||||
"Foo[Bar: value\r\n",
|
||||
};
|
||||
"Foo[Bar: value\r\n"
|
||||
};
|
||||
|
||||
for (String s : bad)
|
||||
{
|
||||
|
@ -1558,7 +1560,7 @@ public class HttpParserTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testResponseReasonIso8859_1()
|
||||
public void testResponseReasonIso88591()
|
||||
{
|
||||
ByteBuffer buffer = BufferUtil.toBuffer(
|
||||
"HTTP/1.1 302 déplacé temporairement\r\n" +
|
||||
|
|
|
@ -361,8 +361,8 @@ public class HttpTester
|
|||
return null;
|
||||
byte[] bytes = _content.toByteArray();
|
||||
|
||||
String content_type = get(HttpHeader.CONTENT_TYPE);
|
||||
String encoding = MimeTypes.getCharsetFromContentType(content_type);
|
||||
String contentType = get(HttpHeader.CONTENT_TYPE);
|
||||
String encoding = MimeTypes.getCharsetFromContentType(contentType);
|
||||
Charset charset = encoding == null ? StandardCharsets.UTF_8 : Charset.forName(encoding);
|
||||
|
||||
return new String(bytes, charset);
|
||||
|
|
|
@ -102,6 +102,7 @@ public class HttpURITest
|
|||
@Test
|
||||
public void testExtB() throws Exception
|
||||
{
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
for (String value : new String[]{"a", "abcdABCD", "\u00C0", "\u697C", "\uD869\uDED5", "\uD840\uDC08"})
|
||||
{
|
||||
HttpURI uri = new HttpURI("/path?value=" + URLEncoder.encode(value, "UTF-8"));
|
||||
|
|
|
@ -29,13 +29,13 @@ import static org.junit.jupiter.api.Assertions.assertNull;
|
|||
public class MimeTypesTest
|
||||
{
|
||||
@Test
|
||||
public void testGetMimeByExtension_Gzip()
|
||||
public void testGetMimeByExtensionGzip()
|
||||
{
|
||||
assertMimeTypeByExtension("application/gzip", "test.gz");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMimeByExtension_Png()
|
||||
public void testGetMimeByExtensionPng()
|
||||
{
|
||||
assertMimeTypeByExtension("image/png", "test.png");
|
||||
assertMimeTypeByExtension("image/png", "TEST.PNG");
|
||||
|
@ -43,26 +43,26 @@ public class MimeTypesTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetMimeByExtension_Png_MultiDot()
|
||||
public void testGetMimeByExtensionPngMultiDot()
|
||||
{
|
||||
assertMimeTypeByExtension("image/png", "org.eclipse.jetty.Logo.png");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMimeByExtension_Png_DeepPath()
|
||||
public void testGetMimeByExtensionPngDeepPath()
|
||||
{
|
||||
assertMimeTypeByExtension("image/png", "/org/eclipse/jetty/Logo.png");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMimeByExtension_Text()
|
||||
public void testGetMimeByExtensionText()
|
||||
{
|
||||
assertMimeTypeByExtension("text/plain", "test.txt");
|
||||
assertMimeTypeByExtension("text/plain", "TEST.TXT");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMimeByExtension_NoExtension()
|
||||
public void testGetMimeByExtensionNoExtension()
|
||||
{
|
||||
MimeTypes mimetypes = new MimeTypes();
|
||||
String contentType = mimetypes.getMimeByExtension("README");
|
||||
|
|
|
@ -34,6 +34,7 @@ import static org.hamcrest.Matchers.is;
|
|||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
public class MultiPartParserTest
|
||||
{
|
||||
|
||||
|
@ -174,12 +175,12 @@ public class MultiPartParserTest
|
|||
MultiPartParser parser = new MultiPartParser(handler, "BOUNDARY");
|
||||
|
||||
ByteBuffer data = BufferUtil.toBuffer("--BOUNDARY\r\n" +
|
||||
"name0: value0\r\n" +
|
||||
"name1 :value1 \r\n" +
|
||||
"name2:value\r\n" +
|
||||
" 2\r\n" +
|
||||
"\r\n" +
|
||||
"Content");
|
||||
"name0: value0\r\n" +
|
||||
"name1 :value1 \r\n" +
|
||||
"name2:value\r\n" +
|
||||
" 2\r\n" +
|
||||
"\r\n" +
|
||||
"Content");
|
||||
|
||||
parser.parse(data, false);
|
||||
assertThat(parser.getState(), is(State.FIRST_OCTETS));
|
||||
|
@ -194,10 +195,10 @@ public class MultiPartParserTest
|
|||
MultiPartParser parser = new MultiPartParser(handler, "BOUNDARY");
|
||||
|
||||
ByteBuffer data = BufferUtil.toBuffer("--BOUNDARY\r\n" +
|
||||
"name: value\r\n" +
|
||||
"\r\n" +
|
||||
"\r\n" +
|
||||
"--BOUNDARY");
|
||||
"name: value\r\n" +
|
||||
"\r\n" +
|
||||
"\r\n" +
|
||||
"--BOUNDARY");
|
||||
parser.parse(data, false);
|
||||
assertThat(parser.getState(), is(State.DELIMITER));
|
||||
assertThat(data.remaining(), is(0));
|
||||
|
@ -212,9 +213,9 @@ public class MultiPartParserTest
|
|||
MultiPartParser parser = new MultiPartParser(handler, "BOUNDARY");
|
||||
|
||||
ByteBuffer data = BufferUtil.toBuffer("--BOUNDARY\r\n" +
|
||||
"name: value\r\n" +
|
||||
"\r\n" +
|
||||
"--BOUNDARY");
|
||||
"name: value\r\n" +
|
||||
"\r\n" +
|
||||
"--BOUNDARY");
|
||||
parser.parse(data, false);
|
||||
assertThat(parser.getState(), is(State.DELIMITER));
|
||||
assertThat(data.remaining(), is(0));
|
||||
|
@ -229,9 +230,9 @@ public class MultiPartParserTest
|
|||
MultiPartParser parser = new MultiPartParser(handler, "BOUNDARY");
|
||||
|
||||
ByteBuffer data = BufferUtil.toBuffer("--BOUNDARY\r\n" +
|
||||
"name: value\r\n" +
|
||||
"\r\n" +
|
||||
"-");
|
||||
"name: value\r\n" +
|
||||
"\r\n" +
|
||||
"-");
|
||||
parser.parse(data, false);
|
||||
data = BufferUtil.toBuffer("Content!");
|
||||
parser.parse(data, false);
|
||||
|
@ -249,9 +250,9 @@ public class MultiPartParserTest
|
|||
MultiPartParser parser = new MultiPartParser(handler, "BOUNDARY");
|
||||
|
||||
ByteBuffer data = BufferUtil.toBuffer("--BOUNDARY\r\n" +
|
||||
"name: value\n" +
|
||||
"\r\n" +
|
||||
"Hello\r\n");
|
||||
"name: value\n" +
|
||||
"\r\n" +
|
||||
"Hello\r\n");
|
||||
parser.parse(data, false);
|
||||
assertThat(parser.getState(), is(State.OCTETS));
|
||||
assertThat(data.remaining(), is(0));
|
||||
|
@ -260,17 +261,17 @@ public class MultiPartParserTest
|
|||
|
||||
data = BufferUtil.toBuffer(
|
||||
"Now is the time for all good ment to come to the aid of the party.\r\n" +
|
||||
"How now brown cow.\r\n" +
|
||||
"The quick brown fox jumped over the lazy dog.\r\n" +
|
||||
"this is not a --BOUNDARY\r\n");
|
||||
"How now brown cow.\r\n" +
|
||||
"The quick brown fox jumped over the lazy dog.\r\n" +
|
||||
"this is not a --BOUNDARY\r\n");
|
||||
parser.parse(data, false);
|
||||
assertThat(parser.getState(), is(State.OCTETS));
|
||||
assertThat(data.remaining(), is(0));
|
||||
assertThat(handler.fields, Matchers.contains("name: value", "<<COMPLETE>>"));
|
||||
assertThat(handler.content, Matchers.contains("Hello", "\r\n", "Now is the time for all good ment to come to the aid of the party.\r\n" +
|
||||
"How now brown cow.\r\n" +
|
||||
"The quick brown fox jumped over the lazy dog.\r\n" +
|
||||
"this is not a --BOUNDARY"));
|
||||
"How now brown cow.\r\n" +
|
||||
"The quick brown fox jumped over the lazy dog.\r\n" +
|
||||
"this is not a --BOUNDARY"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -280,10 +281,10 @@ public class MultiPartParserTest
|
|||
MultiPartParser parser = new MultiPartParser(handler, "BOUNDARY");
|
||||
|
||||
ByteBuffer data = BufferUtil.toBuffer("--BOUNDARY\r\n" +
|
||||
"name: value\n" +
|
||||
"\r\n" +
|
||||
"Hello\r\n" +
|
||||
"--BOUNDARY");
|
||||
"name: value\n" +
|
||||
"\r\n" +
|
||||
"Hello\r\n" +
|
||||
"--BOUNDARY");
|
||||
parser.parse(data, false);
|
||||
assertThat(parser.getState(), is(State.DELIMITER));
|
||||
assertThat(data.remaining(), is(0));
|
||||
|
@ -298,20 +299,20 @@ public class MultiPartParserTest
|
|||
MultiPartParser parser = new MultiPartParser(handler, "BOUNDARY");
|
||||
|
||||
ByteBuffer data = BufferUtil.toBuffer("--BOUNDARY\r\n" +
|
||||
"name: value\n" +
|
||||
"\r\n" +
|
||||
"Now is the time for all good ment to come to the aid of the party.\r\n" +
|
||||
"How now brown cow.\r\n" +
|
||||
"The quick brown fox jumped over the lazy dog.\r\n" +
|
||||
"\r\n" +
|
||||
"--BOUNDARY");
|
||||
"name: value\n" +
|
||||
"\r\n" +
|
||||
"Now is the time for all good ment to come to the aid of the party.\r\n" +
|
||||
"How now brown cow.\r\n" +
|
||||
"The quick brown fox jumped over the lazy dog.\r\n" +
|
||||
"\r\n" +
|
||||
"--BOUNDARY");
|
||||
parser.parse(data, false);
|
||||
assertThat(parser.getState(), is(State.DELIMITER));
|
||||
assertThat(data.remaining(), is(0));
|
||||
assertThat(handler.fields, Matchers.contains("name: value", "<<COMPLETE>>"));
|
||||
assertThat(handler.content, Matchers.contains("Now is the time for all good ment to come to the aid of the party.\r\n" +
|
||||
"How now brown cow.\r\n" +
|
||||
"The quick brown fox jumped over the lazy dog.\r\n", "<<LAST>>"));
|
||||
"How now brown cow.\r\n" +
|
||||
"The quick brown fox jumped over the lazy dog.\r\n", "<<LAST>>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -322,20 +323,20 @@ public class MultiPartParserTest
|
|||
|
||||
//boundary still requires carriage return
|
||||
ByteBuffer data = BufferUtil.toBuffer("--BOUNDARY\n" +
|
||||
"name: value\n" +
|
||||
"\n" +
|
||||
"Now is the time for all good men to come to the aid of the party.\n" +
|
||||
"How now brown cow.\n" +
|
||||
"The quick brown fox jumped over the lazy dog.\n" +
|
||||
"\r\n" +
|
||||
"--BOUNDARY");
|
||||
"name: value\n" +
|
||||
"\n" +
|
||||
"Now is the time for all good men to come to the aid of the party.\n" +
|
||||
"How now brown cow.\n" +
|
||||
"The quick brown fox jumped over the lazy dog.\n" +
|
||||
"\r\n" +
|
||||
"--BOUNDARY");
|
||||
parser.parse(data, false);
|
||||
assertThat(parser.getState(), is(State.DELIMITER));
|
||||
assertThat(data.remaining(), is(0));
|
||||
assertThat(handler.fields, Matchers.contains("name: value", "<<COMPLETE>>"));
|
||||
assertThat(handler.content, Matchers.contains("Now is the time for all good men to come to the aid of the party.\n" +
|
||||
"How now brown cow.\n" +
|
||||
"The quick brown fox jumped over the lazy dog.\n", "<<LAST>>"));
|
||||
"How now brown cow.\n" +
|
||||
"The quick brown fox jumped over the lazy dog.\n", "<<LAST>>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -378,16 +379,16 @@ public class MultiPartParserTest
|
|||
MultiPartParser parser = new MultiPartParser(handler, "BOUNDARY");
|
||||
|
||||
ByteBuffer data = BufferUtil.toBuffer("" +
|
||||
"--BOUNDARY\r\n" +
|
||||
"name: value\n" +
|
||||
"\r\n" +
|
||||
"Hello\r\n" +
|
||||
"--BOUNDARY--" +
|
||||
"epilogue here:" +
|
||||
"\r\n" +
|
||||
"--BOUNDARY--" +
|
||||
"\r\n" +
|
||||
"--BOUNDARY");
|
||||
"--BOUNDARY\r\n" +
|
||||
"name: value\n" +
|
||||
"\r\n" +
|
||||
"Hello\r\n" +
|
||||
"--BOUNDARY--" +
|
||||
"epilogue here:" +
|
||||
"\r\n" +
|
||||
"--BOUNDARY--" +
|
||||
"\r\n" +
|
||||
"--BOUNDARY");
|
||||
|
||||
parser.parse(data, false);
|
||||
assertThat(parser.getState(), is(State.DELIMITER));
|
||||
|
@ -405,19 +406,19 @@ public class MultiPartParserTest
|
|||
MultiPartParser parser = new MultiPartParser(handler, "BOUNDARY");
|
||||
|
||||
ByteBuffer data = BufferUtil.toBuffer("" +
|
||||
"--BOUNDARY\r\n" +
|
||||
"name: value\n" +
|
||||
"\r\n" +
|
||||
"Hello" +
|
||||
"\r\n" +
|
||||
"--BOUNDARY\r\n" +
|
||||
"powerLevel: 9001\n" +
|
||||
"\r\n" +
|
||||
"secondary" +
|
||||
"\r\n" +
|
||||
"content" +
|
||||
"\r\n--BOUNDARY--" +
|
||||
"epilogue here");
|
||||
"--BOUNDARY\r\n" +
|
||||
"name: value\n" +
|
||||
"\r\n" +
|
||||
"Hello" +
|
||||
"\r\n" +
|
||||
"--BOUNDARY\r\n" +
|
||||
"powerLevel: 9001\n" +
|
||||
"\r\n" +
|
||||
"secondary" +
|
||||
"\r\n" +
|
||||
"content" +
|
||||
"\r\n--BOUNDARY--" +
|
||||
"epilogue here");
|
||||
|
||||
/* Test First Content Section */
|
||||
parser.parse(data, false);
|
||||
|
@ -613,20 +614,20 @@ public class MultiPartParserTest
|
|||
assertThat("Third " + i, parser.parse(dataSeg, true), is(true));
|
||||
|
||||
assertThat(handler.fields, Matchers.contains("Content-Disposition: form-data; name=\"text\"", "<<COMPLETE>>",
|
||||
"Content-Disposition: form-data; name=\"file1\"; filename=\"a.txt\"",
|
||||
"Content-Type: text/plain", "<<COMPLETE>>",
|
||||
"Content-Disposition: form-data; name=\"file2\"; filename=\"a.html\"",
|
||||
"Content-Type: text/html", "<<COMPLETE>>",
|
||||
"Field1: value1", "Field2: value2", "Field3: value3",
|
||||
"Field4: value4", "Field5: value5", "Field6: value6",
|
||||
"Field7: value7", "Field8: value8", "Field9: value 9", "<<COMPLETE>>",
|
||||
"Field1: value1", "<<COMPLETE>>"));
|
||||
"Content-Disposition: form-data; name=\"file1\"; filename=\"a.txt\"",
|
||||
"Content-Type: text/plain", "<<COMPLETE>>",
|
||||
"Content-Disposition: form-data; name=\"file2\"; filename=\"a.html\"",
|
||||
"Content-Type: text/html", "<<COMPLETE>>",
|
||||
"Field1: value1", "Field2: value2", "Field3: value3",
|
||||
"Field4: value4", "Field5: value5", "Field6: value6",
|
||||
"Field7: value7", "Field8: value8", "Field9: value 9", "<<COMPLETE>>",
|
||||
"Field1: value1", "<<COMPLETE>>"));
|
||||
|
||||
assertThat(handler.contentString(), is("text default" + "<<LAST>>" +
|
||||
"Content of a.txt.\n" + "<<LAST>>" +
|
||||
"<!DOCTYPE html><title>Content of a.html.</title>\n" + "<<LAST>>" +
|
||||
"<<LAST>>" +
|
||||
"But the amount of denudation which the strata have\n" +
|
||||
"Content of a.txt.\n" + "<<LAST>>" +
|
||||
"<!DOCTYPE html><title>Content of a.html.</title>\n" + "<<LAST>>" +
|
||||
"<<LAST>>" +
|
||||
"But the amount of denudation which the strata have\n" +
|
||||
"in many places suffered, independently of the rate\n" +
|
||||
"of accumulation of the degraded matter, probably\n" +
|
||||
"offers the best evidence of the lapse of time. I remember\n" +
|
||||
|
@ -671,17 +672,17 @@ public class MultiPartParserTest
|
|||
|
||||
MultiPartParser parser = new MultiPartParser(handler, "WebKitFormBoundary7MA4YWf7OaKlSxkTrZu0gW");
|
||||
ByteBuffer data = BufferUtil.toBuffer("" +
|
||||
"Content-Type: multipart/form-data; boundary=WebKitFormBoundary7MA4YWf7OaKlSxkTrZu0gW\r\n" +
|
||||
"\r\n" +
|
||||
"--WebKitFormBoundary7MA4YWf7OaKlSxkTrZu0gW\r\n" +
|
||||
"Content-Disposition: form-data; name=\"part1\"\r\n" +
|
||||
"\n" +
|
||||
"wNfミxVamt\r\n" +
|
||||
"--WebKitFormBoundary7MA4YWf7OaKlSxkTrZu0gW\n" +
|
||||
"Content-Disposition: form-data; name=\"part2\"\r\n" +
|
||||
"\r\n" +
|
||||
"&ᄈ취ᅢO\r\n" +
|
||||
"--WebKitFormBoundary7MA4YWf7OaKlSxkTrZu0gW--");
|
||||
"Content-Type: multipart/form-data; boundary=WebKitFormBoundary7MA4YWf7OaKlSxkTrZu0gW\r\n" +
|
||||
"\r\n" +
|
||||
"--WebKitFormBoundary7MA4YWf7OaKlSxkTrZu0gW\r\n" +
|
||||
"Content-Disposition: form-data; name=\"part1\"\r\n" +
|
||||
"\n" +
|
||||
"wNfミxVamt\r\n" +
|
||||
"--WebKitFormBoundary7MA4YWf7OaKlSxkTrZu0gW\n" +
|
||||
"Content-Disposition: form-data; name=\"part2\"\r\n" +
|
||||
"\r\n" +
|
||||
"&ᄈ취ᅢO\r\n" +
|
||||
"--WebKitFormBoundary7MA4YWf7OaKlSxkTrZu0gW--");
|
||||
|
||||
parser.parse(data, true);
|
||||
assertThat(parser.getState(), is(State.END));
|
||||
|
|
|
@ -44,6 +44,7 @@ public class PathMapTest
|
|||
p.put("/", "8");
|
||||
p.put("/XXX:/YYY", "9");
|
||||
p.put("", "10");
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
p.put("/\u20ACuro/*", "11");
|
||||
|
||||
String[][] tests = {
|
||||
|
@ -64,9 +65,10 @@ public class PathMapTest
|
|||
{"/suffix/path.gz", "7"},
|
||||
{"/animal/path.gz", "5"},
|
||||
{"/Other/path", "8"},
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
{"/\u20ACuro/path", "11"},
|
||||
{"/", "10"},
|
||||
};
|
||||
{"/", "10"}
|
||||
};
|
||||
|
||||
for (String[] test : tests)
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ public class QuotedQualityCSVTest
|
|||
{
|
||||
|
||||
@Test
|
||||
public void test7231_5_3_2_example1()
|
||||
public void test7231Sec532Example1()
|
||||
{
|
||||
QuotedQualityCSV values = new QuotedQualityCSV();
|
||||
values.addValue(" audio/*; q=0.2, audio/basic");
|
||||
|
@ -39,7 +39,7 @@ public class QuotedQualityCSVTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test7231_5_3_2_example2()
|
||||
public void test7231Sec532Example2()
|
||||
{
|
||||
QuotedQualityCSV values = new QuotedQualityCSV();
|
||||
values.addValue("text/plain; q=0.5, text/html,");
|
||||
|
@ -48,7 +48,7 @@ public class QuotedQualityCSVTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test7231_5_3_2_example3()
|
||||
public void test7231Sec532Example3()
|
||||
{
|
||||
QuotedQualityCSV values = new QuotedQualityCSV();
|
||||
values.addValue("text/*, text/plain, text/plain;format=flowed, */*");
|
||||
|
@ -58,7 +58,7 @@ public class QuotedQualityCSVTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test7231_5_3_2_example3_most_specific()
|
||||
public void test7231532Example3MostSpecific()
|
||||
{
|
||||
QuotedQualityCSV values = new QuotedQualityCSV(QuotedQualityCSV.MOST_SPECIFIC_MIME_ORDERING);
|
||||
values.addValue("text/*, text/plain, text/plain;format=flowed, */*");
|
||||
|
@ -67,7 +67,7 @@ public class QuotedQualityCSVTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test7231_5_3_2_example4()
|
||||
public void test7231Sec532Example4()
|
||||
{
|
||||
QuotedQualityCSV values = new QuotedQualityCSV();
|
||||
values.addValue("text/*;q=0.3, text/html;q=0.7, text/html;level=1,");
|
||||
|
@ -82,7 +82,7 @@ public class QuotedQualityCSVTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test7231_5_3_4_example1()
|
||||
public void test7231Sec534Example1()
|
||||
{
|
||||
QuotedQualityCSV values = new QuotedQualityCSV();
|
||||
values.addValue("compress, gzip");
|
||||
|
|
|
@ -28,7 +28,7 @@ import static org.junit.jupiter.api.Assertions.fail;
|
|||
public class SyntaxTest
|
||||
{
|
||||
@Test
|
||||
public void testRequireValidRFC2616Token_Good()
|
||||
public void testRequireValidRFC2616TokenGood()
|
||||
{
|
||||
String[] tokens = {
|
||||
"name",
|
||||
|
@ -50,7 +50,7 @@ public class SyntaxTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRequireValidRFC2616Token_Bad()
|
||||
public void testRequireValidRFC2616TokenBad()
|
||||
{
|
||||
String[] tokens = {
|
||||
"\"name\"",
|
||||
|
@ -81,7 +81,7 @@ public class SyntaxTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRequireValidRFC6265CookieValue_Good()
|
||||
public void testRequireValidRFC6265CookieValueGood()
|
||||
{
|
||||
String[] values = {
|
||||
"value",
|
||||
|
@ -102,7 +102,7 @@ public class SyntaxTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRequireValidRFC6265CookieValue_Bad()
|
||||
public void testRequireValidRFC6265CookieValueBad()
|
||||
{
|
||||
String[] values = {
|
||||
"va\tlue",
|
||||
|
|
|
@ -59,7 +59,7 @@ public class HttpFieldsMatchersTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testContainsHeader_MisMatch()
|
||||
public void testContainsHeaderMisMatch()
|
||||
{
|
||||
HttpFields fields = new HttpFields();
|
||||
fields.put("a", "foo");
|
||||
|
@ -75,7 +75,7 @@ public class HttpFieldsMatchersTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testContainsHeaderValue_MisMatch_NoSuchHeader()
|
||||
public void testContainsHeaderValueMisMatchNoSuchHeader()
|
||||
{
|
||||
HttpFields fields = new HttpFields();
|
||||
fields.put("a", "foo");
|
||||
|
@ -91,7 +91,7 @@ public class HttpFieldsMatchersTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testContainsHeaderValue_MisMatch_NoSuchValue()
|
||||
public void testContainsHeaderValueMisMatchNoSuchValue()
|
||||
{
|
||||
HttpFields fields = new HttpFields();
|
||||
fields.put("a", "foo");
|
||||
|
|
|
@ -28,6 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
public class PathMappingsTest
|
||||
{
|
||||
private void assertMatch(PathMappings<String> pathmap, String path, String expectedValue)
|
||||
|
|
|
@ -56,6 +56,7 @@ public class ServletPathSpecOrderTest
|
|||
data.add(Arguments.of("/downloads/script.gz", "gzipped"));
|
||||
data.add(Arguments.of("/animal/arhive.gz", "animals"));
|
||||
data.add(Arguments.of("/Other/path", "default"));
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
data.add(Arguments.of("/\u20ACuro/path", "money"));
|
||||
data.add(Arguments.of("/", "root"));
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public class UriTemplatePathSpecTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testExactPathSpec_TestWebapp()
|
||||
public void testExactPathSpecTestWebapp()
|
||||
{
|
||||
UriTemplatePathSpec spec = new UriTemplatePathSpec("/deep.thought/");
|
||||
assertEquals("/deep.thought/", spec.getDeclaration(), "Spec.pathSpec");
|
||||
|
|
|
@ -87,7 +87,7 @@ public class ProxyProtocolTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_PROXY_GET_v1() throws Exception
|
||||
public void testProxyGetV1() throws Exception
|
||||
{
|
||||
startServer(new AbstractHandler()
|
||||
{
|
||||
|
@ -139,7 +139,7 @@ public class ProxyProtocolTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_PROXY_GET_v2() throws Exception
|
||||
public void testProxyGetV2() throws Exception
|
||||
{
|
||||
startServer(new AbstractHandler()
|
||||
{
|
||||
|
|
|
@ -213,8 +213,8 @@ public class SmallThreadPoolLoadTest extends AbstractTest
|
|||
}
|
||||
case "POST":
|
||||
{
|
||||
int content_length = request.getContentLength();
|
||||
ByteArrayOutputStream2 bout = new ByteArrayOutputStream2(content_length > 0 ? content_length : 16 * 1024);
|
||||
int contentLength = request.getContentLength();
|
||||
ByteArrayOutputStream2 bout = new ByteArrayOutputStream2(contentLength > 0 ? contentLength : 16 * 1024);
|
||||
IO.copy(request.getInputStream(), bout);
|
||||
response.getOutputStream().write(bout.getBuf(), 0, bout.getCount());
|
||||
break;
|
||||
|
|
|
@ -60,7 +60,7 @@ public class HpackDecoderTest
|
|||
*/
|
||||
|
||||
@Test
|
||||
public void testDecodeD_3() throws Exception
|
||||
public void testDecodeD3() throws Exception
|
||||
{
|
||||
HpackDecoder decoder = new HpackDecoder(4096, 8192);
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class HpackDecoderTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDecodeD_4() throws Exception
|
||||
public void testDecodeD4() throws Exception
|
||||
{
|
||||
HpackDecoder decoder = new HpackDecoder(4096, 8192);
|
||||
|
||||
|
@ -277,7 +277,7 @@ public class HpackDecoderTest
|
|||
|
||||
/* 8.1.2.1. Pseudo-Header Fields */
|
||||
@Test
|
||||
public void test8_1_2_1_PsuedoHeaderFields() throws Exception
|
||||
public void test8121PseudoHeaderFields() throws Exception
|
||||
{
|
||||
// 1:Sends a HEADERS frame that contains a unknown pseudo-header field
|
||||
MetaDataBuilder mdb = new MetaDataBuilder(4096);
|
||||
|
@ -329,7 +329,7 @@ public class HpackDecoderTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test8_1_2_2_ConnectionSpecificHeaderFields() throws Exception
|
||||
public void test8122ConnectionSpecificHeaderFields() throws Exception
|
||||
{
|
||||
MetaDataBuilder mdb;
|
||||
|
||||
|
@ -366,7 +366,7 @@ public class HpackDecoderTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test8_1_2_3_RequestPseudoHeaderFields() throws Exception
|
||||
public void test8123RequestPseudoHeaderFields() throws Exception
|
||||
{
|
||||
{
|
||||
MetaDataBuilder mdb = new MetaDataBuilder(4096);
|
||||
|
|
|
@ -145,6 +145,7 @@ public class HpackTest
|
|||
ByteBuffer buffer = BufferUtil.allocate(16 * 1024);
|
||||
|
||||
HttpFields fields0 = new HttpFields();
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
fields0.add("Cookie", "[\uD842\uDF9F]");
|
||||
fields0.add("custom-key", "[\uD842\uDF9F]");
|
||||
Response original0 = new MetaData.Response(HttpVersion.HTTP_2, 200, fields0);
|
||||
|
|
|
@ -131,7 +131,7 @@ public class NBitIntegerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeExampleD_1_1()
|
||||
public void testEncodeExampleD11()
|
||||
{
|
||||
ByteBuffer buf = BufferUtil.allocate(16);
|
||||
int p = BufferUtil.flipToFill(buf);
|
||||
|
@ -146,7 +146,7 @@ public class NBitIntegerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDecodeExampleD_1_1()
|
||||
public void testDecodeExampleD11()
|
||||
{
|
||||
ByteBuffer buf = ByteBuffer.wrap(TypeUtil.fromHexString("77EaFF"));
|
||||
buf.position(2);
|
||||
|
@ -155,7 +155,7 @@ public class NBitIntegerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeExampleD_1_2()
|
||||
public void testEncodeExampleD12()
|
||||
{
|
||||
ByteBuffer buf = BufferUtil.allocate(16);
|
||||
int p = BufferUtil.flipToFill(buf);
|
||||
|
@ -170,7 +170,7 @@ public class NBitIntegerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDecodeExampleD_1_2()
|
||||
public void testDecodeExampleD12()
|
||||
{
|
||||
ByteBuffer buf = ByteBuffer.wrap(TypeUtil.fromHexString("881f9a0aff"));
|
||||
buf.position(2);
|
||||
|
@ -179,7 +179,7 @@ public class NBitIntegerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeExampleD_1_3()
|
||||
public void testEncodeExampleD13()
|
||||
{
|
||||
ByteBuffer buf = BufferUtil.allocate(16);
|
||||
int p = BufferUtil.flipToFill(buf);
|
||||
|
@ -194,7 +194,7 @@ public class NBitIntegerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDecodeExampleD_1_3()
|
||||
public void testDecodeExampleD13()
|
||||
{
|
||||
ByteBuffer buf = ByteBuffer.wrap(TypeUtil.fromHexString("882aFf"));
|
||||
buf.position(1);
|
||||
|
|
|
@ -34,11 +34,11 @@ public class H2SpecServer
|
|||
|
||||
Server server = new Server();
|
||||
|
||||
HttpConfiguration http_config = new HttpConfiguration();
|
||||
http_config.setRequestHeaderSize(16 * 1024);
|
||||
HttpConfiguration httpConfig = new HttpConfiguration();
|
||||
httpConfig.setRequestHeaderSize(16 * 1024);
|
||||
|
||||
HttpConnectionFactory http = new HttpConnectionFactory(http_config);
|
||||
HTTP2CServerConnectionFactory h2c = new HTTP2CServerConnectionFactory(http_config);
|
||||
HttpConnectionFactory http = new HttpConnectionFactory(httpConfig);
|
||||
HTTP2CServerConnectionFactory h2c = new HTTP2CServerConnectionFactory(httpConfig);
|
||||
ServerConnector connector = new ServerConnector(server, http, h2c);
|
||||
connector.setPort(port);
|
||||
server.addConnector(connector);
|
||||
|
|
|
@ -82,7 +82,7 @@ public class HTTP2CServerTest extends AbstractServerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testHTTP_1_0_Simple() throws Exception
|
||||
public void testHTTP10Simple() throws Exception
|
||||
{
|
||||
try (Socket client = new Socket("localhost", connector.getLocalPort()))
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ public class HTTP2CServerTest extends AbstractServerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testHTTP_1_1_Simple() throws Exception
|
||||
public void testHTTP11Simple() throws Exception
|
||||
{
|
||||
try (Socket client = new Socket("localhost", connector.getLocalPort()))
|
||||
{
|
||||
|
@ -115,7 +115,7 @@ public class HTTP2CServerTest extends AbstractServerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testHTTP_1_1_Upgrade() throws Exception
|
||||
public void testHTTP11Upgrade() throws Exception
|
||||
{
|
||||
try (Socket client = new Socket("localhost", connector.getLocalPort()))
|
||||
{
|
||||
|
@ -223,7 +223,7 @@ public class HTTP2CServerTest extends AbstractServerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testHTTP_2_0_Direct() throws Exception
|
||||
public void testHTTP20Direct() throws Exception
|
||||
{
|
||||
final CountDownLatch latch = new CountDownLatch(3);
|
||||
|
||||
|
@ -290,7 +290,7 @@ public class HTTP2CServerTest extends AbstractServerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testHTTP_2_0_DirectWithoutH2C() throws Exception
|
||||
public void testHTTP20DirectWithoutH2C() throws Exception
|
||||
{
|
||||
AtomicLong fills = new AtomicLong();
|
||||
// Remove "h2c", leaving only "http/1.1".
|
||||
|
|
|
@ -383,15 +383,15 @@ public class HTTP2ServerTest extends AbstractServerTest
|
|||
@Test
|
||||
public void testNonISOHeader() throws Exception
|
||||
{
|
||||
try (StacklessLogging stackless = new StacklessLogging(HttpChannel.class))
|
||||
try (StacklessLogging ignored = new StacklessLogging(HttpChannel.class))
|
||||
{
|
||||
startServer(new HttpServlet()
|
||||
{
|
||||
@Override
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
// Invalid header name, the connection must be closed.
|
||||
response.setHeader("Euro_(\u20AC)", "42");
|
||||
response.setHeader("Euro_(%E2%82%AC)", "42");
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -47,13 +47,10 @@ public class EmbeddedQueryManagerTest
|
|||
public static final String DEFAULT_CACHE_NAME = "session_test_cache";
|
||||
|
||||
@Test
|
||||
public void test() throws Exception
|
||||
public void test()
|
||||
{
|
||||
|
||||
String _name = DEFAULT_CACHE_NAME + System.currentTimeMillis();
|
||||
EmbeddedCacheManager _manager;
|
||||
|
||||
_manager = new DefaultCacheManager(new GlobalConfigurationBuilder().globalJmxStatistics().allowDuplicateDomains(true).build());
|
||||
String name = DEFAULT_CACHE_NAME + System.currentTimeMillis();
|
||||
EmbeddedCacheManager cacheManager = new DefaultCacheManager(new GlobalConfigurationBuilder().globalJmxStatistics().allowDuplicateDomains(true).build());
|
||||
|
||||
//TODO verify that this is being indexed properly, if you change expiry to something that is not a valid field it still passes the tests
|
||||
SearchMapping mapping = new SearchMapping();
|
||||
|
@ -62,7 +59,7 @@ public class EmbeddedQueryManagerTest
|
|||
properties.put(Environment.MODEL_MAPPING, mapping);
|
||||
properties.put("hibernate.search.default.indexBase", MavenTestingUtils.getTargetTestingDir().getAbsolutePath());
|
||||
|
||||
Configuration dcc = _manager.getDefaultCacheConfiguration();
|
||||
Configuration dcc = cacheManager.getDefaultCacheConfiguration();
|
||||
ConfigurationBuilder b = new ConfigurationBuilder();
|
||||
if (dcc != null)
|
||||
b = b.read(dcc);
|
||||
|
@ -70,8 +67,8 @@ public class EmbeddedQueryManagerTest
|
|||
b.indexing().index(Index.ALL).addIndexedEntity(SessionData.class).withProperties(properties);
|
||||
Configuration c = b.build();
|
||||
|
||||
_manager.defineConfiguration(_name, c);
|
||||
Cache<String, SessionData> _cache = _manager.getCache(_name);
|
||||
cacheManager.defineConfiguration(name, c);
|
||||
Cache<String, SessionData> cache = cacheManager.getCache(name);
|
||||
|
||||
//put some sessions into the cache
|
||||
int numSessions = 10;
|
||||
|
@ -92,11 +89,11 @@ public class EmbeddedQueryManagerTest
|
|||
expiredSessions.add("sd" + i);
|
||||
|
||||
//add to cache
|
||||
_cache.put("sd" + i, sd);
|
||||
cache.put("sd" + i, sd);
|
||||
}
|
||||
|
||||
//run the query
|
||||
QueryManager qm = new EmbeddedQueryManager(_cache);
|
||||
QueryManager qm = new EmbeddedQueryManager(cache);
|
||||
Set<String> queryResult = qm.queryExpiredSessions(currentTime);
|
||||
|
||||
// Check that the result is correct
|
||||
|
|
|
@ -70,7 +70,7 @@ public class RemoteQueryManagerTest
|
|||
serCtx.registerProtoFiles(fds);
|
||||
serCtx.registerMarshaller(new SessionDataMarshaller());
|
||||
|
||||
RemoteCache<String, SessionData> _cache = remoteCacheManager.getCache(DEFAULT_CACHE_NAME);
|
||||
RemoteCache<String, SessionData> cache = remoteCacheManager.getCache(DEFAULT_CACHE_NAME);
|
||||
|
||||
ByteArrayOutputStream baos;
|
||||
try (InputStream is = RemoteQueryManagerTest.class.getClassLoader().getResourceAsStream("session.proto"))
|
||||
|
@ -106,12 +106,12 @@ public class RemoteQueryManagerTest
|
|||
expiredSessions.add(id);
|
||||
|
||||
//add to cache
|
||||
_cache.put(id, sd);
|
||||
assertNotNull(_cache.get(id));
|
||||
cache.put(id, sd);
|
||||
assertNotNull(cache.get(id));
|
||||
}
|
||||
|
||||
//run the query
|
||||
QueryManager qm = new RemoteQueryManager(_cache);
|
||||
QueryManager qm = new RemoteQueryManager(cache);
|
||||
Set<String> queryResult = qm.queryExpiredSessions(currentTime);
|
||||
|
||||
// Check that the result is correct
|
||||
|
|
|
@ -146,10 +146,10 @@ public class CyclicTimeoutTest
|
|||
QueuedThreadPool pool = new QueuedThreadPool(200);
|
||||
pool.start();
|
||||
|
||||
long test_until = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(1500);
|
||||
long testUntil = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(1500);
|
||||
|
||||
assertTrue(_timeout.schedule(100, TimeUnit.MILLISECONDS));
|
||||
while (System.nanoTime() < test_until)
|
||||
while (System.nanoTime() < testUntil)
|
||||
{
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
pool.execute(() ->
|
||||
|
|
|
@ -744,7 +744,7 @@ public class SocketChannelEndPointTest
|
|||
return;
|
||||
}
|
||||
|
||||
EndPoint _endp = getEndPoint();
|
||||
EndPoint endp = getEndPoint();
|
||||
try
|
||||
{
|
||||
_last = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
|
||||
|
@ -757,17 +757,17 @@ public class SocketChannelEndPointTest
|
|||
BufferUtil.compact(_in);
|
||||
if (BufferUtil.isFull(_in))
|
||||
throw new IllegalStateException("FULL " + BufferUtil.toDetailString(_in));
|
||||
int filled = _endp.fill(_in);
|
||||
int filled = endp.fill(_in);
|
||||
if (filled > 0)
|
||||
progress = true;
|
||||
|
||||
// If the tests wants to block, then block
|
||||
while (_blockAt.get() > 0 && _endp.isOpen() && _in.remaining() < _blockAt.get())
|
||||
while (_blockAt.get() > 0 && endp.isOpen() && _in.remaining() < _blockAt.get())
|
||||
{
|
||||
FutureCallback future = _blockingRead = new FutureCallback();
|
||||
fillInterested();
|
||||
future.get();
|
||||
filled = _endp.fill(_in);
|
||||
filled = endp.fill(_in);
|
||||
progress |= filled > 0;
|
||||
}
|
||||
|
||||
|
@ -783,18 +783,18 @@ public class SocketChannelEndPointTest
|
|||
for (int i = 0; i < _writeCount.get(); i++)
|
||||
{
|
||||
FutureCallback blockingWrite = new FutureCallback();
|
||||
_endp.write(blockingWrite, out.asReadOnlyBuffer());
|
||||
endp.write(blockingWrite, out.asReadOnlyBuffer());
|
||||
blockingWrite.get();
|
||||
}
|
||||
progress = true;
|
||||
}
|
||||
|
||||
// are we done?
|
||||
if (_endp.isInputShutdown())
|
||||
_endp.shutdownOutput();
|
||||
if (endp.isInputShutdown())
|
||||
endp.shutdownOutput();
|
||||
}
|
||||
|
||||
if (_endp.isOpen())
|
||||
if (endp.isOpen())
|
||||
fillInterested();
|
||||
}
|
||||
catch (ExecutionException e)
|
||||
|
@ -803,9 +803,9 @@ public class SocketChannelEndPointTest
|
|||
try
|
||||
{
|
||||
FutureCallback blockingWrite = new FutureCallback();
|
||||
_endp.write(blockingWrite, BufferUtil.toBuffer("EE: " + BufferUtil.toString(_in)));
|
||||
endp.write(blockingWrite, BufferUtil.toBuffer("EE: " + BufferUtil.toString(_in)));
|
||||
blockingWrite.get();
|
||||
_endp.shutdownOutput();
|
||||
endp.shutdownOutput();
|
||||
}
|
||||
catch (Exception e2)
|
||||
{
|
||||
|
|
|
@ -71,37 +71,37 @@ public class StringReplaceBenchmark
|
|||
}
|
||||
|
||||
@Benchmark
|
||||
public void testJavaStringReplace_Growth(Blackhole blackhole)
|
||||
public void testJavaStringReplaceGrowth(Blackhole blackhole)
|
||||
{
|
||||
blackhole.consume(input.replace("'", "FOOBAR"));
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void testJavaStringReplace_Same(Blackhole blackhole)
|
||||
public void testJavaStringReplaceSame(Blackhole blackhole)
|
||||
{
|
||||
blackhole.consume(input.replace("'", "X"));
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void testJavaStringReplace_Reduce(Blackhole blackhole)
|
||||
public void testJavaStringReplaceReduce(Blackhole blackhole)
|
||||
{
|
||||
blackhole.consume(input.replace("'", ""));
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void testJettyStringUtilReplace_Growth(Blackhole blackhole)
|
||||
public void testJettyStringUtilReplaceGrowth(Blackhole blackhole)
|
||||
{
|
||||
blackhole.consume(StringUtil.replace(input, "'", "FOOBAR"));
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void testJettyStringUtilReplace_Same(Blackhole blackhole)
|
||||
public void testJettyStringUtilReplaceSame(Blackhole blackhole)
|
||||
{
|
||||
blackhole.consume(StringUtil.replace(input, "'", "X"));
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void testJettyStringUtilReplace_Reduce(Blackhole blackhole)
|
||||
public void testJettyStringUtilReplaceReduce(Blackhole blackhole)
|
||||
{
|
||||
blackhole.consume(StringUtil.replace(input, "'", ""));
|
||||
}
|
||||
|
|
|
@ -32,13 +32,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class TestGetContent
|
||||
{
|
||||
@Test
|
||||
public void get_content_response()
|
||||
public void getContentResponse()
|
||||
throws Exception
|
||||
{
|
||||
int port = getPort();
|
||||
|
|
|
@ -46,7 +46,7 @@ public class JwtDecoderTest
|
|||
Arguments.of("XX==", "XX=="),
|
||||
Arguments.of("XXX=", "XXX="),
|
||||
Arguments.of("", "")
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
public static Stream<Arguments> badPaddingExamples()
|
||||
|
@ -101,17 +101,17 @@ public class JwtDecoderTest
|
|||
public void testDecodeMissingPadding()
|
||||
{
|
||||
// Example given in Issue #4128 which requires the re-adding the B64 padding to decode.
|
||||
String jwt = "eyJraWQiOiIxNTU1OTM0ODQ3IiwieDV0IjoiOWdCOW9zRldSRHRSMkhtNGNmVnJnWTBGcmZRIiwiYWxnIjoiUlMyNTYifQ"
|
||||
+ ".eyJhdF9oYXNoIjoiQTA0NUoxcE5YRk1nYzlXN2wxSk1fUSIsImRlbGVnYXRpb25faWQiOiJjZTBhNjRlNS0xYWY3LTQ2MzEtOGUz"
|
||||
+ "NC1mNDE5N2JkYzVjZTAiLCJhY3IiOiJ1cm46c2U6Y3VyaXR5OmF1dGhlbnRpY2F0aW9uOmh0bWwtZm9ybTpodG1sLXByaW1hcnkiL"
|
||||
+ "CJzX2hhc2giOiIwc1FtRG9YY3FwcnM4NWUzdy0wbHdBIiwiYXpwIjoiNzZiZTc5Y2ItM2E1Ni00ZTE3LTg3NzYtNDI1Nzc5MjRjYz"
|
||||
+ "c2IiwiYXV0aF90aW1lIjoxNTY5NjU4MDk1LCJleHAiOjE1Njk2NjE5OTUsIm5iZiI6MTU2OTY1ODM5NSwianRpIjoiZjJkNWI2YzE"
|
||||
+ "tNTIxYi00Y2Y5LThlNWEtOTg5NGJhNmE0MzkyIiwiaXNzIjoiaHR0cHM6Ly9ub3JkaWNhcGlzLmN1cml0eS5pby9-IiwiYXVkIjoi"
|
||||
+ "NzZiZTc5Y2ItM2E1Ni00ZTE3LTg3NzYtNDI1Nzc5MjRjYzc2Iiwic3ViIjoibmlrb3MiLCJpYXQiOjE1Njk2NTgzOTUsInB1cnBvc"
|
||||
+ "2UiOiJpZCJ9.Wd458zNmXggpkDN6vbS3-aiajh4-VbkmcStLYUqahYJUp9p-AUI_RZttWvwh3UDMG9rWww_ya8KFK_SkPfKooEaSN"
|
||||
+ "OjOhw0ox4d-9lgti3J49eRyO20RViXvRHyLVtcjv5IaqvMXgwW60Thubv19OION7DstyArffcxNNSpiqDq6wjd0T2DJ3gSXXlJHLT"
|
||||
+ "Wrry3svqu1j_GCbHc04XYGicxsusKgc3n22dh4I6p4trdo0Gu5Un0bZ8Yov7IzWItqTgm9X5r9gZlAOLcAuK1WTwkzAwZJ24HgvxK"
|
||||
+ "muYfV_4ZCg_VPN2Op8YPuRAQOgUERpeTv1RDFTOG9GKZIMBVR0A";
|
||||
String jwt = "eyJraWQiOiIxNTU1OTM0ODQ3IiwieDV0IjoiOWdCOW9zRldSRHRSMkhtNGNmVnJnWTBGcmZRIiwiYWxnIjoiUlMyNTYifQ" +
|
||||
".eyJhdF9oYXNoIjoiQTA0NUoxcE5YRk1nYzlXN2wxSk1fUSIsImRlbGVnYXRpb25faWQiOiJjZTBhNjRlNS0xYWY3LTQ2MzEtOGUz" +
|
||||
"NC1mNDE5N2JkYzVjZTAiLCJhY3IiOiJ1cm46c2U6Y3VyaXR5OmF1dGhlbnRpY2F0aW9uOmh0bWwtZm9ybTpodG1sLXByaW1hcnkiL" +
|
||||
"CJzX2hhc2giOiIwc1FtRG9YY3FwcnM4NWUzdy0wbHdBIiwiYXpwIjoiNzZiZTc5Y2ItM2E1Ni00ZTE3LTg3NzYtNDI1Nzc5MjRjYz" +
|
||||
"c2IiwiYXV0aF90aW1lIjoxNTY5NjU4MDk1LCJleHAiOjE1Njk2NjE5OTUsIm5iZiI6MTU2OTY1ODM5NSwianRpIjoiZjJkNWI2YzE" +
|
||||
"tNTIxYi00Y2Y5LThlNWEtOTg5NGJhNmE0MzkyIiwiaXNzIjoiaHR0cHM6Ly9ub3JkaWNhcGlzLmN1cml0eS5pby9-IiwiYXVkIjoi" +
|
||||
"NzZiZTc5Y2ItM2E1Ni00ZTE3LTg3NzYtNDI1Nzc5MjRjYzc2Iiwic3ViIjoibmlrb3MiLCJpYXQiOjE1Njk2NTgzOTUsInB1cnBvc" +
|
||||
"2UiOiJpZCJ9.Wd458zNmXggpkDN6vbS3-aiajh4-VbkmcStLYUqahYJUp9p-AUI_RZttWvwh3UDMG9rWww_ya8KFK_SkPfKooEaSN" +
|
||||
"OjOhw0ox4d-9lgti3J49eRyO20RViXvRHyLVtcjv5IaqvMXgwW60Thubv19OION7DstyArffcxNNSpiqDq6wjd0T2DJ3gSXXlJHLT" +
|
||||
"Wrry3svqu1j_GCbHc04XYGicxsusKgc3n22dh4I6p4trdo0Gu5Un0bZ8Yov7IzWItqTgm9X5r9gZlAOLcAuK1WTwkzAwZJ24HgvxK" +
|
||||
"muYfV_4ZCg_VPN2Op8YPuRAQOgUERpeTv1RDFTOG9GKZIMBVR0A";
|
||||
|
||||
// Decode the ID Token and verify the claims are the correct.
|
||||
Map<String, Object> decodedClaims = JwtDecoder.decode(jwt);
|
||||
|
|
|
@ -110,7 +110,7 @@ public class OpenIdAuthenticationTest
|
|||
context.setSecurityHandler(securityHandler);
|
||||
|
||||
server.start();
|
||||
String redirectUri = "http://localhost:"+connector.getLocalPort() + "/j_security_check";
|
||||
String redirectUri = "http://localhost:" + connector.getLocalPort() + "/j_security_check";
|
||||
openIdProvider.addRedirectUri(redirectUri);
|
||||
|
||||
client = new HttpClient();
|
||||
|
@ -127,7 +127,7 @@ public class OpenIdAuthenticationTest
|
|||
@Test
|
||||
public void testLoginLogout() throws Exception
|
||||
{
|
||||
String appUriString = "http://localhost:"+connector.getLocalPort();
|
||||
String appUriString = "http://localhost:" + connector.getLocalPort();
|
||||
|
||||
// Initially not authenticated
|
||||
ContentResponse response = client.GET(appUriString + "/");
|
||||
|
|
|
@ -142,8 +142,8 @@ public class OpenIdProvider extends ContainerLifeCycle
|
|||
final Request baseRequest = Request.getBaseRequest(req);
|
||||
final Response baseResponse = baseRequest.getResponse();
|
||||
redirectUri += "?code=" + authCode + "&state=" + state;
|
||||
int redirectCode = (baseRequest.getHttpVersion().getVersion() < HttpVersion.HTTP_1_1.getVersion() ?
|
||||
HttpServletResponse.SC_MOVED_TEMPORARILY : HttpServletResponse.SC_SEE_OTHER);
|
||||
int redirectCode = (baseRequest.getHttpVersion().getVersion() < HttpVersion.HTTP_1_1.getVersion()
|
||||
? HttpServletResponse.SC_MOVED_TEMPORARILY : HttpServletResponse.SC_SEE_OTHER);
|
||||
baseResponse.sendRedirect(redirectCode, resp.encodeRedirectURL(redirectUri));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -191,10 +190,10 @@ public class TestOSGiUtil
|
|||
|
||||
protected static Bundle getBundle(BundleContext bundleContext, String symbolicName)
|
||||
{
|
||||
Map<String, Bundle> _bundles = new HashMap<>();
|
||||
Map<String, Bundle> bundles = new HashMap<>();
|
||||
for (Bundle b : bundleContext.getBundles())
|
||||
{
|
||||
Bundle prevBundle = _bundles.put(b.getSymbolicName(), b);
|
||||
Bundle prevBundle = bundles.put(b.getSymbolicName(), b);
|
||||
String err = prevBundle != null ? "2 versions of the bundle " + b.getSymbolicName() +
|
||||
" " +
|
||||
b.getHeaders().get("Bundle-Version") +
|
||||
|
@ -202,7 +201,7 @@ public class TestOSGiUtil
|
|||
prevBundle.getHeaders().get("Bundle-Version") : "";
|
||||
assertNull(err, prevBundle);
|
||||
}
|
||||
return _bundles.get(symbolicName);
|
||||
return bundles.get(symbolicName);
|
||||
}
|
||||
|
||||
protected static void assertActiveBundle(BundleContext bundleContext, String symbolicName) throws Exception
|
||||
|
|
|
@ -38,7 +38,7 @@ public class TestConfiguration
|
|||
@Test
|
||||
public void testIt() throws Exception
|
||||
{
|
||||
ClassLoader old_loader = Thread.currentThread().getContextClassLoader();
|
||||
ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -130,7 +130,7 @@ public class TestConfiguration
|
|||
}
|
||||
finally
|
||||
{
|
||||
Thread.currentThread().setContextClassLoader(old_loader);
|
||||
Thread.currentThread().setContextClassLoader(oldLoader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,27 +99,27 @@ public class ConstraintTest
|
|||
_config = _connector.getConnectionFactory(HttpConnectionFactory.class).getHttpConfiguration();
|
||||
_server.setConnectors(new Connector[]{_connector});
|
||||
|
||||
ContextHandler _context = new ContextHandler();
|
||||
SessionHandler _session = new SessionHandler();
|
||||
ContextHandler contextHandler = new ContextHandler();
|
||||
SessionHandler sessionHandler = new SessionHandler();
|
||||
|
||||
TestLoginService _loginService = new TestLoginService(TEST_REALM);
|
||||
TestLoginService loginService = new TestLoginService(TEST_REALM);
|
||||
|
||||
_loginService.putUser("user0", new Password("password"), new String[]{});
|
||||
_loginService.putUser("user", new Password("password"), new String[]{"user"});
|
||||
_loginService.putUser("user2", new Password("password"), new String[]{"user"});
|
||||
_loginService.putUser("admin", new Password("password"), new String[]{"user", "administrator"});
|
||||
_loginService.putUser("user3", new Password("password"), new String[]{"foo"});
|
||||
loginService.putUser("user0", new Password("password"), new String[]{});
|
||||
loginService.putUser("user", new Password("password"), new String[]{"user"});
|
||||
loginService.putUser("user2", new Password("password"), new String[]{"user"});
|
||||
loginService.putUser("admin", new Password("password"), new String[]{"user", "administrator"});
|
||||
loginService.putUser("user3", new Password("password"), new String[]{"foo"});
|
||||
|
||||
_context.setContextPath("/ctx");
|
||||
_server.setHandler(_context);
|
||||
_context.setHandler(_session);
|
||||
contextHandler.setContextPath("/ctx");
|
||||
_server.setHandler(contextHandler);
|
||||
contextHandler.setHandler(sessionHandler);
|
||||
|
||||
_server.addBean(_loginService);
|
||||
_server.addBean(loginService);
|
||||
|
||||
_security = new ConstraintSecurityHandler();
|
||||
_session.setHandler(_security);
|
||||
RequestHandler _handler = new RequestHandler();
|
||||
_security.setHandler(_handler);
|
||||
sessionHandler.setHandler(_security);
|
||||
RequestHandler requestHandler = new RequestHandler();
|
||||
_security.setHandler(requestHandler);
|
||||
|
||||
_security.setConstraintMappings(getConstraintMappings(), getKnownRoles());
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ public class ConstraintTest
|
|||
* @throws Exception if test fails
|
||||
*/
|
||||
@Test
|
||||
public void testSecurityElementExample13_1() throws Exception
|
||||
public void testSecurityElementExample131() throws Exception
|
||||
{
|
||||
ServletSecurityElement element = new ServletSecurityElement();
|
||||
List<ConstraintMapping> mappings = ConstraintSecurityHandler.createConstraintsWithMappingsForPath("foo", "/foo/*", element);
|
||||
|
@ -256,7 +256,7 @@ public class ConstraintTest
|
|||
* @throws Exception if test fails
|
||||
*/
|
||||
@Test
|
||||
public void testSecurityElementExample13_2() throws Exception
|
||||
public void testSecurityElementExample132() throws Exception
|
||||
{
|
||||
HttpConstraintElement httpConstraintElement = new HttpConstraintElement(TransportGuarantee.CONFIDENTIAL);
|
||||
ServletSecurityElement element = new ServletSecurityElement(httpConstraintElement);
|
||||
|
@ -274,7 +274,7 @@ public class ConstraintTest
|
|||
* @ServletSecurity(@HttpConstraint(EmptyRoleSemantic.DENY))
|
||||
*/
|
||||
@Test
|
||||
public void testSecurityElementExample13_3() throws Exception
|
||||
public void testSecurityElementExample133() throws Exception
|
||||
{
|
||||
HttpConstraintElement httpConstraintElement = new HttpConstraintElement(EmptyRoleSemantic.DENY);
|
||||
ServletSecurityElement element = new ServletSecurityElement(httpConstraintElement);
|
||||
|
@ -292,7 +292,7 @@ public class ConstraintTest
|
|||
* @ServletSecurity(@HttpConstraint(rolesAllowed = "R1"))
|
||||
*/
|
||||
@Test
|
||||
public void testSecurityElementExample13_4() throws Exception
|
||||
public void testSecurityElementExample134() throws Exception
|
||||
{
|
||||
HttpConstraintElement httpConstraintElement = new HttpConstraintElement(TransportGuarantee.NONE, "R1");
|
||||
ServletSecurityElement element = new ServletSecurityElement(httpConstraintElement);
|
||||
|
@ -317,7 +317,7 @@ public class ConstraintTest
|
|||
* transportGuarantee = TransportGuarantee.CONFIDENTIAL)})
|
||||
*/
|
||||
@Test
|
||||
public void testSecurityElementExample13_5() throws Exception
|
||||
public void testSecurityElementExample135() throws Exception
|
||||
{
|
||||
List<HttpMethodConstraintElement> methodElements = new ArrayList<HttpMethodConstraintElement>();
|
||||
methodElements.add(new HttpMethodConstraintElement("GET", new HttpConstraintElement(TransportGuarantee.NONE, "R1")));
|
||||
|
@ -343,7 +343,7 @@ public class ConstraintTest
|
|||
* @ServletSecurity(value = @HttpConstraint(rolesAllowed = "R1"), httpMethodConstraints = @HttpMethodConstraint("GET"))
|
||||
*/
|
||||
@Test
|
||||
public void testSecurityElementExample13_6() throws Exception
|
||||
public void testSecurityElementExample136() throws Exception
|
||||
{
|
||||
List<HttpMethodConstraintElement> methodElements = new ArrayList<HttpMethodConstraintElement>();
|
||||
methodElements.add(new HttpMethodConstraintElement("GET"));
|
||||
|
@ -370,7 +370,7 @@ public class ConstraintTest
|
|||
* emptyRoleSemantic = EmptyRoleSemantic.DENY))
|
||||
*/
|
||||
@Test
|
||||
public void testSecurityElementExample13_7() throws Exception
|
||||
public void testSecurityElementExample137() throws Exception
|
||||
{
|
||||
List<HttpMethodConstraintElement> methodElements = new ArrayList<HttpMethodConstraintElement>();
|
||||
methodElements.add(new HttpMethodConstraintElement("TRACE", new HttpConstraintElement(EmptyRoleSemantic.DENY)));
|
||||
|
|
|
@ -79,12 +79,12 @@ public class DataConstraintsTest
|
|||
_connectorS = new LocalConnector(_server, https);
|
||||
_server.setConnectors(new Connector[]{_connector, _connectorS});
|
||||
|
||||
ContextHandler _context = new ContextHandler();
|
||||
ContextHandler contextHandler = new ContextHandler();
|
||||
_session = new SessionHandler();
|
||||
|
||||
_context.setContextPath("/ctx");
|
||||
_server.setHandler(_context);
|
||||
_context.setHandler(_session);
|
||||
contextHandler.setContextPath("/ctx");
|
||||
_server.setHandler(contextHandler);
|
||||
contextHandler.setHandler(_session);
|
||||
|
||||
_security = new ConstraintSecurityHandler();
|
||||
_session.setHandler(_security);
|
||||
|
|
|
@ -67,21 +67,21 @@ public class SpecExampleConstraintTest
|
|||
_connector = new LocalConnector(_server);
|
||||
_server.setConnectors(new Connector[]{_connector});
|
||||
|
||||
ContextHandler _context = new ContextHandler();
|
||||
ContextHandler context = new ContextHandler();
|
||||
_session = new SessionHandler();
|
||||
|
||||
TestLoginService _loginService = new TestLoginService(TEST_REALM);
|
||||
TestLoginService loginService = new TestLoginService(TEST_REALM);
|
||||
|
||||
_loginService.putUser("fred", new Password("password"), IdentityService.NO_ROLES);
|
||||
_loginService.putUser("harry", new Password("password"), new String[]{"HOMEOWNER"});
|
||||
_loginService.putUser("chris", new Password("password"), new String[]{"CONTRACTOR"});
|
||||
_loginService.putUser("steven", new Password("password"), new String[]{"SALESCLERK"});
|
||||
loginService.putUser("fred", new Password("password"), IdentityService.NO_ROLES);
|
||||
loginService.putUser("harry", new Password("password"), new String[]{"HOMEOWNER"});
|
||||
loginService.putUser("chris", new Password("password"), new String[]{"CONTRACTOR"});
|
||||
loginService.putUser("steven", new Password("password"), new String[]{"SALESCLERK"});
|
||||
|
||||
_context.setContextPath("/ctx");
|
||||
_server.setHandler(_context);
|
||||
_context.setHandler(_session);
|
||||
context.setContextPath("/ctx");
|
||||
_server.setHandler(context);
|
||||
context.setHandler(_session);
|
||||
|
||||
_server.addBean(_loginService);
|
||||
_server.addBean(loginService);
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
|
@ -89,8 +89,8 @@ public class SpecExampleConstraintTest
|
|||
{
|
||||
_security = new ConstraintSecurityHandler();
|
||||
_session.setHandler(_security);
|
||||
RequestHandler _handler = new RequestHandler();
|
||||
_security.setHandler(_handler);
|
||||
RequestHandler handler = new RequestHandler();
|
||||
_security.setHandler(handler);
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -118,10 +118,10 @@ public class SpnegoAuthenticatorTest
|
|||
};
|
||||
Request req = channel.getRequest();
|
||||
Response res = channel.getResponse();
|
||||
HttpFields http_fields = new HttpFields();
|
||||
HttpFields httpFields = new HttpFields();
|
||||
// Create a bogus Authorization header. We don't care about the actual credentials.
|
||||
http_fields.add(HttpHeader.AUTHORIZATION, "Basic asdf");
|
||||
MetaData.Request metadata = new MetaData.Request(http_fields);
|
||||
httpFields.add(HttpHeader.AUTHORIZATION, "Basic asdf");
|
||||
MetaData.Request metadata = new MetaData.Request(httpFields);
|
||||
metadata.setURI(new HttpURI("http://localhost"));
|
||||
req.setMetaData(metadata);
|
||||
|
||||
|
@ -168,7 +168,7 @@ public class SpnegoAuthenticatorTest
|
|||
{
|
||||
public MockConnector()
|
||||
{
|
||||
super(new Server() , null, null, null, 0);
|
||||
super(new Server(), null, null, null, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -55,9 +55,6 @@ public abstract class AbstractHandler extends ContainerLifeCycle implements Hand
|
|||
|
||||
private Server _server;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public AbstractHandler()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -709,23 +709,24 @@ public class JDBCSessionDataStore extends AbstractSessionDataStore
|
|||
statement.setLong(10, data.getExpiry());
|
||||
statement.setLong(11, data.getMaxInactiveMs());
|
||||
|
||||
if(!data.getAllAttributes().isEmpty())
|
||||
if (!data.getAllAttributes().isEmpty())
|
||||
{
|
||||
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(baos))
|
||||
{
|
||||
SessionData.serializeAttributes( data, oos );
|
||||
SessionData.serializeAttributes(data, oos);
|
||||
byte[] bytes = baos.toByteArray();
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream( bytes );
|
||||
statement.setBinaryStream( 12, bais, bytes.length );//attribute map as blob
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
|
||||
statement.setBinaryStream(12, bais, bytes.length);//attribute map as blob
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
statement.setBinaryStream( 12, EMPTY, 0);
|
||||
statement.setBinaryStream(12, EMPTY, 0);
|
||||
}
|
||||
statement.executeUpdate();
|
||||
if ( LOG.isDebugEnabled() ) LOG.debug( "Inserted session " + data );
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Inserted session " + data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -745,7 +746,7 @@ public class JDBCSessionDataStore extends AbstractSessionDataStore
|
|||
statement.setLong(5, data.getExpiry());
|
||||
statement.setLong(6, data.getMaxInactiveMs());
|
||||
|
||||
if(!data.getAllAttributes().isEmpty())
|
||||
if (!data.getAllAttributes().isEmpty())
|
||||
{
|
||||
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(baos))
|
||||
|
@ -754,17 +755,18 @@ public class JDBCSessionDataStore extends AbstractSessionDataStore
|
|||
byte[] bytes = baos.toByteArray();
|
||||
try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes))
|
||||
{
|
||||
statement.setBinaryStream( 7, bais, bytes.length );//attribute map as blob
|
||||
statement.setBinaryStream(7, bais, bytes.length);//attribute map as blob
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
statement.setBinaryStream( 7, EMPTY, 0);
|
||||
statement.setBinaryStream(7, EMPTY, 0);
|
||||
}
|
||||
statement.executeUpdate();
|
||||
|
||||
if ( LOG.isDebugEnabled() ) LOG.debug( "Updated session " + data );
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Updated session " + data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -172,9 +172,9 @@ public class AsyncCompletionTest extends HttpServerTestFixture
|
|||
}
|
||||
|
||||
enum WriteStyle
|
||||
{ARRAY, BUFFER, BYTE, BYTE_THEN_ARRAY, PRINT}
|
||||
|
||||
;
|
||||
{
|
||||
ARRAY, BUFFER, BYTE, BYTE_THEN_ARRAY, PRINT
|
||||
}
|
||||
|
||||
public static Stream<Arguments> asyncIOWriteTests()
|
||||
{
|
||||
|
@ -444,9 +444,6 @@ public class AsyncCompletionTest extends HttpServerTestFixture
|
|||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -703,7 +700,10 @@ public class AsyncCompletionTest extends HttpServerTestFixture
|
|||
}
|
||||
|
||||
enum ContentStyle
|
||||
{BUFFER, STREAM} // TODO more types needed here
|
||||
{
|
||||
BUFFER, STREAM
|
||||
// TODO more types needed here
|
||||
}
|
||||
|
||||
private static class SendContentHandler extends AbstractHandler
|
||||
{
|
||||
|
|
|
@ -188,33 +188,33 @@ public class AsyncStressTest
|
|||
@Override
|
||||
public void handle(String target, final Request baseRequest, final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
int read_before = 0;
|
||||
long sleep_for = -1;
|
||||
long suspend_for = -1;
|
||||
long resume_after = -1;
|
||||
long complete_after = -1;
|
||||
int readBefore = 0;
|
||||
long sleepFor = -1;
|
||||
long suspendFor = -1;
|
||||
long resumeAfter = -1;
|
||||
long completeAfter = -1;
|
||||
|
||||
final String uri = baseRequest.getHttpURI().toString();
|
||||
|
||||
if (request.getParameter("read") != null)
|
||||
read_before = Integer.parseInt(request.getParameter("read"));
|
||||
readBefore = Integer.parseInt(request.getParameter("read"));
|
||||
if (request.getParameter("sleep") != null)
|
||||
sleep_for = Integer.parseInt(request.getParameter("sleep"));
|
||||
sleepFor = Integer.parseInt(request.getParameter("sleep"));
|
||||
if (request.getParameter("suspend") != null)
|
||||
suspend_for = Integer.parseInt(request.getParameter("suspend"));
|
||||
suspendFor = Integer.parseInt(request.getParameter("suspend"));
|
||||
if (request.getParameter("resume") != null)
|
||||
resume_after = Integer.parseInt(request.getParameter("resume"));
|
||||
resumeAfter = Integer.parseInt(request.getParameter("resume"));
|
||||
if (request.getParameter("complete") != null)
|
||||
complete_after = Integer.parseInt(request.getParameter("complete"));
|
||||
completeAfter = Integer.parseInt(request.getParameter("complete"));
|
||||
|
||||
if (DispatcherType.REQUEST.equals(baseRequest.getDispatcherType()))
|
||||
{
|
||||
if (read_before > 0)
|
||||
if (readBefore > 0)
|
||||
{
|
||||
byte[] buf = new byte[read_before];
|
||||
byte[] buf = new byte[readBefore];
|
||||
request.getInputStream().read(buf);
|
||||
}
|
||||
else if (read_before < 0)
|
||||
else if (readBefore < 0)
|
||||
{
|
||||
InputStream in = request.getInputStream();
|
||||
int b = in.read();
|
||||
|
@ -224,13 +224,13 @@ public class AsyncStressTest
|
|||
}
|
||||
}
|
||||
|
||||
if (suspend_for >= 0)
|
||||
if (suspendFor >= 0)
|
||||
{
|
||||
final AsyncContext asyncContext = baseRequest.startAsync();
|
||||
asyncContext.addListener(__asyncListener);
|
||||
if (suspend_for > 0)
|
||||
asyncContext.setTimeout(suspend_for);
|
||||
if (complete_after > 0)
|
||||
if (suspendFor > 0)
|
||||
asyncContext.setTimeout(suspendFor);
|
||||
if (completeAfter > 0)
|
||||
{
|
||||
TimerTask complete = new TimerTask()
|
||||
{
|
||||
|
@ -259,17 +259,17 @@ public class AsyncStressTest
|
|||
};
|
||||
synchronized (_timer)
|
||||
{
|
||||
_timer.schedule(complete, complete_after);
|
||||
_timer.schedule(complete, completeAfter);
|
||||
}
|
||||
}
|
||||
else if (complete_after == 0)
|
||||
else if (completeAfter == 0)
|
||||
{
|
||||
response.setStatus(200);
|
||||
response.getOutputStream().println("COMPLETED " + request.getHeader("result"));
|
||||
baseRequest.setHandled(true);
|
||||
asyncContext.complete();
|
||||
}
|
||||
else if (resume_after > 0)
|
||||
else if (resumeAfter > 0)
|
||||
{
|
||||
TimerTask resume = new TimerTask()
|
||||
{
|
||||
|
@ -281,19 +281,19 @@ public class AsyncStressTest
|
|||
};
|
||||
synchronized (_timer)
|
||||
{
|
||||
_timer.schedule(resume, resume_after);
|
||||
_timer.schedule(resume, resumeAfter);
|
||||
}
|
||||
}
|
||||
else if (resume_after == 0)
|
||||
else if (resumeAfter == 0)
|
||||
{
|
||||
asyncContext.dispatch();
|
||||
}
|
||||
}
|
||||
else if (sleep_for >= 0)
|
||||
else if (sleepFor >= 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.sleep(sleep_for);
|
||||
Thread.sleep(sleepFor);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ import static org.hamcrest.Matchers.is;
|
|||
* Tests of poor various name=value scenarios and expectations of results
|
||||
* due to our efforts at being lenient with what we receive.
|
||||
*/
|
||||
public class CookieCutter_LenientTest
|
||||
public class CookieCutterLenientTest
|
||||
{
|
||||
public static Stream<Arguments> data()
|
||||
{
|
|
@ -55,7 +55,7 @@ public class CookieCutterTest
|
|||
* Example from RFC2109 and RFC2965
|
||||
*/
|
||||
@Test
|
||||
public void testRFC_Single()
|
||||
public void testRFCSingle()
|
||||
{
|
||||
String rawCookie = "$Version=\"1\"; Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"";
|
||||
|
||||
|
@ -72,7 +72,7 @@ public class CookieCutterTest
|
|||
* </p>
|
||||
*/
|
||||
@Test
|
||||
public void testRFC_Single_Lenient_NoSpaces()
|
||||
public void testRFCSingleLenientNoSpaces()
|
||||
{
|
||||
String rawCookie = "$Version=\"1\";Customer=\"WILE_E_COYOTE\";$Path=\"/acme\"";
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class CookieCutterTest
|
|||
* Example from RFC2109 and RFC2965
|
||||
*/
|
||||
@Test
|
||||
public void testRFC_Double()
|
||||
public void testRFCDouble()
|
||||
{
|
||||
String rawCookie = "$Version=\"1\"; " +
|
||||
"Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"; " +
|
||||
|
@ -103,7 +103,7 @@ public class CookieCutterTest
|
|||
* Example from RFC2109 and RFC2965
|
||||
*/
|
||||
@Test
|
||||
public void testRFC_Triple()
|
||||
public void testRFCTriple()
|
||||
{
|
||||
String rawCookie = "$Version=\"1\"; " +
|
||||
"Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"; " +
|
||||
|
@ -122,7 +122,7 @@ public class CookieCutterTest
|
|||
* Example from RFC2109 and RFC2965
|
||||
*/
|
||||
@Test
|
||||
public void testRFC_PathExample()
|
||||
public void testRFCPathExample()
|
||||
{
|
||||
String rawCookie = "$Version=\"1\"; " +
|
||||
"Part_Number=\"Riding_Rocket_0023\"; $Path=\"/acme/ammo\"; " +
|
||||
|
@ -139,7 +139,7 @@ public class CookieCutterTest
|
|||
* Example from RFC2109
|
||||
*/
|
||||
@Test
|
||||
public void testRFC2109_CookieSpoofingExample()
|
||||
public void testRFC2109CookieSpoofingExample()
|
||||
{
|
||||
String rawCookie = "$Version=\"1\"; " +
|
||||
"session_id=\"1234\"; " +
|
||||
|
@ -156,7 +156,7 @@ public class CookieCutterTest
|
|||
* Example from RFC2965
|
||||
*/
|
||||
@Test
|
||||
public void testRFC2965_CookieSpoofingExample()
|
||||
public void testRFC2965CookieSpoofingExample()
|
||||
{
|
||||
String rawCookie = "$Version=\"1\"; session_id=\"1234\", " +
|
||||
"$Version=\"1\"; session_id=\"1111\"; $Domain=\".cracker.edu\"";
|
||||
|
@ -177,7 +177,7 @@ public class CookieCutterTest
|
|||
* Example from RFC6265
|
||||
*/
|
||||
@Test
|
||||
public void testRFC6265_SidExample()
|
||||
public void testRFC6265SidExample()
|
||||
{
|
||||
String rawCookie = "SID=31d4d96e407aad42";
|
||||
|
||||
|
@ -191,7 +191,7 @@ public class CookieCutterTest
|
|||
* Example from RFC6265
|
||||
*/
|
||||
@Test
|
||||
public void testRFC6265_SidLangExample()
|
||||
public void testRFC6265SidLangExample()
|
||||
{
|
||||
String rawCookie = "SID=31d4d96e407aad42; lang=en-US";
|
||||
|
||||
|
@ -209,7 +209,7 @@ public class CookieCutterTest
|
|||
* </p>
|
||||
*/
|
||||
@Test
|
||||
public void testRFC6265_SidLangExample_Lenient()
|
||||
public void testRFC6265SidLangExampleLenient()
|
||||
{
|
||||
String rawCookie = "SID=31d4d96e407aad42;lang=en-US";
|
||||
|
||||
|
|
|
@ -74,14 +74,15 @@ public class DelayedServerTest extends HttpServerTestBase
|
|||
@Override
|
||||
public void succeeded()
|
||||
{
|
||||
pool.execute(()->
|
||||
pool.execute(() ->
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.sleep(10);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
catch (InterruptedException ignored)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -93,14 +94,15 @@ public class DelayedServerTest extends HttpServerTestBase
|
|||
@Override
|
||||
public void failed(Throwable x)
|
||||
{
|
||||
pool.execute(()->
|
||||
pool.execute(() ->
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.sleep(20);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
catch (InterruptedException ignored)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -154,17 +154,17 @@ public class DumpHandler extends AbstractHandler
|
|||
}
|
||||
}
|
||||
|
||||
String cookie_name = request.getParameter("CookieName");
|
||||
if (cookie_name != null && cookie_name.trim().length() > 0)
|
||||
String cookieName = request.getParameter("CookieName");
|
||||
if (cookieName != null && cookieName.trim().length() > 0)
|
||||
{
|
||||
String cookie_action = request.getParameter("Button");
|
||||
String cookieAction = request.getParameter("Button");
|
||||
try
|
||||
{
|
||||
String val = request.getParameter("CookieVal");
|
||||
val = val.replaceAll("[ \n\r=<>]", "?");
|
||||
Cookie cookie =
|
||||
new Cookie(cookie_name.trim(), val);
|
||||
if ("Clear Cookie".equals(cookie_action))
|
||||
new Cookie(cookieName.trim(), val);
|
||||
if ("Clear Cookie".equals(cookieAction))
|
||||
cookie.setMaxAge(0);
|
||||
response.addCookie(cookie);
|
||||
}
|
||||
|
|
|
@ -120,7 +120,9 @@ public class ErrorHandlerTest
|
|||
// produce an exception with a UTF-8 cause message
|
||||
if (target.startsWith("/utf8message/"))
|
||||
{
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharacters
|
||||
String message = "Euro is € and \u20AC and %E2%82%AC";
|
||||
// @checkstyle-enable-check : AvoidEscapedUnicodeCharacters
|
||||
throw new ServletException(new RuntimeException(message));
|
||||
}
|
||||
}
|
||||
|
@ -456,8 +458,10 @@ public class ErrorHandlerTest
|
|||
|
||||
if (path.startsWith("/utf8"))
|
||||
{
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharacters
|
||||
// we are Not expecting UTF-8 output, look for mangled ISO-8859-1 version
|
||||
assertThat("content", content, containsString("Euro is &euro; and \u20AC and %E2%82%AC"));
|
||||
// @checkstyle-enabled-check : AvoidEscapedUnicodeCharacters
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -556,8 +560,10 @@ public class ErrorHandlerTest
|
|||
|
||||
if (path.startsWith("/utf8"))
|
||||
{
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharacters
|
||||
// we are expecting UTF-8 output, look for it.
|
||||
assertThat("content", content, containsString("Euro is &euro; and \u20AC and %E2%82%AC"));
|
||||
// @checkstyle-enable-check : AvoidEscapedUnicodeCharacters
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,9 +168,9 @@ public class GracefulStopTest
|
|||
client.close();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test completed writes during shutdown do not close output
|
||||
*
|
||||
* @throws Exception on test failure
|
||||
*/
|
||||
@Test
|
||||
|
@ -205,7 +205,7 @@ public class GracefulStopTest
|
|||
stopper.start();
|
||||
|
||||
final int port = connector.getLocalPort();
|
||||
try(Socket client = new Socket("127.0.0.1", port))
|
||||
try (Socket client = new Socket("127.0.0.1", port))
|
||||
{
|
||||
client.getOutputStream().write((
|
||||
"GET / HTTP/1.1\r\n" +
|
||||
|
@ -215,7 +215,9 @@ public class GracefulStopTest
|
|||
client.getOutputStream().flush();
|
||||
|
||||
while (!connector.isShutdown())
|
||||
{
|
||||
Thread.sleep(10);
|
||||
}
|
||||
|
||||
handler.latchB.countDown();
|
||||
|
||||
|
@ -838,7 +840,7 @@ public class GracefulStopTest
|
|||
int c = 0;
|
||||
try
|
||||
{
|
||||
int content_length = request.getContentLength();
|
||||
int contentLength = request.getContentLength();
|
||||
InputStream in = request.getInputStream();
|
||||
|
||||
while (true)
|
||||
|
@ -850,7 +852,7 @@ public class GracefulStopTest
|
|||
|
||||
baseRequest.setHandled(true);
|
||||
response.setStatus(200);
|
||||
response.getWriter().printf("read %d/%d%n", c, content_length);
|
||||
response.getWriter().printf("read %d/%d%n", c, contentLength);
|
||||
}
|
||||
catch (Throwable th)
|
||||
{
|
||||
|
|
|
@ -890,6 +890,7 @@ public class HttpOutputTest
|
|||
response.setCharacterEncoding("UTF8");
|
||||
HttpOutput out = (HttpOutput)response.getOutputStream();
|
||||
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
exp.print("\u20AC\u0939\uD55C");
|
||||
out.print("\u20AC\u0939\uD55C");
|
||||
exp.print("zero");
|
||||
|
|
|
@ -274,6 +274,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
|||
assertThat(response, Matchers.containsString("HTTP/1.1 400 "));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExceptionThrownInHandlerLoop() throws Exception
|
||||
{
|
||||
|
@ -512,7 +513,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
|||
"\r\n" +
|
||||
"ABCDE\r\n" +
|
||||
"\r\n"
|
||||
//@checkstyle-enable-check : IllegalTokenText
|
||||
//@checkstyle-enable-check : IllegalTokenText
|
||||
).getBytes());
|
||||
os.flush();
|
||||
|
||||
|
@ -1199,7 +1200,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
|||
"Connection: close\r\n" +
|
||||
"\r\n" +
|
||||
"abcdefghi\n"
|
||||
//@checkstyle-enable-check : IllegalTokenText
|
||||
//@checkstyle-enable-check : IllegalTokenText
|
||||
).getBytes(StandardCharsets.ISO_8859_1));
|
||||
|
||||
String in = IO.toString(is);
|
||||
|
@ -1864,7 +1865,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
|||
public SendAsyncContentHandler(int size)
|
||||
{
|
||||
content = BufferUtil.allocate(size);
|
||||
Arrays.fill(content.array(),0,size,(byte)'X');
|
||||
Arrays.fill(content.array(), 0, size, (byte)'X');
|
||||
content.position(0);
|
||||
content.limit(size);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,8 @@ import org.junit.jupiter.api.BeforeEach;
|
|||
|
||||
public class HttpServerTestFixture
|
||||
{
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
|
||||
// Useful constants
|
||||
protected static final long PAUSE = 10L;
|
||||
protected static final int LOOPS = 50;
|
||||
|
@ -186,7 +188,6 @@ public class HttpServerTestFixture
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
protected static class SendErrorHandler extends AbstractHandler
|
||||
{
|
||||
private final int code;
|
||||
|
|
|
@ -35,6 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
|
||||
public class HttpWriterTest
|
||||
{
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
private HttpOutput _httpOut;
|
||||
private ByteBuffer _bytes;
|
||||
|
||||
|
@ -67,33 +68,33 @@ public class HttpWriterTest
|
|||
@Test
|
||||
public void testSimpleUTF8() throws Exception
|
||||
{
|
||||
HttpWriter _writer = new Utf8HttpWriter(_httpOut);
|
||||
_writer.write("Now is the time");
|
||||
HttpWriter writer = new Utf8HttpWriter(_httpOut);
|
||||
writer.write("Now is the time");
|
||||
assertArrayEquals("Now is the time".getBytes(StandardCharsets.UTF_8), BufferUtil.toArray(_bytes));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUTF8() throws Exception
|
||||
{
|
||||
HttpWriter _writer = new Utf8HttpWriter(_httpOut);
|
||||
_writer.write("How now \uFF22rown cow");
|
||||
HttpWriter writer = new Utf8HttpWriter(_httpOut);
|
||||
writer.write("How now \uFF22rown cow");
|
||||
assertArrayEquals("How now \uFF22rown cow".getBytes(StandardCharsets.UTF_8), BufferUtil.toArray(_bytes));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUTF16() throws Exception
|
||||
{
|
||||
HttpWriter _writer = new EncodingHttpWriter(_httpOut, StringUtil.__UTF16);
|
||||
_writer.write("How now \uFF22rown cow");
|
||||
HttpWriter writer = new EncodingHttpWriter(_httpOut, StringUtil.__UTF16);
|
||||
writer.write("How now \uFF22rown cow");
|
||||
assertArrayEquals("How now \uFF22rown cow".getBytes(StandardCharsets.UTF_16), BufferUtil.toArray(_bytes));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotCESU8() throws Exception
|
||||
{
|
||||
HttpWriter _writer = new Utf8HttpWriter(_httpOut);
|
||||
HttpWriter writer = new Utf8HttpWriter(_httpOut);
|
||||
String data = "xxx\uD801\uDC00xxx";
|
||||
_writer.write(data);
|
||||
writer.write(data);
|
||||
assertEquals("787878F0909080787878", TypeUtil.toHexString(BufferUtil.toArray(_bytes)));
|
||||
assertArrayEquals(data.getBytes(StandardCharsets.UTF_8), BufferUtil.toArray(_bytes));
|
||||
assertEquals(3 + 4 + 3, _bytes.remaining());
|
||||
|
@ -106,7 +107,7 @@ public class HttpWriterTest
|
|||
@Test
|
||||
public void testMultiByteOverflowUTF8() throws Exception
|
||||
{
|
||||
HttpWriter _writer = new Utf8HttpWriter(_httpOut);
|
||||
HttpWriter writer = new Utf8HttpWriter(_httpOut);
|
||||
final String singleByteStr = "a";
|
||||
final String multiByteDuplicateStr = "\uFF22";
|
||||
int remainSize = 1;
|
||||
|
@ -127,7 +128,7 @@ public class HttpWriterTest
|
|||
int length = HttpWriter.MAX_OUTPUT_CHARS - multiByteStrByteLength + remainSize + 1;
|
||||
sb.toString().getChars(0, length, buf, 0);
|
||||
|
||||
_writer.write(buf, 0, length);
|
||||
writer.write(buf, 0, length);
|
||||
|
||||
assertEquals(sb.toString(), new String(BufferUtil.toArray(_bytes), StandardCharsets.UTF_8));
|
||||
}
|
||||
|
@ -135,20 +136,20 @@ public class HttpWriterTest
|
|||
@Test
|
||||
public void testISO8859() throws Exception
|
||||
{
|
||||
HttpWriter _writer = new Iso88591HttpWriter(_httpOut);
|
||||
_writer.write("How now \uFF22rown cow");
|
||||
HttpWriter writer = new Iso88591HttpWriter(_httpOut);
|
||||
writer.write("How now \uFF22rown cow");
|
||||
assertEquals(new String(BufferUtil.toArray(_bytes), StandardCharsets.ISO_8859_1), "How now ?rown cow");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUTF16x2() throws Exception
|
||||
{
|
||||
HttpWriter _writer = new Utf8HttpWriter(_httpOut);
|
||||
HttpWriter writer = new Utf8HttpWriter(_httpOut);
|
||||
|
||||
String source = "\uD842\uDF9F";
|
||||
|
||||
byte[] bytes = source.getBytes(StandardCharsets.UTF_8);
|
||||
_writer.write(source.toCharArray(), 0, source.toCharArray().length);
|
||||
writer.write(source.toCharArray(), 0, source.toCharArray().length);
|
||||
|
||||
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
|
||||
java.io.OutputStreamWriter osw = new java.io.OutputStreamWriter(baos, StandardCharsets.UTF_8);
|
||||
|
@ -166,7 +167,7 @@ public class HttpWriterTest
|
|||
@Test
|
||||
public void testMultiByteOverflowUTF16x2() throws Exception
|
||||
{
|
||||
HttpWriter _writer = new Utf8HttpWriter(_httpOut);
|
||||
HttpWriter writer = new Utf8HttpWriter(_httpOut);
|
||||
|
||||
final String singleByteStr = "a";
|
||||
int remainSize = 1;
|
||||
|
@ -186,7 +187,7 @@ public class HttpWriterTest
|
|||
String source = sb.toString();
|
||||
|
||||
byte[] bytes = source.getBytes(StandardCharsets.UTF_8);
|
||||
_writer.write(source.toCharArray(), 0, source.toCharArray().length);
|
||||
writer.write(source.toCharArray(), 0, source.toCharArray().length);
|
||||
|
||||
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
|
||||
java.io.OutputStreamWriter osw = new java.io.OutputStreamWriter(baos, StandardCharsets.UTF_8);
|
||||
|
@ -202,9 +203,9 @@ public class HttpWriterTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testMultiByteOverflowUTF16x2_2() throws Exception
|
||||
public void testMultiByteOverflowUTF16X22() throws Exception
|
||||
{
|
||||
HttpWriter _writer = new Utf8HttpWriter(_httpOut);
|
||||
HttpWriter writer = new Utf8HttpWriter(_httpOut);
|
||||
|
||||
final String singleByteStr = "a";
|
||||
int remainSize = 1;
|
||||
|
@ -224,7 +225,7 @@ public class HttpWriterTest
|
|||
String source = sb.toString();
|
||||
|
||||
byte[] bytes = source.getBytes(StandardCharsets.UTF_8);
|
||||
_writer.write(source.toCharArray(), 0, source.toCharArray().length);
|
||||
writer.write(source.toCharArray(), 0, source.toCharArray().length);
|
||||
|
||||
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
|
||||
java.io.OutputStreamWriter osw = new java.io.OutputStreamWriter(baos, StandardCharsets.UTF_8);
|
||||
|
|
|
@ -252,7 +252,7 @@ public class InclusiveByteRangeTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRange_OpenEnded()
|
||||
public void testRangeOpenEnded()
|
||||
{
|
||||
assertSimpleRange(50, 499, "bytes=50-", 500);
|
||||
}
|
||||
|
@ -281,75 +281,75 @@ public class InclusiveByteRangeTest
|
|||
|
||||
@Test
|
||||
@Disabled
|
||||
public void testBadRange_SetPartiallyBad()
|
||||
public void testBadRangeSetPartiallyBad()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=1-50,1-b,a-50");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadRange_NoNumbers()
|
||||
public void testBadRangeNoNumbers()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=a-b");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadRange_Empty()
|
||||
public void testBadRangeEmpty()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void testBadRange_ZeroPrefixed()
|
||||
public void testBadRangeZeroPrefixed()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=01-050");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadRange_Hex()
|
||||
public void testBadRangeHex()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=0F-FF");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void testBadRange_TabWhitespace()
|
||||
public void testBadRangeTabWhitespace()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=\t1\t-\t50");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadRange_TabDelim()
|
||||
public void testBadRangeTabDelim()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=1-50\t90-101\t200-250");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadRange_SemiColonDelim()
|
||||
public void testBadRangeSemiColonDelim()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=1-50;90-101;200-250");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadRange_NegativeSize()
|
||||
public void testBadRangeNegativeSize()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=50-1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadRange_DoubleDash()
|
||||
public void testBadRangeDoubleDash()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=1--20");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadRange_TrippleDash()
|
||||
public void testBadRangeTrippleDash()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=1---");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadRange_ZeroedNegativeSize()
|
||||
public void testBadRangeZeroedNegativeSize()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=050-001");
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testOneResponse_10() throws Exception
|
||||
public void testOneResponse10() throws Exception
|
||||
{
|
||||
String response = _connector.getResponse("GET /R1 HTTP/1.0\r\n\r\n");
|
||||
assertThat(response, containsString("HTTP/1.1 200 OK"));
|
||||
|
@ -106,7 +106,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testOneResponse_10_keep_alive() throws Exception
|
||||
public void testOneResponse10KeepAlive() throws Exception
|
||||
{
|
||||
String response = _connector.getResponse(
|
||||
"GET /R1 HTTP/1.0\r\n" +
|
||||
|
@ -117,7 +117,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testOneResponse_10_keep_alive_empty() throws Exception
|
||||
public void testOneResponse10KeepAliveEmpty() throws Exception
|
||||
{
|
||||
String response = _connector.getResponse(
|
||||
"GET /R1?empty=true HTTP/1.0\r\n" +
|
||||
|
@ -128,7 +128,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testOneResponse_11() throws Exception
|
||||
public void testOneResponse11() throws Exception
|
||||
{
|
||||
String response = _connector.getResponse(
|
||||
"GET /R1 HTTP/1.1\r\n" +
|
||||
|
@ -139,7 +139,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testOneResponse_11_close() throws Exception
|
||||
public void testOneResponse11close() throws Exception
|
||||
{
|
||||
String response = _connector.getResponse(
|
||||
"GET /R1 HTTP/1.1\r\n" +
|
||||
|
@ -151,7 +151,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testOneResponse_11_empty() throws Exception
|
||||
public void testOneResponse11empty() throws Exception
|
||||
{
|
||||
String response = _connector.getResponse(
|
||||
"GET /R1?empty=true HTTP/1.1\r\n" +
|
||||
|
@ -163,7 +163,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testOneResponse_11_chunked() throws Exception
|
||||
public void testOneResponse11chunked() throws Exception
|
||||
{
|
||||
String response = _connector.getResponse(
|
||||
"GET /R1?flush=true HTTP/1.1\r\n" +
|
||||
|
@ -175,7 +175,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testThreeResponsePipeline_11() throws Exception
|
||||
public void testThreeResponsePipeline11() throws Exception
|
||||
{
|
||||
LocalEndPoint endp = _connector.connect();
|
||||
endp.addInput(
|
||||
|
@ -201,7 +201,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testThreeResponse_11() throws Exception
|
||||
public void testThreeResponse11() throws Exception
|
||||
{
|
||||
LocalEndPoint endp = _connector.connect();
|
||||
endp.addInput(
|
||||
|
@ -234,7 +234,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testThreeResponseClosed_11() throws Exception
|
||||
public void testThreeResponseClosed11() throws Exception
|
||||
{
|
||||
LocalEndPoint endp = _connector.connect();
|
||||
endp.addInput(
|
||||
|
|
|
@ -24,7 +24,7 @@ class MockConnector extends AbstractConnector
|
|||
{
|
||||
public MockConnector()
|
||||
{
|
||||
super(new Server() , null, null, null, 0);
|
||||
super(new Server(), null, null, null, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -82,7 +82,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test3_3()
|
||||
public void test33()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -108,9 +108,8 @@ public class PartialRFC2616Test
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void test3_3_2()
|
||||
public void test332()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -119,7 +118,7 @@ public class PartialRFC2616Test
|
|||
checkContains(get, 0, "Content-Type: text/html", "GET _content");
|
||||
checkContains(get, 0, "<html>", "GET body");
|
||||
int cli = get.indexOf("Content-Length");
|
||||
String contentLength = get.substring(cli,get.indexOf("\r",cli));
|
||||
String contentLength = get.substring(cli, get.indexOf("\r", cli));
|
||||
|
||||
String head = connector.getResponse("HEAD /R1 HTTP/1.0\n" + "Host: localhost\n" + "\n");
|
||||
checkContains(head, 0, "HTTP/1.1 200", "HEAD");
|
||||
|
@ -134,9 +133,8 @@ public class PartialRFC2616Test
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void test3_6_a() throws Exception
|
||||
public void test36a() throws Exception
|
||||
{
|
||||
int offset = 0;
|
||||
// Chunk last
|
||||
|
@ -150,12 +148,12 @@ public class PartialRFC2616Test
|
|||
"5;\015\012" +
|
||||
"123\015\012\015\012" +
|
||||
"0;\015\012\015\012");
|
||||
//@checkstyle-enable-check : IllegalTokenText
|
||||
//@checkstyle-enable-check : IllegalTokenText
|
||||
checkContains(response, offset, "HTTP/1.1 400 Bad", "Chunked last");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test3_6_b() throws Exception
|
||||
public void test36b() throws Exception
|
||||
{
|
||||
String response;
|
||||
int offset = 0;
|
||||
|
@ -201,7 +199,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test3_6_c() throws Exception
|
||||
public void test36c() throws Exception
|
||||
{
|
||||
String response;
|
||||
int offset = 0;
|
||||
|
@ -249,7 +247,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test3_6_d() throws Exception
|
||||
public void test36d() throws Exception
|
||||
{
|
||||
String response;
|
||||
int offset = 0;
|
||||
|
@ -281,7 +279,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test3_9() throws Exception
|
||||
public void test39() throws Exception
|
||||
{
|
||||
HttpFields fields = new HttpFields();
|
||||
|
||||
|
@ -297,7 +295,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test4_1() throws Exception
|
||||
public void test41() throws Exception
|
||||
{
|
||||
int offset = 0;
|
||||
// If _content length not used, second request will not be read.
|
||||
|
@ -327,7 +325,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test4_4_2() throws Exception
|
||||
public void test442() throws Exception
|
||||
{
|
||||
String response;
|
||||
int offset = 0;
|
||||
|
@ -356,7 +354,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test4_4_3() throws Exception
|
||||
public void test443() throws Exception
|
||||
{
|
||||
// Due to smuggling concerns, handling has been changed to
|
||||
// treat content length and chunking as a bad request.
|
||||
|
@ -389,7 +387,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test4_4_4() throws Exception
|
||||
public void test444() throws Exception
|
||||
{
|
||||
// No _content length
|
||||
assertTrue(true, "Skip 411 checks as IE breaks this rule");
|
||||
|
@ -413,7 +411,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test5_2_1() throws Exception
|
||||
public void test521() throws Exception
|
||||
{
|
||||
// Default Host
|
||||
int offset = 0;
|
||||
|
@ -425,7 +423,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test5_2_2() throws Exception
|
||||
public void test522() throws Exception
|
||||
{
|
||||
// Default Host
|
||||
int offset = 0;
|
||||
|
@ -443,7 +441,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test5_2() throws Exception
|
||||
public void test52() throws Exception
|
||||
{
|
||||
// Virtual Host
|
||||
int offset = 0;
|
||||
|
@ -466,7 +464,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test8_1() throws Exception
|
||||
public void test81() throws Exception
|
||||
{
|
||||
int offset = 0;
|
||||
String response = connector.getResponse("GET /R1 HTTP/1.1\n" + "Host: localhost\n" + "\n", 250, TimeUnit.MILLISECONDS);
|
||||
|
@ -500,7 +498,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test10_4_18() throws Exception
|
||||
public void test10418() throws Exception
|
||||
{
|
||||
// Expect Failure
|
||||
int offset = 0;
|
||||
|
@ -515,7 +513,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test8_2_3_dash5() throws Exception
|
||||
public void test823Dash5() throws Exception
|
||||
{
|
||||
// Expect with body: client sends the content right away, we should not send 100-Continue
|
||||
int offset = 0;
|
||||
|
@ -529,13 +527,13 @@ public class PartialRFC2616Test
|
|||
"\n" +
|
||||
//@checkstyle-disable-check : IllegalTokenText
|
||||
"123456\015\012");
|
||||
//@checkstyle-enable-check : IllegalTokenText
|
||||
//@checkstyle-enable-check : IllegalTokenText
|
||||
checkNotContained(response, offset, "HTTP/1.1 100 ", "8.2.3 expect 100");
|
||||
offset = checkContains(response, offset, "HTTP/1.1 200 OK", "8.2.3 expect with body") + 1;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test8_2_3() throws Exception
|
||||
public void test823() throws Exception
|
||||
{
|
||||
int offset = 0;
|
||||
// Expect 100
|
||||
|
@ -559,7 +557,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test8_2_4() throws Exception
|
||||
public void test824() throws Exception
|
||||
{
|
||||
// Expect 100 not sent
|
||||
int offset = 0;
|
||||
|
@ -575,7 +573,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test9_2() throws Exception
|
||||
public void test92() throws Exception
|
||||
{
|
||||
int offset = 0;
|
||||
|
||||
|
@ -594,7 +592,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test9_4()
|
||||
public void test94()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -617,7 +615,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test14_23() throws Exception
|
||||
public void test1423() throws Exception
|
||||
{
|
||||
try (StacklessLogging stackless = new StacklessLogging(HttpParser.class))
|
||||
{
|
||||
|
@ -640,7 +638,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test19_6()
|
||||
public void test196()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -80,6 +80,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
|||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
public class RequestTest
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(RequestTest.class);
|
||||
|
@ -153,7 +154,7 @@ public class RequestTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testParamExtraction_BadSequence() throws Exception
|
||||
public void testParamExtractionBadSequence() throws Exception
|
||||
{
|
||||
_handler._checker = new RequestTester()
|
||||
{
|
||||
|
@ -179,7 +180,7 @@ public class RequestTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testParamExtraction_Timeout() throws Exception
|
||||
public void testParamExtractionTimeout() throws Exception
|
||||
{
|
||||
_handler._checker = new RequestTester()
|
||||
{
|
||||
|
@ -637,17 +638,17 @@ public class RequestTest
|
|||
final long HUGE_LENGTH = (long)Integer.MAX_VALUE * 10L;
|
||||
|
||||
_handler._checker = (request, response) ->
|
||||
request.getContentLength() == (-1) && // per HttpServletRequest javadoc this must return (-1);
|
||||
request.getContentLength() == (-1) && // per HttpServletRequest javadoc this must return (-1);
|
||||
request.getContentLengthLong() == HUGE_LENGTH;
|
||||
|
||||
//Send a request with encoded form content
|
||||
String request = "POST / HTTP/1.1\r\n" +
|
||||
"Host: whatever\r\n" +
|
||||
"Content-Type: application/octet-stream\n" +
|
||||
"Content-Length: " + HUGE_LENGTH + "\n" +
|
||||
"Connection: close\n" +
|
||||
"\n" +
|
||||
"<insert huge amount of content here>\n";
|
||||
"Host: whatever\r\n" +
|
||||
"Content-Type: application/octet-stream\n" +
|
||||
"Content-Length: " + HUGE_LENGTH + "\n" +
|
||||
"Connection: close\n" +
|
||||
"\n" +
|
||||
"<insert huge amount of content here>\n";
|
||||
|
||||
System.out.println(request);
|
||||
|
||||
|
@ -665,8 +666,8 @@ public class RequestTest
|
|||
|
||||
_handler._checker = (request, response) ->
|
||||
request.getHeader("Content-Length").equals(hugeLength) &&
|
||||
request.getContentLength() == (-1) && // per HttpServletRequest javadoc this must return (-1);
|
||||
request.getContentLengthLong() == (-1); // exact behavior here not specified in Servlet javadoc
|
||||
request.getContentLength() == (-1) && // per HttpServletRequest javadoc this must return (-1);
|
||||
request.getContentLengthLong() == (-1); // exact behavior here not specified in Servlet javadoc
|
||||
|
||||
//Send a request with encoded form content
|
||||
String request = "POST / HTTP/1.1\r\n" +
|
||||
|
@ -1869,8 +1870,8 @@ public class RequestTest
|
|||
((Request)request).setHandled(true);
|
||||
|
||||
if (request.getContentLength() > 0 &&
|
||||
!request.getContentType().startsWith(MimeTypes.Type.FORM_ENCODED.asString()) &&
|
||||
!request.getContentType().startsWith("multipart/form-data"))
|
||||
!request.getContentType().startsWith(MimeTypes.Type.FORM_ENCODED.asString()) &&
|
||||
!request.getContentType().startsWith("multipart/form-data"))
|
||||
_content = IO.toString(request.getInputStream());
|
||||
|
||||
if (_checker != null && _checker.check(request, response))
|
||||
|
|
|
@ -89,6 +89,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
public class ResponseTest
|
||||
{
|
||||
|
||||
|
@ -121,14 +122,14 @@ public class ResponseTest
|
|||
BufferUtil.clear(_content);
|
||||
|
||||
_server = new Server();
|
||||
Scheduler _scheduler = new TimerScheduler();
|
||||
Scheduler scheduler = new TimerScheduler();
|
||||
HttpConfiguration config = new HttpConfiguration();
|
||||
LocalConnector connector = new LocalConnector(_server, null, _scheduler, null, 1, new HttpConnectionFactory(config));
|
||||
LocalConnector connector = new LocalConnector(_server, null, scheduler, null, 1, new HttpConnectionFactory(config));
|
||||
_server.addConnector(connector);
|
||||
_server.setHandler(new DumpHandler());
|
||||
_server.start();
|
||||
|
||||
AbstractEndPoint endp = new ByteArrayEndPoint(_scheduler, 5000)
|
||||
AbstractEndPoint endp = new ByteArrayEndPoint(scheduler, 5000)
|
||||
{
|
||||
@Override
|
||||
public InetSocketAddress getLocalAddress()
|
||||
|
@ -518,20 +519,20 @@ public class ResponseTest
|
|||
Response response = getResponse();
|
||||
Request request = response.getHttpChannel().getRequest();
|
||||
|
||||
SessionHandler session_handler = new SessionHandler();
|
||||
session_handler.setServer(_server);
|
||||
session_handler.setUsingCookies(true);
|
||||
session_handler.start();
|
||||
request.setSessionHandler(session_handler);
|
||||
SessionHandler sessionHandler = new SessionHandler();
|
||||
sessionHandler.setServer(_server);
|
||||
sessionHandler.setUsingCookies(true);
|
||||
sessionHandler.start();
|
||||
request.setSessionHandler(sessionHandler);
|
||||
HttpSession session = request.getSession(true);
|
||||
|
||||
assertThat(session, not(nullValue()));
|
||||
assertTrue(session.isNew());
|
||||
|
||||
HttpField set_cookie = response.getHttpFields().getField(HttpHeader.SET_COOKIE);
|
||||
assertThat(set_cookie, not(nullValue()));
|
||||
assertThat(set_cookie.getValue(), startsWith("JSESSIONID"));
|
||||
assertThat(set_cookie.getValue(), containsString(session.getId()));
|
||||
HttpField setCookie = response.getHttpFields().getField(HttpHeader.SET_COOKIE);
|
||||
assertThat(setCookie, not(nullValue()));
|
||||
assertThat(setCookie.getValue(), startsWith("JSESSIONID"));
|
||||
assertThat(setCookie.getValue(), containsString(session.getId()));
|
||||
response.setHeader("Some", "Header");
|
||||
response.addCookie(new Cookie("Some", "Cookie"));
|
||||
response.getOutputStream().print("X");
|
||||
|
@ -539,10 +540,10 @@ public class ResponseTest
|
|||
|
||||
response.reset();
|
||||
|
||||
set_cookie = response.getHttpFields().getField(HttpHeader.SET_COOKIE);
|
||||
assertThat(set_cookie, not(nullValue()));
|
||||
assertThat(set_cookie.getValue(), startsWith("JSESSIONID"));
|
||||
assertThat(set_cookie.getValue(), containsString(session.getId()));
|
||||
setCookie = response.getHttpFields().getField(HttpHeader.SET_COOKIE);
|
||||
assertThat(setCookie, not(nullValue()));
|
||||
assertThat(setCookie.getValue(), startsWith("JSESSIONID"));
|
||||
assertThat(setCookie.getValue(), containsString(session.getId()));
|
||||
assertThat(response.getHttpFields().size(), is(2));
|
||||
response.getWriter();
|
||||
}
|
||||
|
@ -576,7 +577,7 @@ public class ResponseTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testPrint_Empty() throws Exception
|
||||
public void testPrintEmpty() throws Exception
|
||||
{
|
||||
Response response = getResponse();
|
||||
response.setCharacterEncoding(UTF_8.name());
|
||||
|
@ -688,7 +689,6 @@ public class ResponseTest
|
|||
else
|
||||
response.sendError(code, message);
|
||||
|
||||
|
||||
assertTrue(response.getHttpOutput().isClosed());
|
||||
assertEquals(code, response.getStatus());
|
||||
assertEquals(null, response.getReason());
|
||||
|
@ -988,7 +988,7 @@ public class ResponseTest
|
|||
* https://bugs.chromium.org/p/chromium/issues/detail?id=700618
|
||||
*/
|
||||
@Test
|
||||
public void testAddCookie_JavaxServletHttp() throws Exception
|
||||
public void testAddCookieJavaxServletHttp() throws Exception
|
||||
{
|
||||
Response response = getResponse();
|
||||
|
||||
|
@ -1007,7 +1007,7 @@ public class ResponseTest
|
|||
* https://bugs.chromium.org/p/chromium/issues/detail?id=700618
|
||||
*/
|
||||
@Test
|
||||
public void testAddCookie_JavaNet() throws Exception
|
||||
public void testAddCookieJavaNet() throws Exception
|
||||
{
|
||||
java.net.HttpCookie cookie = new java.net.HttpCookie("foo", URLEncoder.encode("bar;baz", UTF_8.toString()));
|
||||
cookie.setPath("/secure");
|
||||
|
|
|
@ -119,7 +119,7 @@ public class ServerConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testReuseAddress_Default() throws Exception
|
||||
public void testReuseAddressDefault() throws Exception
|
||||
{
|
||||
Server server = new Server();
|
||||
ServerConnector connector = new ServerConnector(server);
|
||||
|
@ -154,7 +154,7 @@ public class ServerConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testReuseAddress_True() throws Exception
|
||||
public void testReuseAddressTrue() throws Exception
|
||||
{
|
||||
Server server = new Server();
|
||||
ServerConnector connector = new ServerConnector(server);
|
||||
|
@ -190,7 +190,7 @@ public class ServerConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testReuseAddress_False() throws Exception
|
||||
public void testReuseAddressFalse() throws Exception
|
||||
{
|
||||
Server server = new Server();
|
||||
ServerConnector connector = new ServerConnector(server);
|
||||
|
|
|
@ -70,14 +70,14 @@ public class ServerConnectorTimeoutTest extends ConnectorTimeoutTest
|
|||
public void testIdleTimeoutAfterSuspend() throws Exception
|
||||
{
|
||||
_server.stop();
|
||||
SuspendHandler _handler = new SuspendHandler();
|
||||
SuspendHandler handler = new SuspendHandler();
|
||||
SessionHandler session = new SessionHandler();
|
||||
session.setHandler(_handler);
|
||||
session.setHandler(handler);
|
||||
_server.setHandler(session);
|
||||
_server.start();
|
||||
|
||||
_handler.setSuspendFor(100);
|
||||
_handler.setResumeAfter(25);
|
||||
handler.setSuspendFor(100);
|
||||
handler.setResumeAfter(25);
|
||||
assertTimeoutPreemptively(ofSeconds(10), () ->
|
||||
{
|
||||
String process = process(null).toUpperCase(Locale.ENGLISH);
|
||||
|
@ -88,14 +88,14 @@ public class ServerConnectorTimeoutTest extends ConnectorTimeoutTest
|
|||
@Test
|
||||
public void testIdleTimeoutAfterTimeout() throws Exception
|
||||
{
|
||||
SuspendHandler _handler = new SuspendHandler();
|
||||
SuspendHandler handler = new SuspendHandler();
|
||||
_server.stop();
|
||||
SessionHandler session = new SessionHandler();
|
||||
session.setHandler(_handler);
|
||||
session.setHandler(handler);
|
||||
_server.setHandler(session);
|
||||
_server.start();
|
||||
|
||||
_handler.setSuspendFor(50);
|
||||
handler.setSuspendFor(50);
|
||||
assertTimeoutPreemptively(ofSeconds(10), () ->
|
||||
{
|
||||
String process = process(null).toUpperCase(Locale.ENGLISH);
|
||||
|
@ -106,15 +106,15 @@ public class ServerConnectorTimeoutTest extends ConnectorTimeoutTest
|
|||
@Test
|
||||
public void testIdleTimeoutAfterComplete() throws Exception
|
||||
{
|
||||
SuspendHandler _handler = new SuspendHandler();
|
||||
SuspendHandler handler = new SuspendHandler();
|
||||
_server.stop();
|
||||
SessionHandler session = new SessionHandler();
|
||||
session.setHandler(_handler);
|
||||
session.setHandler(handler);
|
||||
_server.setHandler(session);
|
||||
_server.start();
|
||||
|
||||
_handler.setSuspendFor(100);
|
||||
_handler.setCompleteAfter(25);
|
||||
handler.setSuspendFor(100);
|
||||
handler.setCompleteAfter(25);
|
||||
assertTimeoutPreemptively(ofSeconds(10), () ->
|
||||
{
|
||||
String process = process(null).toUpperCase(Locale.ENGLISH);
|
||||
|
|
|
@ -72,7 +72,8 @@ public class ServletWriterTest
|
|||
char[] chars = new char[128 * 1024 * 1024];
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
AtomicReference<Thread> serverThreadRef = new AtomicReference<>();
|
||||
start(chars.length, new AbstractHandler() {
|
||||
start(chars.length, new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
|
|
|
@ -104,8 +104,8 @@ public class StressTest
|
|||
_connector.setIdleTimeout(30000);
|
||||
_server.addConnector(_connector);
|
||||
|
||||
TestHandler _handler = new TestHandler();
|
||||
_server.setHandler(_handler);
|
||||
TestHandler handler = new TestHandler();
|
||||
_server.setHandler(handler);
|
||||
|
||||
_server.start();
|
||||
}
|
||||
|
@ -256,9 +256,9 @@ public class StressTest
|
|||
throw throwable;
|
||||
}
|
||||
|
||||
for (ConcurrentLinkedQueue _latency : _latencies)
|
||||
for (ConcurrentLinkedQueue latency : _latencies)
|
||||
{
|
||||
assertEquals(_handled.get(), _latency.size());
|
||||
assertEquals(_handled.get(), latency.size());
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
|
|
@ -27,7 +27,6 @@ import java.nio.file.Path;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
@ -545,7 +544,7 @@ public class ContextHandlerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testVirtualHostManagement() throws Exception
|
||||
public void testVirtualHostManagement()
|
||||
{
|
||||
ContextHandler context = new ContextHandler("/");
|
||||
|
||||
|
@ -659,7 +658,7 @@ public class ContextHandlerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testLogNameFromContextPath_Deep() throws Exception
|
||||
public void testLogNameFromContextPathDeep() throws Exception
|
||||
{
|
||||
ContextHandler handler = new ContextHandler();
|
||||
handler.setServer(new Server());
|
||||
|
@ -676,7 +675,7 @@ public class ContextHandlerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testLogNameFromContextPath_Root() throws Exception
|
||||
public void testLogNameFromContextPathRoot() throws Exception
|
||||
{
|
||||
ContextHandler handler = new ContextHandler();
|
||||
handler.setServer(new Server());
|
||||
|
@ -693,7 +692,7 @@ public class ContextHandlerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testLogNameFromContextPath_Undefined() throws Exception
|
||||
public void testLogNameFromContextPathUndefined() throws Exception
|
||||
{
|
||||
ContextHandler handler = new ContextHandler();
|
||||
handler.setServer(new Server());
|
||||
|
@ -709,7 +708,7 @@ public class ContextHandlerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testLogNameFromContextPath_Empty() throws Exception
|
||||
public void testLogNameFromContextPathEmpty() throws Exception
|
||||
{
|
||||
ContextHandler handler = new ContextHandler();
|
||||
handler.setServer(new Server());
|
||||
|
@ -726,7 +725,7 @@ public class ContextHandlerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testClassPath_WithSpaces() throws IOException
|
||||
public void testClassPathWithSpaces() throws IOException
|
||||
{
|
||||
ContextHandler handler = new ContextHandler();
|
||||
handler.setServer(new Server());
|
||||
|
@ -815,7 +814,7 @@ public class ContextHandlerTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handle(String s, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String s, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
this.handled = true;
|
||||
|
@ -830,7 +829,7 @@ public class ContextHandlerTest
|
|||
private static final class ContextPathHandler extends AbstractHandler
|
||||
{
|
||||
@Override
|
||||
public void handle(String s, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String s, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
|
||||
|
|
|
@ -131,7 +131,8 @@ public class InetAccessHandlerTest
|
|||
testConnector(_connector2.getLocalPort(), include, exclude, includeConnectors, excludeConnectors, codePerConnector.get(1));
|
||||
}
|
||||
|
||||
private void testConnector(int port, String include, String exclude, String includeConnectors, String excludeConnectors, String code) throws IOException {
|
||||
private void testConnector(int port, String include, String exclude, String includeConnectors, String excludeConnectors, String code) throws IOException
|
||||
{
|
||||
try (Socket socket = new Socket("127.0.0.1", port);)
|
||||
{
|
||||
socket.setSoTimeout(5000);
|
||||
|
@ -157,6 +158,7 @@ public class InetAccessHandlerTest
|
|||
|
||||
/**
|
||||
* Data for this test.
|
||||
*
|
||||
* @return Format of data: include;exclude;includeConnectors;excludeConnectors;assertionStatusCodePerConnector
|
||||
*/
|
||||
public static Stream<Arguments> data()
|
||||
|
@ -211,12 +213,12 @@ public class InetAccessHandlerTest
|
|||
{"127.0.0.1-127.0.0.254", "", "http_connector1;http_connector2", "", "200;200"},
|
||||
{"192.0.0.1", "", "http_connector1;http_connector2", "", "403;403"},
|
||||
{"192.0.0.1-192.0.0.254", "", "http_connector1;http_connector2", "", "403;403"},
|
||||
|
||||
|
||||
// exclude takes precedence over include
|
||||
{"127.0.0.1", "", "http_connector1;http_connector2", "http_connector1;http_connector2", "200;200"},
|
||||
{"127.0.0.1-127.0.0.254", "", "http_connector1;http_connector2", "http_connector1;http_connector2", "200;200"},
|
||||
{"192.0.0.1", "", "http_connector1;http_connector2", "http_connector1;http_connector2", "200;200"},
|
||||
{"192.0.0.1-192.0.0.254", "", "http_connector1;http_connector2", "http_connector1;http_connector2", "200;200"},
|
||||
{"192.0.0.1-192.0.0.254", "", "http_connector1;http_connector2", "http_connector1;http_connector2", "200;200"}
|
||||
};
|
||||
return Arrays.asList(data).stream().map(Arguments::of);
|
||||
}
|
||||
|
|
|
@ -195,11 +195,11 @@ public class ResourceHandlerTest
|
|||
assertThat(response.getStatus(), equalTo(200));
|
||||
assertThat(response.get(LAST_MODIFIED), Matchers.notNullValue());
|
||||
assertThat(response.getContent(), containsString("simple text"));
|
||||
String last_modified = response.get(LAST_MODIFIED);
|
||||
String lastModified = response.get(LAST_MODIFIED);
|
||||
|
||||
response = HttpTester.parseResponse(_local.getResponse(
|
||||
"GET /resource/simple.txt HTTP/1.0\r\n" +
|
||||
"If-Modified-Since: " + last_modified + "\r\n" +
|
||||
"If-Modified-Since: " + lastModified + "\r\n" +
|
||||
"\r\n"));
|
||||
|
||||
assertThat(response.getStatus(), equalTo(304));
|
||||
|
|
|
@ -127,7 +127,7 @@ public class RangeWriterTest
|
|||
|
||||
@ParameterizedTest(name = "[{index}] {0}")
|
||||
@MethodSource("impls")
|
||||
public void testSameRange_MultipleTimes(String description, RangeWriter rangeWriter) throws IOException
|
||||
public void testSameRangeMultipleTimes(String description, RangeWriter rangeWriter) throws IOException
|
||||
{
|
||||
ByteArrayOutputStream outputStream;
|
||||
|
||||
|
@ -142,7 +142,7 @@ public class RangeWriterTest
|
|||
|
||||
@ParameterizedTest(name = "[{index}] {0}")
|
||||
@MethodSource("impls")
|
||||
public void testMultipleRanges_Ordered(String description, RangeWriter rangeWriter) throws IOException
|
||||
public void testMultipleRangesOrdered(String description, RangeWriter rangeWriter) throws IOException
|
||||
{
|
||||
ByteArrayOutputStream outputStream;
|
||||
|
||||
|
@ -161,7 +161,7 @@ public class RangeWriterTest
|
|||
|
||||
@ParameterizedTest(name = "[{index}] {0}")
|
||||
@MethodSource("impls")
|
||||
public void testMultipleRanges_Overlapping(String description, RangeWriter rangeWriter) throws IOException
|
||||
public void testMultipleRangesOverlapping(String description, RangeWriter rangeWriter) throws IOException
|
||||
{
|
||||
ByteArrayOutputStream outputStream;
|
||||
|
||||
|
@ -180,7 +180,7 @@ public class RangeWriterTest
|
|||
|
||||
@ParameterizedTest(name = "[{index}] {0}")
|
||||
@MethodSource("impls")
|
||||
public void testMultipleRanges_ReverseOrder(String description, RangeWriter rangeWriter) throws IOException
|
||||
public void testMultipleRangesReverseOrder(String description, RangeWriter rangeWriter) throws IOException
|
||||
{
|
||||
ByteArrayOutputStream outputStream;
|
||||
|
||||
|
|
|
@ -369,8 +369,8 @@ public class SSLEngineTest
|
|||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
// System.err.println("HANDLE "+request.getRequestURI());
|
||||
String ssl_id = (String)request.getAttribute("javax.servlet.request.ssl_session_id");
|
||||
assertNotNull(ssl_id);
|
||||
String sslId = (String)request.getAttribute("javax.servlet.request.ssl_session_id");
|
||||
assertNotNull(sslId);
|
||||
|
||||
if (request.getParameter("dump") != null)
|
||||
{
|
||||
|
|
|
@ -272,8 +272,6 @@ public class SniSslConnectionFactoryTest
|
|||
assertThat(response.getStatus(), is(400));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testWrongSNIRejectedFunction() throws Exception
|
||||
{
|
||||
|
|
|
@ -77,12 +77,12 @@ public class SslConnectionFactoryTest
|
|||
|
||||
_server = new Server();
|
||||
|
||||
HttpConfiguration http_config = new HttpConfiguration();
|
||||
http_config.setSecureScheme("https");
|
||||
http_config.setSecurePort(8443);
|
||||
http_config.setOutputBufferSize(32768);
|
||||
HttpConfiguration https_config = new HttpConfiguration(http_config);
|
||||
https_config.addCustomizer(new SecureRequestCustomizer());
|
||||
HttpConfiguration httpConfig = new HttpConfiguration();
|
||||
httpConfig.setSecureScheme("https");
|
||||
httpConfig.setSecurePort(8443);
|
||||
httpConfig.setOutputBufferSize(32768);
|
||||
HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig);
|
||||
httpsConfig.addCustomizer(new SecureRequestCustomizer());
|
||||
|
||||
SslContextFactory sslContextFactory = new SslContextFactory.Server();
|
||||
sslContextFactory.setKeyStorePath(keystoreFile.getAbsolutePath());
|
||||
|
@ -91,7 +91,7 @@ public class SslConnectionFactoryTest
|
|||
|
||||
ServerConnector https = _connector = new ServerConnector(_server,
|
||||
new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
|
||||
new HttpConnectionFactory(https_config));
|
||||
new HttpConnectionFactory(httpsConfig));
|
||||
https.setPort(0);
|
||||
https.setIdleTimeout(30000);
|
||||
|
||||
|
|
|
@ -93,10 +93,10 @@ public class AsyncContextTest
|
|||
_contextHandler.addServlet(new ServletHolder(new BadExpireServlet()), "/badexpire/*");
|
||||
_contextHandler.addServlet(new ServletHolder(new ErrorServlet()), "/error/*");
|
||||
|
||||
ErrorPageErrorHandler error_handler = new ErrorPageErrorHandler();
|
||||
_contextHandler.setErrorHandler(error_handler);
|
||||
error_handler.addErrorPage(500, "/error/500");
|
||||
error_handler.addErrorPage(IOException.class.getName(), "/error/IOE");
|
||||
ErrorPageErrorHandler errorHandler = new ErrorPageErrorHandler();
|
||||
_contextHandler.setErrorHandler(errorHandler);
|
||||
errorHandler.addErrorPage(500, "/error/500");
|
||||
errorHandler.addErrorPage(IOException.class.getName(), "/error/IOE");
|
||||
|
||||
HandlerList handlers = new HandlerList();
|
||||
handlers.setHandlers(new Handler[]
|
||||
|
@ -227,7 +227,7 @@ public class AsyncContextTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDispatchAsyncContext_EncodedUrl() throws Exception
|
||||
public void testDispatchAsyncContextEncodedUrl() throws Exception
|
||||
{
|
||||
String request = "GET /ctx/test/hello%2fthere?dispatch=true HTTP/1.1\r\n" +
|
||||
"Host: localhost\r\n" +
|
||||
|
@ -260,7 +260,7 @@ public class AsyncContextTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDispatchAsyncContext_SelfEncodedUrl() throws Exception
|
||||
public void testDispatchAsyncContextSelfEncodedUrl() throws Exception
|
||||
{
|
||||
String request = "GET /ctx/self/hello%2fthere?dispatch=true HTTP/1.1\r\n" +
|
||||
"Host: localhost\r\n" +
|
||||
|
|
|
@ -70,9 +70,9 @@ public class AsyncListenerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_StartAsync_Throw_OnError_Dispatch() throws Exception
|
||||
public void testStartAsyncThrowOnErrorDispatch() throws Exception
|
||||
{
|
||||
test_StartAsync_Throw_OnError(event -> event.getAsyncContext().dispatch("/dispatch"));
|
||||
testStartAsyncThrowOnError(event -> event.getAsyncContext().dispatch("/dispatch"));
|
||||
String httpResponse = connector.getResponse(
|
||||
"GET /ctx/path HTTP/1.1\r\n" +
|
||||
"Host: localhost\r\n" +
|
||||
|
@ -82,9 +82,9 @@ public class AsyncListenerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_StartAsync_Throw_OnError_Complete() throws Exception
|
||||
public void testStartAsyncThrowOnErrorComplete() throws Exception
|
||||
{
|
||||
test_StartAsync_Throw_OnError(event ->
|
||||
testStartAsyncThrowOnError(event ->
|
||||
{
|
||||
HttpServletResponse response = (HttpServletResponse)event.getAsyncContext().getResponse();
|
||||
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR_500);
|
||||
|
@ -106,9 +106,9 @@ public class AsyncListenerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_StartAsync_Throw_OnError_Throw() throws Exception
|
||||
public void testStartAsyncThrowOnErrorThrow() throws Exception
|
||||
{
|
||||
test_StartAsync_Throw_OnError(event ->
|
||||
testStartAsyncThrowOnError(event ->
|
||||
{
|
||||
throw new IOException();
|
||||
});
|
||||
|
@ -122,9 +122,9 @@ public class AsyncListenerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_StartAsync_Throw_OnError_Nothing() throws Exception
|
||||
public void testStartAsyncThrowOnErrorNothing() throws Exception
|
||||
{
|
||||
test_StartAsync_Throw_OnError(event ->
|
||||
testStartAsyncThrowOnError(event ->
|
||||
{
|
||||
});
|
||||
String httpResponse = connector.getResponse(
|
||||
|
@ -137,9 +137,9 @@ public class AsyncListenerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_StartAsync_Throw_OnError_SendError() throws Exception
|
||||
public void testStartAsyncThrowOnErrorSendError() throws Exception
|
||||
{
|
||||
test_StartAsync_Throw_OnError(event ->
|
||||
testStartAsyncThrowOnError(event ->
|
||||
{
|
||||
HttpServletResponse response = (HttpServletResponse)event.getAsyncContext().getResponse();
|
||||
response.sendError(HttpStatus.BAD_GATEWAY_502, "Message!!!");
|
||||
|
@ -155,9 +155,9 @@ public class AsyncListenerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_StartAsync_Throw_OnError_SendError_CustomErrorPage() throws Exception
|
||||
public void testStartAsyncThrowOnErrorSendErrorCustomErrorPage() throws Exception
|
||||
{
|
||||
test_StartAsync_Throw_OnError(event ->
|
||||
testStartAsyncThrowOnError(event ->
|
||||
{
|
||||
HttpServletResponse response = (HttpServletResponse)event.getAsyncContext().getResponse();
|
||||
response.sendError(HttpStatus.BAD_GATEWAY_502);
|
||||
|
@ -184,14 +184,14 @@ public class AsyncListenerTest
|
|||
assertThat(httpResponse, containsString("CUSTOM"));
|
||||
}
|
||||
|
||||
private void test_StartAsync_Throw_OnError(IOConsumer<AsyncEvent> consumer) throws Exception
|
||||
private void testStartAsyncThrowOnError(IOConsumer<AsyncEvent> consumer) throws Exception
|
||||
{
|
||||
ServletContextHandler context = new ServletContextHandler();
|
||||
context.setContextPath("/ctx");
|
||||
context.addServlet(new ServletHolder(new HttpServlet()
|
||||
{
|
||||
@Override
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException
|
||||
{
|
||||
AsyncContext asyncContext = request.startAsync();
|
||||
asyncContext.setTimeout(10000);
|
||||
|
@ -209,7 +209,7 @@ public class AsyncListenerTest
|
|||
context.addServlet(new ServletHolder(new HttpServlet()
|
||||
{
|
||||
@Override
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
response.setStatus(HttpStatus.OK_200);
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ public class AsyncListenerTest
|
|||
context.addServlet(new ServletHolder(new HttpServlet()
|
||||
{
|
||||
@Override
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
response.getOutputStream().print("CUSTOM");
|
||||
}
|
||||
|
@ -227,9 +227,9 @@ public class AsyncListenerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_StartAsync_OnTimeout_Dispatch() throws Exception
|
||||
public void testStartAsyncOnTimeoutDispatch() throws Exception
|
||||
{
|
||||
test_StartAsync_OnTimeout(500, event -> event.getAsyncContext().dispatch("/dispatch"));
|
||||
testStartAsyncOnTimeout(500, event -> event.getAsyncContext().dispatch("/dispatch"));
|
||||
String httpResponse = connector.getResponse(
|
||||
"GET / HTTP/1.1\r\n" +
|
||||
"Host: localhost\r\n" +
|
||||
|
@ -239,9 +239,9 @@ public class AsyncListenerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_StartAsync_OnTimeout_Complete() throws Exception
|
||||
public void testStartAsyncOnTimeoutComplete() throws Exception
|
||||
{
|
||||
test_StartAsync_OnTimeout(500, event ->
|
||||
testStartAsyncOnTimeout(500, event ->
|
||||
{
|
||||
HttpServletResponse response = (HttpServletResponse)event.getAsyncContext().getResponse();
|
||||
response.setStatus(HttpStatus.OK_200);
|
||||
|
@ -259,9 +259,9 @@ public class AsyncListenerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_StartAsync_OnTimeout_Throw() throws Exception
|
||||
public void testStartAsyncOnTimeoutThrow() throws Exception
|
||||
{
|
||||
test_StartAsync_OnTimeout(500, event ->
|
||||
testStartAsyncOnTimeout(500, event ->
|
||||
{
|
||||
throw new TestRuntimeException();
|
||||
});
|
||||
|
@ -276,9 +276,9 @@ public class AsyncListenerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_StartAsync_OnTimeout_Nothing() throws Exception
|
||||
public void testStartAsyncOnTimeoutNothing() throws Exception
|
||||
{
|
||||
test_StartAsync_OnTimeout(500, event ->
|
||||
testStartAsyncOnTimeout(500, event ->
|
||||
{
|
||||
});
|
||||
String httpResponse = connector.getResponse(
|
||||
|
@ -290,9 +290,9 @@ public class AsyncListenerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_StartAsync_OnTimeout_SendError() throws Exception
|
||||
public void testStartAsyncOnTimeoutSendError() throws Exception
|
||||
{
|
||||
test_StartAsync_OnTimeout(500, event ->
|
||||
testStartAsyncOnTimeout(500, event ->
|
||||
{
|
||||
HttpServletResponse response = (HttpServletResponse)event.getAsyncContext().getResponse();
|
||||
response.sendError(HttpStatus.BAD_GATEWAY_502);
|
||||
|
@ -307,9 +307,9 @@ public class AsyncListenerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_StartAsync_OnTimeout_SendError_CustomErrorPage() throws Exception
|
||||
public void testStartAsyncOnTimeoutSendErrorCustomErrorPage() throws Exception
|
||||
{
|
||||
test_StartAsync_OnTimeout(500, event ->
|
||||
testStartAsyncOnTimeout(500, event ->
|
||||
{
|
||||
AsyncContext asyncContext = event.getAsyncContext();
|
||||
HttpServletResponse response = (HttpServletResponse)asyncContext.getResponse();
|
||||
|
@ -339,13 +339,13 @@ public class AsyncListenerTest
|
|||
assertThat(httpResponse, containsString("CUSTOM"));
|
||||
}
|
||||
|
||||
private void test_StartAsync_OnTimeout(long timeout, IOConsumer<AsyncEvent> consumer) throws Exception
|
||||
private void testStartAsyncOnTimeout(long timeout, IOConsumer<AsyncEvent> consumer) throws Exception
|
||||
{
|
||||
ServletContextHandler context = new ServletContextHandler();
|
||||
context.addServlet(new ServletHolder(new HttpServlet()
|
||||
{
|
||||
@Override
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
AsyncContext asyncContext = request.startAsync();
|
||||
asyncContext.setTimeout(timeout);
|
||||
|
@ -362,7 +362,7 @@ public class AsyncListenerTest
|
|||
context.addServlet(new ServletHolder(new HttpServlet()
|
||||
{
|
||||
@Override
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
response.setStatus(HttpStatus.OK_200);
|
||||
}
|
||||
|
@ -370,7 +370,7 @@ public class AsyncListenerTest
|
|||
context.addServlet(new ServletHolder(new HttpServlet()
|
||||
{
|
||||
@Override
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
response.getOutputStream().print("CUSTOM");
|
||||
}
|
||||
|
@ -380,20 +380,20 @@ public class AsyncListenerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_StartAsync_OnComplete_Throw() throws Exception
|
||||
public void testStartAsyncOnCompleteThrow() throws Exception
|
||||
{
|
||||
ServletContextHandler context = new ServletContextHandler();
|
||||
context.addServlet(new ServletHolder(new HttpServlet()
|
||||
{
|
||||
@Override
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
AsyncContext asyncContext = request.startAsync();
|
||||
asyncContext.setTimeout(10000);
|
||||
asyncContext.addListener(new AsyncListenerAdapter()
|
||||
{
|
||||
@Override
|
||||
public void onComplete(AsyncEvent event) throws IOException
|
||||
public void onComplete(AsyncEvent event)
|
||||
{
|
||||
throw new TestRuntimeException();
|
||||
}
|
||||
|
@ -415,7 +415,7 @@ public class AsyncListenerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_StartAsync_OnTimeout_CalledBy_PooledThread() throws Exception
|
||||
public void testStartAsyncOnTimeoutCalledByPooledThread() throws Exception
|
||||
{
|
||||
String threadNamePrefix = "async_listener";
|
||||
threadPool = new QueuedThreadPool();
|
||||
|
@ -424,14 +424,14 @@ public class AsyncListenerTest
|
|||
context.addServlet(new ServletHolder(new HttpServlet()
|
||||
{
|
||||
@Override
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
AsyncContext asyncContext = request.startAsync();
|
||||
asyncContext.setTimeout(1000);
|
||||
asyncContext.addListener(new AsyncListenerAdapter()
|
||||
{
|
||||
@Override
|
||||
public void onTimeout(AsyncEvent event) throws IOException
|
||||
public void onTimeout(AsyncEvent event)
|
||||
{
|
||||
if (Thread.currentThread().getName().startsWith(threadNamePrefix))
|
||||
response.setStatus(HttpStatus.OK_200);
|
||||
|
@ -459,7 +459,7 @@ public class AsyncListenerTest
|
|||
public static class AsyncListenerAdapter implements AsyncListener
|
||||
{
|
||||
@Override
|
||||
public void onComplete(AsyncEvent event) throws IOException
|
||||
public void onComplete(AsyncEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -474,7 +474,7 @@ public class AsyncListenerTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onStartAsync(AsyncEvent event) throws IOException
|
||||
public void onStartAsync(AsyncEvent event)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,9 +93,9 @@ public class AsyncServletIOTest
|
|||
_wQTP = new WrappingQTP();
|
||||
_server = new Server(_wQTP);
|
||||
|
||||
HttpConfiguration http_config = new HttpConfiguration();
|
||||
http_config.setOutputBufferSize(4096);
|
||||
_connector = new ServerConnector(_server, new HttpConnectionFactory(http_config));
|
||||
HttpConfiguration httpConfig = new HttpConfiguration();
|
||||
httpConfig.setOutputBufferSize(4096);
|
||||
_connector = new ServerConnector(_server, new HttpConnectionFactory(httpConfig));
|
||||
|
||||
_server.setConnectors(new Connector[]{_connector});
|
||||
ServletContextHandler context = new ServletContextHandler();
|
||||
|
|
|
@ -716,43 +716,43 @@ public class AsyncServletTest
|
|||
historyAdd("wrapped" + ((request instanceof ServletRequestWrapper) ? " REQ" : "") + ((response instanceof ServletResponseWrapper) ? " RSP" : ""));
|
||||
|
||||
boolean wrap = "true".equals(request.getParameter("wrap"));
|
||||
int read_before = 0;
|
||||
long sleep_for = -1;
|
||||
long start_for = -1;
|
||||
long start2_for = -1;
|
||||
long dispatch_after = -1;
|
||||
long dispatch2_after = -1;
|
||||
long complete_after = -1;
|
||||
long complete2_after = -1;
|
||||
int readBefore = 0;
|
||||
long sleepFor = -1;
|
||||
long startFor = -1;
|
||||
long start2For = -1;
|
||||
long dispatchAfter = -1;
|
||||
long dispatch2After = -1;
|
||||
long completeAfter = -1;
|
||||
long complete2After = -1;
|
||||
|
||||
if (request.getParameter("read") != null)
|
||||
read_before = Integer.parseInt(request.getParameter("read"));
|
||||
readBefore = Integer.parseInt(request.getParameter("read"));
|
||||
if (request.getParameter("sleep") != null)
|
||||
sleep_for = Integer.parseInt(request.getParameter("sleep"));
|
||||
sleepFor = Integer.parseInt(request.getParameter("sleep"));
|
||||
if (request.getParameter("start") != null)
|
||||
start_for = Integer.parseInt(request.getParameter("start"));
|
||||
startFor = Integer.parseInt(request.getParameter("start"));
|
||||
if (request.getParameter("start2") != null)
|
||||
start2_for = Integer.parseInt(request.getParameter("start2"));
|
||||
start2For = Integer.parseInt(request.getParameter("start2"));
|
||||
if (request.getParameter("dispatch") != null)
|
||||
dispatch_after = Integer.parseInt(request.getParameter("dispatch"));
|
||||
dispatchAfter = Integer.parseInt(request.getParameter("dispatch"));
|
||||
final String path = request.getParameter("path");
|
||||
if (request.getParameter("dispatch2") != null)
|
||||
dispatch2_after = Integer.parseInt(request.getParameter("dispatch2"));
|
||||
dispatch2After = Integer.parseInt(request.getParameter("dispatch2"));
|
||||
if (request.getParameter("complete") != null)
|
||||
complete_after = Integer.parseInt(request.getParameter("complete"));
|
||||
completeAfter = Integer.parseInt(request.getParameter("complete"));
|
||||
if (request.getParameter("complete2") != null)
|
||||
complete2_after = Integer.parseInt(request.getParameter("complete2"));
|
||||
complete2After = Integer.parseInt(request.getParameter("complete2"));
|
||||
|
||||
if (request.getAttribute("State") == null)
|
||||
{
|
||||
request.setAttribute("State", new Integer(1));
|
||||
historyAdd("initial");
|
||||
if (read_before > 0)
|
||||
if (readBefore > 0)
|
||||
{
|
||||
byte[] buf = new byte[read_before];
|
||||
byte[] buf = new byte[readBefore];
|
||||
request.getInputStream().read(buf);
|
||||
}
|
||||
else if (read_before < 0)
|
||||
else if (readBefore < 0)
|
||||
{
|
||||
InputStream in = request.getInputStream();
|
||||
int b = in.read();
|
||||
|
@ -788,18 +788,18 @@ public class AsyncServletTest
|
|||
}.start();
|
||||
}
|
||||
|
||||
if (start_for >= 0)
|
||||
if (startFor >= 0)
|
||||
{
|
||||
final AsyncContext async = wrap ? request.startAsync(new HttpServletRequestWrapper(request), new HttpServletResponseWrapper(response)) : request.startAsync();
|
||||
if (start_for > 0)
|
||||
async.setTimeout(start_for);
|
||||
if (startFor > 0)
|
||||
async.setTimeout(startFor);
|
||||
async.addListener(__listener);
|
||||
historyAdd("start");
|
||||
|
||||
if ("1".equals(request.getParameter("throw")))
|
||||
throw new QuietServletException(new Exception("test throw in async 1"));
|
||||
|
||||
if (complete_after > 0)
|
||||
if (completeAfter > 0)
|
||||
{
|
||||
TimerTask complete = new TimerTask()
|
||||
{
|
||||
|
@ -821,17 +821,17 @@ public class AsyncServletTest
|
|||
};
|
||||
synchronized (_timer)
|
||||
{
|
||||
_timer.schedule(complete, complete_after);
|
||||
_timer.schedule(complete, completeAfter);
|
||||
}
|
||||
}
|
||||
else if (complete_after == 0)
|
||||
else if (completeAfter == 0)
|
||||
{
|
||||
response.setStatus(200);
|
||||
response.getOutputStream().println("COMPLETED\n");
|
||||
historyAdd("complete");
|
||||
async.complete();
|
||||
}
|
||||
else if (dispatch_after > 0)
|
||||
else if (dispatchAfter > 0)
|
||||
{
|
||||
TimerTask dispatch = new TimerTask()
|
||||
{
|
||||
|
@ -853,10 +853,10 @@ public class AsyncServletTest
|
|||
};
|
||||
synchronized (_timer)
|
||||
{
|
||||
_timer.schedule(dispatch, dispatch_after);
|
||||
_timer.schedule(dispatch, dispatchAfter);
|
||||
}
|
||||
}
|
||||
else if (dispatch_after == 0)
|
||||
else if (dispatchAfter == 0)
|
||||
{
|
||||
historyAdd("dispatch");
|
||||
if (path != null)
|
||||
|
@ -865,11 +865,11 @@ public class AsyncServletTest
|
|||
async.dispatch();
|
||||
}
|
||||
}
|
||||
else if (sleep_for >= 0)
|
||||
else if (sleepFor >= 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.sleep(sleep_for);
|
||||
Thread.sleep(sleepFor);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
|
@ -888,22 +888,22 @@ public class AsyncServletTest
|
|||
{
|
||||
historyAdd("!initial");
|
||||
|
||||
if (start2_for >= 0 && request.getAttribute("2nd") == null)
|
||||
if (start2For >= 0 && request.getAttribute("2nd") == null)
|
||||
{
|
||||
final AsyncContext async = wrap ? request.startAsync(new HttpServletRequestWrapper(request), new HttpServletResponseWrapper(response)) : request.startAsync();
|
||||
async.addListener(__listener);
|
||||
request.setAttribute("2nd", "cycle");
|
||||
|
||||
if (start2_for > 0)
|
||||
if (start2For > 0)
|
||||
{
|
||||
async.setTimeout(start2_for);
|
||||
async.setTimeout(start2For);
|
||||
}
|
||||
historyAdd("start");
|
||||
|
||||
if ("2".equals(request.getParameter("throw")))
|
||||
throw new QuietServletException(new Exception("test throw in async 2"));
|
||||
|
||||
if (complete2_after > 0)
|
||||
if (complete2After > 0)
|
||||
{
|
||||
TimerTask complete = new TimerTask()
|
||||
{
|
||||
|
@ -925,17 +925,17 @@ public class AsyncServletTest
|
|||
};
|
||||
synchronized (_timer)
|
||||
{
|
||||
_timer.schedule(complete, complete2_after);
|
||||
_timer.schedule(complete, complete2After);
|
||||
}
|
||||
}
|
||||
else if (complete2_after == 0)
|
||||
else if (complete2After == 0)
|
||||
{
|
||||
response.setStatus(200);
|
||||
response.getOutputStream().println("COMPLETED\n");
|
||||
historyAdd("complete");
|
||||
async.complete();
|
||||
}
|
||||
else if (dispatch2_after > 0)
|
||||
else if (dispatch2After > 0)
|
||||
{
|
||||
TimerTask dispatch = new TimerTask()
|
||||
{
|
||||
|
@ -948,10 +948,10 @@ public class AsyncServletTest
|
|||
};
|
||||
synchronized (_timer)
|
||||
{
|
||||
_timer.schedule(dispatch, dispatch2_after);
|
||||
_timer.schedule(dispatch, dispatch2After);
|
||||
}
|
||||
}
|
||||
else if (dispatch2_after == 0)
|
||||
else if (dispatch2After == 0)
|
||||
{
|
||||
historyAdd("dispatch");
|
||||
async.dispatch();
|
||||
|
|
|
@ -134,7 +134,7 @@ public class ComplianceViolations2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNoColonHeader_Middle() throws Exception
|
||||
public void testNoColonHeaderMiddle() throws Exception
|
||||
{
|
||||
StringBuffer req1 = new StringBuffer();
|
||||
req1.append("GET /dump/ HTTP/1.1\r\n");
|
||||
|
@ -151,7 +151,7 @@ public class ComplianceViolations2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNoColonHeader_End() throws Exception
|
||||
public void testNoColonHeaderEnd() throws Exception
|
||||
{
|
||||
StringBuffer req1 = new StringBuffer();
|
||||
req1.append("GET /dump/ HTTP/1.1\r\n");
|
||||
|
|
|
@ -273,7 +273,7 @@ public class DefaultServletTest
|
|||
* This test ensures that this behavior will not arise again.
|
||||
*/
|
||||
@Test
|
||||
public void testListingFilenamesOnly_UrlResource() throws Exception
|
||||
public void testListingFilenamesOnlyUrlResource() throws Exception
|
||||
{
|
||||
URL extraResource = context.getClassLoader().getResource("rez/one");
|
||||
assertNotNull(extraResource, "Must have extra jar resource in classloader");
|
||||
|
@ -874,7 +874,7 @@ public class DefaultServletTest
|
|||
* Ensure that oddball directory names are served with proper escaping
|
||||
*/
|
||||
@Test
|
||||
public void testWelcomeRedirect_DirWithQuestion() throws Exception
|
||||
public void testWelcomeRedirectDirWithQuestion() throws Exception
|
||||
{
|
||||
FS.ensureDirExists(docRoot);
|
||||
context.setBaseResource(new PathResource(docRoot));
|
||||
|
@ -908,7 +908,7 @@ public class DefaultServletTest
|
|||
* Ensure that oddball directory names are served with proper escaping
|
||||
*/
|
||||
@Test
|
||||
public void testWelcomeRedirect_DirWithSemicolon() throws Exception
|
||||
public void testWelcomeRedirectDirWithSemicolon() throws Exception
|
||||
{
|
||||
FS.ensureDirExists(docRoot);
|
||||
context.setBaseResource(new PathResource(docRoot));
|
||||
|
@ -1500,7 +1500,7 @@ public class DefaultServletTest
|
|||
body = response.getContent();
|
||||
assertThat(body, containsString("Hello Text 0"));
|
||||
String etag = response.get(HttpHeader.ETAG);
|
||||
String etag_gzip = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2--gzip\"");
|
||||
String etagGzip = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2--gzip\"");
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
|
@ -1509,7 +1509,7 @@ public class DefaultServletTest
|
|||
assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "text/plain"));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.VARY, "Accept-Encoding"));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.CONTENT_ENCODING, "gzip"));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_gzip));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagGzip));
|
||||
body = response.getContent();
|
||||
assertThat(body, containsString("fake gzip"));
|
||||
|
||||
|
@ -1520,7 +1520,7 @@ public class DefaultServletTest
|
|||
assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "application/gzip"));
|
||||
assertThat(response, not(containsHeader(HttpHeader.VARY)));
|
||||
assertThat(response, not(containsHeader(HttpHeader.CONTENT_ENCODING)));
|
||||
assertThat("Should not contain gzip variant", response, not(containsHeaderValue(HttpHeader.ETAG, etag_gzip)));
|
||||
assertThat("Should not contain gzip variant", response, not(containsHeaderValue(HttpHeader.ETAG, etagGzip)));
|
||||
assertThat("Should have a different ETag", response, containsHeader(HttpHeader.ETAG));
|
||||
body = response.getContent();
|
||||
assertThat(body, containsString("fake gzip"));
|
||||
|
@ -1532,30 +1532,30 @@ public class DefaultServletTest
|
|||
assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "application/gzip"));
|
||||
assertThat(response, not(containsHeader(HttpHeader.VARY)));
|
||||
assertThat(response, not(containsHeader(HttpHeader.CONTENT_ENCODING)));
|
||||
assertThat("Should not contain gzip variant", response, not(containsHeaderValue(HttpHeader.ETAG, etag_gzip)));
|
||||
assertThat("Should not contain gzip variant", response, not(containsHeaderValue(HttpHeader.ETAG, etagGzip)));
|
||||
assertThat("Should have a different ETag", response, containsHeader(HttpHeader.ETAG));
|
||||
body = response.getContent();
|
||||
assertThat(body, containsString("fake gzip"));
|
||||
|
||||
String bad_etag_gzip = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2X--gzip\"");
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: " + bad_etag_gzip + "\r\n\r\n");
|
||||
String badEtagGzip = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2X--gzip\"");
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: " + badEtagGzip + "\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
assertThat(response.toString(), response.getStatus(), is(not(HttpStatus.NOT_MODIFIED_304)));
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: " + etag_gzip + "\r\n\r\n");
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: " + etagGzip + "\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_gzip));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagGzip));
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: " + etag + "\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag));
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: W/\"foobar\"," + etag_gzip + "\r\n\r\n");
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: W/\"foobar\"," + etagGzip + "\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_gzip));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagGzip));
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: W/\"foobar\"," + etag + "\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
|
@ -1599,7 +1599,7 @@ public class DefaultServletTest
|
|||
assertThat(body, containsString("Hello Text 0"));
|
||||
|
||||
String etag = response.get(HttpHeader.ETAG);
|
||||
String etag_gzip = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2--gzip\"");
|
||||
String etagGzip = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2--gzip\"");
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
|
@ -1608,7 +1608,7 @@ public class DefaultServletTest
|
|||
assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "text/plain"));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.VARY, "Accept-Encoding"));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.CONTENT_ENCODING, "gzip"));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_gzip));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagGzip));
|
||||
body = response.getContent();
|
||||
assertThat(body, containsString("fake gzip"));
|
||||
|
||||
|
@ -1619,25 +1619,25 @@ public class DefaultServletTest
|
|||
assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "application/gzip"));
|
||||
assertThat(response, not(containsHeader(HttpHeader.VARY)));
|
||||
assertThat(response, not(containsHeader(HttpHeader.CONTENT_ENCODING)));
|
||||
assertThat("Should not contain gzip variant", response, not(containsHeaderValue(HttpHeader.ETAG, etag_gzip)));
|
||||
assertThat("Should not contain gzip variant", response, not(containsHeaderValue(HttpHeader.ETAG, etagGzip)));
|
||||
assertThat("Should have a different ETag", response, containsHeader(HttpHeader.ETAG));
|
||||
body = response.getContent();
|
||||
assertThat(body, containsString("fake gzip"));
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: " + etag_gzip + "\r\n\r\n");
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: " + etagGzip + "\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_gzip));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagGzip));
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: " + etag + "\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag));
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: W/\"foobar\"," + etag_gzip + "\r\n\r\n");
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: W/\"foobar\"," + etagGzip + "\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_gzip));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagGzip));
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: W/\"foobar\"," + etag + "\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
|
@ -1674,7 +1674,7 @@ public class DefaultServletTest
|
|||
assertThat(body, containsString("Hello Text 0"));
|
||||
|
||||
String etag = response.get(HttpHeader.ETAG);
|
||||
String etag_br = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2--br\"");
|
||||
String etagBr = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2--br\"");
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip;q=0.9,br\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
|
@ -1683,7 +1683,7 @@ public class DefaultServletTest
|
|||
assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "text/plain"));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.VARY, "Accept-Encoding"));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.CONTENT_ENCODING, "br"));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_br));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagBr));
|
||||
body = response.getContent();
|
||||
assertThat(body, containsString("fake br"));
|
||||
|
||||
|
@ -1694,7 +1694,7 @@ public class DefaultServletTest
|
|||
assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "application/brotli"));
|
||||
assertThat(response, not(containsHeader(HttpHeader.VARY)));
|
||||
assertThat(response, not(containsHeader(HttpHeader.CONTENT_ENCODING)));
|
||||
assertThat("Should not contain br variant", response, not(containsHeaderValue(HttpHeader.ETAG, etag_br)));
|
||||
assertThat("Should not contain br variant", response, not(containsHeaderValue(HttpHeader.ETAG, etagBr)));
|
||||
assertThat("Should have a different ETag", response, containsHeader(HttpHeader.ETAG));
|
||||
body = response.getContent();
|
||||
assertThat(body, containsString("fake br"));
|
||||
|
@ -1706,25 +1706,25 @@ public class DefaultServletTest
|
|||
assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "application/brotli"));
|
||||
assertThat(response, not(containsHeader(HttpHeader.VARY)));
|
||||
assertThat(response, not(containsHeader(HttpHeader.CONTENT_ENCODING)));
|
||||
assertThat("Should not contain br variant", response, not(containsHeaderValue(HttpHeader.ETAG, etag_br)));
|
||||
assertThat("Should not contain br variant", response, not(containsHeaderValue(HttpHeader.ETAG, etagBr)));
|
||||
assertThat("Should have a different ETag", response, containsHeader(HttpHeader.ETAG));
|
||||
body = response.getContent();
|
||||
assertThat(body, containsString("fake br"));
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: " + etag_br + "\r\n\r\n");
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: " + etagBr + "\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_br));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagBr));
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: " + etag + "\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag));
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: W/\"foobar\"," + etag_br + "\r\n\r\n");
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: W/\"foobar\"," + etagBr + "\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_br));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagBr));
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: W/\"foobar\"," + etag + "\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
|
@ -1765,7 +1765,7 @@ public class DefaultServletTest
|
|||
assertThat(body, containsString("Hello Text 0"));
|
||||
|
||||
String etag = response.get(HttpHeader.ETAG);
|
||||
String etag_br = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2--br\"");
|
||||
String etagBr = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2--br\"");
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
|
@ -1774,7 +1774,7 @@ public class DefaultServletTest
|
|||
assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "text/plain"));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.VARY, "Accept-Encoding"));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.CONTENT_ENCODING, "br"));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_br));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagBr));
|
||||
body = response.getContent();
|
||||
assertThat(body, containsString("fake brotli"));
|
||||
|
||||
|
@ -1785,25 +1785,25 @@ public class DefaultServletTest
|
|||
assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "application/brotli"));
|
||||
assertThat(response, not(containsHeader(HttpHeader.VARY)));
|
||||
assertThat(response, not(containsHeader(HttpHeader.CONTENT_ENCODING)));
|
||||
assertThat("Should not contain br variant", response, not(containsHeaderValue(HttpHeader.ETAG, etag_br)));
|
||||
assertThat("Should not contain br variant", response, not(containsHeaderValue(HttpHeader.ETAG, etagBr)));
|
||||
assertThat("Should have a different ETag", response, containsHeader(HttpHeader.ETAG));
|
||||
body = response.getContent();
|
||||
assertThat(body, containsString("fake brotli"));
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: " + etag_br + "\r\n\r\n");
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: " + etagBr + "\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_br));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagBr));
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: " + etag + "\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag));
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: W/\"foobar\"," + etag_br + "\r\n\r\n");
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: W/\"foobar\"," + etagBr + "\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_br));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagBr));
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: W/\"foobar\"," + etag + "\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
|
@ -1931,9 +1931,9 @@ public class DefaultServletTest
|
|||
assertThat(response.toString(), response.getStatus(), is(HttpStatus.OK_200));
|
||||
assertThat(response, containsHeader(HttpHeader.LAST_MODIFIED));
|
||||
|
||||
String last_modified = response.get(HttpHeader.LAST_MODIFIED);
|
||||
String lastModified = response.get(HttpHeader.LAST_MODIFIED);
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/file.txt HTTP/1.1\r\nHost:test\r\nConnection:close\r\nIf-Modified-Since: " + last_modified + "\r\n\r\n");
|
||||
rawResponse = connector.getResponse("GET /context/file.txt HTTP/1.1\r\nHost:test\r\nConnection:close\r\nIf-Modified-Since: " + lastModified + "\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304));
|
||||
|
||||
|
|
|
@ -656,8 +656,8 @@ public class DispatcherTest
|
|||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
{
|
||||
byte[] cp1251_bytes = TypeUtil.fromHexString("d2e5ecefe5f0e0f2f3f0e0");
|
||||
String expectedCP1251String = new String(cp1251_bytes, "cp1251");
|
||||
byte[] cp1251Bytes = TypeUtil.fromHexString("d2e5ecefe5f0e0f2f3f0e0");
|
||||
String expectedCP1251String = new String(cp1251Bytes, "cp1251");
|
||||
|
||||
assertEquals("/context/ForwardServlet", request.getAttribute(Dispatcher.FORWARD_REQUEST_URI));
|
||||
assertEquals("/context", request.getAttribute(Dispatcher.FORWARD_CONTEXT_PATH));
|
||||
|
|
|
@ -183,7 +183,7 @@ public class ErrorPageTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGenerateAcceptableResponse_noAcceptHeader() throws Exception
|
||||
public void testGenerateAcceptableResponseNoAcceptHeader() throws Exception
|
||||
{
|
||||
// no global error page here
|
||||
_errorPageErrorHandler.getErrorPages().remove(ErrorPageErrorHandler.GLOBAL_ERROR_PAGE);
|
||||
|
@ -196,7 +196,7 @@ public class ErrorPageTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGenerateAcceptableResponse_htmlAcceptHeader() throws Exception
|
||||
public void testGenerateAcceptableResponseHtmlAcceptHeader() throws Exception
|
||||
{
|
||||
// no global error page here
|
||||
_errorPageErrorHandler.getErrorPages().remove(ErrorPageErrorHandler.GLOBAL_ERROR_PAGE);
|
||||
|
@ -211,7 +211,7 @@ public class ErrorPageTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGenerateAcceptableResponse_noHtmlAcceptHeader() throws Exception
|
||||
public void testGenerateAcceptableResponseNoHtmlAcceptHeader() throws Exception
|
||||
{
|
||||
// no global error page here
|
||||
_errorPageErrorHandler.getErrorPages().remove(ErrorPageErrorHandler.GLOBAL_ERROR_PAGE);
|
||||
|
@ -415,7 +415,7 @@ public class ErrorPageTest
|
|||
@Test
|
||||
public void testPermanentlyUnavailable() throws Exception
|
||||
{
|
||||
try (StacklessLogging ignore =new StacklessLogging(_context.getLogger()))
|
||||
try (StacklessLogging ignore = new StacklessLogging(_context.getLogger()))
|
||||
{
|
||||
try (StacklessLogging ignore2 = new StacklessLogging(HttpChannel.class))
|
||||
{
|
||||
|
@ -426,10 +426,11 @@ public class ErrorPageTest
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnavailable() throws Exception
|
||||
{
|
||||
try (StacklessLogging ignore =new StacklessLogging(_context.getLogger()))
|
||||
try (StacklessLogging ignore = new StacklessLogging(_context.getLogger()))
|
||||
{
|
||||
try (StacklessLogging ignore2 = new StacklessLogging(HttpChannel.class))
|
||||
{
|
||||
|
@ -494,7 +495,7 @@ public class ErrorPageTest
|
|||
{
|
||||
final CountDownLatch hold = new CountDownLatch(1);
|
||||
final String mode = request.getParameter("mode");
|
||||
switch(mode)
|
||||
switch (mode)
|
||||
{
|
||||
case "DSC":
|
||||
case "SDC":
|
||||
|
@ -510,7 +511,7 @@ public class ErrorPageTest
|
|||
{
|
||||
try
|
||||
{
|
||||
switch(mode)
|
||||
switch (mode)
|
||||
{
|
||||
case "SDC":
|
||||
response.sendError(599);
|
||||
|
@ -553,7 +554,7 @@ public class ErrorPageTest
|
|||
break;
|
||||
}
|
||||
}
|
||||
catch(IllegalStateException e)
|
||||
catch (IllegalStateException e)
|
||||
{
|
||||
Log.getLog().ignore(e);
|
||||
}
|
||||
|
@ -661,7 +662,6 @@ public class ErrorPageTest
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static class UnavailableServlet extends HttpServlet implements Servlet
|
||||
{
|
||||
@Override
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue