Package org.jbpm.formapi.shared.form

Examples of org.jbpm.formapi.shared.form.FormEncodingException


   
    public void testListItemsEncodingProblem() throws Exception {
        GuvnorMenuService service = createMockedService(null);
        FormRepresentationDecoder decoder = EasyMock.createMock(FormRepresentationDecoder.class);
        FormEncodingFactory.register(FormEncodingFactory.getEncoder(), decoder);
        FormEncodingException exception = new FormEncodingException("Something going wrong");
        EasyMock.expect(decoder.decodeMenuItemsMap(EasyMock.anyObject(String.class))).andThrow(exception).once();
       
        EasyMock.replay(decoder);
        try {
            service.listMenuItems();
View Full Code Here


        sampleDescription.setEffects(new ArrayList<FormEffectDescription>());
        FormItemRepresentation item = RESTAbstractTest.createMockForm("form", "param1").getFormItems().iterator().next();
        sampleDescription.setItemRepresentation(item);
        sampleDescription.setName("name");
        FormRepresentationEncoder encoder = EasyMock.createMock(FormRepresentationEncoder.class);
        FormEncodingException exception = new FormEncodingException();
        @SuppressWarnings("unchecked")
        Map<String, List<MenuItemDescription>> anyObject = EasyMock.anyObject(Map.class);
        EasyMock.expect(encoder.encodeMenuItemsMap(anyObject)).andThrow(exception).once();
        FormEncodingFactory.register(encoder, FormEncodingFactory.getDecoder());
       
View Full Code Here

                    String helperClass = (String) helperMap.get("@className");
                    FBScriptHelper helper = (FBScriptHelper) ReflectionHelper
                            .newInstance(helperClass);
                    helper.setDataMap(helperMap);
                } catch (Exception e) {
                    throw new FormEncodingException("Problem creating helper "
                            + obj, e);
                }
            }
            setHelpers(myHelpers);
        }
View Full Code Here

        if (data == null || data.isEmpty()) {
            return null;
        }
        String className = (String) data.get("@className");
        if (className == null) {
            throw new FormEncodingException(
                    "@className attribute cannot be null");
        }
        Object obj = null;
        try {
            obj = Class.forName(className).newInstance();
            if (obj instanceof Mappable) {
                Mappable item = (Mappable) obj;
                item.setDataMap(data);
            } else {
                throw new FormEncodingException("Type "
                        + obj.getClass().getName()
                        + " cannot be casted to FormItemRepresentation");
            }
        } catch (InstantiationException e) {
            throw new FormEncodingException("Couldn't instantiate class "
                    + className, e);
        } catch (IllegalAccessException e) {
            throw new FormEncodingException(
                    "Couldn't access constructor of class " + className, e);
        } catch (ClassNotFoundException e) {
            throw new FormEncodingException("Couldn't find class " + className,
                    e);
        }
        return obj;
    }
View Full Code Here

        if (jsonValue.isJsonObject()) {
            JsonObject jsonObj = jsonValue.getAsJsonObject();
            Map<String, Object> dataMap = asMap(jsonObj);
            return (FormItemRepresentation) decode(dataMap);
        } else {
            throw new FormEncodingException("Expected json object but found "
                    + jsonValue);
        }
    }
View Full Code Here

            obj = ReflectionHelper.newInstance(className);
            if (obj instanceof Mappable) {
                Mappable item = (Mappable) obj;
                item.setDataMap(data);
            } else {
                throw new FormEncodingException("Cannot cast class "
                        + obj.getClass().getName() + " to Mappable");
            }
        } catch (Exception e) {
            throw new FormEncodingException("Couldn't instantiate class "
                    + className, e);
        }
        return obj;
    }
View Full Code Here

        if (jsonValue.isObject() != null) {
            JSONObject jsonObj = jsonValue.isObject();
            Map<String, Object> dataMap = asMap(jsonObj);
            return (FormItemRepresentation) decode(dataMap);
        } else {
            throw new FormEncodingException("Expected JSON Object: "
                    + jsonValue);
        }
    }
View Full Code Here

        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);
       
        EasyMock.replay(client, decoder);
        try {
            service.saveForm("somePackage", form);
View Full Code Here

        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);
        FormRepresentationEncoder encoder = EasyMock.createMock(FormRepresentationEncoder.class);
        EasyMock.expect(encoder.encode(EasyMock.eq(form))).andThrow(new FormEncodingException("Something going wrong")).once();
        FormEncodingFactory.register(encoder, FormEncodingServerFactory.getDecoder());
       
        EasyMock.replay(client, encoder);
        try {
            service.saveForm("somePackage", form);
View Full Code Here

        GuvnorFormDefinitionService service = createService(baseUrl, "", "");
        service.getHelper().setClient(client);
        FormItemRepresentation item = RESTAbstractTest.createMockForm("form1", "oneParam").getFormItems().iterator().next();
        FormRepresentationEncoder encoder = EasyMock.createMock(FormRepresentationEncoder.class);
        FormEncodingFactory.register(encoder, FormEncodingFactory.getDecoder());
        EasyMock.expect(encoder.encode(EasyMock.eq(item))).andThrow(new FormEncodingException("Something wrong")).once();
       
        EasyMock.replay(client, encoder);
        try {
            service.saveFormItem("somePackage", "item1", item);
            fail("Shouldn't have succeeded");
View Full Code Here

TOP

Related Classes of org.jbpm.formapi.shared.form.FormEncodingException

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.