Package org.jbpm.formbuilder.server.xml

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


    @GET @Path("/definitions/package/{pkgName}")
    public Response getForms(@PathParam("pkgName") String pkgName, @Context ServletContext context) {
        setContext(context);
        try {
            List<FormRepresentation> forms = formService.getForms(pkgName);
            ListFormsDTO dto = new ListFormsDTO(forms);
            return Response.ok(dto, MediaType.APPLICATION_XML).build();
        } catch (FormServiceException e) {
            return error("Problem reading forms of package " + pkgName, e);
        } catch (FormEncodingException e) {
            return error("Problem decoding forms of package " + pkgName, e);
View Full Code Here


    @GET @Path("/definitions/package/{pkgName}/id/{formId}")
    public Response getForm(@PathParam("pkgName") String pkgName, @PathParam("formId") String formId, @Context ServletContext context) {
        setContext(context);
        try {
            FormRepresentation form = formService.getForm(pkgName, formId);
            ListFormsDTO dto = new ListFormsDTO(form);
            return Response.ok(dto, MediaType.APPLICATION_XML).build();
        } catch (FormServiceException e) {
            return error("Problem reading form " + formId, e);
        } catch (FormEncodingException e) {
            return error("Problem decoding form " + formId, e);
View Full Code Here

        Response resp = restService.getForms("somePackage", context);
        EasyMock.verify(formService, context);
       
        Object entity = assertXmlOkResponse(resp);
        assertTrue("entity should be of type ListFormsDTO", entity instanceof ListFormsDTO);
        ListFormsDTO dto = (ListFormsDTO) entity;
        assertNotNull("dto.getForm() shouldn't be null", dto.getForm());
        assertEquals("dto.getForm() should be of size " + retval.size() + " but it is of size " + dto.getForm().size(),
                dto.getForm().size(), retval.size());
    }
View Full Code Here

        EasyMock.replay(formService, context);
        Response resp = restService.getForm("somePackage", "myFormId", context);
        EasyMock.verify(formService, context);
       
        Object entity = assertXmlOkResponse(resp);
        ListFormsDTO dto = (ListFormsDTO) entity;
        assertNotNull("dto.getForm() shouldn't be null", dto.getForm());
        assertEquals("dto.getForm() should be of one element but it is of size " + dto.getForm().size(), dto.getForm().size(), 1);
        FormDefDTO formDto = dto.getForm().iterator().next();
        assertTrue("formDto should be named myForm but it isn't", formDto.getJson().contains("myForm"));
        assertTrue("formDto should contain a parameter called myParam1 but it doesn't", formDto.getJson().contains("myParam1"));
        assertTrue("formDto should contain a parameter called myParam2 but it doesn't", formDto.getJson().contains("myParam2"));
        assertTrue("formDto should contain a parameter called myParam3 but it doesn't", formDto.getJson().contains("myParam3"));
    }
View Full Code Here

TOP

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

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.