Java 类com.google.common.annotations.VisibleForTesting 实例源码

项目:async-sqs    文件:SendMessageBatchAction.java   
@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())
            );
}
项目:rest-modeling-framework    文件:StaticGenerator.java   
@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();
}
项目:dropwizard-influxdb-reporter    文件:DropwizardTransformer.java   
/**
 * 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();
}
项目:sstable-adaptor    文件:ColumnDefinition.java   
@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);
}
项目:hadoop-oss    文件:SecureIOUtils.java   
/**
 * 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();
    }
  }
}
项目:hadoop    文件:DelegationTokenAuthenticationFilter.java   
@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;
}
项目:Elasticsearch    文件:TransportShardUpsertAction.java   
@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;
}
项目:hadoop    文件:OpenFileCtx.java   
@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);
}
项目:hadoop-oss    文件:JavaKeyStoreProvider.java   
@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;
}
项目:devtools-driver    文件:InspectorMessenger.java   
@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();
}
项目:java-monitoring-client-library    文件:Counter.java   
@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();
  }
}
项目:hadoop    文件:BPServiceActor.java   
@VisibleForTesting
void triggerDeletionReportForTests() {
  synchronized (pendingIncrementalBRperStorage) {
    lastDeletedReport = 0;
    pendingIncrementalBRperStorage.notifyAll();

    while (lastDeletedReport == 0) {
      try {
        pendingIncrementalBRperStorage.wait(100);
      } catch (InterruptedException e) {
        return;
      }
    }
  }
}
项目:guava-mock    文件:IntMath.java   
/**
 * 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);
}
项目:ditb    文件:OrderedBytes.java   
/**
 * 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;
}
项目:ditb    文件:HTable.java   
/**
 * <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;
}
项目:QDrill    文件:ZkPStoreProvider.java   
@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);
}
项目:okwallet    文件:PaymentChannelV1ClientState.java   
@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);
}
项目:hashsdn-controller    文件:MessageTracker.java   
@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();
}
项目:hashsdn-controller    文件:RuntimeBeanEntry.java   
@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);
}
项目:googles-monorepo-demo    文件:FarmHashFingerprint64.java   
@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);
  }
}
项目:googles-monorepo-demo    文件:ClassPath.java   
@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.
  }
}
项目:googles-monorepo-demo    文件:LocalCache.java   
/**
 * 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);
}
项目:hadoop-oss    文件:DefaultImpersonationProvider.java   
@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;
}
项目:dropwizard-influxdb-reporter    文件:DropwizardTransformer.java   
/**
 * 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();
}
项目:hadoop    文件:YARNRunner.java   
@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());
}
项目:hadoop    文件:BlockPoolSlice.java   
@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;
}
项目:hadoop    文件:ClientContext.java   
/**
 * 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));
}
项目:googles-monorepo-demo    文件:Lists.java   
@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));
}
项目:bench    文件:JgroupsClusterMember.java   
@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);
}
项目:teamcity-autotools-plugin    文件:RuntestToolProvider.java   
@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()) : "";
}
项目:ditb    文件:ServerManager.java   
/**
 * 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);
}
项目:cryptotrader    文件:PipelineImpl.java   
@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);

}
项目:async-sqs    文件:CreateQueueAction.java   
@VisibleForTesting
static CreateQueueRequest createRequest(SqsQueueConfig config) {
    //TODO: add deadletter config

    return new CreateQueueRequest()
            .withQueueName(config.getName())
            .withAttributes(config.getAttributes().getStringMap());
}
项目:n4js    文件:GitRepositoryAwareWorkingSetManager.java   
/**
 * 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();
    }
}
项目:ditb    文件:FuzzyRowFilter.java   
@VisibleForTesting
static SatisfiesCode satisfies(boolean reverse, byte[] row, byte[] fuzzyKeyBytes,
    byte[] fuzzyKeyMeta) {
  return satisfies(reverse, row, 0, row.length, fuzzyKeyBytes, fuzzyKeyMeta);
}
项目:hadoop    文件:UserParam.java   
@VisibleForTesting
public static void setUserPatternDomain(Domain dm) {
  domain = dm;
}
项目:sstable-adaptor    文件:ClearableHistogram.java   
@VisibleForTesting
public void clear()
{
    reservoirRef.clear();
}
项目:hadoop-oss    文件:ShellBasedIdMapping.java   
@VisibleForTesting
public long getTimeout() {
  return timeout;
}
项目:hadoop    文件:ResourceLocalizationService.java   
@VisibleForTesting
@Private
public LocalizerRunner getLocalizerRunner(String locId) {
  return localizerTracker.privLocalizers.get(locId);
}
项目:hadoop    文件:Fetcher.java   
@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;
}