List of usage examples for java.util.concurrent TimeUnit SECONDS
TimeUnit SECONDS
To view the source code for java.util.concurrent TimeUnit SECONDS.
Click Source Link
From source file:org.camelcookbook.routing.multicast.MulticastSpringTest.java
@Test public void testMessageRoutedToMulticastEndpoints() throws InterruptedException { String messageBody = "Message to be multicast"; first.setExpectedMessageCount(1);//w w w . j av a2 s . c o m first.message(0).body().isEqualTo(messageBody); second.setExpectedMessageCount(1); second.message(0).body().isEqualTo(messageBody); third.setExpectedMessageCount(1); third.message(0).body().isEqualTo(messageBody); template.sendBody(messageBody); assertMockEndpointsSatisfied(5, TimeUnit.SECONDS); }
From source file:com.netflix.curator.framework.recipes.queue.TestSimpleDistributedQueue.java
@Test public void testPollWithTimeout() throws Exception { CuratorFramework clients[] = null;//from ww w. j a v a 2 s . c o m try { String dir = "/testOffer1"; final int num_clients = 1; clients = new CuratorFramework[num_clients]; SimpleDistributedQueue queueHandles[] = new SimpleDistributedQueue[num_clients]; for (int i = 0; i < clients.length; i++) { clients[i] = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1)); clients[i].start(); queueHandles[i] = new SimpleDistributedQueue(clients[i], dir); } Assert.assertNull(queueHandles[0].poll(3, TimeUnit.SECONDS)); } finally { closeAll(clients); } }
From source file:com.thoughtworks.go.remote.work.ConsoleOutputTransmitter.java
protected ConsoleOutputTransmitter(ConsoleAppender consoleAppender, Integer consolePublishInterval, ScheduledThreadPoolExecutor scheduledThreadPoolExecutor) { this.consoleAppender = consoleAppender; this.executor = scheduledThreadPoolExecutor; executor.scheduleAtFixedRate(this, 0L, consolePublishInterval, TimeUnit.SECONDS); }
From source file:de.fabianonline.telegram_backup.Utils.java
static void obeyFloodWaitException(RpcErrorException e, boolean silent) throws RpcErrorException { if (e == null || e.getCode() != 420) return;/*from w ww. ja v a 2 s .com*/ int delay = e.getTagInteger(); if (!silent) { System.out.println(""); System.out.println( "Telegram complained about us (okay, me) making too many requests in too short time by\n" + "sending us \"" + e.getTag() + "\" as an error. So we now have to wait a bit. Telegram\n" + "asked us to wait for " + delay + " seconds.\n" + "\n" + "So I'm going to do just that for now. If you don't want to wait, you can quit by pressing\n" + "Ctrl+C. You can restart me at any time and I will just continue to download your\n" + "messages and media. But be advised that just restarting me is not going to change\n" + "the fact that Telegram won't talk to me until then."); System.out.println(""); } try { TimeUnit.SECONDS.sleep(delay + 1); } catch (InterruptedException e2) { } }
From source file:org.zalando.stups.example.ExampleAppIT.java
@Test public void testEventBus() throws InterruptedException { LOG.info("Send Events ...."); this.multiEventBusSender.sendEvents(); this.simpleEventSender.sendEvents(); this.simpleAsyncEventSender.sendEvents(); this.eventBusSupportSender.sendEvents(); subscriber.getLatch().await(10, TimeUnit.SECONDS); deadEventListener.getLatch().await(5, TimeUnit.SECONDS); aac.close();/*from ww w . j a v a2 s . c o m*/ }
From source file:cz.muni.fi.editor.test.service.organization.OrganizationServiceIT.java
protected void waitForNotification(Callable<Integer> callable, Integer number) { await().atMost(3, TimeUnit.SECONDS).until(callable, CoreMatchers.equalTo(number)); }
From source file:com.boundary.sdk.event.service.ServiceCheckTest.java
@Ignore("Timer component for this spring file has been disabled so test fails") @Test/* ww w .java 2s . c om*/ public void testSimple() throws InterruptedException { MockEndpoint endPoint = getMockEndpoint("mock:ssh-out"); endPoint.setMinimumExpectedMessageCount(1); endPoint.await(10, TimeUnit.SECONDS); endPoint.assertIsSatisfied(); }
From source file:com.github.restdriver.clientdriver.integration.VerifyWithinTest.java
@Test public void expectationWhichMatchesAnyTimesDoesNotWait() throws Exception { clientDriver.addExpectation(onRequestTo("/foo"), giveEmptyResponse().within(10, TimeUnit.SECONDS)) .anyTimes();/*www . j av a2 s .com*/ long start = System.currentTimeMillis(); clientDriver.verify(); long end = System.currentTimeMillis(); assertThat(end - start, is(lessThan(5000L))); }
From source file:org.camelcookbook.examples.testing.notifybuilder.FixedEndpointsNotifyBuilderSpringTest.java
@Test public void testSingleMessageDone() throws InterruptedException { final String messageText = "testMessage"; NotifyBuilder notify = new NotifyBuilder(camelContext).from("activemq:in").whenDone(1).create(); sendMessageBody(messageText);/*from w w w . j ava 2 s . c om*/ assertTrue(notify.matches(10, TimeUnit.SECONDS)); }
From source file:it.geosolutions.opensdi2.session.impl.InMemoryUserSessionService.java
public InMemoryUserSessionService() { super(); // schedule eviction thread scheduler.scheduleAtFixedRate(evictionTask, cleanUpSeconds, cleanUpSeconds, TimeUnit.SECONDS); }