當前位置: 首頁>>代碼示例>>Java>>正文


Java Lists.newArrayList方法代碼示例

本文整理匯總了Java中org.testng.collections.Lists.newArrayList方法的典型用法代碼示例。如果您正苦於以下問題:Java Lists.newArrayList方法的具體用法?Java Lists.newArrayList怎麽用?Java Lists.newArrayList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.testng.collections.Lists的用法示例。


在下文中一共展示了Lists.newArrayList方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createAnnotationParameters

import org.testng.collections.Lists; //導入方法依賴的package包/類
/**
 * 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;
}
 
開發者ID:reportportal,項目名稱:agent-java-testNG,代碼行數:23,代碼來源:TestNGService.java

示例2: createTestMethods

import org.testng.collections.Lists; //導入方法依賴的package包/類
/**
 * 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;
}
 
開發者ID:qmetry,項目名稱:qaf,代碼行數:24,代碼來源:TestClass.java

示例3: createInstances

import org.testng.collections.Lists; //導入方法依賴的package包/類
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());
  }
 
開發者ID:qmetry,項目名稱:qaf,代碼行數:22,代碼來源:TestRunner.java

示例4: getInjector

import org.testng.collections.Lists; //導入方法依賴的package包/類
@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;
}
 
開發者ID:qmetry,項目名稱:qaf,代碼行數:22,代碼來源:TestRunner.java

示例5: collectAndOrderMethods

import org.testng.collections.Lists; //導入方法依賴的package包/類
/**
 * 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[]{});
}
 
開發者ID:qmetry,項目名稱:qaf,代碼行數:26,代碼來源:MethodHelper.java

示例6: createSuiteMessage

import org.testng.collections.Lists; //導入方法依賴的package包/類
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;
}
 
開發者ID:testng-team,項目名稱:testng-remote,代碼行數:23,代碼來源:MessageHelper.java

示例7: tokenize

import org.testng.collections.Lists; //導入方法依賴的package包/類
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()]);
}
 
開發者ID:testng-team,項目名稱:testng-remote,代碼行數:20,代碼來源:MessageHelper.java

示例8: runTest

import org.testng.collections.Lists; //導入方法依賴的package包/類
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");
  }
}
 
開發者ID:testng-team,項目名稱:testng-remote,代碼行數:24,代碼來源:RemoteTest.java

示例9: testParseLogFiles

import org.testng.collections.Lists; //導入方法依賴的package包/類
@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());
}
 
開發者ID:trew,項目名稱:RankTracker,代碼行數:25,代碼來源:ScanTaskTest.java

示例10: benchmark

import org.testng.collections.Lists; //導入方法依賴的package包/類
@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));
    }
  }
}
 
開發者ID:ben-manes,項目名稱:concurrentlinkedhashmap,代碼行數:26,代碼來源:EfficiencyBenchmark.java

示例11: testFailJobWhenPreviousStateExistsButDoesNotHaveSnapshot

import org.testng.collections.Lists; //導入方法依賴的package包/類
@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());
    }
}
 
開發者ID:apache,項目名稱:incubator-gobblin,代碼行數:23,代碼來源:FileBasedSourceTest.java

示例12: getFunctionIds

import org.testng.collections.Lists; //導入方法依賴的package包/類
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;
}
 
開發者ID:linkedin,項目名稱:pinot,代碼行數:19,代碼來源:CleanupAndRegenerateAnomaliesTool.java

示例13: combine

import org.testng.collections.Lists; //導入方法依賴的package包/類
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()][]);
}
 
開發者ID:eclipse,項目名稱:keti,代碼行數:8,代碼來源:SecurityFilterChainTest.java

示例14: testCasesAll

import org.testng.collections.Lists; //導入方法依賴的package包/類
@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()][]);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:8,代碼來源:DefaultStaticTestData.java

示例15: testInsertMany

import org.testng.collections.Lists; //導入方法依賴的package包/類
@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);
}
 
開發者ID:wxz1211,項目名稱:dooo,代碼行數:11,代碼來源:TestA.java


注:本文中的org.testng.collections.Lists.newArrayList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。