Package org.jbpm.formapi.shared.api

Examples of org.jbpm.formapi.shared.api.FormRepresentation


                "<metadata>" +
                "<format>formdef</format>" +
                "<uuid>" + uuid + "</uuid>" +
                "</metadata>" +
                "</asset>";
        FormRepresentation form = RESTAbstractTest.createMockForm("myForm", "myOnlyParam");
        String jsonForm = FormEncodingServerFactory.getEncoder().encode(form);
        responses1.put("GET " + helper.getRestBaseUrl(), xml1);
        responses1.put("GET " + helper.getRestBaseUrl() + "somePackage/asset1", xml2);
        responses1.put("GET " + helper.getRestBaseUrl() + "somePackage/asset1/source", jsonForm);
        EasyMock.expect(client.executeMethod(EasyMock.isA(MockGetMethod.class))).
View Full Code Here


                "<metadata>" +
                "<format>formdef</format>" +
                "<uuid>" + uuid + "</uuid>" +
                "</metadata>" +
                "</asset>";
        FormRepresentation form = RESTAbstractTest.createMockForm("myForm", "myOnlyParam");
        String jsonForm = FormEncodingServerFactory.getEncoder().encode(form);
        responses1.put("GET " + helper.getRestBaseUrl(), xml1);
        responses1.put("GET " + helper.getRestBaseUrl() + "somePackage/asset1", xml2);
        responses1.put("GET " + helper.getRestBaseUrl() + "somePackage/asset1/source", jsonForm);
        EasyMock.expect(client.executeMethod(EasyMock.isA(MockGetMethod.class))).
            andAnswer(new MockAnswer(responses1, new IllegalArgumentException("unexpected call"))).times(3);
        EasyMock.expect(client);
        service.getHelper().setClient(client);
       
        EasyMock.replay(client);
        FormRepresentation form2 = service.getFormByUUID("somePackage", uuid);
        EasyMock.verify(client);
       
        assertNotNull("form2 shouldn't be null", form2);
        assertEquals("form and form2 should be the same", form, form2);
    }
View Full Code Here

        HttpClient client = EasyMock.createMock(HttpClient.class);
        GuvnorFormDefinitionService service = createService(baseUrl, "", "");
        service.getHelper().setClient(client);
       
        Map<String, String> responses = new HashMap<String, String>();
        FormRepresentation form = RESTAbstractTest.createMockForm("myForm", "myParam");
        String jsonForm = FormEncodingServerFactory.getEncoder().encode(form);
        responses.put("GET " + helper.getApiSearchUrl("somePackage") + "myForm.formdef", jsonForm);
        EasyMock.expect(client.executeMethod(EasyMock.isA(MockGetMethod.class))).
            andAnswer(new MockAnswer(responses, new IllegalArgumentException("unexpected call"))).once();
       
        EasyMock.replay(client);
        FormRepresentation form2 = service.getForm("somePackage", "myForm");
        EasyMock.verify(client);
       
        assertNotNull("form2 shouldn't be null", form2);
        assertEquals("form and form2 should be equal", form, form2);
    }
View Full Code Here

    }
   
    public void testGetFormEmptyFormId() throws Exception {
        GuvnorFormDefinitionService service = createService(baseUrl, "", "");
       
        FormRepresentation form1 = service.getForm("somePackage", null);
        assertNull("form1 should be null", form1);
       
        FormRepresentation form2 = service.getForm("somePackage", "");
        assertNull("form2 should be null", form2);
    }
View Full Code Here

        HttpClient client = EasyMock.createMock(HttpClient.class);
        GuvnorFormDefinitionService service = createService(baseUrl, "", "");
        service.getHelper().setClient(client);
       
        Map<String, String> responses = new HashMap<String, String>();
        FormRepresentation form = RESTAbstractTest.createMockForm("myForm", "myParam");
        String jsonForm = FormEncodingServerFactory.getEncoder().encode(form);
        responses.put("GET " + helper.getApiSearchUrl("somePackage") + "myForm.formdef", jsonForm);
        EasyMock.expect(client.executeMethod(EasyMock.isA(MockGetMethod.class))).
            andAnswer(new MockAnswer(responses, new IllegalArgumentException("unexpected call"))).once();
        FormRepresentationDecoder decoder = EasyMock.createMock(FormRepresentationDecoder.class);
View Full Code Here

    }

    public void testGetFormsOK() throws Exception {
        HttpClient client = EasyMock.createMock(HttpClient.class);
        Map<String, String> responses = new HashMap<String, String>();
        FormRepresentation form1 = RESTAbstractTest.createMockForm("form1", "oneParam");
        String jsonForm1 = FormEncodingFactory.getEncoder().encode(form1);
        FormRepresentation form2 = RESTAbstractTest.createMockForm("form2", "anotherParam");
        String jsonForm2 = FormEncodingFactory.getEncoder().encode(form2);
        StringBuilder props = new StringBuilder();
        props.append("form1AutoForm.formdef=AAAAA\n");
        props.append("somethingElse.json=AAAAA\n");
        props.append("form2AutoForm.formdef=AAAAA\n");
View Full Code Here

   
    //test happy path for RESTFormService.getForm(...)
    public void testGetFormOK() throws Exception {
        RESTFormService restService = new RESTFormService();
       
        FormRepresentation form = createMockForm("myForm", "myParam1", "myParam2", "myParam3");
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        ServletContext context = EasyMock.createMock(ServletContext.class);
        EasyMock.expect(formService.getForm(EasyMock.same("somePackage"), EasyMock.same("myFormId"))).andReturn(form);
        restService.setFormService(formService);
       
View Full Code Here

        FormRepresentationEncoder encoder = EasyMock.createMock(FormRepresentationEncoder.class);
        EasyMock.expect(encoder.encode(EasyMock.anyObject(FormRepresentation.class))).andThrow(exception).once();
       
        FormEncodingFactory.register(encoder, FormEncodingServerFactory.getDecoder());
       
        FormRepresentation form = createMockForm("form1", "param1", "param2", "param3");
       
        EasyMock.expect(formService.getForm(EasyMock.same("somePackage"), EasyMock.same("myFormId"))).andReturn(form).once();
        restService.setFormService(formService);
       
        EasyMock.replay(formService, context, encoder);
View Full Code Here

    //test happy path for RESTFormService.saveForm(...)
    public void testSaveFormOK() throws Exception {
        FormEncodingFactory.register(FormEncodingServerFactory.getEncoder(), FormEncodingServerFactory.getDecoder());
        RESTFormService restService = new RESTFormService();
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        FormRepresentation form = RESTAbstractTest.createMockForm("formToBeSaved", "param1", "param2", "param3");
        EasyMock.expect(formService.saveForm(EasyMock.eq("somePackage"), EasyMock.eq(form))).andReturn("MY_FORM_ID").once();
        restService.setFormService(formService);
        ServletContext context = EasyMock.createMock(ServletContext.class);
        HttpSession session = EasyMock.createMock(HttpSession.class);
        HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
View Full Code Here

    //test response to a FormServiceException for RESTFormService.saveForm(...)
    public void testSaveFormServiceProblem() throws Exception {
        FormEncodingFactory.register(FormEncodingServerFactory.getEncoder(), FormEncodingServerFactory.getDecoder());
        RESTFormService restService = new RESTFormService();
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        FormRepresentation form = RESTAbstractTest.createMockForm("formToBeSaved", "param1", "param2", "param3");
        FormServiceException exception = new FormServiceException("Something going wrong");
        EasyMock.expect(formService.saveForm(EasyMock.eq("somePackage"), EasyMock.eq(form))).andThrow(exception).once();
        restService.setFormService(formService);
        ServletContext context = EasyMock.createMock(ServletContext.class);
        HttpSession session = EasyMock.createMock(HttpSession.class);
View Full Code Here

TOP

Related Classes of org.jbpm.formapi.shared.api.FormRepresentation

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.