Package org.jbpm.formbuilder.server.mock

Examples of org.jbpm.formbuilder.server.mock.MockAnswer


    //test response to an Exception for GuvnorFormDefinitionService.saveFormItem(...)
    public void testSaveFormItemUnkownProblem() throws Exception {
        HttpClient client = EasyMock.createMock(HttpClient.class);
        Map<String, String> responses = new HashMap<String, String>();
        EasyMock.expect(client.executeMethod(EasyMock.anyObject(MockGetMethod.class))).
            andAnswer(new MockAnswer(responses, new NullPointerException())).anyTimes();
        GuvnorFormDefinitionService service = createService(baseUrl, "", "");
        service.getHelper().setClient(client);
        FormItemRepresentation item = RESTAbstractTest.createMockForm("form1", "oneParam").getFormItems().iterator().next();
       
        EasyMock.replay(client);
View Full Code Here


        Map<String, String> responses = new HashMap<String, String>();
        FormRepresentation form = RESTAbstractTest.createMockForm("form1", "oneParam");
        String jsonForm = FormEncodingFactory.getEncoder().encode(form);
        responses.put("GET " + helper.getApiSearchUrl("somePackage") + "form1AutoForm.formdef", jsonForm);
        EasyMock.expect(client.executeMethod(EasyMock.anyObject(MockGetMethod.class))).
            andAnswer(new MockAnswer(responses, new IllegalArgumentException("Unexpected call"))).anyTimes();
        GuvnorFormDefinitionService service = createService(baseUrl, "", "");
        service.getHelper().setClient(client);
       
        EasyMock.replay(client);
        FormRepresentation form1 = service.getForm("somePackage", "form1AutoForm");
View Full Code Here

        Map<String, String> responses = new HashMap<String, String>();
        FormRepresentation form = RESTAbstractTest.createMockForm("form2", "oneParam");
        String jsonForm = FormEncodingFactory.getEncoder().encode(form);
        responses.put("GET " + helper.getApiSearchUrl("somePackage") + "form2AutoForm.formdef", jsonForm);
        EasyMock.expect(client.executeMethod(EasyMock.anyObject(MockGetMethod.class))).
            andAnswer(new MockAnswer(responses, new IllegalArgumentException("unexpected call"))).anyTimes();
        GuvnorFormDefinitionService service = createService(baseUrl, "", "");
        service.getHelper().setClient(client);
        FormRepresentationDecoder decoder = EasyMock.createMock(FormRepresentationDecoder.class);
        EasyMock.expect(decoder.decode(EasyMock.eq(jsonForm))).andThrow(new FormEncodingException("Something going wrong")).once();
        FormEncodingFactory.register(FormEncodingServerFactory.getEncoder(), decoder);
View Full Code Here

    //test response to a IOException for GuvnorFormDefinitionService.getForm(...)
    public void testGetFormIOProblem() throws Exception {
        HttpClient client = EasyMock.createMock(HttpClient.class);
        Map<String, String> responses = new HashMap<String, String>();
        EasyMock.expect(client.executeMethod(EasyMock.anyObject(MockGetMethod.class))).
            andAnswer(new MockAnswer(responses, new IOException("MOCK IO ERROR"))).anyTimes();
        GuvnorFormDefinitionService service = createService(baseUrl, "", "");
        service.getHelper().setClient(client);
       
        EasyMock.replay(client);
        try {
View Full Code Here

   
    public void testGetFormUnkownProblem() throws Exception {
        HttpClient client = EasyMock.createMock(HttpClient.class);
        Map<String, String> responses = new HashMap<String, String>();
        EasyMock.expect(client.executeMethod(EasyMock.anyObject(MockGetMethod.class))).
            andAnswer(new MockAnswer(responses, new NullPointerException())).anyTimes();
        GuvnorFormDefinitionService service = createService(baseUrl, "", "");
        service.getHelper().setClient(client);
       
        EasyMock.replay(client);
        try {
View Full Code Here

        GuvnorFormDefinitionService service = createService(baseUrl, "", "");
        HttpClient client = EasyMock.createMock(HttpClient.class);
        Map<String, String> responses = new HashMap<String, String>();
        responses.put("GET " + helper.getRestBaseUrl(), "<invalidXmlLetsSeeWhatHappens></WHAT>");
        EasyMock.expect(client.executeMethod(EasyMock.isA(MockGetMethod.class))).
            andAnswer(new MockAnswer(responses, new IllegalArgumentException("unexpected call"))).once();
        service.getHelper().setClient(client);
        String uuid = UUID.randomUUID().toString();
       
        EasyMock.replay(client);
        try {
View Full Code Here

        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);
        FormRepresentationDecoder decoder = EasyMock.createMock(FormRepresentationDecoder.class);
        FormEncodingException exception = new FormEncodingException("Something going wrong");
        EasyMock.expect(decoder.decode(EasyMock.isA(String.class))).andThrow(exception).once();
View Full Code Here

        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);
View Full Code Here

        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);
       
View Full Code Here

        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);
        FormEncodingException exception = new FormEncodingException("Something going wrong");
        EasyMock.expect(decoder.decode(EasyMock.isA(String.class))).andThrow(exception).once();
        FormEncodingFactory.register(FormEncodingFactory.getEncoder(), decoder);
       
View Full Code Here

TOP

Related Classes of org.jbpm.formbuilder.server.mock.MockAnswer

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.