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


Java Repeat类代码示例

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


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

示例1: testReproducible

import com.carrotsearch.randomizedtesting.annotations.Repeat; //导入依赖的package包/类
@Test
@SuppressForbidden(reason = "repeat is a feature here")
@Repeat(iterations = 10, useConstantSeed = true)
public void testReproducible() throws IOException {
    if (ITER++ == 0) {
        CLUSTER_SEED = cluster().seed();
        for (int i = 0; i < SEQUENCE.length; i++) {
            SEQUENCE[i] = randomLong();
        }
    } else {
        assertEquals(CLUSTER_SEED, Long.valueOf(cluster().seed()));
        for (int i = 0; i < SEQUENCE.length; i++) {
            assertThat(SEQUENCE[i], equalTo(randomLong()));
        }
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:SuiteScopeClusterIT.java

示例2: testLeaveZombie

import com.carrotsearch.randomizedtesting.annotations.Repeat; //导入依赖的package包/类
@Repeat(iterations = TOTAL_ITERS)
public void testLeaveZombie() {
  if (++testNum == 2) {
    zombie = new Thread() {
      @Override
      public void run() {
        while (true) {
          try {
            die.await();
            return;
          } catch (Exception e) { /* ignore */ }
        }
      }
    };
    zombie.start();
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:18,代码来源:TestMaxFailuresRule.java

示例3: testLowerUpper

import com.carrotsearch.randomizedtesting.annotations.Repeat; //导入依赖的package包/类
@Test
@Repeat(iterations=10)
public void testLowerUpper() {
  final Integer[] arr = new Integer[randomIntBetween(10, 100)];
  final int max = randomInt(20);
  for (int i = 0; i < arr.length; ++i) {
    arr[i] = randomInt(max);
  }
  Arrays.sort(arr);
  final TimSorter sorter = new ArrayTimSorter<Integer>(arr, arr.length);
  final int savedStart = randomInt(arr.length / 2);
  final int savedLength = randomIntBetween(1, arr.length - savedStart);
  sorter.saveAll(savedStart, savedLength);
  final int savedOff = randomInt(savedLength - 1);
  final int off = savedStart + savedOff;
  final int from = randomInt(arr.length / 2);
  final int to = randomIntBetween(arr.length / 2, arr.length);

  assertEquals(sorter.lower(from, to, off), sorter.lowerSaved(from, to, savedOff));
  assertEquals(sorter.lower(from, to, off), sorter.lowerSaved3(from, to, savedOff));
  assertEquals(sorter.upper(from, to, off), sorter.upperSaved(from, to, savedOff));
  assertEquals(sorter.upper(from, to, off), sorter.upperSaved3(from, to, savedOff));
}
 
开发者ID:jpountz,项目名称:sorts,代码行数:24,代码来源:TimSorterTest.java

示例4: testAdded

import com.carrotsearch.randomizedtesting.annotations.Repeat; //导入依赖的package包/类
@Test
@Repeat(iterations = 5)
public void testAdded() throws Exception {

    final Response<List<GetValue>> initialResponse = randomListGetValueResponse();
    final GetValue added = randomGetVal();
    final List<GetValue> updatedList = Lists.newArrayList(initialResponse.getValue());
    updatedList.add(added);
    final Response<List<GetValue>> initialResponsePlus = randomResponse(updatedList);
    //noinspection unchecked
    when(client.getKVValues(eq(rootPath), any(QueryParams.class))).thenReturn(initialResponse, initialResponsePlus);

    UpdateListener listener = new UpdateListener();
    configSource.addUpdateListener(listener);

    configSource.runOnce();

    assertThat(configSource.getLatestIndex(), is(initialResponse.getConsulIndex()));

    configSource.runOnce();

    assertThat(configSource.getLatestIndex(), is(initialResponsePlus.getConsulIndex()));
    assertThat(listener.events.get(), is(2));
    assertThat(configSource.getCurrentData().values(), hasItem(decodeVal(added.getValue())));

    WatchedUpdateResult result = listener.results.get(1);
    assertThat(result.getAdded().values(), hasItem(decodeVal(added.getValue())));
    assertThat(result.getDeleted().isEmpty(), is(true));
    assertThat(result.getChanged().isEmpty(), is(true));
    assertThat(result.isIncremental(), is(true));


}
 
开发者ID:boundary,项目名称:archaius-consul,代码行数:34,代码来源:ConsulWatchedConfigurationSourceTest.java

示例5: testRemoved

import com.carrotsearch.randomizedtesting.annotations.Repeat; //导入依赖的package包/类
@Test
@Repeat(iterations = 5)
public void testRemoved() throws Exception {

    final Response<List<GetValue>> initialResponse = randomListGetValueResponse();
    final GetValue removed = initialResponse.getValue().get(randomInt(initialResponse.getValue().size() -1));
    final List<GetValue> updatedList = Lists.newArrayList(initialResponse.getValue());
    updatedList.remove(removed);
    final Response<List<GetValue>> initialResponseMinus = randomResponse(updatedList);
    //noinspection unchecked
    when(client.getKVValues(eq(rootPath), any(QueryParams.class))).thenReturn(initialResponse, initialResponseMinus);

    UpdateListener listener = new UpdateListener();
    configSource.addUpdateListener(listener);


    configSource.runOnce();

    assertThat(configSource.getLatestIndex(), is(initialResponse.getConsulIndex()));

    configSource.runOnce();

    assertThat(configSource.getLatestIndex(), is(initialResponseMinus.getConsulIndex()));
    assertThat(listener.events.get(), is(2));
    assertThat(configSource.getCurrentData().values(), not(hasItem(decodeVal(removed.getValue()))));

    WatchedUpdateResult result = listener.results.get(1);
    assertThat(result.getDeleted().values(), hasItem(decodeVal(removed.getValue())));
    assertThat(result.getAdded().isEmpty(), is(true));
    assertThat(result.getChanged().isEmpty(), is(true));
    assertThat(result.isIncremental(), is(true));


}
 
开发者ID:boundary,项目名称:archaius-consul,代码行数:35,代码来源:ConsulWatchedConfigurationSourceTest.java

示例6: testOperations

import com.carrotsearch.randomizedtesting.annotations.Repeat; //导入依赖的package包/类
@Test
@Repeat(iterations = 20)
public void testOperations() throws IOException {
  //setup
  if (random().nextInt(4) > 0) {//75% of the time choose geo (more interesting to test)
    this.ctx = SpatialContext.GEO;
  } else {
    SpatialContextFactory factory = new SpatialContextFactory();
    factory.geo = false;
    factory.worldBounds = new RectangleImpl(-300, 300, -100, 100, null);
    this.ctx = factory.newSpatialContext();
  }
  this.strategy = new BBoxStrategy(ctx, "bbox");
  //test we can disable docValues for predicate tests
  if (random().nextBoolean()) {
    BBoxStrategy bboxStrategy = (BBoxStrategy) strategy;
    FieldType fieldType = new FieldType(bboxStrategy.getFieldType());
    fieldType.setDocValueType(null);
    bboxStrategy.setFieldType(fieldType);
  }
  for (SpatialOperation operation : SpatialOperation.values()) {
    if (operation == SpatialOperation.Overlaps)
      continue;//unsupported
    testOperationRandomShapes(operation);

    deleteAll();
    commit();
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:30,代码来源:TestBBoxStrategy.java

示例7: testFailSometimes

import com.carrotsearch.randomizedtesting.annotations.Repeat; //导入依赖的package包/类
@Repeat(iterations = TOTAL_ITERS)
public void testFailSometimes() {
  numIters++;
  boolean fail = random().nextInt(5) == 0;
  if (fail) numFails++;
  // some seeds are really lucky ... so cheat.
  if (numFails < DESIRED_FAILURES && 
      DESIRED_FAILURES <= TOTAL_ITERS - numIters) {
    fail = true;
  }
  assertFalse(fail);
}
 
开发者ID:europeana,项目名称:search,代码行数:13,代码来源:TestMaxFailuresRule.java

示例8: testLowerUpper

import com.carrotsearch.randomizedtesting.annotations.Repeat; //导入依赖的package包/类
@Test
@Repeat(iterations=10)
public void testLowerUpper() {
  final Integer[] arr = new Integer[randomIntBetween(10, 100)];
  for (int i = 0; i < arr.length; ++i) {
    arr[i] = randomInt(20);
  }
  Arrays.sort(arr);
  final Sorter sorter = new ArrayHeapSorter<Integer>(arr);
  final int off = randomInt(arr.length - 1);
  final int from = randomInt(arr.length / 2);
  final int to = randomIntBetween(arr.length / 2, arr.length);

  int dest = sorter.lower(from, to, off);
  if (dest > from) {
    assertTrue(arr[off] > arr[dest - 1]);
  }
  if (dest < to) {
    assertTrue(arr[off] <= arr[dest]);
  }

  int dest2 = sorter.lower2(from, to, off);
  assertEquals(dest, dest2);

  dest = sorter.upper(from, to, off);
  if (dest > from) {
    assertTrue(arr[off] >= arr[dest - 1]);
  }
  if (dest < to) {
    assertTrue(arr[off] < arr[dest]);
  }

  dest2 = sorter.upper2(from, to, off);
  assertEquals(dest, dest2);
}
 
开发者ID:jpountz,项目名称:sorts,代码行数:36,代码来源:SorterTest.java

示例9: testIntersects

import com.carrotsearch.randomizedtesting.annotations.Repeat; //导入依赖的package包/类
@Test
@Repeat(iterations = ITERATIONS)
public void testIntersects() throws IOException {
  setupGrid(-1);
  doTest(SpatialOperation.Intersects);
}
 
开发者ID:europeana,项目名称:search,代码行数:7,代码来源:SpatialOpRecursivePrefixTreeTest.java

示例10: testWithin

import com.carrotsearch.randomizedtesting.annotations.Repeat; //导入依赖的package包/类
@Test
@Repeat(iterations = ITERATIONS)
public void testWithin() throws IOException {
  setupGrid(-1);
  doTest(SpatialOperation.IsWithin);
}
 
开发者ID:europeana,项目名称:search,代码行数:7,代码来源:SpatialOpRecursivePrefixTreeTest.java

示例11: testContains

import com.carrotsearch.randomizedtesting.annotations.Repeat; //导入依赖的package包/类
@Test
@Repeat(iterations = ITERATIONS)
public void testContains() throws IOException {
  setupGrid(-1);
  doTest(SpatialOperation.Contains);
}
 
开发者ID:europeana,项目名称:search,代码行数:7,代码来源:SpatialOpRecursivePrefixTreeTest.java

示例12: testDisjoint

import com.carrotsearch.randomizedtesting.annotations.Repeat; //导入依赖的package包/类
@Test
@Repeat(iterations = ITERATIONS)
public void testDisjoint() throws IOException {
  setupGrid(-1);
  doTest(SpatialOperation.IsDisjointTo);
}
 
开发者ID:europeana,项目名称:search,代码行数:7,代码来源:SpatialOpRecursivePrefixTreeTest.java

示例13: testNoDupsRemoveDups

import com.carrotsearch.randomizedtesting.annotations.Repeat; //导入依赖的package包/类
@Repeat(iterations = REPEATS)
public void testNoDupsRemoveDups() {
  testCase(1, 1, true);
}
 
开发者ID:europeana,项目名称:search,代码行数:5,代码来源:TestMergedIterator.java

示例14: testOffItrDupsRemoveDups

import com.carrotsearch.randomizedtesting.annotations.Repeat; //导入依赖的package包/类
@Repeat(iterations = REPEATS)
public void testOffItrDupsRemoveDups() {
  testCase(3, 1, true);
}
 
开发者ID:europeana,项目名称:search,代码行数:5,代码来源:TestMergedIterator.java

示例15: testOnItrDupsRemoveDups

import com.carrotsearch.randomizedtesting.annotations.Repeat; //导入依赖的package包/类
@Repeat(iterations = REPEATS)
public void testOnItrDupsRemoveDups() {
  testCase(1, 3, true);
}
 
开发者ID:europeana,项目名称:search,代码行数:5,代码来源:TestMergedIterator.java


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