Package org.jbpm.formapi.server.trans

Examples of org.jbpm.formapi.server.trans.TranslatorException


    public String toServerScript(FBScript script) throws TranslatorException {
        if (isValidScript(script)) {
            return asFtlScript(script);
        } else {
            throw new TranslatorException(script.getType() + " is not a supported language");
        }
    }
View Full Code Here


            String json = encoder.encode(form);
            File file = File.createTempFile("form-gwt-", ".json");
            FileUtils.writeStringToFile(file, json);
            return FileUtils.toURLs(new File[] { file })[0];
        } catch (IOException e) {
            throw new TranslatorException("Problem writing temporal file", e);
        } catch (FormEncodingException e) {
            throw new TranslatorException("Problem encoding form", e);
        }
    }
View Full Code Here

    public String toServerScript(FBScript script) throws TranslatorException {
        if (isValidScript(script)) {
            return asFtlScript(script);
        } else {
            throw new TranslatorException(script.getType() + " is not a supported language");
        }
    }
View Full Code Here

   
    //test response to a non existing Translator for RESTFormService.getFormPreview(...)
    public void testGetFormPreviewTranslatorNotFound() throws Exception {
        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);
View Full Code Here

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

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

TOP

Related Classes of org.jbpm.formapi.server.trans.TranslatorException

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.