Tabnine Logo
TestContext.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.vmware.xenon.common.test.TestContext
constructor

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

origin: vmware/xenon

/**
 * Consider using {@link #TestContext(int, Duration)}
 * This method exists for backward compatibility, and may be deprecated/deleted in future.
 */
public static TestContext create(int count, long expIntervalMicros) {
  return new TestContext(count, Duration.of(expIntervalMicros, ChronoUnit.MICROS));
}
origin: com.vmware.xenon/xenon-common

/**
 * Consider using {@link #TestContext(int, Duration)}
 * This method exists for backward compatibility, and may be deprecated/deleted in future.
 */
public static TestContext create(int count, long expIntervalMicros) {
  return new TestContext(count, Duration.of(expIntervalMicros, ChronoUnit.MICROS));
}
origin: vmware/admiral

private void waitFor(String errorMessage, TestWaitForHandler handler) throws Throwable {
  TestContext context = new TestContext(1, Duration.ofMinutes(1));
  waitFor(handler, context);
  try {
    context.await();
  } catch (Exception e) {
    throw new Exception(errorMessage, e);
  }
}
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/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: 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

private static void waitForDefaultRegistryCreated(ManagementHost host) {
  TestContext ctx = new TestContext(1, Duration.ofSeconds(120));
  host.log(Level.INFO, "Waiting for default registry to start.");
  host.registerForServiceAvailability(ctx.getCompletion(),
      RegistryService.DEFAULT_INSTANCE_LINK);
  ctx.await();
  host.log(Level.INFO, "Default registry started.");
}
origin: vmware/xenon

@Test
public void testThenRun() throws Throwable {
  TestContext ctx = new TestContext(1, TestContext.DEFAULT_WAIT_DURATION);
  AtomicInteger invocations = new AtomicInteger();
  DeferredResult<Integer> original = new DeferredResult<>();
  original
    .thenRun(() -> {
      invocations.incrementAndGet();
    })
    .whenComplete(ctx.getCompletionDeferred());
  runAfter(10, () -> original.complete(1));
  ctx.await();
  Assert.assertEquals(1, invocations.get());
}
origin: vmware/xenon

@Test
public void testGetNowWithValue() throws Throwable {
  TestContext ctx = new TestContext(1, TestContext.DEFAULT_WAIT_DURATION);
  TestContext synchCtx = new TestContext(1, TestContext.DEFAULT_WAIT_DURATION);
  int defaultValue = 0;
  int value = 10;
  DeferredResult<Integer> deferredResult = new DeferredResult<>();
  deferredResult.whenComplete(ctx.getCompletionDeferred());
  runAfter(synchCtx, () -> deferredResult.complete(value));
  Assert.assertEquals(defaultValue, deferredResult.getNow(defaultValue).intValue());
  synchCtx.complete();
  ctx.await();
  Assert.assertEquals(value, deferredResult.getNow(defaultValue).intValue());
}
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: 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: 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: 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: 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: com.vmware.xenon/xenon-common

@Test
public void testThenCombine() throws Throwable {
  TestContext ctx = new TestContext(1, TestContext.DEFAULT_WAIT_DURATION);
  DeferredResult<Integer> original = new DeferredResult<>();
  DeferredResult<Integer> other = new DeferredResult<>();
  DeferredResult<Integer> result = original
      .thenCombine(other, (x, y) -> x + y);
  result.whenComplete(ctx.getCompletionDeferred());
  runAfter(10, () -> original.complete(1));
  runAfter(20, () -> other.complete(2));
  ctx.await();
  Assert.assertEquals(3, result.getNow(0).intValue());
}
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

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 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: 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: com.vmware.xenon/xenon-common

@Test
public void testThenCompose() throws Throwable {
  TestContext ctx = new TestContext(1, TestContext.DEFAULT_WAIT_DURATION);
  DeferredResult<String> result = DeferredResult.completed(12345)
      .thenCompose(ignore -> {
        DeferredResult<String> nested = new DeferredResult<>();
        runAfter(10, () -> nested.complete("foo"));
        return nested;
      });
  result.whenComplete(ctx.getCompletionDeferred());
  ctx.await();
  Assert.assertEquals("foo", result.getNow("bar"));
}
com.vmware.xenon.common.testTestContext<init>

Popular methods of TestContext

  • await
  • 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
  • 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

  • Reactive rest calls using spring rest template
  • scheduleAtFixedRate (Timer)
  • putExtra (Intent)
  • setRequestProperty (URLConnection)
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • From CI to AI: The AI layer in your organization
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