Search in sources :

Example 1 with Response

use of com.developmentontheedge.be5.api.Response in project be5 by DevelopmentOnTheEdge.

the class DocumentTest method generate.

@Test
public void generate() {
    Response response = mock(Response.class);
    component.generate(getSpyMockRequest("", ImmutableMap.of(RestApiConstants.ENTITY, "testtable", RestApiConstants.TIMESTAMP_PARAM, "" + new Date().getTime(), RestApiConstants.QUERY, "All records")), response, injector);
    verify(response).sendAsJson(any(JsonApiModel.class));
}
Also used : Response(com.developmentontheedge.be5.api.Response) JsonApiModel(com.developmentontheedge.be5.model.jsonapi.JsonApiModel) Date(java.util.Date) Test(org.junit.Test) SqlMockOperationTest(com.developmentontheedge.be5.test.SqlMockOperationTest)

Example 2 with Response

use of com.developmentontheedge.be5.api.Response in project be5 by DevelopmentOnTheEdge.

the class DownloadComponentTest method test.

@Test
@Ignore
public void test() {
    Response response = mock(Response.class);
    Request req = getSpyMockRequest("", ImmutableMap.<String, String>builder().put("_t_", "attachments").put("_typeColumn_", "mimeType").put("_charsetColumn_", "mimeCharset").put("_filenameColumn_", "name").put("_dataColumn_", "data").put("_download_", "no").put("ID", "7326").build());
    component.generate(req, response, injector);
}
Also used : Response(com.developmentontheedge.be5.api.Response) Request(com.developmentontheedge.be5.api.Request) Ignore(org.junit.Ignore) Test(org.junit.Test) Be5ProjectTest(com.developmentontheedge.be5.test.Be5ProjectTest)

Example 3 with Response

use of com.developmentontheedge.be5.api.Response in project be5 by DevelopmentOnTheEdge.

the class MenuTest method test.

@Test
public void test() {
    Response response = mock(Response.class);
    component.generate(getMockRequest(""), response, injector);
    verify(response).sendAsRawJson(isA(Menu.MenuResponse.class));
}
Also used : Response(com.developmentontheedge.be5.api.Response) Test(org.junit.Test) Be5ProjectTest(com.developmentontheedge.be5.test.Be5ProjectTest)

Example 4 with Response

use of com.developmentontheedge.be5.api.Response in project be5 by DevelopmentOnTheEdge.

the class MenuTest method testDefaultAction.

@Test
public void testDefaultAction() {
    Response response = mock(Response.class);
    component.generate(getMockRequest("defaultAction"), response, injector);
    verify(response).sendAsRawJson(eq(new Action("call", "table/testtable/All records")));
}
Also used : Response(com.developmentontheedge.be5.api.Response) Action(com.developmentontheedge.be5.model.Action) Test(org.junit.Test) Be5ProjectTest(com.developmentontheedge.be5.test.Be5ProjectTest)

Example 5 with Response

use of com.developmentontheedge.be5.api.Response in project be5 by DevelopmentOnTheEdge.

the class MenuTest method testDefaultActionUser.

@Test
public void testDefaultActionUser() {
    initUserWithRoles("User");
    Response response = mock(Response.class);
    component.generate(getMockRequest("defaultAction"), response, injector);
    verify(response).sendAsRawJson(eq(new Action("call", "table/testtUser/testtUser")));
    initUserWithRoles(RoleType.ROLE_GUEST);
}
Also used : Response(com.developmentontheedge.be5.api.Response) Action(com.developmentontheedge.be5.model.Action) Test(org.junit.Test) Be5ProjectTest(com.developmentontheedge.be5.test.Be5ProjectTest)

Aggregations

Response (com.developmentontheedge.be5.api.Response)23 Test (org.junit.Test)22 Be5ProjectTest (com.developmentontheedge.be5.test.Be5ProjectTest)20 Request (com.developmentontheedge.be5.api.Request)6 Be5Exception (com.developmentontheedge.be5.api.exceptions.Be5Exception)5 ErrorModel (com.developmentontheedge.be5.model.jsonapi.ErrorModel)5 ResourceData (com.developmentontheedge.be5.model.jsonapi.ResourceData)5 HttpServletResponse (javax.servlet.http.HttpServletResponse)5 Action (com.developmentontheedge.be5.model.Action)4 JsonApiModel (com.developmentontheedge.be5.model.jsonapi.JsonApiModel)3 Map (java.util.Map)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)3 UserAwareMeta (com.developmentontheedge.be5.api.helpers.UserAwareMeta)2 UserHelper (com.developmentontheedge.be5.api.helpers.UserHelper)2 ResponseImpl (com.developmentontheedge.be5.api.impl.ResponseImpl)2 DocumentGenerator (com.developmentontheedge.be5.query.DocumentGenerator)2 SqlMockOperationTest (com.developmentontheedge.be5.test.SqlMockOperationTest)2 HashUrl (com.developmentontheedge.be5.util.HashUrl)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 Date (java.util.Date)2