Search in sources :

Example 1 with SMSMessage

use of org.apache.camel.component.cm.client.SMSMessage in project camel by apache.

the class CMTest method testInsufficientBalanceException.

@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);
}
Also used : CMEndpoint(org.apache.camel.component.cm.CMEndpoint) InsufficientBalanceExceptionSender(org.apache.camel.component.cm.test.mocks.cmsender.InsufficientBalanceExceptionSender) SMSMessage(org.apache.camel.component.cm.client.SMSMessage) CMProducer(org.apache.camel.component.cm.CMProducer) Test(org.junit.Test)

Example 2 with SMSMessage

use of org.apache.camel.component.cm.client.SMSMessage in project camel by apache.

the class CMTest method testUnknownErrorException.

@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);
}
Also used : CMEndpoint(org.apache.camel.component.cm.CMEndpoint) UnknownErrorExceptionSender(org.apache.camel.component.cm.test.mocks.cmsender.UnknownErrorExceptionSender) SMSMessage(org.apache.camel.component.cm.client.SMSMessage) CMProducer(org.apache.camel.component.cm.CMProducer) Test(org.junit.Test)

Example 3 with SMSMessage

use of org.apache.camel.component.cm.client.SMSMessage in project camel by apache.

the class CMTest method testInvalidMSISDNException.

@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);
}
Also used : CMEndpoint(org.apache.camel.component.cm.CMEndpoint) SMSMessage(org.apache.camel.component.cm.client.SMSMessage) CMProducer(org.apache.camel.component.cm.CMProducer) InvalidMSISDNExceptionSender(org.apache.camel.component.cm.test.mocks.cmsender.InvalidMSISDNExceptionSender) Test(org.junit.Test)

Example 4 with SMSMessage

use of org.apache.camel.component.cm.client.SMSMessage in project camel by apache.

the class CMTest method testNotPhoneNumberFoundException.

@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);
}
Also used : CMEndpoint(org.apache.camel.component.cm.CMEndpoint) SMSMessage(org.apache.camel.component.cm.client.SMSMessage) CMProducer(org.apache.camel.component.cm.CMProducer) NotPhoneNumberFoundExceptionSender(org.apache.camel.component.cm.test.mocks.cmsender.NotPhoneNumberFoundExceptionSender) Test(org.junit.Test)

Example 5 with SMSMessage

use of org.apache.camel.component.cm.client.SMSMessage in project camel by apache.

the class CMTest method testAsPartOfARoute.

// @DirtiesContext
@Test(expected = NoAccountFoundForProductTokenException.class)
public void testAsPartOfARoute() throws Exception {
    // Body
    final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), generateUnicodeMessage(), validNumber, null);
    cmProxy.send(smsMessage);
}
Also used : SMSMessage(org.apache.camel.component.cm.client.SMSMessage) Test(org.junit.Test)

Aggregations

SMSMessage (org.apache.camel.component.cm.client.SMSMessage)24 Test (org.junit.Test)23 ConstraintViolation (javax.validation.ConstraintViolation)12 CMEndpoint (org.apache.camel.component.cm.CMEndpoint)9 CMProducer (org.apache.camel.component.cm.CMProducer)9 PhoneNumber (com.google.i18n.phonenumbers.Phonenumber.PhoneNumber)1 InvalidPayloadRuntimeException (org.apache.camel.InvalidPayloadRuntimeException)1 CMResponseExceptionSender (org.apache.camel.component.cm.test.mocks.cmsender.CMResponseExceptionSender)1 InsufficientBalanceExceptionSender (org.apache.camel.component.cm.test.mocks.cmsender.InsufficientBalanceExceptionSender)1 InvalidMSISDNExceptionSender (org.apache.camel.component.cm.test.mocks.cmsender.InvalidMSISDNExceptionSender)1 InvalidProductTokenExceptionSender (org.apache.camel.component.cm.test.mocks.cmsender.InvalidProductTokenExceptionSender)1 NoAccountFoundForProductTokenExceptionSender (org.apache.camel.component.cm.test.mocks.cmsender.NoAccountFoundForProductTokenExceptionSender)1 NoMessageExceptionSender (org.apache.camel.component.cm.test.mocks.cmsender.NoMessageExceptionSender)1 NotPhoneNumberFoundExceptionSender (org.apache.camel.component.cm.test.mocks.cmsender.NotPhoneNumberFoundExceptionSender)1 UnknownErrorExceptionSender (org.apache.camel.component.cm.test.mocks.cmsender.UnknownErrorExceptionSender)1 UnroutableMessageExceptionSender (org.apache.camel.component.cm.test.mocks.cmsender.UnroutableMessageExceptionSender)1