Package org.apache.camel.builder

Examples of org.apache.camel.builder.NotifyBuilder.matches()


        template.sendBody("direct:zipToFile", TEXT);

        assertMockEndpointsSatisfied();

        // use builder to ensure the exchange is fully done before we check for file exists
        assertTrue(notify.matches(5, TimeUnit.SECONDS));

        Exchange exchange = mock.getReceivedExchanges().get(0);
        File file = new File(TEST_DIR, exchange.getIn().getMessageId() + ".zip");
        assertTrue(file.exists());
        assertTrue(ObjectHelper.equalByteArray(getZippedText(exchange.getIn().getMessageId()), getBytes(file)));
View Full Code Here


        // just make sure the file is created
        mock.assertIsSatisfied();

        // use builder to ensure the exchange is fully done before we check for file exists
        assertTrue(notify.matches(5, TimeUnit.SECONDS));

        assertTrue(file.exists());
        assertTrue(ObjectHelper.equalByteArray(getZippedText("poem.txt"), getBytes(file)));
    }
View Full Code Here

        context.start();
        NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();

        // no problem for in only as we do not expect a reply
        template.sendBody("direct:start", "Hello World");
        notify.matches(2, TimeUnit.SECONDS);

    }

    public void testInOut() throws Exception {
        context.addRoutes(new RouteBuilder() {
View Full Code Here

            // so we will not be able to do a real InOut/request-response, but that's okay
            // we're just interested in the message becoming expired
        }

        // we should delay a bit so broker can run its expiration processes...
        assertFalse(expireMatcher.matches(2, TimeUnit.SECONDS));

        DestinationViewMBean queue = getQueueMBean(TEST_INOUT_DESTINATION_NAME);
        assertEquals("There were unexpected messages left in the queue: " + TEST_INOUT_DESTINATION_NAME,
                0, queue.getQueueSize());
    }
View Full Code Here

        String endpoint = String.format("sjms:queue:%s?ttl=1000", TEST_INONLY_DESTINATION_NAME);
        template.sendBody(endpoint, "test message");

        // we should delay a bit so broker can run its expiration processes...
        assertFalse(expireMatcher.matches(2, TimeUnit.SECONDS));

        DestinationViewMBean queue = getQueueMBean(TEST_INONLY_DESTINATION_NAME);
        assertEquals("There were unexpected messages left in the queue: " + TEST_INONLY_DESTINATION_NAME,
                0, queue.getQueueSize());
    }
View Full Code Here

                }
            });
            responses.put(index, out);
        }

        notify.matches(2, TimeUnit.MINUTES);
        log.info("Took " + watch.taken() + " millis to process " + files + " messages using " + poolSize + " client threads.");
        assertEquals(files, responses.size());

        // get all responses
        Set<String> unique = new HashSet<String>();
View Full Code Here

        NotifyBuilder builder = new NotifyBuilder(context).whenDone(1).create();

        String out = template.requestBody("http://localhost:{{port}}/myserver", body, String.class);
        assertEquals(body2, out);

        assertTrue(builder.matches(5, TimeUnit.SECONDS));

        // the temporary files should have been deleted
        File file = new File("target/cachedir");
        String[] files = file.list();
        assertEquals("There should be no files", 0, files.length);
View Full Code Here

        template.sendBody("seda:start", "B");

        assertMockEndpointsSatisfied();

        // wait for all exchanges to be done (2 input + 1 aggregated)
        notify.matches(5, TimeUnit.SECONDS);

        // should have confirmed
        assertTrue("Should have confirmed", myRepo.isConfirm());
    }
View Full Code Here

    // disabled due manual test
    public void xxxtestSplitParallelBigFile() throws Exception {
        StopWatch watch = new StopWatch();

        NotifyBuilder builder = new NotifyBuilder(context).whenDone(lines + 1).create();
        boolean done = builder.matches(120, TimeUnit.SECONDS);

        log.info("Took " + TimeUtils.printDuration(watch.stop()));

        if (!done) {
            throw new CamelException("Could not split file in 2 minutes");
View Full Code Here

        template.sendBodyAndHeader("seda:start", "Hello World", "recipientListHeader", "fail");

        assertMockEndpointsSatisfied();

        // wait until its done before we stop and check that retry was invoked
        boolean matches = event.matches(10, TimeUnit.SECONDS);
        assertTrue(matches);

        context.stop();

        assertEquals(3, invoked.get());
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.