Java Code Examples for com.google.common.annotations.VisibleForTesting

The following are top voted examples for showing how to use com.google.common.annotations.VisibleForTesting. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: async-sqs   File: SendMessageBatchAction.java   Source Code and License 7 votes vote down vote up
@VisibleForTesting
static SendMessageBatchRequest createRequest(String queueUrl, Map<String, SendMessageEntry> entries) {
    return new SendMessageBatchRequest()
            .withQueueUrl(queueUrl)
            .withEntries(entries.entrySet().stream().map(keyValue -> {
                        SendMessageBatchRequestEntry entry = new SendMessageBatchRequestEntry()
                                .withId(keyValue.getKey())
                                .withMessageBody(keyValue.getValue().getBody());

                        keyValue.getValue().getDelay()
                                .ifPresent((delay) -> entry.setDelaySeconds((int) delay.getSeconds()));

                        return entry;
                    }).collect(Collectors.toList())
            );
}
 
Example 2
Project: rest-modeling-framework   File: StaticGenerator.java   Source Code and License 6 votes vote down vote up
@VisibleForTesting
String generateContent(URL staticFile, Api api) throws IOException {
    final STGroupFile stGroup = createSTGroup(staticFile);
    final String fileName = new File(staticFile.getPath()).getName();

    final ST st = stGroup.getInstanceOf("main");
    st.add("vendorName", vendorName);
    if (fileName.equals("ResourceClassMap.php.stg")) {
        st.add("package", TypeGenModel.TYPES);
    }
    if (fileName.equals("Config.php.stg")) {
        final String apiUri = api.getBaseUri().getTemplate();
        final String authUri = api.getSecuritySchemes().stream()
                .filter(securityScheme -> securityScheme.getSettings() instanceof OAuth20Settings)
                .map(securityScheme -> ((OAuth20Settings)securityScheme.getSettings()).getAccessTokenUri())
                .findFirst().orElse("");
        st.add("apiUri", apiUri);
        st.add("authUri", authUri);
    }
    return st.render();
}
 
Example 3
Project: dropwizard-influxdb-reporter   File: DropwizardTransformer.java   Source Code and License 6 votes vote down vote up
/**
 * Build an {@link InfluxDbMeasurement} from a meter.
 */
@VisibleForTesting InfluxDbMeasurement fromMeter(final String metricName, final Meter mt, final long timestamp) {
  final DropwizardMeasurement measurement = parser.parse(metricName);

  final Map<String, String> tags = new HashMap<>(baseTags);
  tags.putAll(measurement.tags());

  return new InfluxDbMeasurement.Builder(measurement.name(), timestamp)
    .putTags(tags)
    .putField("count", mt.getCount())
    .putField("one-minute", convertRate(mt.getOneMinuteRate()))
    .putField("five-minute", convertRate(mt.getFiveMinuteRate()))
    .putField("fifteen-minute", convertRate(mt.getFifteenMinuteRate()))
    .putField("mean-minute", convertRate(mt.getMeanRate()))
    .build();
}
 
Example 4
Project: sstable-adaptor   File: ColumnDefinition.java   Source Code and License 6 votes vote down vote up
@VisibleForTesting
public ColumnDefinition(String ksName,
                        String cfName,
                        ColumnIdentifier name,
                        AbstractType<?> type,
                        int position,
                        Kind kind)
{
    super(ksName, cfName, name, type);
    assert name != null && type != null && kind != null;
    assert name.isInterned();
    assert (position == NO_POSITION) == !kind.isPrimaryKeyKind(); // The position really only make sense for partition and clustering columns (and those must have one),
                                                                  // so make sure we don't sneak it for something else since it'd breaks equals()
    this.kind = kind;
    this.position = position;
    this.cellPathComparator = makeCellPathComparator(kind, type);
    this.cellComparator = cellPathComparator == null ? ColumnData.comparator : (a, b) -> cellPathComparator.compare(a.path(), b.path());
    this.asymmetricCellPathComparator = cellPathComparator == null ? null : (a, b) -> cellPathComparator.compare(((Cell)a).path(), (CellPath) b);
    this.comparisonOrder = comparisonOrder(kind, isComplex(), Math.max(0, position), name);
}
 
Example 5
Project: hadoop-oss   File: SecureIOUtils.java   Source Code and License 6 votes vote down vote up
/**
 * Same as openFSDataInputStream except that it will run even if security is
 * off. This is used by unit tests.
 */
@VisibleForTesting
protected static FSDataInputStream forceSecureOpenFSDataInputStream(
    File file,
    String expectedOwner, String expectedGroup) throws IOException {
  final FSDataInputStream in =
      rawFilesystem.open(new Path(file.getAbsolutePath()));
  boolean success = false;
  try {
    Stat stat = NativeIO.POSIX.getFstat(in.getFileDescriptor());
    checkStat(file, stat.getOwner(), stat.getGroup(), expectedOwner,
        expectedGroup);
    success = true;
    return in;
  } finally {
    if (!success) {
      in.close();
    }
  }
}
 
Example 6
Project: Elasticsearch   File: TransportShardUpsertAction.java   Source Code and License 6 votes vote down vote up
@VisibleForTesting
Map<String, Object> buildMapFromSource(Reference[] insertColumns,
                                       Object[] insertValues,
                                       boolean isRawSourceInsert) {
    Map<String, Object> sourceAsMap;
    if (isRawSourceInsert) {
        BytesRef source = (BytesRef) insertValues[0];
        sourceAsMap = XContentHelper.convertToMap(new BytesArray(source), true).v2();
    } else {
        sourceAsMap = new LinkedHashMap<>(insertColumns.length);
        for (int i = 0; i < insertColumns.length; i++) {
            sourceAsMap.put(insertColumns[i].ident().columnIdent().fqn(), insertValues[i]);
        }
    }
    return sourceAsMap;
}
 
Example 7
Project: hadoop   File: OpenFileCtx.java   Source Code and License 6 votes vote down vote up
@VisibleForTesting
public static void alterWriteRequest(WRITE3Request request, long cachedOffset) {
  long offset = request.getOffset();
  int count = request.getCount();
  long smallerCount = offset + count - cachedOffset;
  if (LOG.isDebugEnabled()) {
    LOG.debug(String.format("Got overwrite with appended data (%d-%d),"
        + " current offset %d," + " drop the overlapped section (%d-%d)"
        + " and append new data (%d-%d).", offset, (offset + count - 1),
        cachedOffset, offset, (cachedOffset - 1), cachedOffset, (offset
            + count - 1)));
  }
  
  ByteBuffer data = request.getData();
  Preconditions.checkState(data.position() == 0,
      "The write request data has non-zero position");
  data.position((int) (cachedOffset - offset));
  Preconditions.checkState(data.limit() - data.position() == smallerCount,
      "The write request buffer has wrong limit/position regarding count");
  
  request.setOffset(cachedOffset);
  request.setCount((int) smallerCount);
}
 
Example 8
Project: hadoop-oss   File: JavaKeyStoreProvider.java   Source Code and License 5 votes vote down vote up
@VisibleForTesting
JavaKeyStoreProvider(JavaKeyStoreProvider other) {
  super(new Configuration());
  uri = other.uri;
  path = other.path;
  fs = other.fs;
  permissions = other.permissions;
  keyStore = other.keyStore;
  password = other.password;
  changed = other.changed;
  readLock = other.readLock;
  writeLock = other.writeLock;
}
 
Example 9
Project: devtools-driver   File: InspectorMessenger.java   Source Code and License 5 votes vote down vote up
@VisibleForTesting
@SuppressWarnings("GuardedBy")
Optional<ImmutableSet<AppListing>> getAllAppListings(String hostBundleId) {
  Set<AppListing> listings = appIdToListings.values();
  ImmutableSet<String> hostAppIds =
      listings
          .stream()
          .filter(appListing -> appListing.app.applicationBundleId().equals(hostBundleId))
          .map(appListing -> appListing.app.applicationId())
          .collect(ImmutableSet.toImmutableSet());
  Verify.verify(hostAppIds.size() <= 1, "multiple matching host apps: %s", hostAppIds);
  if (!hostAppIds.isEmpty()) {
    String hostAppId = Iterables.getOnlyElement(hostAppIds);
    ImmutableSet<AppListing> childListings =
        listings
            .stream()
            .filter(
                appListing ->
                    hostAppId.equals(appListing.app.optionalHostApplicationId().orNull()))
            .collect(ImmutableSet.toImmutableSet());
    if (!childListings.isEmpty()
        && childListings.stream().allMatch(appListing -> appListing.listing.isPresent())) {
      return Optional.of(childListings);
    }
  }
  return Optional.empty();
}
 
Example 10
Project: java-monitoring-client-library   File: Counter.java   Source Code and License 5 votes vote down vote up
@VisibleForTesting
final void reset(Instant startTimestamp, ImmutableList<String> labelValues) {
  Lock lock = valueLocks.get(labelValues);
  lock.lock();

  try {
    this.values.put(labelValues, 0);
    this.valueStartTimestamps.put(labelValues, startTimestamp);
  } finally {
    lock.unlock();
  }
}
 
Example 11
Project: hadoop   File: BPServiceActor.java   Source Code and License 5 votes vote down vote up
@VisibleForTesting
void triggerDeletionReportForTests() {
  synchronized (pendingIncrementalBRperStorage) {
    lastDeletedReport = 0;
    pendingIncrementalBRperStorage.notifyAll();

    while (lastDeletedReport == 0) {
      try {
        pendingIncrementalBRperStorage.wait(100);
      } catch (InterruptedException e) {
        return;
      }
    }
  }
}
 
Example 12
Project: guava-mock   File: IntMath.java   Source Code and License 5 votes vote down vote up
/**
 * Returns 1 if {@code x < y} as unsigned integers, and 0 otherwise. Assumes that x - y fits into
 * a signed int. The implementation is branch-free, and benchmarks suggest it is measurably (if
 * narrowly) faster than the straightforward ternary expression.
 */
@VisibleForTesting
static int lessThanBranchFree(int x, int y) {
  // The double negation is optimized away by normal Java, but is necessary for GWT
  // to make sure bit twiddling works as expected.
  return ~~(x - y) >>> (Integer.SIZE - 1);
}
 
Example 13
Project: ditb   File: OrderedBytes.java   Source Code and License 5 votes vote down vote up
/**
 * Skip {@code src} over the encoded varuint64.
 * @param src source buffer
 * @param cmp if true, parse the compliment of the value.
 * @return the number of bytes skipped.
 */
@VisibleForTesting
static int skipVaruint64(PositionedByteRange src, boolean cmp) {
  final int len = lengthVaruint64(src, cmp);
  src.setPosition(src.getPosition() + len);
  return len;
}
 
Example 14
Project: ditb   File: HTable.java   Source Code and License 5 votes vote down vote up
/**
 * <em>INTERNAL</em> Used by unit tests and tools to do low-level
 * manipulations.
 * @return An HConnection instance.
 * @deprecated This method will be changed from public to package protected.
 */
// TODO(tsuna): Remove this.  Unit tests shouldn't require public helpers.
@Deprecated
@VisibleForTesting
public HConnection getConnection() {
  return this.connection;
}
 
Example 15
Project: QDrill   File: ZkPStoreProvider.java   Source Code and License 5 votes vote down vote up
@VisibleForTesting
public ZkPStoreProvider(DrillConfig config, CuratorFramework curator) throws IOException {
  this.curator = curator;
  this.blobRoot = FilePStore.getLogDir();
  this.fs = FilePStore.getFileSystem(config, blobRoot);
  this.zkEStoreProvider = new ZkEStoreProvider(curator);
}
 
Example 16
Project: okwallet   File: PaymentChannelV1ClientState.java   Source Code and License 5 votes vote down vote up
@Override
@VisibleForTesting synchronized void doStoreChannelInWallet(Sha256Hash id) {
    StoredPaymentChannelClientStates channels = (StoredPaymentChannelClientStates)
            wallet.getExtensions().get(StoredPaymentChannelClientStates.EXTENSION_ID);
    checkNotNull(channels, "You have not added the StoredPaymentChannelClientStates extension to the wallet.");
    checkState(channels.getChannel(id, multisigContract.getHash()) == null);
    storedChannel = new StoredClientChannel(getMajorVersion(), id, multisigContract, refundTx, myKey, serverKey, valueToMe, refundFees, 0, true);
    channels.putChannel(storedChannel);
}
 
Example 17
Project: hashsdn-controller   File: MessageTracker.java   Source Code and License 5 votes vote down vote up
@VisibleForTesting
MessageTracker(final Class<?> expectedMessageClass, final long expectedArrivalIntervalInMillis,
        final Ticker ticker) {
    Preconditions.checkArgument(expectedArrivalIntervalInMillis >= 0);
    this.expectedMessageClass = Preconditions.checkNotNull(expectedMessageClass);
    this.expectedArrivalInterval = MILLISECONDS.toNanos(expectedArrivalIntervalInMillis);
    this.ticker = Preconditions.checkNotNull(ticker);
    this.expectedMessageWatch = Stopwatch.createUnstarted(ticker);
    this.currentMessageContext = new CurrentMessageContext();
}
 
Example 18
Project: hashsdn-controller   File: RuntimeBeanEntry.java   Source Code and License 5 votes vote down vote up
@VisibleForTesting
RuntimeBeanEntry(final String packageName,
        final DataNodeContainer nodeForReporting, final String yangName,
        final String javaNamePrefix, final boolean isRoot,
        final Optional<String> keyYangName, final List<AttributeIfc> attributes,
        final List<RuntimeBeanEntry> children, final Set<Rpc> rpcs) {

    checkArgument(isRoot == false || keyYangName.isPresent() == false,
            "Root RuntimeBeanEntry must not have key set");
    this.packageName = packageName;
    this.isRoot = isRoot;
    this.yangName = yangName;
    this.javaNamePrefix = javaNamePrefix;
    this.children = Collections.unmodifiableList(children);
    this.rpcs = Collections.unmodifiableSet(rpcs);

    this.keyYangName = keyYangName;
    Map<String, AttributeIfc> map = new HashMap<>();

    for (AttributeIfc a : attributes) {
        checkState(map.containsKey(a.getAttributeYangName()) == false,
                "Attribute already defined: %s in %s", a.getAttributeYangName(), nodeForReporting);
        map.put(a.getAttributeYangName(), a);
    }

    if (keyYangName.isPresent()) {
        AttributeIfc keyJavaName = map.get(keyYangName.get());
        checkArgument(keyJavaName != null, "Key %s not found in attribute list %s in %s", keyYangName.get(),
                attributes, nodeForReporting);
        this.keyJavaName = Optional
                .of(keyJavaName.getUpperCaseCammelCase());
    } else {
        keyJavaName = Optional.absent();
    }
    attributeMap = Collections.unmodifiableMap(map);
}
 
Example 19
Project: googles-monorepo-demo   File: FarmHashFingerprint64.java   Source Code and License 5 votes vote down vote up
@VisibleForTesting
static long fingerprint(byte[] bytes, int offset, int length) {
  if (length <= 32) {
    if (length <= 16) {
      return hashLength0to16(bytes, offset, length);
    } else {
      return hashLength17to32(bytes, offset, length);
    }
  } else if (length <= 64) {
    return hashLength33To64(bytes, offset, length);
  } else {
    return hashLength65Plus(bytes, offset, length);
  }
}
 
Example 20
Project: googles-monorepo-demo   File: ClassPath.java   Source Code and License 5 votes vote down vote up
@VisibleForTesting
static File toFile(URL url) {
  checkArgument(url.getProtocol().equals("file"));
  try {
    return new File(url.toURI());  // Accepts escaped characters like %20.
  } catch (URISyntaxException e) {  // URL.toURI() doesn't escape chars.
    return new File(url.getPath());  // Accepts non-escaped chars like space.
  }
}
 
Example 21
Project: googles-monorepo-demo   File: LocalCache.java   Source Code and License 5 votes vote down vote up
/**
 * This method is a convenience for testing. Code should call {@link Segment#setValue} instead.
 */
// Guarded By Segment.this
@VisibleForTesting
ValueReference<K, V> newValueReference(ReferenceEntry<K, V> entry, V value, int weight) {
  int hash = entry.getHash();
  return valueStrength.referenceValue(segmentFor(hash), entry, checkNotNull(value), weight);
}
 
Example 22
Project: hadoop-oss   File: DefaultImpersonationProvider.java   Source Code and License 5 votes vote down vote up
@VisibleForTesting
public Map<String, Collection<String>> getProxyGroups() {
   Map<String,Collection<String>> proxyGroups = new HashMap<String,Collection<String>>();
   for(Entry<String, AccessControlList> entry : proxyUserAcl.entrySet()) {
     proxyGroups.put(entry.getKey() + CONF_GROUPS, entry.getValue().getGroups());
   }
   return proxyGroups;
}
 
Example 23
Project: hadoop   File: DelegationTokenAuthenticationFilter.java   Source Code and License 5 votes vote down vote up
@VisibleForTesting
static String getDoAs(HttpServletRequest request) {
  List<NameValuePair> list = URLEncodedUtils.parse(request.getQueryString(),
      UTF8_CHARSET);
  if (list != null) {
    for (NameValuePair nv : list) {
      if (DelegationTokenAuthenticatedURL.DO_AS.
          equalsIgnoreCase(nv.getName())) {
        return nv.getValue();
      }
    }
  }
  return null;
}
 
Example 24
Project: dropwizard-influxdb-reporter   File: DropwizardTransformer.java   Source Code and License 5 votes vote down vote up
/**
 * Build an {@link InfluxDbMeasurement} from a timer.
 */
@VisibleForTesting InfluxDbMeasurement fromTimer(final String metricName, final Timer t, final long timestamp) {
  final Snapshot snapshot = t.getSnapshot();
  final DropwizardMeasurement measurement = parser.parse(metricName);

  final Map<String, String> tags = new HashMap<>(baseTags);
  tags.putAll(measurement.tags());

  return new InfluxDbMeasurement.Builder(measurement.name(), timestamp)
    .putTags(tags)
    .putField("count", snapshot.size())
    .putField("min", convertDuration(snapshot.getMin()))
    .putField("max", convertDuration(snapshot.getMax()))
    .putField("mean", convertDuration(snapshot.getMean()))
    .putField("std-dev", convertDuration(snapshot.getStdDev()))
    .putField("50-percentile", convertDuration(snapshot.getMedian()))
    .putField("75-percentile", convertDuration(snapshot.get75thPercentile()))
    .putField("95-percentile", convertDuration(snapshot.get95thPercentile()))
    .putField("99-percentile", convertDuration(snapshot.get99thPercentile()))
    .putField("999-percentile", convertDuration(snapshot.get999thPercentile()))
    .putField("one-minute", convertRate(t.getOneMinuteRate()))
    .putField("five-minute", convertRate(t.getFiveMinuteRate()))
    .putField("fifteen-minute", convertRate(t.getFifteenMinuteRate()))
    .putField("mean-minute", convertRate(t.getMeanRate()))
    .putField("run-count", t.getCount())
    .build();
}
 
Example 25
Project: hadoop   File: YARNRunner.java   Source Code and License 5 votes vote down vote up
@VisibleForTesting
Token<?> getDelegationTokenFromHS(MRClientProtocol hsProxy)
    throws IOException, InterruptedException {
  GetDelegationTokenRequest request = recordFactory
    .newRecordInstance(GetDelegationTokenRequest.class);
  request.setRenewer(Master.getMasterPrincipal(conf));
  org.apache.hadoop.yarn.api.records.Token mrDelegationToken;
  mrDelegationToken = hsProxy.getDelegationToken(request)
      .getDelegationToken();
  return ConverterUtils.convertFromYarn(mrDelegationToken,
      hsProxy.getConnectAddress());
}
 
Example 26
Project: hadoop   File: BlockPoolSlice.java   Source Code and License 5 votes vote down vote up
@VisibleForTesting
static ReplicaInfo selectReplicaToDelete(final ReplicaInfo replica1,
    final ReplicaInfo replica2) {
  ReplicaInfo replicaToKeep;
  ReplicaInfo replicaToDelete;

  // it's the same block so don't ever delete it, even if GS or size
  // differs.  caller should keep the one it just discovered on disk
  if (replica1.getBlockFile().equals(replica2.getBlockFile())) {
    return null;
  }
  if (replica1.getGenerationStamp() != replica2.getGenerationStamp()) {
    replicaToKeep = replica1.getGenerationStamp() > replica2.getGenerationStamp()
        ? replica1 : replica2;
  } else if (replica1.getNumBytes() != replica2.getNumBytes()) {
    replicaToKeep = replica1.getNumBytes() > replica2.getNumBytes() ?
        replica1 : replica2;
  } else if (replica1.getVolume().isTransientStorage() &&
             !replica2.getVolume().isTransientStorage()) {
    replicaToKeep = replica2;
  } else {
    replicaToKeep = replica1;
  }

  replicaToDelete = (replicaToKeep == replica1) ? replica2 : replica1;

  if (LOG.isDebugEnabled()) {
    LOG.debug("resolveDuplicateReplicas decide to keep " + replicaToKeep
        + ".  Will try to delete " + replicaToDelete);
  }
  return replicaToDelete;
}
 
Example 27
Project: hadoop   File: ClientContext.java   Source Code and License 5 votes vote down vote up
/**
 * Get a client context, from a Configuration object.
 *
 * This method is less efficient than the version which takes a DFSClient#Conf
 * object, and should be mostly used by tests.
 */
@VisibleForTesting
public static ClientContext getFromConf(Configuration conf) {
  return get(conf.get(DFSConfigKeys.DFS_CLIENT_CONTEXT,
      DFSConfigKeys.DFS_CLIENT_CONTEXT_DEFAULT),
          new DFSClient.Conf(conf));
}
 
Example 28
Project: googles-monorepo-demo   File: Lists.java   Source Code and License 5 votes vote down vote up
@VisibleForTesting
static int computeArrayListCapacity(int arraySize) {
  checkNonnegative(arraySize, "arraySize");

  // TODO(kevinb): Figure out the right behavior, and document it
  return Ints.saturatedCast(5L + arraySize + (arraySize / 10));
}
 
Example 29
Project: bench   File: JgroupsClusterMember.java   Source Code and License 5 votes vote down vote up
@VisibleForTesting
JgroupsClusterMember(@NotNull final JChannel jChannel,
                     @NotNull final JgroupsListenerMultiplexer listenerMultiplexer,
                     @NotNull final JgroupsStateMultiplexer stateMultiplexer,
                     @NotNull final JgroupsViewMultiplexer viewMultiplexer) {

    this.jChannel = requireNonNull(jChannel);
    this.listenerMultiplexer = requireNonNull(listenerMultiplexer);
    this.stateMultiplexer = requireNonNull(stateMultiplexer);
    this.viewMultiplexer = requireNonNull(viewMultiplexer);
}
 
Example 30
Project: teamcity-autotools-plugin   File: RuntestToolProvider.java   Source Code and License 5 votes vote down vote up
@NotNull
@VisibleForTesting
@Override
String findVersion(@NotNull final String text) {
  final Pattern needVersion = Pattern.compile("(DejaGnu|Framework).+version.+" + regVersionNumer);
  final Matcher textMatcher = needVersion.matcher(text);
  if (!textMatcher.find()){
    return "";
  }
  final String versionLine = text.substring(textMatcher.start(), textMatcher.end());
  final Pattern versionNumberOnly = Pattern.compile(regVersionNumer);
  final Matcher versionMatcher = versionNumberOnly.matcher(versionLine);
  return versionMatcher.find() ? versionLine.substring(versionMatcher.start(), versionMatcher.end()) : "";
}
 
Example 31
Project: ditb   File: ServerManager.java   Source Code and License 5 votes vote down vote up
/**
 * Adds the onlineServers list. onlineServers should be locked.
 * @param serverName The remote servers name.
 * @param sl
 * @return Server load from the removed server, if any.
 */
@VisibleForTesting
void recordNewServerWithLock(final ServerName serverName, final ServerLoad sl) {
  LOG.info("Registering server=" + serverName);
  this.onlineServers.put(serverName, sl);
  this.rsAdmins.remove(serverName);
}
 
Example 32
Project: cryptotrader   File: PipelineImpl.java   Source Code and License 5 votes vote down vote up
@VisibleForTesting
Request createRequest(Instant time, String site, String instrument) {

    Request request = Request.builder()
            .site(site)
            .instrument(instrument)
            .currentTime(propertyManager.getNow())
            .targetTime(time)
            .tradingSpread(propertyManager.getTradingSpread(site, instrument))
            .tradingSpreadAsk(propertyManager.getTradingSpreadAsk(site, instrument))
            .tradingSpreadBid(propertyManager.getTradingSpreadBid(site, instrument))
            .tradingSigma(propertyManager.getTradingSigma(site, instrument))
            .tradingSamples(propertyManager.getTradingSamples(site, instrument))
            .tradingExposure(propertyManager.getTradingExposure(site, instrument))
            .tradingThreshold(propertyManager.getTradingThreshold(site, instrument))
            .tradingMaximum(propertyManager.getTradingMaximum(site, instrument))
            .tradingMinimum(propertyManager.getTradingMinimum(site, instrument))
            .tradingResistance(propertyManager.getTradingResistance(site, instrument))
            .tradingAversion(propertyManager.getTradingAversion(site, instrument))
            .tradingInstruction(propertyManager.getTradingInstruction(site, instrument))
            .tradingSplit(propertyManager.getTradingSplit(site, instrument))
            .tradingDuration(propertyManager.getTradingDuration(site, instrument))
            .fundingOffset(propertyManager.getFundingOffset(site, instrument))
            .fundingMultiplierProducts(propertyManager.getFundingMultiplierProducts(site, instrument))
            .fundingPositiveMultiplier(propertyManager.getFundingPositiveMultiplier(site, instrument))
            .fundingNegativeMultiplier(propertyManager.getFundingNegativeMultiplier(site, instrument))
            .fundingPositiveThreshold(propertyManager.getFundingPositiveThreshold(site, instrument))
            .fundingNegativeThreshold(propertyManager.getFundingNegativeThreshold(site, instrument))
            .hedgeProducts(propertyManager.getHedgeProducts(site, instrument))
            .estimatorComposites(propertyManager.getEstimatorComposites(site, instrument))
            .estimationAversion(propertyManager.getEstimationAversion(site, instrument))
            .build();

    return validateRequest(request);

}
 
Example 33
Project: async-sqs   File: CreateQueueAction.java   Source Code and License 5 votes vote down vote up
@VisibleForTesting
static CreateQueueRequest createRequest(SqsQueueConfig config) {
    //TODO: add deadletter config

    return new CreateQueueRequest()
            .withQueueName(config.getName())
            .withAttributes(config.getAttributes().getStringMap());
}
 
Example 34
Project: n4js   File: GitRepositoryAwareWorkingSetManager.java   Source Code and License 5 votes vote down vote up
/**
 * Creates a new working set instance with the optional {@link Repository Git repository} and the container
 * working set manager.
 *
 * @param repository
 *            the associated Git repository. Could be {@code null} if the working set is for
 *            {@link WorkingSet#OTHERS_WORKING_SET_ID <em>'Other Project'</em>} purposes.
 * @param manager
 *            the container manager.
 */
@VisibleForTesting
public GitRepositoryWorkingSet(/* nullable */ final Repository repository, final WorkingSetManager manager) {
	super(repositoryToId(repository), manager);
	if (repository == null) {
		rootUri = null;
		name = OTHERS_WORKING_SET_ID;
	} else {
		final File directory = repository.getDirectory().getParentFile();
		rootUri = toUriString(directory.toURI());
		name = directory.getName();
	}
}
 
Example 35
Project: ditb   File: FuzzyRowFilter.java   Source Code and License 4 votes vote down vote up
@VisibleForTesting
static SatisfiesCode satisfies(boolean reverse, byte[] row, byte[] fuzzyKeyBytes,
    byte[] fuzzyKeyMeta) {
  return satisfies(reverse, row, 0, row.length, fuzzyKeyBytes, fuzzyKeyMeta);
}
 
Example 36
Project: hadoop   File: UserParam.java   Source Code and License 4 votes vote down vote up
@VisibleForTesting
public static void setUserPatternDomain(Domain dm) {
  domain = dm;
}
 
Example 37
Project: sstable-adaptor   File: ClearableHistogram.java   Source Code and License 4 votes vote down vote up
@VisibleForTesting
public void clear()
{
    reservoirRef.clear();
}
 
Example 38
Project: hadoop-oss   File: ShellBasedIdMapping.java   Source Code and License 4 votes vote down vote up
@VisibleForTesting
public long getTimeout() {
  return timeout;
}
 
Example 39
Project: hadoop   File: ResourceLocalizationService.java   Source Code and License 4 votes vote down vote up
@VisibleForTesting
@Private
public LocalizerRunner getLocalizerRunner(String locId) {
  return localizerTracker.privLocalizers.get(locId);
}
 
Example 40
Project: hadoop   File: Fetcher.java   Source Code and License 4 votes vote down vote up
@VisibleForTesting
protected synchronized void openConnection(URL url)
    throws IOException {
  HttpURLConnection conn = (HttpURLConnection) url.openConnection();
  if (sslShuffle) {
    HttpsURLConnection httpsConn = (HttpsURLConnection) conn;
    try {
      httpsConn.setSSLSocketFactory(sslFactory.createSSLSocketFactory());
    } catch (GeneralSecurityException ex) {
      throw new IOException(ex);
    }
    httpsConn.setHostnameVerifier(sslFactory.getHostnameVerifier());
  }
  connection = conn;
}