Search in sources :

Example 6 with SMSMessage

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

the class CMTest method testSendInvalidPayload.

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

Example 7 with SMSMessage

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

the class SMSMessageTest method testE164IsValid.

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

Example 8 with SMSMessage

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

the class SMSMessageTest method testDynamicFromFieldMaxLength.

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

Example 9 with SMSMessage

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

the class SMSMessageTest method testDynamicFromFieldZeroLength.

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

Example 10 with SMSMessage

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

the class SMSMessageTest method testSMSMessageConstructor.

// @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"));
}
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