Search in sources :

Example 21 with SMSMessage

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

the class SMSMessageTest method testIdAsStringMaxLength.

@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());
}
Also used : SMSMessage(org.apache.camel.component.cm.client.SMSMessage) ConstraintViolation(javax.validation.ConstraintViolation) Test(org.junit.Test)

Example 22 with SMSMessage

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

the class SMSMessageTest method testE164NoPlusSignedNumberIsInvalid.

@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());
}
Also used : SMSMessage(org.apache.camel.component.cm.client.SMSMessage) ConstraintViolation(javax.validation.ConstraintViolation) Test(org.junit.Test)

Example 23 with SMSMessage

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

the class SMSMessageTest method testNullMessageField.

@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());
}
Also used : SMSMessage(org.apache.camel.component.cm.client.SMSMessage) ConstraintViolation(javax.validation.ConstraintViolation) Test(org.junit.Test)

Example 24 with SMSMessage

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

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