Examples of MemoryIdempotentRepository


Examples of org.apache.camel.processor.idempotent.MemoryIdempotentRepository

        template.sendBodyAndHeader(getFtpUrl(), "B", Exchange.FILE_NAME, "b.txt");

        FtpEndpoint<?> endpoint = context.getEndpoint(getFtpUrl() + "&sortBy=file:name", FtpEndpoint.class);
        assertNotNull(endpoint);

        MemoryIdempotentRepository repo = (MemoryIdempotentRepository) endpoint.getInProgressRepository();
        assertEquals(0, repo.getCacheSize());

        List<Exchange> list = endpoint.getExchanges();
        assertNotNull(list);
        assertEquals(2, list.size());

        assertEquals("a.txt", list.get(0).getIn().getHeader(Exchange.FILE_NAME));
        assertEquals("b.txt", list.get(1).getIn().getHeader(Exchange.FILE_NAME));

        // the in progress repo should not leak
        assertEquals(0, repo.getCacheSize());

        // and the files is still there
        File fileA = new File(FTP_ROOT_DIR + "/browse/a.txt");
        assertTrue("File should exist " + fileA, fileA.exists());
        File fileB = new File(FTP_ROOT_DIR + "/browse/b.txt");
View Full Code Here

Examples of org.apache.camel.processor.idempotent.MemoryIdempotentRepository

        template.sendBodyAndHeader(getFtpUrl(), "C", Exchange.FILE_NAME, "bar/c.txt");

        FtpEndpoint<?> endpoint = context.getEndpoint(getFtpUrl() + "&recursive=true&sortBy=file:name", FtpEndpoint.class);
        assertNotNull(endpoint);

        MemoryIdempotentRepository repo = (MemoryIdempotentRepository) endpoint.getInProgressRepository();
        assertEquals(0, repo.getCacheSize());

        List<Exchange> list = endpoint.getExchanges();
        assertNotNull(list);
        assertEquals(3, list.size());

        assertEquals("a.txt", list.get(0).getIn().getHeader(Exchange.FILE_NAME));
        assertEquals("c.txt", list.get(1).getIn().getHeader(Exchange.FILE_NAME_ONLY));
        assertEquals("b.txt", list.get(2).getIn().getHeader(Exchange.FILE_NAME_ONLY));

        // the in progress repo should not leak
        assertEquals(0, repo.getCacheSize());

        // and the files is still there
        File fileA = new File(FTP_ROOT_DIR + "/browse/a.txt");
        assertTrue("File should exist " + fileA, fileA.exists());
        File fileB = new File(FTP_ROOT_DIR + "/browse/foo/b.txt");
View Full Code Here

Examples of org.apache.camel.processor.idempotent.MemoryIdempotentRepository

        template.sendBodyAndHeader(getFtpUrl(), "A", Exchange.FILE_NAME, "a.txt");

        FtpEndpoint endpoint = context.getEndpoint(getFtpUrl(), FtpEndpoint.class);
        assertNotNull(endpoint);

        MemoryIdempotentRepository repo = (MemoryIdempotentRepository) endpoint.getInProgressRepository();
        assertEquals(0, repo.getCacheSize());

        @SuppressWarnings("unchecked")
        List<Exchange> list = endpoint.getExchanges();
        assertNotNull(list);
        assertEquals(1, list.size());

        assertEquals("a.txt", list.get(0).getIn().getHeader(Exchange.FILE_NAME));

        // the in progress repo should not leak
        assertEquals(0, repo.getCacheSize());

        // and the file is still there
        File file = new File(FTP_ROOT_DIR + "browse/a.txt");
        assertTrue("File should exist " + file, file.exists());
    }
View Full Code Here

Examples of org.apache.camel.processor.idempotent.MemoryIdempotentRepository

        template.sendBodyAndHeader(getFtpUrl(), "B", Exchange.FILE_NAME, "b.txt");

        FtpEndpoint endpoint = context.getEndpoint(getFtpUrl() + "&sortBy=file:name", FtpEndpoint.class);
        assertNotNull(endpoint);

        MemoryIdempotentRepository repo = (MemoryIdempotentRepository) endpoint.getInProgressRepository();
        assertEquals(0, repo.getCacheSize());

        @SuppressWarnings("unchecked")
        List<Exchange> list = endpoint.getExchanges();
        assertNotNull(list);
        assertEquals(2, list.size());

        assertEquals("a.txt", list.get(0).getIn().getHeader(Exchange.FILE_NAME));
        assertEquals("b.txt", list.get(1).getIn().getHeader(Exchange.FILE_NAME));

        // the in progress repo should not leak
        assertEquals(0, repo.getCacheSize());

        // and the files is still there
        File fileA = new File(FTP_ROOT_DIR + "browse/a.txt");
        assertTrue("File should exist " + fileA, fileA.exists());
        File fileB = new File(FTP_ROOT_DIR + "browse/b.txt");
View Full Code Here

Examples of org.apache.camel.processor.idempotent.MemoryIdempotentRepository

        template.sendBodyAndHeader(getFtpUrl(), "C", Exchange.FILE_NAME, "bar/c.txt");

        FtpEndpoint endpoint = context.getEndpoint(getFtpUrl() + "&recursive=true&sortBy=file:name", FtpEndpoint.class);
        assertNotNull(endpoint);

        MemoryIdempotentRepository repo = (MemoryIdempotentRepository) endpoint.getInProgressRepository();
        assertEquals(0, repo.getCacheSize());

        @SuppressWarnings("unchecked")
        List<Exchange> list = endpoint.getExchanges();
        assertNotNull(list);
        assertEquals(3, list.size());

        assertEquals("a.txt", list.get(0).getIn().getHeader(Exchange.FILE_NAME));
        assertEquals("c.txt", list.get(1).getIn().getHeader(Exchange.FILE_NAME_ONLY));
        assertEquals("b.txt", list.get(2).getIn().getHeader(Exchange.FILE_NAME_ONLY));

        // the in progress repo should not leak
        assertEquals(0, repo.getCacheSize());

        // and the files is still there
        File fileA = new File(FTP_ROOT_DIR + "browse/a.txt");
        assertTrue("File should exist " + fileA, fileA.exists());
        File fileB = new File(FTP_ROOT_DIR + "browse/foo/b.txt");
View Full Code Here

Examples of org.apache.camel.processor.idempotent.MemoryIdempotentRepository

        assertMockEndpointsSatisfied();

        FileEndpoint fe = context.getEndpoint(uri, FileEndpoint.class);
        assertNotNull(fe);

        MemoryIdempotentRepository repo = (MemoryIdempotentRepository) fe.getInProgressRepository();
        assertEquals("Should be no in-progress files", 0, repo.getCacheSize());
    }
View Full Code Here

Examples of org.apache.camel.processor.idempotent.MemoryIdempotentRepository

    @Override
    public void configure() throws Exception {
        from("direct:in")
            .log("Received message ${header[messageId]}")
            .idempotentConsumer(header("messageId"), new MemoryIdempotentRepository()).skipDuplicate(false)
                .choice()
                    .when(property(Exchange.DUPLICATE_MESSAGE))
                        .log("Duplicate")
                        .to("mock:duplicate")
                    .otherwise()
View Full Code Here

Examples of org.apache.camel.processor.idempotent.MemoryIdempotentRepository

    @Override
    public void configure() throws Exception {
        from("direct:in")
            .log("Received message ${header[messageId]}")
            .idempotentConsumer(header("messageId"), new MemoryIdempotentRepository())
                .log("Invoking WS")
                .to("mock:ws")
            .end()
            .log("Completing")
            .to("mock:out");
View Full Code Here

Examples of org.apache.camel.processor.idempotent.MemoryIdempotentRepository

            .enrich("direct:invokeWs")
            .log("Completing")
            .to("mock:out");

        from("direct:invokeWs")
            .idempotentConsumer(header("messageId"), new MemoryIdempotentRepository())
                .log("Invoking WS")
                .to("mock:ws");
    }
View Full Code Here

Examples of org.apache.camel.processor.idempotent.MemoryIdempotentRepository


    @Before
    public void setup() throws Exception {

        idempotentRepository = new MemoryIdempotentRepository();
        processor = new TatamiStatusProcessor();
        lastUpdateDateTatamibotConfigurationUpdater = new LastUpdateDateTatamibotConfigurationUpdater();
        bot = new Tatamibot();
        MockitoAnnotations.initMocks(this); // init bot and processor with mock dependency
        ReflectionTestUtils.setField(bot, "idempotentRepository", idempotentRepository);
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.