@Test
 public void testTerserPredicateNull() throws Exception {
   MockEndpoint mock = getMockEndpoint("mock:test3");
   mock.expectedMessageCount(1);
   template.sendBody("direct:test3", createADT01Message());
   assertMockEndpointsSatisfied();
 }
  @Test
  public void testABCClose() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    // we expect ABC in the published message
    // notice: Only 1 message is expected
    mock.expectedBodiesReceived("ABC");

    // send the first message
    template.sendBodyAndHeader("direct:start", "A", "myId", 1);
    // send the 2nd message with the same correlation key
    template.sendBodyAndHeader("direct:start", "B", "myId", 1);
    // the F message has another correlation key
    template.sendBodyAndHeader("direct:start", "F", "myId", 2);
    // now we have 3 messages with the same correlation key
    // and the Aggregator should publish the message
    template.sendBodyAndHeader("direct:start", "C", "myId", 1);

    // sending with correlation id 1 should fail as its closed
    try {
      template.sendBodyAndHeader("direct:start", "A2", "myId", 1);
    } catch (CamelExecutionException e) {
      ClosedCorrelationKeyException cause =
          assertIsInstanceOf(ClosedCorrelationKeyException.class, e.getCause());
      assertEquals("1", cause.getCorrelationKey());
    }

    assertMockEndpointsSatisfied();
  }
Пример #3
0
  @Test
  public void testFilePollerB() throws Exception {
    String expected = "xxx";
    final MockEndpoint mockEndpoint = getMockEndpoint("mock:" + routeATo);
    cc.getRouteDefinitions()
        .get(0)
        .adviceWith(
            cc,
            new RouteBuilder() {
              @Override
              public void configure() throws Exception {
                // intercept sending to mock:foo and do something else
                interceptSendToEndpoint(routeATo).to(mockEndpoint);
              }
            });

    mockEndpoint.expectedBodiesReceived(expected);

    Endpoint ep = cc.getEndpoint(routeAFrom);
    Assert.assertNotNull(ep);
    ProducerTemplate pt = cc.createProducerTemplate();
    pt.start();
    pt.sendBody(ep, expected);

    assertMockEndpointsSatisfied();
  }
 @Test
 @Ignore
 public void shouldNotThrowClassNotFoundException() throws InterruptedException {
   MockEndpoint mockEndpoint = camelContext.getEndpoint("mock:test", MockEndpoint.class);
   mockEndpoint.expectedMinimumMessageCount(5);
   mockEndpoint.assertIsSatisfied();
 }
 @Test
 public void testBlobStorePut() throws InterruptedException {
   MockEndpoint mockEndpoint = resolveMandatoryEndpoint("mock:results", MockEndpoint.class);
   mockEndpoint.expectedMessageCount(1);
   template.sendBody("direct:put", "Some message");
   mockEndpoint.assertIsSatisfied();
 }
  @Test
  public void testMarshall()
      throws InterruptedException, ParserConfigurationException, IOException, SAXException {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMessageCount(1);

    PurchaseOrder purchaseOrder = new PurchaseOrder();
    String name = "foo";
    purchaseOrder.setName(name);
    double price = 49;
    purchaseOrder.setPrice(price);
    double amount = 3;
    purchaseOrder.setAmount(amount);

    template.sendBody("direct:start", purchaseOrder);

    assertMockEndpointsSatisfied();

    String body = mock.getReceivedExchanges().get(0).getIn().getBody(String.class);
    DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    Element root = builder.parse(new InputSource(new StringReader(body))).getDocumentElement();

    assertEquals(name, root.getAttribute("name"));
    assertEquals(price + "", root.getAttribute("price"));
    assertEquals(amount + "", root.getAttribute("amount"));
  }
  public void testXPathSplitStream() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:splitted");
    mock.expectedMessageCount(size);
    mock.expectsNoDuplicates().body();

    assertMockEndpointsSatisfied();
  }
  @Test
  public void testInOnlyMultipleJMSHeadersAndExpiration() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMessageCount(1);
    mock.message(0).header("JMSPriority").isEqualTo(3);
    mock.message(0).header("JMSDeliveryMode").isEqualTo(2);

    long ttl = System.currentTimeMillis() + 2000;
    Map<String, Object> headers = new HashMap<String, Object>();
    headers.put("JMSPriority", 3);
    headers.put("JMSDeliveryMode", 2);
    headers.put("JMSExpiration", ttl);
    template.sendBodyAndHeaders(
        "activemq:queue:bar?preserveMessageQos=true", "Hello World", headers);

    // sleep just a little
    Thread.sleep(50);

    Exchange bar = consumer.receive("activemq:queue:bar", 5000);
    assertNotNull("Should be a message on queue", bar);

    template.send("activemq:queue:foo?preserveMessageQos=true", bar);

    Thread.sleep(1000);

    assertMockEndpointsSatisfied();
  }
  @Test
  public void testInOnlyRouteJMSDestinationName() throws Exception {
    context.addRoutes(
        new RouteBuilder() {
          public void configure() throws Exception {
            from("activemq:queue:a").to("activemq:queue:b");
            from("activemq:queue:b").to("mock:result");
          }
        });
    context.start();

    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedBodiesReceived("Hello World");
    mock.message(0).header("JMSDestination").isNotNull();

    template.sendBodyAndHeader(
        "activemq:queue:bar", "Hello World", JmsConstants.JMS_DESTINATION_NAME, "a");

    assertMockEndpointsSatisfied();

    assertEquals(
        "queue://b",
        mock.getReceivedExchanges()
            .get(0)
            .getIn()
            .getHeader("JMSDestination", Destination.class)
            .toString());
  }
Пример #10
0
 @DirtiesContext
 @Test
 public void testSendCsvDataOneLine() throws Exception {
   resultEndpoint.expectedBodiesReceived(new MyCsvBean(1, "message", "db"));
   template.sendBody("CSV\n1,message,db");
   resultEndpoint.assertIsSatisfied();
 }
Пример #11
0
 @DirtiesContext
 @Test
 public void testSendInvalidData() throws Exception {
   resultEndpoint.expectedMessageCount(0);
   template.sendBody("CSV\nNullpointerException():100");
   resultEndpoint.assertIsSatisfied();
 }
Пример #12
0
 @DirtiesContext
 @Test
 public void testSendCsvDataZeroLines() throws Exception {
   resultEndpoint.expectedMessageCount(0);
   template.sendBody("only one line");
   resultEndpoint.assertIsSatisfied();
 }
Пример #13
0
  public void testSendLotsOfMessagesSimultaneouslyButOnly3GetThrough() throws Exception {
    MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
    resultEndpoint.expectedMessageCount(messageCount);

    ExecutorService executor = Executors.newFixedThreadPool(messageCount);

    long start = System.currentTimeMillis();
    for (int i = 0; i < messageCount; i++) {
      executor.execute(
          new Runnable() {
            public void run() {
              template.sendBody("direct:a", "<message>payload</message>");
            }
          });
    }

    // let's wait for the exchanges to arrive
    resultEndpoint.assertIsSatisfied();

    // now assert that they have actually been throttled
    long minimumTime = (messageCount - 1) * INTERVAL;
    // add a little slack
    long delta = System.currentTimeMillis() - start + 200;
    assertTrue("Should take at least " + minimumTime + "ms, was: " + delta, delta >= minimumTime);
  }
  public void testConcurrentPipeline() throws Exception {
    int total = 200;
    final int group = total / 20;
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMessageCount(total);

    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(20);
    executor.afterPropertiesSet();
    for (int i = 0; i < 20; i++) {
      final int threadCount = i;
      executor.execute(
          new Runnable() {
            public void run() {
              int start = threadCount * group;
              for (int i = 0; i < group; i++) {
                try {
                  // do some random sleep to simulate spread in user activity
                  Thread.sleep(new Random().nextInt(10));
                } catch (InterruptedException e) {
                  // ignore
                }
                template.sendBody(uri, "" + (start + i));
              }
            }
          });
    }

    mock.assertIsSatisfied();
    mock.expectsNoDuplicates(body());
    executor.shutdown();
  }
Пример #15
0
  public void testSendingAMessageUsingMulticastReceivesItsOwnExchange() throws Exception {
    MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
    resultEndpoint.expectedBodiesReceived("James", "Guillaume", "Hiram", "Rob");

    // InOnly
    template.send(
        "direct:seqential",
        new Processor() {
          public void process(Exchange exchange) {
            Message in = exchange.getIn();
            in.setBody("James,Guillaume,Hiram,Rob");
            in.setHeader("foo", "bar");
          }
        });

    assertMockEndpointsSatisfied();

    List<Exchange> list = resultEndpoint.getReceivedExchanges();
    for (int i = 0; i < 4; i++) {
      Exchange exchange = list.get(i);
      Message in = exchange.getIn();
      assertNotNull("The in message should not be null.", in);
      assertProperty(exchange, Exchange.SPLIT_INDEX, i);
      assertProperty(exchange, Exchange.SPLIT_SIZE, 4);
    }
  }
  @Test
  public void testScheduledStartRoutePolicy() throws Exception {
    MockEndpoint success = (MockEndpoint) context.getEndpoint("mock:success");

    success.expectedMessageCount(1);

    context
        .getComponent("quartz", QuartzComponent.class)
        .setPropertiesFile("org/apache/camel/routepolicy/quartz/myquartz.properties");
    context.getComponent("quartz", QuartzComponent.class).start();
    context.addRoutes(
        new RouteBuilder() {
          public void configure() {
            SimpleScheduledRoutePolicy policy = new SimpleScheduledRoutePolicy();
            long startTime = System.currentTimeMillis() + 3000L;
            policy.setRouteStartDate(new Date(startTime));
            policy.setRouteStartRepeatCount(1);
            policy.setRouteStartRepeatInterval(3000);

            from("direct:start").routeId("test").routePolicy(policy).to("mock:success");
          }
        });
    context.start();
    context.stopRoute("test", 0, TimeUnit.MILLISECONDS);

    Thread.sleep(5000);
    assertTrue(context.getRouteStatus("test") == ServiceStatus.Started);
    template.sendBody("direct:start", "Ready or not, Here, I come");

    context.getComponent("quartz", QuartzComponent.class).stop();
    success.assertIsSatisfied();
  }
Пример #17
0
  public void testSendingAMessageUsingMulticastReceivesItsOwnExchangeParallel() throws Exception {
    MockEndpoint resultEndpoint = getMockEndpoint("mock:result");

    resultEndpoint.expectsNoDuplicates(body());
    resultEndpoint.expectedMessageCount(4);

    // InOnly
    template.send(
        "direct:parallel",
        new Processor() {
          public void process(Exchange exchange) {
            Message in = exchange.getIn();
            in.setBody("James,Guillaume,Hiram,Rob");
            in.setHeader("foo", "bar");
          }
        });

    assertMockEndpointsSatisfied();

    List<Exchange> list = resultEndpoint.getReceivedExchanges();
    Set<Integer> numbersFound = new TreeSet<Integer>();
    final String[] names = {"James", "Guillaume", "Hiram", "Rob"};

    for (int i = 0; i < 4; i++) {
      Exchange exchange = list.get(i);
      Message in = exchange.getIn();
      Integer splitCounter = exchange.getProperty(Exchange.SPLIT_INDEX, Integer.class);
      numbersFound.add(splitCounter);
      assertEquals(names[splitCounter], in.getBody());
      assertProperty(exchange, Exchange.SPLIT_SIZE, 4);
    }

    assertEquals(4, numbersFound.size());
  }
  @Test
  /** Operation: CREATE Body contains: Metacard */
  public void testCreateWithIngestException() throws Exception {
    resetMocks();

    // Setup expectations to verify
    final MockEndpoint mockVerifierEndpoint = getMockEndpoint("mock:result");
    mockVerifierEndpoint.expectedMessageCount(1);

    final List<Metacard> metacards = new ArrayList<Metacard>();
    metacards.add(metacard1);

    // Mock catalog framework
    final CreateRequest createRequest = new CreateRequestImpl(metacards);
    final CreateResponse createResponse =
        new CreateResponseImpl(createRequest, new HashMap(), metacards);
    when(catalogFramework.create(any(CreateRequest.class))).thenThrow(new IngestException());

    // Exercise the route with a CREATE operation
    template.sendBodyAndHeader("direct:sampleInput", metacard1, "Operation", "CREATE");

    // Verify that the number of metacards in the exchange after the records
    // is identical to the input
    assertListSize(mockVerifierEndpoint.getExchanges(), 1);
    final Exchange exchange = mockVerifierEndpoint.getExchanges().get(0);
    final List<Metacard> cardsCreated = (List<Metacard>) exchange.getIn().getBody();
    assertListSize(cardsCreated, 0);

    mockVerifierEndpoint.assertIsSatisfied();
  }
Пример #19
0
  @Test
  public void testHeaderAndTrailer() throws Exception {
    results.expectedMessageCount(1);
    results.message(0).body().isInstanceOf(List.class);
    results.message(0).header("camelFlatpackCounter").isEqualTo(6);

    results.assertIsSatisfied();

    List<Map<String, String>> data =
        CastUtils.cast(results.getExchanges().get(0).getIn().getBody(List.class));

    // assert header
    Map<String, String> header = data.get(0);
    assertEquals("HBT", header.get("INDICATOR"));
    assertEquals("20080817", header.get("DATE"));

    // assert body
    int counter = 0;
    for (Map<String, String> row : data.subList(1, 5)) {
      assertEquals("FIRSTNAME", expectedFirstName[counter], row.get("FIRSTNAME"));
      LOG.info("Result: " + counter + " = " + row);
      counter++;
    }

    // assert trailer
    Map<String, String> trailer = data.get(5);
    assertEquals("FBT", trailer.get("INDICATOR"));
    assertEquals("SUCCESS", trailer.get("STATUS"));
  }
  @Test
  /** Operation: DELETE Body contains: 12345678900987654321abcdeffedcba */
  public void testDeleteWithIngestException() throws Exception {
    resetMocks();

    // Setup expectations to verify
    final MockEndpoint mockVerifierEndpoint = getMockEndpoint("mock:result");
    mockVerifierEndpoint.expectedMessageCount(1);

    final List<Metacard> metacards = new ArrayList<Metacard>();
    metacards.add(metacard1);

    // setup mock catalog framework
    final String[] metacardIds = new String[metacards.size()];
    for (int i = 0; i < metacards.size(); i++) {
      metacardIds[i] = metacards.get(i).getId();
    }

    DeleteRequest deleteRequest = new DeleteRequestImpl(metacardIds);
    DeleteResponse deleteResponse = new DeleteResponseImpl(deleteRequest, new HashMap(), metacards);
    when(catalogFramework.delete(any(DeleteRequest.class))).thenThrow(new IngestException());

    // Exercise the route with a DELETE operation
    template.sendBodyAndHeader("direct:sampleInput", metacardIds, "Operation", "DELETE");

    // Verify that the number of metacards in the exchange after the records
    // is identical to the input
    assertListSize(mockVerifierEndpoint.getExchanges(), 1);
    final Exchange exchange = mockVerifierEndpoint.getExchanges().get(0);
    final List<Update> cardsDeleted = (List<Update>) exchange.getIn().getBody();
    assertListSize(cardsDeleted, 0);

    mockVerifierEndpoint.assertIsSatisfied();
  }
Пример #21
0
  @Test
  public void testLanguageCode() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedBodiesReceived("Hello World");

    mock.assertIsSatisfied();
  }
  @Override
  protected RouteBuilder[] createRouteBuilders() throws Exception {
    EbmsOutboundRouteBuilder routeBuilder = new EbmsOutboundRouteBuilder();
    routeBuilder.setOutboundEbmsQueue("direct:testOutboundEbmsQueue");
    routeBuilder.setEbmsResponseInbound(mockEbmsResponseInbound.getEndpointUri());
    routeBuilder.setMessageUpdateEndpoint(mockUpdateMessageStore.getEndpointUri());
    routeBuilder.setCpaRepository(new DummyCPARepository());
    return new RouteBuilder[] {
      routeBuilder,
      new RouteBuilder() {
        @Override
        public void configure() throws Exception {
          from("direct:agreement1")
              .to(mockAgreement1.getEndpointUri())
              .setHeader(Exchange.HTTP_RESPONSE_CODE, constant(204))
              .setBody(constant(null))
              .routeId("mockAgreement1");
          from("direct:agreement2")
              .to(mockAgreement2.getEndpointUri())
              .setHeader(Exchange.HTTP_RESPONSE_CODE, constant(200))
              .setBody(
                  constant(
                      IOUtils.toString(
                          new FileInputStream(fileFromClasspath("simple-as4-receipt.xml")))))
              .routeId("mockAgreement2");

          from(EventNotificationRouteBuilder.SEND_NOTIFICATION_ENDPOINT)
              .log(LoggingLevel.INFO, "mock event notification: ${headers}")
              .routeId("mockEventNotification");
        }
      }
    };
  }
  public void testSimpleSplitWriteRead() throws Exception {
    context.addRoutes(
        new RouteBuilder() {
          @Override
          public void configure() {
            from("direct:start")
                .to(
                    "hdfs://localhost:9000/tmp/test/test-camel-simple-write-file?fileSystemType=HDFS&splitStrategy=BYTES:5,IDLE:1000");
            from("hdfs://localhost:9000/tmp/test/test-camel-simple-write-file?pattern=seg*&initialDelay=2000&fileSystemType=HDFS&chunkSize=5")
                .to("mock:result");
          }
        });
    context.start();

    for (int i = 0; i < 10; ++i) {
      template.sendBody("direct:start", "CIAO" + i);
    }

    MockEndpoint resultEndpoint = (MockEndpoint) context.getEndpoint("mock:result");

    resultEndpoint.expectedMessageCount(10);
    resultEndpoint.assertIsSatisfied();

    int i = 0;
    List<Exchange> exchanges = resultEndpoint.getExchanges();
    for (Exchange exchange : exchanges) {
      Assert.assertEquals("CIAO" + i++, exchange.getIn().getBody(String.class));
    }
  }
  /**
   * Test multi dir.
   *
   * @throws Exception the exception
   */
  @Test
  public void testMultiDir() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedBodiesReceived("Bye World", "Hello World", "Goodday World");

    assertMockEndpointsSatisfied();

    Exchange exchange = mock.getExchanges().get(0);
    RemoteFile<?> file = (RemoteFile<?>) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
    assertNotNull(file);
    assertDirectoryEquals("webdav/multidir/bye.txt", file.getAbsoluteFilePath());
    assertDirectoryEquals("bye.txt", file.getRelativeFilePath());
    assertEquals("bye.txt", file.getFileName());

    exchange = mock.getExchanges().get(1);
    file = (RemoteFile<?>) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
    assertNotNull(file);
    assertDirectoryEquals("webdav/multidir/sub/hello.txt", file.getAbsoluteFilePath());
    assertDirectoryEquals("sub/hello.txt", file.getRelativeFilePath());
    assertEquals("sub/hello.txt", file.getFileName());
    assertEquals("hello.txt", file.getFileNameOnly());

    exchange = mock.getExchanges().get(2);
    file = (RemoteFile<?>) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
    assertNotNull(file);
    assertDirectoryEquals("webdav/multidir/sub/sub2/godday.txt", file.getAbsoluteFilePath());
    assertDirectoryEquals("sub/sub2/godday.txt", file.getRelativeFilePath());
    assertEquals("sub/sub2/godday.txt", file.getFileName());
    assertEquals("godday.txt", file.getFileNameOnly());
  }
Пример #25
0
  @Test
  public void testSendAccountBean() throws Exception {
    MockEndpoint endpoint = getMockEndpoint("mock:results");
    endpoint.expectedMinimumMessageCount(1);

    Account account = new Account();
    account.setId(123);
    account.setFirstName("James");
    account.setLastName("Strachan");
    account.setEmailAddress("*****@*****.**");

    template.sendBody("direct:start", account);

    assertMockEndpointsSatisfied();

    // now lets poll that the account has been inserted
    List body =
        template.requestBody(
            "ibatis:selectAllAccounts?statementType=QueryForList", null, List.class);

    assertEquals("Wrong size: " + body, 1, body.size());
    Account actual = assertIsInstanceOf(Account.class, body.get(0));

    assertEquals("Account.getFirstName()", "James", actual.getFirstName());
    assertEquals("Account.getLastName()", "Strachan", actual.getLastName());

    log.info("Found: " + actual);
  }
  @Test
  public void testJmsPollingConsumerLowTimeout() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedBodiesReceived("Hello Claus");

    // use another thread for polling consumer to demonstrate that we can wait before
    // the message is sent to the queue
    Executors.newSingleThreadExecutor()
        .execute(
            new Runnable() {
              public void run() {
                String body = consumer.receiveBody("activemq:queue.start", 100, String.class);
                assertNull("Should be null", body);

                template.sendBody("activemq:queue.foo", "Hello Claus");
              }
            });

    // wait a little to demonstrate we can start poll before we have a msg on the queue
    Thread.sleep(500);

    template.sendBody("direct:start", "Hello");

    assertMockEndpointsSatisfied();
  }
Пример #27
0
 @Test
 public void testGroovyLanguage() throws Exception {
   MockEndpoint result = getMockEndpoint("mock:result");
   result.expectedBodiesReceived("Hello is processed!");
   template.sendBody("direct:groovy", "Hello");
   result.assertIsSatisfied();
 }
  @Test
  public void testSqlIdempotentConsumer() throws Exception {
    Assert.assertNotNull("DataSource not null", dataSource);

    final JdbcMessageIdRepository jdbcMessageIdRepository =
        new JdbcMessageIdRepository(dataSource, "myProcessorName");

    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(
        new RouteBuilder() {
          @Override
          public void configure() throws Exception {
            from("direct:start")
                .idempotentConsumer(simple("${header.messageId}"), jdbcMessageIdRepository)
                .to("mock:result");
          }
        });

    camelctx.start();
    try {
      MockEndpoint mockEndpoint = camelctx.getEndpoint("mock:result", MockEndpoint.class);
      mockEndpoint.expectedMessageCount(1);

      // Send 5 messages with the same messageId header. Only 1 should be forwarded to the
      // mock:result endpoint
      ProducerTemplate template = camelctx.createProducerTemplate();
      for (int i = 0; i < 5; i++) {
        template.requestBodyAndHeader("direct:start", null, "messageId", "12345");
      }

      mockEndpoint.assertIsSatisfied();
    } finally {
      camelctx.stop();
    }
  }
Пример #29
0
  @Test
  public void testScheduledResumeRoutePolicy() throws Exception {
    MockEndpoint success = context.getEndpoint("mock:success", MockEndpoint.class);
    success.expectedMessageCount(1);

    context
        .getComponent("quartz2", QuartzComponent.class)
        .setPropertiesFile("org/apache/camel/routepolicy/quartz2/myquartz.properties");
    context.addRoutes(
        new RouteBuilder() {
          public void configure() {
            CronScheduledRoutePolicy policy = new CronScheduledRoutePolicy();
            policy.setRouteResumeTime("*/3 * * * * ?");

            from("direct:start").routeId("test").routePolicy(policy).to("mock:success");
          }
        });
    context.start();

    ServiceHelper.suspendService(context.getRoute("test").getConsumer());

    Thread.sleep(5000);
    assertTrue(context.getRouteStatus("test") == ServiceStatus.Started);

    template.sendBody("direct:start", "Ready or not, Here, I come");

    success.assertIsSatisfied();
  }
  @Test
  public void sendLongSubmitSM() throws Exception {
    result.expectedMessageCount(2);

    Exchange exchange = start.createExchange(ExchangePattern.InOnly);
    exchange
        .getIn()
        .setBody(
            "Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! "
                + "Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! "
                + "Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! "); // 270 chars

    template.send(start, exchange);

    assertMockEndpointsSatisfied();
    assertEquals(
        SmppMessageType.DeliveryReceipt.toString(),
        result.getExchanges().get(0).getIn().getHeader(SmppConstants.MESSAGE_TYPE));
    assertEquals(
        SmppMessageType.DeliveryReceipt.toString(),
        result.getExchanges().get(1).getIn().getHeader(SmppConstants.MESSAGE_TYPE));

    assertNotNull(exchange.getIn().getHeader(SmppConstants.ID));
    assertEquals(2, exchange.getIn().getHeader(SmppConstants.SENT_MESSAGE_COUNT));
  }