use of org.webpieces.httpparser.api.dto.HttpRequest in project webpieces by deanhiller.
the class TestSyncHibernate method readBean.
private void readBean(String redirectUrl, String email) {
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, redirectUrl);
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContains("name=SomeName email=" + email);
}
use of org.webpieces.httpparser.api.dto.HttpRequest in project webpieces by deanhiller.
the class TestSyncHibernate method testReverseAddAndEditFromRouteId.
@Test
public void testReverseAddAndEditFromRouteId() {
loadDataInDb();
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/user/list");
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
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("`", "\""));
}
use of org.webpieces.httpparser.api.dto.HttpRequest in project webpieces by deanhiller.
the class TestSyncHibernate method testRenderEditPage.
@Test
public void testRenderEditPage() {
int id = loadDataInDb().getId();
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/user/edit/" + id);
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContains("name='SomeName' email='dean2@sync.xsoftware.biz'");
}
use of org.webpieces.httpparser.api.dto.HttpRequest in project webpieces by deanhiller.
the class TestSyncHibernate method testDbUseWhileRenderingPage.
/**
* Tests when we load user but not company, user.company.name will blow up since company was not
* loaded in the controller from the database.
*
* (ie. we only let you traverse the loaded graph so that we don't accidentally have 1+N queries running)
*/
@Test
public void testDbUseWhileRenderingPage() {
Integer id = loadDataInDb().getId();
verifyLazyLoad(id);
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/dynamic/" + id);
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_500_INTERNAL_SVR_ERROR);
}
use of org.webpieces.httpparser.api.dto.HttpRequest in project webpieces by deanhiller.
the class TestSyncHibernate method testRollback.
@Test
public void testRollback() {
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/fail");
mock.addException(() -> {
throw new RuntimeException("for test");
});
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_500_INTERNAL_SVR_ERROR);
Assert.assertEquals(2, TransactionFilter.getState());
}
Aggregations