use of org.springframework.integration.store.MessageGroup in project spring-integration by spring-projects.
the class MethodInvokingReleaseStrategyTests method testListSubclassParameterUsingMethodName.
@Test
public void testListSubclassParameterUsingMethodName() {
class TestReleaseStrategy {
@SuppressWarnings("unused")
public boolean listSubclassParameter(LinkedList<?> l1) {
return true;
}
}
ReleaseStrategy adapter = new MethodInvokingReleaseStrategy(new TestReleaseStrategy(), "listSubclassParameter");
MessageGroup messages = createListOfMessages(3);
Assert.assertTrue(adapter.canRelease(messages));
}
use of org.springframework.integration.store.MessageGroup in project spring-integration by spring-projects.
the class MethodInvokingReleaseStrategyTests method testWrongReturnType.
@Test(expected = ConversionFailedException.class)
public void testWrongReturnType() throws SecurityException, NoSuchMethodError {
class TestReleaseStrategy {
@SuppressWarnings("unused")
public String wrongReturnType(List<Message<?>> messages) {
return "foo";
}
}
ReleaseStrategy adapter = new MethodInvokingReleaseStrategy(new TestReleaseStrategy(), "wrongReturnType");
MessageGroup messages = createListOfMessages(3);
Assert.assertTrue(adapter.canRelease(messages));
}
use of org.springframework.integration.store.MessageGroup in project spring-integration by spring-projects.
the class MethodInvokingReleaseStrategyTests method testAdapterWithPojoBasedMethodReturningObject.
@Test
public void testAdapterWithPojoBasedMethodReturningObject() {
class TestReleaseStrategy {
@SuppressWarnings("unused")
public // the data
boolean checkCompletenessOnListOfStrings(List<String> messages) {
StringBuffer buffer = new StringBuffer();
for (String content : messages) {
buffer.append(content);
}
return buffer.length() >= 9;
}
}
ReleaseStrategy adapter = new MethodInvokingReleaseStrategy(new TestReleaseStrategy(), "checkCompletenessOnListOfStrings");
MessageGroup messages = createListOfMessages(3);
Assert.assertTrue(adapter.canRelease(messages));
}
use of org.springframework.integration.store.MessageGroup in project spring-integration by spring-projects.
the class MethodInvokingReleaseStrategyTests method testAdapterWithTypeParametrizedMessageBasedMethod.
@Test
public void testAdapterWithTypeParametrizedMessageBasedMethod() {
class TestReleaseStrategy {
@SuppressWarnings("unused")
public boolean checkCompletenessOnListOfMessagesParametrizedWithString(List<Message<String>> messages) {
Assert.assertTrue(messages.size() > 0);
return messages.size() > new IntegrationMessageHeaderAccessor(messages.iterator().next()).getSequenceSize();
}
}
ReleaseStrategy adapter = new MethodInvokingReleaseStrategy(new TestReleaseStrategy(), "checkCompletenessOnListOfMessagesParametrizedWithString");
MessageGroup messages = createListOfMessages(3);
Assert.assertTrue(adapter.canRelease(messages));
}
use of org.springframework.integration.store.MessageGroup in project spring-integration by spring-projects.
the class MethodInvokingReleaseStrategyTests method testListSubclassParameterUsingMethodObject.
@Test
public void testListSubclassParameterUsingMethodObject() throws SecurityException, NoSuchMethodException {
class TestReleaseStrategy {
@SuppressWarnings("unused")
public boolean listSubclassParameter(LinkedList<?> l1) {
return true;
}
}
ReleaseStrategy adapter = new MethodInvokingReleaseStrategy(new TestReleaseStrategy(), TestReleaseStrategy.class.getMethod("listSubclassParameter", new Class<?>[] { LinkedList.class }));
MessageGroup messages = createListOfMessages(3);
Assert.assertTrue(adapter.canRelease(messages));
}
Aggregations