Search in sources :

Example 1 with CMProducer

use of org.apache.camel.component.cm.CMProducer 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 CMProducer

use of org.apache.camel.component.cm.CMProducer 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 CMProducer

use of org.apache.camel.component.cm.CMProducer 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 CMProducer

use of org.apache.camel.component.cm.CMProducer 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 CMProducer

use of org.apache.camel.component.cm.CMProducer in project camel by apache.

the class CMTest method testUnroutableMessageException.

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

Aggregations

CMEndpoint (org.apache.camel.component.cm.CMEndpoint)9 CMProducer (org.apache.camel.component.cm.CMProducer)9 SMSMessage (org.apache.camel.component.cm.client.SMSMessage)9 Test (org.junit.Test)9 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