コード例 #1
0
  @Test
  public void shouldCallServiceOneCharMethod() {
    // Given
    JmsSenderFactory factory = new JmsSenderFactory(CONFIG, new MapJmsPayloadHandler());
    OneCharTestApi sendProxy = factory.create(OneCharTestApi.class);
    Mapping receiveMapping = new MappingBuilder("METHOD").build();

    // When
    sendProxy.a("content");
    MapMessageDecoder.of(OneCharTestApi.class, oneCharServiceMock, receiveMapping) //
        .onMessage(captureMessage());

    // Then
    verify(oneCharServiceMock).a("content");
  }
コード例 #2
0
  @Test
  public void shouldSendAttributesUsingExplicitConversion(boolean flag) throws JMSException {
    // Given
    LocalDate today = new LocalDate();
    String pattern = "dd.MM.YYYY";
    Mapping mapping =
        new MappingBuilder(OPERATION_FIELD_NAME) //
            .mapField("date", FieldMapping.map("date", new JodaLocalDateConverter(pattern))) //
            .mapField("flag", FieldMapping.map("flag", new StringToBooleanConverter("1", "0"))) //
            .build();
    MapJmsPayloadHandler payloadHandler = new MapJmsPayloadHandler(mapping);
    JodaTimeApi service = JmsSenderFactory.create(CONFIG, payloadHandler).create(JodaTimeApi.class);

    // When
    service.localDateCall(today, flag);

    // Then
    MapMessage message = (MapMessage) captureMessage();
    assertEquals(today.toString(pattern), message.getString("date"));
    assertEquals(flag ? "1" : "0", message.getString("flag"));
  }
コード例 #3
0
 private MappedApi service(Mapping mapping) {
   return JmsSenderFactory.create(CONFIG, new MapJmsPayloadHandler(mapping))
       .create(MappedApi.class);
 }