Examples of translateForm()


Examples of org.jbpm.formapi.server.trans.Translator.translateForm()

            try {
                Translator translator = TranslatorFactory.getInstance().getTranslator(language);
                assertNotNull("translator shouldn't be null", translator);
                Renderer renderer = RendererFactory.getInstance().getRenderer(language);
                assertNotNull("renderer shouldn't be null", renderer);
                URL url = translator.translateForm(form);
                Map<String, Object> inputs = basicInputs();
                Object html = renderer.render(url, inputs);
                assertNotNull("html shouldn't be null", html);
            } catch (TranslatorException e) {
                errors.add(new Exception("translator for language " + language + " failed", e));
View Full Code Here

Examples of org.jbpm.formapi.server.trans.Translator.translateForm()

        FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder();
        String json = dto.getRepresentation();
        FormRepresentation form = decoder.decode(json);
        dto.setForm(form);
        Translator translator = getTranslator(language);
        URL url = translator.translateForm(form);
        return url;
    }
   
    @GET @Path("/template/lang/{language}")
    public Response getExportTemplate(@QueryParam("fileName") String fileName,
View Full Code Here

Examples of org.jbpm.formapi.server.trans.Translator.translateForm()

                FormDefinitionService formService = createFormService(req);
                String packageName = taskService.getContainingPackage(uuid);
                FormRepresentation form = formService.getFormByUUID(packageName, uuid);
                if (notEmpty(form.getProcessName()) || notEmpty(form.getTaskId())) {
                    Translator translator = TranslatorFactory.getInstance().getTranslator("ftl");
                    URL url = translator.translateForm(form);
                    String content = IOUtils.toString(url.openStream());
                    String templateName = "";
                    if (!notEmpty(form.getTaskId()) || ProcessGetInputHandler.PROCESS_INPUT_NAME.equals(form.getTaskId())) {
                        templateName = form.getProcessName();
                    } else {
View Full Code Here

Examples of org.jbpm.formapi.server.trans.Translator.translateForm()

       
        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")
        Map<String, Object> anyObject = EasyMock.anyObject(Map.class);
        EasyMock.expect(renderer.render(EasyMock.anyObject(URL.class), anyObject)).andReturn(htmlResult);
        EasyMock.expect(context.getContextPath()).andReturn("/").anyTimes();
View Full Code Here

Examples of org.jbpm.formapi.server.trans.Translator.translateForm()

        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();
       
        EasyMock.replay(translator, context, request);
        Response resp = restService.getFormPreview(dto, "lang", context, request);
        EasyMock.verify(translator, context, request);
View Full Code Here

Examples of org.jbpm.formapi.server.trans.Translator.translateForm()

       
        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();
       
        EasyMock.replay(renderer, translator, context, request);
        Response resp = restService.getFormPreview(dto, "lang", context, request);
        EasyMock.verify(renderer, translator, context, request);
View Full Code Here

Examples of org.jbpm.formapi.server.trans.Translator.translateForm()

        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);
        EasyMock.expect(renderer.render(EasyMock.anyObject(URL.class), anyObject)).andThrow(exception).once();
        EasyMock.expect(context.getContextPath()).andReturn("/").anyTimes();
View Full Code Here

Examples of org.jbpm.formapi.server.trans.Translator.translateForm()

        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);
        EasyMock.verify(translator, context);
       
View Full Code Here

Examples of org.jbpm.formapi.server.trans.Translator.translateForm()

       
        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);
        Response resp = restService.getFormTemplate(dto, "lang", context);
        EasyMock.verify(translator, context);
       
View Full Code Here

Examples of org.jbpm.formbuilder.server.trans.ftl.Translator.translateForm()

public class RendererTest extends RenderTranslatorAbstractTest {

    public void testFormBasic() throws Exception {
        Translator lang = new Translator();
        FormRepresentation form = createBasicForm();
        URL url = lang.translateForm(form);
        assertNotNull("url shouldn't be null", url);
       
        Renderer renderer = new Renderer();
        Map<String, Object> inputData = new HashMap<String, Object>();
        inputData.put(Renderer.BASE_CONTEXT_PATH, "/");
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.