Java 类org.testng.collections.Lists 实例源码

项目:qaf    文件:DependencyMap.java   
public List<ITestNGMethod> getMethodsThatBelongTo(String group, ITestNGMethod fromMethod) {
  Set<String> uniqueKeys = m_groups.keySet();

  List<ITestNGMethod> result = Lists.newArrayList();

  for (String k : uniqueKeys) {
    if (Pattern.matches(group, k)) {
      result.addAll(m_groups.get(k));
    }
  }

  if (result.isEmpty() && !fromMethod.ignoreMissingDependencies()) {
    throw new TestNGException("DependencyMap::Method \"" + fromMethod
        + "\" depends on nonexistent group \"" + group + "\"");
  } else {
    return result;
  }
}
项目:qaf    文件:TestClass.java   
/**
 * Create the test methods that belong to this class (rejects
 * all those that belong to a different class).
 */
private ITestNGMethod[] createTestMethods(ITestNGMethod[] methods) {
  List<ITestNGMethod> vResult = Lists.newArrayList();
  for (ITestNGMethod tm : methods) {
    ConstructorOrMethod m = tm.getConstructorOrMethod();
    if (m.getDeclaringClass().isAssignableFrom(m_testClass)) {
      for (Object o : m_iClass.getInstances(false)) {
        log(4, "Adding method " + tm + " on TestClass " + m_testClass);
        vResult.add(new TestNGScenario(/* tm.getRealClass(), */ m.getMethod(), m_annotationFinder, m_xmlTest,
            o));
      }
    }
    else {
      log(4, "Rejecting method " + tm + " for TestClass " + m_testClass);
    }
  }

  ITestNGMethod[] result = vResult.toArray(new ITestNGMethod[vResult.size()]);
  return result;
}
项目:qaf    文件:TestRunner.java   
/**
 * Apply the method interceptor (if applicable) to the list of methods.
 */
private ITestNGMethod[] intercept(ITestNGMethod[] methods) {
  List<IMethodInstance> methodInstances = methodsToMethodInstances(Arrays.asList(methods));

  // add built-in interceptor (PreserveOrderMethodInterceptor or InstanceOrderingMethodInterceptor at the end of the list
  m_methodInterceptors.add(builtinInterceptor);
  for (IMethodInterceptor m_methodInterceptor : m_methodInterceptors) {
    methodInstances = m_methodInterceptor.intercept(methodInstances, this);
  }

  List<ITestNGMethod> result = Lists.newArrayList();
  for (IMethodInstance imi : methodInstances) {
    result.add(imi.getMethod());
  }

  //Since an interceptor is involved, we would need to ensure that the ClassMethodMap object is in sync with the
  //output of the interceptor, else @AfterClass doesn't get executed at all when interceptors are involved.
  //so let's update the current classMethodMap object with the list of methods obtained from the interceptor.
  this.m_classMethodMap = new ClassMethodMap(result, null);

  return result.toArray(new ITestNGMethod[result.size()]);
}
项目:qaf    文件:TestRunner.java   
private List<List<IMethodInstance>> createInstances(List<IMethodInstance> methodInstances) {
    Map<Object, List<IMethodInstance>> map = Maps.newHashMap();
//    MapList<IMethodInstance[], Object> map = new MapList<IMethodInstance[], Object>();
    for (IMethodInstance imi : methodInstances) {
      for (Object o : imi.getInstances()) {
        System.out.println(o);
        List<IMethodInstance> l = map.get(o);
        if (l == null) {
          l = Lists.newArrayList();
          map.put(o, l);
        }
        l.add(imi);
      }
//      for (Object instance : imi.getInstances()) {
//        map.put(imi, instance);
//      }
    }
//    return map.getKeys();
//    System.out.println(map);
    return new ArrayList<List<IMethodInstance>>(map.values());
  }
项目:qaf    文件:TestRunner.java   
@Override
public Injector getInjector(IClass iClass) {
  Annotation annotation = AnnotationHelper.findAnnotationSuperClasses(Guice.class, iClass.getRealClass());
  if (annotation == null) return null;
  if (iClass instanceof TestClass) {
    iClass = ((TestClass)iClass).getIClass();
  }
  if (!(iClass instanceof ClassImpl)) return null;
  Injector parentInjector = ((ClassImpl)iClass).getParentInjector();

  Guice guice = (Guice) annotation;
  List<Module> moduleInstances = Lists.newArrayList(getModules(guice, parentInjector, iClass.getRealClass()));

  // Reuse the previous injector, if any
  Injector injector = getInjector(moduleInstances);
  if (injector == null) {
    injector = parentInjector.createChildInjector(moduleInstances);
    addInjector(moduleInstances, injector);
  }
  return injector;
}
项目:qaf    文件:MethodHelper.java   
/**
 * Collects and orders test or configuration methods
 * @param methods methods to be worked on
 * @param forTests true for test methods, false for configuration methods
 * @param runInfo
 * @param finder annotation finder
 * @param unique true for unique methods, false otherwise
 * @param outExcludedMethods
 * @return list of ordered methods
 */
public static ITestNGMethod[] collectAndOrderMethods(List<ITestNGMethod> methods,
    boolean forTests, RunInfo runInfo, IAnnotationFinder finder,
    boolean unique, List<ITestNGMethod> outExcludedMethods)
{
  List<ITestNGMethod> includedMethods = Lists.newArrayList();
  MethodGroupsHelper.collectMethodsByGroup(methods.toArray(new ITestNGMethod[methods.size()]),
      forTests,
      includedMethods,
      outExcludedMethods,
      runInfo,
      finder,
      unique);

  return sortMethods(forTests, includedMethods, finder).toArray(new ITestNGMethod[]{});
}
项目:qaf    文件:MethodHelper.java   
private static List<ITestNGMethod> sortMethods(boolean forTests,
    List<ITestNGMethod> allMethods, IAnnotationFinder finder) {
  List<ITestNGMethod> sl = Lists.newArrayList();
  List<ITestNGMethod> pl = Lists.newArrayList();
  ITestNGMethod[] allMethodsArray = allMethods.toArray(new ITestNGMethod[allMethods.size()]);

  // Fix the method inheritance if these are @Configuration methods to make
  // sure base classes are invoked before child classes if 'before' and the
  // other way around if they are 'after'
  if (!forTests && allMethodsArray.length > 0) {
    ITestNGMethod m = allMethodsArray[0];
    boolean before = m.isBeforeClassConfiguration()
        || m.isBeforeMethodConfiguration() || m.isBeforeSuiteConfiguration()
        || m.isBeforeTestConfiguration();
    MethodInheritance.fixMethodInheritance(allMethodsArray, before);
  }

  topologicalSort(allMethodsArray, sl, pl);

  List<ITestNGMethod> result = Lists.newArrayList();
  result.addAll(sl);
  result.addAll(pl);
  return result;
}
项目:agent-java-testNG    文件:TestNGService.java   
/**
 * Process testResult to create parameters provided via {@link Parameters}
 *
 * @param testResult           TestNG's testResult context
 * @param parametersAnnotation Annotation with parameters
 * @return Step Parameters being sent to Report Portal
 */
private List<ParameterResource> createAnnotationParameters(ITestResult testResult, Parameters parametersAnnotation) {
    List<ParameterResource> params = Lists.newArrayList();
    String[] keys = parametersAnnotation.value();
    Object[] parameters = testResult.getParameters();
    if (parameters.length != keys.length) {
        return params;
    }
    for (int i = 0; i < keys.length; i++) {
        ParameterResource parameter = new ParameterResource();
        parameter.setKey(keys[i]);
        parameter.setValue(parameters[i] != null ? parameters[i].toString() : null);
        params.add(parameter);
    }
    return params;
}
项目:testng-remote    文件:MessageHelper.java   
public static SuiteMessage createSuiteMessage(final String message) {
  int type = getMessageType(message);
  String[] messageParts = parseMessage(message);

  SuiteMessage result = new SuiteMessage(messageParts[1],
                          MessageHelper.SUITE_START == type,
                          Integer.parseInt(messageParts[2]));
  // Any excluded methods?
  if (messageParts.length > 3) {
    int count = Integer.parseInt(messageParts[3]);
    if (count > 0) {
      List<String> methods = Lists.newArrayList();
      int i = 4;
      while (count-- > 0) {
        methods.add(messageParts[i++]);
      }
      result.setExcludedMethods(methods);
    }
  }

  return result;
}
项目:testng-remote    文件:MessageHelper.java   
private static String[] tokenize(final String message, final char separator) {
  if(null == message) {
    return new String[0];
  }

  List<String> tokens = Lists.newArrayList();
  int start = 0;
  for(int i = 0; i < message.length(); i++) {
    if(separator == message.charAt(i)) {
      tokens.add(message.substring(start, i));
      start = i + 1;
    }
  }
  if(start < message.length()) {
    tokens.add(message.substring(start, message.length()));
  }

  return tokens.toArray(new String[tokens.size()]);
}
项目:testng-remote    文件:RemoteTest.java   
private void runTest(String arg, int portValue, IMessageSender sms) {
  p("Launching RemoteTestNG on port " + portValue);
  String protocol = null;
  if (sms instanceof JsonMessageSender) {
    protocol = "json";
  }
  launchRemoteTestNG(arg, portValue, protocol);
  MessageHub mh = new MessageHub(sms);
  List<String> received = Lists.newArrayList();
  try {
    mh.initReceiver();
    IMessage message = mh.receiveMessage();
    while (message != null) {
      received.add(message.getClass().getSimpleName());
      message = mh.receiveMessage();
    }

    Assert.assertEquals(received, EXPECTED_MESSAGES);
  }
  catch(SocketTimeoutException ex) {
    Assert.fail("Time out");
  }
}
项目:RankTracker    文件:ScanTaskTest.java   
@Test
public void testParseLogFiles() throws Exception
{
  // setup initial state
  File baseFolder = createBaseFolder();
  File folder = new File(baseFolder, "folder");
  Files.createDirectory(folder.toPath());
  File log1 = LogFileHelper.getValidRLLogFile("ranked.log");
  File log2 = LogFileHelper.getValidRLLogFile("mixed.log");
  Path path1 = Files.copy(log1.toPath(), new File(baseFolder, log1.getName()).toPath());
  Path path2 = Files.copy(log2.toPath(), new File(baseFolder, log2.getName()).toPath());

  List<File> files = Lists.newArrayList(baseFolder.listFiles());
  SortedSet<MatchResult> results = new TreeSet<>();

  ScanTask.parseLogFiles(files, results);

  assertEquals(results.size(), 15);

  Files.delete(path1);
  Files.delete(path2);
  Files.delete(folder.toPath());
  Files.delete(baseFolder.toPath());
}
项目:concurrentlinkedhashmap    文件:EfficiencyBenchmark.java   
@Test(groups = "efficiency")
@Parameters({"capacity", "passes", "generatorMultipler", "workingSetMultiplier"})
public void benchmark(int capacity, int passes, int generatorMultipler,
    int workingSetMultiplier) {
  Generator generator = new ScrambledZipfianGenerator(generatorMultipler * capacity);
  List<List<String>> workingSets = Lists.newArrayList();
  for (int i = 1; i <= passes; i++) {
    int size = i * workingSetMultiplier * capacity;
    workingSets.add(createWorkingSet(generator, size));
  }

  Set<Policy> seen = EnumSet.noneOf(Policy.class);
  for (CacheType cache : CacheType.values()) {
    if (!seen.add(cache.policy())) {
      continue;
    }
    Map<String, String> map = new CacheFactory()
        .maximumCapacity(capacity)
        .makeCache(cache);
    System.out.println(cache.policy().toString() + ":");
    for (List<String> workingSet : workingSets) {
      System.out.println(determineEfficiency(map, workingSet));
    }
  }
}
项目:incubator-gobblin    文件:TimeBasedSelectionPolicyTest.java   
@Test
public void testListCopyableVersions() {
  Properties props = new Properties();
  Path dummyPath = new Path("dummy");
  DateTime dt1 = new DateTime().minusDays(8);
  DateTime dt2 = new DateTime().minusDays(6);

  props.put(SelectAfterTimeBasedPolicy.TIME_BASED_SELECTION_LOOK_BACK_TIME_KEY, "7d");
  SelectAfterTimeBasedPolicy policyLookback7Days = new SelectAfterTimeBasedPolicy(props);
  TimestampedDatasetVersion version1 = new TimestampedDatasetVersion(dt1, dummyPath);
  TimestampedDatasetVersion version2 = new TimestampedDatasetVersion(dt2, dummyPath);
  Assert.assertEquals(policyLookback7Days.listSelectedVersions(Lists.newArrayList(version1, version2)).size(), 1);

  props.put(SelectAfterTimeBasedPolicy.TIME_BASED_SELECTION_LOOK_BACK_TIME_KEY, "1h");
  SelectAfterTimeBasedPolicy policyLookback1Hour = new SelectAfterTimeBasedPolicy(props);
  Assert.assertEquals(policyLookback1Hour.listSelectedVersions(Lists.newArrayList(version1, version2)).size(), 0);

  props.put(SelectAfterTimeBasedPolicy.TIME_BASED_SELECTION_LOOK_BACK_TIME_KEY, "9d");
  SelectAfterTimeBasedPolicy policyLookback8Days = new SelectAfterTimeBasedPolicy(props);
  Assert.assertEquals(policyLookback8Days.listSelectedVersions(Lists.newArrayList(version1, version2)).size(), 2);
}
项目:incubator-gobblin    文件:FileBasedSourceTest.java   
@Test
public void testFailJobWhenPreviousStateExistsButDoesNotHaveSnapshot() {
    try {
        DummyFileBasedSource source = new DummyFileBasedSource();

        WorkUnitState workUnitState = new WorkUnitState();
        workUnitState.setId("priorState");
        List<WorkUnitState> workUnitStates = Lists.newArrayList(workUnitState);

        State state = new State();
        state.setProp(ConfigurationKeys.EXTRACT_TABLE_TYPE_KEY, Extract.TableType.SNAPSHOT_ONLY.toString());
        state.setProp(ConfigurationKeys.SOURCE_FILEBASED_FS_PRIOR_SNAPSHOT_REQUIRED, true);

        SourceState sourceState = new SourceState(state, workUnitStates);

        source.getWorkunits(sourceState);
        Assert.fail("Expected RuntimeException, but no exceptions were thrown.");
    } catch (RuntimeException e) {
        Assert.assertEquals("No 'source.filebased.fs.snapshot' found on state of prior job",
            e.getMessage());
    }
}
项目:omero-csv-tools    文件:AnnotationBlitzServiceTest.java   
@Test
public void listFilesAttachedToContainerShouldConvertNullsToEmptyResult() throws ServerError {
    metadataPrxMock.returns(null).loadSpecifiedAnnotationsLinkedTo(
                    FileAnnotation.class.getName(),
                    null,
                    null,
                    ContainerType.project.getModelClass().getName(),
                    Lists.newArrayList(1L),
                    null);

    Map<Long, Collection<FileAnnotationData>> result =
        annotationService.listFilesAttachedToContainer(
            ContainerType.project.getModelClass(), 1L);

    assertNotNull(result, "Non-null results expected");
    assertTrue(result.isEmpty(), "Empty results expected");

    sessionMock.assertInvoked().getMetadataService();
    metadataPrxMock.assertInvoked().loadSpecifiedAnnotationsLinkedTo(
                    FileAnnotation.class.getName(),
                    null,
                    null,
                    ContainerType.project.getModelClass().getName(),
                    Lists.newArrayList(1L),
                    null);
}
项目:omero-csv-tools    文件:AnnotationBlitzServiceTest.java   
@Test
public void listTagsLinkedToDatasetsShouldConvertNullsToEmptyResult() throws ServerError {
    metadataPrxMock.returns(null).loadSpecifiedAnnotationsLinkedTo(
                    TagAnnotation.class.getName(),
                    null,
                    null,
                    Dataset.class.getName(),
                    Lists.newArrayList(1L),
                    BlitzUtil.byExperimenter(1L));

    Map<Long, Collection<TagAnnotationData>> result =
        annotationService.listTagsLinkedToContainers(1L, Lists.newArrayList(1L), Dataset.class);

    assertNotNull(result, "Non-null results expected");
    assertTrue(result.isEmpty(), "Empty results expected");

    sessionMock.assertInvoked().getMetadataService();
    metadataPrxMock.assertInvoked().loadSpecifiedAnnotationsLinkedTo(
                    TagAnnotation.class.getName(),
                    null,
                    null,
                    Dataset.class.getName(),
                    Lists.newArrayList(1L),
                    BlitzUtil.byExperimenter(1L));
}
项目:omero-csv-tools    文件:CsvAnnotationsReaderTest.java   
@Test
public void getLinesShouldTrimValues() {
    String fixture = "  some.container.name  ,  some.annotation.value , , \n , , , ";
    CsvAnnotationsReader reader =
        new CsvAnnotationsReader(CommonsCsvStringReader.defaultReader(fixture));

    Collection<CsvAnnotationLine> result = reader.getLines();

    assertNotNull(result,"Non null lines expected");
    assertEquals(result.size(), 1, "Wrong lines count");

    CsvAnnotationLine line = Iterables.getOnlyElement(result);
    assertEquals(line.getNumber(), Long.valueOf(1), "Wrong line number");
    assertEquals(line.getSize(), 2, "Wrong line count");
    assertEquals(line.getAnnotationsSize(), 1, "Wrong annotations count");
    assertEquals(line.getAnnotatedName(), "some.container.name", "Wrong target name");
    assertReflectionEquals("Wrong annotation name",
                           Lists.newArrayList("some.annotation.value"),
                           line.getAnnotationsValues(), LENIENT_ORDER);
}
项目:pinot    文件:CleanupAndRegenerateAnomaliesTool.java   
private List<Long> getFunctionIds(String datasets, String functionIds) {
  List<Long> functionIdsList = new ArrayList<>();
  if (StringUtils.isNotBlank(functionIds)) {
    String[] tokens = functionIds.split(",");
    for (String token : tokens) {
      functionIdsList.add(Long.valueOf(token));
    }
  } else if (StringUtils.isNotBlank(datasets)) {
    List<String> datasetsList = Lists.newArrayList(datasets.split(","));
    for (String dataset : datasetsList) {
      List<AnomalyFunctionDTO> anomalyFunctions = anomalyFunctionDAO.findAllByCollection(dataset);
      for (AnomalyFunctionDTO anomalyFunction : anomalyFunctions) {
        functionIdsList.add(anomalyFunction.getId());
      }
    }
  }
  return functionIdsList;
}
项目:Equella    文件:AbstractRestAssuredTest.java   
@BeforeSuite
public void setupProxy(ITestContext testContext)
{
    testContext.getSuite().setAttribute("cleanups", Lists.newArrayList());
    String proxyHost = testConfig.getProperty("proxy.host");
    String proxyPortString = testConfig.getProperty("proxy.port");
    if( proxyPortString != null )
    {
        System.setProperty("http.proxyHost", proxyHost);
        System.setProperty("http.proxyPort", proxyPortString);
    }
}
项目:keti    文件:SecurityFilterChainTest.java   
private static Object[][] combine(final Object[][]... testData) {
    List<Object[]> result = Lists.newArrayList();
    for (Object[][] t : testData) {
        result.addAll(Arrays.asList(t));
    }
    return result.toArray(new Object[result.size()][]);
}
项目:jdk8u-jdk    文件:DefaultStaticTestData.java   
@DataProvider
static Object[][] testCasesAll() {
    List<Object[]> result = Lists.newArrayList();
    result.addAll(Arrays.asList(testClasses()));
    result.addAll(Arrays.asList(testInterfaces()));
    return result.toArray(new Object[result.size()][]);
}
项目:openjdk-jdk10    文件:DefaultStaticTestData.java   
@DataProvider
static Object[][] testCasesAll() {
    List<Object[]> result = Lists.newArrayList();
    result.addAll(Arrays.asList(testClasses()));
    result.addAll(Arrays.asList(testInterfaces()));
    return result.toArray(new Object[result.size()][]);
}
项目:dooo    文件:TestA.java   
@Test
public void testInsertMany() throws Exception {
    List<Map<String, Object>> dataList = Lists.newArrayList();
    for (int i =0; i< 10; i++){
        Map<String, Object> map = Maps.newHashMap();
        map.put("number", i);
        dataList.add(map);
    }
    dataAccess.insertMany("testNumber", dataList);
}
项目:openjdk9    文件:DefaultStaticTestData.java   
@DataProvider
static Object[][] testCasesAll() {
    List<Object[]> result = Lists.newArrayList();
    result.addAll(Arrays.asList(testClasses()));
    result.addAll(Arrays.asList(testInterfaces()));
    return result.toArray(new Object[result.size()][]);
}
项目:incubator-pulsar    文件:ReplicatorTlsTest.java   
@Test
public void testReplicationClient() throws Exception {
    log.info("--- Starting ReplicatorTlsTest::testReplicationClient ---");
    for (BrokerService ns : Lists.newArrayList(ns1, ns2, ns3)) {
        ns.getReplicationClients().forEach((cluster, client) -> {
            assertTrue(((PulsarClientImpl) client).getConfiguration().isUseTls());
            assertEquals(((PulsarClientImpl) client).getConfiguration().getTlsTrustCertsFilePath(),
                    TLS_SERVER_CERT_FILE_PATH);
        });
    }
}
项目:incubator-pulsar    文件:ReplicatorTest.java   
@Test(enabled = false)
public void testConfigChangeNegativeCases() throws Exception {
    log.info("--- Starting ReplicatorTest::testConfigChangeNegativeCases ---");
    // Negative test cases for global namespace config change. Verify that the namespace config change can not be
    // updated when the namespace is being unloaded.
    // Set up field access to internal namespace state in NamespaceService
    Field ownershipCacheField = NamespaceService.class.getDeclaredField("ownershipCache");
    ownershipCacheField.setAccessible(true);
    OwnershipCache ownerCache = (OwnershipCache) ownershipCacheField.get(pulsar1.getNamespaceService());
    Assert.assertNotNull(pulsar1, "pulsar1 is null");
    Assert.assertNotNull(pulsar1.getNamespaceService(), "pulsar1.getNamespaceService() is null");
    NamespaceBundle globalNsBundle = pulsar1.getNamespaceService().getNamespaceBundleFactory()
            .getFullBundle(NamespaceName.get("pulsar/global/ns"));
    ownerCache.tryAcquiringOwnership(globalNsBundle);
    Assert.assertNotNull(ownerCache.getOwnedBundle(globalNsBundle),
            "pulsar1.getNamespaceService().getOwnedServiceUnit(NamespaceName.get(\"pulsar/global/ns\")) is null");
    Field stateField = OwnedBundle.class.getDeclaredField("isActive");
    stateField.setAccessible(true);
    // set the namespace to be disabled
    ownerCache.disableOwnership(globalNsBundle);

    // Make sure the namespace config update failed
    try {
        admin1.namespaces().setNamespaceReplicationClusters("pulsar/global/ns", Lists.newArrayList("r1"));
        fail("Should have raised exception");
    } catch (PreconditionFailedException pfe) {
        // OK
    }

    // restore the namespace state
    ownerCache.removeOwnership(globalNsBundle).get();
    ownerCache.tryAcquiringOwnership(globalNsBundle);
}
项目:java-triton    文件:ImagesIT.java   
@Test(dependsOnMethods = "canListImages")
public void canFindImageById() throws IOException {
    try (CloudApiConnectionContext context = cloudApi.createConnectionContext()) {
        final List<Image> images = Lists.newArrayList(imagesApi.list(context));

        assertFalse(images.isEmpty(), "There must be at least a single image");

        Collections.shuffle(images);

        final UUID imageId = images.iterator().next().getId();
        final Image pkg = imagesApi.findById(imageId);
        assertNotNull(pkg, "There must be a image returned");
        assertEquals(pkg.getId(), imageId, "Image ids must match");
    }
}
项目:java-triton    文件:PackagesIT.java   
@Test(dependsOnMethods = "canListPackages")
public void canFindPackageById() throws IOException {
    try (CloudApiConnectionContext context = cloudApi.createConnectionContext()) {
        final List<Package> packages = Lists.newArrayList(packagesApi.list(context));

        assertFalse(packages.isEmpty(), "There must be at least a single package");

        Collections.shuffle(packages);

        final UUID packageId = packages.iterator().next().getId();
        final Package pkg = packagesApi.findById(packageId);
        assertNotNull(pkg, "There must be a package returned");
        assertEquals(pkg.getId(), packageId, "Package ids must match");
    }
}
项目:qaf    文件:TestRunner.java   
/**
 * @return all the @Listeners annotations found in the current class and its
 * superclasses.
 */
private ListenerHolder findAllListeners(Class<?> cls) {
  ListenerHolder result = new ListenerHolder();
  result.listenerClasses = Lists.newArrayList();

  do {
    IListenersAnnotation l = m_annotationFinder.findAnnotation(cls, IListenersAnnotation.class);
    if (l != null) {
      Class<? extends ITestNGListener>[] classes = l.getValue();
      for (Class<? extends ITestNGListener> c : classes) {
        result.listenerClasses.add(c);

        if (ITestNGListenerFactory.class.isAssignableFrom(c)) {
          if (result.listenerFactoryClass == null) {
            result.listenerFactoryClass = (Class<? extends ITestNGListenerFactory>) c;
          }
          else {
            throw new TestNGException("Found more than one class implementing" +
                "ITestNGListenerFactory:" + c + " and " + result.listenerFactoryClass);
          }
        }
      }
    }
    cls = cls.getSuperclass();
  } while (cls != Object.class);

  return result;
}
项目:qaf    文件:TestRunner.java   
private Map<String, String> createGroups(String[] groups) {
  Map<String, String> result = Maps.newHashMap();

  // Groups that were passed on the command line
  for (String group : groups) {
    result.put(group, group);
  }

  // See if we have any MetaGroups and
  // expand them if they match one of the groups
  // we have just been passed
  List<String> unfinishedGroups = Lists.newArrayList();

  if (m_metaGroups.size() > 0) {
    collectGroups(groups, unfinishedGroups, result);

    // Do we need to loop over unfinished groups?
    while (unfinishedGroups.size() > 0) {
      String[] uGroups = unfinishedGroups.toArray(new String[unfinishedGroups.size()]);
      unfinishedGroups = Lists.newArrayList();
      collectGroups(uGroups, unfinishedGroups, result);
    }
  }

  //    Utils.dumpMap(result);
  return result;
}
项目:qaf    文件:TestRunner.java   
private IMethodInstance[] findClasses(List<IMethodInstance> methodInstances, Class<?> c) {
  List<IMethodInstance> result = Lists.newArrayList();
  for (IMethodInstance mi : methodInstances) {
    if (mi.getMethod().getTestClass().getRealClass() == c) {
      result.add(mi);
    }
  }
  return result.toArray(new IMethodInstance[result.size()]);
}
项目:qaf    文件:TestRunner.java   
/**
 * @@@ remove this
 */
private List<MethodInstance> methodsToMultipleMethodInstances(ITestNGMethod... sl) {
  List<MethodInstance> vResult = Lists.newArrayList();
  for (ITestNGMethod m : sl) {
    vResult.add(new MethodInstance(m));
  }

  return vResult;
}
项目:qaf    文件:TestRunner.java   
public List<ITestNGMethod> getInvokedMethods() {
  List<ITestNGMethod> result= Lists.newArrayList();
  synchronized(m_invokedMethods) {
    for (IInvokedMethod im : m_invokedMethods) {
      ITestNGMethod tm= im.getTestMethod();
      tm.setDate(im.getDate());
      result.add(tm);
    }
  }

  return result;
}
项目:qaf    文件:MethodHelper.java   
/**
 * Extracts the unique list of <code>ITestNGMethod</code>s.
 */
public static List<ITestNGMethod> uniqueMethodList(Collection<List<ITestNGMethod>> methods) {
  Set<ITestNGMethod> resultSet = Sets.newHashSet();

  for (List<ITestNGMethod> l : methods) {
    resultSet.addAll(l);
  }

  return Lists.newArrayList(resultSet);
}
项目:qaf    文件:MethodHelper.java   
/**
 * @return A sorted array containing all the methods 'method' depends on
 */
public static List<ITestNGMethod> getMethodsDependedUpon(ITestNGMethod method, ITestNGMethod[] methods) {
  Graph<ITestNGMethod> g = GRAPH_CACHE.get(methods);
  if (g == null) {
    List<ITestNGMethod> parallelList = Lists.newArrayList();
    List<ITestNGMethod> sequentialList = Lists.newArrayList();
    g = topologicalSort(methods, sequentialList, parallelList);
    GRAPH_CACHE.put(methods, g);
  }

  List<ITestNGMethod> result = g.findPredecessors(method);
  return result;
}
项目:yql-plus    文件:LongSource.java   
@Query
public Iterable<Sample> getSampleIds(long start, long end, boolean increment) {
    List<Sample> samples = Lists.newArrayList();
    if (increment) {         
        samples.add(new Sample(start + 1, end + 1));
    } else {
        samples.add(new Sample(start, end));
    }
    return samples;
}
项目:jdk8u_jdk    文件:DefaultStaticTestData.java   
@DataProvider
static Object[][] testCasesAll() {
    List<Object[]> result = Lists.newArrayList();
    result.addAll(Arrays.asList(testClasses()));
    result.addAll(Arrays.asList(testInterfaces()));
    return result.toArray(new Object[result.size()][]);
}
项目:emodb    文件:SorUpdateTest.java   
@Test
public void testUpdatesAndDatabusEvents() {
    resetValues();
    UUID changeId1 = TimeUUIDs.newUUID();
    SystemClock.tick();
    UUID changeId2 = TimeUUIDs.newUUID();
    _dataStore.update("test:table", "rowkey", changeId1, Deltas.mapBuilder()
            .update("test", Deltas.literal("testValue"))
            .build(),
            new AuditBuilder().setComment("Update").build());

    // Verify that databus would receive the correct UpdateIntentEvent
    UpdateIntentEvent expectedUpdateIntentEvent = new UpdateIntentEvent(_dataStore, Lists.newArrayList(
            new UpdateRef("test:table", "rowkey", changeId1, ImmutableSet.<String>of())));
    assertEquals(_updateIntentEvent.getUpdateRefs(), expectedUpdateIntentEvent.getUpdateRefs(), "Expected events not generated on databus");

    // Try updating the event but suppress databus events
    resetValues();
    _dataStore.updateAll(Lists.newArrayList(new Update("test:table", "rowkey", changeId2,
                    Deltas.mapBuilder()
                            .update("test", Deltas.literal("testValue"))
                            .build(),
                    new AuditBuilder().setComment("Update").build())),
            ImmutableSet.of("ignore"));

    // Verify that the ignorable flag is set
    expectedUpdateIntentEvent = new UpdateIntentEvent(_dataStore, Lists.newArrayList(new UpdateRef("test:table", "rowkey", changeId2, ImmutableSet.of("ignore"))));
    assertEquals(_updateIntentEvent.getUpdateRefs(), expectedUpdateIntentEvent.getUpdateRefs(), "Expected events not generated on databus");
}
项目:lookaside_java-1.8.0-openjdk    文件:DefaultStaticTestData.java   
@DataProvider
static Object[][] testCasesAll() {
    List<Object[]> result = Lists.newArrayList();
    result.addAll(Arrays.asList(testClasses()));
    result.addAll(Arrays.asList(testInterfaces()));
    return result.toArray(new Object[result.size()][]);
}