Tabnine Logo
TestContext.await
Code IndexAdd Tabnine to your IDE (free)

How to use
await
method
in
com.vmware.xenon.common.test.TestContext

Best Java code snippets using com.vmware.xenon.common.test.TestContext.await (Showing top 20 results out of 315)

origin: vmware/xenon

private void runAfter(TestContext ctx, long additionalDelay, Runnable action) {
  Thread t = new Thread(() -> {
    ctx.await();
    if (additionalDelay > 0) {
      sleep(additionalDelay);
    }
    action.run();
  });
  t.setDaemon(true);
  t.start();
}
origin: com.vmware.xenon/xenon-common

private void runAfter(TestContext ctx, long additionalDelay, Runnable action) {
  Thread t = new Thread(() -> {
    ctx.await();
    if (additionalDelay > 0) {
      sleep(additionalDelay);
    }
    action.run();
  });
  t.setDaemon(true);
  t.start();
}
origin: vmware/admiral

private void waitFor(Map map, int count) {
  TestContext context = new TestContext(1, Duration.ofMinutes(1));
  schedule(map, count, context);
  context.await();
}
origin: vmware/xenon

public void await(DeferredResult<?> deferredResult) {
  await(() -> {
    if (deferredResult.isDone()) {
      this.completeIteration();
    }
  });
}
origin: vmware/admiral

protected void waitForServiceAvailability(ServiceHost h, String... serviceLinks)
    throws Throwable {
  if (serviceLinks == null || serviceLinks.length == 0) {
    throw new IllegalArgumentException("null or empty serviceLinks");
  }
  TestContext ctx = testCreate(serviceLinks.length);
  h.registerForServiceAvailability(ctx.getCompletion(), serviceLinks);
  ctx.await();
}
origin: vmware/admiral

@Test
public void testCreateionOfChangeComputeNameTopic() {
  // On start service creates new topic. No need for explicit post for creation.
  TestContext context = new TestContext(1, Duration.ofSeconds(120));
  verifyThatTopicExists(CHANGE_COMPUTE_NAME_SELF_LINK, context);
  context.await();
}
origin: vmware/admiral

@Test
public void testCreateionOfChangeContainerNameTopic() {
  // On start service creates new topic. No need for explicit post for creation.
  TestContext context = new TestContext(1, Duration.ofSeconds(120));
  verifyThatTopicExists(CHANGE_CONTAINER_NAME_SELF_LINK, context);
  context.await();
}
origin: com.vmware.xenon/xenon-common

public void waitForServiceAvailable(String... links) {
  for (String link : links) {
    TestContext ctx = testCreate(1);
    this.registerForServiceAvailability(ctx.getCompletion(), link);
    ctx.await();
  }
}
origin: vmware/xenon

public void waitForServiceAvailable(String... links) {
  for (String link : links) {
    TestContext ctx = testCreate(1);
    this.registerForServiceAvailability(ctx.getCompletion(), link);
    ctx.await();
  }
}
origin: com.vmware.xenon/xenon-common

public void waitForReplicatedFactoryServiceNotAvailable(VerificationHost host, URI u, String nodeSelectorPath) {
  host.waitFor("replicated not available check time out for " + u, () -> {
    boolean[] isReady = new boolean[1];
    TestContext ctx = testCreate(1);
    NodeGroupUtils.checkServiceAvailability((o, e) -> {
      isReady[0] = e != null;
      ctx.completeIteration();
    }, this.host, u, nodeSelectorPath);
    ctx.await();
    return isReady[0];
  });
}
origin: vmware/xenon

public void waitForReplicatedFactoryServiceNotAvailable(VerificationHost host, URI u, String nodeSelectorPath) {
  host.waitFor("replicated not available check time out for " + u, () -> {
    boolean[] isReady = new boolean[1];
    TestContext ctx = testCreate(1);
    NodeGroupUtils.checkServiceAvailability((o, e) -> {
      isReady[0] = e != null;
      ctx.completeIteration();
    }, this.host, u, nodeSelectorPath);
    ctx.await();
    return isReady[0];
  });
}
origin: com.vmware.xenon/xenon-common

public void waitForReplicatedFactoryServiceNotAvailable(VerificationHost host, URI u, String nodeSelectorPath) {
  host.waitFor("replicated not available check time out for " + u, () -> {
    boolean[] isReady = new boolean[1];
    TestContext ctx = testCreate(1);
    NodeGroupUtils.checkServiceAvailability((o, e) -> {
      isReady[0] = e != null;
      ctx.completeIteration();
    }, this.host, u, nodeSelectorPath);
    ctx.await();
    return isReady[0];
  });
}
origin: vmware/admiral

@Test
public void testNoHarborProperty() throws Exception {
  TestContext t = new TestContext(1, Duration.ofSeconds(15));
  harborInitRegistryService.handleStart(Operation
      .createGet(null)
      .setCompletion(t.getCompletion()));
  t.await();
  RegistryState harborRegistry = getHarborRegistry(false);
  assertNull(harborRegistry);
}
origin: vmware/xenon

@Test
public void testThenApply() throws Throwable {
  TestContext ctx = new TestContext(1, TestContext.DEFAULT_WAIT_DURATION);
  DeferredResult<Integer> original = new DeferredResult<>();
  DeferredResult<Integer> result = original
      .thenApply(i -> i + 1);
  result.whenComplete(ctx.getCompletionDeferred());
  runAfter(10, () -> original.complete(1));
  ctx.await();
  Assert.assertEquals(2, result.getNow(0).intValue());
}
origin: com.vmware.xenon/xenon-common

@Test
public void testThenApply() throws Throwable {
  TestContext ctx = new TestContext(1, TestContext.DEFAULT_WAIT_DURATION);
  DeferredResult<Integer> original = new DeferredResult<>();
  DeferredResult<Integer> result = original
      .thenApply(i -> i + 1);
  result.whenComplete(ctx.getCompletionDeferred());
  runAfter(10, () -> original.complete(1));
  ctx.await();
  Assert.assertEquals(2, result.getNow(0).intValue());
}
origin: com.vmware.xenon/xenon-common

@Test
public void testThenAcceptCanThrowException() throws Throwable {
  TestContext ctx = new TestContext(1, TestContext.DEFAULT_WAIT_DURATION);
  DeferredResult<Integer> original = new DeferredResult<>();
  original
    .thenAccept(i -> {
      throw new TestException();
    })
    .whenComplete(getExpectedExceptionCompletion(ctx));
  runAfter(10, () -> original.complete(1));
  ctx.await();
}
origin: vmware/xenon

public static void stopContinuousQuerySubscription(TestRequestSender s, ServiceHost host,
    URI notificationTarget, QueryTask qt) {
  TestContext ctx = new TestContext(1, s.getTimeout());
  Operation delete = Operation
      .createDelete(UriUtils.buildUri(notificationTarget, qt.documentSelfLink))
      .setReferer(host.getUri())
      .setCompletion(ctx.getCompletion());
  host.stopSubscriptionService(delete, notificationTarget);
  ctx.await();
}
origin: vmware/xenon

@Test
public void testThenAcceptCanThrowException() throws Throwable {
  TestContext ctx = new TestContext(1, TestContext.DEFAULT_WAIT_DURATION);
  DeferredResult<Integer> original = new DeferredResult<>();
  original
    .thenAccept(i -> {
      throw new TestException();
    })
    .whenComplete(getExpectedExceptionCompletion(ctx));
  runAfter(10, () -> original.complete(1));
  ctx.await();
}
origin: com.vmware.xenon/xenon-common

@Test
public void testThenComposeNestedStageException() throws Throwable {
  TestContext ctx = new TestContext(1, TestContext.DEFAULT_WAIT_DURATION);
  DeferredResult.completed(12345)
    .thenCompose(ignore -> {
      DeferredResult<String> nested = new DeferredResult<>();
      runAfter(10, () -> nested.fail(new TestException()));
      return nested;
    })
    .whenComplete(getExpectedExceptionCompletion(ctx));
  ctx.await();
}
origin: vmware/xenon

@Test
public void testThenComposeNestedStageException() throws Throwable {
  TestContext ctx = new TestContext(1, TestContext.DEFAULT_WAIT_DURATION);
  DeferredResult.completed(12345)
    .thenCompose(ignore -> {
      DeferredResult<String> nested = new DeferredResult<>();
      runAfter(10, () -> nested.fail(new TestException()));
      return nested;
    })
    .whenComplete(getExpectedExceptionCompletion(ctx));
  ctx.await();
}
com.vmware.xenon.common.testTestContextawait

Popular methods of TestContext

  • fail
  • completeIteration
    Consider using #complete(). This method exists for backward compatibility, and may be deprecated/del
  • failIteration
    Consider using #fail(Throwable). This method exists for backward compatibility, and may be deprecate
  • <init>
  • complete
  • getCompletion
  • create
    Consider using #TestContext(int,Duration)This method exists for backward compatibility, and may be d
  • getExpectedFailureCompletion
  • getCompletionDeferred
  • logAfter
  • logBefore
  • setCheckInterval
  • logBefore,
  • setCheckInterval,
  • setTestName,
  • waitFor

Popular in Java

  • Start an intent from android
  • notifyDataSetChanged (ArrayAdapter)
  • findViewById (Activity)
  • onRequestPermissionsResult (Fragment)
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now