コード例 #1
0
  @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));
  }
コード例 #2
0
  @Test
  public void sendSubmitSMInOnly() throws Exception {
    result.expectedMessageCount(1);

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

    template.send(start, exchange);

    assertMockEndpointsSatisfied();
    Exchange resultExchange = result.getExchanges().get(0);
    assertEquals(
        SmppMessageType.DeliveryReceipt.toString(),
        resultExchange.getIn().getHeader(SmppConstants.MESSAGE_TYPE));
    assertEquals("Hello SMPP World!", resultExchange.getIn().getBody());
    assertNotNull(resultExchange.getIn().getHeader(SmppConstants.ID));
    assertEquals(1, resultExchange.getIn().getHeader(SmppConstants.SUBMITTED));
    assertEquals(1, resultExchange.getIn().getHeader(SmppConstants.DELIVERED));
    assertNotNull(resultExchange.getIn().getHeader(SmppConstants.DONE_DATE));
    assertNotNull(resultExchange.getIn().getHeader(SmppConstants.SUBMIT_DATE));
    assertNull(resultExchange.getIn().getHeader(SmppConstants.ERROR));

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