Package org.jbpm.formbuilder.shared.form

Examples of org.jbpm.formbuilder.shared.form.FormDefinitionService


    }
   
    //test happy path for RESTFormService.getFormItems(...)
    public void testGetFormItemsOK() throws Exception {
        RESTFormService restService = new RESTFormService();
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        Map<String, FormItemRepresentation> map = mockGetFormItems();
        EasyMock.expect(formService.getFormItems(EasyMock.eq("somePackage"))).andReturn(map).once();
        ServletContext context = EasyMock.createMock(ServletContext.class);
        restService.setFormService(formService);
       
        EasyMock.replay(formService, context);
        Response resp = restService.getFormItems("somePackage", context);
View Full Code Here


    }
   
    //test response to a FormServiceException for RESTFormService.getFormItems(...)
    public void testGetFormItemsServiceProblem() throws Exception {
        RESTFormService restService = new RESTFormService();
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        FormServiceException exception = new FormServiceException("Something going wrong");
        EasyMock.expect(formService.getFormItems(EasyMock.eq("somePackage"))).andThrow(exception).once();
        ServletContext context = EasyMock.createMock(ServletContext.class);
        restService.setFormService(formService);
       
        EasyMock.replay(formService, context);
        Response resp = restService.getFormItems("somePackage", context);
View Full Code Here

    public void testGetFormItemsEncodingProblem() throws Exception {
        RESTFormService restService = new RESTFormService();
        FormRepresentationEncoder encoder = EasyMock.createMock(FormRepresentationEncoder.class);
        FormEncodingException exception = new FormEncodingException("Something going wrong");
        EasyMock.expect(encoder.encode(EasyMock.notNull(FormItemRepresentation.class))).andThrow(exception).anyTimes();
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        Map<String, FormItemRepresentation> map = mockGetFormItems();
        EasyMock.expect(formService.getFormItems(EasyMock.eq("somePackage"))).andReturn(map).once();
        ServletContext context = EasyMock.createMock(ServletContext.class);
        restService.setFormService(formService);
        FormEncodingFactory.register(encoder, FormEncodingServerFactory.getDecoder());
       
        EasyMock.replay(formService, context, encoder);
View Full Code Here

    }

    //test happy path for RESTFormService.getFormItem(...)
    public void testGetFormItemOK() throws Exception {
        RESTFormService restService = new RESTFormService();
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        FormItemRepresentation item = createMockForm("myForm", "param1").getFormItems().iterator().next();
        EasyMock.expect(formService.getFormItem(EasyMock.eq("somePackage"), EasyMock.eq("MY_FORM_ITEM_ID"))).andReturn(item).once();
        restService.setFormService(formService);
        ServletContext context = EasyMock.createMock(ServletContext.class);
       
        EasyMock.replay(formService, context);
        Response resp = restService.getFormItem("somePackage", "MY_FORM_ITEM_ID", context);
View Full Code Here

    }

    //test response to FormServiceException for RESTFormService.getFormItem(...)
    public void testGetFormItemServiceProblem() throws Exception {
        RESTFormService restService = new RESTFormService();
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        FormServiceException exception = new FormServiceException("Something going wrong");
        EasyMock.expect(formService.getFormItem(EasyMock.eq("somePackage"), EasyMock.eq("MY_FORM_ITEM_ID"))).andThrow(exception).once();
        restService.setFormService(formService);
        ServletContext context = EasyMock.createMock(ServletContext.class);
       
        EasyMock.replay(formService, context);
        Response resp = restService.getFormItem("somePackage", "MY_FORM_ITEM_ID", context);
View Full Code Here

    public void testGetFormItemEncodingProblem() throws Exception {
        RESTFormService restService = new RESTFormService();
        FormRepresentationEncoder encoder = EasyMock.createMock(FormRepresentationEncoder.class);
        FormEncodingException exception = new FormEncodingException("Something going wrong");
        EasyMock.expect(encoder.encode(EasyMock.notNull(FormItemRepresentation.class))).andThrow(exception).anyTimes();
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        FormItemRepresentation item = createMockForm("myForm", "param1").getFormItems().iterator().next();
        EasyMock.expect(formService.getFormItem(EasyMock.eq("somePackage"), EasyMock.eq("MY_ITEM_ID"))).andReturn(item).once();
        ServletContext context = EasyMock.createMock(ServletContext.class);
        restService.setFormService(formService);
        FormEncodingFactory.register(encoder, FormEncodingServerFactory.getDecoder());
       
        EasyMock.replay(formService, context, encoder);
View Full Code Here

    }

    //test happy path for RESTFormService.saveFormItem(...)
    public void testSaveFormItemOK() throws Exception {
        RESTFormService restService = new RESTFormService();
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        FormItemRepresentation item = RESTAbstractTest.createMockForm("formToBeSaved", "param1").getFormItems().iterator().next();
        EasyMock.expect(formService.saveFormItem(EasyMock.eq("somePackage"), EasyMock.eq("MY_FORM_ITEM_ID"), EasyMock.eq(item))).
            andReturn("MY_FORM_ITEM_ID").once();
        restService.setFormService(formService);
        ServletContext context = EasyMock.createMock(ServletContext.class);
        HttpSession session = EasyMock.createMock(HttpSession.class);
        HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
View Full Code Here

    }
   
    //test response to a FormServiceException for RESTFormService.saveFormItem(...)
    public void testSaveFormItemServiceProblem() throws Exception {
        RESTFormService restService = new RESTFormService();
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        FormItemRepresentation item = RESTAbstractTest.createMockForm("formToBeSaved", "param1").getFormItems().iterator().next();
        FormServiceException exception = new FormServiceException("Something going wrong");
        EasyMock.expect(formService.saveFormItem(EasyMock.eq("somePackage"), EasyMock.eq("MY_FORM_ITEM_ID"), EasyMock.eq(item))).andThrow(exception).once();
        restService.setFormService(formService);
        ServletContext context = EasyMock.createMock(ServletContext.class);
        HttpSession session = EasyMock.createMock(HttpSession.class);
        HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
        EasyMock.expect(request.getSession()).andReturn(session);
View Full Code Here

    //test response to a FormEncodingException for RESTFormService.saveFormItem(...)
    public void testSaveFormItemEncodingProblem() throws Exception {
        RESTFormService restService = new RESTFormService();
        FormRepresentationDecoder decoder = EasyMock.createMock(FormRepresentationDecoder.class);
        FormEncodingFactory.register(FormEncodingServerFactory.getEncoder(), decoder);
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        FormItemRepresentation item = RESTAbstractTest.createMockForm("formToBeSaved", "param1").getFormItems().iterator().next();
        FormEncodingException exception = new FormEncodingException("Something going wrong");
        EasyMock.expect(decoder.decodeItem(EasyMock.anyObject(String.class))).andThrow(exception).once();
        restService.setFormService(formService);
        ServletContext context = EasyMock.createMock(ServletContext.class);
View Full Code Here

    }
   
    //test happy path for RESTFormService.deleteForm(...)
    public void testDeleteFormItemOK() throws Exception {
        RESTFormService restService = new RESTFormService();
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        formService.deleteForm(EasyMock.eq("somePackage"), EasyMock.eq("MY_FORM_ID"));
        EasyMock.expectLastCall().once();
        ServletContext context = EasyMock.createMock(ServletContext.class);
        restService.setFormService(formService);
        HttpSession session = EasyMock.createMock(HttpSession.class);
        HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
View Full Code Here

TOP

Related Classes of org.jbpm.formbuilder.shared.form.FormDefinitionService

Copyright © 2018 www.massapicom. 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.