io.airlift.testing.Assertions.assertLessThan()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(88)

本文整理了Java中io.airlift.testing.Assertions.assertLessThan()方法的一些代码示例,展示了Assertions.assertLessThan()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assertions.assertLessThan()方法的具体详情如下:
包路径:io.airlift.testing.Assertions
类名称:Assertions
方法名:assertLessThan

Assertions.assertLessThan介绍

暂无

代码示例

代码示例来源:origin: prestodb/presto

@Override
public void createCatalog(String catalogName, String connectorName, Map<String, String> properties)
{
  long start = System.nanoTime();
  Set<ConnectorId> connectorIds = new HashSet<>();
  for (TestingPrestoServer server : servers) {
    connectorIds.add(server.createCatalog(catalogName, connectorName, properties));
  }
  ConnectorId connectorId = getOnlyElement(connectorIds);
  log.info("Created catalog %s (%s) in %s", catalogName, connectorId, nanosSince(start));
  // wait for all nodes to announce the new catalog
  start = System.nanoTime();
  while (!isConnectionVisibleToAllNodes(connectorId)) {
    Assertions.assertLessThan(nanosSince(start), new Duration(100, SECONDS), "waiting for connector " + connectorId + " to be initialized in every node");
    try {
      MILLISECONDS.sleep(10);
    }
    catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new RuntimeException(e);
    }
  }
  log.info("Announced catalog %s (%s) in %s", catalogName, connectorId, nanosSince(start));
}

代码示例来源:origin: prestodb/presto

@Test
public void testReserved()
{
  for (StandardErrorCode errorCode : StandardErrorCode.values()) {
    assertLessThan(code(errorCode), EXTERNAL_ERROR_START);
  }
}

代码示例来源:origin: prestodb/presto

static void waitForNodeRefresh(TestingPrestoServer server)
    throws InterruptedException
{
  long start = System.nanoTime();
  while (server.refreshNodes().getActiveNodes().size() < 1) {
    assertLessThan(nanosSince(start), new Duration(10, SECONDS));
    MILLISECONDS.sleep(10);
  }
}

代码示例来源:origin: prestodb/presto

@Test(dataProvider = "provideStandardErrors")
public void testMultiplePositions(double maxStandardError)
{
  DescriptiveStatistics stats = new DescriptiveStatistics();
  for (int i = 0; i < 500; ++i) {
    int uniques = ThreadLocalRandom.current().nextInt(getUniqueValuesCount()) + 1;
    List<Object> values = createRandomSample(uniques, (int) (uniques * 1.5));
    long actual = estimateGroupByCount(values, maxStandardError);
    double error = (actual - uniques) * 1.0 / uniques;
    stats.addValue(error);
  }
  assertLessThan(stats.getMean(), 1.0e-2);
  assertLessThan(stats.getStandardDeviation(), 1.0e-2 + maxStandardError);
}

代码示例来源:origin: prestodb/presto

private void waitForNodes(int numberOfNodes)
      throws InterruptedException
  {
    DistributedQueryRunner queryRunner = (DistributedQueryRunner) getQueryRunner();
    long start = System.nanoTime();
    while (queryRunner.getCoordinator().refreshNodes().getActiveNodes().size() < numberOfNodes) {
      assertLessThan(nanosSince(start), new Duration(10, SECONDS));
      MILLISECONDS.sleep(10);
    }
  }
}

代码示例来源:origin: prestodb/presto

Assertions.assertLessThan(nanosSince(start), new Duration(10, SECONDS));
MILLISECONDS.sleep(10);

代码示例来源:origin: prestodb/presto

public static void waitForGlobalResourceGroup(DistributedQueryRunner queryRunner)
    throws InterruptedException
{
  long startTime = System.nanoTime();
  while (true) {
    SECONDS.sleep(1);
    ResourceGroupInfo global = getResourceGroupManager(queryRunner).getResourceGroupInfo(new ResourceGroupId("global"));
    if (global.getSoftMemoryLimit().toBytes() > 0) {
      break;
    }
    assertLessThan(nanosSince(startTime).roundTo(SECONDS), 60L);
  }
}

代码示例来源:origin: prestodb/presto

int lowerBound = binomial.inverseCumulativeProbability(0.000001);
int upperBound = binomial.inverseCumulativeProbability(0.999999);
assertLessThan(foo, upperBound);
assertGreaterThan(foo, lowerBound);
lowerBound = binomial.inverseCumulativeProbability(0.000001);
upperBound = binomial.inverseCumulativeProbability(0.999999);
assertLessThan(foo, upperBound);
assertGreaterThan(foo, lowerBound);

代码示例来源:origin: prestodb/presto

@Test
public void testSingleDictionaryColumnByteLimit()
{
  int bytesPerEntry = 1024;
  int dictionaryEntries = 1024;
  TestDictionaryColumn column = dictionaryColumn(bytesPerEntry, dictionaryEntries);
  // construct a simulator that will hit the row limit first
  int stripeMaxBytes = megabytes(100);
  int bytesPerRow = estimateIndexBytesPerValue(dictionaryEntries);
  int expectedMaxRowCount = stripeMaxBytes / bytesPerRow;
  DataSimulator simulator = new DataSimulator(0, stripeMaxBytes, expectedMaxRowCount * 10, megabytes(16), 0, column);
  for (int loop = 0; loop < 3; loop++) {
    assertFalse(simulator.isDictionaryMemoryFull());
    assertFalse(column.isDirect());
    assertEquals(simulator.getRowCount(), 0);
    assertEquals(simulator.getBufferedBytes(), 0);
    simulator.advanceToNextStateChange();
    // since there dictionary columns is only 1 MB, the simulator should advance until the strip is full
    assertFalse(simulator.isDictionaryMemoryFull());
    assertFalse(column.isDirect());
    assertGreaterThanOrEqual(simulator.getBufferedBytes(), (long) stripeMaxBytes);
    assertLessThan(simulator.getRowCount(), expectedMaxRowCount);
    simulator.finalOptimize();
    assertFalse(simulator.isDictionaryMemoryFull());
    assertFalse(column.isDirect());
    assertGreaterThanOrEqual(simulator.getBufferedBytes(), (long) stripeMaxBytes);
    assertLessThan(simulator.getRowCount(), expectedMaxRowCount);
    simulator.reset();
  }
}

代码示例来源:origin: prestodb/presto

assertLessThan(simulator.getBufferedBytes(), (long) stripeMaxBytes);
assertGreaterThanOrEqual(simulator.getRowCount(), expectedMaxRowCount);
assertLessThan(simulator.getBufferedBytes(), (long) stripeMaxBytes);
assertGreaterThanOrEqual(simulator.getRowCount(), expectedMaxRowCount);

代码示例来源:origin: prestodb/presto

assertLessThan(simulator.getBufferedBytes(), (long) stripeMaxBytes);
assertGreaterThanOrEqual(simulator.getRowCount(), expectedMaxRowCount);
assertLessThan(simulator.getBufferedBytes(), (long) stripeMaxBytes);
assertGreaterThanOrEqual(simulator.getRowCount(), expectedMaxRowCount);

代码示例来源:origin: prestodb/presto

assertTrue(directColumn.isDirect());
assertFalse(dictionaryColumn.isDirect());
assertLessThan(simulator.getBufferedBytes(), (long) stripeMaxBytes);
assertGreaterThanOrEqual(simulator.getRowCount(), expectedRowCountAtFlip);

代码示例来源:origin: prestodb/presto

assertLessThan(simulator.getBufferedBytes(), (long) stripeMaxBytes);
assertGreaterThanOrEqual(simulator.getRowCount(), expectedRowCountAtFlip);

代码示例来源:origin: prestodb/presto

assertLessThan(simulator.getBufferedBytes(), (long) stripeMaxBytes);
assertGreaterThanOrEqual(simulator.getRowCount(), expectedRowCountAtFlip);

代码示例来源:origin: prestodb/presto

assertLessThan(Duration.nanosSince(start), new Duration(5, TimeUnit.SECONDS));
sleepUninterruptibly(100, MILLISECONDS);
assertLessThan(Duration.nanosSince(start), new Duration(5, TimeUnit.SECONDS));
sleepUninterruptibly(100, MILLISECONDS);
assertLessThan(Duration.nanosSince(start), new Duration(5, TimeUnit.SECONDS));
sleepUninterruptibly(100, MILLISECONDS);

代码示例来源:origin: prestodb/presto

int lowerBound = binomial.inverseCumulativeProbability(0.000001);
int upperBound = binomial.inverseCumulativeProbability(0.999999);
assertLessThan(group2Ran, upperBound);
assertGreaterThan(group2Ran, lowerBound);

代码示例来源:origin: prestodb/presto

assertLessThan(higherLevelTime, (lowerLevelTime * 2) + 10);

代码示例来源:origin: prestodb/presto

assertLessThan(additionalMemoryInBytes, 1L << 21, "additionalMemoryInBytes should be a relatively small number");
List<Page> result = new LinkedList<>();
    assertLessThan(actualIncreasedMemory, additionalMemoryInBytes);

代码示例来源:origin: airlift/airlift

@SuppressWarnings({"unchecked", "rawtypes"})
public void passLessThan(Comparable actual, Comparable expected)
{
  assertLessThan(actual, expected);
  assertLessThan(actual, expected, MESSAGE);
}

代码示例来源:origin: com.facebook.presto/presto-jdbc

static void waitForNodeRefresh(TestingPrestoServer server)
    throws InterruptedException
{
  long start = System.nanoTime();
  while (server.refreshNodes().getActiveNodes().size() < 1) {
    assertLessThan(nanosSince(start), new Duration(10, SECONDS));
    MILLISECONDS.sleep(10);
  }
}

相关文章