You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/03/23 19:59:21 UTC

[01/23] camel git commit: Fixing version

Repository: camel
Updated Branches:
  refs/heads/master fa78b8636 -> 31991b581


Fixing version


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

Branch: refs/heads/master
Commit: 5d015b93db9dcfa1d6368de27628c4aea3339258
Parents: 87fb63e
Author: oalles <oa...@neivi.es>
Authored: Wed Mar 23 12:19:27 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 23 18:46:10 2016 +0100

----------------------------------------------------------------------
 components/camel-cm/pom.xml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/5d015b93/components/camel-cm/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-cm/pom.xml b/components/camel-cm/pom.xml
index ff66e28..9d010f4 100644
--- a/components/camel-cm/pom.xml
+++ b/components/camel-cm/pom.xml
@@ -12,13 +12,16 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 	<modelVersion>4.0.0</modelVersion>
+	
 	<parent>
 		<groupId>org.apache.camel</groupId>
 		<artifactId>components</artifactId>
-		<version>2.16.2</version>
+		<version>2.18-SNAPSHOT</version>
 	</parent>
+	
 	<artifactId>camel-cm</artifactId>
 	<packaging>bundle</packaging>
+	
 	<name>Camel :: CM</name>
 	<description>Camel CM Component</description>
 


[09/23] camel git commit: LOG instance removed. Parent Logger is going to be used.

Posted by da...@apache.org.
LOG instance removed. Parent Logger is going to be used. 

Logging debug level instead of info. 

CMProducer is a Processor. process() method throws Exception. Let camel
do the work and not catch exceptions. 

In order to obtain the payload, Message.getMandatoryBody() is used
instead of getBody() so there is no need to the check if the payload is
null. Camel 's InvalidPayloadException is going to be thrown. 

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

Branch: refs/heads/master
Commit: 354e7e93c7cbbfaabbb1cf3f591e0847870f4608
Parents: 0bd5398
Author: oalles <oa...@neivi.es>
Authored: Mon Mar 21 13:11:09 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 23 18:46:10 2016 +0100

----------------------------------------------------------------------
 .../apache/camel/component/cm/CMProducer.java   | 324 +++++++++----------
 1 file changed, 159 insertions(+), 165 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/354e7e93/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java
index d175750..3ae6d9a 100644
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java
@@ -1,165 +1,159 @@
-/**
- * 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.cm;
-
-import java.util.Set;
-
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.component.cm.client.SMSMessage;
-import org.apache.camel.component.cm.exceptions.HostUnavailableException;
-import org.apache.camel.component.cm.exceptions.InvalidPayloadException;
-import org.apache.camel.impl.DefaultProducer;
-import org.apache.http.client.methods.HttpHead;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * is the exchange processor. Sends a validated sms message to CM Endpoints.
- */
-public class CMProducer extends DefaultProducer {
-
-    private static final Logger LOG = LoggerFactory.getLogger(CMProducer.class);
-
-    private Validator validator;
-
-    /**
-     * sends a valid message to CM endpoints.
-     */
-    private CMSender sender;
-
-    public CMProducer(final CMEndpoint endpoint, final CMSender sender) {
-        super(endpoint);
-        this.sender = sender;
-    }
-
-    /**
-     * Producer is a exchange processor. This process is built in several steps. 1. Validate message receive from client 2. Send validated message to CM endpoints. 3. Process response from CM
-     * endpoints.
-     */
-    @Override
-    public void process(final Exchange exchange) {
-
-        try {
-
-            // Immutable message receive from clients.
-            final SMSMessage smsMessage = exchange.getIn().getBody(SMSMessage.class);
-            if (smsMessage == null) {
-                throw new NullPointerException();
-            }
-
-            // Validates Payload - SMSMessage
-            LOG.trace("Validating SMSMessage instance provided: {}", smsMessage.toString());
-            final Set<ConstraintViolation<SMSMessage>> constraintViolations = getValidator().validate(smsMessage);
-            if (constraintViolations.size() > 0) {
-                final StringBuffer msg = new StringBuffer();
-                for (final ConstraintViolation<SMSMessage> cv : constraintViolations) {
-                    msg.append(String.format("- Invalid value for %s: %s", cv.getPropertyPath().toString(), cv.getMessage()));
-                }
-                throw new InvalidPayloadException(msg.toString());
-            }
-            LOG.trace("SMSMessage instance is valid: {}", smsMessage.toString());
-
-            // We have a valid (immutable) SMSMessage instance, lets extend to CMMessage
-            // This is the instance we will use to build the XML document to be
-            // sent to CM SMS GW.
-            final CMMessage cmMessage = new CMMessage(smsMessage.getPhoneNumber(), smsMessage.getMessage());
-            LOG.debug("CMMessage instance build from valid SMSMessage instance");
-
-            if (smsMessage.getFrom() == null || smsMessage.getFrom().isEmpty()) {
-                String df = getConfiguration().getDefaultFrom();
-                cmMessage.setSender(df);
-                LOG.debug("Dynamic sender is set to default dynamic sender: {}", df);
-            }
-
-            // Remember, this can be null.
-            cmMessage.setIdAsString(smsMessage.getId());
-
-            // Unicode and multipart
-            cmMessage.setUnicodeAndMultipart(getConfiguration().getDefaultMaxNumberOfParts());
-
-            // 2. Send a validated sms message to CM endpoints
-            // throws MessagingException for abnormal situations.
-            sender.send(cmMessage);
-
-            log.debug("Request accepted by CM Host: {}", cmMessage.toString());
-        } catch (final NullPointerException e) {
-            // Body hast to be an instance of SMSMessage
-            final String m = "Check Message body - Has to be an SMSMessage instance";
-            log.error(m, e);
-            exchange.setException(new InvalidPayloadException(m));
-        } catch (final RuntimeException e) {
-            log.error("Message cannot be sent ", e);
-            exchange.setException(e);
-        }
-    }
-
-    @Override
-    protected void doStart() throws Exception {
-
-        // log at debug level for singletons, for prototype scoped log at trace
-        // level to not spam logs
-
-        log.debug("Starting CMProducer");
-
-        final CMConfiguration configuration = getConfiguration();
-
-        if (configuration.isTestConnectionOnStartup()) {
-            try {
-                log.debug("Checking connection - {}", getEndpoint().getCMUrl());
-                HttpClientBuilder.create().build().execute(new HttpHead(getEndpoint().getCMUrl()));
-                log.info("Connection to {}: OK", getEndpoint().getCMUrl());
-            } catch (final Exception e) {
-                log.info("Connection to {}: NOT AVAILABLE", getEndpoint().getCMUrl());
-                throw new HostUnavailableException(e);
-            }
-        }
-
-        // keep starting
-        super.doStart();
-
-        log.info("CMProducer started");
-    }
-
-    @Override
-    public CMEndpoint getEndpoint() {
-        return (CMEndpoint) super.getEndpoint();
-    }
-
-    public CMConfiguration getConfiguration() {
-        return getEndpoint().getConfiguration();
-    }
-
-    public Validator getValidator() {
-        if (validator == null) {
-            validator = getEndpoint().getComponent().getValidator();
-        }
-        return validator;
-    }
-
-    public CMSender getSender() {
-        return sender;
-    }
-
-    public void setSender(CMSender sender) {
-        this.sender = sender;
-    }
-
-}
+/**
+ * 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.cm;
+
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.component.cm.client.SMSMessage;
+import org.apache.camel.component.cm.exceptions.HostUnavailableException;
+import org.apache.camel.component.cm.exceptions.InvalidPayloadException;
+import org.apache.camel.impl.DefaultProducer;
+import org.apache.http.client.methods.HttpHead;
+import org.apache.http.impl.client.HttpClientBuilder;
+
+/**
+ * is the exchange processor. Sends a validated sms message to CM Endpoints.
+ */
+public class CMProducer extends DefaultProducer {
+
+    private Validator validator;
+
+    /**
+     * sends a valid message to CM endpoints.
+     */
+    private CMSender sender;
+
+    public CMProducer(final CMEndpoint endpoint, final CMSender sender) {
+        super(endpoint);
+        this.sender = sender;
+    }
+
+    /**
+     * Producer is a exchange processor. This process is built in several steps.
+     * 1. Validate message receive from client 2. Send validated message to CM
+     * endpoints. 3. Process response from CM endpoints.
+     */
+    @Override
+    public void process(final Exchange exchange) throws Exception {
+
+        // Immutable message receive from clients. Throws camel ' s
+        // InvalidPayloadException
+        final SMSMessage smsMessage = exchange.getIn()
+                .getMandatoryBody(SMSMessage.class);
+
+        // Validates Payload - SMSMessage
+        log.trace("Validating SMSMessage instance provided: {}",
+                smsMessage.toString());
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = getValidator()
+                .validate(smsMessage);
+        if (constraintViolations.size() > 0) {
+            final StringBuffer msg = new StringBuffer();
+            for (final ConstraintViolation<SMSMessage> cv : constraintViolations) {
+                msg.append(String.format("- Invalid value for %s: %s",
+                        cv.getPropertyPath().toString(), cv.getMessage()));
+            }
+            throw new InvalidPayloadException(msg.toString());
+        }
+        log.trace("SMSMessage instance is valid: {}", smsMessage.toString());
+
+        // We have a valid (immutable) SMSMessage instance, lets extend to
+        // CMMessage
+        // This is the instance we will use to build the XML document to be
+        // sent to CM SMS GW.
+        final CMMessage cmMessage = new CMMessage(smsMessage.getPhoneNumber(),
+                smsMessage.getMessage());
+        log.debug("CMMessage instance build from valid SMSMessage instance");
+
+        if (smsMessage.getFrom() == null || smsMessage.getFrom().isEmpty()) {
+            String df = getConfiguration().getDefaultFrom();
+            cmMessage.setSender(df);
+            log.debug("Dynamic sender is set to default dynamic sender: {}",
+                    df);
+        }
+
+        // Remember, this can be null.
+        cmMessage.setIdAsString(smsMessage.getId());
+
+        // Unicode and multipart
+        cmMessage.setUnicodeAndMultipart(
+                getConfiguration().getDefaultMaxNumberOfParts());
+
+        // 2. Send a validated sms message to CM endpoints
+        // throws MessagingException for abnormal situations.
+        sender.send(cmMessage);
+
+        log.debug("Request accepted by CM Host: {}", cmMessage.toString());
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+
+        // log at debug level for singletons, for prototype scoped log at trace
+        // level to not spam logs
+
+        log.debug("Starting CMProducer");
+
+        final CMConfiguration configuration = getConfiguration();
+
+        if (configuration.isTestConnectionOnStartup()) {
+            try {
+                log.debug("Checking connection - {}", getEndpoint().getCMUrl());
+                HttpClientBuilder.create().build()
+                        .execute(new HttpHead(getEndpoint().getCMUrl()));
+                log.debug("Connection to {}: OK", getEndpoint().getCMUrl());
+            } catch (final Exception e) {
+                log.debug("Connection to {}: NOT AVAILABLE",
+                        getEndpoint().getCMUrl());
+                throw new HostUnavailableException(e);
+            }
+        }
+
+        // keep starting
+        super.doStart();
+
+        log.debug("CMProducer started");
+    }
+
+    @Override
+    public CMEndpoint getEndpoint() {
+        return (CMEndpoint) super.getEndpoint();
+    }
+
+    public CMConfiguration getConfiguration() {
+        return getEndpoint().getConfiguration();
+    }
+
+    public Validator getValidator() {
+        if (validator == null) {
+            validator = getEndpoint().getComponent().getValidator();
+        }
+        return validator;
+    }
+
+    public CMSender getSender() {
+        return sender;
+    }
+
+    public void setSender(CMSender sender) {
+        this.sender = sender;
+    }
+
+}


[20/23] camel git commit: Polished

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
deleted file mode 100644
index ab26e14..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * 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.cm;
-
-import java.util.Map;
-import java.util.Set;
-
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-
-import org.apache.camel.BeanInject;
-import org.apache.camel.CamelContext;
-import org.apache.camel.Endpoint;
-import org.apache.camel.ResolveEndpointFailedException;
-import org.apache.camel.impl.UriEndpointComponent;
-import org.apache.camel.util.URISupport;
-import org.apache.commons.validator.routines.UrlValidator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Represents the component that manages {@link CMEndpoint}s.
- */
-public class CMComponent extends UriEndpointComponent {
-
-    private static final Logger LOG = LoggerFactory.getLogger(CMComponent.class);
-
-    @BeanInject
-    private Validator validator;
-
-    // public CMComponent() {
-    // super(CMEndpoint.class);
-    // }
-
-    public CMComponent(final CamelContext context) {
-        super(context, CMEndpoint.class);
-    }
-
-    /**
-     * Endpoints factory
-     */
-    @Override
-    protected Endpoint createEndpoint(final String uri, final String remaining, final Map<String, Object> parameters) throws Exception {
-
-        LOG.debug("Creating CM Endpoint ... ");
-
-        final String url = CMConstants.DEFAULT_SCHEME + remaining;
-        if (!UrlValidator.getInstance().isValid(url)) {
-            throw new ResolveEndpointFailedException(uri, String.format("HOST provided: %s seem to be invalid. Remember SCHEME has to be excluded.", url));
-        }
-
-        LOG.debug("Uri=[{}], path=[{}], parameters=[{}]", new Object[] {URISupport.sanitizeUri(uri), URISupport.sanitizePath(remaining), parameters });
-
-        // Set configuration based on uri parameters
-        final CMConfiguration config = new CMConfiguration();
-        setProperties(config, parameters);
-
-        // Validate configuration
-        LOG.debug("Validating uri based configuration");
-        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(config);
-        if (constraintViolations.size() > 0) {
-            final StringBuffer msg = new StringBuffer();
-            for (final ConstraintViolation<CMConfiguration> cv : constraintViolations) {
-                msg.append(String.format("- Invalid value for %s: %s", cv.getPropertyPath().toString(), cv.getMessage()));
-            }
-            throw new ResolveEndpointFailedException(uri, msg.toString());
-        }
-        LOG.debug("CMConfiguration - OK!");
-
-        // Component is an Endpoint factory. So far, just one Endpoint type.
-        // Endpoint construction and configuration.
-
-        LOG.debug("Creating CMEndpoint");
-        final CMEndpoint endpoint = new CMEndpoint(uri, this);
-        endpoint.setConfiguration(config);
-        endpoint.setHost(remaining);
-
-        return endpoint;
-    }
-
-    public Validator getValidator() {
-        return validator;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConfiguration.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConfiguration.java
deleted file mode 100644
index c95c06e..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConfiguration.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * 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.cm;
-
-import java.util.UUID;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-
-import org.apache.camel.spi.UriParam;
-import org.apache.camel.spi.UriParams;
-
-@UriParams
-public class CMConfiguration {
-
-    @UriParam
-    @NotNull
-    private UUID productToken;
-
-    /**
-     * This is the sender name. The maximum length is 11 characters.
-     */
-    @UriParam
-    @NotNull
-    @Size(min = 1, max = 11)
-    private String defaultFrom;
-
-    /**
-     * If it is a multipart message forces the max number. Message can be truncated. Technically the gateway will first check if a message is larger than 160 characters, if so, the message will be cut
-     * into multiple 153 characters parts limited by these parameters. <br>
-     * {@link https://dashboard.onlinesmsgateway.com/docs#send-a-message-multipart}
-     */
-    @UriParam
-    @Max(8)
-    @Min(1)
-    private int defaultMaxNumberOfParts = 8;
-
-    @UriParam
-    private boolean testConnectionOnStartup;
-
-    public UUID getProductToken() {
-        return productToken;
-    }
-
-    public void setProductToken(String productTokenAsString) {
-        productToken = UUID.fromString(productTokenAsString);
-    }
-
-    public String getDefaultFrom() {
-        return defaultFrom;
-    }
-
-    public void setDefaultFrom(final String defaultFrom) {
-        this.defaultFrom = defaultFrom;
-    }
-
-    public int getDefaultMaxNumberOfParts() {
-        return defaultMaxNumberOfParts;
-    }
-
-    public void setDefaultMaxNumberOfParts(final int defaultMaxNumberOfParts) {
-        this.defaultMaxNumberOfParts = defaultMaxNumberOfParts;
-    }
-
-    public boolean isTestConnectionOnStartup() {
-        return testConnectionOnStartup;
-    }
-
-    public void setTestConnectionOnStartup(final boolean testConnectionOnStartup) {
-        this.testConnectionOnStartup = testConnectionOnStartup;
-    }
-
-    public void setProductTokenAsUUID(final UUID productToken) {
-        this.productToken = productToken;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConstants.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConstants.java
deleted file mode 100644
index afe8fde..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConstants.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.cm;
-
-public interface CMConstants {
-
-    String DEFAULT_SCHEME = "https://";
-
-    int DEFAULT_MULTIPARTS = 8;
-
-    int MAX_UNICODE_MESSAGE_LENGTH = 70;
-    int MAX_GSM_MESSAGE_LENGTH = 160;
-    int MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART = 67;
-    int MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART = 153;
-
-    // status code 200 - Error substrings - check it contains.
-    String ERROR_UNKNOWN = "Unknown error";
-    String ERROR_NO_ACCOUNT = "No account found";
-    String ERROR_INSUFICIENT_BALANCE = "Insufficient balance";
-    String ERROR_UNROUTABLE_MESSAGE = "Message is unroutable";
-    String ERROR_INVALID_PRODUCT_TOKEN = "Invalid product token";
-
-    // TODO: Review this pattern.
-    // or it should be foundnd an alternative to jcharset to check if a message is GSM 03.38 encodable
-    // See:
-    // https://en.wikipedia.org/wiki/GSM_03.38
-    // http://frightanic.com/software-development/regex-for-gsm-03-38-7bit-character-set/
-    String GSM_0338_REGEX = "^[A-Za-z0-9 \\r\\n@£$\u0394_\u03A6\u0393\u039B\u03A9\u03A0\u03A8\u03A3\u0398\u039E!\"#$%&amp;'()*+,\\-./:;&lt;=&gt;?¡¿^{}\\\\\\[~\\]|"
-                            + "\u20AC\u00a5\u00e8\u00e9\u00f9\u00ec\u00f2\u00c7\u00d8\u00f8\u00c5\u00e5\u00c6\u00e6\u00df\u00c9\u00c4\u00d6\u00d1\u00dc\u00a7\u00e4\u00f6\u00f1\u00fc\u00e0]*$";
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMEndpoint.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMEndpoint.java
deleted file mode 100644
index 860967d..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMEndpoint.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * 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.cm;
-
-import org.apache.camel.Consumer;
-import org.apache.camel.ExchangePattern;
-import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.api.management.ManagedAttribute;
-import org.apache.camel.api.management.ManagedOperation;
-import org.apache.camel.api.management.ManagedResource;
-import org.apache.camel.impl.DefaultEndpoint;
-import org.apache.camel.spi.Metadata;
-import org.apache.camel.spi.UriPath;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@ManagedResource(description = "CM SMS Endpoint")
-// @UriEndpoint(scheme = "cm", title = "CM DIRECT SMS", syntax = "cm:host",
-// label = "sms provider", producerOnly = true)
-public class CMEndpoint extends DefaultEndpoint {
-
-    private static final Logger LOG = LoggerFactory.getLogger(CMEndpoint.class);
-
-    @UriPath
-    @Metadata(description = "SMS Provider HOST with scheme", required = "true")
-    private String host;
-
-    /**
-     * data needed for exchange interaction
-     */
-    private CMConfiguration configuration;
-
-    private CMProducer producer;
-
-    /**
-     * Constructs a partially-initialized CMEndpoint instance. Useful when creating endpoints manually (e.g., as beans in Spring).
-     */
-    // We are just going to allow fully initialized endpoint instances
-    // public CMEndpoint() {
-    // }
-
-    /**
-     * Constructs a fully-initialized CMEndpoint instance. This is the preferred method of constructing an object from Java code (as opposed to Spring beans, etc.).
-     *
-     * @param endpointUri the full URI used to create this endpoint
-     * @param component the component that created this endpoint
-     */
-    public CMEndpoint(final String uri, final CMComponent component) {
-        super(uri, component);
-        setExchangePattern(ExchangePattern.InOut);
-        LOG.debug("CM Endpoint created");
-    }
-
-    /**
-     * Provides a channel on which clients can send Messages to a CM Endpoint
-     */
-    @Override
-    public Producer createProducer() throws Exception {
-        final CMConfiguration config = getConfiguration();
-
-        // This is the camel exchange processor. Allows to send messages to CM
-        // API.
-        // TODO: Should i provide a CMSender factory? Dynamically choose
-        // CMSender implementation? Sending strategy?
-        // Consider:
-        // 1. single - Single Message strategy.
-        // 2. Multi - CM Api supports to 1000 messages per call.
-        // 3. sliding - sliding window? 1000 messages or time thresold?
-        // 4. mocked - in order to fake cm responses
-
-        // CMConstants.DEFAULT_SCHEME + host is a valid URL. It was previously
-        // checked
-        LOG.debug("Creating CM Producer");
-        producer = new CMProducer(this, new CMSenderOneMessageImpl(getCMUrl(), config.getProductToken()));
-        LOG.debug("CM Producer: OK!");
-        return producer;
-    }
-
-    @Override
-    public Consumer createConsumer(final Processor processor) throws Exception {
-
-        throw new RuntimeCamelException("So far, cannot consume from CM Endpoint: " + getEndpointUri());
-    }
-
-    public CMConfiguration getConfiguration() {
-        return configuration;
-    }
-
-    public void setConfiguration(final CMConfiguration configuration) {
-        this.configuration = configuration;
-    }
-
-    @Override
-    public boolean isSingleton() {
-        return true;
-    }
-
-    // @Override
-    // public Exchange createExchange() {
-    // return super.createExchange();
-    // }
-
-    @ManagedAttribute
-    public String getHost() {
-        return host;
-    }
-
-    public String getCMUrl() {
-        return CMConstants.DEFAULT_SCHEME + host;
-    }
-
-    @ManagedOperation(description = "Dynamically modify Service HOST")
-    public void setHost(final String host) {
-        this.host = host;
-    }
-
-    @Override
-    public CMComponent getComponent() {
-        return (CMComponent) super.getComponent();
-    }
-
-    public CMProducer getProducer() {
-        return producer;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMMessage.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMMessage.java
deleted file mode 100644
index 2f98936..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMMessage.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
- * 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.cm;
-
-/**
- * Valid message to be serialized and sent to CM Endpoints. If the message only uses GSM 7-bit characters, then 160 characters will fit in 1 SMS part, and 153*n characters will fit in n SMS parts for
- * n>1. If the message contains other characters, then only 70 characters will fit in 1 SMS part, and 67*n characters will fit in n SMS parts for n>1. <br>
- * <br>
- * {@link https://dashboard.onlinesmsgateway.com/docs} <br>
- * {@link http://support.telerivet.com/customer/portal/articles/1957426-multipart-unicode-sms-messages}
- */
-public class CMMessage {
-
-    /**
-     * Restrictions: 1 - 32 alphanumeric characters and reference will not work for demo accounts
-     */
-    // TODO: use a ID generator?
-    private String idAsString;
-
-    private String phoneNumber;
-    private String message;
-
-    private String sender;
-
-    private boolean unicode;
-    private int multipart = 1;
-
-    public CMMessage(final String phoneNumber, final String message) {
-        this.message = message;
-        this.phoneNumber = phoneNumber;
-    }
-
-    public String getMessage() {
-        return message;
-    }
-
-    public void setMessage(final String message) {
-        this.message = message;
-    }
-
-    public String getPhoneNumber() {
-        return phoneNumber;
-    }
-
-    public void setPhoneNumber(final String phoneNumber) {
-        this.phoneNumber = phoneNumber;
-    }
-
-    public String getSender() {
-        return sender;
-    }
-
-    public void setSender(final String sender) {
-        this.sender = sender;
-    }
-
-    public String getIdAsString() {
-        return idAsString;
-    }
-
-    public void setIdAsString(final String idAsString) {
-        this.idAsString = idAsString;
-    }
-
-    public boolean isUnicode() {
-        return unicode;
-    }
-
-    public void setUnicode(final boolean unicode) {
-        this.unicode = unicode;
-    }
-
-    public boolean isMultipart() {
-        return multipart > 1;
-    }
-
-    /**
-     * For a CMMessage instance
-     *
-     * @param defaultMaxNumberOfParts
-     */
-    public void setUnicodeAndMultipart(int defaultMaxNumberOfParts) {
-
-        // Set UNICODE and MULTIPART
-        final String msg = getMessage();
-        if (CMUtils.isGsm0338Encodeable(msg)) {
-
-            // Not Unicode is Multipart?
-            if (msg.length() > CMConstants.MAX_GSM_MESSAGE_LENGTH) {
-
-                // Multiparts. 153 caracteres max per part
-                int parts = msg.length() / CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART;
-                if (msg.length() % CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART != 0) {
-                    parts++;
-                }
-
-                setMultiparts((parts > defaultMaxNumberOfParts) ? defaultMaxNumberOfParts : parts);
-            } else { // Otherwise multipart = 1
-                setMultiparts(1);
-            }
-        } else {
-            // Unicode Message
-            setUnicode(true);
-
-            if (msg.length() > CMConstants.MAX_UNICODE_MESSAGE_LENGTH) {
-
-                // Multiparts. 67 caracteres max per part
-                int parts = msg.length() / CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART;
-                if (msg.length() % CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART != 0) {
-                    parts++;
-                }
-
-                setMultiparts((parts > defaultMaxNumberOfParts) ? defaultMaxNumberOfParts : parts);
-            } else { // Otherwise multipart = 1
-                setMultiparts(1);
-            }
-        }
-    }
-
-    public void setMultiparts(final int multipart) {
-        this.multipart = multipart;
-    }
-
-    public int getMultiparts() {
-        return multipart;
-    }
-
-    @Override
-    public String toString() {
-
-        StringBuffer sb = new StringBuffer(" {phoneNumber: " + phoneNumber + ", message: " + message + ", sender=" + sender + ", unicode: " + unicode + ", multipart: " + multipart);
-        if (idAsString != null && !idAsString.isEmpty()) {
-            sb.append(", idAsString=" + idAsString);
-        }
-        sb.append(" }");
-        return sb.toString();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java
deleted file mode 100644
index e4f5722..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- * 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.cm;
-
-import java.util.Set;
-
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.InvalidPayloadRuntimeException;
-import org.apache.camel.component.cm.client.SMSMessage;
-import org.apache.camel.component.cm.exceptions.HostUnavailableException;
-import org.apache.camel.impl.DefaultProducer;
-import org.apache.http.client.methods.HttpHead;
-import org.apache.http.impl.client.HttpClientBuilder;
-
-/**
- * is the exchange processor. Sends a validated sms message to CM Endpoints.
- */
-public class CMProducer extends DefaultProducer {
-
-    private Validator validator;
-
-    /**
-     * sends a valid message to CM endpoints.
-     */
-    private CMSender sender;
-
-    public CMProducer(final CMEndpoint endpoint, final CMSender sender) {
-        super(endpoint);
-        this.sender = sender;
-    }
-
-    /**
-     * Producer is a exchange processor. This process is built in several steps. 1. Validate message receive from client 2. Send validated message to CM endpoints. 3. Process response from CM
-     * endpoints.
-     */
-    @Override
-    public void process(final Exchange exchange) throws Exception {
-
-        // Immutable message receive from clients. Throws camel ' s
-        // InvalidPayloadException
-        final SMSMessage smsMessage = exchange.getIn().getMandatoryBody(SMSMessage.class);
-
-        // Validates Payload - SMSMessage
-        log.trace("Validating SMSMessage instance provided: {}", smsMessage.toString());
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = getValidator().validate(smsMessage);
-        if (constraintViolations.size() > 0) {
-            final StringBuffer msg = new StringBuffer();
-            for (final ConstraintViolation<SMSMessage> cv : constraintViolations) {
-                msg.append(String.format("- Invalid value for %s: %s", cv.getPropertyPath().toString(), cv.getMessage()));
-            }
-            log.debug(msg.toString());
-            throw new InvalidPayloadRuntimeException(exchange, SMSMessage.class);
-        }
-        log.trace("SMSMessage instance is valid: {}", smsMessage.toString());
-
-        // We have a valid (immutable) SMSMessage instance, lets extend to
-        // CMMessage
-        // This is the instance we will use to build the XML document to be
-        // sent to CM SMS GW.
-        final CMMessage cmMessage = new CMMessage(smsMessage.getPhoneNumber(), smsMessage.getMessage());
-        log.debug("CMMessage instance build from valid SMSMessage instance");
-
-        if (smsMessage.getFrom() == null || smsMessage.getFrom().isEmpty()) {
-            String df = getConfiguration().getDefaultFrom();
-            cmMessage.setSender(df);
-            log.debug("Dynamic sender is set to default dynamic sender: {}", df);
-        }
-
-        // Remember, this can be null.
-        cmMessage.setIdAsString(smsMessage.getId());
-
-        // Unicode and multipart
-        cmMessage.setUnicodeAndMultipart(getConfiguration().getDefaultMaxNumberOfParts());
-
-        // 2. Send a validated sms message to CM endpoints
-        //  for abnormal situations.
-        sender.send(cmMessage);
-
-        log.debug("Request accepted by CM Host: {}", cmMessage.toString());
-    }
-
-    @Override
-    protected void doStart() throws Exception {
-
-        // log at debug level for singletons, for prototype scoped log at trace
-        // level to not spam logs
-
-        log.debug("Starting CMProducer");
-
-        final CMConfiguration configuration = getConfiguration();
-
-        if (configuration.isTestConnectionOnStartup()) {
-            try {
-                log.debug("Checking connection - {}", getEndpoint().getCMUrl());
-                HttpClientBuilder.create().build().execute(new HttpHead(getEndpoint().getCMUrl()));
-                log.debug("Connection to {}: OK", getEndpoint().getCMUrl());
-            } catch (final Exception e) {
-                throw new HostUnavailableException(String.format("Connection to %s: NOT AVAILABLE", getEndpoint().getCMUrl()), e);
-            }
-        }
-
-        // keep starting
-        super.doStart();
-
-        log.debug("CMProducer started");
-    }
-
-    @Override
-    public CMEndpoint getEndpoint() {
-        return (CMEndpoint) super.getEndpoint();
-    }
-
-    public CMConfiguration getConfiguration() {
-        return getEndpoint().getConfiguration();
-    }
-
-    public Validator getValidator() {
-        if (validator == null) {
-            validator = getEndpoint().getComponent().getValidator();
-        }
-        return validator;
-    }
-
-    public CMSender getSender() {
-        return sender;
-    }
-
-    public void setSender(CMSender sender) {
-        this.sender = sender;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSender.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSender.java
deleted file mode 100644
index 661f4dd..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSender.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * 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.cm;
-
-/**
- * Sends a validated sms message to CM endpoints
- */
-public interface CMSender {
-
-    /**
-     * Sends a validated sms message to CM Endpoints.
-     */
-    void send(CMMessage cmMessage);
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
deleted file mode 100644
index 07e0e14..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/**
- * 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.cm;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.charset.Charset;
-import java.util.UUID;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Text;
-
-import org.apache.camel.component.cm.exceptions.CMDirectException;
-import org.apache.camel.component.cm.exceptions.XMLConstructionException;
-import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
-import org.apache.camel.component.cm.exceptions.cmresponse.InsufficientBalanceException;
-import org.apache.camel.component.cm.exceptions.cmresponse.InvalidProductTokenException;
-import org.apache.camel.component.cm.exceptions.cmresponse.NoAccountFoundForProductTokenException;
-import org.apache.camel.component.cm.exceptions.cmresponse.UnknownErrorException;
-import org.apache.camel.component.cm.exceptions.cmresponse.UnroutableMessageException;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class CMSenderOneMessageImpl implements CMSender {
-
-    private static final Logger LOG = LoggerFactory.getLogger(CMSenderOneMessageImpl.class);
-
-    private final String url;
-    private final UUID productToken;
-
-    public CMSenderOneMessageImpl(final String url, final UUID productToken) {
-
-        this.url = url;
-        this.productToken = productToken;
-    }
-
-    /**
-     * Sends a message to CM endpoints. 1. CMMessage instance is going to be marshalled to xml. 2. Post request xml string to CMEndpoint.
-     */
-    @Override
-    public void send(final CMMessage cmMessage) {
-
-        // See: Check https://dashboard.onlinesmsgateway.com/docs for responses
-
-        // 1.Construct XML. Throws XMLConstructionException
-        final String xml = createXml(cmMessage);
-
-        // 2. Try to send to CM SMS Provider ...Throws CMResponseException
-        doHttpPost(url, xml);
-    }
-
-    private String createXml(final CMMessage message) {
-
-        try {
-
-            final ByteArrayOutputStream xml = new ByteArrayOutputStream();
-            final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-            factory.setNamespaceAware(true);
-
-            // Get the DocumentBuilder
-            final DocumentBuilder docBuilder = factory.newDocumentBuilder();
-
-            // Create blank DOM Document
-            final DOMImplementation impl = docBuilder.getDOMImplementation();
-            final Document doc = impl.createDocument(null, "MESSAGES", null);
-
-            // ROOT Element es MESSAGES
-            final Element root = doc.getDocumentElement();
-
-            // AUTHENTICATION element
-            final Element authenticationElement = doc.createElement("AUTHENTICATION");
-            final Element productTokenElement = doc.createElement("PRODUCTTOKEN");
-            authenticationElement.appendChild(productTokenElement);
-            final Text productTokenValue = doc.createTextNode("" + productToken);
-            productTokenElement.appendChild(productTokenValue);
-            root.appendChild(authenticationElement);
-
-            // MSG Element
-            final Element msgElement = doc.createElement("MSG");
-            root.appendChild(msgElement);
-
-            // <FROM>VALUE</FROM>
-            final Element fromElement = doc.createElement("FROM");
-            fromElement.appendChild(doc.createTextNode(message.getSender()));
-            msgElement.appendChild(fromElement);
-
-            // <BODY>VALUE</BODY>
-            final Element bodyElement = doc.createElement("BODY");
-            bodyElement.appendChild(doc.createTextNode(message.getMessage()));
-            msgElement.appendChild(bodyElement);
-
-            // <TO>VALUE</TO>
-            final Element toElement = doc.createElement("TO");
-            toElement.appendChild(doc.createTextNode(message.getPhoneNumber()));
-            msgElement.appendChild(toElement);
-
-            // <DCS>VALUE</DCS> - if UNICODE - messageOut.isGSM338Enc
-            // false
-            if (message.isUnicode()) {
-                final Element dcsElement = doc.createElement("DCS");
-                dcsElement.appendChild(doc.createTextNode("8"));
-                msgElement.appendChild(dcsElement);
-            }
-
-            // <REFERENCE>VALUE</REFERENCE> -Alfanum
-            final String id = message.getIdAsString();
-            if (id != null && !id.isEmpty()) {
-                final Element refElement = doc.createElement("REFERENCE");
-                refElement.appendChild(doc.createTextNode("" + message.getIdAsString()));
-                msgElement.appendChild(refElement);
-            }
-
-            // <MINIMUMNUMBEROFMESSAGEPARTS>1</MINIMUMNUMBEROFMESSAGEPARTS>
-            // <MAXIMUMNUMBEROFMESSAGEPARTS>8</MAXIMUMNUMBEROFMESSAGEPARTS>
-            if (message.isMultipart()) {
-                final Element minMessagePartsElement = doc.createElement("MINIMUMNUMBEROFMESSAGEPARTS");
-                minMessagePartsElement.appendChild(doc.createTextNode("1"));
-                msgElement.appendChild(minMessagePartsElement);
-
-                final Element maxMessagePartsElement = doc.createElement("MAXIMUMNUMBEROFMESSAGEPARTS");
-                maxMessagePartsElement.appendChild(doc.createTextNode(Integer.toString(message.getMultiparts())));
-                msgElement.appendChild(maxMessagePartsElement);
-            }
-
-            // Creatate XML as String
-            final Transformer aTransformer = TransformerFactory.newInstance().newTransformer();
-            aTransformer.setOutputProperty(OutputKeys.INDENT, "yes");
-            final Source src = new DOMSource(doc);
-            final Result dest = new StreamResult(xml);
-            aTransformer.transform(src, dest);
-            return xml.toString();
-        } catch (final TransformerException e) {
-            throw new XMLConstructionException(String.format("Cant serialize CMMessage %s", message), e);
-        } catch (final ParserConfigurationException e) {
-            throw new XMLConstructionException(String.format("Cant serialize CMMessage %s", message), e);
-        }
-    }
-
-    private void doHttpPost(final String urlString, final String requestString) {
-
-        final HttpClient client = HttpClientBuilder.create().build();
-        final HttpPost post = new HttpPost(urlString);
-        post.setEntity(new StringEntity(requestString, Charset.forName("UTF-8")));
-
-        try {
-
-            final HttpResponse response = client.execute(post);
-
-            final int statusCode = response.getStatusLine().getStatusCode();
-
-            LOG.debug("Response Code : {}", statusCode);
-
-            if (statusCode == 400) {
-                throw new CMDirectException("CM Component and CM API show some kind of inconsistency. "
-                                            + "CM is complaining about not using a post method for the request. And this component only uses POST requests. What happens?");
-            }
-
-            if (statusCode != 200) {
-                throw new CMDirectException("CM Component and CM API show some kind of inconsistency. The component expects the status code to be 200 or 400. New api released? ");
-            }
-
-            // So we have 200 status code...
-
-            // The response type is 'text/plain' and contains the actual
-            // result of the request processing.
-
-            // We obtaing the result text
-            final BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
-
-            final StringBuffer result = new StringBuffer();
-            String line = null;
-            while ((line = rd.readLine()) != null) {
-                result.append(line);
-            }
-
-            // ... and process it
-
-            line = result.toString();
-            if (!line.isEmpty()) {
-
-                // Line is not empty = error
-                LOG.debug("Result of the request processing: FAILED\n{}", line);
-
-                // The response text contains the error description. We will
-                // throw a custom exception for each.
-
-                if (line.contains(CMConstants.ERROR_UNKNOWN)) {
-                    throw new UnknownErrorException();
-                } else if (line.contains(CMConstants.ERROR_NO_ACCOUNT)) {
-                    throw new NoAccountFoundForProductTokenException();
-                } else if (line.contains(CMConstants.ERROR_INSUFICIENT_BALANCE)) {
-                    throw new InsufficientBalanceException();
-                } else if (line.contains(CMConstants.ERROR_UNROUTABLE_MESSAGE)) {
-                    throw new UnroutableMessageException();
-                } else if (line.contains(CMConstants.ERROR_INVALID_PRODUCT_TOKEN)) {
-                    throw new InvalidProductTokenException();
-                } else {
-
-                    // SO FAR i would expect other kind of ERROR.
-
-                    // MSISDN correctness and message validity is client
-                    // responsibility
-                    throw new CMResponseException("CHECK ME. I am not expecting this. ");
-                }
-            }
-
-            // Ok. Line is EMPTY - successfully submitted
-            LOG.debug("Result of the request processing: Successfully submited");
-        } catch (final IOException io) {
-            throw new CMDirectException(io);
-        } catch (Throwable t) {
-            if (!(t instanceof CMDirectException)) {
-                // Chain it
-                t = new CMDirectException(t);
-            }
-            throw (CMDirectException) t;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMUtils.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMUtils.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMUtils.java
deleted file mode 100644
index f0581da..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMUtils.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.cm;
-
-public final class CMUtils {
-
-    private CMUtils() {
-    }
-
-    public static boolean isGsm0338Encodeable(final String message) {
-        return message.matches(CMConstants.GSM_0338_REGEX);
-    }
-
-    // TODO: Have a look at
-    // https:// github.com/apache/camel/blob/master/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/client/SMSMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/client/SMSMessage.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/client/SMSMessage.java
deleted file mode 100644
index 869c9f8..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/client/SMSMessage.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * 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.cm.client;
-
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-import javax.validation.constraints.Size;
-
-import org.apache.camel.component.cm.validation.constraints.E164;
-
-/**
- * Immutable. The message instance provided by the client.
- */
-public class SMSMessage {
-
-    /**
-     * Required MSISDN. E164 value. The destination phone number. Format with a '+' and country code.
-     *
-     * @see <a href="https://en.wikipedia.org/wiki/E.164">https://en.wikipedia.org/wiki/E.164</a>
-     */
-    @E164
-    private final String phoneNumber;
-
-    /**
-     * This is the message to be sent. 2 options:
-     * <ul>
-     * <li>If the message is GSM 0038 encodeable the gateway will first check if a message is larger than 160 characters, if so, the message will be cut into multiple 153 characters parts limited by
-     * defaultMaxNumberOfParts set in the component uri.</li>
-     * <li>Otherwise, the gateway will check if a message is larger than 70 characters, if so, the message will be cut into multiple 67 characters parts to a maximum of defaultMaxNumberOfParts set in
-     * the component uri.</li>
-     * </ul>
-     *
-     * @see <a href="https://en.wikipedia.org/wiki/GSM_03.38">E.164</a>
-     */
-    @NotNull
-    private final String message;
-
-    /**
-     * This is an optional dynamic sender name.
-     * <p>
-     * 1 - 11 alphanumeric characters and + char. Not Empty Strings. This field has a maximum length of 11 characters. If it is not set the defaultFrom required to configure the component will be set.
-     */
-    @Size(min = 1, max = 11)
-    @Pattern(regexp = "^[A-Za-z0-9]+$")
-    private final String from;
-
-    /**
-     * Unique identifier for a message.
-     * <p>
-     * 1 - 32 alphanumeric characters. Not Empty Strings. Will not work for demo accounts. This field corresponds to REFERENCE parameter in CM Api.
-     */
-    @Size(min = 1, max = 32)
-    @Pattern(regexp = "^[A-Za-z0-9]+$")
-    private final String id;
-
-    public SMSMessage(final String message, final String phoneNumber) {
-        this(null, message, phoneNumber, null);
-    }
-
-    public SMSMessage(String id, final String message, final String phoneNumber) {
-        this(id, message, phoneNumber, null);
-    }
-
-    public SMSMessage(final String id, final String message, final String phoneNumber, final String from) {
-        this.id = id;
-        this.message = message;
-        this.phoneNumber = phoneNumber;
-        this.from = from;
-    }
-
-    public String getId() {
-        return id;
-    }
-
-    public String getMessage() {
-        return message;
-    }
-
-    public String getPhoneNumber() {
-        return phoneNumber;
-    }
-
-    public String getFrom() {
-        return from;
-    }
-
-    @Override
-    public String toString() {
-        StringBuffer toS = new StringBuffer("{phoneNumber: " + phoneNumber + ", message: " + message);
-        if (from != null && !from.isEmpty()) {
-            toS.append(", from: " + from);
-        }
-        if (id != null && !id.isEmpty()) {
-            toS.append(", id: " + id);
-        }
-        toS.append(" }");
-        return toS.toString();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/client/Translator.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/client/Translator.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/client/Translator.java
deleted file mode 100644
index 4c6e9e9..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/client/Translator.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * 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.cm.client;
-
-public interface Translator<T> {
-
-    SMSMessage translate(T t);
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/CMDirectException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/CMDirectException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/CMDirectException.java
deleted file mode 100644
index 70912ff..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/CMDirectException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.cm.exceptions;
-
-public class CMDirectException extends RuntimeException {
-
-    public CMDirectException() {
-    }
-
-    public CMDirectException(final String message) {
-        super(message);
-    }
-
-    public CMDirectException(final Throwable cause) {
-        super(cause);
-    }
-
-    public CMDirectException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-    public CMDirectException(final String message, final Throwable cause,
-            final boolean enableSuppression, final boolean writableStackTrace) {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/HostUnavailableException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/HostUnavailableException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/HostUnavailableException.java
deleted file mode 100644
index 73bf0d0..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/HostUnavailableException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.cm.exceptions;
-
-public class HostUnavailableException extends CMDirectException {
-
-    public HostUnavailableException() {
-    }
-
-    public HostUnavailableException(final String message) {
-        super(message);
-    }
-
-    public HostUnavailableException(final Throwable cause) {
-        super(cause);
-    }
-
-    public HostUnavailableException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-    public HostUnavailableException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/XMLConstructionException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/XMLConstructionException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/XMLConstructionException.java
deleted file mode 100644
index 5086e70..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/XMLConstructionException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.cm.exceptions;
-
-public class XMLConstructionException extends CMDirectException {
-
-    public XMLConstructionException() {
-    }
-
-    public XMLConstructionException(final String message) {
-        super(message);
-    }
-
-    public XMLConstructionException(final Throwable cause) {
-        super(cause);
-    }
-
-    public XMLConstructionException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-    public XMLConstructionException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/CMResponseException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/CMResponseException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/CMResponseException.java
deleted file mode 100644
index 4ed4f6e..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/CMResponseException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * 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.cm.exceptions.cmresponse;
-
-import org.apache.camel.component.cm.exceptions.CMDirectException;
-
-public class CMResponseException extends CMDirectException {
-
-    public CMResponseException() {
-    }
-
-    public CMResponseException(final String message) {
-        super(message);
-    }
-
-    public CMResponseException(final Throwable cause) {
-        super(cause);
-    }
-
-    public CMResponseException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-    public CMResponseException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InsufficientBalanceException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InsufficientBalanceException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InsufficientBalanceException.java
deleted file mode 100644
index bb73cc5..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InsufficientBalanceException.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * 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.cm.exceptions.cmresponse;
-
-/**
- * You are out of trial messages. Order new messages via your dashboard.
- */
-public class InsufficientBalanceException extends CMResponseException {
-
-    public InsufficientBalanceException() {
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidMSISDNException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidMSISDNException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidMSISDNException.java
deleted file mode 100644
index c80fbdd..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidMSISDNException.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * 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.cm.exceptions.cmresponse;
-
-public class InvalidMSISDNException extends CMResponseException {
-
-    public InvalidMSISDNException() {
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidProductTokenException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidProductTokenException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidProductTokenException.java
deleted file mode 100644
index ce81bcb..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidProductTokenException.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * 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.cm.exceptions.cmresponse;
-
-/**
- * Invalid or missing
- */
-public class InvalidProductTokenException extends CMResponseException {
-
-    public InvalidProductTokenException() {
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoAccountFoundForProductTokenException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoAccountFoundForProductTokenException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoAccountFoundForProductTokenException.java
deleted file mode 100644
index a718ff3..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoAccountFoundForProductTokenException.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * 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.cm.exceptions.cmresponse;
-
-/**
- * No account found for the provided product token.
- *
- * @author Omar
- */
-public class NoAccountFoundForProductTokenException extends CMResponseException {
-
-    public NoAccountFoundForProductTokenException() {
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoMessageException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoMessageException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoMessageException.java
deleted file mode 100644
index 4398219..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoMessageException.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * 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.cm.exceptions.cmresponse;
-
-public class NoMessageException extends CMResponseException {
-
-    public NoMessageException() {
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NotPhoneNumberFoundException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NotPhoneNumberFoundException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NotPhoneNumberFoundException.java
deleted file mode 100644
index 877b972..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NotPhoneNumberFoundException.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * 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.cm.exceptions.cmresponse;
-
-public class NotPhoneNumberFoundException extends CMResponseException {
-
-    public NotPhoneNumberFoundException() {
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnknownErrorException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnknownErrorException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnknownErrorException.java
deleted file mode 100644
index bb0951a..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnknownErrorException.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * 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.cm.exceptions.cmresponse;
-
-/**
- * An unexpected error occurred. Check the provided values. Contact CM for support.
- */
-public class UnknownErrorException extends CMResponseException {
-
-    public UnknownErrorException() {
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnroutableMessageException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnroutableMessageException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnroutableMessageException.java
deleted file mode 100644
index ec07c1f..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnroutableMessageException.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * 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.cm.exceptions.cmresponse;
-
-public class UnroutableMessageException extends CMResponseException {
-
-    public UnroutableMessageException() {
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/validation/constraints/E164.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/validation/constraints/E164.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/validation/constraints/E164.java
deleted file mode 100644
index 3d7dd95..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/validation/constraints/E164.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * 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.cm.validation.constraints;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.validation.Constraint;
-import javax.validation.Payload;
-
-@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER,
-        ElementType.ANNOTATION_TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-@Constraint(validatedBy = E164Validator.class)
-@Documented
-public @interface E164 {
-
-    // String message() default "{e164.message}";
-    String message() default "E164 format expected for that phone number";
-
-    Class<?>[] groups() default {};
-
-    Class<? extends Payload>[] payload() default {};
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/java/org/apache/camel/component/cm/validation/constraints/E164Validator.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/validation/constraints/E164Validator.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/validation/constraints/E164Validator.java
deleted file mode 100644
index d8160f7..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/validation/constraints/E164Validator.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * 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.cm.validation.constraints;
-
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
-
-import com.google.i18n.phonenumbers.NumberParseException;
-import com.google.i18n.phonenumbers.PhoneNumberUtil;
-import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
-import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
-
-/**
- * Checks that a given character sequence (e.g. string) is a valid E164 formatted phonenumber. https://www.cmtelecom.com/newsroom/how-to-format-international-telephone- numbers
- * https://github.com/googlei18n/libphonenumber
- */
-public class E164Validator implements ConstraintValidator<E164, String> {
-
-    private final PhoneNumberUtil pnu = PhoneNumberUtil.getInstance();
-
-    @Override
-    public void initialize(final E164 constraintAnnotation) {
-    }
-
-    @Override
-    public boolean isValid(final String value, final ConstraintValidatorContext context) {
-
-        if (value == null) {
-            return false;
-        }
-        try {
-
-            final PhoneNumber parsingResult = pnu.parse(value, null);
-            if (!pnu.format(parsingResult, PhoneNumberFormat.E164).equals(value)) {
-                return false;
-            }
-            return true;
-        } catch (final NumberParseException t) {
-            // Errors when parsing phonenumber
-            return false;
-        }
-
-        // CountryCodeSource.FROM_NUMBER_WITH_PLUS_SIGN
-        // log.debug("Phone Number: {}", value);
-        // log.debug("Country code: {}", numberProto.getCountryCode());
-        // log.debug("National Number: {}", numberProto.getNationalNumber());
-        // log.debug("E164 format: {}", pnu.format(numberProto,
-        // PhoneNumberFormat.E164));
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/resources/META-INF/services/org/apache/camel/component/cm
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/resources/META-INF/services/org/apache/camel/component/cm b/components/camel-cm/src/main/resources/META-INF/services/org/apache/camel/component/cm
deleted file mode 100644
index bf9d84b..0000000
--- a/components/camel-cm/src/main/resources/META-INF/services/org/apache/camel/component/cm
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# 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.
-#
-
-class=org.apache.camel.component.cm.CMComponent

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/resources/log4j.properties b/components/camel-cm/src/main/resources/log4j.properties
deleted file mode 100644
index 8c6ec38..0000000
--- a/components/camel-cm/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# 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.
-#
-log4j.rootLogger=error, stdout
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-
-# Print the date in ISO 8601 format
-log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
-
-log4j.appender.R=org.apache.log4j.RollingFileAppender
-log4j.appender.R.File=application.log
-
-log4j.appender.R.MaxFileSize=100KB
-# Keep one backup file
-log4j.appender.R.MaxBackupIndex=1
-
-log4j.appender.R.layout=org.apache.log4j.PatternLayout
-log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
-
-# LOGGERS
-log4j.logger.org.apache=INFO
-log4j.logger.org.apache.camel.cm=TRACE

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMConfigurationTest.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMConfigurationTest.java
deleted file mode 100644
index beafa33..0000000
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMConfigurationTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/**
- * 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.cm.test;
-
-import java.util.Set;
-import java.util.UUID;
-
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-
-import org.apache.camel.component.cm.CMConfiguration;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.util.Assert;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = { ValidatorConfiguration.class })
-// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
-// @DisableJmx(false)
-// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class CMConfigurationTest extends AbstractJUnit4SpringContextTests {
-
-    @Autowired
-    private Validator validator;
-
-    @Before
-    public void beforeTest() throws Exception {
-    }
-
-    // @After
-    // public void afterTest() {
-
-    @Test
-    public void testNullProductToken() throws Exception {
-
-        final CMConfiguration configuration = new CMConfiguration();
-
-        // length: 1-11
-        configuration.setDefaultFrom("DefaultFrom");
-        configuration.setProductTokenAsUUID(null);
-        configuration.setDefaultMaxNumberOfParts(8);
-        configuration.setTestConnectionOnStartup(false);
-
-        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testNullDefaultFrom() throws Exception {
-
-        final CMConfiguration configuration = new CMConfiguration();
-
-        // length: 1-11
-        configuration.setDefaultFrom(null);
-
-        configuration.setProductTokenAsUUID(UUID.randomUUID());
-        configuration.setDefaultMaxNumberOfParts(8);
-        configuration.setTestConnectionOnStartup(false);
-
-        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testDefaultFromFieldMaxLength() throws Exception {
-
-        final CMConfiguration configuration = new CMConfiguration();
-
-        // length: 1-11
-        configuration.setDefaultFrom("123456789012");
-
-        configuration.setProductTokenAsUUID(UUID.randomUUID());
-        configuration.setDefaultMaxNumberOfParts(8);
-        configuration.setTestConnectionOnStartup(false);
-
-        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testDefaultFromFieldZeroLength() throws Exception {
-
-        final CMConfiguration configuration = new CMConfiguration();
-
-        // length: 1-11
-        configuration.setDefaultFrom("");
-
-        configuration.setProductTokenAsUUID(UUID.randomUUID());
-        configuration.setDefaultMaxNumberOfParts(8);
-        configuration.setTestConnectionOnStartup(false);
-
-        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testMaxNumberOfParts() throws Exception {
-
-        final CMConfiguration configuration = new CMConfiguration();
-
-        configuration.setProductTokenAsUUID(UUID.randomUUID());
-        configuration.setDefaultFrom("DefaultFrom");
-        configuration.setDefaultMaxNumberOfParts(9);
-        configuration.setTestConnectionOnStartup(false);
-
-        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testMaxNumberOfPartsZero() throws Exception {
-
-        final CMConfiguration configuration = new CMConfiguration();
-
-        configuration.setProductTokenAsUUID(UUID.randomUUID());
-        configuration.setDefaultFrom("DefaultFrom");
-        configuration.setDefaultMaxNumberOfParts(0);
-        configuration.setTestConnectionOnStartup(false);
-
-        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-}


[22/23] camel git commit: Polished

Posted by da...@apache.org.
Polished


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

Branch: refs/heads/master
Commit: 585154511947c0ddf2674e1e44fc0f85db7f9311
Parents: 1c79846
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Mar 23 19:41:18 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 23 19:41:18 2016 +0100

----------------------------------------------------------------------
 apache-camel/pom.xml                            |   4 +
 .../src/main/descriptors/common-bin.xml         |   1 +
 components/camel-cm-sms/README.md               |  32 ++
 components/camel-cm-sms/pom.xml                 | 106 ++++++
 .../apache/camel/component/cm/CMComponent.java  |  96 +++++
 .../camel/component/cm/CMConfiguration.java     |  89 +++++
 .../apache/camel/component/cm/CMConstants.java  |  44 +++
 .../apache/camel/component/cm/CMEndpoint.java   | 109 ++++++
 .../apache/camel/component/cm/CMMessage.java    | 153 ++++++++
 .../apache/camel/component/cm/CMProducer.java   | 149 ++++++++
 .../org/apache/camel/component/cm/CMSender.java |  28 ++
 .../component/cm/CMSenderOneMessageImpl.java    | 254 +++++++++++++
 .../org/apache/camel/component/cm/CMUtils.java  |  30 ++
 .../camel/component/cm/client/SMSMessage.java   | 114 ++++++
 .../camel/component/cm/client/Translator.java   |  23 ++
 .../cm/exceptions/CMDirectException.java        |  40 ++
 .../cm/exceptions/HostUnavailableException.java |  39 ++
 .../cm/exceptions/XMLConstructionException.java |  39 ++
 .../cmresponse/CMResponseException.java         |  41 ++
 .../InsufficientBalanceException.java           |  26 ++
 .../cmresponse/InvalidMSISDNException.java      |  23 ++
 .../InvalidProductTokenException.java           |  26 ++
 .../NoAccountFoundForProductTokenException.java |  28 ++
 .../cmresponse/NoMessageException.java          |  23 ++
 .../NotPhoneNumberFoundException.java           |  23 ++
 .../cmresponse/UnknownErrorException.java       |  26 ++
 .../cmresponse/UnroutableMessageException.java  |  23 ++
 .../cm/validation/constraints/E164.java         |  41 ++
 .../validation/constraints/E164Validator.java   |  66 ++++
 .../services/org/apache/camel/component/cm-sms  |  18 +
 .../src/main/resources/log4j.properties         |  41 ++
 .../component/cm/test/CMConfigurationTest.java  | 142 +++++++
 .../camel/component/cm/test/CMMessageTest.java  | 323 ++++++++++++++++
 .../apache/camel/component/cm/test/CMProxy.java |  26 ++
 .../apache/camel/component/cm/test/CMTest.java  | 375 +++++++++++++++++++
 .../cm/test/CamelTestConfiguration.java         | 110 ++++++
 .../camel/component/cm/test/SMSMessageTest.java | 183 +++++++++
 .../cm/test/ValidatorConfiguration.java         |  35 ++
 .../cmsender/CMResponseExceptionSender.java     |  30 ++
 .../InsufficientBalanceExceptionSender.java     |  30 ++
 .../cmsender/InvalidMSISDNExceptionSender.java  |  30 ++
 .../InvalidProductTokenExceptionSender.java     |  30 ++
 ...ountFoundForProductTokenExceptionSender.java |  30 ++
 .../cmsender/NoMessageExceptionSender.java      |  30 ++
 .../NotPhoneNumberFoundExceptionSender.java     |  30 ++
 .../cmsender/UnknownErrorExceptionSender.java   |  30 ++
 .../UnroutableMessageExceptionSender.java       |  30 ++
 .../src/test/resources/cm-smsgw.properties      |  28 ++
 components/camel-cm/README.md                   |  32 --
 components/camel-cm/pom.xml                     | 105 ------
 .../apache/camel/component/cm/CMComponent.java  |  99 -----
 .../camel/component/cm/CMConfiguration.java     |  92 -----
 .../apache/camel/component/cm/CMConstants.java  |  44 ---
 .../apache/camel/component/cm/CMEndpoint.java   | 141 -------
 .../apache/camel/component/cm/CMMessage.java    | 153 --------
 .../apache/camel/component/cm/CMProducer.java   | 149 --------
 .../org/apache/camel/component/cm/CMSender.java |  28 --
 .../component/cm/CMSenderOneMessageImpl.java    | 254 -------------
 .../org/apache/camel/component/cm/CMUtils.java  |  30 --
 .../camel/component/cm/client/SMSMessage.java   | 114 ------
 .../camel/component/cm/client/Translator.java   |  23 --
 .../cm/exceptions/CMDirectException.java        |  40 --
 .../cm/exceptions/HostUnavailableException.java |  39 --
 .../cm/exceptions/XMLConstructionException.java |  39 --
 .../cmresponse/CMResponseException.java         |  41 --
 .../InsufficientBalanceException.java           |  26 --
 .../cmresponse/InvalidMSISDNException.java      |  23 --
 .../InvalidProductTokenException.java           |  26 --
 .../NoAccountFoundForProductTokenException.java |  28 --
 .../cmresponse/NoMessageException.java          |  23 --
 .../NotPhoneNumberFoundException.java           |  23 --
 .../cmresponse/UnknownErrorException.java       |  26 --
 .../cmresponse/UnroutableMessageException.java  |  23 --
 .../cm/validation/constraints/E164.java         |  41 --
 .../validation/constraints/E164Validator.java   |  66 ----
 .../services/org/apache/camel/component/cm      |  18 -
 .../src/main/resources/log4j.properties         |  37 --
 .../component/cm/test/CMConfigurationTest.java  | 142 -------
 .../camel/component/cm/test/CMMessageTest.java  | 323 ----------------
 .../apache/camel/component/cm/test/CMProxy.java |  26 --
 .../apache/camel/component/cm/test/CMTest.java  | 363 ------------------
 .../cm/test/CamelTestConfiguration.java         | 112 ------
 .../camel/component/cm/test/SMSMessageTest.java | 183 ---------
 .../cm/test/ValidatorConfiguration.java         |  35 --
 .../cmsender/CMResponseExceptionSender.java     |  30 --
 .../InsufficientBalanceExceptionSender.java     |  30 --
 .../cmsender/InvalidMSISDNExceptionSender.java  |  30 --
 .../InvalidProductTokenExceptionSender.java     |  30 --
 ...ountFoundForProductTokenExceptionSender.java |  30 --
 .../cmsender/NoMessageExceptionSender.java      |  30 --
 .../NotPhoneNumberFoundExceptionSender.java     |  30 --
 .../cmsender/UnknownErrorExceptionSender.java   |  30 --
 .../UnroutableMessageExceptionSender.java       |  30 --
 .../src/test/resources/cm-smsgw.properties      |  28 --
 components/pom.xml                              |   2 +-
 parent/pom.xml                                  |   5 +
 96 files changed, 3253 insertions(+), 3266 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/apache-camel/pom.xml
----------------------------------------------------------------------
diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index db97d20..b92593e 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -153,6 +153,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-cm-sms</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-cmis</artifactId>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/apache-camel/src/main/descriptors/common-bin.xml
----------------------------------------------------------------------
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index 3f43a8e..ae2c879 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -49,6 +49,7 @@
         <include>org.apache.camel:camel-castor</include>
         <include>org.apache.camel:camel-cdi</include>
         <include>org.apache.camel:camel-chunk</include>
+        <include>org.apache.camel:camel-cm-sms</include>
         <include>org.apache.camel:camel-cmis</include>
         <include>org.apache.camel:camel-core</include>
         <include>org.apache.camel:camel-core-osgi</include>

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/README.md
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/README.md b/components/camel-cm-sms/README.md
new file mode 100644
index 0000000..63f9059
--- /dev/null
+++ b/components/camel-cm-sms/README.md
@@ -0,0 +1,32 @@
+# camel-cm
+
+[Camel component](http://camel.apache.org/components.html) for the [CM SMS Gateway](https://www.cmtelecom.com). 
+
+It allows to integrate [CM SMS API](https://dashboard.onlinesmsgateway.com/docs) in an application as a camel component. 
+
+You must have a valid account.  More information are available at [CM Telecom](https://www.cmtelecom.com/support).
+
+### URI Format
+
+```
+cm://sgw01.cm.nl/gateway.ashx?defaultFrom=DefaultSender&defaultMaxNumberOfParts=8&productToken=2fb82162-754c-4c1b-806d-9cb7efd677f4
+```
+
+
+### Endpoint Options
+
+CM endpoints act like a **producer** and support the following options.
+
+| Name  | Default Value | Description |
+| ------------- | ------------- | ------------- |
+| productToken  |*none* |**Required**. UUID as String. This is the product token that was sent to you by email. Example: 'de7c7df3-81ca-4d1e-863d-95a252120321'|
+| defaultFrom  | *none* |**Required**. This is the default sender name, to be included in each SMSMessage instance not providing one. The maximum length is 11 characters.|
+| defaultMaxNumberOfParts  | 8 | If it is a [multipart message](https://dashboard.onlinesmsgateway.com/docs#send-a-message-multipart) forces the max number of parts to be sent. <p>The gateway will first check if a message is larger than 160 characters, if so, the message will be cut into multiple 153 characters parts limited by these parameters whether the message is [GSM 0038 encodeable](https://en.wikipedia.org/wiki/GSM_03.38). <p>Otherwise, The gateway will check if a message is larger than 70 characters, if so, the message will be cut into multiple 67 characters parts to a maximum of this parameter.|
+| testConnectionOnStartup | false | This ensures that Camel is not started with failed connections cause an exception is thrown on startup. | 
+
+### Tests
+
+Tests provided so far show a valid [Spring Configuration](https://github.com/oalles/camel-cm/blob/master/src/test/java/org/apache/camel/component/cm/test/TestConfiguration.java). Notice that CM Component URI is built from properties in a [file](https://github.com/oalles/camel-cm/blob/master/src/test/resources/cm-smsgw.properties). 
+
+### Sample of Usage
+You can try [this project](https://github.com/oalles/camel-cm-sample) to see how camel-cm can be integrated in a camel route. 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/pom.xml b/components/camel-cm-sms/pom.xml
new file mode 100644
index 0000000..4200180
--- /dev/null
+++ b/components/camel-cm-sms/pom.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+	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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>components</artifactId>
+    <version>2.18-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-cm-sms</artifactId>
+  <packaging>bundle</packaging>
+
+  <name>Camel :: CM SMS</name>
+  <description>Camel CM SMS Gateway Component</description>
+
+  <properties>
+    <camel.osgi.export.pkg>org.apache.camel.component.cm.*</camel.osgi.export.pkg>
+    <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=cm-sms</camel.osgi.export.service>
+  </properties>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>com.googlecode.libphonenumber</groupId>
+      <artifactId>libphonenumber</artifactId>
+      <version>${libphonenumber-version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpclient-osgi</artifactId>
+      <version>${httpclient4-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jsoup</groupId>
+      <artifactId>jsoup</artifactId>
+      <version>${jsoup-version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>javax.validation</groupId>
+      <artifactId>validation-api</artifactId>
+      <version>${validation-api-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.el</groupId>
+      <artifactId>javax.el-api</artifactId>
+      <version>${javax.el-api-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-validator</groupId>
+      <artifactId>commons-validator</artifactId>
+      <version>${commons-validator-version}</version>
+    </dependency>
+
+    <!-- test dependencies -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test-spring</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring-javaconfig</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.hibernate</groupId>
+      <artifactId>hibernate-validator</artifactId>
+      <version>${hibernate-validator-version}</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMComponent.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMComponent.java
new file mode 100644
index 0000000..73d1250
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMComponent.java
@@ -0,0 +1,96 @@
+/**
+ * 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.cm;
+
+import java.util.Map;
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.apache.camel.BeanInject;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
+import org.apache.camel.ResolveEndpointFailedException;
+import org.apache.camel.impl.UriEndpointComponent;
+import org.apache.camel.util.URISupport;
+import org.apache.commons.validator.routines.UrlValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Represents the component that manages {@link CMEndpoint}s.
+ */
+public class CMComponent extends UriEndpointComponent {
+
+    private static final Logger LOG = LoggerFactory.getLogger(CMComponent.class);
+
+    // TODO: Must not rely on dependency injection as it should work out of the box
+    @BeanInject
+    private Validator validator;
+
+    public CMComponent(final CamelContext context) {
+        super(context, CMEndpoint.class);
+    }
+
+    /**
+     * Endpoints factory
+     */
+    @Override
+    protected Endpoint createEndpoint(final String uri, final String remaining, final Map<String, Object> parameters) throws Exception {
+
+        LOG.debug("Creating CM Endpoint ... ");
+
+        final String url = CMConstants.DEFAULT_SCHEME + remaining;
+        if (!UrlValidator.getInstance().isValid(url)) {
+            throw new ResolveEndpointFailedException(uri, String.format("HOST provided: %s seem to be invalid. Remember SCHEME has to be excluded.", url));
+        }
+
+        LOG.debug("Uri=[{}], path=[{}], parameters=[{}]", new Object[] {URISupport.sanitizeUri(uri), URISupport.sanitizePath(remaining), parameters });
+
+        // Set configuration based on uri parameters
+        final CMConfiguration config = new CMConfiguration();
+        setProperties(config, parameters);
+
+        // Validate configuration
+        LOG.debug("Validating uri based configuration");
+        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(config);
+        if (constraintViolations.size() > 0) {
+            final StringBuffer msg = new StringBuffer();
+            for (final ConstraintViolation<CMConfiguration> cv : constraintViolations) {
+                msg.append(String.format("- Invalid value for %s: %s", cv.getPropertyPath().toString(), cv.getMessage()));
+            }
+            throw new ResolveEndpointFailedException(uri, msg.toString());
+        }
+        LOG.debug("CMConfiguration - OK!");
+
+        // Component is an Endpoint factory. So far, just one Endpoint type.
+        // Endpoint construction and configuration.
+
+        LOG.debug("Creating CMEndpoint");
+        final CMEndpoint endpoint = new CMEndpoint(uri, this);
+        endpoint.setConfiguration(config);
+        endpoint.setHost(remaining);
+
+        return endpoint;
+    }
+
+    public Validator getValidator() {
+        return validator;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMConfiguration.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMConfiguration.java
new file mode 100644
index 0000000..74d75b0
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMConfiguration.java
@@ -0,0 +1,89 @@
+/**
+ * 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.cm;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+
+@UriParams
+public class CMConfiguration {
+
+    @UriParam @Metadata(required = "true")
+    @NotNull
+    private String productToken;
+    @UriParam
+    @NotNull @Size(min = 1, max = 11)
+    private String defaultFrom;
+    @UriParam(defaultValue = "8")
+    @Min(1) @Max(8)
+    private int defaultMaxNumberOfParts = 8;
+    @UriParam
+    private boolean testConnectionOnStartup;
+
+    public String getProductToken() {
+        return productToken;
+    }
+
+    /**
+     * The unique token to use
+     */
+    public void setProductToken(String productToken) {
+        this.productToken = productToken;
+    }
+
+    public String getDefaultFrom() {
+        return defaultFrom;
+    }
+
+    /**
+     * This is the sender name. The maximum length is 11 characters.
+     */
+    public void setDefaultFrom(final String defaultFrom) {
+        this.defaultFrom = defaultFrom;
+    }
+
+    public int getDefaultMaxNumberOfParts() {
+        return defaultMaxNumberOfParts;
+    }
+
+    /**
+     * If it is a multipart message forces the max number. Message can be truncated.
+     * Technically the gateway will first check if a message is larger than 160 characters,
+     * if so, the message will be cut into multiple 153 characters parts limited by these parameters.
+     */
+    public void setDefaultMaxNumberOfParts(final int defaultMaxNumberOfParts) {
+        this.defaultMaxNumberOfParts = defaultMaxNumberOfParts;
+    }
+
+    public boolean isTestConnectionOnStartup() {
+        return testConnectionOnStartup;
+    }
+
+    /**
+     * Whether to test the connection to the SMS Gateway on startup
+     */
+    public void setTestConnectionOnStartup(final boolean testConnectionOnStartup) {
+        this.testConnectionOnStartup = testConnectionOnStartup;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMConstants.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMConstants.java
new file mode 100644
index 0000000..afe8fde
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMConstants.java
@@ -0,0 +1,44 @@
+/**
+ * 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.cm;
+
+public interface CMConstants {
+
+    String DEFAULT_SCHEME = "https://";
+
+    int DEFAULT_MULTIPARTS = 8;
+
+    int MAX_UNICODE_MESSAGE_LENGTH = 70;
+    int MAX_GSM_MESSAGE_LENGTH = 160;
+    int MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART = 67;
+    int MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART = 153;
+
+    // status code 200 - Error substrings - check it contains.
+    String ERROR_UNKNOWN = "Unknown error";
+    String ERROR_NO_ACCOUNT = "No account found";
+    String ERROR_INSUFICIENT_BALANCE = "Insufficient balance";
+    String ERROR_UNROUTABLE_MESSAGE = "Message is unroutable";
+    String ERROR_INVALID_PRODUCT_TOKEN = "Invalid product token";
+
+    // TODO: Review this pattern.
+    // or it should be foundnd an alternative to jcharset to check if a message is GSM 03.38 encodable
+    // See:
+    // https://en.wikipedia.org/wiki/GSM_03.38
+    // http://frightanic.com/software-development/regex-for-gsm-03-38-7bit-character-set/
+    String GSM_0338_REGEX = "^[A-Za-z0-9 \\r\\n@£$\u0394_\u03A6\u0393\u039B\u03A9\u03A0\u03A8\u03A3\u0398\u039E!\"#$%&amp;'()*+,\\-./:;&lt;=&gt;?¡¿^{}\\\\\\[~\\]|"
+                            + "\u20AC\u00a5\u00e8\u00e9\u00f9\u00ec\u00f2\u00c7\u00d8\u00f8\u00c5\u00e5\u00c6\u00e6\u00df\u00c9\u00c4\u00d6\u00d1\u00dc\u00a7\u00e4\u00f6\u00f1\u00fc\u00e0]*$";
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMEndpoint.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMEndpoint.java
new file mode 100644
index 0000000..b290801
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMEndpoint.java
@@ -0,0 +1,109 @@
+/**
+ * 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.cm;
+
+import java.util.UUID;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
+import org.apache.camel.util.ObjectHelper;
+
+@UriEndpoint(scheme = "cm-sms", title = "CM SMS Gateway", syntax = "cm-sms:host", label = "mobile", producerOnly = true)
+public class CMEndpoint extends DefaultEndpoint {
+
+    @UriPath
+    @Metadata(required = "true")
+    private String host;
+    @UriParam
+    private CMConfiguration configuration;
+
+    public CMEndpoint(final String uri, final CMComponent component) {
+        super(uri, component);
+        setExchangePattern(ExchangePattern.InOut);
+    }
+
+    /**
+     * Provides a channel on which clients can send Messages to a CM Endpoint
+     */
+    @Override
+    public CMProducer createProducer() throws Exception {
+        final CMConfiguration config = getConfiguration();
+
+        // This is the camel exchange processor. Allows to send messages to CM
+        // API.
+        // TODO: Should i provide a CMSender factory? Dynamically choose
+        // CMSender implementation? Sending strategy?
+        // Consider:
+        // 1. single - Single Message strategy.
+        // 2. Multi - CM Api supports to 1000 messages per call.
+        // 3. sliding - sliding window? 1000 messages or time thresold?
+        // 4. mocked - in order to fake cm responses
+
+        // CMConstants.DEFAULT_SCHEME + host is a valid URL. It was previously checked
+
+        String token = config.getProductToken();
+        ObjectHelper.notEmpty(token, "productToken");
+
+        UUID uuid = UUID.fromString(token);
+        return new CMProducer(this, new CMSenderOneMessageImpl(getCMUrl(), uuid));
+    }
+
+    @Override
+    public Consumer createConsumer(final Processor processor) throws Exception {
+        throw new UnsupportedOperationException("Consumer not supported");
+    }
+
+    public CMConfiguration getConfiguration() {
+        return configuration;
+    }
+
+    public void setConfiguration(final CMConfiguration configuration) {
+        this.configuration = configuration;
+    }
+
+    @Override
+    public boolean isSingleton() {
+        return true;
+    }
+
+    public String getCMUrl() {
+        return CMConstants.DEFAULT_SCHEME + host;
+    }
+
+    @Override
+    public CMComponent getComponent() {
+        return (CMComponent) super.getComponent();
+    }
+
+    public String getHost() {
+        return host;
+    }
+
+    /**
+     * SMS Provider HOST with scheme
+     */
+    public void setHost(final String host) {
+        this.host = host;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMMessage.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMMessage.java
new file mode 100644
index 0000000..2f98936
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMMessage.java
@@ -0,0 +1,153 @@
+/**
+ * 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.cm;
+
+/**
+ * Valid message to be serialized and sent to CM Endpoints. If the message only uses GSM 7-bit characters, then 160 characters will fit in 1 SMS part, and 153*n characters will fit in n SMS parts for
+ * n>1. If the message contains other characters, then only 70 characters will fit in 1 SMS part, and 67*n characters will fit in n SMS parts for n>1. <br>
+ * <br>
+ * {@link https://dashboard.onlinesmsgateway.com/docs} <br>
+ * {@link http://support.telerivet.com/customer/portal/articles/1957426-multipart-unicode-sms-messages}
+ */
+public class CMMessage {
+
+    /**
+     * Restrictions: 1 - 32 alphanumeric characters and reference will not work for demo accounts
+     */
+    // TODO: use a ID generator?
+    private String idAsString;
+
+    private String phoneNumber;
+    private String message;
+
+    private String sender;
+
+    private boolean unicode;
+    private int multipart = 1;
+
+    public CMMessage(final String phoneNumber, final String message) {
+        this.message = message;
+        this.phoneNumber = phoneNumber;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(final String message) {
+        this.message = message;
+    }
+
+    public String getPhoneNumber() {
+        return phoneNumber;
+    }
+
+    public void setPhoneNumber(final String phoneNumber) {
+        this.phoneNumber = phoneNumber;
+    }
+
+    public String getSender() {
+        return sender;
+    }
+
+    public void setSender(final String sender) {
+        this.sender = sender;
+    }
+
+    public String getIdAsString() {
+        return idAsString;
+    }
+
+    public void setIdAsString(final String idAsString) {
+        this.idAsString = idAsString;
+    }
+
+    public boolean isUnicode() {
+        return unicode;
+    }
+
+    public void setUnicode(final boolean unicode) {
+        this.unicode = unicode;
+    }
+
+    public boolean isMultipart() {
+        return multipart > 1;
+    }
+
+    /**
+     * For a CMMessage instance
+     *
+     * @param defaultMaxNumberOfParts
+     */
+    public void setUnicodeAndMultipart(int defaultMaxNumberOfParts) {
+
+        // Set UNICODE and MULTIPART
+        final String msg = getMessage();
+        if (CMUtils.isGsm0338Encodeable(msg)) {
+
+            // Not Unicode is Multipart?
+            if (msg.length() > CMConstants.MAX_GSM_MESSAGE_LENGTH) {
+
+                // Multiparts. 153 caracteres max per part
+                int parts = msg.length() / CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART;
+                if (msg.length() % CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART != 0) {
+                    parts++;
+                }
+
+                setMultiparts((parts > defaultMaxNumberOfParts) ? defaultMaxNumberOfParts : parts);
+            } else { // Otherwise multipart = 1
+                setMultiparts(1);
+            }
+        } else {
+            // Unicode Message
+            setUnicode(true);
+
+            if (msg.length() > CMConstants.MAX_UNICODE_MESSAGE_LENGTH) {
+
+                // Multiparts. 67 caracteres max per part
+                int parts = msg.length() / CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART;
+                if (msg.length() % CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART != 0) {
+                    parts++;
+                }
+
+                setMultiparts((parts > defaultMaxNumberOfParts) ? defaultMaxNumberOfParts : parts);
+            } else { // Otherwise multipart = 1
+                setMultiparts(1);
+            }
+        }
+    }
+
+    public void setMultiparts(final int multipart) {
+        this.multipart = multipart;
+    }
+
+    public int getMultiparts() {
+        return multipart;
+    }
+
+    @Override
+    public String toString() {
+
+        StringBuffer sb = new StringBuffer(" {phoneNumber: " + phoneNumber + ", message: " + message + ", sender=" + sender + ", unicode: " + unicode + ", multipart: " + multipart);
+        if (idAsString != null && !idAsString.isEmpty()) {
+            sb.append(", idAsString=" + idAsString);
+        }
+        sb.append(" }");
+        return sb.toString();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMProducer.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMProducer.java
new file mode 100644
index 0000000..e4f5722
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMProducer.java
@@ -0,0 +1,149 @@
+/**
+ * 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.cm;
+
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.InvalidPayloadRuntimeException;
+import org.apache.camel.component.cm.client.SMSMessage;
+import org.apache.camel.component.cm.exceptions.HostUnavailableException;
+import org.apache.camel.impl.DefaultProducer;
+import org.apache.http.client.methods.HttpHead;
+import org.apache.http.impl.client.HttpClientBuilder;
+
+/**
+ * is the exchange processor. Sends a validated sms message to CM Endpoints.
+ */
+public class CMProducer extends DefaultProducer {
+
+    private Validator validator;
+
+    /**
+     * sends a valid message to CM endpoints.
+     */
+    private CMSender sender;
+
+    public CMProducer(final CMEndpoint endpoint, final CMSender sender) {
+        super(endpoint);
+        this.sender = sender;
+    }
+
+    /**
+     * Producer is a exchange processor. This process is built in several steps. 1. Validate message receive from client 2. Send validated message to CM endpoints. 3. Process response from CM
+     * endpoints.
+     */
+    @Override
+    public void process(final Exchange exchange) throws Exception {
+
+        // Immutable message receive from clients. Throws camel ' s
+        // InvalidPayloadException
+        final SMSMessage smsMessage = exchange.getIn().getMandatoryBody(SMSMessage.class);
+
+        // Validates Payload - SMSMessage
+        log.trace("Validating SMSMessage instance provided: {}", smsMessage.toString());
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = getValidator().validate(smsMessage);
+        if (constraintViolations.size() > 0) {
+            final StringBuffer msg = new StringBuffer();
+            for (final ConstraintViolation<SMSMessage> cv : constraintViolations) {
+                msg.append(String.format("- Invalid value for %s: %s", cv.getPropertyPath().toString(), cv.getMessage()));
+            }
+            log.debug(msg.toString());
+            throw new InvalidPayloadRuntimeException(exchange, SMSMessage.class);
+        }
+        log.trace("SMSMessage instance is valid: {}", smsMessage.toString());
+
+        // We have a valid (immutable) SMSMessage instance, lets extend to
+        // CMMessage
+        // This is the instance we will use to build the XML document to be
+        // sent to CM SMS GW.
+        final CMMessage cmMessage = new CMMessage(smsMessage.getPhoneNumber(), smsMessage.getMessage());
+        log.debug("CMMessage instance build from valid SMSMessage instance");
+
+        if (smsMessage.getFrom() == null || smsMessage.getFrom().isEmpty()) {
+            String df = getConfiguration().getDefaultFrom();
+            cmMessage.setSender(df);
+            log.debug("Dynamic sender is set to default dynamic sender: {}", df);
+        }
+
+        // Remember, this can be null.
+        cmMessage.setIdAsString(smsMessage.getId());
+
+        // Unicode and multipart
+        cmMessage.setUnicodeAndMultipart(getConfiguration().getDefaultMaxNumberOfParts());
+
+        // 2. Send a validated sms message to CM endpoints
+        //  for abnormal situations.
+        sender.send(cmMessage);
+
+        log.debug("Request accepted by CM Host: {}", cmMessage.toString());
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+
+        // log at debug level for singletons, for prototype scoped log at trace
+        // level to not spam logs
+
+        log.debug("Starting CMProducer");
+
+        final CMConfiguration configuration = getConfiguration();
+
+        if (configuration.isTestConnectionOnStartup()) {
+            try {
+                log.debug("Checking connection - {}", getEndpoint().getCMUrl());
+                HttpClientBuilder.create().build().execute(new HttpHead(getEndpoint().getCMUrl()));
+                log.debug("Connection to {}: OK", getEndpoint().getCMUrl());
+            } catch (final Exception e) {
+                throw new HostUnavailableException(String.format("Connection to %s: NOT AVAILABLE", getEndpoint().getCMUrl()), e);
+            }
+        }
+
+        // keep starting
+        super.doStart();
+
+        log.debug("CMProducer started");
+    }
+
+    @Override
+    public CMEndpoint getEndpoint() {
+        return (CMEndpoint) super.getEndpoint();
+    }
+
+    public CMConfiguration getConfiguration() {
+        return getEndpoint().getConfiguration();
+    }
+
+    public Validator getValidator() {
+        if (validator == null) {
+            validator = getEndpoint().getComponent().getValidator();
+        }
+        return validator;
+    }
+
+    public CMSender getSender() {
+        return sender;
+    }
+
+    public void setSender(CMSender sender) {
+        this.sender = sender;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMSender.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMSender.java
new file mode 100644
index 0000000..661f4dd
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMSender.java
@@ -0,0 +1,28 @@
+/**
+ * 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.cm;
+
+/**
+ * Sends a validated sms message to CM endpoints
+ */
+public interface CMSender {
+
+    /**
+     * Sends a validated sms message to CM Endpoints.
+     */
+    void send(CMMessage cmMessage);
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
new file mode 100644
index 0000000..07e0e14
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
@@ -0,0 +1,254 @@
+/**
+ * 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.cm;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.nio.charset.Charset;
+import java.util.UUID;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Text;
+
+import org.apache.camel.component.cm.exceptions.CMDirectException;
+import org.apache.camel.component.cm.exceptions.XMLConstructionException;
+import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
+import org.apache.camel.component.cm.exceptions.cmresponse.InsufficientBalanceException;
+import org.apache.camel.component.cm.exceptions.cmresponse.InvalidProductTokenException;
+import org.apache.camel.component.cm.exceptions.cmresponse.NoAccountFoundForProductTokenException;
+import org.apache.camel.component.cm.exceptions.cmresponse.UnknownErrorException;
+import org.apache.camel.component.cm.exceptions.cmresponse.UnroutableMessageException;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CMSenderOneMessageImpl implements CMSender {
+
+    private static final Logger LOG = LoggerFactory.getLogger(CMSenderOneMessageImpl.class);
+
+    private final String url;
+    private final UUID productToken;
+
+    public CMSenderOneMessageImpl(final String url, final UUID productToken) {
+
+        this.url = url;
+        this.productToken = productToken;
+    }
+
+    /**
+     * Sends a message to CM endpoints. 1. CMMessage instance is going to be marshalled to xml. 2. Post request xml string to CMEndpoint.
+     */
+    @Override
+    public void send(final CMMessage cmMessage) {
+
+        // See: Check https://dashboard.onlinesmsgateway.com/docs for responses
+
+        // 1.Construct XML. Throws XMLConstructionException
+        final String xml = createXml(cmMessage);
+
+        // 2. Try to send to CM SMS Provider ...Throws CMResponseException
+        doHttpPost(url, xml);
+    }
+
+    private String createXml(final CMMessage message) {
+
+        try {
+
+            final ByteArrayOutputStream xml = new ByteArrayOutputStream();
+            final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            factory.setNamespaceAware(true);
+
+            // Get the DocumentBuilder
+            final DocumentBuilder docBuilder = factory.newDocumentBuilder();
+
+            // Create blank DOM Document
+            final DOMImplementation impl = docBuilder.getDOMImplementation();
+            final Document doc = impl.createDocument(null, "MESSAGES", null);
+
+            // ROOT Element es MESSAGES
+            final Element root = doc.getDocumentElement();
+
+            // AUTHENTICATION element
+            final Element authenticationElement = doc.createElement("AUTHENTICATION");
+            final Element productTokenElement = doc.createElement("PRODUCTTOKEN");
+            authenticationElement.appendChild(productTokenElement);
+            final Text productTokenValue = doc.createTextNode("" + productToken);
+            productTokenElement.appendChild(productTokenValue);
+            root.appendChild(authenticationElement);
+
+            // MSG Element
+            final Element msgElement = doc.createElement("MSG");
+            root.appendChild(msgElement);
+
+            // <FROM>VALUE</FROM>
+            final Element fromElement = doc.createElement("FROM");
+            fromElement.appendChild(doc.createTextNode(message.getSender()));
+            msgElement.appendChild(fromElement);
+
+            // <BODY>VALUE</BODY>
+            final Element bodyElement = doc.createElement("BODY");
+            bodyElement.appendChild(doc.createTextNode(message.getMessage()));
+            msgElement.appendChild(bodyElement);
+
+            // <TO>VALUE</TO>
+            final Element toElement = doc.createElement("TO");
+            toElement.appendChild(doc.createTextNode(message.getPhoneNumber()));
+            msgElement.appendChild(toElement);
+
+            // <DCS>VALUE</DCS> - if UNICODE - messageOut.isGSM338Enc
+            // false
+            if (message.isUnicode()) {
+                final Element dcsElement = doc.createElement("DCS");
+                dcsElement.appendChild(doc.createTextNode("8"));
+                msgElement.appendChild(dcsElement);
+            }
+
+            // <REFERENCE>VALUE</REFERENCE> -Alfanum
+            final String id = message.getIdAsString();
+            if (id != null && !id.isEmpty()) {
+                final Element refElement = doc.createElement("REFERENCE");
+                refElement.appendChild(doc.createTextNode("" + message.getIdAsString()));
+                msgElement.appendChild(refElement);
+            }
+
+            // <MINIMUMNUMBEROFMESSAGEPARTS>1</MINIMUMNUMBEROFMESSAGEPARTS>
+            // <MAXIMUMNUMBEROFMESSAGEPARTS>8</MAXIMUMNUMBEROFMESSAGEPARTS>
+            if (message.isMultipart()) {
+                final Element minMessagePartsElement = doc.createElement("MINIMUMNUMBEROFMESSAGEPARTS");
+                minMessagePartsElement.appendChild(doc.createTextNode("1"));
+                msgElement.appendChild(minMessagePartsElement);
+
+                final Element maxMessagePartsElement = doc.createElement("MAXIMUMNUMBEROFMESSAGEPARTS");
+                maxMessagePartsElement.appendChild(doc.createTextNode(Integer.toString(message.getMultiparts())));
+                msgElement.appendChild(maxMessagePartsElement);
+            }
+
+            // Creatate XML as String
+            final Transformer aTransformer = TransformerFactory.newInstance().newTransformer();
+            aTransformer.setOutputProperty(OutputKeys.INDENT, "yes");
+            final Source src = new DOMSource(doc);
+            final Result dest = new StreamResult(xml);
+            aTransformer.transform(src, dest);
+            return xml.toString();
+        } catch (final TransformerException e) {
+            throw new XMLConstructionException(String.format("Cant serialize CMMessage %s", message), e);
+        } catch (final ParserConfigurationException e) {
+            throw new XMLConstructionException(String.format("Cant serialize CMMessage %s", message), e);
+        }
+    }
+
+    private void doHttpPost(final String urlString, final String requestString) {
+
+        final HttpClient client = HttpClientBuilder.create().build();
+        final HttpPost post = new HttpPost(urlString);
+        post.setEntity(new StringEntity(requestString, Charset.forName("UTF-8")));
+
+        try {
+
+            final HttpResponse response = client.execute(post);
+
+            final int statusCode = response.getStatusLine().getStatusCode();
+
+            LOG.debug("Response Code : {}", statusCode);
+
+            if (statusCode == 400) {
+                throw new CMDirectException("CM Component and CM API show some kind of inconsistency. "
+                                            + "CM is complaining about not using a post method for the request. And this component only uses POST requests. What happens?");
+            }
+
+            if (statusCode != 200) {
+                throw new CMDirectException("CM Component and CM API show some kind of inconsistency. The component expects the status code to be 200 or 400. New api released? ");
+            }
+
+            // So we have 200 status code...
+
+            // The response type is 'text/plain' and contains the actual
+            // result of the request processing.
+
+            // We obtaing the result text
+            final BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+
+            final StringBuffer result = new StringBuffer();
+            String line = null;
+            while ((line = rd.readLine()) != null) {
+                result.append(line);
+            }
+
+            // ... and process it
+
+            line = result.toString();
+            if (!line.isEmpty()) {
+
+                // Line is not empty = error
+                LOG.debug("Result of the request processing: FAILED\n{}", line);
+
+                // The response text contains the error description. We will
+                // throw a custom exception for each.
+
+                if (line.contains(CMConstants.ERROR_UNKNOWN)) {
+                    throw new UnknownErrorException();
+                } else if (line.contains(CMConstants.ERROR_NO_ACCOUNT)) {
+                    throw new NoAccountFoundForProductTokenException();
+                } else if (line.contains(CMConstants.ERROR_INSUFICIENT_BALANCE)) {
+                    throw new InsufficientBalanceException();
+                } else if (line.contains(CMConstants.ERROR_UNROUTABLE_MESSAGE)) {
+                    throw new UnroutableMessageException();
+                } else if (line.contains(CMConstants.ERROR_INVALID_PRODUCT_TOKEN)) {
+                    throw new InvalidProductTokenException();
+                } else {
+
+                    // SO FAR i would expect other kind of ERROR.
+
+                    // MSISDN correctness and message validity is client
+                    // responsibility
+                    throw new CMResponseException("CHECK ME. I am not expecting this. ");
+                }
+            }
+
+            // Ok. Line is EMPTY - successfully submitted
+            LOG.debug("Result of the request processing: Successfully submited");
+        } catch (final IOException io) {
+            throw new CMDirectException(io);
+        } catch (Throwable t) {
+            if (!(t instanceof CMDirectException)) {
+                // Chain it
+                t = new CMDirectException(t);
+            }
+            throw (CMDirectException) t;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMUtils.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMUtils.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMUtils.java
new file mode 100644
index 0000000..f0581da
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMUtils.java
@@ -0,0 +1,30 @@
+/**
+ * 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.cm;
+
+public final class CMUtils {
+
+    private CMUtils() {
+    }
+
+    public static boolean isGsm0338Encodeable(final String message) {
+        return message.matches(CMConstants.GSM_0338_REGEX);
+    }
+
+    // TODO: Have a look at
+    // https:// github.com/apache/camel/blob/master/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/client/SMSMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/client/SMSMessage.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/client/SMSMessage.java
new file mode 100644
index 0000000..869c9f8
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/client/SMSMessage.java
@@ -0,0 +1,114 @@
+/**
+ * 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.cm.client;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
+
+import org.apache.camel.component.cm.validation.constraints.E164;
+
+/**
+ * Immutable. The message instance provided by the client.
+ */
+public class SMSMessage {
+
+    /**
+     * Required MSISDN. E164 value. The destination phone number. Format with a '+' and country code.
+     *
+     * @see <a href="https://en.wikipedia.org/wiki/E.164">https://en.wikipedia.org/wiki/E.164</a>
+     */
+    @E164
+    private final String phoneNumber;
+
+    /**
+     * This is the message to be sent. 2 options:
+     * <ul>
+     * <li>If the message is GSM 0038 encodeable the gateway will first check if a message is larger than 160 characters, if so, the message will be cut into multiple 153 characters parts limited by
+     * defaultMaxNumberOfParts set in the component uri.</li>
+     * <li>Otherwise, the gateway will check if a message is larger than 70 characters, if so, the message will be cut into multiple 67 characters parts to a maximum of defaultMaxNumberOfParts set in
+     * the component uri.</li>
+     * </ul>
+     *
+     * @see <a href="https://en.wikipedia.org/wiki/GSM_03.38">E.164</a>
+     */
+    @NotNull
+    private final String message;
+
+    /**
+     * This is an optional dynamic sender name.
+     * <p>
+     * 1 - 11 alphanumeric characters and + char. Not Empty Strings. This field has a maximum length of 11 characters. If it is not set the defaultFrom required to configure the component will be set.
+     */
+    @Size(min = 1, max = 11)
+    @Pattern(regexp = "^[A-Za-z0-9]+$")
+    private final String from;
+
+    /**
+     * Unique identifier for a message.
+     * <p>
+     * 1 - 32 alphanumeric characters. Not Empty Strings. Will not work for demo accounts. This field corresponds to REFERENCE parameter in CM Api.
+     */
+    @Size(min = 1, max = 32)
+    @Pattern(regexp = "^[A-Za-z0-9]+$")
+    private final String id;
+
+    public SMSMessage(final String message, final String phoneNumber) {
+        this(null, message, phoneNumber, null);
+    }
+
+    public SMSMessage(String id, final String message, final String phoneNumber) {
+        this(id, message, phoneNumber, null);
+    }
+
+    public SMSMessage(final String id, final String message, final String phoneNumber, final String from) {
+        this.id = id;
+        this.message = message;
+        this.phoneNumber = phoneNumber;
+        this.from = from;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public String getPhoneNumber() {
+        return phoneNumber;
+    }
+
+    public String getFrom() {
+        return from;
+    }
+
+    @Override
+    public String toString() {
+        StringBuffer toS = new StringBuffer("{phoneNumber: " + phoneNumber + ", message: " + message);
+        if (from != null && !from.isEmpty()) {
+            toS.append(", from: " + from);
+        }
+        if (id != null && !id.isEmpty()) {
+            toS.append(", id: " + id);
+        }
+        toS.append(" }");
+        return toS.toString();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/client/Translator.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/client/Translator.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/client/Translator.java
new file mode 100644
index 0000000..4c6e9e9
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/client/Translator.java
@@ -0,0 +1,23 @@
+/**
+ * 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.cm.client;
+
+public interface Translator<T> {
+
+    SMSMessage translate(T t);
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/CMDirectException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/CMDirectException.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/CMDirectException.java
new file mode 100644
index 0000000..70912ff
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/CMDirectException.java
@@ -0,0 +1,40 @@
+/**
+ * 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.cm.exceptions;
+
+public class CMDirectException extends RuntimeException {
+
+    public CMDirectException() {
+    }
+
+    public CMDirectException(final String message) {
+        super(message);
+    }
+
+    public CMDirectException(final Throwable cause) {
+        super(cause);
+    }
+
+    public CMDirectException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public CMDirectException(final String message, final Throwable cause,
+            final boolean enableSuppression, final boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/HostUnavailableException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/HostUnavailableException.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/HostUnavailableException.java
new file mode 100644
index 0000000..73bf0d0
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/HostUnavailableException.java
@@ -0,0 +1,39 @@
+/**
+ * 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.cm.exceptions;
+
+public class HostUnavailableException extends CMDirectException {
+
+    public HostUnavailableException() {
+    }
+
+    public HostUnavailableException(final String message) {
+        super(message);
+    }
+
+    public HostUnavailableException(final Throwable cause) {
+        super(cause);
+    }
+
+    public HostUnavailableException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public HostUnavailableException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/XMLConstructionException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/XMLConstructionException.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/XMLConstructionException.java
new file mode 100644
index 0000000..5086e70
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/XMLConstructionException.java
@@ -0,0 +1,39 @@
+/**
+ * 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.cm.exceptions;
+
+public class XMLConstructionException extends CMDirectException {
+
+    public XMLConstructionException() {
+    }
+
+    public XMLConstructionException(final String message) {
+        super(message);
+    }
+
+    public XMLConstructionException(final Throwable cause) {
+        super(cause);
+    }
+
+    public XMLConstructionException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public XMLConstructionException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/CMResponseException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/CMResponseException.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/CMResponseException.java
new file mode 100644
index 0000000..4ed4f6e
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/CMResponseException.java
@@ -0,0 +1,41 @@
+/**
+ * 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.cm.exceptions.cmresponse;
+
+import org.apache.camel.component.cm.exceptions.CMDirectException;
+
+public class CMResponseException extends CMDirectException {
+
+    public CMResponseException() {
+    }
+
+    public CMResponseException(final String message) {
+        super(message);
+    }
+
+    public CMResponseException(final Throwable cause) {
+        super(cause);
+    }
+
+    public CMResponseException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public CMResponseException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InsufficientBalanceException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InsufficientBalanceException.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InsufficientBalanceException.java
new file mode 100644
index 0000000..bb73cc5
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InsufficientBalanceException.java
@@ -0,0 +1,26 @@
+/**
+ * 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.cm.exceptions.cmresponse;
+
+/**
+ * You are out of trial messages. Order new messages via your dashboard.
+ */
+public class InsufficientBalanceException extends CMResponseException {
+
+    public InsufficientBalanceException() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidMSISDNException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidMSISDNException.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidMSISDNException.java
new file mode 100644
index 0000000..c80fbdd
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidMSISDNException.java
@@ -0,0 +1,23 @@
+/**
+ * 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.cm.exceptions.cmresponse;
+
+public class InvalidMSISDNException extends CMResponseException {
+
+    public InvalidMSISDNException() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidProductTokenException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidProductTokenException.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidProductTokenException.java
new file mode 100644
index 0000000..ce81bcb
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidProductTokenException.java
@@ -0,0 +1,26 @@
+/**
+ * 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.cm.exceptions.cmresponse;
+
+/**
+ * Invalid or missing
+ */
+public class InvalidProductTokenException extends CMResponseException {
+
+    public InvalidProductTokenException() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoAccountFoundForProductTokenException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoAccountFoundForProductTokenException.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoAccountFoundForProductTokenException.java
new file mode 100644
index 0000000..a718ff3
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoAccountFoundForProductTokenException.java
@@ -0,0 +1,28 @@
+/**
+ * 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.cm.exceptions.cmresponse;
+
+/**
+ * No account found for the provided product token.
+ *
+ * @author Omar
+ */
+public class NoAccountFoundForProductTokenException extends CMResponseException {
+
+    public NoAccountFoundForProductTokenException() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoMessageException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoMessageException.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoMessageException.java
new file mode 100644
index 0000000..4398219
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoMessageException.java
@@ -0,0 +1,23 @@
+/**
+ * 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.cm.exceptions.cmresponse;
+
+public class NoMessageException extends CMResponseException {
+
+    public NoMessageException() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NotPhoneNumberFoundException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NotPhoneNumberFoundException.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NotPhoneNumberFoundException.java
new file mode 100644
index 0000000..877b972
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NotPhoneNumberFoundException.java
@@ -0,0 +1,23 @@
+/**
+ * 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.cm.exceptions.cmresponse;
+
+public class NotPhoneNumberFoundException extends CMResponseException {
+
+    public NotPhoneNumberFoundException() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnknownErrorException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnknownErrorException.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnknownErrorException.java
new file mode 100644
index 0000000..bb0951a
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnknownErrorException.java
@@ -0,0 +1,26 @@
+/**
+ * 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.cm.exceptions.cmresponse;
+
+/**
+ * An unexpected error occurred. Check the provided values. Contact CM for support.
+ */
+public class UnknownErrorException extends CMResponseException {
+
+    public UnknownErrorException() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnroutableMessageException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnroutableMessageException.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnroutableMessageException.java
new file mode 100644
index 0000000..ec07c1f
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnroutableMessageException.java
@@ -0,0 +1,23 @@
+/**
+ * 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.cm.exceptions.cmresponse;
+
+public class UnroutableMessageException extends CMResponseException {
+
+    public UnroutableMessageException() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/validation/constraints/E164.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/validation/constraints/E164.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/validation/constraints/E164.java
new file mode 100644
index 0000000..3d7dd95
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/validation/constraints/E164.java
@@ -0,0 +1,41 @@
+/**
+ * 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.cm.validation.constraints;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER,
+        ElementType.ANNOTATION_TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+@Constraint(validatedBy = E164Validator.class)
+@Documented
+public @interface E164 {
+
+    // String message() default "{e164.message}";
+    String message() default "E164 format expected for that phone number";
+
+    Class<?>[] groups() default {};
+
+    Class<? extends Payload>[] payload() default {};
+}


[04/23] camel git commit: Fixing. This component info logging should be TRACE or DEBUG. Now, it is set to DEBUG level.

Posted by da...@apache.org.
Fixing. This component info logging should be TRACE or DEBUG. Now, it is
set to DEBUG level. 

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

Branch: refs/heads/master
Commit: 0bd53989b79b90ac4cbb54480cf00a91a0a9d284
Parents: a7f8c12
Author: oalles <oa...@neivi.es>
Authored: Mon Mar 21 12:48:27 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 23 18:46:10 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/component/cm/CMComponent.java  | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/0bd53989/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
index 8dd3b58..3239af2 100644
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
@@ -59,7 +59,7 @@ public class CMComponent extends UriEndpointComponent {
     protected Endpoint createEndpoint(final String uri, final String remaining,
             final Map<String, Object> parameters) throws Exception {
 
-        LOG.info("Creating CM Endpoint ... ");
+        LOG.debug("Creating CM Endpoint ... ");
 
         final String url = CMConstants.DEFAULT_SCHEME + remaining;
         if (!UrlValidator.getInstance().isValid(url)) {
@@ -68,7 +68,7 @@ public class CMComponent extends UriEndpointComponent {
                     url));
         }
 
-        LOG.info("Uri=[{}], path=[{}], parameters=[{}]",
+        LOG.debug("Uri=[{}], path=[{}], parameters=[{}]",
                 new Object[] { URISupport.sanitizeUri(uri),
                         URISupport.sanitizePath(remaining), parameters });
 
@@ -77,7 +77,7 @@ public class CMComponent extends UriEndpointComponent {
         setProperties(config, parameters);
 
         // Validate configuration
-        LOG.info("Validating uri based configuration");
+        LOG.debug("Validating uri based configuration");
         final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator
                 .validate(config);
         if (constraintViolations.size() > 0) {
@@ -86,15 +86,14 @@ public class CMComponent extends UriEndpointComponent {
                 msg.append(String.format("- Invalid value for %s: %s",
                         cv.getPropertyPath().toString(), cv.getMessage()));
             }
-            LOG.error(msg.toString());
             throw new InvalidUriEndpointException(msg.toString());
         }
-        LOG.info("CMConfiguration - OK!");
+        LOG.debug("CMConfiguration - OK!");
 
         // Component is an Endpoint factory. So far, just one Endpoint type.
         // Endpoint construction and configuration.
 
-        LOG.info("Creating CMEndpoint");
+        LOG.debug("Creating CMEndpoint");
         final CMEndpoint endpoint = new CMEndpoint(uri, this);
         endpoint.setConfiguration(config);
         endpoint.setHost(remaining);


[08/23] camel git commit: Fixing lack of test scope camel-spring-javaconfig.

Posted by da...@apache.org.
Fixing lack of test scope camel-spring-javaconfig. 

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

Branch: refs/heads/master
Commit: a17572eea95c31d64b5cb37e076c63656c3af3ce
Parents: c70e9db
Author: oalles <oa...@neivi.es>
Authored: Mon Mar 21 12:41:41 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 23 18:46:10 2016 +0100

----------------------------------------------------------------------
 components/camel-cm/pom.xml | 203 ++++++++++++++++++++-------------------
 1 file changed, 102 insertions(+), 101 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a17572ee/components/camel-cm/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-cm/pom.xml b/components/camel-cm/pom.xml
index 2659259..ff66e28 100644
--- a/components/camel-cm/pom.xml
+++ b/components/camel-cm/pom.xml
@@ -1,101 +1,102 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- 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. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-	<parent>
-		<groupId>org.apache.camel</groupId>
-		<artifactId>components</artifactId>
-		<version>2.16.2</version>
-	</parent>
-	<artifactId>camel-cm</artifactId>
-	<packaging>bundle</packaging>
-	<name>Camel :: CM</name>
-	<description>Camel CM Component</description>
-
-	<properties>
-		<camel.osgi.export.pkg>org.apache.camel.component.cm.*</camel.osgi.export.pkg>
-		<camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=cm</camel.osgi.export.service>
-		<httpclient>${httpclient4-version}</httpclient>
-		<jsoup-version>1.8.3</jsoup-version>
-		<libphonenumber-version>7.2.7</libphonenumber-version>
-		<commons-validator-version>1.5.0</commons-validator-version>
-	</properties>
-
-	<dependencies>
-
-		<dependency>
-			<groupId>org.apache.camel</groupId>
-			<artifactId>camel-core</artifactId>
-		</dependency>
-
-		<dependency>
-			<groupId>com.googlecode.libphonenumber</groupId>
-			<artifactId>libphonenumber</artifactId>
-			<version>${libphonenumber-version}</version>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.httpcomponents</groupId>
-			<artifactId>httpclient-osgi</artifactId>
-			<version>${httpclient}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.jsoup</groupId>
-			<artifactId>jsoup</artifactId>
-			<version>${jsoup-version}</version>
-		</dependency>
-
-		<dependency>
-			<groupId>javax.validation</groupId>
-			<artifactId>validation-api</artifactId>
-			<version>${validation-api-version}</version>
-		</dependency>
-		<dependency>
-			<groupId>javax.el</groupId>
-			<artifactId>javax.el-api</artifactId>
-			<version>${javax.el-api-version}</version>
-		</dependency>
-		<dependency>
-			<groupId>commons-validator</groupId>
-			<artifactId>commons-validator</artifactId>
-			<version>${commons-validator-version}</version>
-		</dependency>
-
-		<!-- test dependencies -->
-		<dependency>
-			<groupId>org.apache.camel</groupId>
-			<artifactId>camel-test-spring</artifactId>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.camel</groupId>
-			<artifactId>camel-spring-javaconfig</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.slf4j</groupId>
-			<artifactId>slf4j-log4j12</artifactId>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.hibernate</groupId>
-			<artifactId>hibernate-validator</artifactId>
-			<version>${hibernate-validator-version}</version>
-			<scope>test</scope>
-		</dependency>
-	</dependencies>
-</project>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.apache.camel</groupId>
+		<artifactId>components</artifactId>
+		<version>2.16.2</version>
+	</parent>
+	<artifactId>camel-cm</artifactId>
+	<packaging>bundle</packaging>
+	<name>Camel :: CM</name>
+	<description>Camel CM Component</description>
+
+	<properties>
+		<camel.osgi.export.pkg>org.apache.camel.component.cm.*</camel.osgi.export.pkg>
+		<camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=cm</camel.osgi.export.service>
+		<httpclient>${httpclient4-version}</httpclient>
+		<jsoup-version>1.8.3</jsoup-version>
+		<libphonenumber-version>7.2.7</libphonenumber-version>
+		<commons-validator-version>1.5.0</commons-validator-version>
+	</properties>
+
+	<dependencies>
+
+		<dependency>
+			<groupId>org.apache.camel</groupId>
+			<artifactId>camel-core</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>com.googlecode.libphonenumber</groupId>
+			<artifactId>libphonenumber</artifactId>
+			<version>${libphonenumber-version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.httpcomponents</groupId>
+			<artifactId>httpclient-osgi</artifactId>
+			<version>${httpclient}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.jsoup</groupId>
+			<artifactId>jsoup</artifactId>
+			<version>${jsoup-version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>javax.validation</groupId>
+			<artifactId>validation-api</artifactId>
+			<version>${validation-api-version}</version>
+		</dependency>
+		<dependency>
+			<groupId>javax.el</groupId>
+			<artifactId>javax.el-api</artifactId>
+			<version>${javax.el-api-version}</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-validator</groupId>
+			<artifactId>commons-validator</artifactId>
+			<version>${commons-validator-version}</version>
+		</dependency>
+
+		<!-- test dependencies -->
+		<dependency>
+			<groupId>org.apache.camel</groupId>
+			<artifactId>camel-test-spring</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.camel</groupId>
+			<artifactId>camel-spring-javaconfig</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-log4j12</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate-validator</artifactId>
+			<version>${hibernate-validator-version}</version>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+</project>


[17/23] camel git commit: Exception hierarchy is being revised. Invalid[URIEndpoint/URL]Exception are removed. Camel 's ResolveEndpointException is used instead.

Posted by da...@apache.org.
Exception hierarchy is being revised. Invalid[URIEndpoint/URL]Exception
are removed. Camel 's ResolveEndpointException is used instead. 

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

Branch: refs/heads/master
Commit: cf97b6da4102683a3ba4350f49b077700c387f6f
Parents: 32308ca
Author: oalles <oa...@neivi.es>
Authored: Tue Mar 22 12:53:17 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 23 18:46:10 2016 +0100

----------------------------------------------------------------------
 .../apache/camel/component/cm/CMComponent.java  |   7 +-
 .../cm/exceptions/CMValidationException.java    |  40 -------
 .../cm/exceptions/InvalidURLException.java      |  30 -----
 .../exceptions/InvalidUriEndpointException.java |  33 ------
 .../apache/camel/component/cm/test/CMTest.java  | 109 ++++++-------------
 5 files changed, 36 insertions(+), 183 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/cf97b6da/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
index fc7b9b5..ab26e14 100644
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
@@ -25,8 +25,7 @@ import javax.validation.Validator;
 import org.apache.camel.BeanInject;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
-import org.apache.camel.component.cm.exceptions.InvalidURLException;
-import org.apache.camel.component.cm.exceptions.InvalidUriEndpointException;
+import org.apache.camel.ResolveEndpointFailedException;
 import org.apache.camel.impl.UriEndpointComponent;
 import org.apache.camel.util.URISupport;
 import org.apache.commons.validator.routines.UrlValidator;
@@ -61,7 +60,7 @@ public class CMComponent extends UriEndpointComponent {
 
         final String url = CMConstants.DEFAULT_SCHEME + remaining;
         if (!UrlValidator.getInstance().isValid(url)) {
-            throw new InvalidURLException(String.format("HOST provided: %s seem to be invalid. Remember SCHEME has to be excluded.", url));
+            throw new ResolveEndpointFailedException(uri, String.format("HOST provided: %s seem to be invalid. Remember SCHEME has to be excluded.", url));
         }
 
         LOG.debug("Uri=[{}], path=[{}], parameters=[{}]", new Object[] {URISupport.sanitizeUri(uri), URISupport.sanitizePath(remaining), parameters });
@@ -78,7 +77,7 @@ public class CMComponent extends UriEndpointComponent {
             for (final ConstraintViolation<CMConfiguration> cv : constraintViolations) {
                 msg.append(String.format("- Invalid value for %s: %s", cv.getPropertyPath().toString(), cv.getMessage()));
             }
-            throw new InvalidUriEndpointException(msg.toString());
+            throw new ResolveEndpointFailedException(uri, msg.toString());
         }
         LOG.debug("CMConfiguration - OK!");
 

http://git-wip-us.apache.org/repos/asf/camel/blob/cf97b6da/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/CMValidationException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/CMValidationException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/CMValidationException.java
deleted file mode 100644
index 65cfaff..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/CMValidationException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.cm.exceptions;
-
-public class CMValidationException extends CMDirectException {
-
-    public CMValidationException() {
-    }
-
-    public CMValidationException(final String message) {
-        super(message);
-    }
-
-    public CMValidationException(final Throwable cause) {
-        super(cause);
-    }
-
-    public CMValidationException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-    public CMValidationException(final String message, final Throwable cause,
-            final boolean enableSuppression, final boolean writableStackTrace) {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/cf97b6da/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidURLException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidURLException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidURLException.java
deleted file mode 100644
index 9f26a5b..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidURLException.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.cm.exceptions;
-
-/**
- * Invalid Resource URL - CM Hosts
- */
-public class InvalidURLException extends InvalidUriEndpointException {
-
-    public InvalidURLException() {
-    }
-
-    public InvalidURLException(final String message) {
-        super(message);
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/cf97b6da/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidUriEndpointException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidUriEndpointException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidUriEndpointException.java
deleted file mode 100644
index 449df1b..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidUriEndpointException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.cm.exceptions;
-
-/**
- * CM Camel component s configuration is based on URI. This exception is raised
- * when the uri provided for configuration is wrong
- *
- */
-public class InvalidUriEndpointException extends CMValidationException {
-
-    public InvalidUriEndpointException() {
-        super();
-    }
-
-    public InvalidUriEndpointException(final String message) {
-        super(message);
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/cf97b6da/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java
index 9fac037..b6e9f1a 100644
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java
@@ -31,8 +31,6 @@ import org.apache.camel.Service;
 import org.apache.camel.component.cm.CMEndpoint;
 import org.apache.camel.component.cm.client.SMSMessage;
 import org.apache.camel.component.cm.exceptions.HostUnavailableException;
-import org.apache.camel.component.cm.exceptions.InvalidURLException;
-import org.apache.camel.component.cm.exceptions.InvalidUriEndpointException;
 import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
 import org.apache.camel.component.cm.exceptions.cmresponse.InsufficientBalanceException;
 import org.apache.camel.component.cm.exceptions.cmresponse.InvalidMSISDNException;
@@ -64,8 +62,7 @@ import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
 import org.springframework.util.Assert;
 
 @RunWith(CamelSpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {
-        CamelTestConfiguration.class }, loader = CamelSpringDelegatingTestContextLoader.class)
+@ContextConfiguration(classes = {CamelTestConfiguration.class }, loader = CamelSpringDelegatingTestContextLoader.class)
 // @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
 // @DisableJmx(false)
 // @MockEndpoints
@@ -94,8 +91,7 @@ public class CMTest extends AbstractJUnit4SpringContextTests {
     public void beforeTest() throws Exception {
         mock.reset();
         camelContext.startRoute(CamelTestConfiguration.SIMPLE_ROUTE_ID);
-        validNumber = pnu.format(pnu.getExampleNumber("ES"),
-                PhoneNumberFormat.E164);
+        validNumber = pnu.format(pnu.getExampleNumber("ES"), PhoneNumberFormat.E164);
     }
 
     @After
@@ -121,7 +117,7 @@ public class CMTest extends AbstractJUnit4SpringContextTests {
      * 1. Invalid URI
      */
 
-    @Test(expected = InvalidUriEndpointException.class)
+    @Test(expected = ResolveEndpointFailedException.class)
     public void testNotRequiredProductToken() throws Throwable {
         try {
             String schemedUri = "cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&testConnectionOnStartup=true";
@@ -132,7 +128,7 @@ public class CMTest extends AbstractJUnit4SpringContextTests {
 
     }
 
-    @Test(expected = InvalidUriEndpointException.class)
+    @Test(expected = ResolveEndpointFailedException.class)
     public void testNotRequiredDefaultFrom() throws Throwable {
         try {
             String schemedUri = "cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&testConnectionOnStartup=true";
@@ -151,7 +147,7 @@ public class CMTest extends AbstractJUnit4SpringContextTests {
         service.start();
     }
 
-    @Test(expected = InvalidURLException.class)
+    @Test(expected = ResolveEndpointFailedException.class)
     public void testInvalidHostDuplicateScheme() throws Throwable {
         // cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
         try {
@@ -183,8 +179,7 @@ public class CMTest extends AbstractJUnit4SpringContextTests {
     public void testAsPartOfARoute() throws Exception {
 
         // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateUnicodeMessage(), validNumber, null);
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateUnicodeMessage(), validNumber, null);
         cmProxy.send(smsMessage);
     }
 
@@ -192,15 +187,11 @@ public class CMTest extends AbstractJUnit4SpringContextTests {
     public void testNoAccountFoundForProductTokenException() throws Exception {
 
         // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer()
-                .setSender(new NoAccountFoundForProductTokenExceptionSender());
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer().setSender(new NoAccountFoundForProductTokenExceptionSender());
 
         // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateGSM0338Message(), validNumber, null);
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateGSM0338Message(), validNumber, null);
         cmProxy.send(smsMessage);
     }
 
@@ -212,14 +203,11 @@ public class CMTest extends AbstractJUnit4SpringContextTests {
     public void testCMResponseException() throws Exception {
 
         // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
         endpoint.getProducer().setSender(new CMResponseExceptionSender());
 
         // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateUnicodeMessage(), validNumber, null);
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateUnicodeMessage(), validNumber, null);
         cmProxy.send(smsMessage);
     }
 
@@ -227,15 +215,11 @@ public class CMTest extends AbstractJUnit4SpringContextTests {
     public void testInsufficientBalanceException() throws Exception {
 
         // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer()
-                .setSender(new InsufficientBalanceExceptionSender());
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer().setSender(new InsufficientBalanceExceptionSender());
 
         // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateGSM0338Message(), validNumber, null);
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateGSM0338Message(), validNumber, null);
         cmProxy.send(smsMessage);
     }
 
@@ -243,14 +227,11 @@ public class CMTest extends AbstractJUnit4SpringContextTests {
     public void testInvalidMSISDNException() throws Exception {
 
         // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
         endpoint.getProducer().setSender(new InvalidMSISDNExceptionSender());
 
         // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateUnicodeMessage(), validNumber, null);
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateUnicodeMessage(), validNumber, null);
         cmProxy.send(smsMessage);
     }
 
@@ -258,15 +239,11 @@ public class CMTest extends AbstractJUnit4SpringContextTests {
     public void testInvalidProductTokenException() throws Exception {
 
         // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer()
-                .setSender(new InvalidProductTokenExceptionSender());
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer().setSender(new InvalidProductTokenExceptionSender());
 
         // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateUnicodeMessage(), validNumber, null);
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateUnicodeMessage(), validNumber, null);
         cmProxy.send(smsMessage);
     }
 
@@ -274,14 +251,11 @@ public class CMTest extends AbstractJUnit4SpringContextTests {
     public void testNoMessageException() throws Exception {
 
         // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
         endpoint.getProducer().setSender(new NoMessageExceptionSender());
 
         // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateGSM0338Message(), validNumber, null);
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateGSM0338Message(), validNumber, null);
         cmProxy.send(smsMessage);
     }
 
@@ -289,15 +263,11 @@ public class CMTest extends AbstractJUnit4SpringContextTests {
     public void testNotPhoneNumberFoundException() throws Exception {
 
         // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer()
-                .setSender(new NotPhoneNumberFoundExceptionSender());
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer().setSender(new NotPhoneNumberFoundExceptionSender());
 
         // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateUnicodeMessage(), validNumber, null);
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateUnicodeMessage(), validNumber, null);
         cmProxy.send(smsMessage);
     }
 
@@ -305,14 +275,11 @@ public class CMTest extends AbstractJUnit4SpringContextTests {
     public void testUnknownErrorException() throws Exception {
 
         // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
         endpoint.getProducer().setSender(new UnknownErrorExceptionSender());
 
         // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateGSM0338Message(), validNumber, null);
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateGSM0338Message(), validNumber, null);
         cmProxy.send(smsMessage);
     }
 
@@ -320,15 +287,11 @@ public class CMTest extends AbstractJUnit4SpringContextTests {
     public void testUnroutableMessageException() throws Exception {
 
         // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer()
-                .setSender(new UnroutableMessageExceptionSender());
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer().setSender(new UnroutableMessageExceptionSender());
 
         // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateUnicodeMessage(), validNumber, null);
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateUnicodeMessage(), validNumber, null);
         cmProxy.send(smsMessage);
     }
 
@@ -336,9 +299,7 @@ public class CMTest extends AbstractJUnit4SpringContextTests {
     public void testCMEndpointIsForProducing() throws Exception {
 
         // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
         endpoint.createConsumer(null);
     }
 
@@ -346,19 +307,15 @@ public class CMTest extends AbstractJUnit4SpringContextTests {
     public void testCMEndpointGetHost() throws Exception {
 
         // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
-        Assert.isTrue(endpoint.getHost().equals(applicationContext
-                .getEnvironment().getRequiredProperty("cm.url")));
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
+        Assert.isTrue(endpoint.getHost().equals(applicationContext.getEnvironment().getRequiredProperty("cm.url")));
     }
 
     @Test(expected = InvalidPayloadRuntimeException.class)
     public void testSendInvalidPayload() throws Exception {
 
         // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateGSM0338Message(), null, null);
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateGSM0338Message(), null, null);
         cmProxy.send(smsMessage);
     }
 


[06/23] camel git commit: camel-cm component added following the steps in http://camel.apache.org/add-new-component-guide.html

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoMessageException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoMessageException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoMessageException.java
new file mode 100644
index 0000000..4398219
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoMessageException.java
@@ -0,0 +1,23 @@
+/**
+ * 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.cm.exceptions.cmresponse;
+
+public class NoMessageException extends CMResponseException {
+
+    public NoMessageException() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NotPhoneNumberFoundException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NotPhoneNumberFoundException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NotPhoneNumberFoundException.java
new file mode 100644
index 0000000..877b972
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NotPhoneNumberFoundException.java
@@ -0,0 +1,23 @@
+/**
+ * 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.cm.exceptions.cmresponse;
+
+public class NotPhoneNumberFoundException extends CMResponseException {
+
+    public NotPhoneNumberFoundException() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnknownErrorException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnknownErrorException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnknownErrorException.java
new file mode 100644
index 0000000..bb0951a
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnknownErrorException.java
@@ -0,0 +1,26 @@
+/**
+ * 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.cm.exceptions.cmresponse;
+
+/**
+ * An unexpected error occurred. Check the provided values. Contact CM for support.
+ */
+public class UnknownErrorException extends CMResponseException {
+
+    public UnknownErrorException() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnroutableMessageException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnroutableMessageException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnroutableMessageException.java
new file mode 100644
index 0000000..ec07c1f
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/UnroutableMessageException.java
@@ -0,0 +1,23 @@
+/**
+ * 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.cm.exceptions.cmresponse;
+
+public class UnroutableMessageException extends CMResponseException {
+
+    public UnroutableMessageException() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/validation/constraints/E164.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/validation/constraints/E164.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/validation/constraints/E164.java
new file mode 100644
index 0000000..3d7dd95
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/validation/constraints/E164.java
@@ -0,0 +1,41 @@
+/**
+ * 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.cm.validation.constraints;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER,
+        ElementType.ANNOTATION_TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+@Constraint(validatedBy = E164Validator.class)
+@Documented
+public @interface E164 {
+
+    // String message() default "{e164.message}";
+    String message() default "E164 format expected for that phone number";
+
+    Class<?>[] groups() default {};
+
+    Class<? extends Payload>[] payload() default {};
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/validation/constraints/E164Validator.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/validation/constraints/E164Validator.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/validation/constraints/E164Validator.java
new file mode 100644
index 0000000..d8160f7
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/validation/constraints/E164Validator.java
@@ -0,0 +1,66 @@
+/**
+ * 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.cm.validation.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+import com.google.i18n.phonenumbers.NumberParseException;
+import com.google.i18n.phonenumbers.PhoneNumberUtil;
+import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
+import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
+
+/**
+ * Checks that a given character sequence (e.g. string) is a valid E164 formatted phonenumber. https://www.cmtelecom.com/newsroom/how-to-format-international-telephone- numbers
+ * https://github.com/googlei18n/libphonenumber
+ */
+public class E164Validator implements ConstraintValidator<E164, String> {
+
+    private final PhoneNumberUtil pnu = PhoneNumberUtil.getInstance();
+
+    @Override
+    public void initialize(final E164 constraintAnnotation) {
+    }
+
+    @Override
+    public boolean isValid(final String value, final ConstraintValidatorContext context) {
+
+        if (value == null) {
+            return false;
+        }
+        try {
+
+            final PhoneNumber parsingResult = pnu.parse(value, null);
+            if (!pnu.format(parsingResult, PhoneNumberFormat.E164).equals(value)) {
+                return false;
+            }
+            return true;
+        } catch (final NumberParseException t) {
+            // Errors when parsing phonenumber
+            return false;
+        }
+
+        // CountryCodeSource.FROM_NUMBER_WITH_PLUS_SIGN
+        // log.debug("Phone Number: {}", value);
+        // log.debug("Country code: {}", numberProto.getCountryCode());
+        // log.debug("National Number: {}", numberProto.getNationalNumber());
+        // log.debug("E164 format: {}", pnu.format(numberProto,
+        // PhoneNumberFormat.E164));
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/resources/META-INF/services/org/apache/camel/component/cm
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/resources/META-INF/services/org/apache/camel/component/cm b/components/camel-cm/src/main/resources/META-INF/services/org/apache/camel/component/cm
new file mode 100644
index 0000000..bf9d84b
--- /dev/null
+++ b/components/camel-cm/src/main/resources/META-INF/services/org/apache/camel/component/cm
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+class=org.apache.camel.component.cm.CMComponent

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/resources/log4j.properties b/components/camel-cm/src/main/resources/log4j.properties
new file mode 100644
index 0000000..8c6ec38
--- /dev/null
+++ b/components/camel-cm/src/main/resources/log4j.properties
@@ -0,0 +1,37 @@
+#
+# 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.
+#
+log4j.rootLogger=error, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+
+# Print the date in ISO 8601 format
+log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
+
+log4j.appender.R=org.apache.log4j.RollingFileAppender
+log4j.appender.R.File=application.log
+
+log4j.appender.R.MaxFileSize=100KB
+# Keep one backup file
+log4j.appender.R.MaxBackupIndex=1
+
+log4j.appender.R.layout=org.apache.log4j.PatternLayout
+log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
+
+# LOGGERS
+log4j.logger.org.apache=INFO
+log4j.logger.org.apache.camel.cm=TRACE

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMConfigurationTest.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMConfigurationTest.java
new file mode 100644
index 0000000..beafa33
--- /dev/null
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMConfigurationTest.java
@@ -0,0 +1,142 @@
+/**
+ * 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.cm.test;
+
+import java.util.Set;
+import java.util.UUID;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.apache.camel.component.cm.CMConfiguration;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.util.Assert;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { ValidatorConfiguration.class })
+// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
+// @DisableJmx(false)
+// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class CMConfigurationTest extends AbstractJUnit4SpringContextTests {
+
+    @Autowired
+    private Validator validator;
+
+    @Before
+    public void beforeTest() throws Exception {
+    }
+
+    // @After
+    // public void afterTest() {
+
+    @Test
+    public void testNullProductToken() throws Exception {
+
+        final CMConfiguration configuration = new CMConfiguration();
+
+        // length: 1-11
+        configuration.setDefaultFrom("DefaultFrom");
+        configuration.setProductTokenAsUUID(null);
+        configuration.setDefaultMaxNumberOfParts(8);
+        configuration.setTestConnectionOnStartup(false);
+
+        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testNullDefaultFrom() throws Exception {
+
+        final CMConfiguration configuration = new CMConfiguration();
+
+        // length: 1-11
+        configuration.setDefaultFrom(null);
+
+        configuration.setProductTokenAsUUID(UUID.randomUUID());
+        configuration.setDefaultMaxNumberOfParts(8);
+        configuration.setTestConnectionOnStartup(false);
+
+        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testDefaultFromFieldMaxLength() throws Exception {
+
+        final CMConfiguration configuration = new CMConfiguration();
+
+        // length: 1-11
+        configuration.setDefaultFrom("123456789012");
+
+        configuration.setProductTokenAsUUID(UUID.randomUUID());
+        configuration.setDefaultMaxNumberOfParts(8);
+        configuration.setTestConnectionOnStartup(false);
+
+        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testDefaultFromFieldZeroLength() throws Exception {
+
+        final CMConfiguration configuration = new CMConfiguration();
+
+        // length: 1-11
+        configuration.setDefaultFrom("");
+
+        configuration.setProductTokenAsUUID(UUID.randomUUID());
+        configuration.setDefaultMaxNumberOfParts(8);
+        configuration.setTestConnectionOnStartup(false);
+
+        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testMaxNumberOfParts() throws Exception {
+
+        final CMConfiguration configuration = new CMConfiguration();
+
+        configuration.setProductTokenAsUUID(UUID.randomUUID());
+        configuration.setDefaultFrom("DefaultFrom");
+        configuration.setDefaultMaxNumberOfParts(9);
+        configuration.setTestConnectionOnStartup(false);
+
+        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testMaxNumberOfPartsZero() throws Exception {
+
+        final CMConfiguration configuration = new CMConfiguration();
+
+        configuration.setProductTokenAsUUID(UUID.randomUUID());
+        configuration.setDefaultFrom("DefaultFrom");
+        configuration.setDefaultMaxNumberOfParts(0);
+        configuration.setTestConnectionOnStartup(false);
+
+        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
new file mode 100644
index 0000000..9eacecb
--- /dev/null
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
@@ -0,0 +1,323 @@
+/**
+ * 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.cm.test;
+
+import com.google.i18n.phonenumbers.PhoneNumberUtil;
+import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
+import org.apache.camel.component.cm.CMConstants;
+import org.apache.camel.component.cm.CMMessage;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.util.Assert;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { ValidatorConfiguration.class })
+// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
+// @DisableJmx(false)
+// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class CMMessageTest extends AbstractJUnit4SpringContextTests {
+
+    private final PhoneNumberUtil pnu = PhoneNumberUtil.getInstance();
+    private String validNumber;
+
+    @Before
+    public void beforeTest() throws Exception {
+        validNumber = pnu.format(pnu.getExampleNumber("ES"), PhoneNumberFormat.E164);
+    }
+
+    // @After
+    // public void afterTest() {
+
+    /*
+     * GSM0338
+     */
+
+    @Test
+    public void testGSM338AndLTMAXGSMMESSAGELENGTH() throws Exception {
+
+        // 0338 and less than 160 char -> 1 part
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < CMConstants.MAX_GSM_MESSAGE_LENGTH; index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 1);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndEQMAXGSMMESSAGELENGTH() throws Exception {
+        // 0338 and length is exactly 160 -> 1 part
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < CMConstants.MAX_GSM_MESSAGE_LENGTH; index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 1);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndGTMAXGSMMESSAGELENGTH() throws Exception {
+
+        // 0338 and length is exactly 161 -> 2 part
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < CMConstants.MAX_GSM_MESSAGE_LENGTH + 1; index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 2);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndLT2MAXGSMMESSAGELENGTH() throws Exception {
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (2 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART - 1); index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 2);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndEQ2MAXGSMMESSAGELENGTH() throws Exception {
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (2 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 2);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndGT2MAXGSMMESSAGELENGTH() throws Exception {
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (2 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 3);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndEQ8MAXGSMMESSAGELENGTH() throws Exception {
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (8 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 8);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndGT8MAXGSMMESSAGELENGTH() throws Exception {
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (8 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 8);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    /*
+     * Unicode Messages
+     */
+
+    @Test
+    public void testUnicodeAndLTMAXGSMMESSAGELENGTH() throws Exception {
+
+        String ch = "\uF400";
+
+        // 0338 and less than 160 char -> 1 part
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < CMConstants.MAX_UNICODE_MESSAGE_LENGTH; index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 1);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndEQMAXGSMMESSAGELENGTH() throws Exception {
+        // 0338 and length is exactly 160 -> 1 part
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < CMConstants.MAX_UNICODE_MESSAGE_LENGTH; index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 1);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndGTMAXGSMMESSAGELENGTH() throws Exception {
+
+        // 0338 and length is exactly 161 -> 2 part
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < CMConstants.MAX_UNICODE_MESSAGE_LENGTH + 1; index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 2);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndLT2MAXGSMMESSAGELENGTH() throws Exception {
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (2 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART - 1); index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 2);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndEQ2MAXGSMMESSAGELENGTH() throws Exception {
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (2 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 2);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndGT2MAXGSMMESSAGELENGTH() throws Exception {
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (2 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 3);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndEQ8MAXGSMMESSAGELENGTH() throws Exception {
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (8 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 8);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndGT8MAXGSMMESSAGELENGTH() throws Exception {
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (8 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 8);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMProxy.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMProxy.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMProxy.java
new file mode 100644
index 0000000..45b88bd
--- /dev/null
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMProxy.java
@@ -0,0 +1,26 @@
+/**
+ * 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.cm.test;
+
+import org.apache.camel.component.cm.client.SMSMessage;
+
+/**
+ * Regular interface used to proxy a producer sending to the Route out to CM Direct {@link http://camel.apache.org/using-camelproxy.html}
+ */
+public interface CMProxy {
+    void send(SMSMessage smsMessage);
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java
new file mode 100644
index 0000000..aac110e
--- /dev/null
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java
@@ -0,0 +1,407 @@
+/**
+ * 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.cm.test;
+
+import java.math.BigInteger;
+import java.security.SecureRandom;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ResolveEndpointFailedException;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.Service;
+import org.apache.camel.component.cm.CMEndpoint;
+import org.apache.camel.component.cm.client.SMSMessage;
+import org.apache.camel.component.cm.exceptions.HostUnavailableException;
+import org.apache.camel.component.cm.exceptions.InvalidPayloadException;
+import org.apache.camel.component.cm.exceptions.InvalidURLException;
+import org.apache.camel.component.cm.exceptions.InvalidUriEndpointException;
+import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
+import org.apache.camel.component.cm.exceptions.cmresponse.InsufficientBalanceException;
+import org.apache.camel.component.cm.exceptions.cmresponse.InvalidMSISDNException;
+import org.apache.camel.component.cm.exceptions.cmresponse.InvalidProductTokenException;
+import org.apache.camel.component.cm.exceptions.cmresponse.NoAccountFoundForProductTokenException;
+import org.apache.camel.component.cm.exceptions.cmresponse.NoMessageException;
+import org.apache.camel.component.cm.exceptions.cmresponse.NotPhoneNumberFoundException;
+import org.apache.camel.component.cm.exceptions.cmresponse.UnknownErrorException;
+import org.apache.camel.component.cm.exceptions.cmresponse.UnroutableMessageException;
+import org.apache.camel.component.cm.test.mocks.cmsender.CMResponseExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.InsufficientBalanceExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.InvalidMSISDNExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.InvalidProductTokenExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.NoAccountFoundForProductTokenExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.NoMessageExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.NotPhoneNumberFoundExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.UnknownErrorExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.UnroutableMessageExceptionSender;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.spring.CamelSpringDelegatingTestContextLoader;
+import org.apache.camel.test.spring.CamelSpringJUnit4ClassRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import org.springframework.util.Assert;
+
+import com.google.i18n.phonenumbers.PhoneNumberUtil;
+import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
+
+@RunWith(CamelSpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {
+        CamelTestConfiguration.class }, loader = CamelSpringDelegatingTestContextLoader.class)
+// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
+// @DisableJmx(false)
+// @MockEndpoints
+// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class CMTest extends AbstractJUnit4SpringContextTests {
+
+    // dependency: camel-spring-javaconfig
+
+    @Autowired
+    private CamelContext camelContext;
+
+    private SecureRandom random = new SecureRandom();
+
+    private final PhoneNumberUtil pnu = PhoneNumberUtil.getInstance();
+    private String validNumber;
+
+    @Produce(uri = "direct:sms")
+    private CMProxy cmProxy;
+
+    @EndpointInject(uri = "mock:test")
+    private MockEndpoint mock;
+
+    // private StopWatch stopWatch = new StopWatch(getClass().getSimpleName());
+
+    @Before
+    public void beforeTest() throws Exception {
+        mock.reset();
+        camelContext.startRoute(CamelTestConfiguration.SIMPLE_ROUTE_ID);
+        validNumber = pnu.format(pnu.getExampleNumber("ES"),
+                PhoneNumberFormat.E164);
+    }
+
+    @After
+    public void afterTest() {
+
+        try {
+            camelContext.stopRoute(CamelTestConfiguration.SIMPLE_ROUTE_ID);
+        } catch (Exception e) {
+            logger.error("Exception trying to stop de routes", e);
+        }
+
+        // Stop all routes
+        // for (Route route : camelContext.getRoutes()) {
+        // try {
+        // camelContext.stopRoute(route.getId());
+        // } catch (Exception e) {
+        // logger.error("Exception trying to stop de routes", e);
+        // }
+        // }
+    }
+
+    /*
+     * 1. Invalid URI
+     */
+
+    @Test(expected = InvalidUriEndpointException.class)
+    public void testNotRequiredProductToken() throws Throwable {
+        try {
+            String schemedUri = "cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&testConnectionOnStartup=true";
+            camelContext.getEndpoint(schemedUri).start();
+        } catch (Throwable t) {
+            throw t.getCause();
+        }
+
+    }
+
+    @Test(expected = InvalidUriEndpointException.class)
+    public void testNotRequiredDefaultFrom() throws Throwable {
+        try {
+            String schemedUri = "cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&testConnectionOnStartup=true";
+            camelContext.getEndpoint(schemedUri).start();
+        } catch (Throwable t) {
+            throw t.getCause();
+        }
+
+    }
+
+    @Test(expected = HostUnavailableException.class)
+    public void testHostUnavailableException() throws Throwable {
+        // cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
+        String schemedUri = "cm://dummy.sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true";
+        Service service = camelContext.getEndpoint(schemedUri).createProducer();
+        service.start();
+    }
+
+    @Test(expected = InvalidURLException.class)
+    public void testInvalidHostDuplicateScheme() throws Throwable {
+        // cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
+        try {
+            String schemedUri = "cm://https://demo.com";
+            camelContext.getEndpoint(schemedUri);
+        } catch (Throwable t) {
+            throw t.getCause();
+        }
+    }
+
+    @Test(expected = ResolveEndpointFailedException.class)
+    public void testInvalidUriEndpoint() throws Throwable {
+        // cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
+        String noHostUri = "cm://gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true";
+        camelContext.getEndpoint(noHostUri);
+    }
+
+    /*
+     * 2. Invalid Payload
+     */
+
+    @Test(expected = RuntimeException.class)
+    public void testNullPayload() throws Throwable {
+        cmProxy.send(null);
+    }
+
+    // @DirtiesContext
+    @Test(expected = NoAccountFoundForProductTokenException.class)
+    public void testAsPartOfARoute() throws Exception {
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateUnicodeMessage(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    @Test(expected = NoAccountFoundForProductTokenException.class)
+    public void testNoAccountFoundForProductTokenException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer()
+                .setSender(new NoAccountFoundForProductTokenExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateGSM0338Message(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    /*
+     * 3. CM Responses (Faking Exceptions)
+     */
+
+    @Test(expected = CMResponseException.class)
+    public void testCMResponseException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer().setSender(new CMResponseExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateUnicodeMessage(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    @Test(expected = InsufficientBalanceException.class)
+    public void testInsufficientBalanceException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer()
+                .setSender(new InsufficientBalanceExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateGSM0338Message(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    @Test(expected = InvalidMSISDNException.class)
+    public void testInvalidMSISDNException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer().setSender(new InvalidMSISDNExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateUnicodeMessage(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    @Test(expected = InvalidProductTokenException.class)
+    public void testInvalidProductTokenException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer()
+                .setSender(new InvalidProductTokenExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateUnicodeMessage(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    @Test(expected = NoMessageException.class)
+    public void testNoMessageException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer().setSender(new NoMessageExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateGSM0338Message(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    @Test(expected = NotPhoneNumberFoundException.class)
+    public void testNotPhoneNumberFoundException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer()
+                .setSender(new NotPhoneNumberFoundExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateUnicodeMessage(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    @Test(expected = UnknownErrorException.class)
+    public void testUnknownErrorException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer().setSender(new UnknownErrorExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateGSM0338Message(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    @Test(expected = UnroutableMessageException.class)
+    public void testUnroutableMessageException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer()
+                .setSender(new UnroutableMessageExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateUnicodeMessage(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    @Test(expected = RuntimeCamelException.class)
+    public void testCMEndpointIsForProducing() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.createConsumer(null);
+    }
+
+    @Test
+    public void testCMEndpointGetHost() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        Assert.isTrue(endpoint.getHost().equals(applicationContext
+                .getEnvironment().getRequiredProperty("cm.url")));
+    }
+
+    @Test(expected = InvalidPayloadException.class)
+    public void testSendInvalidPayload() throws Exception {
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateGSM0338Message(), null, null);
+        cmProxy.send(smsMessage);
+    }
+
+    /*
+     * CMMessages
+     */
+
+    // @Test(expected = RuntimeException.class)
+    // public void testSkel() throws Exception {
+
+    // mock.expectedMessageCount(1);
+    //
+    // // Body
+    // final SMSMessage smsMessage = new SMSMessage("Hello CM", validNumber);
+    // cmProxy.send(smsMessage);
+    //
+    // mock.assertIsSatisfied();
+    // }
+
+    private String generateUnicodeMessage() {
+        String ch = "\uF400";
+        return generateRandomLengthMessageByChar(ch);
+    }
+
+    private String generateGSM0338Message() {
+        String ch = "a";
+        return generateRandomLengthMessageByChar(ch);
+    }
+
+    private String generateRandomLengthMessageByChar(String ch) {
+        // random Length
+        int msgLength = (int) (Math.random() * 2000);
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < msgLength; index++) {
+            message.append(ch);
+        }
+        return message.toString();
+    }
+
+    //
+    private String generateIdAsString() {
+        return new BigInteger(130, random).toString(32);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CamelTestConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CamelTestConfiguration.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CamelTestConfiguration.java
new file mode 100644
index 0000000..b6a136d
--- /dev/null
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CamelTestConfiguration.java
@@ -0,0 +1,100 @@
+/**
+ * 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.cm.test;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spring.javaconfig.SingleRouteCamelConfiguration;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.core.env.Environment;
+import org.springframework.util.Assert;
+import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
+
+/**
+ * Builds a SimpleRoute to send a message to CM GW and CM Uri is built based on properties in a file.
+ */
+@Configuration("cmConfig")
+@PropertySource("classpath:/cm-smsgw.properties")
+public class CamelTestConfiguration extends SingleRouteCamelConfiguration {
+
+    public static final String SIMPLE_ROUTE_ID = "simple-route";
+
+    private String uri;
+
+    @Override
+    public RouteBuilder route() {
+        return new RouteBuilder() {
+
+            @Override
+            public void configure() throws Exception {
+
+                Assert.hasLength(uri);
+
+                log.info("\nCM Component is an URI based component\nCM URI: {}", uri);
+
+                // Route definition
+                from("direct:sms").to(uri).to("mock:test").routeId(SIMPLE_ROUTE_ID).autoStartup(true);
+
+            }
+        };
+    }
+
+    @Bean
+    public LocalValidatorFactoryBean getValidatorFactory() {
+        final LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
+        localValidatorFactoryBean.getValidationPropertyMap().put("hibernate.validator.fail_fast", "true");
+        return localValidatorFactoryBean;
+    }
+
+    /**
+     * Build the URI of the CM Component based on Environmental properties
+     */
+    @Override
+    public final void setApplicationContext(final ApplicationContext applicationContext) {
+
+        super.setApplicationContext(applicationContext);
+
+        final Environment env = applicationContext.getEnvironment();
+
+        final String host = env.getRequiredProperty("cm.url");
+        final String productTokenString = env.getRequiredProperty("cm.product-token");
+        final String sender = env.getRequiredProperty("cm.default-sender");
+
+        final StringBuffer cmUri = new StringBuffer("cm:" + host).append("?productToken=").append(productTokenString);
+        if (sender != null && !sender.isEmpty()) {
+            cmUri.append("&defaultFrom=").append(sender);
+        }
+
+        // Defaults to false
+        final Boolean testConnectionOnStartup = Boolean.parseBoolean(env.getProperty("cm.testConnectionOnStartup", "false"));
+        if (testConnectionOnStartup) {
+            cmUri.append("&testConnectionOnStartup=").append(testConnectionOnStartup.toString());
+        }
+
+        // Defaults to 8
+        final Integer defaultMaxNumberOfParts = Integer.parseInt(env.getProperty("defaultMaxNumberOfParts", "8"));
+        cmUri.append("&defaultMaxNumberOfParts=").append(defaultMaxNumberOfParts.toString());
+
+        uri = cmUri.toString();
+    }
+
+    public String getUri() {
+        return uri;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java
new file mode 100644
index 0000000..63bfced
--- /dev/null
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java
@@ -0,0 +1,183 @@
+/**
+ * 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.cm.test;
+
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import com.google.i18n.phonenumbers.PhoneNumberUtil;
+import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
+import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
+import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber.CountryCodeSource;
+import org.apache.camel.component.cm.client.SMSMessage;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.util.Assert;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {ValidatorConfiguration.class })
+// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
+// @DisableJmx(false)
+// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class SMSMessageTest extends AbstractJUnit4SpringContextTests {
+
+    @Autowired
+    private Validator validator;
+
+    private final PhoneNumberUtil pnu = PhoneNumberUtil.getInstance();
+    private String validNumber;
+
+    @Before
+    public void beforeTest() throws Exception {
+
+        validNumber = pnu.format(pnu.getExampleNumber("ES"), PhoneNumberFormat.E164);
+    }
+
+    // @After
+    // public void afterTest() {
+
+    @Test
+    public void testSMSMessageConstructor() throws Throwable {
+
+        // Coverage ;)
+        SMSMessage message = new SMSMessage(null, null);
+        Assert.isNull(message.getMessage());
+        Assert.isNull(message.getPhoneNumber());
+
+        message = new SMSMessage("idAsString", null, null, "MySelf");
+        Assert.isTrue(message.getId().equals("idAsString"));
+        Assert.isTrue(message.getFrom().equals("MySelf"));
+    }
+
+    @Test
+    public void testNullMessageField() throws Exception {
+
+        final SMSMessage m = new SMSMessage(null, validNumber);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testNullPhoneNumber() throws Exception {
+
+        final SMSMessage m = new SMSMessage("Hello world!", null);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testDynamicFromFieldMaxLength() throws Exception {
+
+        String dynamicFrom = "messagelengthgreaterthan12";
+
+        final SMSMessage m = new SMSMessage("idAsString", "Hello World", validNumber, dynamicFrom);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testDynamicFromFieldZeroLength() throws Exception {
+
+        String zeroLengthDynamicFrom = "";
+
+        final SMSMessage m = new SMSMessage("idAsString", "Hello World", validNumber, zeroLengthDynamicFrom);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testIdAsStringMaxLength() throws Exception {
+
+        String idAsString = "thisistheidastringlengthgreaterthan32";
+
+        final SMSMessage m = new SMSMessage(idAsString, "Hello World", validNumber, "MySelf");
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testIdAsStringFieldZeroLength() throws Exception {
+
+        String zeroLengthIdAsString = "";
+
+        final SMSMessage m = new SMSMessage(zeroLengthIdAsString, "Hello World", validNumber, "MySelf");
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testE164NullNumberIsInValid() throws Exception {
+
+        final String phoneNumber = null;
+        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testE164IsValid() throws Exception {
+
+        final SMSMessage m = new SMSMessage("Hello world!", validNumber);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(0 == constraintViolations.size());
+    }
+
+    @Test
+    public void testE164NoPlusSignedNumberIsInvalid() throws Exception {
+
+        final String phoneNumber = "34600000000";
+        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testE164NoPlusSignedNumberBut00IsInvalid() throws Exception {
+
+        final String phoneNumber = new PhoneNumber().setCountryCodeSource(CountryCodeSource.FROM_NUMBER_WITHOUT_PLUS_SIGN).setNationalNumber(0034600000000).toString();
+        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testE164NumberWithPlusSignIsInvalid() throws Exception {
+
+        final String phoneNumber = "+34 600 00 00 00";
+        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/ValidatorConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/ValidatorConfiguration.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/ValidatorConfiguration.java
new file mode 100644
index 0000000..9e8779e
--- /dev/null
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/ValidatorConfiguration.java
@@ -0,0 +1,35 @@
+/**
+ * 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.cm.test;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
+
+/**
+ * Builds a SimpleRoute to send a message to CM GW and CM Uri is built based on properties in a file.
+ */
+@Configuration("smsConfig")
+public class ValidatorConfiguration {
+
+    @Bean
+    public LocalValidatorFactoryBean getValidatorFactory() {
+        final LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
+        localValidatorFactoryBean.getValidationPropertyMap().put("hibernate.validator.fail_fast", "true");
+        return localValidatorFactoryBean;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/CMResponseExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/CMResponseExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/CMResponseExceptionSender.java
new file mode 100644
index 0000000..f116f28
--- /dev/null
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/CMResponseExceptionSender.java
@@ -0,0 +1,31 @@
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.MessagingException;
+import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
+
+public class CMResponseExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage) throws MessagingException {
+        throw new CMResponseException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InsufficientBalanceExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InsufficientBalanceExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InsufficientBalanceExceptionSender.java
new file mode 100644
index 0000000..03f940d
--- /dev/null
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InsufficientBalanceExceptionSender.java
@@ -0,0 +1,31 @@
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.MessagingException;
+import org.apache.camel.component.cm.exceptions.cmresponse.InsufficientBalanceException;
+
+public class InsufficientBalanceExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage) throws MessagingException {
+        throw new InsufficientBalanceException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidMSISDNExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidMSISDNExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidMSISDNExceptionSender.java
new file mode 100644
index 0000000..b45d113
--- /dev/null
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidMSISDNExceptionSender.java
@@ -0,0 +1,31 @@
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.MessagingException;
+import org.apache.camel.component.cm.exceptions.cmresponse.InvalidMSISDNException;
+
+public class InvalidMSISDNExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage) throws MessagingException {
+        throw new InvalidMSISDNException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidProductTokenExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidProductTokenExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidProductTokenExceptionSender.java
new file mode 100644
index 0000000..7ff256c
--- /dev/null
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidProductTokenExceptionSender.java
@@ -0,0 +1,31 @@
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.MessagingException;
+import org.apache.camel.component.cm.exceptions.cmresponse.InvalidProductTokenException;
+
+public class InvalidProductTokenExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage) throws MessagingException {
+        throw new InvalidProductTokenException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoAccountFoundForProductTokenExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoAccountFoundForProductTokenExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoAccountFoundForProductTokenExceptionSender.java
new file mode 100644
index 0000000..8b57406
--- /dev/null
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoAccountFoundForProductTokenExceptionSender.java
@@ -0,0 +1,31 @@
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.MessagingException;
+import org.apache.camel.component.cm.exceptions.cmresponse.NoAccountFoundForProductTokenException;
+
+public class NoAccountFoundForProductTokenExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage) throws MessagingException {
+        throw new NoAccountFoundForProductTokenException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoMessageExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoMessageExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoMessageExceptionSender.java
new file mode 100644
index 0000000..9520934
--- /dev/null
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoMessageExceptionSender.java
@@ -0,0 +1,31 @@
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.MessagingException;
+import org.apache.camel.component.cm.exceptions.cmresponse.NoMessageException;
+
+public class NoMessageExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage) throws MessagingException {
+        throw new NoMessageException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NotPhoneNumberFoundExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NotPhoneNumberFoundExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NotPhoneNumberFoundExceptionSender.java
new file mode 100644
index 0000000..a85639b
--- /dev/null
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NotPhoneNumberFoundExceptionSender.java
@@ -0,0 +1,31 @@
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.MessagingException;
+import org.apache.camel.component.cm.exceptions.cmresponse.NotPhoneNumberFoundException;
+
+public class NotPhoneNumberFoundExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage) throws MessagingException {
+        throw new NotPhoneNumberFoundException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnknownErrorExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnknownErrorExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnknownErrorExceptionSender.java
new file mode 100644
index 0000000..d20723f
--- /dev/null
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnknownErrorExceptionSender.java
@@ -0,0 +1,31 @@
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.MessagingException;
+import org.apache.camel.component.cm.exceptions.cmresponse.UnknownErrorException;
+
+public class UnknownErrorExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage) throws MessagingException {
+        throw new UnknownErrorException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnroutableMessageExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnroutableMessageExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnroutableMessageExceptionSender.java
new file mode 100644
index 0000000..3b6af1e
--- /dev/null
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnroutableMessageExceptionSender.java
@@ -0,0 +1,31 @@
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.MessagingException;
+import org.apache.camel.component.cm.exceptions.cmresponse.UnroutableMessageException;
+
+public class UnroutableMessageExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage) throws MessagingException {
+        throw new UnroutableMessageException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/test/resources/cm-smsgw.properties
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/resources/cm-smsgw.properties b/components/camel-cm/src/test/resources/cm-smsgw.properties
new file mode 100644
index 0000000..9393fa9
--- /dev/null
+++ b/components/camel-cm/src/test/resources/cm-smsgw.properties
@@ -0,0 +1,28 @@
+#
+# 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.
+#
+
+# DefaultSender
+cm.default-sender=MyBusiness
+
+# CM URL
+# https://dashboard.onlinesmsgateway.com/docs#send-a-message-send-a-message
+cm.url=sgw01.cm.nl/gateway.ashx
+
+# UUID as STRING
+cm.product-token=ea723fd7-da81-4826-89bc-fa7144e71c40
+
+cm.testConnectionOnStartup=true
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/pom.xml
----------------------------------------------------------------------
diff --git a/components/pom.xml b/components/pom.xml
index 4fdb948..1cc2241 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -81,6 +81,7 @@
     <module>camel-castor</module>
     <module>camel-cdi</module>
     <module>camel-chunk</module>
+	<module>camel-cm</module>
     <module>camel-cmis</module>
     <module>camel-coap</module>
     <module>camel-cometd</module>

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 9475392..dca9b67 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -125,6 +125,8 @@
     <commons-net-version>3.3</commons-net-version>
     <commons-pool-version>1.6</commons-pool-version>
     <commons-pool2-version>2.4.2</commons-pool2-version>
+    <commons-pool2-version>2.4.1</commons-pool2-version>
+	<commons-validator-version>1.5.0</commons-validator-version>
     <commons-vfs2-version>2.0</commons-vfs2-version>
     <compress-lzf-version>1.0.3</compress-lzf-version>
     <concurrentlinkedhashmap.version>1.4.2</concurrentlinkedhashmap.version>
@@ -335,6 +337,7 @@
     <json-path-version>2.1.0</json-path-version>
     <json-simple-version>1.1.1</json-simple-version>
     <json-smart-version>2.2.1</json-smart-version>
+	<jsoup-version>1.8.3</jsoup-version>
     <jsp-api-2.1-version>1.0.1</jsp-api-2.1-version>
     <jsr311-api-version>1.1.1</jsr311-api-version>
     <jsmpp-bundle-version>2.1.0_4</jsmpp-bundle-version>
@@ -358,6 +361,7 @@
     <kubernetes-model-version>1.0.43</kubernetes-model-version>
     <kxml2-bundle-version>2.3.0_3</kxml2-bundle-version>
     <leveldbjni-version>1.8</leveldbjni-version>
+	<libphonenumber-version>7.2.7</libphonenumber-version>
     <!-- virtual dependency only used by Eclipse m2e -->
     <lifecycle-mapping-version>1.0.0</lifecycle-mapping-version>
     <log4j-version>1.2.17</log4j-version>


[23/23] camel git commit: Make it work for OSGi

Posted by da...@apache.org.
Make it work for OSGi


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

Branch: refs/heads/master
Commit: 31991b581af5aca1805215c5db45744059129090
Parents: 5851545
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Mar 23 19:53:46 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 23 19:59:05 2016 +0100

----------------------------------------------------------------------
 components/camel-cm-sms/pom.xml                 |  5 ---
 .../apache/camel/component/cm/CMComponent.java  | 11 ++----
 .../apache/camel/component/cm/test/CMTest.java  |  7 ----
 parent/pom.xml                                  |  1 -
 .../features/src/main/resources/features.xml    | 16 ++++----
 .../camel/itest/karaf/CamelCmSmsTest.java       | 39 ++++++++++++++++++++
 6 files changed, 52 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/31991b58/components/camel-cm-sms/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/pom.xml b/components/camel-cm-sms/pom.xml
index 4200180..a14774e 100644
--- a/components/camel-cm-sms/pom.xml
+++ b/components/camel-cm-sms/pom.xml
@@ -69,11 +69,6 @@
       <artifactId>javax.el-api</artifactId>
       <version>${javax.el-api-version}</version>
     </dependency>
-    <dependency>
-      <groupId>commons-validator</groupId>
-      <artifactId>commons-validator</artifactId>
-      <version>${commons-validator-version}</version>
-    </dependency>
 
     <!-- test dependencies -->
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/31991b58/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMComponent.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMComponent.java
index 73d1250..5844dc9 100644
--- a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMComponent.java
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMComponent.java
@@ -18,7 +18,6 @@ package org.apache.camel.component.cm;
 
 import java.util.Map;
 import java.util.Set;
-
 import javax.validation.ConstraintViolation;
 import javax.validation.Validator;
 
@@ -28,7 +27,6 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.ResolveEndpointFailedException;
 import org.apache.camel.impl.UriEndpointComponent;
 import org.apache.camel.util.URISupport;
-import org.apache.commons.validator.routines.UrlValidator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -43,6 +41,10 @@ public class CMComponent extends UriEndpointComponent {
     @BeanInject
     private Validator validator;
 
+    public CMComponent() {
+        super(CMEndpoint.class);
+    }
+
     public CMComponent(final CamelContext context) {
         super(context, CMEndpoint.class);
     }
@@ -55,11 +57,6 @@ public class CMComponent extends UriEndpointComponent {
 
         LOG.debug("Creating CM Endpoint ... ");
 
-        final String url = CMConstants.DEFAULT_SCHEME + remaining;
-        if (!UrlValidator.getInstance().isValid(url)) {
-            throw new ResolveEndpointFailedException(uri, String.format("HOST provided: %s seem to be invalid. Remember SCHEME has to be excluded.", url));
-        }
-
         LOG.debug("Uri=[{}], path=[{}], parameters=[{}]", new Object[] {URISupport.sanitizeUri(uri), URISupport.sanitizePath(remaining), parameters });
 
         // Set configuration based on uri parameters

http://git-wip-us.apache.org/repos/asf/camel/blob/31991b58/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
index e151e5a..8e3246d 100644
--- a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
@@ -155,13 +155,6 @@ public class CMTest extends AbstractJUnit4SpringContextTests {
         }
     }
 
-    @Test(expected = ResolveEndpointFailedException.class)
-    public void testInvalidUriEndpoint() throws Throwable {
-        // cm-sms://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
-        String noHostUri = "cm-sms://gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true";
-        camelContext.getEndpoint(noHostUri);
-    }
-
     /*
      * 2. Invalid Payload
      */

http://git-wip-us.apache.org/repos/asf/camel/blob/31991b58/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index b19d6d1..63831e7 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -125,7 +125,6 @@
     <commons-net-version>3.3</commons-net-version>
     <commons-pool-version>1.6</commons-pool-version>
     <commons-pool2-version>2.4.2</commons-pool2-version>
-	<commons-validator-version>1.5.0</commons-validator-version>
     <commons-vfs2-version>2.0</commons-vfs2-version>
     <compress-lzf-version>1.0.3</compress-lzf-version>
     <concurrentlinkedhashmap.version>1.4.2</concurrentlinkedhashmap.version>

http://git-wip-us.apache.org/repos/asf/camel/blob/31991b58/platforms/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index 6e19906..df02687 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -289,15 +289,17 @@
     <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.chunk-templates/${chunk-templates-bundle-version}</bundle>
     <bundle>mvn:org.apache.camel/camel-chunk/${project.version}</bundle>
   </feature>
-  <feature name='camel-cm' version='${project.version}' resolver='(obr)' start-level='50'>
+  <feature name='camel-cm-sms' version='${project.version}' resolver='(obr)' start-level='50'>
     <feature version='${project.version}'>camel-core</feature>
     <feature version='${cxf-version-range}'>cxf-specs</feature>
-	<bundle dependency='true'>mvn:org.apache.httpcomponents/httpclient-osgi/${httpclient4-version}</bundle>
-	<bundle dependency='true'>mvn:org.jsoup/jsoup/${jsoup-version}</bundle>
-	<bundle dependency='true'>mvn:javax.validation/validation-api/${validation-api-version}</bundle>
-	<bundle dependency='true'>mvn:javax.el/javax.el-api/${javax.el-api-version}</bundle>
-	<bundle dependency='true'>mvn:commons-validator/commons-validator/${commons-validator-version}</bundle>
-    <bundle>mvn:org.apache.camel/camel-cm/${project.version}</bundle>
+    <bundle dependency='true'>wrap:mvn:com.googlecode.libphonenumber/libphonenumber/${libphonenumber-version}</bundle>
+    <bundle dependency='true'>mvn:org.apache.httpcomponents/httpcore-osgi/${httpcore4-version}</bundle>
+    <bundle dependency='true'>mvn:org.apache.httpcomponents/httpclient-osgi/${httpclient4-version}</bundle>
+    <bundle dependency='true'>mvn:javax.servlet/javax.servlet-api/${javax.servlet-api-version}</bundle>
+	  <bundle dependency='true'>mvn:org.jsoup/jsoup/${jsoup-version}</bundle>
+	  <bundle dependency='true'>mvn:javax.validation/validation-api/${validation-api-version}</bundle>
+	  <bundle dependency='true'>mvn:javax.el/javax.el-api/${javax.el-api-version}</bundle>
+    <bundle>mvn:org.apache.camel/camel-cm-sms/${project.version}</bundle>
   </feature>
   <feature name='camel-cmis' version='${project.version}' resolver='(obr)' start-level='50'>
     <feature version='${project.version}'>camel-core</feature>

http://git-wip-us.apache.org/repos/asf/camel/blob/31991b58/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCmSmsTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCmSmsTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCmSmsTest.java
new file mode 100644
index 0000000..74d699e
--- /dev/null
+++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCmSmsTest.java
@@ -0,0 +1,39 @@
+/**
+ * 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.itest.karaf;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+
+@RunWith(PaxExam.class)
+public class CamelCmSmsTest extends AbstractFeatureTest {
+    public static final String COMPONENT = extractName(CamelCmSmsTest.class);
+
+    @Test
+    public void test() throws Exception {
+        testComponent(COMPONENT);
+    }
+
+    @Configuration
+    public static Option[] configure() {
+        return configure(COMPONENT);
+    }
+
+}


[03/23] camel git commit: ProviderException is not needed.

Posted by da...@apache.org.
ProviderException is not needed. 

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

Branch: refs/heads/master
Commit: fcd1a49ccf95ab49e2acbe9a46d5acd51b743a3f
Parents: cf97b6d
Author: oalles <oa...@neivi.es>
Authored: Tue Mar 22 13:01:45 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 23 18:46:10 2016 +0100

----------------------------------------------------------------------
 .../component/cm/CMSenderOneMessageImpl.java    |  8 ++--
 .../cm/exceptions/ProviderException.java        | 41 --------------------
 2 files changed, 4 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/fcd1a49c/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
index e1d78c1..813ed42 100644
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
@@ -40,8 +40,8 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Text;
 
+import org.apache.camel.component.cm.exceptions.CMDirectException;
 import org.apache.camel.component.cm.exceptions.MessagingException;
-import org.apache.camel.component.cm.exceptions.ProviderException;
 import org.apache.camel.component.cm.exceptions.XMLConstructionException;
 import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
 import org.apache.camel.component.cm.exceptions.cmresponse.InsufficientBalanceException;
@@ -195,12 +195,12 @@ public class CMSenderOneMessageImpl implements CMSender {
             LOG.debug("Response Code : {}", statusCode);
 
             if (statusCode == 400) {
-                throw new ProviderException("CM Component and CM API show some kind of inconsistency. "
+                throw new CMDirectException("CM Component and CM API show some kind of inconsistency. "
                                             + "CM is complaining about not using a post method for the request. And this component only uses POST requests. What happens?");
             }
 
             if (statusCode != 200) {
-                throw new ProviderException("CM Component and CM API show some kind of inconsistency. The component expects the status code to be 200 or 400. New api released? ");
+                throw new CMDirectException("CM Component and CM API show some kind of inconsistency. The component expects the status code to be 200 or 400. New api released? ");
             }
 
             // So we have 200 status code...
@@ -251,7 +251,7 @@ public class CMSenderOneMessageImpl implements CMSender {
             // Ok. Line is EMPTY - successfully submitted
             LOG.debug("Result of the request processing: Successfully submited");
         } catch (final IOException io) {
-            throw new ProviderException(io);
+            throw new CMDirectException(io);
         } catch (Throwable t) {
             if (!(t instanceof MessagingException)) {
                 // Chain it

http://git-wip-us.apache.org/repos/asf/camel/blob/fcd1a49c/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/ProviderException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/ProviderException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/ProviderException.java
deleted file mode 100644
index e29ca4a..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/ProviderException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * 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.cm.exceptions;
-
-import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
-
-public class ProviderException extends CMResponseException {
-
-    public ProviderException() {
-    }
-
-    public ProviderException(final String message) {
-        super(message);
-    }
-
-    public ProviderException(final Throwable cause) {
-        super(cause);
-    }
-
-    public ProviderException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-    public ProviderException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-}


[15/23] camel git commit: Fixing Logging level.

Posted by da...@apache.org.
Fixing Logging level. 

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

Branch: refs/heads/master
Commit: 32308ca75a405a44d30735925d583210246cee58
Parents: d0e134c
Author: oalles <oa...@neivi.es>
Authored: Tue Mar 22 12:33:32 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 23 18:46:10 2016 +0100

----------------------------------------------------------------------
 .../apache/camel/component/cm/CMEndpoint.java   | 282 +++++++++----------
 1 file changed, 141 insertions(+), 141 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/32308ca7/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMEndpoint.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMEndpoint.java
index 0aa34d2..860967d 100644
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMEndpoint.java
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMEndpoint.java
@@ -1,141 +1,141 @@
-/**
- * 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.cm;
-
-import org.apache.camel.Consumer;
-import org.apache.camel.ExchangePattern;
-import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.api.management.ManagedAttribute;
-import org.apache.camel.api.management.ManagedOperation;
-import org.apache.camel.api.management.ManagedResource;
-import org.apache.camel.impl.DefaultEndpoint;
-import org.apache.camel.spi.Metadata;
-import org.apache.camel.spi.UriPath;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@ManagedResource(description = "CM SMS Endpoint")
-// @UriEndpoint(scheme = "cm", title = "CM DIRECT SMS", syntax = "cm:host",
-// label = "sms provider", producerOnly = true)
-public class CMEndpoint extends DefaultEndpoint {
-
-    private static final Logger LOG = LoggerFactory.getLogger(CMEndpoint.class);
-
-    @UriPath
-    @Metadata(description = "SMS Provider HOST with scheme", required = "true")
-    private String host;
-
-    /**
-     * data needed for exchange interaction
-     */
-    private CMConfiguration configuration;
-
-    private CMProducer producer;
-
-    /**
-     * Constructs a partially-initialized CMEndpoint instance. Useful when creating endpoints manually (e.g., as beans in Spring).
-     */
-    // We are just going to allow fully initialized endpoint instances
-    // public CMEndpoint() {
-    // }
-
-    /**
-     * Constructs a fully-initialized CMEndpoint instance. This is the preferred method of constructing an object from Java code (as opposed to Spring beans, etc.).
-     *
-     * @param endpointUri the full URI used to create this endpoint
-     * @param component the component that created this endpoint
-     */
-    public CMEndpoint(final String uri, final CMComponent component) {
-        super(uri, component);
-        setExchangePattern(ExchangePattern.InOut);
-        LOG.info("CM Endpoint created - (IN/OUT)");
-    }
-
-    /**
-     * Provides a channel on which clients can send Messages to a CM Endpoint
-     */
-    @Override
-    public Producer createProducer() throws Exception {
-        final CMConfiguration config = getConfiguration();
-
-        // This is the camel exchange processor. Allows to send messages to CM
-        // API.
-        // TODO: Should i provide a CMSender factory? Dynamically choose
-        // CMSender implementation? Sending strategy?
-        // Consider:
-        // 1. single - Single Message strategy.
-        // 2. Multi - CM Api supports to 1000 messages per call.
-        // 3. sliding - sliding window? 1000 messages or time thresold?
-        // 4. mocked - in order to fake cm responses
-
-        // CMConstants.DEFAULT_SCHEME + host is a valid URL. It was previously
-        // checked
-        LOG.debug("Creating CM Producer");
-        producer = new CMProducer(this, new CMSenderOneMessageImpl(getCMUrl(), config.getProductToken()));
-        LOG.debug("CM Producer: OK!");
-        return producer;
-    }
-
-    @Override
-    public Consumer createConsumer(final Processor processor) throws Exception {
-
-        throw new RuntimeCamelException("So far, cannot consume from CM Endpoint: " + getEndpointUri());
-    }
-
-    public CMConfiguration getConfiguration() {
-        return configuration;
-    }
-
-    public void setConfiguration(final CMConfiguration configuration) {
-        this.configuration = configuration;
-    }
-
-    @Override
-    public boolean isSingleton() {
-        return true;
-    }
-
-    // @Override
-    // public Exchange createExchange() {
-    // return super.createExchange();
-    // }
-
-    @ManagedAttribute
-    public String getHost() {
-        return host;
-    }
-
-    public String getCMUrl() {
-        return CMConstants.DEFAULT_SCHEME + host;
-    }
-
-    @ManagedOperation(description = "Dynamically modify Service HOST")
-    public void setHost(final String host) {
-        this.host = host;
-    }
-
-    @Override
-    public CMComponent getComponent() {
-        return (CMComponent) super.getComponent();
-    }
-
-    public CMProducer getProducer() {
-        return producer;
-    }
-}
+/**
+ * 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.cm;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.api.management.ManagedAttribute;
+import org.apache.camel.api.management.ManagedOperation;
+import org.apache.camel.api.management.ManagedResource;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriPath;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@ManagedResource(description = "CM SMS Endpoint")
+// @UriEndpoint(scheme = "cm", title = "CM DIRECT SMS", syntax = "cm:host",
+// label = "sms provider", producerOnly = true)
+public class CMEndpoint extends DefaultEndpoint {
+
+    private static final Logger LOG = LoggerFactory.getLogger(CMEndpoint.class);
+
+    @UriPath
+    @Metadata(description = "SMS Provider HOST with scheme", required = "true")
+    private String host;
+
+    /**
+     * data needed for exchange interaction
+     */
+    private CMConfiguration configuration;
+
+    private CMProducer producer;
+
+    /**
+     * Constructs a partially-initialized CMEndpoint instance. Useful when creating endpoints manually (e.g., as beans in Spring).
+     */
+    // We are just going to allow fully initialized endpoint instances
+    // public CMEndpoint() {
+    // }
+
+    /**
+     * Constructs a fully-initialized CMEndpoint instance. This is the preferred method of constructing an object from Java code (as opposed to Spring beans, etc.).
+     *
+     * @param endpointUri the full URI used to create this endpoint
+     * @param component the component that created this endpoint
+     */
+    public CMEndpoint(final String uri, final CMComponent component) {
+        super(uri, component);
+        setExchangePattern(ExchangePattern.InOut);
+        LOG.debug("CM Endpoint created");
+    }
+
+    /**
+     * Provides a channel on which clients can send Messages to a CM Endpoint
+     */
+    @Override
+    public Producer createProducer() throws Exception {
+        final CMConfiguration config = getConfiguration();
+
+        // This is the camel exchange processor. Allows to send messages to CM
+        // API.
+        // TODO: Should i provide a CMSender factory? Dynamically choose
+        // CMSender implementation? Sending strategy?
+        // Consider:
+        // 1. single - Single Message strategy.
+        // 2. Multi - CM Api supports to 1000 messages per call.
+        // 3. sliding - sliding window? 1000 messages or time thresold?
+        // 4. mocked - in order to fake cm responses
+
+        // CMConstants.DEFAULT_SCHEME + host is a valid URL. It was previously
+        // checked
+        LOG.debug("Creating CM Producer");
+        producer = new CMProducer(this, new CMSenderOneMessageImpl(getCMUrl(), config.getProductToken()));
+        LOG.debug("CM Producer: OK!");
+        return producer;
+    }
+
+    @Override
+    public Consumer createConsumer(final Processor processor) throws Exception {
+
+        throw new RuntimeCamelException("So far, cannot consume from CM Endpoint: " + getEndpointUri());
+    }
+
+    public CMConfiguration getConfiguration() {
+        return configuration;
+    }
+
+    public void setConfiguration(final CMConfiguration configuration) {
+        this.configuration = configuration;
+    }
+
+    @Override
+    public boolean isSingleton() {
+        return true;
+    }
+
+    // @Override
+    // public Exchange createExchange() {
+    // return super.createExchange();
+    // }
+
+    @ManagedAttribute
+    public String getHost() {
+        return host;
+    }
+
+    public String getCMUrl() {
+        return CMConstants.DEFAULT_SCHEME + host;
+    }
+
+    @ManagedOperation(description = "Dynamically modify Service HOST")
+    public void setHost(final String host) {
+        this.host = host;
+    }
+
+    @Override
+    public CMComponent getComponent() {
+        return (CMComponent) super.getComponent();
+    }
+
+    public CMProducer getProducer() {
+        return producer;
+    }
+}


[11/23] camel git commit: Custom InvalidPayloadException is removed. Camel 's InvalidPayloadRuntimeException is going to be used instead.

Posted by da...@apache.org.
Custom InvalidPayloadException is removed. Camel 's
InvalidPayloadRuntimeException is going to be used instead. 

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

Branch: refs/heads/master
Commit: 2e43972cb861b439af306543e1a90f7a19b2643a
Parents: 354e7e9
Author: oalles <oa...@neivi.es>
Authored: Mon Mar 21 13:20:11 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 23 18:46:10 2016 +0100

----------------------------------------------------------------------
 .../apache/camel/component/cm/CMProducer.java   |   6 +-
 .../cm/exceptions/InvalidPayloadException.java  |  44 -
 .../apache/camel/component/cm/test/CMTest.java  | 814 +++++++++----------
 3 files changed, 411 insertions(+), 453 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2e43972c/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java
index 3ae6d9a..b3003cb 100644
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java
@@ -22,9 +22,9 @@ import javax.validation.ConstraintViolation;
 import javax.validation.Validator;
 
 import org.apache.camel.Exchange;
+import org.apache.camel.InvalidPayloadRuntimeException;
 import org.apache.camel.component.cm.client.SMSMessage;
 import org.apache.camel.component.cm.exceptions.HostUnavailableException;
-import org.apache.camel.component.cm.exceptions.InvalidPayloadException;
 import org.apache.camel.impl.DefaultProducer;
 import org.apache.http.client.methods.HttpHead;
 import org.apache.http.impl.client.HttpClientBuilder;
@@ -70,7 +70,9 @@ public class CMProducer extends DefaultProducer {
                 msg.append(String.format("- Invalid value for %s: %s",
                         cv.getPropertyPath().toString(), cv.getMessage()));
             }
-            throw new InvalidPayloadException(msg.toString());
+            log.debug(msg.toString());
+            throw new InvalidPayloadRuntimeException(exchange,
+                    SMSMessage.class);
         }
         log.trace("SMSMessage instance is valid: {}", smsMessage.toString());
 

http://git-wip-us.apache.org/repos/asf/camel/blob/2e43972c/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidPayloadException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidPayloadException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidPayloadException.java
deleted file mode 100644
index 0cf8385..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidPayloadException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.cm.exceptions;
-
-/**
- * The body has to be an instance of CMMessage.
- *
- */
-public class InvalidPayloadException extends CMValidationException {
-
-    public InvalidPayloadException() {
-    }
-
-    public InvalidPayloadException(final String message) {
-        super(message);
-    }
-
-    public InvalidPayloadException(final Throwable cause) {
-        super(cause);
-    }
-
-    public InvalidPayloadException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-    public InvalidPayloadException(final String message, final Throwable cause,
-            final boolean enableSuppression, final boolean writableStackTrace) {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/2e43972c/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java
index aac110e..bb4ed83 100644
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java
@@ -1,407 +1,407 @@
-/**
- * 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.cm.test;
-
-import java.math.BigInteger;
-import java.security.SecureRandom;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.EndpointInject;
-import org.apache.camel.Produce;
-import org.apache.camel.ResolveEndpointFailedException;
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.Service;
-import org.apache.camel.component.cm.CMEndpoint;
-import org.apache.camel.component.cm.client.SMSMessage;
-import org.apache.camel.component.cm.exceptions.HostUnavailableException;
-import org.apache.camel.component.cm.exceptions.InvalidPayloadException;
-import org.apache.camel.component.cm.exceptions.InvalidURLException;
-import org.apache.camel.component.cm.exceptions.InvalidUriEndpointException;
-import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
-import org.apache.camel.component.cm.exceptions.cmresponse.InsufficientBalanceException;
-import org.apache.camel.component.cm.exceptions.cmresponse.InvalidMSISDNException;
-import org.apache.camel.component.cm.exceptions.cmresponse.InvalidProductTokenException;
-import org.apache.camel.component.cm.exceptions.cmresponse.NoAccountFoundForProductTokenException;
-import org.apache.camel.component.cm.exceptions.cmresponse.NoMessageException;
-import org.apache.camel.component.cm.exceptions.cmresponse.NotPhoneNumberFoundException;
-import org.apache.camel.component.cm.exceptions.cmresponse.UnknownErrorException;
-import org.apache.camel.component.cm.exceptions.cmresponse.UnroutableMessageException;
-import org.apache.camel.component.cm.test.mocks.cmsender.CMResponseExceptionSender;
-import org.apache.camel.component.cm.test.mocks.cmsender.InsufficientBalanceExceptionSender;
-import org.apache.camel.component.cm.test.mocks.cmsender.InvalidMSISDNExceptionSender;
-import org.apache.camel.component.cm.test.mocks.cmsender.InvalidProductTokenExceptionSender;
-import org.apache.camel.component.cm.test.mocks.cmsender.NoAccountFoundForProductTokenExceptionSender;
-import org.apache.camel.component.cm.test.mocks.cmsender.NoMessageExceptionSender;
-import org.apache.camel.component.cm.test.mocks.cmsender.NotPhoneNumberFoundExceptionSender;
-import org.apache.camel.component.cm.test.mocks.cmsender.UnknownErrorExceptionSender;
-import org.apache.camel.component.cm.test.mocks.cmsender.UnroutableMessageExceptionSender;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.spring.CamelSpringDelegatingTestContextLoader;
-import org.apache.camel.test.spring.CamelSpringJUnit4ClassRunner;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
-import org.springframework.util.Assert;
-
-import com.google.i18n.phonenumbers.PhoneNumberUtil;
-import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
-
-@RunWith(CamelSpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {
-        CamelTestConfiguration.class }, loader = CamelSpringDelegatingTestContextLoader.class)
-// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
-// @DisableJmx(false)
-// @MockEndpoints
-// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class CMTest extends AbstractJUnit4SpringContextTests {
-
-    // dependency: camel-spring-javaconfig
-
-    @Autowired
-    private CamelContext camelContext;
-
-    private SecureRandom random = new SecureRandom();
-
-    private final PhoneNumberUtil pnu = PhoneNumberUtil.getInstance();
-    private String validNumber;
-
-    @Produce(uri = "direct:sms")
-    private CMProxy cmProxy;
-
-    @EndpointInject(uri = "mock:test")
-    private MockEndpoint mock;
-
-    // private StopWatch stopWatch = new StopWatch(getClass().getSimpleName());
-
-    @Before
-    public void beforeTest() throws Exception {
-        mock.reset();
-        camelContext.startRoute(CamelTestConfiguration.SIMPLE_ROUTE_ID);
-        validNumber = pnu.format(pnu.getExampleNumber("ES"),
-                PhoneNumberFormat.E164);
-    }
-
-    @After
-    public void afterTest() {
-
-        try {
-            camelContext.stopRoute(CamelTestConfiguration.SIMPLE_ROUTE_ID);
-        } catch (Exception e) {
-            logger.error("Exception trying to stop de routes", e);
-        }
-
-        // Stop all routes
-        // for (Route route : camelContext.getRoutes()) {
-        // try {
-        // camelContext.stopRoute(route.getId());
-        // } catch (Exception e) {
-        // logger.error("Exception trying to stop de routes", e);
-        // }
-        // }
-    }
-
-    /*
-     * 1. Invalid URI
-     */
-
-    @Test(expected = InvalidUriEndpointException.class)
-    public void testNotRequiredProductToken() throws Throwable {
-        try {
-            String schemedUri = "cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&testConnectionOnStartup=true";
-            camelContext.getEndpoint(schemedUri).start();
-        } catch (Throwable t) {
-            throw t.getCause();
-        }
-
-    }
-
-    @Test(expected = InvalidUriEndpointException.class)
-    public void testNotRequiredDefaultFrom() throws Throwable {
-        try {
-            String schemedUri = "cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&testConnectionOnStartup=true";
-            camelContext.getEndpoint(schemedUri).start();
-        } catch (Throwable t) {
-            throw t.getCause();
-        }
-
-    }
-
-    @Test(expected = HostUnavailableException.class)
-    public void testHostUnavailableException() throws Throwable {
-        // cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
-        String schemedUri = "cm://dummy.sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true";
-        Service service = camelContext.getEndpoint(schemedUri).createProducer();
-        service.start();
-    }
-
-    @Test(expected = InvalidURLException.class)
-    public void testInvalidHostDuplicateScheme() throws Throwable {
-        // cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
-        try {
-            String schemedUri = "cm://https://demo.com";
-            camelContext.getEndpoint(schemedUri);
-        } catch (Throwable t) {
-            throw t.getCause();
-        }
-    }
-
-    @Test(expected = ResolveEndpointFailedException.class)
-    public void testInvalidUriEndpoint() throws Throwable {
-        // cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
-        String noHostUri = "cm://gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true";
-        camelContext.getEndpoint(noHostUri);
-    }
-
-    /*
-     * 2. Invalid Payload
-     */
-
-    @Test(expected = RuntimeException.class)
-    public void testNullPayload() throws Throwable {
-        cmProxy.send(null);
-    }
-
-    // @DirtiesContext
-    @Test(expected = NoAccountFoundForProductTokenException.class)
-    public void testAsPartOfARoute() throws Exception {
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateUnicodeMessage(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    @Test(expected = NoAccountFoundForProductTokenException.class)
-    public void testNoAccountFoundForProductTokenException() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer()
-                .setSender(new NoAccountFoundForProductTokenExceptionSender());
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateGSM0338Message(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    /*
-     * 3. CM Responses (Faking Exceptions)
-     */
-
-    @Test(expected = CMResponseException.class)
-    public void testCMResponseException() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer().setSender(new CMResponseExceptionSender());
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateUnicodeMessage(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    @Test(expected = InsufficientBalanceException.class)
-    public void testInsufficientBalanceException() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer()
-                .setSender(new InsufficientBalanceExceptionSender());
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateGSM0338Message(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    @Test(expected = InvalidMSISDNException.class)
-    public void testInvalidMSISDNException() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer().setSender(new InvalidMSISDNExceptionSender());
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateUnicodeMessage(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    @Test(expected = InvalidProductTokenException.class)
-    public void testInvalidProductTokenException() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer()
-                .setSender(new InvalidProductTokenExceptionSender());
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateUnicodeMessage(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    @Test(expected = NoMessageException.class)
-    public void testNoMessageException() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer().setSender(new NoMessageExceptionSender());
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateGSM0338Message(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    @Test(expected = NotPhoneNumberFoundException.class)
-    public void testNotPhoneNumberFoundException() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer()
-                .setSender(new NotPhoneNumberFoundExceptionSender());
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateUnicodeMessage(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    @Test(expected = UnknownErrorException.class)
-    public void testUnknownErrorException() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer().setSender(new UnknownErrorExceptionSender());
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateGSM0338Message(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    @Test(expected = UnroutableMessageException.class)
-    public void testUnroutableMessageException() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer()
-                .setSender(new UnroutableMessageExceptionSender());
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateUnicodeMessage(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    @Test(expected = RuntimeCamelException.class)
-    public void testCMEndpointIsForProducing() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
-        endpoint.createConsumer(null);
-    }
-
-    @Test
-    public void testCMEndpointGetHost() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext
-                .getEndpoint(applicationContext
-                        .getBean(CamelTestConfiguration.class).getUri());
-        Assert.isTrue(endpoint.getHost().equals(applicationContext
-                .getEnvironment().getRequiredProperty("cm.url")));
-    }
-
-    @Test(expected = InvalidPayloadException.class)
-    public void testSendInvalidPayload() throws Exception {
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
-                generateGSM0338Message(), null, null);
-        cmProxy.send(smsMessage);
-    }
-
-    /*
-     * CMMessages
-     */
-
-    // @Test(expected = RuntimeException.class)
-    // public void testSkel() throws Exception {
-
-    // mock.expectedMessageCount(1);
-    //
-    // // Body
-    // final SMSMessage smsMessage = new SMSMessage("Hello CM", validNumber);
-    // cmProxy.send(smsMessage);
-    //
-    // mock.assertIsSatisfied();
-    // }
-
-    private String generateUnicodeMessage() {
-        String ch = "\uF400";
-        return generateRandomLengthMessageByChar(ch);
-    }
-
-    private String generateGSM0338Message() {
-        String ch = "a";
-        return generateRandomLengthMessageByChar(ch);
-    }
-
-    private String generateRandomLengthMessageByChar(String ch) {
-        // random Length
-        int msgLength = (int) (Math.random() * 2000);
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < msgLength; index++) {
-            message.append(ch);
-        }
-        return message.toString();
-    }
-
-    //
-    private String generateIdAsString() {
-        return new BigInteger(130, random).toString(32);
-    }
-
-}
+/**
+ * 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.cm.test;
+
+import java.math.BigInteger;
+import java.security.SecureRandom;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.InvalidPayloadRuntimeException;
+import org.apache.camel.Produce;
+import org.apache.camel.ResolveEndpointFailedException;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.Service;
+import org.apache.camel.component.cm.CMEndpoint;
+import org.apache.camel.component.cm.client.SMSMessage;
+import org.apache.camel.component.cm.exceptions.HostUnavailableException;
+import org.apache.camel.component.cm.exceptions.InvalidURLException;
+import org.apache.camel.component.cm.exceptions.InvalidUriEndpointException;
+import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
+import org.apache.camel.component.cm.exceptions.cmresponse.InsufficientBalanceException;
+import org.apache.camel.component.cm.exceptions.cmresponse.InvalidMSISDNException;
+import org.apache.camel.component.cm.exceptions.cmresponse.InvalidProductTokenException;
+import org.apache.camel.component.cm.exceptions.cmresponse.NoAccountFoundForProductTokenException;
+import org.apache.camel.component.cm.exceptions.cmresponse.NoMessageException;
+import org.apache.camel.component.cm.exceptions.cmresponse.NotPhoneNumberFoundException;
+import org.apache.camel.component.cm.exceptions.cmresponse.UnknownErrorException;
+import org.apache.camel.component.cm.exceptions.cmresponse.UnroutableMessageException;
+import org.apache.camel.component.cm.test.mocks.cmsender.CMResponseExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.InsufficientBalanceExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.InvalidMSISDNExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.InvalidProductTokenExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.NoAccountFoundForProductTokenExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.NoMessageExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.NotPhoneNumberFoundExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.UnknownErrorExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.UnroutableMessageExceptionSender;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.spring.CamelSpringDelegatingTestContextLoader;
+import org.apache.camel.test.spring.CamelSpringJUnit4ClassRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import org.springframework.util.Assert;
+
+import com.google.i18n.phonenumbers.PhoneNumberUtil;
+import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
+
+@RunWith(CamelSpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {
+        CamelTestConfiguration.class }, loader = CamelSpringDelegatingTestContextLoader.class)
+// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
+// @DisableJmx(false)
+// @MockEndpoints
+// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class CMTest extends AbstractJUnit4SpringContextTests {
+
+    // dependency: camel-spring-javaconfig
+
+    @Autowired
+    private CamelContext camelContext;
+
+    private SecureRandom random = new SecureRandom();
+
+    private final PhoneNumberUtil pnu = PhoneNumberUtil.getInstance();
+    private String validNumber;
+
+    @Produce(uri = "direct:sms")
+    private CMProxy cmProxy;
+
+    @EndpointInject(uri = "mock:test")
+    private MockEndpoint mock;
+
+    // private StopWatch stopWatch = new StopWatch(getClass().getSimpleName());
+
+    @Before
+    public void beforeTest() throws Exception {
+        mock.reset();
+        camelContext.startRoute(CamelTestConfiguration.SIMPLE_ROUTE_ID);
+        validNumber = pnu.format(pnu.getExampleNumber("ES"),
+                PhoneNumberFormat.E164);
+    }
+
+    @After
+    public void afterTest() {
+
+        try {
+            camelContext.stopRoute(CamelTestConfiguration.SIMPLE_ROUTE_ID);
+        } catch (Exception e) {
+            logger.error("Exception trying to stop de routes", e);
+        }
+
+        // Stop all routes
+        // for (Route route : camelContext.getRoutes()) {
+        // try {
+        // camelContext.stopRoute(route.getId());
+        // } catch (Exception e) {
+        // logger.error("Exception trying to stop de routes", e);
+        // }
+        // }
+    }
+
+    /*
+     * 1. Invalid URI
+     */
+
+    @Test(expected = InvalidUriEndpointException.class)
+    public void testNotRequiredProductToken() throws Throwable {
+        try {
+            String schemedUri = "cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&testConnectionOnStartup=true";
+            camelContext.getEndpoint(schemedUri).start();
+        } catch (Throwable t) {
+            throw t.getCause();
+        }
+
+    }
+
+    @Test(expected = InvalidUriEndpointException.class)
+    public void testNotRequiredDefaultFrom() throws Throwable {
+        try {
+            String schemedUri = "cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&testConnectionOnStartup=true";
+            camelContext.getEndpoint(schemedUri).start();
+        } catch (Throwable t) {
+            throw t.getCause();
+        }
+
+    }
+
+    @Test(expected = HostUnavailableException.class)
+    public void testHostUnavailableException() throws Throwable {
+        // cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
+        String schemedUri = "cm://dummy.sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true";
+        Service service = camelContext.getEndpoint(schemedUri).createProducer();
+        service.start();
+    }
+
+    @Test(expected = InvalidURLException.class)
+    public void testInvalidHostDuplicateScheme() throws Throwable {
+        // cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
+        try {
+            String schemedUri = "cm://https://demo.com";
+            camelContext.getEndpoint(schemedUri);
+        } catch (Throwable t) {
+            throw t.getCause();
+        }
+    }
+
+    @Test(expected = ResolveEndpointFailedException.class)
+    public void testInvalidUriEndpoint() throws Throwable {
+        // cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
+        String noHostUri = "cm://gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true";
+        camelContext.getEndpoint(noHostUri);
+    }
+
+    /*
+     * 2. Invalid Payload
+     */
+
+    @Test(expected = RuntimeException.class)
+    public void testNullPayload() throws Throwable {
+        cmProxy.send(null);
+    }
+
+    // @DirtiesContext
+    @Test(expected = NoAccountFoundForProductTokenException.class)
+    public void testAsPartOfARoute() throws Exception {
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateUnicodeMessage(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    @Test(expected = NoAccountFoundForProductTokenException.class)
+    public void testNoAccountFoundForProductTokenException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer()
+                .setSender(new NoAccountFoundForProductTokenExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateGSM0338Message(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    /*
+     * 3. CM Responses (Faking Exceptions)
+     */
+
+    @Test(expected = CMResponseException.class)
+    public void testCMResponseException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer().setSender(new CMResponseExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateUnicodeMessage(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    @Test(expected = InsufficientBalanceException.class)
+    public void testInsufficientBalanceException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer()
+                .setSender(new InsufficientBalanceExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateGSM0338Message(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    @Test(expected = InvalidMSISDNException.class)
+    public void testInvalidMSISDNException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer().setSender(new InvalidMSISDNExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateUnicodeMessage(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    @Test(expected = InvalidProductTokenException.class)
+    public void testInvalidProductTokenException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer()
+                .setSender(new InvalidProductTokenExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateUnicodeMessage(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    @Test(expected = NoMessageException.class)
+    public void testNoMessageException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer().setSender(new NoMessageExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateGSM0338Message(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    @Test(expected = NotPhoneNumberFoundException.class)
+    public void testNotPhoneNumberFoundException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer()
+                .setSender(new NotPhoneNumberFoundExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateUnicodeMessage(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    @Test(expected = UnknownErrorException.class)
+    public void testUnknownErrorException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer().setSender(new UnknownErrorExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateGSM0338Message(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    @Test(expected = UnroutableMessageException.class)
+    public void testUnroutableMessageException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.getProducer()
+                .setSender(new UnroutableMessageExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateUnicodeMessage(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    @Test(expected = RuntimeCamelException.class)
+    public void testCMEndpointIsForProducing() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        endpoint.createConsumer(null);
+    }
+
+    @Test
+    public void testCMEndpointGetHost() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext
+                .getEndpoint(applicationContext
+                        .getBean(CamelTestConfiguration.class).getUri());
+        Assert.isTrue(endpoint.getHost().equals(applicationContext
+                .getEnvironment().getRequiredProperty("cm.url")));
+    }
+
+    @Test(expected = InvalidPayloadRuntimeException.class)
+    public void testSendInvalidPayload() throws Exception {
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(),
+                generateGSM0338Message(), null, null);
+        cmProxy.send(smsMessage);
+    }
+
+    /*
+     * CMMessages
+     */
+
+    // @Test(expected = RuntimeException.class)
+    // public void testSkel() throws Exception {
+
+    // mock.expectedMessageCount(1);
+    //
+    // // Body
+    // final SMSMessage smsMessage = new SMSMessage("Hello CM", validNumber);
+    // cmProxy.send(smsMessage);
+    //
+    // mock.assertIsSatisfied();
+    // }
+
+    private String generateUnicodeMessage() {
+        String ch = "\uF400";
+        return generateRandomLengthMessageByChar(ch);
+    }
+
+    private String generateGSM0338Message() {
+        String ch = "a";
+        return generateRandomLengthMessageByChar(ch);
+    }
+
+    private String generateRandomLengthMessageByChar(String ch) {
+        // random Length
+        int msgLength = (int) (Math.random() * 2000);
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < msgLength; index++) {
+            message.append(ch);
+        }
+        return message.toString();
+    }
+
+    //
+    private String generateIdAsString() {
+        return new BigInteger(130, random).toString(32);
+    }
+
+}


[18/23] camel git commit: Fixes #911

Posted by da...@apache.org.
Fixes #911


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

Branch: refs/heads/master
Commit: 1c79846c76725b57a49418abe67fcffb6b870d74
Parents: 5d015b9
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Mar 23 18:48:11 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 23 18:48:11 2016 +0100

----------------------------------------------------------------------
 parent/pom.xml | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1c79846c/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index dca9b67..2fc19eb 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -125,7 +125,6 @@
     <commons-net-version>3.3</commons-net-version>
     <commons-pool-version>1.6</commons-pool-version>
     <commons-pool2-version>2.4.2</commons-pool2-version>
-    <commons-pool2-version>2.4.1</commons-pool2-version>
 	<commons-validator-version>1.5.0</commons-validator-version>
     <commons-vfs2-version>2.0</commons-vfs2-version>
     <compress-lzf-version>1.0.3</compress-lzf-version>


[10/23] camel git commit: Fix some checkstyle issues.

Posted by da...@apache.org.
Fix some checkstyle issues. 

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

Branch: refs/heads/master
Commit: 4f8c9c9bec14a7d3cd4902b60e2959dd9b1f1a10
Parents: 2e43972
Author: oalles <oa...@neivi.es>
Authored: Mon Mar 21 13:36:08 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 23 18:46:10 2016 +0100

----------------------------------------------------------------------
 .../apache/camel/component/cm/CMComponent.java  |  20 +-
 .../component/cm/CMSenderOneMessageImpl.java    | 526 +++++++--------
 .../camel/component/cm/test/CMMessageTest.java  | 646 +++++++++----------
 .../apache/camel/component/cm/test/CMTest.java  |   5 +-
 .../cm/test/CamelTestConfiguration.java         | 212 +++---
 .../camel/component/cm/test/SMSMessageTest.java | 366 +++++------
 6 files changed, 889 insertions(+), 886 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/4f8c9c9b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
index 3239af2..fc7b9b5 100644
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
@@ -38,8 +38,7 @@ import org.slf4j.LoggerFactory;
  */
 public class CMComponent extends UriEndpointComponent {
 
-    private static final Logger LOG = LoggerFactory
-            .getLogger(CMComponent.class);
+    private static final Logger LOG = LoggerFactory.getLogger(CMComponent.class);
 
     @BeanInject
     private Validator validator;
@@ -56,21 +55,16 @@ public class CMComponent extends UriEndpointComponent {
      * Endpoints factory
      */
     @Override
-    protected Endpoint createEndpoint(final String uri, final String remaining,
-            final Map<String, Object> parameters) throws Exception {
+    protected Endpoint createEndpoint(final String uri, final String remaining, final Map<String, Object> parameters) throws Exception {
 
         LOG.debug("Creating CM Endpoint ... ");
 
         final String url = CMConstants.DEFAULT_SCHEME + remaining;
         if (!UrlValidator.getInstance().isValid(url)) {
-            throw new InvalidURLException(String.format(
-                    "HOST provided: %s seem to be invalid. Remember SCHEME has to be excluded.",
-                    url));
+            throw new InvalidURLException(String.format("HOST provided: %s seem to be invalid. Remember SCHEME has to be excluded.", url));
         }
 
-        LOG.debug("Uri=[{}], path=[{}], parameters=[{}]",
-                new Object[] { URISupport.sanitizeUri(uri),
-                        URISupport.sanitizePath(remaining), parameters });
+        LOG.debug("Uri=[{}], path=[{}], parameters=[{}]", new Object[] {URISupport.sanitizeUri(uri), URISupport.sanitizePath(remaining), parameters });
 
         // Set configuration based on uri parameters
         final CMConfiguration config = new CMConfiguration();
@@ -78,13 +72,11 @@ public class CMComponent extends UriEndpointComponent {
 
         // Validate configuration
         LOG.debug("Validating uri based configuration");
-        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator
-                .validate(config);
+        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(config);
         if (constraintViolations.size() > 0) {
             final StringBuffer msg = new StringBuffer();
             for (final ConstraintViolation<CMConfiguration> cv : constraintViolations) {
-                msg.append(String.format("- Invalid value for %s: %s",
-                        cv.getPropertyPath().toString(), cv.getMessage()));
+                msg.append(String.format("- Invalid value for %s: %s", cv.getPropertyPath().toString(), cv.getMessage()));
             }
             throw new InvalidUriEndpointException(msg.toString());
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/4f8c9c9b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
index fc69fc5..e1d78c1 100644
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
@@ -1,263 +1,263 @@
-/**
- * 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.cm;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.charset.Charset;
-import java.util.UUID;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Text;
-
-import org.apache.camel.component.cm.exceptions.MessagingException;
-import org.apache.camel.component.cm.exceptions.ProviderException;
-import org.apache.camel.component.cm.exceptions.XMLConstructionException;
-import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
-import org.apache.camel.component.cm.exceptions.cmresponse.InsufficientBalanceException;
-import org.apache.camel.component.cm.exceptions.cmresponse.InvalidProductTokenException;
-import org.apache.camel.component.cm.exceptions.cmresponse.NoAccountFoundForProductTokenException;
-import org.apache.camel.component.cm.exceptions.cmresponse.UnknownErrorException;
-import org.apache.camel.component.cm.exceptions.cmresponse.UnroutableMessageException;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class CMSenderOneMessageImpl implements CMSender {
-
-    private static final Logger LOG = LoggerFactory.getLogger(CMSenderOneMessageImpl.class);
-
-    private final String url;
-    private final UUID productToken;
-
-    public CMSenderOneMessageImpl(final String url, final UUID productToken) {
-
-        this.url = url;
-        this.productToken = productToken;
-    }
-
-    /**
-     * Sends a previously validated SMSMessage to CM endpoint
-     */
-    @Override
-    public void send(final CMMessage cmMessage) throws MessagingException {
-
-        // See: Check https://dashboard.onlinesmsgateway.com/docs for responses
-
-        try {
-
-            // 1.Construct XML. Throws XMLConstructionException
-            final String xml = createXml(cmMessage);
-
-            // 2. Try to send to CM SMS Provider ...Throws CMResponse
-            doHttpPost(url, xml);
-        } catch (final RuntimeException e) {
-            LOG.error("Failed to send SMS: {}", cmMessage, e);
-            throw e; // XMLConstrucion o
-        }
-    }
-
-    private String createXml(final CMMessage message) {
-
-        try {
-
-            final ByteArrayOutputStream xml = new ByteArrayOutputStream();
-            final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-            factory.setNamespaceAware(true);
-
-            // Get the DocumentBuilder
-            final DocumentBuilder docBuilder = factory.newDocumentBuilder();
-
-            // Create blank DOM Document
-            final DOMImplementation impl = docBuilder.getDOMImplementation();
-            final Document doc = impl.createDocument(null, "MESSAGES", null);
-
-            // ROOT Element es MESSAGES
-            final Element root = doc.getDocumentElement();
-
-            // AUTHENTICATION element
-            final Element authenticationElement = doc.createElement("AUTHENTICATION");
-            final Element productTokenElement = doc.createElement("PRODUCTTOKEN");
-            authenticationElement.appendChild(productTokenElement);
-            final Text productTokenValue = doc.createTextNode("" + productToken);
-            productTokenElement.appendChild(productTokenValue);
-            root.appendChild(authenticationElement);
-
-            // MSG Element
-            final Element msgElement = doc.createElement("MSG");
-            root.appendChild(msgElement);
-
-            // <FROM>VALUE</FROM>
-            final Element fromElement = doc.createElement("FROM");
-            fromElement.appendChild(doc.createTextNode(message.getSender()));
-            msgElement.appendChild(fromElement);
-
-            // <BODY>VALUE</BODY>
-            final Element bodyElement = doc.createElement("BODY");
-            bodyElement.appendChild(doc.createTextNode(message.getMessage()));
-            msgElement.appendChild(bodyElement);
-
-            // <TO>VALUE</TO>
-            final Element toElement = doc.createElement("TO");
-            toElement.appendChild(doc.createTextNode(message.getPhoneNumber()));
-            msgElement.appendChild(toElement);
-
-            // <DCS>VALUE</DCS> - if UNICODE - messageOut.isGSM338Enc
-            // false
-            if (message.isUnicode()) {
-                final Element dcsElement = doc.createElement("DCS");
-                dcsElement.appendChild(doc.createTextNode("8"));
-                msgElement.appendChild(dcsElement);
-            }
-
-            // <REFERENCE>VALUE</REFERENCE> -Alfanum
-            final String id = message.getIdAsString();
-            if (id != null && !id.isEmpty()) {
-                final Element refElement = doc.createElement("REFERENCE");
-                refElement.appendChild(doc.createTextNode("" + message.getIdAsString()));
-                msgElement.appendChild(refElement);
-            }
-
-            // <MINIMUMNUMBEROFMESSAGEPARTS>1</MINIMUMNUMBEROFMESSAGEPARTS>
-            // <MAXIMUMNUMBEROFMESSAGEPARTS>8</MAXIMUMNUMBEROFMESSAGEPARTS>
-            if (message.isMultipart()) {
-                final Element minMessagePartsElement = doc.createElement("MINIMUMNUMBEROFMESSAGEPARTS");
-                minMessagePartsElement.appendChild(doc.createTextNode("1"));
-                msgElement.appendChild(minMessagePartsElement);
-
-                final Element maxMessagePartsElement = doc.createElement("MAXIMUMNUMBEROFMESSAGEPARTS");
-                maxMessagePartsElement.appendChild(doc.createTextNode(Integer.toString(message.getMultiparts())));
-                msgElement.appendChild(maxMessagePartsElement);
-            }
-
-            // Creatate XML as String
-            final Transformer aTransformer = TransformerFactory.newInstance().newTransformer();
-            aTransformer.setOutputProperty(OutputKeys.INDENT, "yes");
-            final Source src = new DOMSource(doc);
-            final Result dest = new StreamResult(xml);
-            aTransformer.transform(src, dest);
-            return xml.toString();
-        } catch (final TransformerException e) {
-            LOG.error("Cant serialize CMMessage {}: ", message, e);
-            throw new XMLConstructionException(e);
-        } catch (final ParserConfigurationException e) {
-            LOG.error("Cant serialize CMMessage {}: ", message, e);
-            throw new XMLConstructionException(e);
-        }
-    }
-
-    private void doHttpPost(final String urlString, final String requestString) {
-
-        final HttpClient client = HttpClientBuilder.create().build();
-        final HttpPost post = new HttpPost(urlString);
-        post.setEntity(new StringEntity(requestString, Charset.forName("UTF-8")));
-
-        try {
-
-            final HttpResponse response = client.execute(post);
-
-            final int statusCode = response.getStatusLine().getStatusCode();
-
-            LOG.debug("Response Code : {}", statusCode);
-
-            if (statusCode == 400) {
-                throw new ProviderException("CM Component and CM API show some kind of inconsistency. "
-                                            + "CM is complaining about not using a post method for the request. And this component only uses POST requests. What happens?");
-            }
-
-            if (statusCode != 200) {
-                throw new ProviderException("CM Component and CM API show some kind of inconsistency. The component expects the status code to be 200 or 400. New api released? ");
-            }
-
-            // So we have 200 status code...
-
-            // The response type is 'text/plain' and contains the actual
-            // result of the request processing.
-
-            // We obtaing the result text
-            final BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
-
-            final StringBuffer result = new StringBuffer();
-            String line = null;
-            while ((line = rd.readLine()) != null) {
-                result.append(line);
-            }
-
-            // ... and process it
-
-            line = result.toString();
-            if (!line.isEmpty()) {
-
-                // Line is not empty = error
-                LOG.debug("Result of the request processing: FAILED\n{}", line);
-
-                // The response text contains the error description. We will
-                // throw a custom exception for each.
-
-                if (line.contains(CMConstants.ERROR_UNKNOWN)) {
-                    throw new UnknownErrorException();
-                } else if (line.contains(CMConstants.ERROR_NO_ACCOUNT)) {
-                    throw new NoAccountFoundForProductTokenException();
-                } else if (line.contains(CMConstants.ERROR_INSUFICIENT_BALANCE)) {
-                    throw new InsufficientBalanceException();
-                } else if (line.contains(CMConstants.ERROR_UNROUTABLE_MESSAGE)) {
-                    throw new UnroutableMessageException();
-                } else if (line.contains(CMConstants.ERROR_INVALID_PRODUCT_TOKEN)) {
-                    throw new InvalidProductTokenException();
-                } else {
-
-                    // SO FAR i would expect other kind of ERROR.
-
-                    // MSISDN correctness and message validity is client
-                    // responsibility
-                    throw new CMResponseException("CHECK ME. I am not expecting this. ");
-                }
-            }
-
-            // Ok. Line is EMPTY - successfully submitted
-            LOG.debug("Result of the request processing: Successfully submited");
-        } catch (final IOException io) {
-            throw new ProviderException(io);
-        } catch (Throwable t) {
-            if (!(t instanceof MessagingException)) {
-                // Chain it
-                t = new MessagingException(t);
-            }
-            throw (MessagingException) t;
-        }
-    }
-}
+/**
+ * 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.cm;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.nio.charset.Charset;
+import java.util.UUID;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Text;
+
+import org.apache.camel.component.cm.exceptions.MessagingException;
+import org.apache.camel.component.cm.exceptions.ProviderException;
+import org.apache.camel.component.cm.exceptions.XMLConstructionException;
+import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
+import org.apache.camel.component.cm.exceptions.cmresponse.InsufficientBalanceException;
+import org.apache.camel.component.cm.exceptions.cmresponse.InvalidProductTokenException;
+import org.apache.camel.component.cm.exceptions.cmresponse.NoAccountFoundForProductTokenException;
+import org.apache.camel.component.cm.exceptions.cmresponse.UnknownErrorException;
+import org.apache.camel.component.cm.exceptions.cmresponse.UnroutableMessageException;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CMSenderOneMessageImpl implements CMSender {
+
+    private static final Logger LOG = LoggerFactory.getLogger(CMSenderOneMessageImpl.class);
+
+    private final String url;
+    private final UUID productToken;
+
+    public CMSenderOneMessageImpl(final String url, final UUID productToken) {
+
+        this.url = url;
+        this.productToken = productToken;
+    }
+
+    /**
+     * Sends a previously validated SMSMessage to CM endpoint
+     */
+    @Override
+    public void send(final CMMessage cmMessage) throws MessagingException {
+
+        // See: Check https://dashboard.onlinesmsgateway.com/docs for responses
+
+        try {
+
+            // 1.Construct XML. Throws XMLConstructionException
+            final String xml = createXml(cmMessage);
+
+            // 2. Try to send to CM SMS Provider ...Throws CMResponse
+            doHttpPost(url, xml);
+        } catch (final RuntimeException e) {
+            LOG.error("Failed to send SMS: {}", cmMessage, e);
+            throw e; // XMLConstrucion o
+        }
+    }
+
+    private String createXml(final CMMessage message) {
+
+        try {
+
+            final ByteArrayOutputStream xml = new ByteArrayOutputStream();
+            final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            factory.setNamespaceAware(true);
+
+            // Get the DocumentBuilder
+            final DocumentBuilder docBuilder = factory.newDocumentBuilder();
+
+            // Create blank DOM Document
+            final DOMImplementation impl = docBuilder.getDOMImplementation();
+            final Document doc = impl.createDocument(null, "MESSAGES", null);
+
+            // ROOT Element es MESSAGES
+            final Element root = doc.getDocumentElement();
+
+            // AUTHENTICATION element
+            final Element authenticationElement = doc.createElement("AUTHENTICATION");
+            final Element productTokenElement = doc.createElement("PRODUCTTOKEN");
+            authenticationElement.appendChild(productTokenElement);
+            final Text productTokenValue = doc.createTextNode("" + productToken);
+            productTokenElement.appendChild(productTokenValue);
+            root.appendChild(authenticationElement);
+
+            // MSG Element
+            final Element msgElement = doc.createElement("MSG");
+            root.appendChild(msgElement);
+
+            // <FROM>VALUE</FROM>
+            final Element fromElement = doc.createElement("FROM");
+            fromElement.appendChild(doc.createTextNode(message.getSender()));
+            msgElement.appendChild(fromElement);
+
+            // <BODY>VALUE</BODY>
+            final Element bodyElement = doc.createElement("BODY");
+            bodyElement.appendChild(doc.createTextNode(message.getMessage()));
+            msgElement.appendChild(bodyElement);
+
+            // <TO>VALUE</TO>
+            final Element toElement = doc.createElement("TO");
+            toElement.appendChild(doc.createTextNode(message.getPhoneNumber()));
+            msgElement.appendChild(toElement);
+
+            // <DCS>VALUE</DCS> - if UNICODE - messageOut.isGSM338Enc
+            // false
+            if (message.isUnicode()) {
+                final Element dcsElement = doc.createElement("DCS");
+                dcsElement.appendChild(doc.createTextNode("8"));
+                msgElement.appendChild(dcsElement);
+            }
+
+            // <REFERENCE>VALUE</REFERENCE> -Alfanum
+            final String id = message.getIdAsString();
+            if (id != null && !id.isEmpty()) {
+                final Element refElement = doc.createElement("REFERENCE");
+                refElement.appendChild(doc.createTextNode("" + message.getIdAsString()));
+                msgElement.appendChild(refElement);
+            }
+
+            // <MINIMUMNUMBEROFMESSAGEPARTS>1</MINIMUMNUMBEROFMESSAGEPARTS>
+            // <MAXIMUMNUMBEROFMESSAGEPARTS>8</MAXIMUMNUMBEROFMESSAGEPARTS>
+            if (message.isMultipart()) {
+                final Element minMessagePartsElement = doc.createElement("MINIMUMNUMBEROFMESSAGEPARTS");
+                minMessagePartsElement.appendChild(doc.createTextNode("1"));
+                msgElement.appendChild(minMessagePartsElement);
+
+                final Element maxMessagePartsElement = doc.createElement("MAXIMUMNUMBEROFMESSAGEPARTS");
+                maxMessagePartsElement.appendChild(doc.createTextNode(Integer.toString(message.getMultiparts())));
+                msgElement.appendChild(maxMessagePartsElement);
+            }
+
+            // Creatate XML as String
+            final Transformer aTransformer = TransformerFactory.newInstance().newTransformer();
+            aTransformer.setOutputProperty(OutputKeys.INDENT, "yes");
+            final Source src = new DOMSource(doc);
+            final Result dest = new StreamResult(xml);
+            aTransformer.transform(src, dest);
+            return xml.toString();
+        } catch (final TransformerException e) {
+            LOG.error("Cant serialize CMMessage {}: ", message, e);
+            throw new XMLConstructionException(e);
+        } catch (final ParserConfigurationException e) {
+            LOG.error("Cant serialize CMMessage {}: ", message, e);
+            throw new XMLConstructionException(e);
+        }
+    }
+
+    private void doHttpPost(final String urlString, final String requestString) {
+
+        final HttpClient client = HttpClientBuilder.create().build();
+        final HttpPost post = new HttpPost(urlString);
+        post.setEntity(new StringEntity(requestString, Charset.forName("UTF-8")));
+
+        try {
+
+            final HttpResponse response = client.execute(post);
+
+            final int statusCode = response.getStatusLine().getStatusCode();
+
+            LOG.debug("Response Code : {}", statusCode);
+
+            if (statusCode == 400) {
+                throw new ProviderException("CM Component and CM API show some kind of inconsistency. "
+                                            + "CM is complaining about not using a post method for the request. And this component only uses POST requests. What happens?");
+            }
+
+            if (statusCode != 200) {
+                throw new ProviderException("CM Component and CM API show some kind of inconsistency. The component expects the status code to be 200 or 400. New api released? ");
+            }
+
+            // So we have 200 status code...
+
+            // The response type is 'text/plain' and contains the actual
+            // result of the request processing.
+
+            // We obtaing the result text
+            final BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+
+            final StringBuffer result = new StringBuffer();
+            String line = null;
+            while ((line = rd.readLine()) != null) {
+                result.append(line);
+            }
+
+            // ... and process it
+
+            line = result.toString();
+            if (!line.isEmpty()) {
+
+                // Line is not empty = error
+                LOG.debug("Result of the request processing: FAILED\n{}", line);
+
+                // The response text contains the error description. We will
+                // throw a custom exception for each.
+
+                if (line.contains(CMConstants.ERROR_UNKNOWN)) {
+                    throw new UnknownErrorException();
+                } else if (line.contains(CMConstants.ERROR_NO_ACCOUNT)) {
+                    throw new NoAccountFoundForProductTokenException();
+                } else if (line.contains(CMConstants.ERROR_INSUFICIENT_BALANCE)) {
+                    throw new InsufficientBalanceException();
+                } else if (line.contains(CMConstants.ERROR_UNROUTABLE_MESSAGE)) {
+                    throw new UnroutableMessageException();
+                } else if (line.contains(CMConstants.ERROR_INVALID_PRODUCT_TOKEN)) {
+                    throw new InvalidProductTokenException();
+                } else {
+
+                    // SO FAR i would expect other kind of ERROR.
+
+                    // MSISDN correctness and message validity is client
+                    // responsibility
+                    throw new CMResponseException("CHECK ME. I am not expecting this. ");
+                }
+            }
+
+            // Ok. Line is EMPTY - successfully submitted
+            LOG.debug("Result of the request processing: Successfully submited");
+        } catch (final IOException io) {
+            throw new ProviderException(io);
+        } catch (Throwable t) {
+            if (!(t instanceof MessagingException)) {
+                // Chain it
+                t = new MessagingException(t);
+            }
+            throw (MessagingException) t;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/4f8c9c9b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
index 9eacecb..d796eb9 100644
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
@@ -1,323 +1,323 @@
-/**
- * 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.cm.test;
-
-import com.google.i18n.phonenumbers.PhoneNumberUtil;
-import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
-import org.apache.camel.component.cm.CMConstants;
-import org.apache.camel.component.cm.CMMessage;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.util.Assert;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = { ValidatorConfiguration.class })
-// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
-// @DisableJmx(false)
-// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class CMMessageTest extends AbstractJUnit4SpringContextTests {
-
-    private final PhoneNumberUtil pnu = PhoneNumberUtil.getInstance();
-    private String validNumber;
-
-    @Before
-    public void beforeTest() throws Exception {
-        validNumber = pnu.format(pnu.getExampleNumber("ES"), PhoneNumberFormat.E164);
-    }
-
-    // @After
-    // public void afterTest() {
-
-    /*
-     * GSM0338
-     */
-
-    @Test
-    public void testGSM338AndLTMAXGSMMESSAGELENGTH() throws Exception {
-
-        // 0338 and less than 160 char -> 1 part
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < CMConstants.MAX_GSM_MESSAGE_LENGTH; index++) {
-            message.append("a");
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 1);
-        Assert.isTrue(!cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testGSM338AndEQMAXGSMMESSAGELENGTH() throws Exception {
-        // 0338 and length is exactly 160 -> 1 part
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < CMConstants.MAX_GSM_MESSAGE_LENGTH; index++) {
-            message.append("a");
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 1);
-        Assert.isTrue(!cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testGSM338AndGTMAXGSMMESSAGELENGTH() throws Exception {
-
-        // 0338 and length is exactly 161 -> 2 part
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < CMConstants.MAX_GSM_MESSAGE_LENGTH + 1; index++) {
-            message.append("a");
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 2);
-        Assert.isTrue(!cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testGSM338AndLT2MAXGSMMESSAGELENGTH() throws Exception {
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (2 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART - 1); index++) {
-            message.append("a");
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 2);
-        Assert.isTrue(!cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testGSM338AndEQ2MAXGSMMESSAGELENGTH() throws Exception {
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (2 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
-            message.append("a");
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 2);
-        Assert.isTrue(!cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testGSM338AndGT2MAXGSMMESSAGELENGTH() throws Exception {
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (2 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
-            message.append("a");
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 3);
-        Assert.isTrue(!cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testGSM338AndEQ8MAXGSMMESSAGELENGTH() throws Exception {
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (8 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
-            message.append("a");
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 8);
-        Assert.isTrue(!cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testGSM338AndGT8MAXGSMMESSAGELENGTH() throws Exception {
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (8 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
-            message.append("a");
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 8);
-        Assert.isTrue(!cmMessage.isUnicode());
-    }
-
-    /*
-     * Unicode Messages
-     */
-
-    @Test
-    public void testUnicodeAndLTMAXGSMMESSAGELENGTH() throws Exception {
-
-        String ch = "\uF400";
-
-        // 0338 and less than 160 char -> 1 part
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < CMConstants.MAX_UNICODE_MESSAGE_LENGTH; index++) {
-            message.append(ch);
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 1);
-        Assert.isTrue(cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testUnicodeAndEQMAXGSMMESSAGELENGTH() throws Exception {
-        // 0338 and length is exactly 160 -> 1 part
-
-        String ch = "\uF400";
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < CMConstants.MAX_UNICODE_MESSAGE_LENGTH; index++) {
-            message.append(ch);
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 1);
-        Assert.isTrue(cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testUnicodeAndGTMAXGSMMESSAGELENGTH() throws Exception {
-
-        // 0338 and length is exactly 161 -> 2 part
-
-        String ch = "\uF400";
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < CMConstants.MAX_UNICODE_MESSAGE_LENGTH + 1; index++) {
-            message.append(ch);
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 2);
-        Assert.isTrue(cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testUnicodeAndLT2MAXGSMMESSAGELENGTH() throws Exception {
-
-        String ch = "\uF400";
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (2 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART - 1); index++) {
-            message.append(ch);
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 2);
-        Assert.isTrue(cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testUnicodeAndEQ2MAXGSMMESSAGELENGTH() throws Exception {
-
-        String ch = "\uF400";
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (2 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
-            message.append(ch);
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 2);
-        Assert.isTrue(cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testUnicodeAndGT2MAXGSMMESSAGELENGTH() throws Exception {
-
-        String ch = "\uF400";
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (2 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
-            message.append(ch);
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 3);
-        Assert.isTrue(cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testUnicodeAndEQ8MAXGSMMESSAGELENGTH() throws Exception {
-
-        String ch = "\uF400";
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (8 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
-            message.append(ch);
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 8);
-        Assert.isTrue(cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testUnicodeAndGT8MAXGSMMESSAGELENGTH() throws Exception {
-
-        String ch = "\uF400";
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (8 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
-            message.append(ch);
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 8);
-        Assert.isTrue(cmMessage.isUnicode());
-    }
-
-}
+/**
+ * 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.cm.test;
+
+import com.google.i18n.phonenumbers.PhoneNumberUtil;
+import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
+import org.apache.camel.component.cm.CMConstants;
+import org.apache.camel.component.cm.CMMessage;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.util.Assert;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { ValidatorConfiguration.class })
+// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
+// @DisableJmx(false)
+// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class CMMessageTest extends AbstractJUnit4SpringContextTests {
+
+    private final PhoneNumberUtil pnu = PhoneNumberUtil.getInstance();
+    private String validNumber;
+
+    @Before
+    public void beforeTest() throws Exception {
+        validNumber = pnu.format(pnu.getExampleNumber("ES"), PhoneNumberFormat.E164);
+    }
+
+    // @After
+    // public void afterTest() {
+
+    /*
+     * GSM0338
+     */
+
+    @Test
+    public void testGSM338AndLTMAXGSMMESSAGELENGTH() throws Exception {
+
+        // 0338 and less than 160 char -> 1 part
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < CMConstants.MAX_GSM_MESSAGE_LENGTH; index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 1);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndEQMAXGSMMESSAGELENGTH() throws Exception {
+        // 0338 and length is exactly 160 -> 1 part
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < CMConstants.MAX_GSM_MESSAGE_LENGTH; index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 1);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndGTMAXGSMMESSAGELENGTH() throws Exception {
+
+        // 0338 and length is exactly 161 -> 2 part
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < CMConstants.MAX_GSM_MESSAGE_LENGTH + 1; index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 2);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndLT2MAXGSMMESSAGELENGTH() throws Exception {
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (2 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART - 1); index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 2);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndEQ2MAXGSMMESSAGELENGTH() throws Exception {
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (2 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 2);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndGT2MAXGSMMESSAGELENGTH() throws Exception {
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (2 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 3);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndEQ8MAXGSMMESSAGELENGTH() throws Exception {
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (8 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 8);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndGT8MAXGSMMESSAGELENGTH() throws Exception {
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (8 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 8);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    /*
+     * Unicode Messages
+     */
+
+    @Test
+    public void testUnicodeAndLTMAXGSMMESSAGELENGTH() throws Exception {
+
+        String ch = "\uF400";
+
+        // 0338 and less than 160 char -> 1 part
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < CMConstants.MAX_UNICODE_MESSAGE_LENGTH; index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 1);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndEQMAXGSMMESSAGELENGTH() throws Exception {
+        // 0338 and length is exactly 160 -> 1 part
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < CMConstants.MAX_UNICODE_MESSAGE_LENGTH; index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 1);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndGTMAXGSMMESSAGELENGTH() throws Exception {
+
+        // 0338 and length is exactly 161 -> 2 part
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < CMConstants.MAX_UNICODE_MESSAGE_LENGTH + 1; index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 2);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndLT2MAXGSMMESSAGELENGTH() throws Exception {
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (2 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART - 1); index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 2);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndEQ2MAXGSMMESSAGELENGTH() throws Exception {
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (2 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 2);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndGT2MAXGSMMESSAGELENGTH() throws Exception {
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (2 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 3);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndEQ8MAXGSMMESSAGELENGTH() throws Exception {
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (8 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 8);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndGT8MAXGSMMESSAGELENGTH() throws Exception {
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (8 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 8);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/4f8c9c9b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java
index bb4ed83..9fac037 100644
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java
@@ -19,6 +19,8 @@ package org.apache.camel.component.cm.test;
 import java.math.BigInteger;
 import java.security.SecureRandom;
 
+import com.google.i18n.phonenumbers.PhoneNumberUtil;
+import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
 import org.apache.camel.CamelContext;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.InvalidPayloadRuntimeException;
@@ -61,9 +63,6 @@ import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
 import org.springframework.util.Assert;
 
-import com.google.i18n.phonenumbers.PhoneNumberUtil;
-import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
-
 @RunWith(CamelSpringJUnit4ClassRunner.class)
 @ContextConfiguration(classes = {
         CamelTestConfiguration.class }, loader = CamelSpringDelegatingTestContextLoader.class)

http://git-wip-us.apache.org/repos/asf/camel/blob/4f8c9c9b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CamelTestConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CamelTestConfiguration.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CamelTestConfiguration.java
index b6a136d..54a3356 100644
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CamelTestConfiguration.java
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CamelTestConfiguration.java
@@ -1,100 +1,112 @@
-/**
- * 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.cm.test;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.spring.javaconfig.SingleRouteCamelConfiguration;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.PropertySource;
-import org.springframework.core.env.Environment;
-import org.springframework.util.Assert;
-import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
-
-/**
- * Builds a SimpleRoute to send a message to CM GW and CM Uri is built based on properties in a file.
- */
-@Configuration("cmConfig")
-@PropertySource("classpath:/cm-smsgw.properties")
-public class CamelTestConfiguration extends SingleRouteCamelConfiguration {
-
-    public static final String SIMPLE_ROUTE_ID = "simple-route";
-
-    private String uri;
-
-    @Override
-    public RouteBuilder route() {
-        return new RouteBuilder() {
-
-            @Override
-            public void configure() throws Exception {
-
-                Assert.hasLength(uri);
-
-                log.info("\nCM Component is an URI based component\nCM URI: {}", uri);
-
-                // Route definition
-                from("direct:sms").to(uri).to("mock:test").routeId(SIMPLE_ROUTE_ID).autoStartup(true);
-
-            }
-        };
-    }
-
-    @Bean
-    public LocalValidatorFactoryBean getValidatorFactory() {
-        final LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
-        localValidatorFactoryBean.getValidationPropertyMap().put("hibernate.validator.fail_fast", "true");
-        return localValidatorFactoryBean;
-    }
-
-    /**
-     * Build the URI of the CM Component based on Environmental properties
-     */
-    @Override
-    public final void setApplicationContext(final ApplicationContext applicationContext) {
-
-        super.setApplicationContext(applicationContext);
-
-        final Environment env = applicationContext.getEnvironment();
-
-        final String host = env.getRequiredProperty("cm.url");
-        final String productTokenString = env.getRequiredProperty("cm.product-token");
-        final String sender = env.getRequiredProperty("cm.default-sender");
-
-        final StringBuffer cmUri = new StringBuffer("cm:" + host).append("?productToken=").append(productTokenString);
-        if (sender != null && !sender.isEmpty()) {
-            cmUri.append("&defaultFrom=").append(sender);
-        }
-
-        // Defaults to false
-        final Boolean testConnectionOnStartup = Boolean.parseBoolean(env.getProperty("cm.testConnectionOnStartup", "false"));
-        if (testConnectionOnStartup) {
-            cmUri.append("&testConnectionOnStartup=").append(testConnectionOnStartup.toString());
-        }
-
-        // Defaults to 8
-        final Integer defaultMaxNumberOfParts = Integer.parseInt(env.getProperty("defaultMaxNumberOfParts", "8"));
-        cmUri.append("&defaultMaxNumberOfParts=").append(defaultMaxNumberOfParts.toString());
-
-        uri = cmUri.toString();
-    }
-
-    public String getUri() {
-        return uri;
-    }
-}
+/**
+ * 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.cm.test;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spring.javaconfig.SingleRouteCamelConfiguration;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.core.env.Environment;
+import org.springframework.util.Assert;
+import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
+
+/**
+ * Builds a SimpleRoute to send a message to CM GW and CM Uri is built based on
+ * properties in a file.
+ */
+@Configuration("cmConfig")
+@PropertySource("classpath:/cm-smsgw.properties")
+public class CamelTestConfiguration extends SingleRouteCamelConfiguration {
+
+    public static final String SIMPLE_ROUTE_ID = "simple-route";
+
+    private String uri;
+
+    @Override
+    public RouteBuilder route() {
+        return new RouteBuilder() {
+
+            @Override
+            public void configure() throws Exception {
+
+                Assert.hasLength(uri);
+
+                log.debug(
+                        "\nCM Component is an URI based component\nCM URI: {}",
+                        uri);
+
+                // Route definition
+                from("direct:sms").to(uri).to("mock:test")
+                        .routeId(SIMPLE_ROUTE_ID).autoStartup(true);
+
+            }
+        };
+    }
+
+    @Bean
+    public LocalValidatorFactoryBean getValidatorFactory() {
+        final LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
+        localValidatorFactoryBean.getValidationPropertyMap()
+                .put("hibernate.validator.fail_fast", "true");
+        return localValidatorFactoryBean;
+    }
+
+    /**
+     * Build the URI of the CM Component based on Environmental properties
+     */
+    @Override
+    public final void setApplicationContext(
+            final ApplicationContext applicationContext) {
+
+        super.setApplicationContext(applicationContext);
+
+        final Environment env = applicationContext.getEnvironment();
+
+        final String host = env.getRequiredProperty("cm.url");
+        final String productTokenString = env
+                .getRequiredProperty("cm.product-token");
+        final String sender = env.getRequiredProperty("cm.default-sender");
+
+        final StringBuffer cmUri = new StringBuffer("cm:" + host)
+                .append("?productToken=").append(productTokenString);
+        if (sender != null && !sender.isEmpty()) {
+            cmUri.append("&defaultFrom=").append(sender);
+        }
+
+        // Defaults to false
+        final Boolean testConnectionOnStartup = Boolean.parseBoolean(
+                env.getProperty("cm.testConnectionOnStartup", "false"));
+        if (testConnectionOnStartup) {
+            cmUri.append("&testConnectionOnStartup=")
+                    .append(testConnectionOnStartup.toString());
+        }
+
+        // Defaults to 8
+        final Integer defaultMaxNumberOfParts = Integer
+                .parseInt(env.getProperty("defaultMaxNumberOfParts", "8"));
+        cmUri.append("&defaultMaxNumberOfParts=")
+                .append(defaultMaxNumberOfParts.toString());
+
+        uri = cmUri.toString();
+    }
+
+    public String getUri() {
+        return uri;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/4f8c9c9b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java
index 63bfced..8d653d3 100644
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java
@@ -1,183 +1,183 @@
-/**
- * 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.cm.test;
-
-import java.util.Set;
-
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-
-import com.google.i18n.phonenumbers.PhoneNumberUtil;
-import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
-import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
-import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber.CountryCodeSource;
-import org.apache.camel.component.cm.client.SMSMessage;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.util.Assert;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {ValidatorConfiguration.class })
-// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
-// @DisableJmx(false)
-// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class SMSMessageTest extends AbstractJUnit4SpringContextTests {
-
-    @Autowired
-    private Validator validator;
-
-    private final PhoneNumberUtil pnu = PhoneNumberUtil.getInstance();
-    private String validNumber;
-
-    @Before
-    public void beforeTest() throws Exception {
-
-        validNumber = pnu.format(pnu.getExampleNumber("ES"), PhoneNumberFormat.E164);
-    }
-
-    // @After
-    // public void afterTest() {
-
-    @Test
-    public void testSMSMessageConstructor() throws Throwable {
-
-        // Coverage ;)
-        SMSMessage message = new SMSMessage(null, null);
-        Assert.isNull(message.getMessage());
-        Assert.isNull(message.getPhoneNumber());
-
-        message = new SMSMessage("idAsString", null, null, "MySelf");
-        Assert.isTrue(message.getId().equals("idAsString"));
-        Assert.isTrue(message.getFrom().equals("MySelf"));
-    }
-
-    @Test
-    public void testNullMessageField() throws Exception {
-
-        final SMSMessage m = new SMSMessage(null, validNumber);
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testNullPhoneNumber() throws Exception {
-
-        final SMSMessage m = new SMSMessage("Hello world!", null);
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testDynamicFromFieldMaxLength() throws Exception {
-
-        String dynamicFrom = "messagelengthgreaterthan12";
-
-        final SMSMessage m = new SMSMessage("idAsString", "Hello World", validNumber, dynamicFrom);
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testDynamicFromFieldZeroLength() throws Exception {
-
-        String zeroLengthDynamicFrom = "";
-
-        final SMSMessage m = new SMSMessage("idAsString", "Hello World", validNumber, zeroLengthDynamicFrom);
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testIdAsStringMaxLength() throws Exception {
-
-        String idAsString = "thisistheidastringlengthgreaterthan32";
-
-        final SMSMessage m = new SMSMessage(idAsString, "Hello World", validNumber, "MySelf");
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testIdAsStringFieldZeroLength() throws Exception {
-
-        String zeroLengthIdAsString = "";
-
-        final SMSMessage m = new SMSMessage(zeroLengthIdAsString, "Hello World", validNumber, "MySelf");
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testE164NullNumberIsInValid() throws Exception {
-
-        final String phoneNumber = null;
-        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testE164IsValid() throws Exception {
-
-        final SMSMessage m = new SMSMessage("Hello world!", validNumber);
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(0 == constraintViolations.size());
-    }
-
-    @Test
-    public void testE164NoPlusSignedNumberIsInvalid() throws Exception {
-
-        final String phoneNumber = "34600000000";
-        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testE164NoPlusSignedNumberBut00IsInvalid() throws Exception {
-
-        final String phoneNumber = new PhoneNumber().setCountryCodeSource(CountryCodeSource.FROM_NUMBER_WITHOUT_PLUS_SIGN).setNationalNumber(0034600000000).toString();
-        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testE164NumberWithPlusSignIsInvalid() throws Exception {
-
-        final String phoneNumber = "+34 600 00 00 00";
-        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-}
+/**
+ * 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.cm.test;
+
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import com.google.i18n.phonenumbers.PhoneNumberUtil;
+import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
+import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
+import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber.CountryCodeSource;
+import org.apache.camel.component.cm.client.SMSMessage;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.util.Assert;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {ValidatorConfiguration.class })
+// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
+// @DisableJmx(false)
+// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class SMSMessageTest extends AbstractJUnit4SpringContextTests {
+
+    @Autowired
+    private Validator validator;
+
+    private final PhoneNumberUtil pnu = PhoneNumberUtil.getInstance();
+    private String validNumber;
+
+    @Before
+    public void beforeTest() throws Exception {
+
+        validNumber = pnu.format(pnu.getExampleNumber("ES"), PhoneNumberFormat.E164);
+    }
+
+    // @After
+    // public void afterTest() {
+
+    @Test
+    public void testSMSMessageConstructor() throws Throwable {
+
+        // Coverage ;)
+        SMSMessage message = new SMSMessage(null, null);
+        Assert.isNull(message.getMessage());
+        Assert.isNull(message.getPhoneNumber());
+
+        message = new SMSMessage("idAsString", null, null, "MySelf");
+        Assert.isTrue(message.getId().equals("idAsString"));
+        Assert.isTrue(message.getFrom().equals("MySelf"));
+    }
+
+    @Test
+    public void testNullMessageField() throws Exception {
+
+        final SMSMessage m = new SMSMessage(null, validNumber);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testNullPhoneNumber() throws Exception {
+
+        final SMSMessage m = new SMSMessage("Hello world!", null);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testDynamicFromFieldMaxLength() throws Exception {
+
+        String dynamicFrom = "messagelengthgreaterthan12";
+
+        final SMSMessage m = new SMSMessage("idAsString", "Hello World", validNumber, dynamicFrom);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testDynamicFromFieldZeroLength() throws Exception {
+
+        String zeroLengthDynamicFrom = "";
+
+        final SMSMessage m = new SMSMessage("idAsString", "Hello World", validNumber, zeroLengthDynamicFrom);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testIdAsStringMaxLength() throws Exception {
+
+        String idAsString = "thisistheidastringlengthgreaterthan32";
+
+        final SMSMessage m = new SMSMessage(idAsString, "Hello World", validNumber, "MySelf");
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testIdAsStringFieldZeroLength() throws Exception {
+
+        String zeroLengthIdAsString = "";
+
+        final SMSMessage m = new SMSMessage(zeroLengthIdAsString, "Hello World", validNumber, "MySelf");
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testE164NullNumberIsInValid() throws Exception {
+
+        final String phoneNumber = null;
+        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testE164IsValid() throws Exception {
+
+        final SMSMessage m = new SMSMessage("Hello world!", validNumber);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(0 == constraintViolations.size());
+    }
+
+    @Test
+    public void testE164NoPlusSignedNumberIsInvalid() throws Exception {
+
+        final String phoneNumber = "34600000000";
+        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testE164NoPlusSignedNumberBut00IsInvalid() throws Exception {
+
+        final String phoneNumber = new PhoneNumber().setCountryCodeSource(CountryCodeSource.FROM_NUMBER_WITHOUT_PLUS_SIGN).setNationalNumber(0034600000000).toString();
+        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testE164NumberWithPlusSignIsInvalid() throws Exception {
+
+        final String phoneNumber = "+34 600 00 00 00";
+        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+}


[16/23] camel git commit: Fixing. Logging and throw. Do not log and throw error, just throw error.

Posted by da...@apache.org.
Fixing. Logging and throw. Do not log and throw error, just throw error.

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

Branch: refs/heads/master
Commit: a7f8c12ef1aa43284dc8c5da397c19a5e33d7b5d
Parents: a17572e
Author: oalles <oa...@neivi.es>
Authored: Mon Mar 21 12:45:35 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 23 18:46:10 2016 +0100

----------------------------------------------------------------------
 .../apache/camel/component/cm/CMComponent.java  | 213 ++++++++++---------
 1 file changed, 109 insertions(+), 104 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a7f8c12e/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
index ccd701f..8dd3b58 100644
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
@@ -1,104 +1,109 @@
-/**
- * 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.cm;
-
-import java.util.Map;
-import java.util.Set;
-
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-
-import org.apache.camel.BeanInject;
-import org.apache.camel.CamelContext;
-import org.apache.camel.Endpoint;
-import org.apache.camel.component.cm.exceptions.InvalidURLException;
-import org.apache.camel.component.cm.exceptions.InvalidUriEndpointException;
-import org.apache.camel.impl.UriEndpointComponent;
-import org.apache.camel.util.URISupport;
-import org.apache.commons.validator.routines.UrlValidator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Represents the component that manages {@link CMEndpoint}s.
- */
-public class CMComponent extends UriEndpointComponent {
-
-    private static final Logger LOG = LoggerFactory.getLogger(CMComponent.class);
-
-    @BeanInject
-    private Validator validator;
-
-    // public CMComponent() {
-    // super(CMEndpoint.class);
-    // }
-
-    public CMComponent(final CamelContext context) {
-        super(context, CMEndpoint.class);
-    }
-
-    /**
-     * Endpoints factory
-     */
-    @Override
-    protected Endpoint createEndpoint(final String uri, final String remaining, final Map<String, Object> parameters) throws Exception {
-
-        LOG.info("Creating CM Endpoint ... ");
-
-        final String url = CMConstants.DEFAULT_SCHEME + remaining;
-        if (!UrlValidator.getInstance().isValid(url)) {
-            final String errorMessage = String.format("HOST provided: %s seem to be invalid. Remember SCHEME has to be excluded.", url);
-            final Exception t = new InvalidURLException(errorMessage);
-            LOG.error(errorMessage, t);
-            throw t;
-        }
-
-        LOG.info("Uri=[{}], path=[{}], parameters=[{}]", new Object[] {URISupport.sanitizeUri(uri), URISupport.sanitizePath(remaining), parameters });
-
-        // Set configuration based on uri parameters
-        final CMConfiguration config = new CMConfiguration();
-        setProperties(config, parameters);
-
-        // Validate configuration
-        LOG.info("Validating uri based configuration");
-        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(config);
-        if (constraintViolations.size() > 0) {
-            final StringBuffer msg = new StringBuffer();
-            for (final ConstraintViolation<CMConfiguration> cv : constraintViolations) {
-                msg.append(String.format("- Invalid value for %s: %s", cv.getPropertyPath().toString(), cv.getMessage()));
-            }
-            LOG.error(msg.toString());
-            throw new InvalidUriEndpointException(msg.toString());
-        }
-        LOG.info("CMConfiguration - OK!");
-
-        // Component is an Endpoint factory. So far, just one Endpoint type.
-        // Endpoint construction and configuration.
-
-        LOG.info("Creating CMEndpoint");
-        final CMEndpoint endpoint = new CMEndpoint(uri, this);
-        endpoint.setConfiguration(config);
-        endpoint.setHost(remaining);
-
-        return endpoint;
-    }
-
-    public Validator getValidator() {
-        return validator;
-    }
-
-}
+/**
+ * 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.cm;
+
+import java.util.Map;
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.apache.camel.BeanInject;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
+import org.apache.camel.component.cm.exceptions.InvalidURLException;
+import org.apache.camel.component.cm.exceptions.InvalidUriEndpointException;
+import org.apache.camel.impl.UriEndpointComponent;
+import org.apache.camel.util.URISupport;
+import org.apache.commons.validator.routines.UrlValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Represents the component that manages {@link CMEndpoint}s.
+ */
+public class CMComponent extends UriEndpointComponent {
+
+    private static final Logger LOG = LoggerFactory
+            .getLogger(CMComponent.class);
+
+    @BeanInject
+    private Validator validator;
+
+    // public CMComponent() {
+    // super(CMEndpoint.class);
+    // }
+
+    public CMComponent(final CamelContext context) {
+        super(context, CMEndpoint.class);
+    }
+
+    /**
+     * Endpoints factory
+     */
+    @Override
+    protected Endpoint createEndpoint(final String uri, final String remaining,
+            final Map<String, Object> parameters) throws Exception {
+
+        LOG.info("Creating CM Endpoint ... ");
+
+        final String url = CMConstants.DEFAULT_SCHEME + remaining;
+        if (!UrlValidator.getInstance().isValid(url)) {
+            throw new InvalidURLException(String.format(
+                    "HOST provided: %s seem to be invalid. Remember SCHEME has to be excluded.",
+                    url));
+        }
+
+        LOG.info("Uri=[{}], path=[{}], parameters=[{}]",
+                new Object[] { URISupport.sanitizeUri(uri),
+                        URISupport.sanitizePath(remaining), parameters });
+
+        // Set configuration based on uri parameters
+        final CMConfiguration config = new CMConfiguration();
+        setProperties(config, parameters);
+
+        // Validate configuration
+        LOG.info("Validating uri based configuration");
+        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator
+                .validate(config);
+        if (constraintViolations.size() > 0) {
+            final StringBuffer msg = new StringBuffer();
+            for (final ConstraintViolation<CMConfiguration> cv : constraintViolations) {
+                msg.append(String.format("- Invalid value for %s: %s",
+                        cv.getPropertyPath().toString(), cv.getMessage()));
+            }
+            LOG.error(msg.toString());
+            throw new InvalidUriEndpointException(msg.toString());
+        }
+        LOG.info("CMConfiguration - OK!");
+
+        // Component is an Endpoint factory. So far, just one Endpoint type.
+        // Endpoint construction and configuration.
+
+        LOG.info("Creating CMEndpoint");
+        final CMEndpoint endpoint = new CMEndpoint(uri, this);
+        endpoint.setConfiguration(config);
+        endpoint.setHost(remaining);
+
+        return endpoint;
+    }
+
+    public Validator getValidator() {
+        return validator;
+    }
+
+}


[21/23] camel git commit: Polished

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/validation/constraints/E164Validator.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/validation/constraints/E164Validator.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/validation/constraints/E164Validator.java
new file mode 100644
index 0000000..d8160f7
--- /dev/null
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/validation/constraints/E164Validator.java
@@ -0,0 +1,66 @@
+/**
+ * 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.cm.validation.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+import com.google.i18n.phonenumbers.NumberParseException;
+import com.google.i18n.phonenumbers.PhoneNumberUtil;
+import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
+import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
+
+/**
+ * Checks that a given character sequence (e.g. string) is a valid E164 formatted phonenumber. https://www.cmtelecom.com/newsroom/how-to-format-international-telephone- numbers
+ * https://github.com/googlei18n/libphonenumber
+ */
+public class E164Validator implements ConstraintValidator<E164, String> {
+
+    private final PhoneNumberUtil pnu = PhoneNumberUtil.getInstance();
+
+    @Override
+    public void initialize(final E164 constraintAnnotation) {
+    }
+
+    @Override
+    public boolean isValid(final String value, final ConstraintValidatorContext context) {
+
+        if (value == null) {
+            return false;
+        }
+        try {
+
+            final PhoneNumber parsingResult = pnu.parse(value, null);
+            if (!pnu.format(parsingResult, PhoneNumberFormat.E164).equals(value)) {
+                return false;
+            }
+            return true;
+        } catch (final NumberParseException t) {
+            // Errors when parsing phonenumber
+            return false;
+        }
+
+        // CountryCodeSource.FROM_NUMBER_WITH_PLUS_SIGN
+        // log.debug("Phone Number: {}", value);
+        // log.debug("Country code: {}", numberProto.getCountryCode());
+        // log.debug("National Number: {}", numberProto.getNationalNumber());
+        // log.debug("E164 format: {}", pnu.format(numberProto,
+        // PhoneNumberFormat.E164));
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/resources/META-INF/services/org/apache/camel/component/cm-sms
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/resources/META-INF/services/org/apache/camel/component/cm-sms b/components/camel-cm-sms/src/main/resources/META-INF/services/org/apache/camel/component/cm-sms
new file mode 100644
index 0000000..bf9d84b
--- /dev/null
+++ b/components/camel-cm-sms/src/main/resources/META-INF/services/org/apache/camel/component/cm-sms
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+class=org.apache.camel.component.cm.CMComponent

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/resources/log4j.properties b/components/camel-cm-sms/src/main/resources/log4j.properties
new file mode 100644
index 0000000..0ada021
--- /dev/null
+++ b/components/camel-cm-sms/src/main/resources/log4j.properties
@@ -0,0 +1,41 @@
+## ------------------------------------------------------------------------
+## 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.
+## ------------------------------------------------------------------------
+
+#
+# The logging properties used for testing
+#
+log4j.rootLogger=INFO, file
+
+# uncomment the following to enable camel debugging
+#log4j.logger.org.apache.camel.component.cm=TRACE
+#log4j.logger.org.apache.camel=DEBUG
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+#log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+# MDC
+#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{camel.breadcrumbId} - %-10.10X{camel.exchangeId} - %-10.10X{camel.correlationId} - %-10.10X{camel.routeId} - %m%n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.file.file=target/camel-cm-sms-test.log
+# MDC
+#log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{camel.breadcrumbId} - %-10.10X{camel.exchangeId} - %-10.10X{camel.correlationId} - %-10.10X{camel.routeId} - %m%n

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMConfigurationTest.java b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMConfigurationTest.java
new file mode 100644
index 0000000..b4135ec
--- /dev/null
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMConfigurationTest.java
@@ -0,0 +1,142 @@
+/**
+ * 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.cm.test;
+
+import java.util.Set;
+import java.util.UUID;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.apache.camel.component.cm.CMConfiguration;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.util.Assert;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { ValidatorConfiguration.class })
+// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
+// @DisableJmx(false)
+// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class CMConfigurationTest extends AbstractJUnit4SpringContextTests {
+
+    @Autowired
+    private Validator validator;
+
+    @Before
+    public void beforeTest() throws Exception {
+    }
+
+    // @After
+    // public void afterTest() {
+
+    @Test
+    public void testNullProductToken() throws Exception {
+
+        final CMConfiguration configuration = new CMConfiguration();
+
+        // length: 1-11
+        configuration.setDefaultFrom("DefaultFrom");
+        configuration.setProductToken(null);
+        configuration.setDefaultMaxNumberOfParts(8);
+        configuration.setTestConnectionOnStartup(false);
+
+        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testNullDefaultFrom() throws Exception {
+
+        final CMConfiguration configuration = new CMConfiguration();
+
+        // length: 1-11
+        configuration.setDefaultFrom(null);
+
+        configuration.setProductToken(UUID.randomUUID().toString());
+        configuration.setDefaultMaxNumberOfParts(8);
+        configuration.setTestConnectionOnStartup(false);
+
+        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testDefaultFromFieldMaxLength() throws Exception {
+
+        final CMConfiguration configuration = new CMConfiguration();
+
+        // length: 1-11
+        configuration.setDefaultFrom("123456789012");
+
+        configuration.setProductToken(UUID.randomUUID().toString());
+        configuration.setDefaultMaxNumberOfParts(8);
+        configuration.setTestConnectionOnStartup(false);
+
+        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testDefaultFromFieldZeroLength() throws Exception {
+
+        final CMConfiguration configuration = new CMConfiguration();
+
+        // length: 1-11
+        configuration.setDefaultFrom("");
+
+        configuration.setProductToken(UUID.randomUUID().toString());
+        configuration.setDefaultMaxNumberOfParts(8);
+        configuration.setTestConnectionOnStartup(false);
+
+        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testMaxNumberOfParts() throws Exception {
+
+        final CMConfiguration configuration = new CMConfiguration();
+
+        configuration.setProductToken(UUID.randomUUID().toString());
+        configuration.setDefaultFrom("DefaultFrom");
+        configuration.setDefaultMaxNumberOfParts(9);
+        configuration.setTestConnectionOnStartup(false);
+
+        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testMaxNumberOfPartsZero() throws Exception {
+
+        final CMConfiguration configuration = new CMConfiguration();
+
+        configuration.setProductToken(UUID.randomUUID().toString());
+        configuration.setDefaultFrom("DefaultFrom");
+        configuration.setDefaultMaxNumberOfParts(0);
+        configuration.setTestConnectionOnStartup(false);
+
+        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
new file mode 100644
index 0000000..d796eb9
--- /dev/null
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
@@ -0,0 +1,323 @@
+/**
+ * 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.cm.test;
+
+import com.google.i18n.phonenumbers.PhoneNumberUtil;
+import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
+import org.apache.camel.component.cm.CMConstants;
+import org.apache.camel.component.cm.CMMessage;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.util.Assert;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { ValidatorConfiguration.class })
+// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
+// @DisableJmx(false)
+// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class CMMessageTest extends AbstractJUnit4SpringContextTests {
+
+    private final PhoneNumberUtil pnu = PhoneNumberUtil.getInstance();
+    private String validNumber;
+
+    @Before
+    public void beforeTest() throws Exception {
+        validNumber = pnu.format(pnu.getExampleNumber("ES"), PhoneNumberFormat.E164);
+    }
+
+    // @After
+    // public void afterTest() {
+
+    /*
+     * GSM0338
+     */
+
+    @Test
+    public void testGSM338AndLTMAXGSMMESSAGELENGTH() throws Exception {
+
+        // 0338 and less than 160 char -> 1 part
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < CMConstants.MAX_GSM_MESSAGE_LENGTH; index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 1);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndEQMAXGSMMESSAGELENGTH() throws Exception {
+        // 0338 and length is exactly 160 -> 1 part
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < CMConstants.MAX_GSM_MESSAGE_LENGTH; index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 1);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndGTMAXGSMMESSAGELENGTH() throws Exception {
+
+        // 0338 and length is exactly 161 -> 2 part
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < CMConstants.MAX_GSM_MESSAGE_LENGTH + 1; index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 2);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndLT2MAXGSMMESSAGELENGTH() throws Exception {
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (2 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART - 1); index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 2);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndEQ2MAXGSMMESSAGELENGTH() throws Exception {
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (2 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 2);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndGT2MAXGSMMESSAGELENGTH() throws Exception {
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (2 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 3);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndEQ8MAXGSMMESSAGELENGTH() throws Exception {
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (8 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 8);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testGSM338AndGT8MAXGSMMESSAGELENGTH() throws Exception {
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (8 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
+            message.append("a");
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 8);
+        Assert.isTrue(!cmMessage.isUnicode());
+    }
+
+    /*
+     * Unicode Messages
+     */
+
+    @Test
+    public void testUnicodeAndLTMAXGSMMESSAGELENGTH() throws Exception {
+
+        String ch = "\uF400";
+
+        // 0338 and less than 160 char -> 1 part
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < CMConstants.MAX_UNICODE_MESSAGE_LENGTH; index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 1);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndEQMAXGSMMESSAGELENGTH() throws Exception {
+        // 0338 and length is exactly 160 -> 1 part
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < CMConstants.MAX_UNICODE_MESSAGE_LENGTH; index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 1);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndGTMAXGSMMESSAGELENGTH() throws Exception {
+
+        // 0338 and length is exactly 161 -> 2 part
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < CMConstants.MAX_UNICODE_MESSAGE_LENGTH + 1; index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 2);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndLT2MAXGSMMESSAGELENGTH() throws Exception {
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (2 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART - 1); index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 2);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndEQ2MAXGSMMESSAGELENGTH() throws Exception {
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (2 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 2);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndGT2MAXGSMMESSAGELENGTH() throws Exception {
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (2 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 3);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndEQ8MAXGSMMESSAGELENGTH() throws Exception {
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (8 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 8);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+    @Test
+    public void testUnicodeAndGT8MAXGSMMESSAGELENGTH() throws Exception {
+
+        String ch = "\uF400";
+
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < (8 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
+            message.append(ch);
+        }
+
+        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
+
+        Assert.isTrue(cmMessage.getMultiparts() == 8);
+        Assert.isTrue(cmMessage.isUnicode());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMProxy.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMProxy.java b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMProxy.java
new file mode 100644
index 0000000..45b88bd
--- /dev/null
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMProxy.java
@@ -0,0 +1,26 @@
+/**
+ * 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.cm.test;
+
+import org.apache.camel.component.cm.client.SMSMessage;
+
+/**
+ * Regular interface used to proxy a producer sending to the Route out to CM Direct {@link http://camel.apache.org/using-camelproxy.html}
+ */
+public interface CMProxy {
+    void send(SMSMessage smsMessage);
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
new file mode 100644
index 0000000..e151e5a
--- /dev/null
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
@@ -0,0 +1,375 @@
+/**
+ * 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.cm.test;
+
+import java.math.BigInteger;
+import java.security.SecureRandom;
+
+import com.google.i18n.phonenumbers.PhoneNumberUtil;
+import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
+import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.InvalidPayloadRuntimeException;
+import org.apache.camel.Produce;
+import org.apache.camel.ResolveEndpointFailedException;
+import org.apache.camel.Service;
+import org.apache.camel.component.cm.CMEndpoint;
+import org.apache.camel.component.cm.CMProducer;
+import org.apache.camel.component.cm.client.SMSMessage;
+import org.apache.camel.component.cm.exceptions.HostUnavailableException;
+import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
+import org.apache.camel.component.cm.exceptions.cmresponse.InsufficientBalanceException;
+import org.apache.camel.component.cm.exceptions.cmresponse.InvalidMSISDNException;
+import org.apache.camel.component.cm.exceptions.cmresponse.InvalidProductTokenException;
+import org.apache.camel.component.cm.exceptions.cmresponse.NoAccountFoundForProductTokenException;
+import org.apache.camel.component.cm.exceptions.cmresponse.NoMessageException;
+import org.apache.camel.component.cm.exceptions.cmresponse.NotPhoneNumberFoundException;
+import org.apache.camel.component.cm.exceptions.cmresponse.UnknownErrorException;
+import org.apache.camel.component.cm.exceptions.cmresponse.UnroutableMessageException;
+import org.apache.camel.component.cm.test.mocks.cmsender.CMResponseExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.InsufficientBalanceExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.InvalidMSISDNExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.InvalidProductTokenExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.NoAccountFoundForProductTokenExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.NoMessageExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.NotPhoneNumberFoundExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.UnknownErrorExceptionSender;
+import org.apache.camel.component.cm.test.mocks.cmsender.UnroutableMessageExceptionSender;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.spring.CamelSpringDelegatingTestContextLoader;
+import org.apache.camel.test.spring.CamelSpringJUnit4ClassRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import org.springframework.util.Assert;
+
+@RunWith(CamelSpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {CamelTestConfiguration.class }, loader = CamelSpringDelegatingTestContextLoader.class)
+public class CMTest extends AbstractJUnit4SpringContextTests {
+
+    // dependency: camel-spring-javaconfig
+
+    @Autowired
+    private CamelContext camelContext;
+
+    private SecureRandom random = new SecureRandom();
+
+    private final PhoneNumberUtil pnu = PhoneNumberUtil.getInstance();
+    private String validNumber;
+
+    @Produce(uri = "direct:sms")
+    private CMProxy cmProxy;
+
+    @EndpointInject(uri = "mock:test")
+    private MockEndpoint mock;
+
+    // private StopWatch stopWatch = new StopWatch(getClass().getSimpleName());
+
+    @Before
+    public void beforeTest() throws Exception {
+        mock.reset();
+        camelContext.startRoute(CamelTestConfiguration.SIMPLE_ROUTE_ID);
+        validNumber = pnu.format(pnu.getExampleNumber("ES"), PhoneNumberFormat.E164);
+    }
+
+    @After
+    public void afterTest() {
+
+        try {
+            camelContext.stopRoute(CamelTestConfiguration.SIMPLE_ROUTE_ID);
+        } catch (Exception e) {
+            logger.error("Exception trying to stop de routes", e);
+        }
+
+        // Stop all routes
+        // for (Route route : camelContext.getRoutes()) {
+        // try {
+        // camelContext.stopRoute(route.getId());
+        // } catch (Exception e) {
+        // logger.error("Exception trying to stop de routes", e);
+        // }
+        // }
+    }
+
+    /*
+     * 1. Invalid URI
+     */
+
+    @Test(expected = ResolveEndpointFailedException.class)
+    public void testNotRequiredProductToken() throws Throwable {
+        try {
+            String schemedUri = "cm-sms://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&testConnectionOnStartup=true";
+            camelContext.getEndpoint(schemedUri).start();
+        } catch (Throwable t) {
+            throw t.getCause();
+        }
+
+    }
+
+    @Test(expected = ResolveEndpointFailedException.class)
+    public void testNotRequiredDefaultFrom() throws Throwable {
+        try {
+            String schemedUri = "cm-sms://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&testConnectionOnStartup=true";
+            camelContext.getEndpoint(schemedUri).start();
+        } catch (Throwable t) {
+            throw t.getCause();
+        }
+
+    }
+
+    @Test(expected = HostUnavailableException.class)
+    public void testHostUnavailableException() throws Throwable {
+        // cm-sms://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
+        String schemedUri = "cm-sms://dummy.sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true";
+        Service service = camelContext.getEndpoint(schemedUri).createProducer();
+        service.start();
+    }
+
+    @Test(expected = ResolveEndpointFailedException.class)
+    public void testInvalidHostDuplicateScheme() throws Throwable {
+        // cm-sms://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
+        try {
+            String schemedUri = "cm-sms://https://demo.com";
+            camelContext.getEndpoint(schemedUri);
+        } catch (Throwable t) {
+            throw t.getCause();
+        }
+    }
+
+    @Test(expected = ResolveEndpointFailedException.class)
+    public void testInvalidUriEndpoint() throws Throwable {
+        // cm-sms://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
+        String noHostUri = "cm-sms://gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true";
+        camelContext.getEndpoint(noHostUri);
+    }
+
+    /*
+     * 2. Invalid Payload
+     */
+
+    @Test(expected = RuntimeException.class)
+    public void testNullPayload() throws Throwable {
+        cmProxy.send(null);
+    }
+
+    // @DirtiesContext
+    @Test(expected = NoAccountFoundForProductTokenException.class)
+    public void testAsPartOfARoute() throws Exception {
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateUnicodeMessage(), validNumber, null);
+        cmProxy.send(smsMessage);
+    }
+
+    @Test(expected = NoAccountFoundForProductTokenException.class)
+    public void testNoAccountFoundForProductTokenException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
+        CMProducer producer = endpoint.createProducer();
+        producer.setSender(new NoAccountFoundForProductTokenExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateGSM0338Message(), validNumber, null);
+        send(producer, smsMessage);
+    }
+
+    /*
+     * 3. CM Responses (Faking Exceptions)
+     */
+
+    @Test(expected = CMResponseException.class)
+    public void testCMResponseException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
+        CMProducer producer = endpoint.createProducer();
+        producer.setSender(new CMResponseExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateUnicodeMessage(), validNumber, null);
+        send(producer, smsMessage);
+    }
+
+    @Test(expected = InsufficientBalanceException.class)
+    public void testInsufficientBalanceException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
+        CMProducer producer = endpoint.createProducer();
+        producer.setSender(new InsufficientBalanceExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateGSM0338Message(), validNumber, null);
+        send(producer, smsMessage);
+    }
+
+    @Test(expected = InvalidMSISDNException.class)
+    public void testInvalidMSISDNException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
+        CMProducer producer = endpoint.createProducer();
+        producer.setSender(new InvalidMSISDNExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateUnicodeMessage(), validNumber, null);
+        send(producer, smsMessage);
+    }
+
+    @Test(expected = InvalidProductTokenException.class)
+    public void testInvalidProductTokenException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
+        CMProducer producer = endpoint.createProducer();
+        producer.setSender(new InvalidProductTokenExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateUnicodeMessage(), validNumber, null);
+        send(producer, smsMessage);
+    }
+
+    @Test(expected = NoMessageException.class)
+    public void testNoMessageException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
+        CMProducer producer = endpoint.createProducer();
+        producer.setSender(new NoMessageExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateGSM0338Message(), validNumber, null);
+        send(producer, smsMessage);
+    }
+
+    @Test(expected = NotPhoneNumberFoundException.class)
+    public void testNotPhoneNumberFoundException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
+        CMProducer producer = endpoint.createProducer();
+        producer.setSender(new NotPhoneNumberFoundExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateUnicodeMessage(), validNumber, null);
+        send(producer, smsMessage);
+    }
+
+    @Test(expected = UnknownErrorException.class)
+    public void testUnknownErrorException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
+        CMProducer producer = endpoint.createProducer();
+        producer.setSender(new UnknownErrorExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateGSM0338Message(), validNumber, null);
+        send(producer, smsMessage);
+    }
+
+    @Test(expected = UnroutableMessageException.class)
+    public void testUnroutableMessageException() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
+        CMProducer producer = endpoint.createProducer();
+        producer.setSender(new UnroutableMessageExceptionSender());
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateUnicodeMessage(), validNumber, null);
+        send(producer, smsMessage);
+    }
+
+    @Test(expected = UnsupportedOperationException.class)
+    public void testCMEndpointIsForProducing() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
+        endpoint.createConsumer(null);
+    }
+
+    @Test
+    public void testCMEndpointGetHost() throws Exception {
+
+        // Change sending strategy
+        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
+        Assert.isTrue(endpoint.getHost().equals(applicationContext.getEnvironment().getRequiredProperty("cm.url")));
+    }
+
+    @Test(expected = InvalidPayloadRuntimeException.class)
+    public void testSendInvalidPayload() throws Exception {
+
+        // Body
+        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateGSM0338Message(), null, null);
+        cmProxy.send(smsMessage);
+    }
+
+    /*
+     * CMMessages
+     */
+
+    // @Test(expected = RuntimeException.class)
+    // public void testSkel() throws Exception {
+
+    // mock.expectedMessageCount(1);
+    //
+    // // Body
+    // final SMSMessage smsMessage = new SMSMessage("Hello CM", validNumber);
+    // cmProxy.send(smsMessage);
+    //
+    // mock.assertIsSatisfied();
+    // }
+
+    private String generateUnicodeMessage() {
+        String ch = "\uF400";
+        return generateRandomLengthMessageByChar(ch);
+    }
+
+    private String generateGSM0338Message() {
+        String ch = "a";
+        return generateRandomLengthMessageByChar(ch);
+    }
+
+    private String generateRandomLengthMessageByChar(String ch) {
+        // random Length
+        int msgLength = (int) (Math.random() * 2000);
+        StringBuffer message = new StringBuffer();
+        for (int index = 0; index < msgLength; index++) {
+            message.append(ch);
+        }
+        return message.toString();
+    }
+
+    //
+    private String generateIdAsString() {
+        return new BigInteger(130, random).toString(32);
+    }
+
+    private static void send(CMProducer producer, SMSMessage smsMessage) throws Exception {
+        Exchange exchange = producer.getEndpoint().createExchange();
+        exchange.getIn().setBody(smsMessage);
+        producer.process(exchange);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CamelTestConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CamelTestConfiguration.java b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CamelTestConfiguration.java
new file mode 100644
index 0000000..170ea6d
--- /dev/null
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CamelTestConfiguration.java
@@ -0,0 +1,110 @@
+/**
+ * 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.cm.test;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spring.javaconfig.SingleRouteCamelConfiguration;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.core.env.Environment;
+import org.springframework.util.Assert;
+import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
+
+/**
+ * Builds a SimpleRoute to send a message to CM GW and CM Uri is built based on
+ * properties in a file.
+ */
+@Configuration("cmConfig")
+@PropertySource("classpath:/cm-smsgw.properties")
+public class CamelTestConfiguration extends SingleRouteCamelConfiguration {
+
+    public static final String SIMPLE_ROUTE_ID = "simple-route";
+
+    private String uri;
+
+    @Override
+    public RouteBuilder route() {
+        return new RouteBuilder() {
+
+            @Override
+            public void configure() throws Exception {
+
+                Assert.hasLength(uri);
+
+                log.debug("CM Component is an URI based component\nCM URI: {}", uri);
+
+                // Route definition
+                from("direct:sms").to(uri).to("mock:test")
+                        .routeId(SIMPLE_ROUTE_ID);
+
+            }
+        };
+    }
+
+    @Bean
+    public LocalValidatorFactoryBean getValidatorFactory() {
+        final LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
+        localValidatorFactoryBean.getValidationPropertyMap()
+                .put("hibernate.validator.fail_fast", "true");
+        return localValidatorFactoryBean;
+    }
+
+    /**
+     * Build the URI of the CM Component based on Environmental properties
+     */
+    @Override
+    public final void setApplicationContext(
+            final ApplicationContext applicationContext) {
+
+        super.setApplicationContext(applicationContext);
+
+        final Environment env = applicationContext.getEnvironment();
+
+        final String host = env.getRequiredProperty("cm.url");
+        final String productTokenString = env
+                .getRequiredProperty("cm.product-token");
+        final String sender = env.getRequiredProperty("cm.default-sender");
+
+        final StringBuffer cmUri = new StringBuffer("cm-sms:" + host)
+                .append("?productToken=").append(productTokenString);
+        if (sender != null && !sender.isEmpty()) {
+            cmUri.append("&defaultFrom=").append(sender);
+        }
+
+        // Defaults to false
+        final Boolean testConnectionOnStartup = Boolean.parseBoolean(
+                env.getProperty("cm.testConnectionOnStartup", "false"));
+        if (testConnectionOnStartup) {
+            cmUri.append("&testConnectionOnStartup=")
+                    .append(testConnectionOnStartup.toString());
+        }
+
+        // Defaults to 8
+        final Integer defaultMaxNumberOfParts = Integer
+                .parseInt(env.getProperty("defaultMaxNumberOfParts", "8"));
+        cmUri.append("&defaultMaxNumberOfParts=")
+                .append(defaultMaxNumberOfParts.toString());
+
+        uri = cmUri.toString();
+    }
+
+    public String getUri() {
+        return uri;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java
new file mode 100644
index 0000000..8d653d3
--- /dev/null
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java
@@ -0,0 +1,183 @@
+/**
+ * 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.cm.test;
+
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import com.google.i18n.phonenumbers.PhoneNumberUtil;
+import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
+import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
+import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber.CountryCodeSource;
+import org.apache.camel.component.cm.client.SMSMessage;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.util.Assert;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {ValidatorConfiguration.class })
+// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
+// @DisableJmx(false)
+// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class SMSMessageTest extends AbstractJUnit4SpringContextTests {
+
+    @Autowired
+    private Validator validator;
+
+    private final PhoneNumberUtil pnu = PhoneNumberUtil.getInstance();
+    private String validNumber;
+
+    @Before
+    public void beforeTest() throws Exception {
+
+        validNumber = pnu.format(pnu.getExampleNumber("ES"), PhoneNumberFormat.E164);
+    }
+
+    // @After
+    // public void afterTest() {
+
+    @Test
+    public void testSMSMessageConstructor() throws Throwable {
+
+        // Coverage ;)
+        SMSMessage message = new SMSMessage(null, null);
+        Assert.isNull(message.getMessage());
+        Assert.isNull(message.getPhoneNumber());
+
+        message = new SMSMessage("idAsString", null, null, "MySelf");
+        Assert.isTrue(message.getId().equals("idAsString"));
+        Assert.isTrue(message.getFrom().equals("MySelf"));
+    }
+
+    @Test
+    public void testNullMessageField() throws Exception {
+
+        final SMSMessage m = new SMSMessage(null, validNumber);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testNullPhoneNumber() throws Exception {
+
+        final SMSMessage m = new SMSMessage("Hello world!", null);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testDynamicFromFieldMaxLength() throws Exception {
+
+        String dynamicFrom = "messagelengthgreaterthan12";
+
+        final SMSMessage m = new SMSMessage("idAsString", "Hello World", validNumber, dynamicFrom);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testDynamicFromFieldZeroLength() throws Exception {
+
+        String zeroLengthDynamicFrom = "";
+
+        final SMSMessage m = new SMSMessage("idAsString", "Hello World", validNumber, zeroLengthDynamicFrom);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testIdAsStringMaxLength() throws Exception {
+
+        String idAsString = "thisistheidastringlengthgreaterthan32";
+
+        final SMSMessage m = new SMSMessage(idAsString, "Hello World", validNumber, "MySelf");
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testIdAsStringFieldZeroLength() throws Exception {
+
+        String zeroLengthIdAsString = "";
+
+        final SMSMessage m = new SMSMessage(zeroLengthIdAsString, "Hello World", validNumber, "MySelf");
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testE164NullNumberIsInValid() throws Exception {
+
+        final String phoneNumber = null;
+        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testE164IsValid() throws Exception {
+
+        final SMSMessage m = new SMSMessage("Hello world!", validNumber);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(0 == constraintViolations.size());
+    }
+
+    @Test
+    public void testE164NoPlusSignedNumberIsInvalid() throws Exception {
+
+        final String phoneNumber = "34600000000";
+        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testE164NoPlusSignedNumberBut00IsInvalid() throws Exception {
+
+        final String phoneNumber = new PhoneNumber().setCountryCodeSource(CountryCodeSource.FROM_NUMBER_WITHOUT_PLUS_SIGN).setNationalNumber(0034600000000).toString();
+        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+
+    @Test
+    public void testE164NumberWithPlusSignIsInvalid() throws Exception {
+
+        final String phoneNumber = "+34 600 00 00 00";
+        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
+
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
+        Assert.isTrue(1 == constraintViolations.size());
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/ValidatorConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/ValidatorConfiguration.java b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/ValidatorConfiguration.java
new file mode 100644
index 0000000..9e8779e
--- /dev/null
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/ValidatorConfiguration.java
@@ -0,0 +1,35 @@
+/**
+ * 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.cm.test;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
+
+/**
+ * Builds a SimpleRoute to send a message to CM GW and CM Uri is built based on properties in a file.
+ */
+@Configuration("smsConfig")
+public class ValidatorConfiguration {
+
+    @Bean
+    public LocalValidatorFactoryBean getValidatorFactory() {
+        final LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
+        localValidatorFactoryBean.getValidationPropertyMap().put("hibernate.validator.fail_fast", "true");
+        return localValidatorFactoryBean;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/CMResponseExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/CMResponseExceptionSender.java b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/CMResponseExceptionSender.java
new file mode 100644
index 0000000..fe23ae9
--- /dev/null
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/CMResponseExceptionSender.java
@@ -0,0 +1,30 @@
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
+
+public class CMResponseExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage)  {
+        throw new CMResponseException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InsufficientBalanceExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InsufficientBalanceExceptionSender.java b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InsufficientBalanceExceptionSender.java
new file mode 100644
index 0000000..413df91
--- /dev/null
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InsufficientBalanceExceptionSender.java
@@ -0,0 +1,30 @@
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.cmresponse.InsufficientBalanceException;
+
+public class InsufficientBalanceExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage) {
+        throw new InsufficientBalanceException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidMSISDNExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidMSISDNExceptionSender.java b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidMSISDNExceptionSender.java
new file mode 100644
index 0000000..09107d5
--- /dev/null
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidMSISDNExceptionSender.java
@@ -0,0 +1,30 @@
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.cmresponse.InvalidMSISDNException;
+
+public class InvalidMSISDNExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage)  {
+        throw new InvalidMSISDNException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidProductTokenExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidProductTokenExceptionSender.java b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidProductTokenExceptionSender.java
new file mode 100644
index 0000000..102cbf4
--- /dev/null
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidProductTokenExceptionSender.java
@@ -0,0 +1,30 @@
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.cmresponse.InvalidProductTokenException;
+
+public class InvalidProductTokenExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage)  {
+        throw new InvalidProductTokenException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoAccountFoundForProductTokenExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoAccountFoundForProductTokenExceptionSender.java b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoAccountFoundForProductTokenExceptionSender.java
new file mode 100644
index 0000000..7fb4c2b
--- /dev/null
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoAccountFoundForProductTokenExceptionSender.java
@@ -0,0 +1,30 @@
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.cmresponse.NoAccountFoundForProductTokenException;
+
+public class NoAccountFoundForProductTokenExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage)  {
+        throw new NoAccountFoundForProductTokenException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoMessageExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoMessageExceptionSender.java b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoMessageExceptionSender.java
new file mode 100644
index 0000000..6e27dcf
--- /dev/null
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoMessageExceptionSender.java
@@ -0,0 +1,30 @@
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.cmresponse.NoMessageException;
+
+public class NoMessageExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage) {
+        throw new NoMessageException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NotPhoneNumberFoundExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NotPhoneNumberFoundExceptionSender.java b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NotPhoneNumberFoundExceptionSender.java
new file mode 100644
index 0000000..162ef38
--- /dev/null
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NotPhoneNumberFoundExceptionSender.java
@@ -0,0 +1,30 @@
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.cmresponse.NotPhoneNumberFoundException;
+
+public class NotPhoneNumberFoundExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage)  {
+        throw new NotPhoneNumberFoundException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnknownErrorExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnknownErrorExceptionSender.java b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnknownErrorExceptionSender.java
new file mode 100644
index 0000000..33e4565
--- /dev/null
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnknownErrorExceptionSender.java
@@ -0,0 +1,30 @@
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.cmresponse.UnknownErrorException;
+
+public class UnknownErrorExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage) {
+        throw new UnknownErrorException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnroutableMessageExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnroutableMessageExceptionSender.java b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnroutableMessageExceptionSender.java
new file mode 100644
index 0000000..3657ac7
--- /dev/null
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnroutableMessageExceptionSender.java
@@ -0,0 +1,30 @@
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.cmresponse.UnroutableMessageException;
+
+public class UnroutableMessageExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage)  {
+        throw new UnroutableMessageException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm-sms/src/test/resources/cm-smsgw.properties
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/test/resources/cm-smsgw.properties b/components/camel-cm-sms/src/test/resources/cm-smsgw.properties
new file mode 100644
index 0000000..9393fa9
--- /dev/null
+++ b/components/camel-cm-sms/src/test/resources/cm-smsgw.properties
@@ -0,0 +1,28 @@
+#
+# 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.
+#
+
+# DefaultSender
+cm.default-sender=MyBusiness
+
+# CM URL
+# https://dashboard.onlinesmsgateway.com/docs#send-a-message-send-a-message
+cm.url=sgw01.cm.nl/gateway.ashx
+
+# UUID as STRING
+cm.product-token=ea723fd7-da81-4826-89bc-fa7144e71c40
+
+cm.testConnectionOnStartup=true
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/README.md
----------------------------------------------------------------------
diff --git a/components/camel-cm/README.md b/components/camel-cm/README.md
deleted file mode 100644
index 63f9059..0000000
--- a/components/camel-cm/README.md
+++ /dev/null
@@ -1,32 +0,0 @@
-# camel-cm
-
-[Camel component](http://camel.apache.org/components.html) for the [CM SMS Gateway](https://www.cmtelecom.com). 
-
-It allows to integrate [CM SMS API](https://dashboard.onlinesmsgateway.com/docs) in an application as a camel component. 
-
-You must have a valid account.  More information are available at [CM Telecom](https://www.cmtelecom.com/support).
-
-### URI Format
-
-```
-cm://sgw01.cm.nl/gateway.ashx?defaultFrom=DefaultSender&defaultMaxNumberOfParts=8&productToken=2fb82162-754c-4c1b-806d-9cb7efd677f4
-```
-
-
-### Endpoint Options
-
-CM endpoints act like a **producer** and support the following options.
-
-| Name  | Default Value | Description |
-| ------------- | ------------- | ------------- |
-| productToken  |*none* |**Required**. UUID as String. This is the product token that was sent to you by email. Example: 'de7c7df3-81ca-4d1e-863d-95a252120321'|
-| defaultFrom  | *none* |**Required**. This is the default sender name, to be included in each SMSMessage instance not providing one. The maximum length is 11 characters.|
-| defaultMaxNumberOfParts  | 8 | If it is a [multipart message](https://dashboard.onlinesmsgateway.com/docs#send-a-message-multipart) forces the max number of parts to be sent. <p>The gateway will first check if a message is larger than 160 characters, if so, the message will be cut into multiple 153 characters parts limited by these parameters whether the message is [GSM 0038 encodeable](https://en.wikipedia.org/wiki/GSM_03.38). <p>Otherwise, The gateway will check if a message is larger than 70 characters, if so, the message will be cut into multiple 67 characters parts to a maximum of this parameter.|
-| testConnectionOnStartup | false | This ensures that Camel is not started with failed connections cause an exception is thrown on startup. | 
-
-### Tests
-
-Tests provided so far show a valid [Spring Configuration](https://github.com/oalles/camel-cm/blob/master/src/test/java/org/apache/camel/component/cm/test/TestConfiguration.java). Notice that CM Component URI is built from properties in a [file](https://github.com/oalles/camel-cm/blob/master/src/test/resources/cm-smsgw.properties). 
-
-### Sample of Usage
-You can try [this project](https://github.com/oalles/camel-cm-sample) to see how camel-cm can be integrated in a camel route. 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-cm/pom.xml b/components/camel-cm/pom.xml
deleted file mode 100644
index 9d010f4..0000000
--- a/components/camel-cm/pom.xml
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- 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. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-	
-	<parent>
-		<groupId>org.apache.camel</groupId>
-		<artifactId>components</artifactId>
-		<version>2.18-SNAPSHOT</version>
-	</parent>
-	
-	<artifactId>camel-cm</artifactId>
-	<packaging>bundle</packaging>
-	
-	<name>Camel :: CM</name>
-	<description>Camel CM Component</description>
-
-	<properties>
-		<camel.osgi.export.pkg>org.apache.camel.component.cm.*</camel.osgi.export.pkg>
-		<camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=cm</camel.osgi.export.service>
-		<httpclient>${httpclient4-version}</httpclient>
-		<jsoup-version>1.8.3</jsoup-version>
-		<libphonenumber-version>7.2.7</libphonenumber-version>
-		<commons-validator-version>1.5.0</commons-validator-version>
-	</properties>
-
-	<dependencies>
-
-		<dependency>
-			<groupId>org.apache.camel</groupId>
-			<artifactId>camel-core</artifactId>
-		</dependency>
-
-		<dependency>
-			<groupId>com.googlecode.libphonenumber</groupId>
-			<artifactId>libphonenumber</artifactId>
-			<version>${libphonenumber-version}</version>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.httpcomponents</groupId>
-			<artifactId>httpclient-osgi</artifactId>
-			<version>${httpclient}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.jsoup</groupId>
-			<artifactId>jsoup</artifactId>
-			<version>${jsoup-version}</version>
-		</dependency>
-
-		<dependency>
-			<groupId>javax.validation</groupId>
-			<artifactId>validation-api</artifactId>
-			<version>${validation-api-version}</version>
-		</dependency>
-		<dependency>
-			<groupId>javax.el</groupId>
-			<artifactId>javax.el-api</artifactId>
-			<version>${javax.el-api-version}</version>
-		</dependency>
-		<dependency>
-			<groupId>commons-validator</groupId>
-			<artifactId>commons-validator</artifactId>
-			<version>${commons-validator-version}</version>
-		</dependency>
-
-		<!-- test dependencies -->
-		<dependency>
-			<groupId>org.apache.camel</groupId>
-			<artifactId>camel-test-spring</artifactId>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.camel</groupId>
-			<artifactId>camel-spring-javaconfig</artifactId>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.slf4j</groupId>
-			<artifactId>slf4j-log4j12</artifactId>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.hibernate</groupId>
-			<artifactId>hibernate-validator</artifactId>
-			<version>${hibernate-validator-version}</version>
-			<scope>test</scope>
-		</dependency>
-	</dependencies>
-</project>


[12/23] camel git commit: TODO: GSM 0338 pattern needs to be checked. It is used as an alternative for jcharset cause it is a gpl library and cannot be used.

Posted by da...@apache.org.
TODO: GSM 0338 pattern needs to be checked. It is used as an alternative
for jcharset cause it is a gpl library and cannot be used. 



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

Branch: refs/heads/master
Commit: 5e87c96cda830cb73c5910d79092beabee9e6aa5
Parents: 4f8c9c9
Author: oalles <oa...@neivi.es>
Authored: Mon Mar 21 13:59:31 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 23 18:46:10 2016 +0100

----------------------------------------------------------------------
 .../apache/camel/component/cm/CMConstants.java  | 82 ++++++++++----------
 .../org/apache/camel/component/cm/CMUtils.java  | 60 +++++++-------
 2 files changed, 73 insertions(+), 69 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/5e87c96c/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConstants.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConstants.java
index ad8bfc4..138f75f 100644
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConstants.java
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConstants.java
@@ -1,39 +1,43 @@
-/**
- * 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.cm;
-
-public interface CMConstants {
-
-    String DEFAULT_SCHEME = "https://";
-
-    int DEFAULT_MULTIPARTS = 8;
-
-    int MAX_UNICODE_MESSAGE_LENGTH = 70;
-    int MAX_GSM_MESSAGE_LENGTH = 160;
-    int MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART = 67;
-    int MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART = 153;
-
-    // status code 200 - Error substrings - checkk it contains.
-    String ERROR_UNKNOWN = "Unknown error";
-    String ERROR_NO_ACCOUNT = "No account found";
-    String ERROR_INSUFICIENT_BALANCE = "Insufficient balance";
-    String ERROR_UNROUTABLE_MESSAGE = "Message is unroutable";
-    String ERROR_INVALID_PRODUCT_TOKEN = "Invalid product token";
-
-    String GSM_CHARACTERS_REGEX = "^[A-Za-z0-9 \\r\\n@£$¥èéùìòÇØøÅå\u0394_\u03A6\u0393\u039B\u03A9"
-                                  + "\u03A0\u03A8\u03A3\u0398\u039EÆæßÉ!\"#$%&amp;'()*+,\\-./:;&lt;=&gt;?¡ÄÖÑܧ¿äöñüà^{}\\\\\\[~\\]|\u20AC]*$";
-}
+/**
+ * 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.cm;
+
+public interface CMConstants {
+
+    String DEFAULT_SCHEME = "https://";
+
+    int DEFAULT_MULTIPARTS = 8;
+
+    int MAX_UNICODE_MESSAGE_LENGTH = 70;
+    int MAX_GSM_MESSAGE_LENGTH = 160;
+    int MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART = 67;
+    int MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART = 153;
+
+    // status code 200 - Error substrings - check it contains.
+    String ERROR_UNKNOWN = "Unknown error";
+    String ERROR_NO_ACCOUNT = "No account found";
+    String ERROR_INSUFICIENT_BALANCE = "Insufficient balance";
+    String ERROR_UNROUTABLE_MESSAGE = "Message is unroutable";
+    String ERROR_INVALID_PRODUCT_TOKEN = "Invalid product token";
+
+    // TODO: Review this pattern.
+    // or it should be foundnd an alternative to jcharset to check if a message is GSM 03.38 encodable
+    // See:
+    // https://en.wikipedia.org/wiki/GSM_03.38
+    // http://frightanic.com/software-development/regex-for-gsm-03-38-7bit-character-set/
+    String GSM_0338_REGEX = "^[A-Za-z0-9 \\r\\n@£$¥èéùìòÇØøÅå\u0394_\u03A6\u0393\u039B\u03A9\u03A0\u03A8\u03A3\u0398\u039EÆæßÉ!\"#$%&amp;'()*+,\\-./:;&lt;=&gt;?¡ÄÖÑܧ¿äöñüà^{}\\\\\\[~\\]|\u20AC]*$";
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/5e87c96c/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMUtils.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMUtils.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMUtils.java
index 932e99f..f0581da 100644
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMUtils.java
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMUtils.java
@@ -1,30 +1,30 @@
-/**
- * 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.cm;
-
-public final class CMUtils {
-
-    private CMUtils() {
-    }
-
-    public static boolean isGsm0338Encodeable(final String message) {
-        return message.matches(CMConstants.GSM_CHARACTERS_REGEX);
-    }
-
-    // TODO: Have a look at
-    // https:// github.com/apache/camel/blob/master/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java
-}
+/**
+ * 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.cm;
+
+public final class CMUtils {
+
+    private CMUtils() {
+    }
+
+    public static boolean isGsm0338Encodeable(final String message) {
+        return message.matches(CMConstants.GSM_0338_REGEX);
+    }
+
+    // TODO: Have a look at
+    // https:// github.com/apache/camel/blob/master/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java
+}


[05/23] camel git commit: camel-cm component added following the steps in http://camel.apache.org/add-new-component-guide.html

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/platforms/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index 8eebef6..6e19906 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -289,6 +289,16 @@
     <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.chunk-templates/${chunk-templates-bundle-version}</bundle>
     <bundle>mvn:org.apache.camel/camel-chunk/${project.version}</bundle>
   </feature>
+  <feature name='camel-cm' version='${project.version}' resolver='(obr)' start-level='50'>
+    <feature version='${project.version}'>camel-core</feature>
+    <feature version='${cxf-version-range}'>cxf-specs</feature>
+	<bundle dependency='true'>mvn:org.apache.httpcomponents/httpclient-osgi/${httpclient4-version}</bundle>
+	<bundle dependency='true'>mvn:org.jsoup/jsoup/${jsoup-version}</bundle>
+	<bundle dependency='true'>mvn:javax.validation/validation-api/${validation-api-version}</bundle>
+	<bundle dependency='true'>mvn:javax.el/javax.el-api/${javax.el-api-version}</bundle>
+	<bundle dependency='true'>mvn:commons-validator/commons-validator/${commons-validator-version}</bundle>
+    <bundle>mvn:org.apache.camel/camel-cm/${project.version}</bundle>
+  </feature>
   <feature name='camel-cmis' version='${project.version}' resolver='(obr)' start-level='50'>
     <feature version='${project.version}'>camel-core</feature>
     <feature version='${cxf-version-range}'>cxf-specs</feature>


[13/23] camel git commit: Refactoring Exception Hierarchy. MessagingException is being removed.

Posted by da...@apache.org.
Refactoring Exception Hierarchy. 
MessagingException is being removed.



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

Branch: refs/heads/master
Commit: 87fb63ee183759818914e3fa4a0741800abf48c1
Parents: 5537bb5
Author: oalles <oa...@neivi.es>
Authored: Tue Mar 22 13:32:55 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 23 18:46:10 2016 +0100

----------------------------------------------------------------------
 .../apache/camel/component/cm/CMProducer.java   | 38 ++++-----
 .../org/apache/camel/component/cm/CMSender.java | 58 +++++++-------
 .../component/cm/CMSenderOneMessageImpl.java    | 13 ++--
 .../cm/exceptions/HostUnavailableException.java | 79 ++++++++++---------
 .../cm/exceptions/MessagingException.java       | 40 ----------
 .../cm/exceptions/XMLConstructionException.java | 78 +++++++++----------
 .../cmresponse/CMResponseException.java         | 82 ++++++++++----------
 .../cmsender/CMResponseExceptionSender.java     | 61 +++++++--------
 .../InsufficientBalanceExceptionSender.java     | 61 +++++++--------
 .../cmsender/InvalidMSISDNExceptionSender.java  | 61 +++++++--------
 .../InvalidProductTokenExceptionSender.java     | 61 +++++++--------
 ...ountFoundForProductTokenExceptionSender.java | 61 +++++++--------
 .../cmsender/NoMessageExceptionSender.java      | 61 +++++++--------
 .../NotPhoneNumberFoundExceptionSender.java     | 61 +++++++--------
 .../cmsender/UnknownErrorExceptionSender.java   | 61 +++++++--------
 .../UnroutableMessageExceptionSender.java       | 61 +++++++--------
 16 files changed, 436 insertions(+), 501 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/87fb63ee/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java
index b3003cb..e4f5722 100644
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java
@@ -47,32 +47,26 @@ public class CMProducer extends DefaultProducer {
     }
 
     /**
-     * Producer is a exchange processor. This process is built in several steps.
-     * 1. Validate message receive from client 2. Send validated message to CM
-     * endpoints. 3. Process response from CM endpoints.
+     * Producer is a exchange processor. This process is built in several steps. 1. Validate message receive from client 2. Send validated message to CM endpoints. 3. Process response from CM
+     * endpoints.
      */
     @Override
     public void process(final Exchange exchange) throws Exception {
 
         // Immutable message receive from clients. Throws camel ' s
         // InvalidPayloadException
-        final SMSMessage smsMessage = exchange.getIn()
-                .getMandatoryBody(SMSMessage.class);
+        final SMSMessage smsMessage = exchange.getIn().getMandatoryBody(SMSMessage.class);
 
         // Validates Payload - SMSMessage
-        log.trace("Validating SMSMessage instance provided: {}",
-                smsMessage.toString());
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = getValidator()
-                .validate(smsMessage);
+        log.trace("Validating SMSMessage instance provided: {}", smsMessage.toString());
+        final Set<ConstraintViolation<SMSMessage>> constraintViolations = getValidator().validate(smsMessage);
         if (constraintViolations.size() > 0) {
             final StringBuffer msg = new StringBuffer();
             for (final ConstraintViolation<SMSMessage> cv : constraintViolations) {
-                msg.append(String.format("- Invalid value for %s: %s",
-                        cv.getPropertyPath().toString(), cv.getMessage()));
+                msg.append(String.format("- Invalid value for %s: %s", cv.getPropertyPath().toString(), cv.getMessage()));
             }
             log.debug(msg.toString());
-            throw new InvalidPayloadRuntimeException(exchange,
-                    SMSMessage.class);
+            throw new InvalidPayloadRuntimeException(exchange, SMSMessage.class);
         }
         log.trace("SMSMessage instance is valid: {}", smsMessage.toString());
 
@@ -80,26 +74,23 @@ public class CMProducer extends DefaultProducer {
         // CMMessage
         // This is the instance we will use to build the XML document to be
         // sent to CM SMS GW.
-        final CMMessage cmMessage = new CMMessage(smsMessage.getPhoneNumber(),
-                smsMessage.getMessage());
+        final CMMessage cmMessage = new CMMessage(smsMessage.getPhoneNumber(), smsMessage.getMessage());
         log.debug("CMMessage instance build from valid SMSMessage instance");
 
         if (smsMessage.getFrom() == null || smsMessage.getFrom().isEmpty()) {
             String df = getConfiguration().getDefaultFrom();
             cmMessage.setSender(df);
-            log.debug("Dynamic sender is set to default dynamic sender: {}",
-                    df);
+            log.debug("Dynamic sender is set to default dynamic sender: {}", df);
         }
 
         // Remember, this can be null.
         cmMessage.setIdAsString(smsMessage.getId());
 
         // Unicode and multipart
-        cmMessage.setUnicodeAndMultipart(
-                getConfiguration().getDefaultMaxNumberOfParts());
+        cmMessage.setUnicodeAndMultipart(getConfiguration().getDefaultMaxNumberOfParts());
 
         // 2. Send a validated sms message to CM endpoints
-        // throws MessagingException for abnormal situations.
+        //  for abnormal situations.
         sender.send(cmMessage);
 
         log.debug("Request accepted by CM Host: {}", cmMessage.toString());
@@ -118,13 +109,10 @@ public class CMProducer extends DefaultProducer {
         if (configuration.isTestConnectionOnStartup()) {
             try {
                 log.debug("Checking connection - {}", getEndpoint().getCMUrl());
-                HttpClientBuilder.create().build()
-                        .execute(new HttpHead(getEndpoint().getCMUrl()));
+                HttpClientBuilder.create().build().execute(new HttpHead(getEndpoint().getCMUrl()));
                 log.debug("Connection to {}: OK", getEndpoint().getCMUrl());
             } catch (final Exception e) {
-                log.debug("Connection to {}: NOT AVAILABLE",
-                        getEndpoint().getCMUrl());
-                throw new HostUnavailableException(e);
+                throw new HostUnavailableException(String.format("Connection to %s: NOT AVAILABLE", getEndpoint().getCMUrl()), e);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/87fb63ee/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSender.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSender.java
index d3eceeb..661f4dd 100644
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSender.java
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSender.java
@@ -1,30 +1,28 @@
-/**
- * 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.cm;
-
-import org.apache.camel.component.cm.exceptions.MessagingException;
-
-/**
- * Sends a validated sms message to CM endpoints
- */
-public interface CMSender {
-
-    /**
-     * Sends a validated sms message to CM Endpoints.
-     */
-    void send(CMMessage cmMessage) throws MessagingException;
-}
+/**
+ * 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.cm;
+
+/**
+ * Sends a validated sms message to CM endpoints
+ */
+public interface CMSender {
+
+    /**
+     * Sends a validated sms message to CM Endpoints.
+     */
+    void send(CMMessage cmMessage);
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/87fb63ee/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
index 101905e..07e0e14 100644
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
@@ -41,7 +41,6 @@ import org.w3c.dom.Element;
 import org.w3c.dom.Text;
 
 import org.apache.camel.component.cm.exceptions.CMDirectException;
-import org.apache.camel.component.cm.exceptions.MessagingException;
 import org.apache.camel.component.cm.exceptions.XMLConstructionException;
 import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
 import org.apache.camel.component.cm.exceptions.cmresponse.InsufficientBalanceException;
@@ -71,17 +70,17 @@ public class CMSenderOneMessageImpl implements CMSender {
     }
 
     /**
-     * Sends a previously validated SMSMessage to CM endpoint
+     * Sends a message to CM endpoints. 1. CMMessage instance is going to be marshalled to xml. 2. Post request xml string to CMEndpoint.
      */
     @Override
-    public void send(final CMMessage cmMessage) throws MessagingException {
+    public void send(final CMMessage cmMessage) {
 
         // See: Check https://dashboard.onlinesmsgateway.com/docs for responses
 
         // 1.Construct XML. Throws XMLConstructionException
         final String xml = createXml(cmMessage);
 
-        // 2. Try to send to CM SMS Provider ...Throws CMResponse
+        // 2. Try to send to CM SMS Provider ...Throws CMResponseException
         doHttpPost(url, xml);
     }
 
@@ -245,11 +244,11 @@ public class CMSenderOneMessageImpl implements CMSender {
         } catch (final IOException io) {
             throw new CMDirectException(io);
         } catch (Throwable t) {
-            if (!(t instanceof MessagingException)) {
+            if (!(t instanceof CMDirectException)) {
                 // Chain it
-                t = new MessagingException(t);
+                t = new CMDirectException(t);
             }
-            throw (MessagingException) t;
+            throw (CMDirectException) t;
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/87fb63ee/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/HostUnavailableException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/HostUnavailableException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/HostUnavailableException.java
index 4e1348c..73bf0d0 100644
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/HostUnavailableException.java
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/HostUnavailableException.java
@@ -1,40 +1,39 @@
-/**
- * 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.cm.exceptions;
-
-public class HostUnavailableException extends MessagingException {
-
-    public HostUnavailableException() {
-    }
-
-    public HostUnavailableException(final String message) {
-        super(message);
-    }
-
-    public HostUnavailableException(final Throwable cause) {
-        super(cause);
-    }
-
-    public HostUnavailableException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-    public HostUnavailableException(final String message, final Throwable cause,
-            final boolean enableSuppression, final boolean writableStackTrace) {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-}
+/**
+ * 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.cm.exceptions;
+
+public class HostUnavailableException extends CMDirectException {
+
+    public HostUnavailableException() {
+    }
+
+    public HostUnavailableException(final String message) {
+        super(message);
+    }
+
+    public HostUnavailableException(final Throwable cause) {
+        super(cause);
+    }
+
+    public HostUnavailableException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public HostUnavailableException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/87fb63ee/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/MessagingException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/MessagingException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/MessagingException.java
deleted file mode 100644
index ddf9c87..0000000
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/MessagingException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.cm.exceptions;
-
-public class MessagingException extends CMDirectException {
-
-    public MessagingException() {
-    }
-
-    public MessagingException(final String message) {
-        super(message);
-    }
-
-    public MessagingException(final Throwable cause) {
-        super(cause);
-    }
-
-    public MessagingException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-    public MessagingException(final String message, final Throwable cause,
-            final boolean enableSuppression, final boolean writableStackTrace) {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/87fb63ee/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/XMLConstructionException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/XMLConstructionException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/XMLConstructionException.java
index a6dae02..5086e70 100644
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/XMLConstructionException.java
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/XMLConstructionException.java
@@ -1,39 +1,39 @@
-/**
- * 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.cm.exceptions;
-
-public class XMLConstructionException extends MessagingException {
-
-    public XMLConstructionException() {
-    }
-
-    public XMLConstructionException(final String message) {
-        super(message);
-    }
-
-    public XMLConstructionException(final Throwable cause) {
-        super(cause);
-    }
-
-    public XMLConstructionException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-    public XMLConstructionException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-}
+/**
+ * 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.cm.exceptions;
+
+public class XMLConstructionException extends CMDirectException {
+
+    public XMLConstructionException() {
+    }
+
+    public XMLConstructionException(final String message) {
+        super(message);
+    }
+
+    public XMLConstructionException(final Throwable cause) {
+        super(cause);
+    }
+
+    public XMLConstructionException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public XMLConstructionException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/87fb63ee/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/CMResponseException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/CMResponseException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/CMResponseException.java
index 7251c51..4ed4f6e 100644
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/CMResponseException.java
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/CMResponseException.java
@@ -1,41 +1,41 @@
-/**
- * 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.cm.exceptions.cmresponse;
-
-import org.apache.camel.component.cm.exceptions.MessagingException;
-
-public class CMResponseException extends MessagingException {
-
-    public CMResponseException() {
-    }
-
-    public CMResponseException(final String message) {
-        super(message);
-    }
-
-    public CMResponseException(final Throwable cause) {
-        super(cause);
-    }
-
-    public CMResponseException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-    public CMResponseException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-}
+/**
+ * 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.cm.exceptions.cmresponse;
+
+import org.apache.camel.component.cm.exceptions.CMDirectException;
+
+public class CMResponseException extends CMDirectException {
+
+    public CMResponseException() {
+    }
+
+    public CMResponseException(final String message) {
+        super(message);
+    }
+
+    public CMResponseException(final Throwable cause) {
+        super(cause);
+    }
+
+    public CMResponseException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public CMResponseException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/87fb63ee/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/CMResponseExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/CMResponseExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/CMResponseExceptionSender.java
index f116f28..fe23ae9 100644
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/CMResponseExceptionSender.java
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/CMResponseExceptionSender.java
@@ -1,31 +1,30 @@
-/**
- * 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.cm.test.mocks.cmsender;
-
-import org.apache.camel.component.cm.CMMessage;
-import org.apache.camel.component.cm.CMSender;
-import org.apache.camel.component.cm.exceptions.MessagingException;
-import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
-
-public class CMResponseExceptionSender implements CMSender {
-
-    @Override
-    public void send(CMMessage cmMessage) throws MessagingException {
-        throw new CMResponseException();
-    }
-
-}
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
+
+public class CMResponseExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage)  {
+        throw new CMResponseException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/87fb63ee/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InsufficientBalanceExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InsufficientBalanceExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InsufficientBalanceExceptionSender.java
index 03f940d..413df91 100644
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InsufficientBalanceExceptionSender.java
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InsufficientBalanceExceptionSender.java
@@ -1,31 +1,30 @@
-/**
- * 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.cm.test.mocks.cmsender;
-
-import org.apache.camel.component.cm.CMMessage;
-import org.apache.camel.component.cm.CMSender;
-import org.apache.camel.component.cm.exceptions.MessagingException;
-import org.apache.camel.component.cm.exceptions.cmresponse.InsufficientBalanceException;
-
-public class InsufficientBalanceExceptionSender implements CMSender {
-
-    @Override
-    public void send(CMMessage cmMessage) throws MessagingException {
-        throw new InsufficientBalanceException();
-    }
-
-}
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.cmresponse.InsufficientBalanceException;
+
+public class InsufficientBalanceExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage) {
+        throw new InsufficientBalanceException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/87fb63ee/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidMSISDNExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidMSISDNExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidMSISDNExceptionSender.java
index b45d113..09107d5 100644
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidMSISDNExceptionSender.java
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidMSISDNExceptionSender.java
@@ -1,31 +1,30 @@
-/**
- * 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.cm.test.mocks.cmsender;
-
-import org.apache.camel.component.cm.CMMessage;
-import org.apache.camel.component.cm.CMSender;
-import org.apache.camel.component.cm.exceptions.MessagingException;
-import org.apache.camel.component.cm.exceptions.cmresponse.InvalidMSISDNException;
-
-public class InvalidMSISDNExceptionSender implements CMSender {
-
-    @Override
-    public void send(CMMessage cmMessage) throws MessagingException {
-        throw new InvalidMSISDNException();
-    }
-
-}
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.cmresponse.InvalidMSISDNException;
+
+public class InvalidMSISDNExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage)  {
+        throw new InvalidMSISDNException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/87fb63ee/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidProductTokenExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidProductTokenExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidProductTokenExceptionSender.java
index 7ff256c..102cbf4 100644
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidProductTokenExceptionSender.java
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidProductTokenExceptionSender.java
@@ -1,31 +1,30 @@
-/**
- * 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.cm.test.mocks.cmsender;
-
-import org.apache.camel.component.cm.CMMessage;
-import org.apache.camel.component.cm.CMSender;
-import org.apache.camel.component.cm.exceptions.MessagingException;
-import org.apache.camel.component.cm.exceptions.cmresponse.InvalidProductTokenException;
-
-public class InvalidProductTokenExceptionSender implements CMSender {
-
-    @Override
-    public void send(CMMessage cmMessage) throws MessagingException {
-        throw new InvalidProductTokenException();
-    }
-
-}
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.cmresponse.InvalidProductTokenException;
+
+public class InvalidProductTokenExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage)  {
+        throw new InvalidProductTokenException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/87fb63ee/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoAccountFoundForProductTokenExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoAccountFoundForProductTokenExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoAccountFoundForProductTokenExceptionSender.java
index 8b57406..7fb4c2b 100644
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoAccountFoundForProductTokenExceptionSender.java
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoAccountFoundForProductTokenExceptionSender.java
@@ -1,31 +1,30 @@
-/**
- * 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.cm.test.mocks.cmsender;
-
-import org.apache.camel.component.cm.CMMessage;
-import org.apache.camel.component.cm.CMSender;
-import org.apache.camel.component.cm.exceptions.MessagingException;
-import org.apache.camel.component.cm.exceptions.cmresponse.NoAccountFoundForProductTokenException;
-
-public class NoAccountFoundForProductTokenExceptionSender implements CMSender {
-
-    @Override
-    public void send(CMMessage cmMessage) throws MessagingException {
-        throw new NoAccountFoundForProductTokenException();
-    }
-
-}
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.cmresponse.NoAccountFoundForProductTokenException;
+
+public class NoAccountFoundForProductTokenExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage)  {
+        throw new NoAccountFoundForProductTokenException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/87fb63ee/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoMessageExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoMessageExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoMessageExceptionSender.java
index 9520934..6e27dcf 100644
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoMessageExceptionSender.java
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoMessageExceptionSender.java
@@ -1,31 +1,30 @@
-/**
- * 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.cm.test.mocks.cmsender;
-
-import org.apache.camel.component.cm.CMMessage;
-import org.apache.camel.component.cm.CMSender;
-import org.apache.camel.component.cm.exceptions.MessagingException;
-import org.apache.camel.component.cm.exceptions.cmresponse.NoMessageException;
-
-public class NoMessageExceptionSender implements CMSender {
-
-    @Override
-    public void send(CMMessage cmMessage) throws MessagingException {
-        throw new NoMessageException();
-    }
-
-}
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.cmresponse.NoMessageException;
+
+public class NoMessageExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage) {
+        throw new NoMessageException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/87fb63ee/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NotPhoneNumberFoundExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NotPhoneNumberFoundExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NotPhoneNumberFoundExceptionSender.java
index a85639b..162ef38 100644
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NotPhoneNumberFoundExceptionSender.java
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NotPhoneNumberFoundExceptionSender.java
@@ -1,31 +1,30 @@
-/**
- * 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.cm.test.mocks.cmsender;
-
-import org.apache.camel.component.cm.CMMessage;
-import org.apache.camel.component.cm.CMSender;
-import org.apache.camel.component.cm.exceptions.MessagingException;
-import org.apache.camel.component.cm.exceptions.cmresponse.NotPhoneNumberFoundException;
-
-public class NotPhoneNumberFoundExceptionSender implements CMSender {
-
-    @Override
-    public void send(CMMessage cmMessage) throws MessagingException {
-        throw new NotPhoneNumberFoundException();
-    }
-
-}
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.cmresponse.NotPhoneNumberFoundException;
+
+public class NotPhoneNumberFoundExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage)  {
+        throw new NotPhoneNumberFoundException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/87fb63ee/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnknownErrorExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnknownErrorExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnknownErrorExceptionSender.java
index d20723f..33e4565 100644
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnknownErrorExceptionSender.java
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnknownErrorExceptionSender.java
@@ -1,31 +1,30 @@
-/**
- * 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.cm.test.mocks.cmsender;
-
-import org.apache.camel.component.cm.CMMessage;
-import org.apache.camel.component.cm.CMSender;
-import org.apache.camel.component.cm.exceptions.MessagingException;
-import org.apache.camel.component.cm.exceptions.cmresponse.UnknownErrorException;
-
-public class UnknownErrorExceptionSender implements CMSender {
-
-    @Override
-    public void send(CMMessage cmMessage) throws MessagingException {
-        throw new UnknownErrorException();
-    }
-
-}
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.cmresponse.UnknownErrorException;
+
+public class UnknownErrorExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage) {
+        throw new UnknownErrorException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/87fb63ee/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnroutableMessageExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnroutableMessageExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnroutableMessageExceptionSender.java
index 3b6af1e..3657ac7 100644
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnroutableMessageExceptionSender.java
+++ b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnroutableMessageExceptionSender.java
@@ -1,31 +1,30 @@
-/**
- * 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.cm.test.mocks.cmsender;
-
-import org.apache.camel.component.cm.CMMessage;
-import org.apache.camel.component.cm.CMSender;
-import org.apache.camel.component.cm.exceptions.MessagingException;
-import org.apache.camel.component.cm.exceptions.cmresponse.UnroutableMessageException;
-
-public class UnroutableMessageExceptionSender implements CMSender {
-
-    @Override
-    public void send(CMMessage cmMessage) throws MessagingException {
-        throw new UnroutableMessageException();
-    }
-
-}
+/**
+ * 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.cm.test.mocks.cmsender;
+
+import org.apache.camel.component.cm.CMMessage;
+import org.apache.camel.component.cm.CMSender;
+import org.apache.camel.component.cm.exceptions.cmresponse.UnroutableMessageException;
+
+public class UnroutableMessageExceptionSender implements CMSender {
+
+    @Override
+    public void send(CMMessage cmMessage)  {
+        throw new UnroutableMessageException();
+    }
+
+}


[14/23] camel git commit: Unicode number is now used for some of the characters.

Posted by da...@apache.org.
Unicode number is now used for some of the characters. 

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

Branch: refs/heads/master
Commit: d0e134c587b48f50190baf6228234920a7ff9515
Parents: 5e87c96
Author: oalles <oa...@neivi.es>
Authored: Tue Mar 22 12:24:09 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 23 18:46:10 2016 +0100

----------------------------------------------------------------------
 .../src/main/java/org/apache/camel/component/cm/CMConstants.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d0e134c5/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConstants.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConstants.java
index 138f75f..afe8fde 100644
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConstants.java
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConstants.java
@@ -39,5 +39,6 @@ public interface CMConstants {
     // See:
     // https://en.wikipedia.org/wiki/GSM_03.38
     // http://frightanic.com/software-development/regex-for-gsm-03-38-7bit-character-set/
-    String GSM_0338_REGEX = "^[A-Za-z0-9 \\r\\n@£$¥èéùìòÇØøÅå\u0394_\u03A6\u0393\u039B\u03A9\u03A0\u03A8\u03A3\u0398\u039EÆæßÉ!\"#$%&amp;'()*+,\\-./:;&lt;=&gt;?¡ÄÖÑܧ¿äöñüà^{}\\\\\\[~\\]|\u20AC]*$";
+    String GSM_0338_REGEX = "^[A-Za-z0-9 \\r\\n@£$\u0394_\u03A6\u0393\u039B\u03A9\u03A0\u03A8\u03A3\u0398\u039E!\"#$%&amp;'()*+,\\-./:;&lt;=&gt;?¡¿^{}\\\\\\[~\\]|"
+                            + "\u20AC\u00a5\u00e8\u00e9\u00f9\u00ec\u00f2\u00c7\u00d8\u00f8\u00c5\u00e5\u00c6\u00e6\u00df\u00c9\u00c4\u00d6\u00d1\u00dc\u00a7\u00e4\u00f6\u00f1\u00fc\u00e0]*$";
 }


[19/23] camel git commit: Polished

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
deleted file mode 100644
index d796eb9..0000000
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/**
- * 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.cm.test;
-
-import com.google.i18n.phonenumbers.PhoneNumberUtil;
-import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
-import org.apache.camel.component.cm.CMConstants;
-import org.apache.camel.component.cm.CMMessage;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.util.Assert;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = { ValidatorConfiguration.class })
-// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
-// @DisableJmx(false)
-// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class CMMessageTest extends AbstractJUnit4SpringContextTests {
-
-    private final PhoneNumberUtil pnu = PhoneNumberUtil.getInstance();
-    private String validNumber;
-
-    @Before
-    public void beforeTest() throws Exception {
-        validNumber = pnu.format(pnu.getExampleNumber("ES"), PhoneNumberFormat.E164);
-    }
-
-    // @After
-    // public void afterTest() {
-
-    /*
-     * GSM0338
-     */
-
-    @Test
-    public void testGSM338AndLTMAXGSMMESSAGELENGTH() throws Exception {
-
-        // 0338 and less than 160 char -> 1 part
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < CMConstants.MAX_GSM_MESSAGE_LENGTH; index++) {
-            message.append("a");
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 1);
-        Assert.isTrue(!cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testGSM338AndEQMAXGSMMESSAGELENGTH() throws Exception {
-        // 0338 and length is exactly 160 -> 1 part
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < CMConstants.MAX_GSM_MESSAGE_LENGTH; index++) {
-            message.append("a");
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 1);
-        Assert.isTrue(!cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testGSM338AndGTMAXGSMMESSAGELENGTH() throws Exception {
-
-        // 0338 and length is exactly 161 -> 2 part
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < CMConstants.MAX_GSM_MESSAGE_LENGTH + 1; index++) {
-            message.append("a");
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 2);
-        Assert.isTrue(!cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testGSM338AndLT2MAXGSMMESSAGELENGTH() throws Exception {
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (2 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART - 1); index++) {
-            message.append("a");
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 2);
-        Assert.isTrue(!cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testGSM338AndEQ2MAXGSMMESSAGELENGTH() throws Exception {
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (2 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
-            message.append("a");
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 2);
-        Assert.isTrue(!cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testGSM338AndGT2MAXGSMMESSAGELENGTH() throws Exception {
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (2 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
-            message.append("a");
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 3);
-        Assert.isTrue(!cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testGSM338AndEQ8MAXGSMMESSAGELENGTH() throws Exception {
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (8 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
-            message.append("a");
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 8);
-        Assert.isTrue(!cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testGSM338AndGT8MAXGSMMESSAGELENGTH() throws Exception {
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (8 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
-            message.append("a");
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 8);
-        Assert.isTrue(!cmMessage.isUnicode());
-    }
-
-    /*
-     * Unicode Messages
-     */
-
-    @Test
-    public void testUnicodeAndLTMAXGSMMESSAGELENGTH() throws Exception {
-
-        String ch = "\uF400";
-
-        // 0338 and less than 160 char -> 1 part
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < CMConstants.MAX_UNICODE_MESSAGE_LENGTH; index++) {
-            message.append(ch);
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 1);
-        Assert.isTrue(cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testUnicodeAndEQMAXGSMMESSAGELENGTH() throws Exception {
-        // 0338 and length is exactly 160 -> 1 part
-
-        String ch = "\uF400";
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < CMConstants.MAX_UNICODE_MESSAGE_LENGTH; index++) {
-            message.append(ch);
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 1);
-        Assert.isTrue(cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testUnicodeAndGTMAXGSMMESSAGELENGTH() throws Exception {
-
-        // 0338 and length is exactly 161 -> 2 part
-
-        String ch = "\uF400";
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < CMConstants.MAX_UNICODE_MESSAGE_LENGTH + 1; index++) {
-            message.append(ch);
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 2);
-        Assert.isTrue(cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testUnicodeAndLT2MAXGSMMESSAGELENGTH() throws Exception {
-
-        String ch = "\uF400";
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (2 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART - 1); index++) {
-            message.append(ch);
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 2);
-        Assert.isTrue(cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testUnicodeAndEQ2MAXGSMMESSAGELENGTH() throws Exception {
-
-        String ch = "\uF400";
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (2 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
-            message.append(ch);
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 2);
-        Assert.isTrue(cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testUnicodeAndGT2MAXGSMMESSAGELENGTH() throws Exception {
-
-        String ch = "\uF400";
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (2 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
-            message.append(ch);
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 3);
-        Assert.isTrue(cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testUnicodeAndEQ8MAXGSMMESSAGELENGTH() throws Exception {
-
-        String ch = "\uF400";
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (8 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
-            message.append(ch);
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 8);
-        Assert.isTrue(cmMessage.isUnicode());
-    }
-
-    @Test
-    public void testUnicodeAndGT8MAXGSMMESSAGELENGTH() throws Exception {
-
-        String ch = "\uF400";
-
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < (8 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
-            message.append(ch);
-        }
-
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
-        cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
-
-        Assert.isTrue(cmMessage.getMultiparts() == 8);
-        Assert.isTrue(cmMessage.isUnicode());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMProxy.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMProxy.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMProxy.java
deleted file mode 100644
index 45b88bd..0000000
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMProxy.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * 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.cm.test;
-
-import org.apache.camel.component.cm.client.SMSMessage;
-
-/**
- * Regular interface used to proxy a producer sending to the Route out to CM Direct {@link http://camel.apache.org/using-camelproxy.html}
- */
-public interface CMProxy {
-    void send(SMSMessage smsMessage);
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java
deleted file mode 100644
index b6e9f1a..0000000
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CMTest.java
+++ /dev/null
@@ -1,363 +0,0 @@
-/**
- * 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.cm.test;
-
-import java.math.BigInteger;
-import java.security.SecureRandom;
-
-import com.google.i18n.phonenumbers.PhoneNumberUtil;
-import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
-import org.apache.camel.CamelContext;
-import org.apache.camel.EndpointInject;
-import org.apache.camel.InvalidPayloadRuntimeException;
-import org.apache.camel.Produce;
-import org.apache.camel.ResolveEndpointFailedException;
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.Service;
-import org.apache.camel.component.cm.CMEndpoint;
-import org.apache.camel.component.cm.client.SMSMessage;
-import org.apache.camel.component.cm.exceptions.HostUnavailableException;
-import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
-import org.apache.camel.component.cm.exceptions.cmresponse.InsufficientBalanceException;
-import org.apache.camel.component.cm.exceptions.cmresponse.InvalidMSISDNException;
-import org.apache.camel.component.cm.exceptions.cmresponse.InvalidProductTokenException;
-import org.apache.camel.component.cm.exceptions.cmresponse.NoAccountFoundForProductTokenException;
-import org.apache.camel.component.cm.exceptions.cmresponse.NoMessageException;
-import org.apache.camel.component.cm.exceptions.cmresponse.NotPhoneNumberFoundException;
-import org.apache.camel.component.cm.exceptions.cmresponse.UnknownErrorException;
-import org.apache.camel.component.cm.exceptions.cmresponse.UnroutableMessageException;
-import org.apache.camel.component.cm.test.mocks.cmsender.CMResponseExceptionSender;
-import org.apache.camel.component.cm.test.mocks.cmsender.InsufficientBalanceExceptionSender;
-import org.apache.camel.component.cm.test.mocks.cmsender.InvalidMSISDNExceptionSender;
-import org.apache.camel.component.cm.test.mocks.cmsender.InvalidProductTokenExceptionSender;
-import org.apache.camel.component.cm.test.mocks.cmsender.NoAccountFoundForProductTokenExceptionSender;
-import org.apache.camel.component.cm.test.mocks.cmsender.NoMessageExceptionSender;
-import org.apache.camel.component.cm.test.mocks.cmsender.NotPhoneNumberFoundExceptionSender;
-import org.apache.camel.component.cm.test.mocks.cmsender.UnknownErrorExceptionSender;
-import org.apache.camel.component.cm.test.mocks.cmsender.UnroutableMessageExceptionSender;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.spring.CamelSpringDelegatingTestContextLoader;
-import org.apache.camel.test.spring.CamelSpringJUnit4ClassRunner;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
-import org.springframework.util.Assert;
-
-@RunWith(CamelSpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {CamelTestConfiguration.class }, loader = CamelSpringDelegatingTestContextLoader.class)
-// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
-// @DisableJmx(false)
-// @MockEndpoints
-// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class CMTest extends AbstractJUnit4SpringContextTests {
-
-    // dependency: camel-spring-javaconfig
-
-    @Autowired
-    private CamelContext camelContext;
-
-    private SecureRandom random = new SecureRandom();
-
-    private final PhoneNumberUtil pnu = PhoneNumberUtil.getInstance();
-    private String validNumber;
-
-    @Produce(uri = "direct:sms")
-    private CMProxy cmProxy;
-
-    @EndpointInject(uri = "mock:test")
-    private MockEndpoint mock;
-
-    // private StopWatch stopWatch = new StopWatch(getClass().getSimpleName());
-
-    @Before
-    public void beforeTest() throws Exception {
-        mock.reset();
-        camelContext.startRoute(CamelTestConfiguration.SIMPLE_ROUTE_ID);
-        validNumber = pnu.format(pnu.getExampleNumber("ES"), PhoneNumberFormat.E164);
-    }
-
-    @After
-    public void afterTest() {
-
-        try {
-            camelContext.stopRoute(CamelTestConfiguration.SIMPLE_ROUTE_ID);
-        } catch (Exception e) {
-            logger.error("Exception trying to stop de routes", e);
-        }
-
-        // Stop all routes
-        // for (Route route : camelContext.getRoutes()) {
-        // try {
-        // camelContext.stopRoute(route.getId());
-        // } catch (Exception e) {
-        // logger.error("Exception trying to stop de routes", e);
-        // }
-        // }
-    }
-
-    /*
-     * 1. Invalid URI
-     */
-
-    @Test(expected = ResolveEndpointFailedException.class)
-    public void testNotRequiredProductToken() throws Throwable {
-        try {
-            String schemedUri = "cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&testConnectionOnStartup=true";
-            camelContext.getEndpoint(schemedUri).start();
-        } catch (Throwable t) {
-            throw t.getCause();
-        }
-
-    }
-
-    @Test(expected = ResolveEndpointFailedException.class)
-    public void testNotRequiredDefaultFrom() throws Throwable {
-        try {
-            String schemedUri = "cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&testConnectionOnStartup=true";
-            camelContext.getEndpoint(schemedUri).start();
-        } catch (Throwable t) {
-            throw t.getCause();
-        }
-
-    }
-
-    @Test(expected = HostUnavailableException.class)
-    public void testHostUnavailableException() throws Throwable {
-        // cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
-        String schemedUri = "cm://dummy.sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true";
-        Service service = camelContext.getEndpoint(schemedUri).createProducer();
-        service.start();
-    }
-
-    @Test(expected = ResolveEndpointFailedException.class)
-    public void testInvalidHostDuplicateScheme() throws Throwable {
-        // cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
-        try {
-            String schemedUri = "cm://https://demo.com";
-            camelContext.getEndpoint(schemedUri);
-        } catch (Throwable t) {
-            throw t.getCause();
-        }
-    }
-
-    @Test(expected = ResolveEndpointFailedException.class)
-    public void testInvalidUriEndpoint() throws Throwable {
-        // cm://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
-        String noHostUri = "cm://gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true";
-        camelContext.getEndpoint(noHostUri);
-    }
-
-    /*
-     * 2. Invalid Payload
-     */
-
-    @Test(expected = RuntimeException.class)
-    public void testNullPayload() throws Throwable {
-        cmProxy.send(null);
-    }
-
-    // @DirtiesContext
-    @Test(expected = NoAccountFoundForProductTokenException.class)
-    public void testAsPartOfARoute() throws Exception {
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateUnicodeMessage(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    @Test(expected = NoAccountFoundForProductTokenException.class)
-    public void testNoAccountFoundForProductTokenException() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer().setSender(new NoAccountFoundForProductTokenExceptionSender());
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateGSM0338Message(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    /*
-     * 3. CM Responses (Faking Exceptions)
-     */
-
-    @Test(expected = CMResponseException.class)
-    public void testCMResponseException() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer().setSender(new CMResponseExceptionSender());
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateUnicodeMessage(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    @Test(expected = InsufficientBalanceException.class)
-    public void testInsufficientBalanceException() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer().setSender(new InsufficientBalanceExceptionSender());
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateGSM0338Message(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    @Test(expected = InvalidMSISDNException.class)
-    public void testInvalidMSISDNException() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer().setSender(new InvalidMSISDNExceptionSender());
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateUnicodeMessage(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    @Test(expected = InvalidProductTokenException.class)
-    public void testInvalidProductTokenException() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer().setSender(new InvalidProductTokenExceptionSender());
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateUnicodeMessage(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    @Test(expected = NoMessageException.class)
-    public void testNoMessageException() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer().setSender(new NoMessageExceptionSender());
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateGSM0338Message(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    @Test(expected = NotPhoneNumberFoundException.class)
-    public void testNotPhoneNumberFoundException() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer().setSender(new NotPhoneNumberFoundExceptionSender());
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateUnicodeMessage(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    @Test(expected = UnknownErrorException.class)
-    public void testUnknownErrorException() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer().setSender(new UnknownErrorExceptionSender());
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateGSM0338Message(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    @Test(expected = UnroutableMessageException.class)
-    public void testUnroutableMessageException() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
-        endpoint.getProducer().setSender(new UnroutableMessageExceptionSender());
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateUnicodeMessage(), validNumber, null);
-        cmProxy.send(smsMessage);
-    }
-
-    @Test(expected = RuntimeCamelException.class)
-    public void testCMEndpointIsForProducing() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
-        endpoint.createConsumer(null);
-    }
-
-    @Test
-    public void testCMEndpointGetHost() throws Exception {
-
-        // Change sending strategy
-        CMEndpoint endpoint = (CMEndpoint) camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
-        Assert.isTrue(endpoint.getHost().equals(applicationContext.getEnvironment().getRequiredProperty("cm.url")));
-    }
-
-    @Test(expected = InvalidPayloadRuntimeException.class)
-    public void testSendInvalidPayload() throws Exception {
-
-        // Body
-        final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateGSM0338Message(), null, null);
-        cmProxy.send(smsMessage);
-    }
-
-    /*
-     * CMMessages
-     */
-
-    // @Test(expected = RuntimeException.class)
-    // public void testSkel() throws Exception {
-
-    // mock.expectedMessageCount(1);
-    //
-    // // Body
-    // final SMSMessage smsMessage = new SMSMessage("Hello CM", validNumber);
-    // cmProxy.send(smsMessage);
-    //
-    // mock.assertIsSatisfied();
-    // }
-
-    private String generateUnicodeMessage() {
-        String ch = "\uF400";
-        return generateRandomLengthMessageByChar(ch);
-    }
-
-    private String generateGSM0338Message() {
-        String ch = "a";
-        return generateRandomLengthMessageByChar(ch);
-    }
-
-    private String generateRandomLengthMessageByChar(String ch) {
-        // random Length
-        int msgLength = (int) (Math.random() * 2000);
-        StringBuffer message = new StringBuffer();
-        for (int index = 0; index < msgLength; index++) {
-            message.append(ch);
-        }
-        return message.toString();
-    }
-
-    //
-    private String generateIdAsString() {
-        return new BigInteger(130, random).toString(32);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CamelTestConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CamelTestConfiguration.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CamelTestConfiguration.java
deleted file mode 100644
index 54a3356..0000000
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/CamelTestConfiguration.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * 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.cm.test;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.spring.javaconfig.SingleRouteCamelConfiguration;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.PropertySource;
-import org.springframework.core.env.Environment;
-import org.springframework.util.Assert;
-import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
-
-/**
- * Builds a SimpleRoute to send a message to CM GW and CM Uri is built based on
- * properties in a file.
- */
-@Configuration("cmConfig")
-@PropertySource("classpath:/cm-smsgw.properties")
-public class CamelTestConfiguration extends SingleRouteCamelConfiguration {
-
-    public static final String SIMPLE_ROUTE_ID = "simple-route";
-
-    private String uri;
-
-    @Override
-    public RouteBuilder route() {
-        return new RouteBuilder() {
-
-            @Override
-            public void configure() throws Exception {
-
-                Assert.hasLength(uri);
-
-                log.debug(
-                        "\nCM Component is an URI based component\nCM URI: {}",
-                        uri);
-
-                // Route definition
-                from("direct:sms").to(uri).to("mock:test")
-                        .routeId(SIMPLE_ROUTE_ID).autoStartup(true);
-
-            }
-        };
-    }
-
-    @Bean
-    public LocalValidatorFactoryBean getValidatorFactory() {
-        final LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
-        localValidatorFactoryBean.getValidationPropertyMap()
-                .put("hibernate.validator.fail_fast", "true");
-        return localValidatorFactoryBean;
-    }
-
-    /**
-     * Build the URI of the CM Component based on Environmental properties
-     */
-    @Override
-    public final void setApplicationContext(
-            final ApplicationContext applicationContext) {
-
-        super.setApplicationContext(applicationContext);
-
-        final Environment env = applicationContext.getEnvironment();
-
-        final String host = env.getRequiredProperty("cm.url");
-        final String productTokenString = env
-                .getRequiredProperty("cm.product-token");
-        final String sender = env.getRequiredProperty("cm.default-sender");
-
-        final StringBuffer cmUri = new StringBuffer("cm:" + host)
-                .append("?productToken=").append(productTokenString);
-        if (sender != null && !sender.isEmpty()) {
-            cmUri.append("&defaultFrom=").append(sender);
-        }
-
-        // Defaults to false
-        final Boolean testConnectionOnStartup = Boolean.parseBoolean(
-                env.getProperty("cm.testConnectionOnStartup", "false"));
-        if (testConnectionOnStartup) {
-            cmUri.append("&testConnectionOnStartup=")
-                    .append(testConnectionOnStartup.toString());
-        }
-
-        // Defaults to 8
-        final Integer defaultMaxNumberOfParts = Integer
-                .parseInt(env.getProperty("defaultMaxNumberOfParts", "8"));
-        cmUri.append("&defaultMaxNumberOfParts=")
-                .append(defaultMaxNumberOfParts.toString());
-
-        uri = cmUri.toString();
-    }
-
-    public String getUri() {
-        return uri;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java
deleted file mode 100644
index 8d653d3..0000000
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/**
- * 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.cm.test;
-
-import java.util.Set;
-
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-
-import com.google.i18n.phonenumbers.PhoneNumberUtil;
-import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
-import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
-import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber.CountryCodeSource;
-import org.apache.camel.component.cm.client.SMSMessage;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.util.Assert;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {ValidatorConfiguration.class })
-// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
-// @DisableJmx(false)
-// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class SMSMessageTest extends AbstractJUnit4SpringContextTests {
-
-    @Autowired
-    private Validator validator;
-
-    private final PhoneNumberUtil pnu = PhoneNumberUtil.getInstance();
-    private String validNumber;
-
-    @Before
-    public void beforeTest() throws Exception {
-
-        validNumber = pnu.format(pnu.getExampleNumber("ES"), PhoneNumberFormat.E164);
-    }
-
-    // @After
-    // public void afterTest() {
-
-    @Test
-    public void testSMSMessageConstructor() throws Throwable {
-
-        // Coverage ;)
-        SMSMessage message = new SMSMessage(null, null);
-        Assert.isNull(message.getMessage());
-        Assert.isNull(message.getPhoneNumber());
-
-        message = new SMSMessage("idAsString", null, null, "MySelf");
-        Assert.isTrue(message.getId().equals("idAsString"));
-        Assert.isTrue(message.getFrom().equals("MySelf"));
-    }
-
-    @Test
-    public void testNullMessageField() throws Exception {
-
-        final SMSMessage m = new SMSMessage(null, validNumber);
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testNullPhoneNumber() throws Exception {
-
-        final SMSMessage m = new SMSMessage("Hello world!", null);
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testDynamicFromFieldMaxLength() throws Exception {
-
-        String dynamicFrom = "messagelengthgreaterthan12";
-
-        final SMSMessage m = new SMSMessage("idAsString", "Hello World", validNumber, dynamicFrom);
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testDynamicFromFieldZeroLength() throws Exception {
-
-        String zeroLengthDynamicFrom = "";
-
-        final SMSMessage m = new SMSMessage("idAsString", "Hello World", validNumber, zeroLengthDynamicFrom);
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testIdAsStringMaxLength() throws Exception {
-
-        String idAsString = "thisistheidastringlengthgreaterthan32";
-
-        final SMSMessage m = new SMSMessage(idAsString, "Hello World", validNumber, "MySelf");
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testIdAsStringFieldZeroLength() throws Exception {
-
-        String zeroLengthIdAsString = "";
-
-        final SMSMessage m = new SMSMessage(zeroLengthIdAsString, "Hello World", validNumber, "MySelf");
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testE164NullNumberIsInValid() throws Exception {
-
-        final String phoneNumber = null;
-        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testE164IsValid() throws Exception {
-
-        final SMSMessage m = new SMSMessage("Hello world!", validNumber);
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(0 == constraintViolations.size());
-    }
-
-    @Test
-    public void testE164NoPlusSignedNumberIsInvalid() throws Exception {
-
-        final String phoneNumber = "34600000000";
-        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testE164NoPlusSignedNumberBut00IsInvalid() throws Exception {
-
-        final String phoneNumber = new PhoneNumber().setCountryCodeSource(CountryCodeSource.FROM_NUMBER_WITHOUT_PLUS_SIGN).setNationalNumber(0034600000000).toString();
-        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-
-    @Test
-    public void testE164NumberWithPlusSignIsInvalid() throws Exception {
-
-        final String phoneNumber = "+34 600 00 00 00";
-        final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
-
-        final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size());
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/ValidatorConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/ValidatorConfiguration.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/ValidatorConfiguration.java
deleted file mode 100644
index 9e8779e..0000000
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/ValidatorConfiguration.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * 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.cm.test;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
-
-/**
- * Builds a SimpleRoute to send a message to CM GW and CM Uri is built based on properties in a file.
- */
-@Configuration("smsConfig")
-public class ValidatorConfiguration {
-
-    @Bean
-    public LocalValidatorFactoryBean getValidatorFactory() {
-        final LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
-        localValidatorFactoryBean.getValidationPropertyMap().put("hibernate.validator.fail_fast", "true");
-        return localValidatorFactoryBean;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/CMResponseExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/CMResponseExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/CMResponseExceptionSender.java
deleted file mode 100644
index fe23ae9..0000000
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/CMResponseExceptionSender.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.cm.test.mocks.cmsender;
-
-import org.apache.camel.component.cm.CMMessage;
-import org.apache.camel.component.cm.CMSender;
-import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
-
-public class CMResponseExceptionSender implements CMSender {
-
-    @Override
-    public void send(CMMessage cmMessage)  {
-        throw new CMResponseException();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InsufficientBalanceExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InsufficientBalanceExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InsufficientBalanceExceptionSender.java
deleted file mode 100644
index 413df91..0000000
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InsufficientBalanceExceptionSender.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.cm.test.mocks.cmsender;
-
-import org.apache.camel.component.cm.CMMessage;
-import org.apache.camel.component.cm.CMSender;
-import org.apache.camel.component.cm.exceptions.cmresponse.InsufficientBalanceException;
-
-public class InsufficientBalanceExceptionSender implements CMSender {
-
-    @Override
-    public void send(CMMessage cmMessage) {
-        throw new InsufficientBalanceException();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidMSISDNExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidMSISDNExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidMSISDNExceptionSender.java
deleted file mode 100644
index 09107d5..0000000
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidMSISDNExceptionSender.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.cm.test.mocks.cmsender;
-
-import org.apache.camel.component.cm.CMMessage;
-import org.apache.camel.component.cm.CMSender;
-import org.apache.camel.component.cm.exceptions.cmresponse.InvalidMSISDNException;
-
-public class InvalidMSISDNExceptionSender implements CMSender {
-
-    @Override
-    public void send(CMMessage cmMessage)  {
-        throw new InvalidMSISDNException();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidProductTokenExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidProductTokenExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidProductTokenExceptionSender.java
deleted file mode 100644
index 102cbf4..0000000
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/InvalidProductTokenExceptionSender.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.cm.test.mocks.cmsender;
-
-import org.apache.camel.component.cm.CMMessage;
-import org.apache.camel.component.cm.CMSender;
-import org.apache.camel.component.cm.exceptions.cmresponse.InvalidProductTokenException;
-
-public class InvalidProductTokenExceptionSender implements CMSender {
-
-    @Override
-    public void send(CMMessage cmMessage)  {
-        throw new InvalidProductTokenException();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoAccountFoundForProductTokenExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoAccountFoundForProductTokenExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoAccountFoundForProductTokenExceptionSender.java
deleted file mode 100644
index 7fb4c2b..0000000
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoAccountFoundForProductTokenExceptionSender.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.cm.test.mocks.cmsender;
-
-import org.apache.camel.component.cm.CMMessage;
-import org.apache.camel.component.cm.CMSender;
-import org.apache.camel.component.cm.exceptions.cmresponse.NoAccountFoundForProductTokenException;
-
-public class NoAccountFoundForProductTokenExceptionSender implements CMSender {
-
-    @Override
-    public void send(CMMessage cmMessage)  {
-        throw new NoAccountFoundForProductTokenException();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoMessageExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoMessageExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoMessageExceptionSender.java
deleted file mode 100644
index 6e27dcf..0000000
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NoMessageExceptionSender.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.cm.test.mocks.cmsender;
-
-import org.apache.camel.component.cm.CMMessage;
-import org.apache.camel.component.cm.CMSender;
-import org.apache.camel.component.cm.exceptions.cmresponse.NoMessageException;
-
-public class NoMessageExceptionSender implements CMSender {
-
-    @Override
-    public void send(CMMessage cmMessage) {
-        throw new NoMessageException();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NotPhoneNumberFoundExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NotPhoneNumberFoundExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NotPhoneNumberFoundExceptionSender.java
deleted file mode 100644
index 162ef38..0000000
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/NotPhoneNumberFoundExceptionSender.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.cm.test.mocks.cmsender;
-
-import org.apache.camel.component.cm.CMMessage;
-import org.apache.camel.component.cm.CMSender;
-import org.apache.camel.component.cm.exceptions.cmresponse.NotPhoneNumberFoundException;
-
-public class NotPhoneNumberFoundExceptionSender implements CMSender {
-
-    @Override
-    public void send(CMMessage cmMessage)  {
-        throw new NotPhoneNumberFoundException();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnknownErrorExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnknownErrorExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnknownErrorExceptionSender.java
deleted file mode 100644
index 33e4565..0000000
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnknownErrorExceptionSender.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.cm.test.mocks.cmsender;
-
-import org.apache.camel.component.cm.CMMessage;
-import org.apache.camel.component.cm.CMSender;
-import org.apache.camel.component.cm.exceptions.cmresponse.UnknownErrorException;
-
-public class UnknownErrorExceptionSender implements CMSender {
-
-    @Override
-    public void send(CMMessage cmMessage) {
-        throw new UnknownErrorException();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnroutableMessageExceptionSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnroutableMessageExceptionSender.java b/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnroutableMessageExceptionSender.java
deleted file mode 100644
index 3657ac7..0000000
--- a/components/camel-cm/src/test/java/org/apache/camel/component/cm/test/mocks/cmsender/UnroutableMessageExceptionSender.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.cm.test.mocks.cmsender;
-
-import org.apache.camel.component.cm.CMMessage;
-import org.apache.camel.component.cm.CMSender;
-import org.apache.camel.component.cm.exceptions.cmresponse.UnroutableMessageException;
-
-public class UnroutableMessageExceptionSender implements CMSender {
-
-    @Override
-    public void send(CMMessage cmMessage)  {
-        throw new UnroutableMessageException();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/camel-cm/src/test/resources/cm-smsgw.properties
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/test/resources/cm-smsgw.properties b/components/camel-cm/src/test/resources/cm-smsgw.properties
deleted file mode 100644
index 9393fa9..0000000
--- a/components/camel-cm/src/test/resources/cm-smsgw.properties
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# 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.
-#
-
-# DefaultSender
-cm.default-sender=MyBusiness
-
-# CM URL
-# https://dashboard.onlinesmsgateway.com/docs#send-a-message-send-a-message
-cm.url=sgw01.cm.nl/gateway.ashx
-
-# UUID as STRING
-cm.product-token=ea723fd7-da81-4826-89bc-fa7144e71c40
-
-cm.testConnectionOnStartup=true
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/components/pom.xml
----------------------------------------------------------------------
diff --git a/components/pom.xml b/components/pom.xml
index 1cc2241..35f5a8b 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -81,7 +81,7 @@
     <module>camel-castor</module>
     <module>camel-cdi</module>
     <module>camel-chunk</module>
-	<module>camel-cm</module>
+	<module>camel-cm-sms</module>
     <module>camel-cmis</module>
     <module>camel-coap</module>
     <module>camel-cometd</module>

http://git-wip-us.apache.org/repos/asf/camel/blob/58515451/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 2fc19eb..b19d6d1 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -796,6 +796,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-cm-sms</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-cmis</artifactId>
         <version>${project.version}</version>
       </dependency>


[02/23] camel git commit: Fixing. send() method doesnot need to catch exceptions.

Posted by da...@apache.org.
Fixing. send() method doesnot need to catch exceptions. 

Logging code is being removed. when throwing exception.

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

Branch: refs/heads/master
Commit: 5537bb59355319bd9eebeb644258e9467952bb25
Parents: fcd1a49
Author: oalles <oa...@neivi.es>
Authored: Tue Mar 22 13:12:09 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 23 18:46:10 2016 +0100

----------------------------------------------------------------------
 .../component/cm/CMSenderOneMessageImpl.java    | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/5537bb59/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
index 813ed42..101905e 100644
--- a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
@@ -78,17 +78,11 @@ public class CMSenderOneMessageImpl implements CMSender {
 
         // See: Check https://dashboard.onlinesmsgateway.com/docs for responses
 
-        try {
-
-            // 1.Construct XML. Throws XMLConstructionException
-            final String xml = createXml(cmMessage);
+        // 1.Construct XML. Throws XMLConstructionException
+        final String xml = createXml(cmMessage);
 
-            // 2. Try to send to CM SMS Provider ...Throws CMResponse
-            doHttpPost(url, xml);
-        } catch (final RuntimeException e) {
-            LOG.error("Failed to send SMS: {}", cmMessage, e);
-            throw e; // XMLConstrucion o
-        }
+        // 2. Try to send to CM SMS Provider ...Throws CMResponse
+        doHttpPost(url, xml);
     }
 
     private String createXml(final CMMessage message) {
@@ -172,11 +166,9 @@ public class CMSenderOneMessageImpl implements CMSender {
             aTransformer.transform(src, dest);
             return xml.toString();
         } catch (final TransformerException e) {
-            LOG.error("Cant serialize CMMessage {}: ", message, e);
-            throw new XMLConstructionException(e);
+            throw new XMLConstructionException(String.format("Cant serialize CMMessage %s", message), e);
         } catch (final ParserConfigurationException e) {
-            LOG.error("Cant serialize CMMessage {}: ", message, e);
-            throw new XMLConstructionException(e);
+            throw new XMLConstructionException(String.format("Cant serialize CMMessage %s", message), e);
         }
     }
 


[07/23] camel git commit: camel-cm component added following the steps in http://camel.apache.org/add-new-component-guide.html

Posted by da...@apache.org.
camel-cm component added following the steps in http://camel.apache.org/add-new-component-guide.html


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

Branch: refs/heads/master
Commit: c70e9db88e9d3c04bf5b69cde8078c7e47c70e15
Parents: fa78b86
Author: oalles <oa...@neivi.es>
Authored: Sun Mar 20 14:23:21 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 23 18:46:10 2016 +0100

----------------------------------------------------------------------
 components/camel-cm/README.md                   |  32 ++
 components/camel-cm/pom.xml                     | 101 +++++
 .../apache/camel/component/cm/CMComponent.java  | 104 +++++
 .../camel/component/cm/CMConfiguration.java     |  92 +++++
 .../apache/camel/component/cm/CMConstants.java  |  39 ++
 .../apache/camel/component/cm/CMEndpoint.java   | 141 +++++++
 .../apache/camel/component/cm/CMMessage.java    | 153 +++++++
 .../apache/camel/component/cm/CMProducer.java   | 165 ++++++++
 .../org/apache/camel/component/cm/CMSender.java |  30 ++
 .../component/cm/CMSenderOneMessageImpl.java    | 263 ++++++++++++
 .../org/apache/camel/component/cm/CMUtils.java  |  30 ++
 .../camel/component/cm/client/SMSMessage.java   | 114 ++++++
 .../camel/component/cm/client/Translator.java   |  23 ++
 .../cm/exceptions/CMDirectException.java        |  40 ++
 .../cm/exceptions/CMValidationException.java    |  40 ++
 .../cm/exceptions/HostUnavailableException.java |  40 ++
 .../cm/exceptions/InvalidPayloadException.java  |  44 ++
 .../cm/exceptions/InvalidURLException.java      |  30 ++
 .../exceptions/InvalidUriEndpointException.java |  33 ++
 .../cm/exceptions/MessagingException.java       |  40 ++
 .../cm/exceptions/ProviderException.java        |  41 ++
 .../cm/exceptions/XMLConstructionException.java |  39 ++
 .../cmresponse/CMResponseException.java         |  41 ++
 .../InsufficientBalanceException.java           |  26 ++
 .../cmresponse/InvalidMSISDNException.java      |  23 ++
 .../InvalidProductTokenException.java           |  26 ++
 .../NoAccountFoundForProductTokenException.java |  28 ++
 .../cmresponse/NoMessageException.java          |  23 ++
 .../NotPhoneNumberFoundException.java           |  23 ++
 .../cmresponse/UnknownErrorException.java       |  26 ++
 .../cmresponse/UnroutableMessageException.java  |  23 ++
 .../cm/validation/constraints/E164.java         |  41 ++
 .../validation/constraints/E164Validator.java   |  66 +++
 .../services/org/apache/camel/component/cm      |  18 +
 .../src/main/resources/log4j.properties         |  37 ++
 .../component/cm/test/CMConfigurationTest.java  | 142 +++++++
 .../camel/component/cm/test/CMMessageTest.java  | 323 +++++++++++++++
 .../apache/camel/component/cm/test/CMProxy.java |  26 ++
 .../apache/camel/component/cm/test/CMTest.java  | 407 +++++++++++++++++++
 .../cm/test/CamelTestConfiguration.java         | 100 +++++
 .../camel/component/cm/test/SMSMessageTest.java | 183 +++++++++
 .../cm/test/ValidatorConfiguration.java         |  35 ++
 .../cmsender/CMResponseExceptionSender.java     |  31 ++
 .../InsufficientBalanceExceptionSender.java     |  31 ++
 .../cmsender/InvalidMSISDNExceptionSender.java  |  31 ++
 .../InvalidProductTokenExceptionSender.java     |  31 ++
 ...ountFoundForProductTokenExceptionSender.java |  31 ++
 .../cmsender/NoMessageExceptionSender.java      |  31 ++
 .../NotPhoneNumberFoundExceptionSender.java     |  31 ++
 .../cmsender/UnknownErrorExceptionSender.java   |  31 ++
 .../UnroutableMessageExceptionSender.java       |  31 ++
 .../src/test/resources/cm-smsgw.properties      |  28 ++
 components/pom.xml                              |   1 +
 parent/pom.xml                                  |   4 +
 .../features/src/main/resources/features.xml    |  10 +
 55 files changed, 3573 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/README.md
----------------------------------------------------------------------
diff --git a/components/camel-cm/README.md b/components/camel-cm/README.md
new file mode 100644
index 0000000..63f9059
--- /dev/null
+++ b/components/camel-cm/README.md
@@ -0,0 +1,32 @@
+# camel-cm
+
+[Camel component](http://camel.apache.org/components.html) for the [CM SMS Gateway](https://www.cmtelecom.com). 
+
+It allows to integrate [CM SMS API](https://dashboard.onlinesmsgateway.com/docs) in an application as a camel component. 
+
+You must have a valid account.  More information are available at [CM Telecom](https://www.cmtelecom.com/support).
+
+### URI Format
+
+```
+cm://sgw01.cm.nl/gateway.ashx?defaultFrom=DefaultSender&defaultMaxNumberOfParts=8&productToken=2fb82162-754c-4c1b-806d-9cb7efd677f4
+```
+
+
+### Endpoint Options
+
+CM endpoints act like a **producer** and support the following options.
+
+| Name  | Default Value | Description |
+| ------------- | ------------- | ------------- |
+| productToken  |*none* |**Required**. UUID as String. This is the product token that was sent to you by email. Example: 'de7c7df3-81ca-4d1e-863d-95a252120321'|
+| defaultFrom  | *none* |**Required**. This is the default sender name, to be included in each SMSMessage instance not providing one. The maximum length is 11 characters.|
+| defaultMaxNumberOfParts  | 8 | If it is a [multipart message](https://dashboard.onlinesmsgateway.com/docs#send-a-message-multipart) forces the max number of parts to be sent. <p>The gateway will first check if a message is larger than 160 characters, if so, the message will be cut into multiple 153 characters parts limited by these parameters whether the message is [GSM 0038 encodeable](https://en.wikipedia.org/wiki/GSM_03.38). <p>Otherwise, The gateway will check if a message is larger than 70 characters, if so, the message will be cut into multiple 67 characters parts to a maximum of this parameter.|
+| testConnectionOnStartup | false | This ensures that Camel is not started with failed connections cause an exception is thrown on startup. | 
+
+### Tests
+
+Tests provided so far show a valid [Spring Configuration](https://github.com/oalles/camel-cm/blob/master/src/test/java/org/apache/camel/component/cm/test/TestConfiguration.java). Notice that CM Component URI is built from properties in a [file](https://github.com/oalles/camel-cm/blob/master/src/test/resources/cm-smsgw.properties). 
+
+### Sample of Usage
+You can try [this project](https://github.com/oalles/camel-cm-sample) to see how camel-cm can be integrated in a camel route. 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-cm/pom.xml b/components/camel-cm/pom.xml
new file mode 100644
index 0000000..2659259
--- /dev/null
+++ b/components/camel-cm/pom.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.apache.camel</groupId>
+		<artifactId>components</artifactId>
+		<version>2.16.2</version>
+	</parent>
+	<artifactId>camel-cm</artifactId>
+	<packaging>bundle</packaging>
+	<name>Camel :: CM</name>
+	<description>Camel CM Component</description>
+
+	<properties>
+		<camel.osgi.export.pkg>org.apache.camel.component.cm.*</camel.osgi.export.pkg>
+		<camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=cm</camel.osgi.export.service>
+		<httpclient>${httpclient4-version}</httpclient>
+		<jsoup-version>1.8.3</jsoup-version>
+		<libphonenumber-version>7.2.7</libphonenumber-version>
+		<commons-validator-version>1.5.0</commons-validator-version>
+	</properties>
+
+	<dependencies>
+
+		<dependency>
+			<groupId>org.apache.camel</groupId>
+			<artifactId>camel-core</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>com.googlecode.libphonenumber</groupId>
+			<artifactId>libphonenumber</artifactId>
+			<version>${libphonenumber-version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.httpcomponents</groupId>
+			<artifactId>httpclient-osgi</artifactId>
+			<version>${httpclient}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.jsoup</groupId>
+			<artifactId>jsoup</artifactId>
+			<version>${jsoup-version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>javax.validation</groupId>
+			<artifactId>validation-api</artifactId>
+			<version>${validation-api-version}</version>
+		</dependency>
+		<dependency>
+			<groupId>javax.el</groupId>
+			<artifactId>javax.el-api</artifactId>
+			<version>${javax.el-api-version}</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-validator</groupId>
+			<artifactId>commons-validator</artifactId>
+			<version>${commons-validator-version}</version>
+		</dependency>
+
+		<!-- test dependencies -->
+		<dependency>
+			<groupId>org.apache.camel</groupId>
+			<artifactId>camel-test-spring</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.camel</groupId>
+			<artifactId>camel-spring-javaconfig</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-log4j12</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate-validator</artifactId>
+			<version>${hibernate-validator-version}</version>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
new file mode 100644
index 0000000..ccd701f
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMComponent.java
@@ -0,0 +1,104 @@
+/**
+ * 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.cm;
+
+import java.util.Map;
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.apache.camel.BeanInject;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
+import org.apache.camel.component.cm.exceptions.InvalidURLException;
+import org.apache.camel.component.cm.exceptions.InvalidUriEndpointException;
+import org.apache.camel.impl.UriEndpointComponent;
+import org.apache.camel.util.URISupport;
+import org.apache.commons.validator.routines.UrlValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Represents the component that manages {@link CMEndpoint}s.
+ */
+public class CMComponent extends UriEndpointComponent {
+
+    private static final Logger LOG = LoggerFactory.getLogger(CMComponent.class);
+
+    @BeanInject
+    private Validator validator;
+
+    // public CMComponent() {
+    // super(CMEndpoint.class);
+    // }
+
+    public CMComponent(final CamelContext context) {
+        super(context, CMEndpoint.class);
+    }
+
+    /**
+     * Endpoints factory
+     */
+    @Override
+    protected Endpoint createEndpoint(final String uri, final String remaining, final Map<String, Object> parameters) throws Exception {
+
+        LOG.info("Creating CM Endpoint ... ");
+
+        final String url = CMConstants.DEFAULT_SCHEME + remaining;
+        if (!UrlValidator.getInstance().isValid(url)) {
+            final String errorMessage = String.format("HOST provided: %s seem to be invalid. Remember SCHEME has to be excluded.", url);
+            final Exception t = new InvalidURLException(errorMessage);
+            LOG.error(errorMessage, t);
+            throw t;
+        }
+
+        LOG.info("Uri=[{}], path=[{}], parameters=[{}]", new Object[] {URISupport.sanitizeUri(uri), URISupport.sanitizePath(remaining), parameters });
+
+        // Set configuration based on uri parameters
+        final CMConfiguration config = new CMConfiguration();
+        setProperties(config, parameters);
+
+        // Validate configuration
+        LOG.info("Validating uri based configuration");
+        final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(config);
+        if (constraintViolations.size() > 0) {
+            final StringBuffer msg = new StringBuffer();
+            for (final ConstraintViolation<CMConfiguration> cv : constraintViolations) {
+                msg.append(String.format("- Invalid value for %s: %s", cv.getPropertyPath().toString(), cv.getMessage()));
+            }
+            LOG.error(msg.toString());
+            throw new InvalidUriEndpointException(msg.toString());
+        }
+        LOG.info("CMConfiguration - OK!");
+
+        // Component is an Endpoint factory. So far, just one Endpoint type.
+        // Endpoint construction and configuration.
+
+        LOG.info("Creating CMEndpoint");
+        final CMEndpoint endpoint = new CMEndpoint(uri, this);
+        endpoint.setConfiguration(config);
+        endpoint.setHost(remaining);
+
+        return endpoint;
+    }
+
+    public Validator getValidator() {
+        return validator;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConfiguration.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConfiguration.java
new file mode 100644
index 0000000..c95c06e
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConfiguration.java
@@ -0,0 +1,92 @@
+/**
+ * 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.cm;
+
+import java.util.UUID;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+
+@UriParams
+public class CMConfiguration {
+
+    @UriParam
+    @NotNull
+    private UUID productToken;
+
+    /**
+     * This is the sender name. The maximum length is 11 characters.
+     */
+    @UriParam
+    @NotNull
+    @Size(min = 1, max = 11)
+    private String defaultFrom;
+
+    /**
+     * If it is a multipart message forces the max number. Message can be truncated. Technically the gateway will first check if a message is larger than 160 characters, if so, the message will be cut
+     * into multiple 153 characters parts limited by these parameters. <br>
+     * {@link https://dashboard.onlinesmsgateway.com/docs#send-a-message-multipart}
+     */
+    @UriParam
+    @Max(8)
+    @Min(1)
+    private int defaultMaxNumberOfParts = 8;
+
+    @UriParam
+    private boolean testConnectionOnStartup;
+
+    public UUID getProductToken() {
+        return productToken;
+    }
+
+    public void setProductToken(String productTokenAsString) {
+        productToken = UUID.fromString(productTokenAsString);
+    }
+
+    public String getDefaultFrom() {
+        return defaultFrom;
+    }
+
+    public void setDefaultFrom(final String defaultFrom) {
+        this.defaultFrom = defaultFrom;
+    }
+
+    public int getDefaultMaxNumberOfParts() {
+        return defaultMaxNumberOfParts;
+    }
+
+    public void setDefaultMaxNumberOfParts(final int defaultMaxNumberOfParts) {
+        this.defaultMaxNumberOfParts = defaultMaxNumberOfParts;
+    }
+
+    public boolean isTestConnectionOnStartup() {
+        return testConnectionOnStartup;
+    }
+
+    public void setTestConnectionOnStartup(final boolean testConnectionOnStartup) {
+        this.testConnectionOnStartup = testConnectionOnStartup;
+    }
+
+    public void setProductTokenAsUUID(final UUID productToken) {
+        this.productToken = productToken;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConstants.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConstants.java
new file mode 100644
index 0000000..ad8bfc4
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMConstants.java
@@ -0,0 +1,39 @@
+/**
+ * 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.cm;
+
+public interface CMConstants {
+
+    String DEFAULT_SCHEME = "https://";
+
+    int DEFAULT_MULTIPARTS = 8;
+
+    int MAX_UNICODE_MESSAGE_LENGTH = 70;
+    int MAX_GSM_MESSAGE_LENGTH = 160;
+    int MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART = 67;
+    int MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART = 153;
+
+    // status code 200 - Error substrings - checkk it contains.
+    String ERROR_UNKNOWN = "Unknown error";
+    String ERROR_NO_ACCOUNT = "No account found";
+    String ERROR_INSUFICIENT_BALANCE = "Insufficient balance";
+    String ERROR_UNROUTABLE_MESSAGE = "Message is unroutable";
+    String ERROR_INVALID_PRODUCT_TOKEN = "Invalid product token";
+
+    String GSM_CHARACTERS_REGEX = "^[A-Za-z0-9 \\r\\n@£$¥èéùìòÇØøÅå\u0394_\u03A6\u0393\u039B\u03A9"
+                                  + "\u03A0\u03A8\u03A3\u0398\u039EÆæßÉ!\"#$%&amp;'()*+,\\-./:;&lt;=&gt;?¡ÄÖÑܧ¿äöñüà^{}\\\\\\[~\\]|\u20AC]*$";
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMEndpoint.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMEndpoint.java
new file mode 100644
index 0000000..0aa34d2
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMEndpoint.java
@@ -0,0 +1,141 @@
+/**
+ * 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.cm;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.api.management.ManagedAttribute;
+import org.apache.camel.api.management.ManagedOperation;
+import org.apache.camel.api.management.ManagedResource;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriPath;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@ManagedResource(description = "CM SMS Endpoint")
+// @UriEndpoint(scheme = "cm", title = "CM DIRECT SMS", syntax = "cm:host",
+// label = "sms provider", producerOnly = true)
+public class CMEndpoint extends DefaultEndpoint {
+
+    private static final Logger LOG = LoggerFactory.getLogger(CMEndpoint.class);
+
+    @UriPath
+    @Metadata(description = "SMS Provider HOST with scheme", required = "true")
+    private String host;
+
+    /**
+     * data needed for exchange interaction
+     */
+    private CMConfiguration configuration;
+
+    private CMProducer producer;
+
+    /**
+     * Constructs a partially-initialized CMEndpoint instance. Useful when creating endpoints manually (e.g., as beans in Spring).
+     */
+    // We are just going to allow fully initialized endpoint instances
+    // public CMEndpoint() {
+    // }
+
+    /**
+     * Constructs a fully-initialized CMEndpoint instance. This is the preferred method of constructing an object from Java code (as opposed to Spring beans, etc.).
+     *
+     * @param endpointUri the full URI used to create this endpoint
+     * @param component the component that created this endpoint
+     */
+    public CMEndpoint(final String uri, final CMComponent component) {
+        super(uri, component);
+        setExchangePattern(ExchangePattern.InOut);
+        LOG.info("CM Endpoint created - (IN/OUT)");
+    }
+
+    /**
+     * Provides a channel on which clients can send Messages to a CM Endpoint
+     */
+    @Override
+    public Producer createProducer() throws Exception {
+        final CMConfiguration config = getConfiguration();
+
+        // This is the camel exchange processor. Allows to send messages to CM
+        // API.
+        // TODO: Should i provide a CMSender factory? Dynamically choose
+        // CMSender implementation? Sending strategy?
+        // Consider:
+        // 1. single - Single Message strategy.
+        // 2. Multi - CM Api supports to 1000 messages per call.
+        // 3. sliding - sliding window? 1000 messages or time thresold?
+        // 4. mocked - in order to fake cm responses
+
+        // CMConstants.DEFAULT_SCHEME + host is a valid URL. It was previously
+        // checked
+        LOG.debug("Creating CM Producer");
+        producer = new CMProducer(this, new CMSenderOneMessageImpl(getCMUrl(), config.getProductToken()));
+        LOG.debug("CM Producer: OK!");
+        return producer;
+    }
+
+    @Override
+    public Consumer createConsumer(final Processor processor) throws Exception {
+
+        throw new RuntimeCamelException("So far, cannot consume from CM Endpoint: " + getEndpointUri());
+    }
+
+    public CMConfiguration getConfiguration() {
+        return configuration;
+    }
+
+    public void setConfiguration(final CMConfiguration configuration) {
+        this.configuration = configuration;
+    }
+
+    @Override
+    public boolean isSingleton() {
+        return true;
+    }
+
+    // @Override
+    // public Exchange createExchange() {
+    // return super.createExchange();
+    // }
+
+    @ManagedAttribute
+    public String getHost() {
+        return host;
+    }
+
+    public String getCMUrl() {
+        return CMConstants.DEFAULT_SCHEME + host;
+    }
+
+    @ManagedOperation(description = "Dynamically modify Service HOST")
+    public void setHost(final String host) {
+        this.host = host;
+    }
+
+    @Override
+    public CMComponent getComponent() {
+        return (CMComponent) super.getComponent();
+    }
+
+    public CMProducer getProducer() {
+        return producer;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMMessage.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMMessage.java
new file mode 100644
index 0000000..2f98936
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMMessage.java
@@ -0,0 +1,153 @@
+/**
+ * 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.cm;
+
+/**
+ * Valid message to be serialized and sent to CM Endpoints. If the message only uses GSM 7-bit characters, then 160 characters will fit in 1 SMS part, and 153*n characters will fit in n SMS parts for
+ * n>1. If the message contains other characters, then only 70 characters will fit in 1 SMS part, and 67*n characters will fit in n SMS parts for n>1. <br>
+ * <br>
+ * {@link https://dashboard.onlinesmsgateway.com/docs} <br>
+ * {@link http://support.telerivet.com/customer/portal/articles/1957426-multipart-unicode-sms-messages}
+ */
+public class CMMessage {
+
+    /**
+     * Restrictions: 1 - 32 alphanumeric characters and reference will not work for demo accounts
+     */
+    // TODO: use a ID generator?
+    private String idAsString;
+
+    private String phoneNumber;
+    private String message;
+
+    private String sender;
+
+    private boolean unicode;
+    private int multipart = 1;
+
+    public CMMessage(final String phoneNumber, final String message) {
+        this.message = message;
+        this.phoneNumber = phoneNumber;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(final String message) {
+        this.message = message;
+    }
+
+    public String getPhoneNumber() {
+        return phoneNumber;
+    }
+
+    public void setPhoneNumber(final String phoneNumber) {
+        this.phoneNumber = phoneNumber;
+    }
+
+    public String getSender() {
+        return sender;
+    }
+
+    public void setSender(final String sender) {
+        this.sender = sender;
+    }
+
+    public String getIdAsString() {
+        return idAsString;
+    }
+
+    public void setIdAsString(final String idAsString) {
+        this.idAsString = idAsString;
+    }
+
+    public boolean isUnicode() {
+        return unicode;
+    }
+
+    public void setUnicode(final boolean unicode) {
+        this.unicode = unicode;
+    }
+
+    public boolean isMultipart() {
+        return multipart > 1;
+    }
+
+    /**
+     * For a CMMessage instance
+     *
+     * @param defaultMaxNumberOfParts
+     */
+    public void setUnicodeAndMultipart(int defaultMaxNumberOfParts) {
+
+        // Set UNICODE and MULTIPART
+        final String msg = getMessage();
+        if (CMUtils.isGsm0338Encodeable(msg)) {
+
+            // Not Unicode is Multipart?
+            if (msg.length() > CMConstants.MAX_GSM_MESSAGE_LENGTH) {
+
+                // Multiparts. 153 caracteres max per part
+                int parts = msg.length() / CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART;
+                if (msg.length() % CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART != 0) {
+                    parts++;
+                }
+
+                setMultiparts((parts > defaultMaxNumberOfParts) ? defaultMaxNumberOfParts : parts);
+            } else { // Otherwise multipart = 1
+                setMultiparts(1);
+            }
+        } else {
+            // Unicode Message
+            setUnicode(true);
+
+            if (msg.length() > CMConstants.MAX_UNICODE_MESSAGE_LENGTH) {
+
+                // Multiparts. 67 caracteres max per part
+                int parts = msg.length() / CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART;
+                if (msg.length() % CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART != 0) {
+                    parts++;
+                }
+
+                setMultiparts((parts > defaultMaxNumberOfParts) ? defaultMaxNumberOfParts : parts);
+            } else { // Otherwise multipart = 1
+                setMultiparts(1);
+            }
+        }
+    }
+
+    public void setMultiparts(final int multipart) {
+        this.multipart = multipart;
+    }
+
+    public int getMultiparts() {
+        return multipart;
+    }
+
+    @Override
+    public String toString() {
+
+        StringBuffer sb = new StringBuffer(" {phoneNumber: " + phoneNumber + ", message: " + message + ", sender=" + sender + ", unicode: " + unicode + ", multipart: " + multipart);
+        if (idAsString != null && !idAsString.isEmpty()) {
+            sb.append(", idAsString=" + idAsString);
+        }
+        sb.append(" }");
+        return sb.toString();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java
new file mode 100644
index 0000000..d175750
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMProducer.java
@@ -0,0 +1,165 @@
+/**
+ * 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.cm;
+
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.component.cm.client.SMSMessage;
+import org.apache.camel.component.cm.exceptions.HostUnavailableException;
+import org.apache.camel.component.cm.exceptions.InvalidPayloadException;
+import org.apache.camel.impl.DefaultProducer;
+import org.apache.http.client.methods.HttpHead;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * is the exchange processor. Sends a validated sms message to CM Endpoints.
+ */
+public class CMProducer extends DefaultProducer {
+
+    private static final Logger LOG = LoggerFactory.getLogger(CMProducer.class);
+
+    private Validator validator;
+
+    /**
+     * sends a valid message to CM endpoints.
+     */
+    private CMSender sender;
+
+    public CMProducer(final CMEndpoint endpoint, final CMSender sender) {
+        super(endpoint);
+        this.sender = sender;
+    }
+
+    /**
+     * Producer is a exchange processor. This process is built in several steps. 1. Validate message receive from client 2. Send validated message to CM endpoints. 3. Process response from CM
+     * endpoints.
+     */
+    @Override
+    public void process(final Exchange exchange) {
+
+        try {
+
+            // Immutable message receive from clients.
+            final SMSMessage smsMessage = exchange.getIn().getBody(SMSMessage.class);
+            if (smsMessage == null) {
+                throw new NullPointerException();
+            }
+
+            // Validates Payload - SMSMessage
+            LOG.trace("Validating SMSMessage instance provided: {}", smsMessage.toString());
+            final Set<ConstraintViolation<SMSMessage>> constraintViolations = getValidator().validate(smsMessage);
+            if (constraintViolations.size() > 0) {
+                final StringBuffer msg = new StringBuffer();
+                for (final ConstraintViolation<SMSMessage> cv : constraintViolations) {
+                    msg.append(String.format("- Invalid value for %s: %s", cv.getPropertyPath().toString(), cv.getMessage()));
+                }
+                throw new InvalidPayloadException(msg.toString());
+            }
+            LOG.trace("SMSMessage instance is valid: {}", smsMessage.toString());
+
+            // We have a valid (immutable) SMSMessage instance, lets extend to CMMessage
+            // This is the instance we will use to build the XML document to be
+            // sent to CM SMS GW.
+            final CMMessage cmMessage = new CMMessage(smsMessage.getPhoneNumber(), smsMessage.getMessage());
+            LOG.debug("CMMessage instance build from valid SMSMessage instance");
+
+            if (smsMessage.getFrom() == null || smsMessage.getFrom().isEmpty()) {
+                String df = getConfiguration().getDefaultFrom();
+                cmMessage.setSender(df);
+                LOG.debug("Dynamic sender is set to default dynamic sender: {}", df);
+            }
+
+            // Remember, this can be null.
+            cmMessage.setIdAsString(smsMessage.getId());
+
+            // Unicode and multipart
+            cmMessage.setUnicodeAndMultipart(getConfiguration().getDefaultMaxNumberOfParts());
+
+            // 2. Send a validated sms message to CM endpoints
+            // throws MessagingException for abnormal situations.
+            sender.send(cmMessage);
+
+            log.debug("Request accepted by CM Host: {}", cmMessage.toString());
+        } catch (final NullPointerException e) {
+            // Body hast to be an instance of SMSMessage
+            final String m = "Check Message body - Has to be an SMSMessage instance";
+            log.error(m, e);
+            exchange.setException(new InvalidPayloadException(m));
+        } catch (final RuntimeException e) {
+            log.error("Message cannot be sent ", e);
+            exchange.setException(e);
+        }
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+
+        // log at debug level for singletons, for prototype scoped log at trace
+        // level to not spam logs
+
+        log.debug("Starting CMProducer");
+
+        final CMConfiguration configuration = getConfiguration();
+
+        if (configuration.isTestConnectionOnStartup()) {
+            try {
+                log.debug("Checking connection - {}", getEndpoint().getCMUrl());
+                HttpClientBuilder.create().build().execute(new HttpHead(getEndpoint().getCMUrl()));
+                log.info("Connection to {}: OK", getEndpoint().getCMUrl());
+            } catch (final Exception e) {
+                log.info("Connection to {}: NOT AVAILABLE", getEndpoint().getCMUrl());
+                throw new HostUnavailableException(e);
+            }
+        }
+
+        // keep starting
+        super.doStart();
+
+        log.info("CMProducer started");
+    }
+
+    @Override
+    public CMEndpoint getEndpoint() {
+        return (CMEndpoint) super.getEndpoint();
+    }
+
+    public CMConfiguration getConfiguration() {
+        return getEndpoint().getConfiguration();
+    }
+
+    public Validator getValidator() {
+        if (validator == null) {
+            validator = getEndpoint().getComponent().getValidator();
+        }
+        return validator;
+    }
+
+    public CMSender getSender() {
+        return sender;
+    }
+
+    public void setSender(CMSender sender) {
+        this.sender = sender;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSender.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSender.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSender.java
new file mode 100644
index 0000000..d3eceeb
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSender.java
@@ -0,0 +1,30 @@
+/**
+ * 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.cm;
+
+import org.apache.camel.component.cm.exceptions.MessagingException;
+
+/**
+ * Sends a validated sms message to CM endpoints
+ */
+public interface CMSender {
+
+    /**
+     * Sends a validated sms message to CM Endpoints.
+     */
+    void send(CMMessage cmMessage) throws MessagingException;
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
new file mode 100644
index 0000000..fc69fc5
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMSenderOneMessageImpl.java
@@ -0,0 +1,263 @@
+/**
+ * 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.cm;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.nio.charset.Charset;
+import java.util.UUID;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Text;
+
+import org.apache.camel.component.cm.exceptions.MessagingException;
+import org.apache.camel.component.cm.exceptions.ProviderException;
+import org.apache.camel.component.cm.exceptions.XMLConstructionException;
+import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
+import org.apache.camel.component.cm.exceptions.cmresponse.InsufficientBalanceException;
+import org.apache.camel.component.cm.exceptions.cmresponse.InvalidProductTokenException;
+import org.apache.camel.component.cm.exceptions.cmresponse.NoAccountFoundForProductTokenException;
+import org.apache.camel.component.cm.exceptions.cmresponse.UnknownErrorException;
+import org.apache.camel.component.cm.exceptions.cmresponse.UnroutableMessageException;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CMSenderOneMessageImpl implements CMSender {
+
+    private static final Logger LOG = LoggerFactory.getLogger(CMSenderOneMessageImpl.class);
+
+    private final String url;
+    private final UUID productToken;
+
+    public CMSenderOneMessageImpl(final String url, final UUID productToken) {
+
+        this.url = url;
+        this.productToken = productToken;
+    }
+
+    /**
+     * Sends a previously validated SMSMessage to CM endpoint
+     */
+    @Override
+    public void send(final CMMessage cmMessage) throws MessagingException {
+
+        // See: Check https://dashboard.onlinesmsgateway.com/docs for responses
+
+        try {
+
+            // 1.Construct XML. Throws XMLConstructionException
+            final String xml = createXml(cmMessage);
+
+            // 2. Try to send to CM SMS Provider ...Throws CMResponse
+            doHttpPost(url, xml);
+        } catch (final RuntimeException e) {
+            LOG.error("Failed to send SMS: {}", cmMessage, e);
+            throw e; // XMLConstrucion o
+        }
+    }
+
+    private String createXml(final CMMessage message) {
+
+        try {
+
+            final ByteArrayOutputStream xml = new ByteArrayOutputStream();
+            final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            factory.setNamespaceAware(true);
+
+            // Get the DocumentBuilder
+            final DocumentBuilder docBuilder = factory.newDocumentBuilder();
+
+            // Create blank DOM Document
+            final DOMImplementation impl = docBuilder.getDOMImplementation();
+            final Document doc = impl.createDocument(null, "MESSAGES", null);
+
+            // ROOT Element es MESSAGES
+            final Element root = doc.getDocumentElement();
+
+            // AUTHENTICATION element
+            final Element authenticationElement = doc.createElement("AUTHENTICATION");
+            final Element productTokenElement = doc.createElement("PRODUCTTOKEN");
+            authenticationElement.appendChild(productTokenElement);
+            final Text productTokenValue = doc.createTextNode("" + productToken);
+            productTokenElement.appendChild(productTokenValue);
+            root.appendChild(authenticationElement);
+
+            // MSG Element
+            final Element msgElement = doc.createElement("MSG");
+            root.appendChild(msgElement);
+
+            // <FROM>VALUE</FROM>
+            final Element fromElement = doc.createElement("FROM");
+            fromElement.appendChild(doc.createTextNode(message.getSender()));
+            msgElement.appendChild(fromElement);
+
+            // <BODY>VALUE</BODY>
+            final Element bodyElement = doc.createElement("BODY");
+            bodyElement.appendChild(doc.createTextNode(message.getMessage()));
+            msgElement.appendChild(bodyElement);
+
+            // <TO>VALUE</TO>
+            final Element toElement = doc.createElement("TO");
+            toElement.appendChild(doc.createTextNode(message.getPhoneNumber()));
+            msgElement.appendChild(toElement);
+
+            // <DCS>VALUE</DCS> - if UNICODE - messageOut.isGSM338Enc
+            // false
+            if (message.isUnicode()) {
+                final Element dcsElement = doc.createElement("DCS");
+                dcsElement.appendChild(doc.createTextNode("8"));
+                msgElement.appendChild(dcsElement);
+            }
+
+            // <REFERENCE>VALUE</REFERENCE> -Alfanum
+            final String id = message.getIdAsString();
+            if (id != null && !id.isEmpty()) {
+                final Element refElement = doc.createElement("REFERENCE");
+                refElement.appendChild(doc.createTextNode("" + message.getIdAsString()));
+                msgElement.appendChild(refElement);
+            }
+
+            // <MINIMUMNUMBEROFMESSAGEPARTS>1</MINIMUMNUMBEROFMESSAGEPARTS>
+            // <MAXIMUMNUMBEROFMESSAGEPARTS>8</MAXIMUMNUMBEROFMESSAGEPARTS>
+            if (message.isMultipart()) {
+                final Element minMessagePartsElement = doc.createElement("MINIMUMNUMBEROFMESSAGEPARTS");
+                minMessagePartsElement.appendChild(doc.createTextNode("1"));
+                msgElement.appendChild(minMessagePartsElement);
+
+                final Element maxMessagePartsElement = doc.createElement("MAXIMUMNUMBEROFMESSAGEPARTS");
+                maxMessagePartsElement.appendChild(doc.createTextNode(Integer.toString(message.getMultiparts())));
+                msgElement.appendChild(maxMessagePartsElement);
+            }
+
+            // Creatate XML as String
+            final Transformer aTransformer = TransformerFactory.newInstance().newTransformer();
+            aTransformer.setOutputProperty(OutputKeys.INDENT, "yes");
+            final Source src = new DOMSource(doc);
+            final Result dest = new StreamResult(xml);
+            aTransformer.transform(src, dest);
+            return xml.toString();
+        } catch (final TransformerException e) {
+            LOG.error("Cant serialize CMMessage {}: ", message, e);
+            throw new XMLConstructionException(e);
+        } catch (final ParserConfigurationException e) {
+            LOG.error("Cant serialize CMMessage {}: ", message, e);
+            throw new XMLConstructionException(e);
+        }
+    }
+
+    private void doHttpPost(final String urlString, final String requestString) {
+
+        final HttpClient client = HttpClientBuilder.create().build();
+        final HttpPost post = new HttpPost(urlString);
+        post.setEntity(new StringEntity(requestString, Charset.forName("UTF-8")));
+
+        try {
+
+            final HttpResponse response = client.execute(post);
+
+            final int statusCode = response.getStatusLine().getStatusCode();
+
+            LOG.debug("Response Code : {}", statusCode);
+
+            if (statusCode == 400) {
+                throw new ProviderException("CM Component and CM API show some kind of inconsistency. "
+                                            + "CM is complaining about not using a post method for the request. And this component only uses POST requests. What happens?");
+            }
+
+            if (statusCode != 200) {
+                throw new ProviderException("CM Component and CM API show some kind of inconsistency. The component expects the status code to be 200 or 400. New api released? ");
+            }
+
+            // So we have 200 status code...
+
+            // The response type is 'text/plain' and contains the actual
+            // result of the request processing.
+
+            // We obtaing the result text
+            final BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+
+            final StringBuffer result = new StringBuffer();
+            String line = null;
+            while ((line = rd.readLine()) != null) {
+                result.append(line);
+            }
+
+            // ... and process it
+
+            line = result.toString();
+            if (!line.isEmpty()) {
+
+                // Line is not empty = error
+                LOG.debug("Result of the request processing: FAILED\n{}", line);
+
+                // The response text contains the error description. We will
+                // throw a custom exception for each.
+
+                if (line.contains(CMConstants.ERROR_UNKNOWN)) {
+                    throw new UnknownErrorException();
+                } else if (line.contains(CMConstants.ERROR_NO_ACCOUNT)) {
+                    throw new NoAccountFoundForProductTokenException();
+                } else if (line.contains(CMConstants.ERROR_INSUFICIENT_BALANCE)) {
+                    throw new InsufficientBalanceException();
+                } else if (line.contains(CMConstants.ERROR_UNROUTABLE_MESSAGE)) {
+                    throw new UnroutableMessageException();
+                } else if (line.contains(CMConstants.ERROR_INVALID_PRODUCT_TOKEN)) {
+                    throw new InvalidProductTokenException();
+                } else {
+
+                    // SO FAR i would expect other kind of ERROR.
+
+                    // MSISDN correctness and message validity is client
+                    // responsibility
+                    throw new CMResponseException("CHECK ME. I am not expecting this. ");
+                }
+            }
+
+            // Ok. Line is EMPTY - successfully submitted
+            LOG.debug("Result of the request processing: Successfully submited");
+        } catch (final IOException io) {
+            throw new ProviderException(io);
+        } catch (Throwable t) {
+            if (!(t instanceof MessagingException)) {
+                // Chain it
+                t = new MessagingException(t);
+            }
+            throw (MessagingException) t;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMUtils.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMUtils.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMUtils.java
new file mode 100644
index 0000000..932e99f
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/CMUtils.java
@@ -0,0 +1,30 @@
+/**
+ * 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.cm;
+
+public final class CMUtils {
+
+    private CMUtils() {
+    }
+
+    public static boolean isGsm0338Encodeable(final String message) {
+        return message.matches(CMConstants.GSM_CHARACTERS_REGEX);
+    }
+
+    // TODO: Have a look at
+    // https:// github.com/apache/camel/blob/master/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/client/SMSMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/client/SMSMessage.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/client/SMSMessage.java
new file mode 100644
index 0000000..869c9f8
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/client/SMSMessage.java
@@ -0,0 +1,114 @@
+/**
+ * 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.cm.client;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
+
+import org.apache.camel.component.cm.validation.constraints.E164;
+
+/**
+ * Immutable. The message instance provided by the client.
+ */
+public class SMSMessage {
+
+    /**
+     * Required MSISDN. E164 value. The destination phone number. Format with a '+' and country code.
+     *
+     * @see <a href="https://en.wikipedia.org/wiki/E.164">https://en.wikipedia.org/wiki/E.164</a>
+     */
+    @E164
+    private final String phoneNumber;
+
+    /**
+     * This is the message to be sent. 2 options:
+     * <ul>
+     * <li>If the message is GSM 0038 encodeable the gateway will first check if a message is larger than 160 characters, if so, the message will be cut into multiple 153 characters parts limited by
+     * defaultMaxNumberOfParts set in the component uri.</li>
+     * <li>Otherwise, the gateway will check if a message is larger than 70 characters, if so, the message will be cut into multiple 67 characters parts to a maximum of defaultMaxNumberOfParts set in
+     * the component uri.</li>
+     * </ul>
+     *
+     * @see <a href="https://en.wikipedia.org/wiki/GSM_03.38">E.164</a>
+     */
+    @NotNull
+    private final String message;
+
+    /**
+     * This is an optional dynamic sender name.
+     * <p>
+     * 1 - 11 alphanumeric characters and + char. Not Empty Strings. This field has a maximum length of 11 characters. If it is not set the defaultFrom required to configure the component will be set.
+     */
+    @Size(min = 1, max = 11)
+    @Pattern(regexp = "^[A-Za-z0-9]+$")
+    private final String from;
+
+    /**
+     * Unique identifier for a message.
+     * <p>
+     * 1 - 32 alphanumeric characters. Not Empty Strings. Will not work for demo accounts. This field corresponds to REFERENCE parameter in CM Api.
+     */
+    @Size(min = 1, max = 32)
+    @Pattern(regexp = "^[A-Za-z0-9]+$")
+    private final String id;
+
+    public SMSMessage(final String message, final String phoneNumber) {
+        this(null, message, phoneNumber, null);
+    }
+
+    public SMSMessage(String id, final String message, final String phoneNumber) {
+        this(id, message, phoneNumber, null);
+    }
+
+    public SMSMessage(final String id, final String message, final String phoneNumber, final String from) {
+        this.id = id;
+        this.message = message;
+        this.phoneNumber = phoneNumber;
+        this.from = from;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public String getPhoneNumber() {
+        return phoneNumber;
+    }
+
+    public String getFrom() {
+        return from;
+    }
+
+    @Override
+    public String toString() {
+        StringBuffer toS = new StringBuffer("{phoneNumber: " + phoneNumber + ", message: " + message);
+        if (from != null && !from.isEmpty()) {
+            toS.append(", from: " + from);
+        }
+        if (id != null && !id.isEmpty()) {
+            toS.append(", id: " + id);
+        }
+        toS.append(" }");
+        return toS.toString();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/client/Translator.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/client/Translator.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/client/Translator.java
new file mode 100644
index 0000000..4c6e9e9
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/client/Translator.java
@@ -0,0 +1,23 @@
+/**
+ * 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.cm.client;
+
+public interface Translator<T> {
+
+    SMSMessage translate(T t);
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/CMDirectException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/CMDirectException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/CMDirectException.java
new file mode 100644
index 0000000..70912ff
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/CMDirectException.java
@@ -0,0 +1,40 @@
+/**
+ * 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.cm.exceptions;
+
+public class CMDirectException extends RuntimeException {
+
+    public CMDirectException() {
+    }
+
+    public CMDirectException(final String message) {
+        super(message);
+    }
+
+    public CMDirectException(final Throwable cause) {
+        super(cause);
+    }
+
+    public CMDirectException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public CMDirectException(final String message, final Throwable cause,
+            final boolean enableSuppression, final boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/CMValidationException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/CMValidationException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/CMValidationException.java
new file mode 100644
index 0000000..65cfaff
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/CMValidationException.java
@@ -0,0 +1,40 @@
+/**
+ * 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.cm.exceptions;
+
+public class CMValidationException extends CMDirectException {
+
+    public CMValidationException() {
+    }
+
+    public CMValidationException(final String message) {
+        super(message);
+    }
+
+    public CMValidationException(final Throwable cause) {
+        super(cause);
+    }
+
+    public CMValidationException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public CMValidationException(final String message, final Throwable cause,
+            final boolean enableSuppression, final boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/HostUnavailableException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/HostUnavailableException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/HostUnavailableException.java
new file mode 100644
index 0000000..4e1348c
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/HostUnavailableException.java
@@ -0,0 +1,40 @@
+/**
+ * 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.cm.exceptions;
+
+public class HostUnavailableException extends MessagingException {
+
+    public HostUnavailableException() {
+    }
+
+    public HostUnavailableException(final String message) {
+        super(message);
+    }
+
+    public HostUnavailableException(final Throwable cause) {
+        super(cause);
+    }
+
+    public HostUnavailableException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public HostUnavailableException(final String message, final Throwable cause,
+            final boolean enableSuppression, final boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidPayloadException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidPayloadException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidPayloadException.java
new file mode 100644
index 0000000..0cf8385
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidPayloadException.java
@@ -0,0 +1,44 @@
+/**
+ * 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.cm.exceptions;
+
+/**
+ * The body has to be an instance of CMMessage.
+ *
+ */
+public class InvalidPayloadException extends CMValidationException {
+
+    public InvalidPayloadException() {
+    }
+
+    public InvalidPayloadException(final String message) {
+        super(message);
+    }
+
+    public InvalidPayloadException(final Throwable cause) {
+        super(cause);
+    }
+
+    public InvalidPayloadException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public InvalidPayloadException(final String message, final Throwable cause,
+            final boolean enableSuppression, final boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidURLException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidURLException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidURLException.java
new file mode 100644
index 0000000..9f26a5b
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidURLException.java
@@ -0,0 +1,30 @@
+/**
+ * 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.cm.exceptions;
+
+/**
+ * Invalid Resource URL - CM Hosts
+ */
+public class InvalidURLException extends InvalidUriEndpointException {
+
+    public InvalidURLException() {
+    }
+
+    public InvalidURLException(final String message) {
+        super(message);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidUriEndpointException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidUriEndpointException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidUriEndpointException.java
new file mode 100644
index 0000000..449df1b
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/InvalidUriEndpointException.java
@@ -0,0 +1,33 @@
+/**
+ * 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.cm.exceptions;
+
+/**
+ * CM Camel component s configuration is based on URI. This exception is raised
+ * when the uri provided for configuration is wrong
+ *
+ */
+public class InvalidUriEndpointException extends CMValidationException {
+
+    public InvalidUriEndpointException() {
+        super();
+    }
+
+    public InvalidUriEndpointException(final String message) {
+        super(message);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/MessagingException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/MessagingException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/MessagingException.java
new file mode 100644
index 0000000..ddf9c87
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/MessagingException.java
@@ -0,0 +1,40 @@
+/**
+ * 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.cm.exceptions;
+
+public class MessagingException extends CMDirectException {
+
+    public MessagingException() {
+    }
+
+    public MessagingException(final String message) {
+        super(message);
+    }
+
+    public MessagingException(final Throwable cause) {
+        super(cause);
+    }
+
+    public MessagingException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public MessagingException(final String message, final Throwable cause,
+            final boolean enableSuppression, final boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/ProviderException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/ProviderException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/ProviderException.java
new file mode 100644
index 0000000..e29ca4a
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/ProviderException.java
@@ -0,0 +1,41 @@
+/**
+ * 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.cm.exceptions;
+
+import org.apache.camel.component.cm.exceptions.cmresponse.CMResponseException;
+
+public class ProviderException extends CMResponseException {
+
+    public ProviderException() {
+    }
+
+    public ProviderException(final String message) {
+        super(message);
+    }
+
+    public ProviderException(final Throwable cause) {
+        super(cause);
+    }
+
+    public ProviderException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public ProviderException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/XMLConstructionException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/XMLConstructionException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/XMLConstructionException.java
new file mode 100644
index 0000000..a6dae02
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/XMLConstructionException.java
@@ -0,0 +1,39 @@
+/**
+ * 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.cm.exceptions;
+
+public class XMLConstructionException extends MessagingException {
+
+    public XMLConstructionException() {
+    }
+
+    public XMLConstructionException(final String message) {
+        super(message);
+    }
+
+    public XMLConstructionException(final Throwable cause) {
+        super(cause);
+    }
+
+    public XMLConstructionException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public XMLConstructionException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/CMResponseException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/CMResponseException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/CMResponseException.java
new file mode 100644
index 0000000..7251c51
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/CMResponseException.java
@@ -0,0 +1,41 @@
+/**
+ * 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.cm.exceptions.cmresponse;
+
+import org.apache.camel.component.cm.exceptions.MessagingException;
+
+public class CMResponseException extends MessagingException {
+
+    public CMResponseException() {
+    }
+
+    public CMResponseException(final String message) {
+        super(message);
+    }
+
+    public CMResponseException(final Throwable cause) {
+        super(cause);
+    }
+
+    public CMResponseException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public CMResponseException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InsufficientBalanceException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InsufficientBalanceException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InsufficientBalanceException.java
new file mode 100644
index 0000000..bb73cc5
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InsufficientBalanceException.java
@@ -0,0 +1,26 @@
+/**
+ * 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.cm.exceptions.cmresponse;
+
+/**
+ * You are out of trial messages. Order new messages via your dashboard.
+ */
+public class InsufficientBalanceException extends CMResponseException {
+
+    public InsufficientBalanceException() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidMSISDNException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidMSISDNException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidMSISDNException.java
new file mode 100644
index 0000000..c80fbdd
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidMSISDNException.java
@@ -0,0 +1,23 @@
+/**
+ * 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.cm.exceptions.cmresponse;
+
+public class InvalidMSISDNException extends CMResponseException {
+
+    public InvalidMSISDNException() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidProductTokenException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidProductTokenException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidProductTokenException.java
new file mode 100644
index 0000000..ce81bcb
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/InvalidProductTokenException.java
@@ -0,0 +1,26 @@
+/**
+ * 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.cm.exceptions.cmresponse;
+
+/**
+ * Invalid or missing
+ */
+public class InvalidProductTokenException extends CMResponseException {
+
+    public InvalidProductTokenException() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c70e9db8/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoAccountFoundForProductTokenException.java
----------------------------------------------------------------------
diff --git a/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoAccountFoundForProductTokenException.java b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoAccountFoundForProductTokenException.java
new file mode 100644
index 0000000..a718ff3
--- /dev/null
+++ b/components/camel-cm/src/main/java/org/apache/camel/component/cm/exceptions/cmresponse/NoAccountFoundForProductTokenException.java
@@ -0,0 +1,28 @@
+/**
+ * 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.cm.exceptions.cmresponse;
+
+/**
+ * No account found for the provided product token.
+ *
+ * @author Omar
+ */
+public class NoAccountFoundForProductTokenException extends CMResponseException {
+
+    public NoAccountFoundForProductTokenException() {
+    }
+}