Examples of MenuService


Examples of org.jbpm.formbuilder.shared.menu.MenuService

public class RESTMenuServiceTest extends RESTAbstractTest {

    //test happy path for RESTMenuService.listMenuItems()
    public void testListMenuItemsOK() throws Exception {
        RESTMenuService restService = new RESTMenuService();
        MenuService menuService = EasyMock.createMock(MenuService.class);
        Map<String, List<MenuItemDescription>> retval = new HashMap<String, List<MenuItemDescription>>();
        List<MenuItemDescription> menuList = new ArrayList<MenuItemDescription>();
        MenuItemDescription menuItem1 = new MenuItemDescription();
        List<String> allowedEvents = new ArrayList<String>();
        allowedEvents.add("onclick");
        allowedEvents.add("onblur");
        allowedEvents.add("onfocus");
        List<FormEffectDescription> effects = new ArrayList<FormEffectDescription>();
        FormEffectDescription effect1 = new FormEffectDescription();
        effect1.setClassName("org.jbpm.formbuilder.client.effect.ResizeEffect");
        effects.add(effect1);
        FormEffectDescription effect2 = new FormEffectDescription();
        effect2.setClassName("org.jbpm.formbuilder.client.effect.RemoveEffect");
        effects.add(effect2);
        menuItem1.setAllowedEvents(allowedEvents);
        menuItem1.setClassName("org.jbpm.formbuilder.client.menu.items.ClientScriptMenuItem");
        menuItem1.setEffects(effects);
        MenuItemDescription menuItem2 = new MenuItemDescription();
        menuItem2.setClassName("org.jbpm.formbuilder.client.menu.items.TableLayoutMenuItem");
        menuItem2.setAllowedEvents(allowedEvents);
        menuList.add(menuItem1);
        menuList.add(menuItem2);
        retval.put("group", menuList);
        EasyMock.expect(menuService.listMenuItems()).andReturn(retval).once();
        restService.setMenuService(menuService);
       
        EasyMock.replay(menuService);
        Response resp = restService.listMenuItems();
        EasyMock.verify(menuService);
View Full Code Here

Examples of org.jbpm.formbuilder.shared.menu.MenuService

    }
   
    //test response to a MenuServiceException on RESTMenuService.listMenuItems()
    public void testListMenuItemsServiceProblem() throws Exception {
        RESTMenuService restService = new RESTMenuService();
        MenuService menuService = EasyMock.createMock(MenuService.class);
        MenuServiceException exception = new MenuServiceException("Something going wrong");
        EasyMock.expect(menuService.listMenuItems()).andThrow(exception).once();
        restService.setMenuService(menuService);
       
        EasyMock.replay(menuService);
        Response resp = restService.listMenuItems();
        EasyMock.verify(menuService);
View Full Code Here

Examples of org.jbpm.formbuilder.shared.menu.MenuService

    }
   
    //test happy path for RESTMenuService.listMenuOptions()
    public void testListMenuOptionsOK() throws Exception {
        RESTMenuService restService = new RESTMenuService();
        MenuService menuService = EasyMock.createMock(MenuService.class);
        List<MenuOptionDescription> retval = new ArrayList<MenuOptionDescription>();
        MenuOptionDescription option1 = new MenuOptionDescription();
        option1.setCommandClass("aaa");
        option1.setHtml("bbb");
        MenuOptionDescription option2 = new MenuOptionDescription();
        List<MenuOptionDescription> subMenu = new ArrayList<MenuOptionDescription>();
        MenuOptionDescription option2_1 = new MenuOptionDescription();
        option2_1.setCommandClass("ccc");
        MenuOptionDescription option2_2 = new MenuOptionDescription();
        subMenu.add(option2_1);
        subMenu.add(option2_2);
        option2.setHtml("eee");
        option2.setSubMenu(subMenu);
        retval.add(option1);
        retval.add(option2);
        EasyMock.expect(menuService.listOptions()).andReturn(retval).once();
        restService.setMenuService(menuService);
       
        EasyMock.replay(menuService);
        Response resp = restService.listMenuOptions();
        EasyMock.verify(menuService);
View Full Code Here

Examples of org.jbpm.formbuilder.shared.menu.MenuService

    }
   
    //test response to a MenuServiceException on RESTMenuService.listMenuOptions()
    public void testListMenuOptionsServiceProblem() throws Exception {
        RESTMenuService restService = new RESTMenuService();
        MenuService menuService = EasyMock.createMock(MenuService.class);
        MenuServiceException exception = new MenuServiceException("Something going wrong");
        EasyMock.expect(menuService.listOptions()).andThrow(exception).once();
        restService.setMenuService(menuService);
       
        EasyMock.replay(menuService);
        Response resp = restService.listMenuOptions();
        EasyMock.verify(menuService);
View Full Code Here

Examples of org.jbpm.formbuilder.shared.menu.MenuService

    }
   
    //test happy path for RESTMenuService.getValidations()
    public void testGetValidationsOK() throws Exception {
        RESTMenuService restService = new RESTMenuService();
        MenuService menuService = EasyMock.createMock(MenuService.class);
        List<ValidationDescription> retval = new ArrayList<ValidationDescription>();
        ValidationDescription validation1 = new ValidationDescription();
        validation1.setClassName("aaa");
        validation1.setProperties(new HashMap<String, String>());
        ValidationDescription validation2 = new ValidationDescription();
        validation2.setClassName("bbb");
        Map<String, String> properties = new HashMap<String, String>();
        properties.put("ccc", "CCC");
        properties.put("ddd", "DDD");
        validation2.setProperties(properties);
        retval.add(validation1);
        retval.add(validation2);
        EasyMock.expect(menuService.listValidations()).andReturn(retval).once();
        restService.setMenuService(menuService);
       
        EasyMock.replay(menuService);
        Response resp = restService.getValidations();
        EasyMock.verify(menuService);
View Full Code Here

Examples of org.jbpm.formbuilder.shared.menu.MenuService

        assertEquals("validations should have " + retval.size() + " elements but has " + validations.size(), validations.size(), retval.size());
    }
   
    public void testGetValidationsServiceProblem() throws Exception {
        RESTMenuService restService = new RESTMenuService();
        MenuService menuService = EasyMock.createMock(MenuService.class);
        MenuServiceException exception = new MenuServiceException("Something going wrong");
        EasyMock.expect(menuService.listValidations()).andThrow(exception).once();
        restService.setMenuService(menuService);
       
        EasyMock.replay(menuService);
        Response resp = restService.getValidations();
        EasyMock.verify(menuService);
View Full Code Here

Examples of org.jbpm.formbuilder.shared.menu.MenuService

    }
   
    //test happy path for RESTMenuService.saveMenuItem(...)
    public void testSaveMenuItemOK() throws Exception {
        RESTMenuService restService = new RESTMenuService();
        MenuService menuService = EasyMock.createMock(MenuService.class);
        HttpServletRequest mockRequest = EasyMock.createMock(HttpServletRequest.class);
        EasyMock.expect(mockRequest.isUserInRole(EasyMock.anyObject(String.class))).andReturn(true).times(3);
        menuService.saveMenuItem(EasyMock.same("groupName"), EasyMock.anyObject(MenuItemDescription.class));
        EasyMock.expectLastCall().once();
        restService.setMenuService(menuService);
        SaveMenuItemDTO dto = new SaveMenuItemDTO();
        List<String> allowedEvents = new ArrayList<String>();
        allowedEvents.add("onclick");
View Full Code Here

Examples of org.jbpm.formbuilder.shared.menu.MenuService

    }
   
    //test response to a MenuServiceException for RESTMenuService.saveMenuItem(...)
    public void testSaveMenuItemServiceProblem() throws Exception {
        RESTMenuService restService = new RESTMenuService();
        MenuService menuService = EasyMock.createMock(MenuService.class);
        HttpServletRequest mockRequest = EasyMock.createMock(HttpServletRequest.class);
        EasyMock.expect(mockRequest.isUserInRole(EasyMock.anyObject(String.class))).andReturn(true).times(3);
        menuService.saveMenuItem(EasyMock.same("groupName"), EasyMock.anyObject(MenuItemDescription.class));
        MenuServiceException exception = new MenuServiceException("Something went wrong");
        EasyMock.expectLastCall().andThrow(exception).once();
        restService.setMenuService(menuService);
        SaveMenuItemDTO dto = new SaveMenuItemDTO();
        List<String> allowedEvents = new ArrayList<String>();
View Full Code Here

Examples of org.jbpm.formbuilder.shared.menu.MenuService

    }
   
    //test happy path for RESTMenuService.deleteMenuItem(...)
    public void testDeleteMenuItemOK() throws Exception {
        RESTMenuService restService = new RESTMenuService();
        MenuService menuService = EasyMock.createMock(MenuService.class);
        HttpServletRequest mockRequest = EasyMock.createMock(HttpServletRequest.class);
        EasyMock.expect(mockRequest.isUserInRole(EasyMock.anyObject(String.class))).andReturn(true).times(3);
        menuService.deleteMenuItem(EasyMock.same("groupName"), EasyMock.anyObject(MenuItemDescription.class));
        EasyMock.expectLastCall().once();
        Map<String, List<MenuItemDescription>> initialMenuItems = new HashMap<String, List<MenuItemDescription>>();
        List<MenuItemDescription> descriptions = new ArrayList<MenuItemDescription>();
        MenuItemDescription description = new MenuItemDescription();
        description.setName("myItem");
        descriptions.add(description);
        initialMenuItems.put("groupName", descriptions);
        EasyMock.expect(menuService.listMenuItems()).andReturn(initialMenuItems).once();
        restService.setMenuService(menuService);
        SaveMenuItemDTO dto = new SaveMenuItemDTO();
        List<String> allowedEvents = new ArrayList<String>();
        allowedEvents.add("onclick");
        allowedEvents.add("onfocus");
View Full Code Here

Examples of org.jbpm.formbuilder.shared.menu.MenuService

    }
   
    //test response for not finding the specified item at RESTMenuService.deleteMenuItem(...)
    public void testDeleteMenuItemEmptyGroup() throws Exception {
        RESTMenuService restService = new RESTMenuService();
        MenuService menuService = EasyMock.createMock(MenuService.class);
        HttpServletRequest mockRequest = EasyMock.createMock(HttpServletRequest.class);
        EasyMock.expect(mockRequest.isUserInRole(EasyMock.anyObject(String.class))).andReturn(true).times(3);
        EasyMock.expect(menuService.listMenuItems()).andReturn(new HashMap<String, List<MenuItemDescription>>()).once();
        restService.setMenuService(menuService);
        SaveMenuItemDTO dto = new SaveMenuItemDTO();
        List<String> allowedEvents = new ArrayList<String>();
        allowedEvents.add("onclick");
        allowedEvents.add("onfocus");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.