use of com.developmentontheedge.be5.model.Action in project be5 by DevelopmentOnTheEdge.
the class MenuTest method testGenerateSimpleMenu.
@Test
public void testGenerateSimpleMenu() {
initUserWithRoles("User");
Menu menu = (Menu) component;
Menu.MenuResponse menuResponse = menu.generateSimpleMenu(injector, EntityType.TABLE);
assertEquals("testtable", menuResponse.root.get(1).getTitle());
assertEquals(new Action("call", "table/testtable/All records"), menuResponse.root.get(1).getAction());
assertNull(menuResponse.root.get(1).getChildren());
}
use of com.developmentontheedge.be5.model.Action in project be5 by DevelopmentOnTheEdge.
the class MenuTest method testGenerateSimpleMenuAdmin.
@Test
public void testGenerateSimpleMenuAdmin() {
initUserWithRoles(RoleType.ROLE_ADMINISTRATOR, RoleType.ROLE_SYSTEM_DEVELOPER);
Menu menu = (Menu) component;
Menu.MenuResponse menuResponse = menu.generateSimpleMenu(injector, EntityType.TABLE);
assertEquals("Добавить", menuResponse.root.get(1).getOperations().get(0).title);
assertEquals(new Action("call", "form/dateTime/All records/Insert"), menuResponse.root.get(1).getOperations().get(0).action);
initUserWithRoles(RoleType.ROLE_GUEST);
}
use of com.developmentontheedge.be5.model.Action 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")));
}
use of com.developmentontheedge.be5.model.Action 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);
}
use of com.developmentontheedge.be5.model.Action in project be5 by DevelopmentOnTheEdge.
the class ResponseTest method sendAsRawJson.
// @Test
// public void sendErrorsAsJson() throws Exception {
// Action call = new Action("call", "test/path");
// response.sendErrorsAsJson(call);
//
// verify(writer).append(doubleQuotes("{'value':{'arg':'test/path','name':'call'}}"));
// verify(writer).flush();
// }
@Test
public void sendAsRawJson() {
Action call = new Action("call", "test/path");
response.sendAsRawJson(call);
verify(writer).append(doubleQuotes("{'arg':'test/path','name':'call'}"));
}
Aggregations