Package org.jbpm.formapi.shared.form

Examples of org.jbpm.formapi.shared.form.FormRepresentationDecoder


        responses.put("GET " + helper.getApiSearchUrl("somePackage") + "form2AutoForm.formdef", jsonForm);
        EasyMock.expect(client.executeMethod(EasyMock.anyObject(MockGetMethod.class))).
            andAnswer(new MockAnswer(responses, new IllegalArgumentException("unexpected call"))).anyTimes();
        GuvnorFormDefinitionService service = createService(baseUrl, "", "");
        service.getHelper().setClient(client);
        FormRepresentationDecoder decoder = EasyMock.createMock(FormRepresentationDecoder.class);
        EasyMock.expect(decoder.decode(EasyMock.eq(jsonForm))).andThrow(new FormEncodingException("Something going wrong")).once();
        FormEncodingFactory.register(FormEncodingServerFactory.getEncoder(), decoder);
       
        EasyMock.replay(client, decoder);
        try {
            service.saveForm("somePackage", form);
View Full Code Here


        responses.put("GET " + helper.getApiSearchUrl("somePackage") + "form2AutoForm.formdef", jsonForm);
        EasyMock.expect(client.executeMethod(EasyMock.anyObject(MockGetMethod.class))).
            andAnswer(new MockAnswer(responses, new IllegalArgumentException("unexpected call"))).anyTimes();
        GuvnorFormDefinitionService service = createService(baseUrl, "", "");
        service.getHelper().setClient(client);
        FormRepresentationDecoder decoder = EasyMock.createMock(FormRepresentationDecoder.class);
        EasyMock.expect(decoder.decode(EasyMock.eq(jsonForm))).andThrow(new FormEncodingException("Something going wrong")).once();
        FormEncodingFactory.register(FormEncodingServerFactory.getEncoder(), decoder);
       
        EasyMock.replay(client, decoder);
        try {
            service.getForm("somePackage", "form2AutoForm");
View Full Code Here

        responses1.put("GET " + helper.getRestBaseUrl() + "somePackage/asset1/source", jsonForm);
        EasyMock.expect(client.executeMethod(EasyMock.isA(MockGetMethod.class))).
            andAnswer(new MockAnswer(responses1, new IllegalArgumentException("unexpected call"))).times(3);
        EasyMock.expect(client);
        service.getHelper().setClient(client);
        FormRepresentationDecoder decoder = EasyMock.createMock(FormRepresentationDecoder.class);
        FormEncodingException exception = new FormEncodingException("Something going wrong");
        EasyMock.expect(decoder.decode(EasyMock.isA(String.class))).andThrow(exception).once();
        FormEncodingFactory.register(FormEncodingFactory.getEncoder(), decoder);
       
        EasyMock.replay(client, decoder);
        try {
            service.getFormByUUID("somePackage", uuid);
View Full Code Here

        FormRepresentation form = RESTAbstractTest.createMockForm("myForm", "myParam");
        String jsonForm = FormEncodingServerFactory.getEncoder().encode(form);
        responses.put("GET " + helper.getApiSearchUrl("somePackage") + "myForm.formdef", jsonForm);
        EasyMock.expect(client.executeMethod(EasyMock.isA(MockGetMethod.class))).
            andAnswer(new MockAnswer(responses, new IllegalArgumentException("unexpected call"))).once();
        FormRepresentationDecoder decoder = EasyMock.createMock(FormRepresentationDecoder.class);
        FormEncodingException exception = new FormEncodingException("Something going wrong");
        EasyMock.expect(decoder.decode(EasyMock.isA(String.class))).andThrow(exception).once();
        FormEncodingFactory.register(FormEncodingFactory.getEncoder(), decoder);
       
        EasyMock.replay(client, decoder);
        try {
            service.getForm("somePackage", "myForm");
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);
        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);
        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.getFormPreview(...)
    public void testGetFormPreviewEncodingProblem() throws Exception {
        final ServletContext context = EasyMock.createMock(ServletContext.class);
        final HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
        FormRepresentationDecoder decoder = EasyMock.createMock(FormRepresentationDecoder.class);
        RESTFormService restService = new RESTFormService();
        restService.setFormService(new MockFormDefinitionService());
        FormEncodingFactory.register(FormEncodingFactory.getEncoder(), decoder);
       
        FormPreviewDTO dto = new FormPreviewDTO();
        FormRepresentation form = createMockForm("myForm", "key1", "key2");
        String jsonBody = FormEncodingFactory.getEncoder().encode(form);
        dto.setRepresentation(jsonBody);
       
        FormEncodingException exception = new FormEncodingException("Something going wrong");
        EasyMock.expect(decoder.decode(EasyMock.eq(jsonBody))).andThrow(exception).once();
       
        EasyMock.replay(context, request);
        Response resp = restService.getFormPreview(dto, "lang", context, request);
        EasyMock.verify(context, request);
       
View Full Code Here

    //test response to a FormEncodingException for RESTFormService.getFormTemplate(...)
    public void testGetFormTemplateEncodingProblem() throws Exception {
        ServletContext context = EasyMock.createMock(ServletContext.class);
        RESTFormService restService = new RESTFormService();
        restService.setFormService(new MockFormDefinitionService());
        FormRepresentationDecoder decoder = EasyMock.createMock(FormRepresentationDecoder.class);
        FormEncodingFactory.register(FormEncodingFactory.getEncoder(), decoder);
        FormRepresentation form = createMockForm("myForm", "key1", "key2");
        FormPreviewDTO dto = createFormPreviewDTO(form);
       
        FormEncodingException exception = new FormEncodingException("Something going wrong");
        EasyMock.expect(decoder.decode(EasyMock.eq(dto.getRepresentation()))).andThrow(exception).once();
       
        EasyMock.replay(decoder, context);
        Response resp = restService.getFormTemplate(dto, "lang", context);
        EasyMock.verify(decoder, context);
       
View Full Code Here

TOP

Related Classes of org.jbpm.formapi.shared.form.FormRepresentationDecoder

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.