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


Java Maps.newHashMap方法代码示例

本文整理汇总了Java中org.testng.collections.Maps.newHashMap方法的典型用法代码示例。如果您正苦于以下问题:Java Maps.newHashMap方法的具体用法?Java Maps.newHashMap怎么用?Java Maps.newHashMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.testng.collections.Maps的用法示例。


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

示例1: createDocTest

import org.testng.collections.Maps; //导入方法依赖的package包/类
@Test
void createDocTest()
{
	BaseIndexer indexer = new SolrIndexer("", TEST1);
	List<String> languages = Lists.newArrayList();
	languages.add(LOCALE);
	Map<String, Object> createdDoc = indexer.createDoc(ID, ENGLISH_TITLE, SPANISH_TITLE, ALT_TITLE, languages);
	Map<String, Object> expectedDoc = Maps.newHashMap();
	expectedDoc.put(Properties.idField.get(), ID + "_" + TEST1);
	expectedDoc.put(Properties.titleFields.get().get(0) + "_en", ENGLISH_TITLE);
	Set<Object> localizedTitles = Sets.newHashSet();
	localizedTitles.add(SPANISH_TITLE);
	expectedDoc.put(Properties.titleFields.get().get(0) + "_es", localizedTitles);
	expectedDoc.put(Properties.docTypeFieldName.get(), TEST1);
	Assert.assertEquals(createdDoc, expectedDoc);

	StringBuilder jsonStringOfDoc = indexer.getJsonStringOfDoc(new ObjectMapper().valueToTree(createdDoc));
	Assert.assertEquals(jsonStringOfDoc.toString(), "[{\"query_testing_type\":\"test1\",\"title_en\":\"title en\",\"id\":\"123_test1\",\"title_es\":[\"title es\"]}]");
	
	String urlForAddingDoc = indexer.getUrlForAddingDoc(createdDoc);
	Assert.assertEquals(urlForAddingDoc, "http://localhost:8983/solr/qtest/update");

	String urlForCommitting = indexer.getUrlForCommitting();
	Assert.assertEquals(urlForCommitting, "http://localhost:8983/solr/qtest/update?commit=true");
}
 
开发者ID:Netflix,项目名称:q,代码行数:26,代码来源:SolrIndexerTest.java

示例2: createInstances

import org.testng.collections.Maps; //导入方法依赖的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

示例3: getNodeReplicas

import org.testng.collections.Maps; //导入方法依赖的package包/类
/** Returns all replicas per node. */
private Map<String, List<ReplicaInfo>> getNodeReplicas() {
    final ClusterState clusterState = getClusterState();
    final Map<String, List<ReplicaInfo>> result = Maps.newHashMap();
    for (final DocCollection collection : clusterState.getCollectionsMap().values()) {
        for (final Slice slice : collection.getSlices()) {
            for (final Replica replica : slice.getReplicas()) {
                List<ReplicaInfo> nodeReplicas = result.get(replica.getNodeName());
                if (nodeReplicas == null) {
                    nodeReplicas = Lists.newArrayList();
                    result.put(replica.getNodeName(), nodeReplicas);
                }
                nodeReplicas.add(new ReplicaInfo(replica, collection.getName(), slice.getName()));
            }
        }
    }
    return result;
}
 
开发者ID:shaie,项目名称:lucenelab,代码行数:19,代码来源:CollectionsStateHelper.java

示例4: testInsertMany

import org.testng.collections.Maps; //导入方法依赖的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

示例5: createDocTest

import org.testng.collections.Maps; //导入方法依赖的package包/类
@Test
void createDocTest()
{

	BaseIndexer indexer = new ElasticsearchIndexer("", TEST1);
	List<String> languages = Lists.newArrayList();
	languages.add(LOCALE);
	Map<String, Object> createdDoc = indexer.createDoc(ID, ENGLISH_TITLE, SPANISH_TITLE, ALT_TITLE, languages);
	Map<String, Object> expectedDoc = Maps.newHashMap();
	expectedDoc.put(Properties.idField.get(), ID + "_" + TEST1);
	expectedDoc.put(Properties.titleFields.get().get(0) + "_en", ENGLISH_TITLE);
	Set<Object> localizedTitles = Sets.newHashSet();
	localizedTitles.add(SPANISH_TITLE);
	expectedDoc.put(Properties.titleFields.get().get(0) + "_es", localizedTitles);
	expectedDoc.put(Properties.docTypeFieldName.get(), TEST1);

	Assert.assertEquals(createdDoc, expectedDoc);

	StringBuilder jsonStringOfDoc = indexer.getJsonStringOfDoc(new ObjectMapper().valueToTree(createdDoc));
	Assert.assertEquals(jsonStringOfDoc.toString(), "{\"query_testing_type\":\"test1\",\"title_en\":\"title en\",\"id\":\"123_test1\",\"title_es\":[\"title es\"]}");
	
	String urlForAddingDoc = indexer.getUrlForAddingDoc(createdDoc);
	Assert.assertEquals(urlForAddingDoc, "http://localhost:8983/solr/qtest/test_doc/123_test1");

	String urlForCommitting = indexer.getUrlForCommitting();
	Assert.assertEquals(urlForCommitting, "http://localhost:8983/solr/qtest/_flush");

}
 
开发者ID:Netflix,项目名称:q,代码行数:29,代码来源:ElasticsearchIndexerTest.java

示例6: createDocTest

import org.testng.collections.Maps; //导入方法依赖的package包/类
@Test
void createDocTest()
{
	GoogleDataExtractor titleExtractor = Mockito.mock(GoogleDataExtractor.class);
	Map<String, Map<Integer, TitleWithQueries>> mapOfQueriesToTitles = Maps.newHashMap();
	
	Map<Integer, TitleWithQueries> titlesWithQueries = Maps.newHashMap();
	TitleWithQueries titleWithQueries = new TitleWithQueries(DATASET_ID);
	titleWithQueries.setValue(TitleWithQueries.ID, ID1);
	titleWithQueries.setValue(TitleWithQueries.TITLE_EN, ENGLISH_TITLE);
	titleWithQueries.setValue(TitleWithQueries.TITLE_LOCALE, SPANISH_TITLE);
	titleWithQueries.setValue(TitleWithQueries.Q_ + "regular", Q1);
	titlesWithQueries.put(1, titleWithQueries);

	TitleWithQueries titleWithQueries2 = new TitleWithQueries(DATASET_ID);
	titleWithQueries2.setValue(TitleWithQueries.ID, ID2);
	titleWithQueries2.setValue(TitleWithQueries.TITLE_EN, ENGLISH_TITLE);
	titleWithQueries2.setValue(TitleWithQueries.TITLE_LOCALE, SPANISH_TITLE);
	titleWithQueries2.setValue(TitleWithQueries.Q_ + "regular", Q1);
	titlesWithQueries.put(2, titleWithQueries2);

	mapOfQueriesToTitles.put(DATASET_ID, titlesWithQueries);

	Mockito.when(titleExtractor.getTitlesWithQueriesPerDataset()).thenReturn(mapOfQueriesToTitles);

	Queries queries = new Queries(DATASET_ID, TEST1, titleExtractor);
	queries.populateFromGoogleSpreadsheets();

	Map<String, Set<String>> queryToIdMap = queries.getQueryToIdMap();

	Map<String, Set<String>> expectedQueryToIdMap = Maps.newHashMap();
	Set<String> titles = Sets.newHashSet();
	titles.add(ID1+"_"+DATASET_ID);
	titles.add(ID2+"_"+DATASET_ID);
	expectedQueryToIdMap.put(Q1, titles);

	Assert.assertEquals(queryToIdMap, expectedQueryToIdMap);
}
 
开发者ID:Netflix,项目名称:q,代码行数:39,代码来源:QueriesTest.java

示例7: createGroups

import org.testng.collections.Maps; //导入方法依赖的package包/类
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;
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:28,代码来源:TestRunner.java

示例8: getExcludedMethods

import org.testng.collections.Maps; //导入方法依赖的package包/类
@Override
public Collection<ITestNGMethod> getExcludedMethods() {
  Map<ITestNGMethod, ITestNGMethod> vResult = Maps.newHashMap();

  for (ITestNGMethod m : m_excludedMethods) {
    vResult.put(m, m);
  }

  return vResult.keySet();
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:11,代码来源:TestRunner.java

示例9: dataProviderForBDD

import org.testng.collections.Maps; //导入方法依赖的package包/类
@DataProvider(name="dp-with-testngmethod-contex")
public Object[][] dataProviderForBDD(ITestNGMethod method, ITestContext contex){
	Map<Object, Object> m = Maps.newHashMap();
	m.put("method", method.getMethodName());
	m.put("contex", contex.getName());
	return new Object[][]{{m}};
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:8,代码来源:CustomDataProvider.java

示例10: SuiteMessage

import org.testng.collections.Maps; //导入方法依赖的package包/类
public SuiteMessage(final ISuite suite, final boolean startSuiteRun) {
  m_suiteName = suite.getName();
  m_testMethodCount =suite.getInvokedMethods().size();
  m_startSuite = startSuiteRun;
  Collection<ITestNGMethod> excludedMethods = suite.getExcludedMethods();
  if (excludedMethods != null && excludedMethods.size() > 0) {
    m_excludedMethods = Lists.newArrayList();
    m_descriptions = Maps.newHashMap();
    for (ITestNGMethod m : excludedMethods) {
      String methodName = m.getTestClass().getName() + "." + m.getMethodName();
      m_excludedMethods.add(methodName);
      if (m.getDescription() != null) m_descriptions.put(methodName, m.getDescription());
    }
  }
}
 
开发者ID:testng-team,项目名称:testng-remote,代码行数:16,代码来源:SuiteMessage.java

示例11: testResolveDashedProperties

import org.testng.collections.Maps; //导入方法依赖的package包/类
@Test(dataProvider = "envPropMap")
public void testResolveDashedProperties(String key, String value, String keyENV, String valueENV) throws Exception {
    Properties props = new Properties();
    props.put(key, value);
    props = EnvironmentPropertyConfigurer.resolveDashedProperties(props);
    assertEquals(props.size(), 1);
    assertEquals(props.get(key), value);

    Map<String, String> envMap = Maps.newHashMap(System.getenv());
    envMap.put(keyENV, valueENV);
    props = EnvironmentPropertyConfigurer.resolveDashedProperties(props, envMap);
    assertEquals(props.size(), 1);
    assertEquals(props.get(key), valueENV);
}
 
开发者ID:ConSol,项目名称:sakuli,代码行数:15,代码来源:EnvironmentPropertyConfigurerTest.java

示例12: copyTableQueryTest

import org.testng.collections.Maps; //导入方法依赖的package包/类
@Test
public void copyTableQueryTest() throws Exception {
  Map<String, String> partitionsDMLInfo = Maps.newHashMap();
  String partitionName = "datepartition";
  String partitionValue = "2017-07-15-08";

  partitionsDMLInfo.put(partitionName, partitionValue);
  String expectedQuery = "INSERT OVERWRITE TABLE `" + outputDatabaseName + "`.`" + outputTableName + "` \n"
      + "PARTITION (`" + partitionName + "`) \n" + "SELECT * FROM `" + inputDbName + "`.`" + inputTableName + "` WHERE "
      + "`" + partitionName + "`='" + partitionsDMLInfo.get(partitionName) + "'";

  String actualQuery = HiveConverterUtils.generateTableCopy(inputTableName,
      outputTableName, inputDbName, outputDatabaseName, Optional.of(partitionsDMLInfo));
  Assert.assertEquals(expectedQuery, actualQuery);
}
 
开发者ID:apache,项目名称:incubator-gobblin,代码行数:16,代码来源:HiveConverterUtilsTest.java

示例13: getDownReplicas

import org.testng.collections.Maps; //导入方法依赖的package包/类
/**
 * Returns all the nodes with down replicas. Note that some replicas for a node may not be marked DOWN, however per
 * node returned there is at least one replica that was marked DOWN.
 */
public Map<String, List<ReplicaInfo>> getDownReplicas() {
    final Map<String, List<ReplicaInfo>> nodeReplicas = getNodeReplicas();
    final Map<String, List<ReplicaInfo>> result = Maps.newHashMap();
    for (final Entry<String, List<ReplicaInfo>> entry : nodeReplicas.entrySet()) {
        for (final ReplicaInfo replicaInfo : entry.getValue()) {
            if (isReplicaDown(replicaInfo.getReplica())) {
                result.put(entry.getKey(), entry.getValue());
            }
        }
    }
    return result;
}
 
开发者ID:shaie,项目名称:lucenelab,代码行数:17,代码来源:CollectionsStateHelper.java

示例14: buildTestClassGroups

import org.testng.collections.Maps; //导入方法依赖的package包/类
private Map<String, List<ITestResult>> buildTestClassGroups(Set<ITestResult> testResults) {
  Map<String, List<ITestResult>> map = Maps.newHashMap();
  for (ITestResult result : testResults) {
    String className = result.getTestClass().getName();
    List<ITestResult> list = map.get(className);
    if (list == null) {
      list = Lists.newArrayList();
      map.put(className, list);
    }
    list.add(result);
  }
  return map;
}
 
开发者ID:bigtester,项目名称:automation-test-engine,代码行数:14,代码来源:ATEXMLSuiteResultWriter.java

示例15: testTlsSyncProducerAndConsumer

import org.testng.collections.Maps; //导入方法依赖的package包/类
/**
 * <pre>
 * It verifies e2e tls + Authentication + Authorization (client -> proxy -> broker>
 * 
 * 1. client connects to proxy over tls and pass auth-data
 * 2. proxy authenticate client and retrieve client-role 
 *    and send it to broker as originalPrincipal over tls
 * 3. client creates producer/consumer via proxy
 * 4. broker authorize producer/consumer create request using originalPrincipal
 * 
 * </pre>
 * 
 * @throws Exception
 */
@Test
public void testTlsSyncProducerAndConsumer() throws Exception {
    log.info("-- Starting {} test --", methodName);

    final String proxyServiceUrl = "pulsar://localhost:" + proxyConfig.getServicePortTls();
    Map<String, String> authParams = Maps.newHashMap();
    authParams.put("tlsCertFile", TLS_CLIENT_CERT_FILE_PATH);
    authParams.put("tlsKeyFile", TLS_CLIENT_KEY_FILE_PATH);
    Authentication authTls = new AuthenticationTls();
    authTls.configure(authParams);
    // create a client which connects to proxy over tls and pass authData
    PulsarClient proxyClient = createPulsarClient(authTls, proxyServiceUrl);

    admin.clusters().createCluster("use", new ClusterData(brokerUrl.toString(), brokerUrlTls.toString(),
            "pulsar://localhost:" + BROKER_PORT, "pulsar+ssl://localhost:" + BROKER_PORT_TLS));
    admin.properties().createProperty("my-property",
            new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), Sets.newHashSet("use")));
    admin.namespaces().createNamespace("my-property/use/my-ns");

    ConsumerConfiguration conf = new ConsumerConfiguration();
    conf.setSubscriptionType(SubscriptionType.Exclusive);
    Consumer consumer = proxyClient.subscribe("persistent://my-property/use/my-ns/my-topic1", "my-subscriber-name",
            conf);

    ProducerConfiguration producerConf = new ProducerConfiguration();

    Producer producer = proxyClient.createProducer("persistent://my-property/use/my-ns/my-topic1", producerConf);
    final int msgs = 10;
    for (int i = 0; i < msgs; i++) {
        String message = "my-message-" + i;
        producer.send(message.getBytes());
    }

    Message msg = null;
    Set<String> messageSet = Sets.newHashSet();
    int count = 0;
    for (int i = 0; i < 10; i++) {
        msg = consumer.receive(5, TimeUnit.SECONDS);
        String receivedMessage = new String(msg.getData());
        log.debug("Received message: [{}]", receivedMessage);
        String expectedMessage = "my-message-" + i;
        testMessageOrderAndDuplicates(messageSet, receivedMessage, expectedMessage);
        count++;
    }
    // Acknowledge the consumption of all messages at once
    Assert.assertEquals(msgs, count);
    consumer.acknowledgeCumulative(msg);
    consumer.close();
    log.info("-- Exiting {} test --", methodName);
}
 
开发者ID:apache,项目名称:incubator-pulsar,代码行数:65,代码来源:ProxyAuthenticatedProducerConsumerTest.java


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