Package org.jbpm.formbuilder.shared.form

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


    }
   
    //test response to a FormEncodingException for RESTFormService.getForms(...)
    public void testGetFormsEncodingProblem() throws Exception {
        RESTFormService restService = new RESTFormService();
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        ServletContext context = EasyMock.createMock(ServletContext.class);
       
        FormEncodingException exception = new FormEncodingException("Something going wrong");
       
        FormRepresentationEncoder encoder = EasyMock.createMock(FormRepresentationEncoder.class);
        EasyMock.expect(encoder.encode(EasyMock.anyObject(FormRepresentation.class))).andThrow(exception).once();
       
        FormEncodingFactory.register(encoder, FormEncodingServerFactory.getDecoder());
       
        List<FormRepresentation> forms = new ArrayList<FormRepresentation>();
        forms.add(createMockForm("form1", "param1", "param2", "param3"));
        forms.add(createMockForm("form2", "paramA", "paramB", "paramC"));
       
        EasyMock.expect(formService.getForms(EasyMock.same("somePackage"))).andReturn(forms).once();
        restService.setFormService(formService);
       
        EasyMock.replay(formService, context, encoder);
        Response resp = restService.getForms("somePackage", context);
        EasyMock.verify(formService, context, encoder);
View Full Code Here


    //test happy path for RESTFormService.getForm(...)
    public void testGetFormOK() throws Exception {
        RESTFormService restService = new RESTFormService();
       
        FormRepresentation form = createMockForm("myForm", "myParam1", "myParam2", "myParam3");
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        ServletContext context = EasyMock.createMock(ServletContext.class);
        EasyMock.expect(formService.getForm(EasyMock.same("somePackage"), EasyMock.same("myFormId"))).andReturn(form);
        restService.setFormService(formService);
       
        EasyMock.replay(formService, context);
        Response resp = restService.getForm("somePackage", "myFormId", context);
        EasyMock.verify(formService, context);
View Full Code Here

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

    }
   
    //test response to a FormEncodingException for RESTFormService.getForm(...)
    public void testGetFormEncodingProblem() throws Exception {
        RESTFormService restService = new RESTFormService();
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        ServletContext context = EasyMock.createMock(ServletContext.class);
       
        FormEncodingException exception = new FormEncodingException("Something going wrong");
       
        FormRepresentationEncoder encoder = EasyMock.createMock(FormRepresentationEncoder.class);
        EasyMock.expect(encoder.encode(EasyMock.anyObject(FormRepresentation.class))).andThrow(exception).once();
       
        FormEncodingFactory.register(encoder, FormEncodingServerFactory.getDecoder());
       
        FormRepresentation form = createMockForm("form1", "param1", "param2", "param3");
       
        EasyMock.expect(formService.getForm(EasyMock.same("somePackage"), EasyMock.same("myFormId"))).andReturn(form).once();
        restService.setFormService(formService);
       
        EasyMock.replay(formService, context, encoder);
        Response resp = restService.getForm("somePackage", "myFormId", context);
        EasyMock.verify(formService, context, encoder);
View Full Code Here

    //test happy path for RESTFormService.saveForm(...)
    public void testSaveFormOK() throws Exception {
        FormEncodingFactory.register(FormEncodingServerFactory.getEncoder(), FormEncodingServerFactory.getDecoder());
        RESTFormService restService = new RESTFormService();
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        FormRepresentation form = RESTAbstractTest.createMockForm("formToBeSaved", "param1", "param2", "param3");
        EasyMock.expect(formService.saveForm(EasyMock.eq("somePackage"), EasyMock.eq(form))).andReturn("MY_FORM_ID").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 FormServiceException for RESTFormService.saveForm(...)
    public void testSaveFormServiceProblem() throws Exception {
        FormEncodingFactory.register(FormEncodingServerFactory.getEncoder(), FormEncodingServerFactory.getDecoder());
        RESTFormService restService = new RESTFormService();
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        FormRepresentation form = RESTAbstractTest.createMockForm("formToBeSaved", "param1", "param2", "param3");
        FormServiceException exception = new FormServiceException("Something going wrong");
        EasyMock.expect(formService.saveForm(EasyMock.eq("somePackage"), EasyMock.eq(form))).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

public class FormDefinitionServiceTest extends TestCase {

    public void testTemplateFormFromTask() throws Exception {
        TaskRef task = new TaskRef();
        task.setTaskId("MyTask");
        FormDefinitionService formService = new MockFormDefinitionService();
        FormRepresentation form = formService.createFormFromTask(task);
        assertNotNull("form shouldn't be null", form);
        assertTrue("form should contain two items", form.getFormItems().size() == 2);
    }
View Full Code Here

    //test response to a FormEncodingException for RESTFormService.saveForm(...)
    public void testSaveFormEncodingProblem() throws Exception {
        RESTFormService restService = new RESTFormService();
        FormRepresentationDecoder decoder = EasyMock.createMock(FormRepresentationDecoder.class);
        FormEncodingFactory.register(FormEncodingServerFactory.getEncoder(), decoder);
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        FormRepresentation form = RESTAbstractTest.createMockForm("formToBeSaved", "param1", "param2", "param3");
        FormEncodingException exception = new FormEncodingException("Something going wrong");
        EasyMock.expect(decoder.decode(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 testDeleteFormOK() throws Exception {
        RESTFormService restService = new RESTFormService();
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        formService.deleteForm(EasyMock.eq("somePackage"), EasyMock.eq("myFormId"));
        EasyMock.expectLastCall().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.deleteForm(...)
    public void testDeleteFormServiceProblem() throws Exception {
        RESTFormService restService = new RESTFormService();
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        formService.deleteForm(EasyMock.eq("somePackage"), EasyMock.eq("myFormId"));
        FormServiceException exception = new FormServiceException("Something going wrong");
        EasyMock.expectLastCall().andThrow(exception).once();
        restService.setFormService(formService);
        ServletContext context = EasyMock.createMock(ServletContext.class);
        HttpSession session = EasyMock.createMock(HttpSession.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.