Search in sources :

Example 6 with CMProducer

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

the class CMTest method testCMResponseException.

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

Example 7 with CMProducer

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

the class CMTest method testNoAccountFoundForProductTokenException.

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

Example 8 with CMProducer

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

the class CMTest method testNoMessageException.

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

Example 9 with CMProducer

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

the class CMTest method testInvalidProductTokenException.

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