use of org.webpieces.httpclient11.api.HttpFullResponse in project webpieces by deanhiller.
the class TestSyncHibernate method testRollback.
@Test
public void testRollback() {
HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, "/fail");
mock.addException(() -> {
throw new RuntimeException("for test");
});
XFuture<HttpFullResponse> respFuture = http11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_500_INTERNAL_SVR_ERROR);
Assert.assertEquals(2, TransactionFilter.getState());
}
use of org.webpieces.httpclient11.api.HttpFullResponse in project webpieces by deanhiller.
the class TestSyncHibernate method testRenderEditPage.
@Test
public void testRenderEditPage() {
int id = loadDataInDb().getId();
HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, "/user/edit/" + id);
XFuture<HttpFullResponse> respFuture = http11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContains("name='SomeName' email='dean2@sync.xsoftware.biz'");
}
use of org.webpieces.httpclient11.api.HttpFullResponse in project webpieces by deanhiller.
the class TestSyncHibernate method saveBean.
private String saveBean(String path) {
HttpFullRequest req = Requests.createRequest(KnownHttpMethod.POST, path);
XFuture<HttpFullResponse> respFuture = http11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_303_SEEOTHER);
return response.getRedirectUrl();
}
use of org.webpieces.httpclient11.api.HttpFullResponse in project webpieces by deanhiller.
the class TestSyncHibernate method readBean.
private void readBean(String redirectUrl, String email) {
HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, redirectUrl);
XFuture<HttpFullResponse> respFuture = http11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContains("name=SomeName email=" + email);
}
use of org.webpieces.httpclient11.api.HttpFullResponse in project webpieces by deanhiller.
the class TestSyncHibernate method testReverseAddAndEditFromRouteId.
@Test
public void testReverseAddAndEditFromRouteId() {
loadDataInDb();
HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, "/user/list");
XFuture<HttpFullResponse> respFuture = http11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContains("<a href=`/user/new`>Add User</a>".replace("`", "\""));
response.assertContains("<a href=`/user/edit/1`>Edit</a>".replace("`", "\""));
}
Aggregations