Package org.springframework.messaging.handler.invocation

Examples of org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke()


    instance.afterPropertiesSet();

    InvocableHandlerMethod invocableHandlerMethod =
        createInvocableHandlerMethod(instance, "simpleString", String.class);

    invocableHandlerMethod.invoke(MessageBuilder.withPayload(sample).build());
    assertMethodInvocation(sample, "simpleString");
  }

  @Test
  public void customConversionServiceFailure() throws Exception {
View Full Code Here


    InvocableHandlerMethod invocableHandlerMethod =
        createInvocableHandlerMethod(instance, "simpleString", String.class);

    thrown.expect(MessageConversionException.class);
    invocableHandlerMethod.invoke(MessageBuilder.withPayload(123).build());
  }

  @Test
  public void customMessageConverterFailure() throws Exception {
    DefaultMessageHandlerMethodFactory instance = createInstance();
View Full Code Here

    InvocableHandlerMethod invocableHandlerMethod =
        createInvocableHandlerMethod(instance, "simpleString", String.class);

    thrown.expect(MessageConversionException.class);
    invocableHandlerMethod.invoke(MessageBuilder.withPayload(123).build());
  }

  @Test
  public void customArgumentResolver() throws Exception {
    DefaultMessageHandlerMethodFactory instance = createInstance();
View Full Code Here

    instance.afterPropertiesSet();

    InvocableHandlerMethod invocableHandlerMethod =
        createInvocableHandlerMethod(instance, "customArgumentResolver", Locale.class);

    invocableHandlerMethod.invoke(MessageBuilder.withPayload(123).build());
    assertMethodInvocation(sample, "customArgumentResolver");
  }

  @Test
  public void overrideArgumentResolvers() throws Exception {
View Full Code Here

    Message<String> message = MessageBuilder.withPayload("sample").build();

    // This will work as the local resolver is set
    InvocableHandlerMethod invocableHandlerMethod =
        createInvocableHandlerMethod(instance, "customArgumentResolver", Locale.class);
    invocableHandlerMethod.invoke(message);
    assertMethodInvocation(sample, "customArgumentResolver");

    // This won't work as no resolver is known for the payload
    InvocableHandlerMethod invocableHandlerMethod2 =
        createInvocableHandlerMethod(instance, "simpleString", String.class);
View Full Code Here

    InvocableHandlerMethod invocableHandlerMethod2 =
        createInvocableHandlerMethod(instance, "simpleString", String.class);

    thrown.expect(IllegalStateException.class);
    thrown.expectMessage("No suitable resolver for");
    invocableHandlerMethod2.invoke(message);
  }

  @Test
  public void noValidationByDefault() throws Exception {
    DefaultMessageHandlerMethodFactory instance = createInstance();
View Full Code Here

    DefaultMessageHandlerMethodFactory instance = createInstance();
    instance.afterPropertiesSet();

    InvocableHandlerMethod invocableHandlerMethod =
        createInvocableHandlerMethod(instance, "payloadValidation", String.class);
    invocableHandlerMethod.invoke(MessageBuilder.withPayload("failure").build());
    assertMethodInvocation(sample, "payloadValidation");
  }

  @Test
  public void customValidation() throws Exception {
View Full Code Here

    instance.afterPropertiesSet();

    InvocableHandlerMethod invocableHandlerMethod =
        createInvocableHandlerMethod(instance, "payloadValidation", String.class);
    thrown.expect(MethodArgumentNotValidException.class);
    invocableHandlerMethod.invoke(MessageBuilder.withPayload("failure").build());
  }


  private void assertMethodInvocation(SampleBean bean, String methodName) {
    assertTrue("Method " + methodName + " should have been invoked", bean.invocations.get(methodName));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.