• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VisibleForTesting类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.common.annotations.VisibleForTesting的典型用法代码示例。如果您正苦于以下问题:Java VisibleForTesting类的具体用法?Java VisibleForTesting怎么用?Java VisibleForTesting使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VisibleForTesting类属于com.google.common.annotations包,在下文中一共展示了VisibleForTesting类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createRequest

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
@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())
            );
}
 
开发者ID:Bandwidth,项目名称:async-sqs,代码行数:17,代码来源:SendMessageBatchAction.java


示例2: generateContent

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
@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();
}
 
开发者ID:vrapio,项目名称:rest-modeling-framework,代码行数:22,代码来源:StaticGenerator.java


示例3: fromMeter

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:kickstarter,项目名称:dropwizard-influxdb-reporter,代码行数:19,代码来源:DropwizardTransformer.java


示例4: ColumnDefinition

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
@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);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:21,代码来源:ColumnDefinition.java


示例5: forceSecureOpenFSDataInputStream

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
/**
 * 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();
    }
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:24,代码来源:SecureIOUtils.java


示例6: getDoAs

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
@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;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:DelegationTokenAuthenticationFilter.java


示例7: buildMapFromSource

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
@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;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:17,代码来源:TransportShardUpsertAction.java


示例8: alterWriteRequest

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
@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);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:OpenFileCtx.java


示例9: super

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
@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;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:14,代码来源:JavaKeyStoreProvider.java


示例10: getAllAppListings

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
@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();
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:28,代码来源:InspectorMessenger.java


示例11: reset

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
@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();
  }
}
 
开发者ID:google,项目名称:java-monitoring-client-library,代码行数:13,代码来源:Counter.java


示例12: triggerDeletionReportForTests

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
void triggerDeletionReportForTests() {
  synchronized (pendingIncrementalBRperStorage) {
    lastDeletedReport = 0;
    pendingIncrementalBRperStorage.notifyAll();

    while (lastDeletedReport == 0) {
      try {
        pendingIncrementalBRperStorage.wait(100);
      } catch (InterruptedException e) {
        return;
      }
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:BPServiceActor.java


示例13: lessThanBranchFree

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:12,代码来源:IntMath.java


示例14:

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:13,代码来源:OrderedBytes.java


示例15: getConnection

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
/**
 * <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;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:13,代码来源:HTable.java


示例16: ZkPStoreProvider

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
@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);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:8,代码来源:ZkPStoreProvider.java


示例17: doStoreChannelInWallet

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
@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);
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:10,代码来源:PaymentChannelV1ClientState.java


示例18: CurrentMessageContext

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
@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();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:11,代码来源:MessageTracker.java


示例19: checkArgument

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
@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);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:37,代码来源:RuntimeBeanEntry.java


示例20: fingerprint

import com.google.common.annotations.VisibleForTesting; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:15,代码来源:FarmHashFingerprint64.java



注:本文中的com.google.common.annotations.VisibleForTesting类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SerializationFeature类代码示例发布时间:2022-05-20
下一篇:
Java JsonCreator类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap