当前位置: 首页>>代码示例>>Java>>正文


Java ConditionTimeoutException类代码示例

本文整理汇总了Java中com.jayway.awaitility.core.ConditionTimeoutException的典型用法代码示例。如果您正苦于以下问题:Java ConditionTimeoutException类的具体用法?Java ConditionTimeoutException怎么用?Java ConditionTimeoutException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConditionTimeoutException类属于com.jayway.awaitility.core包,在下文中一共展示了ConditionTimeoutException类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: awaitExpiration

import com.jayway.awaitility.core.ConditionTimeoutException; //导入依赖的package包/类
private boolean awaitExpiration(Region r, Object key) {
  // Return true if entry expires. We only wait
  // TEST_WAIT_MS. If we need to wait that long for
  // a SHORT_WAIT_MS to expire then the expiration
  // is probably still set at LONG_WAIT_MS.
  try {
    with().pollInterval(POLL_INTERVAL_MS, TimeUnit.MILLISECONDS).await()
        .atMost(TEST_WAIT_MS, TimeUnit.MILLISECONDS).until(() -> !r.containsValueForKey(key));
  } catch (ConditionTimeoutException toe) {
    return false;
  }
  return true;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:14,代码来源:Bug44418JUnitTest.java

示例2: waitUntilReady

import com.jayway.awaitility.core.ConditionTimeoutException; //导入依赖的package包/类
public void waitUntilReady(Cluster cluster) {
    final AtomicReference<Optional<SuccessOrFailure>> lastSuccessOrFailure = new AtomicReference<>(
            Optional.empty());

    log.info("Waiting for cluster to be healthy");
    try {
        Awaitility.await()
                .pollInterval(50, TimeUnit.MILLISECONDS)
                .atMost(timeout.getMillis(), TimeUnit.MILLISECONDS)
                .until(weHaveSuccess(cluster, lastSuccessOrFailure));
    } catch (ConditionTimeoutException e) {
        throw new IllegalStateException(serviceDidNotStartupExceptionMessage(lastSuccessOrFailure));
    }
}
 
开发者ID:palantir,项目名称:docker-compose-rule,代码行数:15,代码来源:ClusterWait.java

示例3: matches

import com.jayway.awaitility.core.ConditionTimeoutException; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public boolean matches(Object item) {
    MockAuthenticationCallback<T> callback = (MockAuthenticationCallback<T>) item;
    try {
        await().until(callback.payload(), payloadMatcher);
        await().until(callback.error(), errorMatcher);
        return true;
    } catch (ConditionTimeoutException e) {
        return false;
    }
}
 
开发者ID:auth0,项目名称:Auth0.Android,代码行数:13,代码来源:AuthenticationCallbackMatcher.java

示例4: matches

import com.jayway.awaitility.core.ConditionTimeoutException; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public boolean matches(Object item) {
    MockBaseCallback<T, U> callback = (MockBaseCallback<T, U>) item;
    try {
        await().until(callback.payload(), payloadMatcher);
        await().until(callback.error(), errorMatcher);
        return true;
    } catch (ConditionTimeoutException e) {
        return false;
    }
}
 
开发者ID:auth0,项目名称:Auth0.Android,代码行数:13,代码来源:CallbackMatcher.java

示例5: matches

import com.jayway.awaitility.core.ConditionTimeoutException; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public boolean matches(Object item) {
    MockManagementCallback<T> callback = (MockManagementCallback<T>) item;
    try {
        await().until(callback.payload(), payloadMatcher);
        await().until(callback.error(), errorMatcher);
        return true;
    } catch (ConditionTimeoutException e) {
        return false;
    }
}
 
开发者ID:auth0,项目名称:Auth0.Android,代码行数:13,代码来源:ManagementCallbackMatcher.java

示例6: assertUp

import com.jayway.awaitility.core.ConditionTimeoutException; //导入依赖的package包/类
public RabbitDockerContainer assertUp() {
    RabbitProbe probe = getProbe();
    try {
        Awaitility
                .with()
                .pollDelay(2, TimeUnit.SECONDS)
                .pollInterval(500, TimeUnit.MILLISECONDS)
                .await()
                .atMost(2, TimeUnit.MINUTES)
                .until(probe::isSatisfied);
    } catch(ConditionTimeoutException e) {
        throw new RuntimeException(probe.getLatestError());
    }
    return this;
}
 
开发者ID:meltwater,项目名称:rxrabbit,代码行数:16,代码来源:RabbitDockerContainer.java

示例7: test

import com.jayway.awaitility.core.ConditionTimeoutException; //导入依赖的package包/类
@Test
public void test() {
  try {
    await().atMost(1, TimeUnit.SECONDS).catchUncaughtExceptions().until(getTask());
  } catch (ConditionTimeoutException e) {

    String msg = e.toString();
    msg = Common.hasError(msg) ? msg : Common.error("Timeout Error\n" + lastInput());

    System.err.println(msg);
    System.exit(-1);
  } catch (Throwable t) {
    //t.printStackTrace();
    StackTraceElement[] stackTrace = t.getStackTrace();
    StringBuilder buf = new StringBuilder();

    buf.append(t.fillInStackTrace()).append('\n');

    for (StackTraceElement line : stackTrace) {
      if (classes.contains(line.getClassName())) {
        buf.append(line).append('\n');
      }
    }
    buf.append(lastInput());

    System.err.println(Common.error(buf.toString()));
    System.exit(-1);
  }
}
 
开发者ID:V0L0DYMYR,项目名称:red-black-tree,代码行数:30,代码来源:AbstractTest.java

示例8: verifyRightCountOfEvents

import com.jayway.awaitility.core.ConditionTimeoutException; //导入依赖的package包/类
private void verifyRightCountOfEvents(final Expect[] expectedEvents) {

        for (final Expect expectedEvent : expectedEvents) {
            try {
                Awaitility.await().atMost(5, TimeUnit.SECONDS)
                        .until(() -> eventCaptor.getCountFor(expectedEvent.type()), equalTo(expectedEvent.count()));

            } catch (final ConditionTimeoutException ex) {
                Assert.fail("Did not receive the expected amount of events form " + expectedEvent.type() + " Expected: "
                        + expectedEvent.count() + " but was: " + eventCaptor.getCountFor(expectedEvent.type()));
            }
        }
    }
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:14,代码来源:EventVerifier.java

示例9: joeShouldReceive

import com.jayway.awaitility.core.ConditionTimeoutException; //导入依赖的package包/类
@Test(expected = ConditionTimeoutException.class)
public void
a_client_cannot_write_after_it_left() throws Exception {
    jack.enter();
    joeShouldReceive(welcome("Jack"));

    jack.leave();
    joeShouldReceive(exit("Jack"));

    jack.announce("All alone now ...");

    joeShouldReceive(signed("Jack", "Are alone now ..."));
}
 
开发者ID:philou,项目名称:concurrency-kata,代码行数:14,代码来源:EndToEndTest.java

示例10: matches

import com.jayway.awaitility.core.ConditionTimeoutException; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public boolean matches(Object item) {
    MockLockCallback callback = (MockLockCallback) item;
    try {
        waitAtMost(Duration.ONE_SECOND).await().until(callback.authentication(), authenticationMatcher);
        waitAtMost(Duration.ONE_SECOND).await().until(callback.canceled(), canceledMatcher);
        waitAtMost(Duration.ONE_SECOND).await().until(callback.error(), errorMatcher);
        return true;
    } catch (ConditionTimeoutException e) {
        return false;
    }
}
 
开发者ID:auth0,项目名称:Lock.Android,代码行数:14,代码来源:AuthenticationCallbackMatcher.java

示例11: waitForScanners

import com.jayway.awaitility.core.ConditionTimeoutException; //导入依赖的package包/类
private void waitForScanners(int maxTime) {
    /* XXX!!!!!!!!!!!!!!!!!! */
    if (maxTime == 0) {
        maxTime = 3600*2;
    }
    if (maxTime < timeStep) {
        maxTime = timeStep * 2;
    }
    try {
        Awaitility.with().timeout(maxTime, TimeUnit.SECONDS)
                .and().with().pollDelay(timeStep, TimeUnit.SECONDS)
                .and().with().pollInterval(timeStep, TimeUnit.SECONDS)
                .await()
                .until(new Callable<Boolean>() {
                    @Override
                    public Boolean call() throws Exception {
                        scanTime += timeStep;
                        synchronized (scanners) {
                            Iterator<IScanQueueItem> i = scanners.iterator();
                            while (i.hasNext()) {
                                IScanQueueItem scan = i.next();
                                if (scan.getStatus().equals("finished")) {
                                    i.remove();
                                    totalScanners += 1;
                                } else {
                                    stdout.println("Scanners: " + scanners.size());

                                    if (issues != null) {
                                        callbacks.generateScanReport("XML", issues.toArray(new IScanIssue[issues.size()]),
                                                new File(extConfig.getReportPath()));
                                    }

                                    return false;
                                }
                            }
                        }
                        return true;
                    }
                });
    } catch (ConditionTimeoutException e) {
        /* exiting anyway */
        stdout.println("timeout!");
        timeout = true;
    }
}
 
开发者ID:yandex,项目名称:burp-molly-scanner,代码行数:46,代码来源:BurpExtender.java

示例12: start

import com.jayway.awaitility.core.ConditionTimeoutException; //导入依赖的package包/类
/**
 * Starts the container and waits until is started
 *
 * @param timeout in seconds
 */
@Override
public void start(int timeout) {
    if (containerId != null) {
        return;
    }

    pullImage();

    CreateContainerCmd createCommand = dockerCommand();
    LOGGER.debug("Creating container [" + createCommand.getName() + "]");
    containerId = createCommand.exec().getId();

    DockerClientFactory.build().startContainerCmd(containerId).exec();

    try {

        await("Container did not start within " + timeout + " seconds").atMost(timeout, TimeUnit.SECONDS).pollDelay(1, TimeUnit.SECONDS).until(() -> {
            List<Container> containers = DockerClientFactory.build().listContainersCmd().withShowAll(true).exec();
            for (Container container : containers) {
                if (container.getId().equals(containerId)) {
                    return true;
                }
            }
            return false;
        });

    } catch (ConditionTimeoutException cte) {
        String errorMessage = String.format("Container [%s] did not start within %d seconds.", createCommand.getName(), timeout);
        LOGGER.error(errorMessage);
        try {
            for (String logLine : DockerContainersUtil.getDockerLogs(containerId)) {
                LOGGER.error(logLine);
            }
        } catch (Exception e) {
            LOGGER.error("Could not print container logs", e);
        }
        throw new MinimesosException(errorMessage + " See container logs above");
    }

    LOGGER.debug(String.format("Container %s is up and running", containerId));
}
 
开发者ID:ContainerSolutions,项目名称:minimesos,代码行数:47,代码来源:AbstractContainer.java


注:本文中的com.jayway.awaitility.core.ConditionTimeoutException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。