You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dh...@apache.org on 2014/12/13 19:19:27 UTC

[1/2] camel git commit: CAMEL-8152: Added enum value EXTENDED

Repository: camel
Updated Branches:
  refs/heads/master c76dec5a1 -> 1b927ae44


CAMEL-8152: Added enum value EXTENDED


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1b927ae4
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1b927ae4
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1b927ae4

Branch: refs/heads/master
Commit: 1b927ae447e2313dacb5f932953f34a0eeeb792f
Parents: 06992f5
Author: Dhiraj Bokde <dh...@yahoo.com>
Authored: Sat Dec 13 10:18:31 2014 -0800
Committer: Dhiraj Bokde <dh...@yahoo.com>
Committed: Sat Dec 13 10:19:10 2014 -0800

----------------------------------------------------------------------
 .../salesforce/internal/dto/NotifyForOperationsEnum.java          | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1b927ae4/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/NotifyForOperationsEnum.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/NotifyForOperationsEnum.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/NotifyForOperationsEnum.java
index 807fef5..f75839c 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/NotifyForOperationsEnum.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/NotifyForOperationsEnum.java
@@ -26,7 +26,8 @@ public enum NotifyForOperationsEnum {
 
     CREATE("Create"),
     UPDATE("Update"),
-    ALL("All");
+    ALL("All"),
+    EXTENDED("Extended");
 
     final String value;
 


[2/2] camel git commit: CAMEL-7927: Added support for Salesforce multiselect picklists

Posted by dh...@apache.org.
CAMEL-7927: Added support for Salesforce multiselect picklists


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/06992f53
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/06992f53
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/06992f53

Branch: refs/heads/master
Commit: 06992f53a7604808180fc166d1cddae2495dff6f
Parents: c76dec5
Author: Dhiraj Bokde <dh...@yahoo.com>
Authored: Sat Dec 13 09:30:02 2014 -0800
Committer: Dhiraj Bokde <dh...@yahoo.com>
Committed: Sat Dec 13 10:19:10 2014 -0800

----------------------------------------------------------------------
 .../salesforce/api/JodaTimeConverter.java       |   6 +-
 .../api/MultiSelectPicklistConverter.java       | 101 +++++++++++++++++++
 .../api/MultiSelectPicklistDeserializer.java    |  94 +++++++++++++++++
 .../api/MultiSelectPicklistSerializer.java      |  64 ++++++++++++
 .../salesforce/api/PicklistEnumConverter.java   |  12 +--
 .../salesforce/internal/SalesforceSession.java  |   2 +-
 .../api/MultiSelectPicklistJsonTest.java        |  59 +++++++++++
 .../api/MultiSelectPicklistXmlTest.java         |  70 +++++++++++++
 .../salesforce/dto/generated/MSPTest.java       |  87 ++++++++++++++++
 .../camel-salesforce-maven-plugin/pom.xml       |   1 -
 .../apache/camel/maven/CamelSalesforceMojo.java |  23 ++++-
 .../src/main/resources/sobject-pojo.vm          |  25 ++++-
 components/camel-salesforce/pom.xml             |  27 +++++
 13 files changed, 557 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/06992f53/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/JodaTimeConverter.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/JodaTimeConverter.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/JodaTimeConverter.java
index 009f697..c2609b8 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/JodaTimeConverter.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/JodaTimeConverter.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.salesforce.api;
 
 import java.lang.reflect.Constructor;
 
+import com.thoughtworks.xstream.converters.ConversionException;
 import com.thoughtworks.xstream.converters.Converter;
 import com.thoughtworks.xstream.converters.MarshallingContext;
 import com.thoughtworks.xstream.converters.UnmarshallingContext;
@@ -29,6 +30,9 @@ import org.joda.time.DateTimeZone;
 import org.joda.time.format.DateTimeFormatter;
 import org.joda.time.format.ISODateTimeFormat;
 
+/**
+ * XStream converter for handling JodaTime fields.
+ */
 public class JodaTimeConverter implements Converter {
 
     private final DateTimeFormatter formatter = ISODateTimeFormat.dateTime();
@@ -48,7 +52,7 @@ public class JodaTimeConverter implements Converter {
             // normalize date time to UTC
             return constructor.newInstance(dateTimeStr, DateTimeZone.UTC);
         } catch (Exception e) {
-            throw new IllegalArgumentException(
+            throw new ConversionException(
                     String.format("Error reading Joda DateTime from value %s: %s",
                             dateTimeStr, e.getMessage()),
                     e);

http://git-wip-us.apache.org/repos/asf/camel/blob/06992f53/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistConverter.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistConverter.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistConverter.java
new file mode 100644
index 0000000..201a482
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistConverter.java
@@ -0,0 +1,101 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+
+import com.thoughtworks.xstream.converters.ConversionException;
+import com.thoughtworks.xstream.converters.Converter;
+import com.thoughtworks.xstream.converters.MarshallingContext;
+import com.thoughtworks.xstream.converters.UnmarshallingContext;
+import com.thoughtworks.xstream.io.HierarchicalStreamReader;
+import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
+
+/**
+ * XStream converter for handling MSPs mapped to Picklist enum array fields.
+ */
+public class MultiSelectPicklistConverter implements Converter {
+
+    private static final String FACTORY_METHOD = "fromValue";
+
+    @Override
+    public void marshal(Object o, HierarchicalStreamWriter writer, MarshallingContext context) {
+        // get Picklist enum element class from array class
+        Class<?> arrayClass = o.getClass();
+        final Class<?> aClass = arrayClass.getComponentType();
+
+        try {
+            Method getterMethod = aClass.getMethod("value");
+            final int length = Array.getLength(o);
+
+            // construct a string of form value1;value2;...
+            final StringBuilder buffer = new StringBuilder();
+            for (int i = 0; i < length; i++) {
+                buffer.append((String) getterMethod.invoke(Array.get(o, i)));
+                if (i < (length - 1)) {
+                    buffer.append(';');
+                }
+            }
+            writer.setValue(buffer.toString());
+        } catch (Exception e) {
+            throw new ConversionException(
+                    String.format("Exception writing pick list value %s of type %s: %s",
+                            o, o.getClass().getName(), e.getMessage()), e);
+        }
+    }
+
+    @Override
+    public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
+        final String listValue = reader.getValue();
+        // get Picklist enum element class from array class
+        final Class<?> requiredArrayType = context.getRequiredType();
+        final Class<?> requiredType = requiredArrayType.getComponentType();
+
+        try {
+            Method factoryMethod = requiredType.getMethod(FACTORY_METHOD, String.class);
+
+            // parse the string of the form value1;value2;...
+            final String[] value = listValue.split(";");
+            final int length = value.length;
+            final Object resultArray = Array.newInstance(requiredType, length);
+            for (int i = 0; i < length; i++) {
+                // use factory method to create object
+                Array.set(resultArray, i, factoryMethod.invoke(null, value[i].trim()));
+            }
+            return resultArray;
+        } catch (Exception e) {
+            throw new ConversionException(
+                    String.format("Exception reading pick list value %s of type %s: %s",
+                            listValue, requiredArrayType.getName(), e.getMessage()), e);
+        }
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public boolean canConvert(Class aClass) {
+        try {
+            // check whether the Class is an array, and whether the array elment is a Picklist enum class
+            final Class componentType = aClass.getComponentType();
+            return componentType != null && Enum.class.isAssignableFrom(componentType)
+                && componentType.getMethod(FACTORY_METHOD, String.class) != null;
+        } catch (NoSuchMethodException e) {
+            return false;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/06992f53/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistDeserializer.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistDeserializer.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistDeserializer.java
new file mode 100644
index 0000000..406f478
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistDeserializer.java
@@ -0,0 +1,94 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api;
+
+import java.io.IOException;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.JsonParser;
+import org.codehaus.jackson.map.BeanProperty;
+import org.codehaus.jackson.map.ContextualDeserializer;
+import org.codehaus.jackson.map.DeserializationConfig;
+import org.codehaus.jackson.map.DeserializationContext;
+import org.codehaus.jackson.map.JsonDeserializer;
+import org.codehaus.jackson.map.JsonMappingException;
+
+/**
+ * Jackson deserializer base class for reading ';' separated strings for MultiSelect pick-lists.
+ */
+public class MultiSelectPicklistDeserializer
+    extends JsonDeserializer<Object> implements ContextualDeserializer<Object> {
+
+    private static final String FACTORY_METHOD = "fromValue";
+
+    private final Class<? extends Enum> enumClass;
+    private final Method factoryMethod;
+
+    @SuppressWarnings("unused")
+    public MultiSelectPicklistDeserializer() {
+        enumClass = null;
+        factoryMethod = null;
+    }
+
+    public MultiSelectPicklistDeserializer(Class<? extends Enum> enumClass) throws JsonMappingException {
+        this.enumClass = enumClass;
+        try {
+            this.factoryMethod = enumClass.getMethod(FACTORY_METHOD, String.class);
+        } catch (NoSuchMethodException e) {
+            throw new JsonMappingException("Invalid pick-list enum class " + enumClass.getName(), e);
+        }
+    }
+
+    @Override
+    public Object deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
+
+        // validate enum class
+        if (enumClass == null) {
+            throw new JsonMappingException("Unable to parse unknown pick-list type");
+        }
+
+        final String listValue = jp.getText();
+
+        try {
+            // parse the string of the form value1;value2;...
+            final String[] value = listValue.split(";");
+            final int length = value.length;
+            final Object resultArray = Array.newInstance(enumClass, length);
+            for (int i = 0; i < length; i++) {
+                // use factory method to create object
+                Array.set(resultArray, i, factoryMethod.invoke(null, value[i].trim()));
+            }
+
+            return resultArray;
+        } catch (Exception e) {
+            throw new JsonParseException("Exception reading multi-select pick list value", jp.getCurrentLocation(), e);
+        }
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public JsonDeserializer<Object> createContextual(DeserializationConfig config, BeanProperty property) throws JsonMappingException {
+        final Class<?> rawClass = property.getType().getRawClass();
+        final Class<?> componentType = rawClass.getComponentType();
+        if (componentType == null || !componentType.isEnum()) {
+            throw new JsonMappingException("Pick list Enum array expected for " + rawClass);
+        }
+        return new MultiSelectPicklistDeserializer((Class<? extends Enum>) componentType);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/06992f53/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistSerializer.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistSerializer.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistSerializer.java
new file mode 100644
index 0000000..affbd1b
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistSerializer.java
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api;
+
+import java.io.IOException;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+
+import org.codehaus.jackson.JsonGenerationException;
+import org.codehaus.jackson.JsonGenerator;
+import org.codehaus.jackson.map.JsonSerializer;
+import org.codehaus.jackson.map.SerializerProvider;
+
+/**
+ * Jackson Serializer for generating ';' separated strings for MultiSelect pick-lists.
+ */
+public class MultiSelectPicklistSerializer extends JsonSerializer<Object> {
+
+    private static final String FACTORY_METHOD = "fromValue";
+
+    @Override
+    public void serialize(Object value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
+
+        // get Picklist enum element class from array class
+        Class<?> arrayClass = value.getClass();
+        final Class<?> aClass = arrayClass.getComponentType();
+
+        try {
+
+            Method getterMethod = aClass.getMethod("value");
+            final int length = Array.getLength(value);
+
+            // construct a string of form value1;value2;...
+            final StringBuilder buffer = new StringBuilder();
+            for (int i = 0; i < length; i++) {
+                buffer.append((String) getterMethod.invoke(Array.get(value, i)));
+                if (i < (length - 1)) {
+                    buffer.append(';');
+                }
+            }
+
+            jgen.writeString(buffer.toString());
+
+        } catch (Exception e) {
+            throw new JsonGenerationException(
+                    String.format("Exception writing pick list value %s of type %s: %s",
+                            value, value.getClass().getName(), e.getMessage()), e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/06992f53/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/PicklistEnumConverter.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/PicklistEnumConverter.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/PicklistEnumConverter.java
index 775f5bd..4a430bf 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/PicklistEnumConverter.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/PicklistEnumConverter.java
@@ -18,12 +18,16 @@ package org.apache.camel.component.salesforce.api;
 
 import java.lang.reflect.Method;
 
+import com.thoughtworks.xstream.converters.ConversionException;
 import com.thoughtworks.xstream.converters.Converter;
 import com.thoughtworks.xstream.converters.MarshallingContext;
 import com.thoughtworks.xstream.converters.UnmarshallingContext;
 import com.thoughtworks.xstream.io.HierarchicalStreamReader;
 import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
 
+/**
+ * XStream converter for handling pick-list enum fields.
+ */
 public class PicklistEnumConverter implements Converter {
 
     private static final String FACTORY_METHOD = "fromValue";
@@ -35,7 +39,7 @@ public class PicklistEnumConverter implements Converter {
             Method getterMethod = aClass.getMethod("value");
             writer.setValue((String) getterMethod.invoke(o));
         } catch (Exception e) {
-            throw new IllegalArgumentException(
+            throw new ConversionException(
                     String.format("Exception writing pick list value %s of type %s: %s",
                             o, o.getClass().getName(), e.getMessage()), e);
         }
@@ -49,12 +53,8 @@ public class PicklistEnumConverter implements Converter {
             Method factoryMethod = requiredType.getMethod(FACTORY_METHOD, String.class);
             // use factory method to create object
             return factoryMethod.invoke(null, value);
-        } catch (SecurityException e) {
-            throw new IllegalArgumentException(
-                    String.format("Security Exception reading pick list value %s of type %s: %s",
-                            value, context.getRequiredType().getName(), e.getMessage()), e);
         } catch (Exception e) {
-            throw new IllegalArgumentException(
+            throw new ConversionException(
                     String.format("Exception reading pick list value %s of type %s: %s",
                             value, context.getRequiredType().getName(), e.getMessage()), e);
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/06992f53/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java
index a1ce643..5dcb68b 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java
@@ -121,7 +121,7 @@ public class SalesforceSession implements Service {
 
             try {
 
-                LOG.info("Logging clientId: {} into Salesforce url: {}", config.getClientId(), url);
+                LOG.info("Login user {} at Salesforce url: {}", config.getUserName(), url);
 
                 // set form content
                 loginPost.setRequestContent(new ByteArrayBuffer(

http://git-wip-us.apache.org/repos/asf/camel/blob/06992f53/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistJsonTest.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistJsonTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistJsonTest.java
new file mode 100644
index 0000000..250c628
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistJsonTest.java
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api;
+
+import org.apache.camel.component.salesforce.dto.generated.MSPTest;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.junit.Test;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+public class MultiSelectPicklistJsonTest {
+
+    private static final String TEST_JSON = "{\"MspField\":\"Value1;Value2;Value3\"}";
+    private static final String TEST_NULL_JSON = "{\"MspField\":null}";
+
+    private static ObjectMapper objectMapper = new ObjectMapper();
+
+    @Test
+    public void testMarshal() throws Exception {
+        final MSPTest mspTest = new MSPTest();
+        mspTest.setMspField(MSPTest.MSPEnum.values());
+
+        String json = objectMapper.writeValueAsString(mspTest);
+        assertEquals(TEST_JSON, json);
+
+        // test null
+        mspTest.setMspField(null);
+
+        json = objectMapper.writeValueAsString(mspTest);
+        assertEquals(TEST_NULL_JSON, json);
+    }
+
+    @Test
+    public void testUnmarshal() throws Exception {
+        MSPTest mspTest = objectMapper.readValue(TEST_JSON, MSPTest.class);
+        assertArrayEquals(MSPTest.MSPEnum.values(), mspTest.getMspField());
+
+        // test null
+        mspTest = objectMapper.readValue(TEST_NULL_JSON, MSPTest.class);
+        assertNull(mspTest.getMspField());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/06992f53/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistXmlTest.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistXmlTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistXmlTest.java
new file mode 100644
index 0000000..1dec3fd
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/MultiSelectPicklistXmlTest.java
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api;
+
+import com.thoughtworks.xstream.XStream;
+
+import org.apache.camel.component.salesforce.dto.generated.MSPTest;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+public class MultiSelectPicklistXmlTest {
+
+    private static final String TEST_XML = "<MSPTest>\n"
+        + "  <MspField>Value1;Value2;Value3</MspField>\n"
+        + "</MSPTest>";
+    private static final String TEST_NULL_XML = "<MSPTest/>";
+
+    private static XStream xStream = new XStream();
+
+    @BeforeClass
+    public static void beforeClass() throws Exception {
+        xStream = new XStream();
+        xStream.processAnnotations(MSPTest.class);
+    }
+
+
+    @Test
+    public void testMarshal() throws Exception {
+        final MSPTest mspTest = new MSPTest();
+        mspTest.setMspField(MSPTest.MSPEnum.values());
+
+        String xml = xStream.toXML(mspTest);
+        assertEquals(TEST_XML, xml);
+
+        // test null value
+        mspTest.setMspField(null);
+
+        xml = xStream.toXML(mspTest);
+        assertEquals(TEST_NULL_XML, xml);
+    }
+
+    @Test
+    public void testUnmarshal() throws Exception {
+        MSPTest mspTest = (MSPTest) xStream.fromXML(TEST_XML);
+        assertArrayEquals(MSPTest.MSPEnum.values(), mspTest.getMspField());
+
+        // test null field value
+        mspTest = (MSPTest) xStream.fromXML(TEST_NULL_XML);
+        assertNull(mspTest.getMspField());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/06992f53/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/dto/generated/MSPTest.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/dto/generated/MSPTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/dto/generated/MSPTest.java
new file mode 100644
index 0000000..a825391
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/dto/generated/MSPTest.java
@@ -0,0 +1,87 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.dto.generated;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+import com.thoughtworks.xstream.annotations.XStreamConverter;
+
+import org.apache.camel.component.salesforce.api.MultiSelectPicklistConverter;
+import org.apache.camel.component.salesforce.api.MultiSelectPicklistDeserializer;
+import org.apache.camel.component.salesforce.api.MultiSelectPicklistSerializer;
+import org.apache.camel.component.salesforce.api.dto.AbstractSObjectBase;
+import org.codehaus.jackson.annotate.JsonCreator;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.annotate.JsonValue;
+import org.codehaus.jackson.map.annotate.JsonDeserialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+/**
+ * Sample POJO for MSP tests.
+ */
+//CHECKSTYLE:OFF
+@XStreamAlias("MSPTest")
+public class MSPTest extends AbstractSObjectBase {
+
+    @XStreamConverter(MultiSelectPicklistConverter.class)
+    private MSPEnum[] MspField;
+
+    @JsonProperty("MspField")
+    @JsonSerialize(using = MultiSelectPicklistSerializer.class)
+    public MSPEnum[] getMspField() {
+        return MspField;
+    }
+
+    @JsonProperty("MspField")
+    @JsonDeserialize(using = MultiSelectPicklistDeserializer.class)
+    public void setMspField(MSPEnum[] mspField) {
+        this.MspField = mspField;
+    }
+
+    @JsonDeserialize
+    public enum MSPEnum {
+
+        // Value1
+        VALUE1("Value1"),
+        // Value1
+        VALUE2("Value2"),
+        // Value1
+        VALUE3("Value3");
+
+        final String value;
+
+        private MSPEnum(String value) {
+            this.value = value;
+        }
+
+        @JsonValue
+        public String value() {
+            return this.value;
+        }
+
+        @JsonCreator
+        public static MSPEnum fromValue(String value) {
+            for (MSPEnum e : MSPEnum.values()) {
+                if (e.value.equals(value)) {
+                    return e;
+                }
+            }
+            throw new IllegalArgumentException(value);
+        }
+
+    }
+}
+//CHECKSTYLE:ON

http://git-wip-us.apache.org/repos/asf/camel/blob/06992f53/components/camel-salesforce/camel-salesforce-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-maven-plugin/pom.xml b/components/camel-salesforce/camel-salesforce-maven-plugin/pom.xml
index bbaa476..c32f12d 100644
--- a/components/camel-salesforce/camel-salesforce-maven-plugin/pom.xml
+++ b/components/camel-salesforce/camel-salesforce-maven-plugin/pom.xml
@@ -151,7 +151,6 @@
             </executions>
           </plugin>
         </plugins>
-
       </build>
     </profile>
   </profiles>

http://git-wip-us.apache.org/repos/asf/camel/blob/06992f53/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/java/org/apache/camel/maven/CamelSalesforceMojo.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/java/org/apache/camel/maven/CamelSalesforceMojo.java b/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/java/org/apache/camel/maven/CamelSalesforceMojo.java
index 4436d2e..fdb0f8e 100644
--- a/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/java/org/apache/camel/maven/CamelSalesforceMojo.java
+++ b/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/java/org/apache/camel/maven/CamelSalesforceMojo.java
@@ -386,7 +386,7 @@ public class CamelSalesforceMojo extends AbstractMojo {
 
             // write required Enumerations for any picklists
             for (SObjectField field : description.getFields()) {
-                if (utility.isPicklist(field)) {
+                if (utility.isPicklist(field) || utility.isMultiSelectPicklist(field)) {
                     fileName = utility.enumTypeName(field.getName()) + JAVA_EXT;
                     File enumFile = new File(pkgDir, fileName);
                     writer = new BufferedWriter(new FileWriter(enumFile));
@@ -497,6 +497,8 @@ public class CamelSalesforceMojo extends AbstractMojo {
         }
 
         private static final String BASE64BINARY = "base64Binary";
+        private static final String MULTIPICKLIST = "multipicklist";
+        private static final String PICKLIST = "picklist";
 
         public boolean isBlobField(SObjectField field) {
             final String soapType = field.getSoapType();
@@ -512,6 +514,9 @@ public class CamelSalesforceMojo extends AbstractMojo {
             if (isPicklist(field)) {
                 // use a pick list enum, which will be created after generating the SObject class
                 return enumTypeName(field.getName());
+            } else if (isMultiSelectPicklist(field)) {
+                // use a pick list enum array, enum will be created after generating the SObject class
+                return enumTypeName(field.getName()) + "[]";
             } else {
                 // map field to Java type
                 final String soapType = field.getSoapType();
@@ -524,6 +529,10 @@ public class CamelSalesforceMojo extends AbstractMojo {
             }
         }
 
+        public boolean isMultiSelectPicklist(SObjectField field) {
+            return MULTIPICKLIST.equals(field.getType());
+        }
+
         public boolean hasPicklists(SObjectDescription desc) {
             for (SObjectField field : desc.getFields()) {
                 if (isPicklist(field)) {
@@ -533,13 +542,23 @@ public class CamelSalesforceMojo extends AbstractMojo {
             return false;
         }
 
+        public boolean hasMultiSelectPicklists(SObjectDescription desc) {
+            for (SObjectField field : desc.getFields()) {
+                if (isMultiSelectPicklist(field)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+
         public PickListValue getLastEntry(SObjectField field) {
             final List<PickListValue> values = field.getPicklistValues();
             return values.get(values.size() - 1);
         }
 
         public boolean isPicklist(SObjectField field) {
-            return field.getPicklistValues() != null && !field.getPicklistValues().isEmpty();
+//            return field.getPicklistValues() != null && !field.getPicklistValues().isEmpty();
+            return PICKLIST.equals(field.getType());
         }
 
         public String enumTypeName(String name) {

http://git-wip-us.apache.org/repos/asf/camel/blob/06992f53/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/resources/sobject-pojo.vm
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/resources/sobject-pojo.vm b/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/resources/sobject-pojo.vm
index bbce083..b69a3d8 100644
--- a/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/resources/sobject-pojo.vm
+++ b/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/resources/sobject-pojo.vm
@@ -23,15 +23,25 @@ package $packageName;
 
 ## add imports for XStreamConverter and PicklistEnumConverter if needed
 #set ( $hasPicklists = $utility.hasPicklists($desc) )
+#set ( $hasMultiSelectPicklists = $utility.hasMultiSelectPicklists($desc) )
 import com.thoughtworks.xstream.annotations.XStreamAlias;
-#if ( $hasPicklists )
+#if ( $hasPicklists || $hasMultiSelectPicklists )
 import com.thoughtworks.xstream.annotations.XStreamConverter;
 #end
-import org.codehaus.jackson.annotate.JsonProperty;
 #if ( $hasPicklists )
 import org.apache.camel.component.salesforce.api.PicklistEnumConverter;
 #end
+#if ( $hasMultiSelectPicklists )
+import org.apache.camel.component.salesforce.api.MultiSelectPicklistConverter;
+import org.apache.camel.component.salesforce.api.MultiSelectPicklistDeserializer;
+import org.apache.camel.component.salesforce.api.MultiSelectPicklistSerializer;
+#end
 import org.apache.camel.component.salesforce.api.dto.AbstractSObjectBase;
+import org.codehaus.jackson.annotate.JsonProperty;
+#if ( $hasMultiSelectPicklists )
+import org.codehaus.jackson.map.annotate.JsonDeserialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+#end
 
 /**
  * Salesforce DTO for SObject $desc.Name
@@ -43,6 +53,7 @@ public class $desc.Name extends AbstractSObjectBase {
 #if ( $utility.notBaseField($field.Name) )
 #set ( $fieldName = $field.Name )
 #set ( $fieldType = $utility.getFieldType($field) )
+#set ( $isMultiSelectPicklist = $utility.isMultiSelectPicklist($field) )
     // $fieldName
 #if ( $utility.isBlobField($field) )
 #set ( $propertyName = $fieldName + "Url" )
@@ -50,8 +61,10 @@ public class $desc.Name extends AbstractSObjectBase {
 #set ( $propertyName = $fieldName )
 #end
 ## add a converter annotation if needed
-#if ( $utility.isPicklist($field) )
+#if ( !$isMultiSelectPicklist && $utility.isPicklist($field) )
     @XStreamConverter(PicklistEnumConverter.class)
+#elseif ( $isMultiSelectPicklist )
+    @XStreamConverter(MultiSelectPicklistConverter.class)
 #else
 ## add an alias for blob field url if needed
 #if ( $propertyName != $fieldName )
@@ -62,11 +75,17 @@ public class $desc.Name extends AbstractSObjectBase {
     private $fieldType $propertyName;
 
     @JsonProperty("$fieldName")
+#if ( $isMultiSelectPicklist )
+    @JsonSerialize(using = MultiSelectPicklistSerializer.class)
+#end
     public $fieldType get$propertyName() {
         return this.$propertyName;
     }
 
     @JsonProperty("$fieldName")
+#if ( $isMultiSelectPicklist )
+    @JsonDeserialize(using = MultiSelectPicklistDeserializer.class)
+#end
     public void set$propertyName($fieldType $propertyName) {
         this.$propertyName = $propertyName;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/06992f53/components/camel-salesforce/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/pom.xml b/components/camel-salesforce/pom.xml
index 04b44b1..e22bf3f 100644
--- a/components/camel-salesforce/pom.xml
+++ b/components/camel-salesforce/pom.xml
@@ -35,4 +35,31 @@
         <module>camel-salesforce-maven-plugin</module>
     </modules>
 
+    <profiles>
+
+      <profile>
+        <id>salesforce-test</id>
+        <build>
+          <plugins>
+            <plugin>
+              <artifactId>maven-surefire-plugin</artifactId>
+              <configuration>
+                <childDelegation>false</childDelegation>
+                <useFile>true</useFile>
+                <forkCount>1</forkCount>
+                <reuseForks>true</reuseForks>
+                <forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
+                <excludes>
+                  <exclude>**/*XXXTest.java</exclude>
+                </excludes>
+                <includes>
+                  <include>**/*Test.java</include>
+                </includes>
+              </configuration>
+            </plugin>
+          </plugins>
+        </build>
+      </profile>
+    </profiles>
+
 </project>