@Test public void testOnUnaccepted() throws Exception { final IdempotentMessageFilter filter = idempotentMessageFilterFromFlow("idempotentFilterWithOnUnacceptedMP"); assertNotNull(filter.getUnacceptedMessageProcessor()); assertEquals(StringAppendTransformer.class, filter.getUnacceptedMessageProcessor().getClass()); }
private void testPojoObjectStore(final String flowName) throws Exception { final IdempotentMessageFilter filter = idempotentMessageFilterFromFlow(flowName); final ObjectStore<?> store = filter.getStore(); assertEquals(CustomObjectStore.class, store.getClass()); final CustomObjectStore customStore = (CustomObjectStore) store; assertEquals("the-value:" + flowName, customStore.getCustomProperty()); }
@Test public void testInMemoryObjectStore() throws Exception { final IdempotentMessageFilter filter = idempotentMessageFilterFromFlow("inMemoryStore"); final ObjectStore<?> store = filter.getStore(); assertEquals(InMemoryObjectStore.class, store.getClass()); final InMemoryObjectStore<?> memoryStore = (InMemoryObjectStore<?>) store; assertEquals(1000, memoryStore.getEntryTTL()); assertEquals(2000, memoryStore.getExpirationInterval()); assertEquals(3000, memoryStore.getMaxEntries()); }
@Test public void testSimpleTextFileStore() throws Exception { final IdempotentMessageFilter filter = idempotentMessageFilterFromFlow("simpleTextFileStore"); final ObjectStore<?> store = filter.getStore(); assertEquals(TextFileObjectStore.class, store.getClass()); final TextFileObjectStore fileStore = (TextFileObjectStore) store; assertEquals("the-store", fileStore.getName()); final File tmpDir = SystemUtils.getJavaIoTmpDir(); assertEquals(tmpDir.getCanonicalPath(), new File(fileStore.getDirectory()).getCanonicalPath()); assertEquals(1000, fileStore.getEntryTTL()); assertEquals(2000, fileStore.getExpirationInterval()); assertEquals(3000, fileStore.getMaxEntries()); }
@Test public void testIdempotentReceiverRouter() throws Exception { MessageProcessor router = lookupMessageProcessorFromFlow("IdempotentReceiverRouter"); assertTrue(router instanceof IdempotentMessageFilter); IdempotentMessageFilter filter = (IdempotentMessageFilter) router; assertEquals("#[message:id]-#[message:correlationId]", filter.getIdExpression()); assertNotNull(filter.getStore()); assertTrue(filter.getStore() instanceof TextFileObjectStore); TextFileObjectStore store = (TextFileObjectStore) filter.getStore(); assertEquals(-1, store.getEntryTTL()); assertEquals(1000, store.getExpirationInterval()); assertEquals(10000000, store.getMaxEntries()); assertEquals("foo", store.getDirectory()); assertNotNull(store.getName()); assertNotNull(store.getScheduler()); }