Package org.jbpm.formapi.server.render

Examples of org.jbpm.formapi.server.render.Renderer.render()


                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));
            } catch (RendererException e) {
                errors.add(new Exception("renderer for language " + language + " failed", e));
View Full Code Here


            Map<String, Object> inputs = dto.getInputsAsMap();
            Renderer renderer = getRenderer(language);
            inputs.put(Renderer.BASE_CONTEXT_PATH, context.getContextPath());
            Locale locale = request.getLocale();
            inputs.put(Renderer.BASE_LOCALE, locale == null ? "default" : locale.getDisplayName(locale));
            Object html = renderer.render(url, inputs);
            String htmlUrl = createHtmlTemplate(html, language, context);
            return Response.ok(htmlUrl, MediaType.TEXT_PLAIN).build();
        } catch (FormEncodingException e) {
            return error("Problem encoding form preview", e);
        } catch (TranslatorException e) {
View Full Code Here

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

       
        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();
        EasyMock.expect(request.getLocale()).andReturn(Locale.getDefault()).once();
       
        EasyMock.replay(renderer, translator, context, request);
        Response resp = restService.getFormPreview(dto, "lang", context, request);
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.