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


Java ValueQueue类代码示例

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


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

示例1: testWarmUp

import org.apache.hadoop.crypto.key.kms.ValueQueue; //导入依赖的package包/类
/**
 * Verifies that Queue is initialized (Warmed-up) for provided keys
 */
@Test(timeout=30000)
public void testWarmUp() throws Exception {
  MockFiller filler = new MockFiller();
  ValueQueue<String> vq =
      new ValueQueue<String>(10, 0.5f, 300, 1,
          SyncGenerationPolicy.ALL, filler);
  vq.initializeQueuesForKeys("k1", "k2", "k3");
  FillInfo[] fillInfos =
    {filler.getTop(), filler.getTop(), filler.getTop()};
  Assert.assertEquals(5, fillInfos[0].num);
  Assert.assertEquals(5, fillInfos[1].num);
  Assert.assertEquals(5, fillInfos[2].num);
  Assert.assertEquals(Sets.newHashSet("k1", "k2", "k3"),
      Sets.newHashSet(fillInfos[0].key,
          fillInfos[1].key,
          fillInfos[2].key));
  vq.shutdown();
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:22,代码来源:TestValueQueue.java

示例2: testgetAtMostPolicyLOW_WATERMARK

import org.apache.hadoop.crypto.key.kms.ValueQueue; //导入依赖的package包/类
/**
 * Verify getAtMost when SyncGeneration Policy = LOW_WATERMARK
 */
@Test(timeout=30000)
public void testgetAtMostPolicyLOW_WATERMARK() throws Exception {
  MockFiller filler = new MockFiller();
  ValueQueue<String> vq =
      new ValueQueue<String>(10, 0.3f, 300, 1,
          SyncGenerationPolicy.LOW_WATERMARK, filler);
  Assert.assertEquals("test", vq.getNext("k1"));
  Assert.assertEquals(3, filler.getTop().num);
  // Drain completely
  Assert.assertEquals(3, vq.getAtMost("k1", 10).size());
  // Synchronous call
  Assert.assertEquals(1, filler.getTop().num);
  // Asynch Refill call
  Assert.assertEquals(10, filler.getTop().num);
  vq.shutdown();
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:20,代码来源:TestValueQueue.java

示例3: CryptoExtension

import org.apache.hadoop.crypto.key.kms.ValueQueue; //导入依赖的package包/类
public CryptoExtension(Configuration conf, 
    KeyProviderCryptoExtension keyProviderCryptoExtension) {
  this.keyProviderCryptoExtension = keyProviderCryptoExtension;
  encKeyVersionQueue =
      new ValueQueue<KeyProviderCryptoExtension.EncryptedKeyVersion>(
          conf.getInt(KMS_KEY_CACHE_SIZE,
              KMS_KEY_CACHE_SIZE_DEFAULT),
          conf.getFloat(KMS_KEY_CACHE_LOW_WATERMARK,
              KMS_KEY_CACHE_LOW_WATERMARK_DEFAULT),
          conf.getInt(KMS_KEY_CACHE_EXPIRY_MS,
              KMS_KEY_CACHE_EXPIRY_DEFAULT),
          conf.getInt(KMS_KEY_CACHE_NUM_REFILL_THREADS,
              KMS_KEY_CACHE_NUM_REFILL_THREADS_DEFAULT),
          SyncGenerationPolicy.LOW_WATERMARK, new EncryptedQueueRefiller()
      );
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:17,代码来源:EagerKeyGeneratorKeyProviderCryptoExtension.java

示例4: testWarmUp

import org.apache.hadoop.crypto.key.kms.ValueQueue; //导入依赖的package包/类
/**
 * Verifies that Queue is initialized (Warmed-up) for provided keys
 */
@Test
public void testWarmUp() throws Exception {
  MockFiller filler = new MockFiller();
  ValueQueue<String> vq =
      new ValueQueue<String>(10, 0.5f, 300, 1,
          SyncGenerationPolicy.ALL, filler);
  vq.initializeQueuesForKeys("k1", "k2", "k3");
  FillInfo[] fillInfos =
    {filler.getTop(), filler.getTop(), filler.getTop()};
  Assert.assertEquals(5, fillInfos[0].num);
  Assert.assertEquals(5, fillInfos[1].num);
  Assert.assertEquals(5, fillInfos[2].num);
  Assert.assertEquals(Sets.newHashSet("k1", "k2", "k3"),
      Sets.newHashSet(fillInfos[0].key,
          fillInfos[1].key,
          fillInfos[2].key));
  vq.shutdown();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestValueQueue.java

示例5: testgetAtMostPolicyALL

import org.apache.hadoop.crypto.key.kms.ValueQueue; //导入依赖的package包/类
/**
 * Verify getAtMost when SyncGeneration Policy = ALL
 */
@Test
public void testgetAtMostPolicyALL() throws Exception {
  MockFiller filler = new MockFiller();
  ValueQueue<String> vq =
      new ValueQueue<String>(10, 0.1f, 300, 1,
          SyncGenerationPolicy.ALL, filler);
  Assert.assertEquals("test", vq.getNext("k1"));
  Assert.assertEquals(1, filler.getTop().num);
  // Drain completely
  Assert.assertEquals(10, vq.getAtMost("k1", 10).size());
  // Synchronous call
  Assert.assertEquals(10, filler.getTop().num);
  // Ask for more... return all
  Assert.assertEquals(19, vq.getAtMost("k1", 19).size());
  // Synchronous call (No Async call since num > lowWatermark)
  Assert.assertEquals(19, filler.getTop().num);
  vq.shutdown();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestValueQueue.java

示例6: testgetAtMostPolicyLOW_WATERMARK

import org.apache.hadoop.crypto.key.kms.ValueQueue; //导入依赖的package包/类
/**
 * Verify getAtMost when SyncGeneration Policy = LOW_WATERMARK
 */
@Test
public void testgetAtMostPolicyLOW_WATERMARK() throws Exception {
  MockFiller filler = new MockFiller();
  ValueQueue<String> vq =
      new ValueQueue<String>(10, 0.3f, 300, 1,
          SyncGenerationPolicy.LOW_WATERMARK, filler);
  Assert.assertEquals("test", vq.getNext("k1"));
  Assert.assertEquals(3, filler.getTop().num);
  // Drain completely
  Assert.assertEquals(3, vq.getAtMost("k1", 10).size());
  // Synchronous call
  Assert.assertEquals(1, filler.getTop().num);
  // Asynch Refill call
  Assert.assertEquals(10, filler.getTop().num);
  vq.shutdown();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:TestValueQueue.java

示例7: CryptoExtension

import org.apache.hadoop.crypto.key.kms.ValueQueue; //导入依赖的package包/类
public CryptoExtension(Configuration conf,
    KeyProviderCryptoExtension keyProviderCryptoExtension) {
  this.keyProviderCryptoExtension = keyProviderCryptoExtension;
  encKeyVersionQueue =
      new ValueQueue<KeyProviderCryptoExtension.EncryptedKeyVersion>(
          conf.getInt(KMS_KEY_CACHE_SIZE,
              KMS_KEY_CACHE_SIZE_DEFAULT),
          conf.getFloat(KMS_KEY_CACHE_LOW_WATERMARK,
              KMS_KEY_CACHE_LOW_WATERMARK_DEFAULT),
          conf.getInt(KMS_KEY_CACHE_EXPIRY_MS,
              KMS_KEY_CACHE_EXPIRY_DEFAULT),
          conf.getInt(KMS_KEY_CACHE_NUM_REFILL_THREADS,
              KMS_KEY_CACHE_NUM_REFILL_THREADS_DEFAULT),
          SyncGenerationPolicy.LOW_WATERMARK, new EncryptedQueueRefiller()
      );
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:EagerKeyGeneratorKeyProviderCryptoExtension.java

示例8: testInitFill

import org.apache.hadoop.crypto.key.kms.ValueQueue; //导入依赖的package包/类
/**
 * Verifies that Queue is initially filled to "numInitValues"
 */
@Test(timeout=30000)
public void testInitFill() throws Exception {
  MockFiller filler = new MockFiller();
  ValueQueue<String> vq =
      new ValueQueue<String>(10, 0.1f, 300, 1,
          SyncGenerationPolicy.ALL, filler);
  Assert.assertEquals("test", vq.getNext("k1"));
  Assert.assertEquals(1, filler.getTop().num);
  vq.shutdown();
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:14,代码来源:TestValueQueue.java

示例9: testRefill

import org.apache.hadoop.crypto.key.kms.ValueQueue; //导入依赖的package包/类
/**
 * Verifies that the refill task is executed after "checkInterval" if
 * num values below "lowWatermark"
 */
@Test(timeout=30000)
public void testRefill() throws Exception {
  MockFiller filler = new MockFiller();
  ValueQueue<String> vq =
      new ValueQueue<String>(10, 0.1f, 300, 1,
          SyncGenerationPolicy.ALL, filler);
  Assert.assertEquals("test", vq.getNext("k1"));
  Assert.assertEquals(1, filler.getTop().num);
  // Trigger refill
  vq.getNext("k1");
  Assert.assertEquals(1, filler.getTop().num);
  Assert.assertEquals(10, filler.getTop().num);
  vq.shutdown();
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:19,代码来源:TestValueQueue.java

示例10: testNoRefill

import org.apache.hadoop.crypto.key.kms.ValueQueue; //导入依赖的package包/类
/**
 * Verifies that the No refill Happens after "checkInterval" if
 * num values above "lowWatermark"
 */
@Test(timeout=30000)
public void testNoRefill() throws Exception {
  MockFiller filler = new MockFiller();
  ValueQueue<String> vq =
      new ValueQueue<String>(10, 0.5f, 300, 1,
          SyncGenerationPolicy.ALL, filler);
  Assert.assertEquals("test", vq.getNext("k1"));
  Assert.assertEquals(5, filler.getTop().num);
  Assert.assertEquals(null, filler.getTop());
  vq.shutdown();
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:16,代码来源:TestValueQueue.java

示例11: testgetAtMostPolicyATLEAST_ONE

import org.apache.hadoop.crypto.key.kms.ValueQueue; //导入依赖的package包/类
/**
 * Verify getAtMost when SyncGeneration Policy = ALL
 */
@Test(timeout=30000)
public void testgetAtMostPolicyATLEAST_ONE() throws Exception {
  MockFiller filler = new MockFiller();
  ValueQueue<String> vq =
      new ValueQueue<String>(10, 0.3f, 300, 1,
          SyncGenerationPolicy.ATLEAST_ONE, filler);
  Assert.assertEquals("test", vq.getNext("k1"));
  Assert.assertEquals(3, filler.getTop().num);
  // Drain completely
  Assert.assertEquals(2, vq.getAtMost("k1", 10).size());
  // Asynch Refill call
  Assert.assertEquals(10, filler.getTop().num);
  vq.shutdown();
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:18,代码来源:TestValueQueue.java

示例12: testDrain

import org.apache.hadoop.crypto.key.kms.ValueQueue; //导入依赖的package包/类
@Test(timeout=30000)
public void testDrain() throws Exception {
  MockFiller filler = new MockFiller();
  ValueQueue<String> vq =
      new ValueQueue<String>(10, 0.1f, 300, 1,
          SyncGenerationPolicy.ALL, filler);
  Assert.assertEquals("test", vq.getNext("k1"));
  Assert.assertEquals(1, filler.getTop().num);
  vq.drain("k1");
  Assert.assertNull(filler.getTop());
  vq.shutdown();
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:13,代码来源:TestValueQueue.java

示例13: testInitFill

import org.apache.hadoop.crypto.key.kms.ValueQueue; //导入依赖的package包/类
/**
 * Verifies that Queue is initially filled to "numInitValues"
 */
@Test
public void testInitFill() throws Exception {
  MockFiller filler = new MockFiller();
  ValueQueue<String> vq =
      new ValueQueue<String>(10, 0.1f, 300, 1,
          SyncGenerationPolicy.ALL, filler);
  Assert.assertEquals("test", vq.getNext("k1"));
  Assert.assertEquals(1, filler.getTop().num);
  vq.shutdown();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:TestValueQueue.java

示例14: testRefill

import org.apache.hadoop.crypto.key.kms.ValueQueue; //导入依赖的package包/类
/**
 * Verifies that the refill task is executed after "checkInterval" if
 * num values below "lowWatermark"
 */
@Test
public void testRefill() throws Exception {
  MockFiller filler = new MockFiller();
  ValueQueue<String> vq =
      new ValueQueue<String>(10, 0.1f, 300, 1,
          SyncGenerationPolicy.ALL, filler);
  Assert.assertEquals("test", vq.getNext("k1"));
  Assert.assertEquals(1, filler.getTop().num);
  // Trigger refill
  vq.getNext("k1");
  Assert.assertEquals(1, filler.getTop().num);
  Assert.assertEquals(10, filler.getTop().num);
  vq.shutdown();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestValueQueue.java

示例15: testNoRefill

import org.apache.hadoop.crypto.key.kms.ValueQueue; //导入依赖的package包/类
/**
 * Verifies that the No refill Happens after "checkInterval" if
 * num values above "lowWatermark"
 */
@Test
public void testNoRefill() throws Exception {
  MockFiller filler = new MockFiller();
  ValueQueue<String> vq =
      new ValueQueue<String>(10, 0.5f, 300, 1,
          SyncGenerationPolicy.ALL, filler);
  Assert.assertEquals("test", vq.getNext("k1"));
  Assert.assertEquals(5, filler.getTop().num);
  Assert.assertEquals(null, filler.getTop());
  vq.shutdown();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:TestValueQueue.java


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