Package org.jbpm.formbuilder.server.xml

Examples of org.jbpm.formbuilder.server.xml.FormPreviewDTO


            }
        };
    }

    private FormPreviewDTO createFormPreviewDTO(FormRepresentation form) throws Exception {
        FormPreviewDTO dto = new FormPreviewDTO();
        String jsonBody = FormEncodingFactory.getEncoder().encode(form);
        dto.setRepresentation(jsonBody);
        List<FormPreviewParameterDTO> inputs = new ArrayList<FormPreviewParameterDTO>();
        FormPreviewParameterDTO param1 = new FormPreviewParameterDTO();
        param1.setKey("key1");
        param1.setValue("value1");
        FormPreviewParameterDTO param2 = new FormPreviewParameterDTO();
        param2.setKey("key2");
        param2.setValue("value2");
        inputs.add(param1);
        inputs.add(param2);
        dto.setInput(inputs);
        return dto;
    }
View Full Code Here


        final HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
        RESTFormService restService = emulateRESTFormService(translator, null, renderer, null);
        restService.setFormService(new MockFormDefinitionService());
       
        FormRepresentation form = createMockForm("myForm", "key1", "key2");
        FormPreviewDTO dto = createFormPreviewDTO(form);
       
        URL url = new URL("http://www.redhat.com");
        EasyMock.expect(translator.translateForm(EasyMock.eq(form))).andReturn(url).once();
        String htmlResult = "<html><body><div>Hello</div></body></html>";
        @SuppressWarnings("unchecked")
View Full Code Here

        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);
View Full Code Here

        final ServletContext context = EasyMock.createMock(ServletContext.class);
        final HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
        RESTFormService restService = emulateRESTFormService(null, new TranslatorException("Not finding translator"), null, null);
        restService.setFormService(new MockFormDefinitionService());
       
        FormPreviewDTO dto = new FormPreviewDTO();
        FormRepresentation form = createMockForm("myForm", "key1", "key2");
        String jsonBody = FormEncodingFactory.getEncoder().encode(form);
        dto.setRepresentation(jsonBody);
       
        EasyMock.replay(context, request);
        Response resp = restService.getFormPreview(dto, "lang", context, request);
        EasyMock.verify(context, request);
       
View Full Code Here

        final ServletContext context = EasyMock.createMock(ServletContext.class);
        final HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
        RESTFormService restService = emulateRESTFormService(translator, null, null, new RendererException("not finding a renderer"));
        restService.setFormService(new MockFormDefinitionService());
       
        FormPreviewDTO dto = new FormPreviewDTO();
        FormRepresentation form = createMockForm("myForm", "key1", "key2");
        String jsonBody = FormEncodingFactory.getEncoder().encode(form);
        dto.setRepresentation(jsonBody);
       
        URL url = new URL("http://www.redhat.com");
        EasyMock.expect(translator.translateForm(EasyMock.eq(form))).andReturn(url).once();
        EasyMock.expect(context.getContextPath()).andReturn("/").anyTimes();
       
View Full Code Here

        final HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
        RESTFormService restService = emulateRESTFormService(translator, null, renderer, null);
        restService.setFormService(new MockFormDefinitionService());
       
        FormRepresentation form = createMockForm("myForm", "key1", "key2");
        FormPreviewDTO dto = createFormPreviewDTO(form);
       
        TranslatorException exception = new TranslatorException("Something going wrong");
        EasyMock.expect(translator.translateForm(EasyMock.eq(form))).andThrow(exception).once();
        EasyMock.expect(context.getContextPath()).andReturn("/").anyTimes();
       
View Full Code Here

        final HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
        RESTFormService restService = emulateRESTFormService(translator, null, renderer, null);
        restService.setFormService(new MockFormDefinitionService());
       
        FormRepresentation form = createMockForm("myForm", "key1", "key2");
        FormPreviewDTO dto = createFormPreviewDTO(form);
       
        EasyMock.expect(translator.translateForm(EasyMock.eq(form))).andReturn(new URL("http://www.redhat.com")).once();
        RendererException exception = new RendererException("Something going wrong");
        @SuppressWarnings("unchecked")
        Map<String, Object> anyObject = EasyMock.anyObject(Map.class);
View Full Code Here

        ServletContext context = EasyMock.createMock(ServletContext.class);
        RESTFormService restService = emulateRESTFormService(translator, null, null, null);
        restService.setFormService(new MockFormDefinitionService());
       
        FormRepresentation form = createMockForm("myForm", "key1", "key2");
        FormPreviewDTO dto = createFormPreviewDTO(form);
       
        EasyMock.expect(translator.translateForm(EasyMock.eq(form))).andReturn(new URL("http://www.redhat.com")).once();
       
        EasyMock.replay(translator, context);
        Response resp = restService.getFormTemplate(dto, "lang", context);
View Full Code Here

        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

        ServletContext context = EasyMock.createMock(ServletContext.class);
        RESTFormService restService = emulateRESTFormService(translator, null, null, null);
        restService.setFormService(new MockFormDefinitionService());
       
        FormRepresentation form = createMockForm("myForm", "key1", "key2");
        FormPreviewDTO dto = createFormPreviewDTO(form);
       
        TranslatorException exception = new TranslatorException("Something going wrong");
        EasyMock.expect(translator.translateForm(EasyMock.eq(form))).andThrow(exception).once();
       
        EasyMock.replay(translator, context);
View Full Code Here

TOP

Related Classes of org.jbpm.formbuilder.server.xml.FormPreviewDTO

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.