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:39 UTC
[19/23] camel git commit: Polished
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>