Skip to content

Instantly share code, notes, and snippets.

[vagrant@fedora ~]$ vagrant plugin install vagrant-hostsupdater --debug
INFO global: Vagrant version: 1.8.4
INFO global: Ruby version: 2.2.3
INFO global: RubyGems version: 2.4.5.1
INFO global: VAGRANT_OLD_ENV_SSH_CLIENT="10.0.2.2 44132 22"
INFO global: VAGRANT_OLD_ENV_LESSOPEN="|/usr/bin/lesspipe.sh %s"
INFO global: VAGRANT_INSTALLER_ENV="1"
INFO global: VAGRANT_OLD_ENV_HOSTNAME="fedora"
INFO global: VAGRANT_OLD_ENV_SHELL="/bin/bash"
INFO global: VAGRANT_OLD_ENV_SSH_CONNECTION="10.0.2.2 44132 10.0.2.15 22"
using System;
using System.Collections.Generic;
using System.Text;
namespace Com.Api
{
public class ApiOptions
{
private string _clientIdentifier;
private int _defaultConnectionLimit;
/// <summary>
/// Construct an Api with the specific Trader platform to connect to.
/// For testing: 'https://testapi.123.com' and production: 'https://api.123.com'.
/// </summary>
/// <param name="urlBase" />
/// A <see cref="String"> that contains the url of the system to connect to.
///
/// <param name="apiOptions" />Allows for configuration of the Api.
public Api(String urlBase, ApiOptions apiOptions) :
this(urlBase, new HttpInvoker(apiOptions), new SaxParser())
public Api(String urlBase) :
this(urlBase, new HttpInvoker(), new SaxParser())
{
}
public Api(String urlBase, String clientIdentifier) :
this(urlBase, new HttpInvoker(TruncateClientId(clientIdentifier)), new SaxParser())
{
}
static HttpInvoker()
{
ServicePointManager.Expect100Continue = false;
ServicePointManager.UseNagleAlgorithm = false;
ServicePointManager.DefaultConnectionLimit = 5;
}
public Collection<ResultData> search(final Collection<String> searchTerms) {
final Multimap<Integer, ResultData> sortedResults = TreeMultimap.create(Ordering.natural().reverse(), new ResultDataComparator());
for (final String term : searchTerms) {
for(final ResultData record : dao.searchDatabase(term)) {
if (sortedResults.containsValue(record)) {
for (final Integer key : sortedResults.keySet()) {
if (sortedResults.get(key).contains(record)) {
sortedResults.get(key).remove(record);
sortedResults.put(key + 1, record);
public Collection<ResultData> search(final Collection<String> terms) {
final Map<ResultData, Integer> results = new TreeMap<ResultData, Integer>();
for (final String term : terms) {
final Collection<ResultData> queryResults = dao.searchDatabase(term);
for (final ResultData record : queryResults) {
final Integer weighting = results.get(record);
if (weighting == null) {
public Collection<ResultData> search(final Collection<String> terms) {
final Collection<ResultData> results = new HashSet<ResultData>();
for (final String term : terms) {
results.addAll(dao.searchDatabase(term));
}
return results;
}
public Collection<ResultData> search(final Collection<String> terms) {
final Collection<ResultData> results = new LinkedList<ResultData>();
for (final String term : terms) {
results.addAll(dao.searchDatabase(term));
}
return results;
}
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.16</version>
<configuration>
<includes>
<include>**/*IntegrationTest.java</include>
</includes>