示例#1
0
 public void testIdempotentReceiverRouter() throws Exception {
   Router r = lookupInboundRouterFromService("IdempotentReceiverRouter");
   assertTrue(r instanceof IdempotentReceiver);
   IdempotentReceiver router = (IdempotentReceiver) r;
   assertEquals("#[message:id]-#[message:correlationId]", router.getIdExpression());
   assertNotNull(router.getStore());
   assertTrue(router.getStore() instanceof TextFileObjectStore);
   TextFileObjectStore store = (TextFileObjectStore) router.getStore();
   assertEquals(-1, store.getEntryTTL());
   assertEquals(1000, store.getExpirationInterval());
   assertEquals(10000000, store.getMaxEntries());
   assertEquals("foo", store.getDirectory());
   assertNotNull(store.getName());
   assertNotNull(store.getScheduler());
 }
  @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());
  }
  @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());
  }