Search in sources :

Example 56 with FullResponse

use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.

the class TestDomainMatching method testDomain1RequestDomain1RouteWithPort.

@Test
public void testDomain1RequestDomain1RouteWithPort() {
    HttpRequest req = Requests.createGetRequest("mydomain.com:9000", "/domain1");
    httpsSocket.send(req);
    FullResponse response = ResponseExtract.assertSingleResponse(httpsSocket);
    response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
    response.assertContains("This is domain1");
}
Also used : HttpRequest(org.webpieces.httpparser.api.dto.HttpRequest) FullResponse(org.webpieces.webserver.test.FullResponse) Test(org.junit.Test) WebserverForTest(org.webpieces.webserver.WebserverForTest) AbstractWebpiecesTest(org.webpieces.webserver.test.AbstractWebpiecesTest)

Example 57 with FullResponse

use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.

the class TestDevRefreshPageWithNoRestarting method verifyPageContents.

private void verifyPageContents(String contents) {
    FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
    response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
    response.assertContains(contents);
}
Also used : FullResponse(org.webpieces.webserver.test.FullResponse)

Example 58 with FullResponse

use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.

the class TestDevRefreshPageWithNoRestarting method verify500PageContents.

private void verify500PageContents(String contents) {
    FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
    response.assertStatusCode(KnownStatusCode.HTTP_500_INTERNAL_SVR_ERROR);
    response.assertContains(contents);
}
Also used : FullResponse(org.webpieces.webserver.test.FullResponse)

Example 59 with FullResponse

use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.

the class TestDevRefreshPageWithNoRestarting method testNotFoundDisplaysWithIframeANDSpecialUrl.

@Test
public void testNotFoundDisplaysWithIframeANDSpecialUrl() {
    HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/notFound");
    http11Socket.send(req);
    FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
    response.assertStatusCode(KnownStatusCode.HTTP_404_NOTFOUND);
    //platform should convert request into a development not found page which has an iframe
    //of the original page with a query param to tell platform to display original 
    //page requested 
    response.assertContains("<iframe src=\"/notFound?webpiecesShowPage=true");
}
Also used : HttpRequest(org.webpieces.httpparser.api.dto.HttpRequest) FullResponse(org.webpieces.webserver.test.FullResponse) AbstractWebpiecesTest(org.webpieces.webserver.test.AbstractWebpiecesTest) PlatformOverridesForTest(org.webpieces.webserver.test.PlatformOverridesForTest) Test(org.junit.Test) WebserverForTest(org.webpieces.webserver.WebserverForTest)

Example 60 with FullResponse

use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.

the class TestHttps method testSameRouteHttpAndHttpsCorrectOrder.

@Test
public void testSameRouteHttpAndHttpsCorrectOrder() {
    HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/same2");
    httpsSocket.send(req);
    FullResponse response = ResponseExtract.assertSingleResponse(httpsSocket);
    response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
    response.assertContains("Https Route");
    httpSocket.send(req);
    response = ResponseExtract.assertSingleResponse(httpSocket);
    response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
    response.assertContains("Http Route");
}
Also used : HttpRequest(org.webpieces.httpparser.api.dto.HttpRequest) FullResponse(org.webpieces.webserver.test.FullResponse) Test(org.junit.Test) AbstractWebpiecesTest(org.webpieces.webserver.test.AbstractWebpiecesTest) WebserverForTest(org.webpieces.webserver.WebserverForTest)

Aggregations

FullResponse (org.webpieces.webserver.test.FullResponse)154 Test (org.junit.Test)142 AbstractWebpiecesTest (org.webpieces.webserver.test.AbstractWebpiecesTest)142 WebserverForTest (org.webpieces.webserver.WebserverForTest)136 HttpRequest (org.webpieces.httpparser.api.dto.HttpRequest)120 HttpDummyRequest (org.webpieces.webserver.test.HttpDummyRequest)32 Header (org.webpieces.httpparser.api.common.Header)16 CompletableFuture (java.util.concurrent.CompletableFuture)11 PlatformOverridesForTest (org.webpieces.webserver.test.PlatformOverridesForTest)9 UserDto (org.webpieces.webserver.basic.app.biz.UserDto)4 UserTestDbo (org.webpieces.plugins.hibernate.app.dbo.UserTestDbo)3 NotFoundException (org.webpieces.router.api.exceptions.NotFoundException)2 ByteBuffer (java.nio.ByteBuffer)1 BufferCreationPool (org.webpieces.data.api.BufferCreationPool)1 DataWrapper (org.webpieces.data.api.DataWrapper)1 DataWrapperGenerator (org.webpieces.data.api.DataWrapperGenerator)1 HttpParser (org.webpieces.httpparser.api.HttpParser)1 MarshalState (org.webpieces.httpparser.api.MarshalState)1