Java Code Examples for org.apache.hadoop.crypto.key.kms.ValueQueue.SyncGenerationPolicy#ALL
The following examples show how to use
org.apache.hadoop.crypto.key.kms.ValueQueue.SyncGenerationPolicy#ALL .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestValueQueue.java From hadoop with Apache License 2.0 | 6 votes |
/** * 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(); }
Example 2
Source File: TestValueQueue.java From hadoop with Apache License 2.0 | 6 votes |
/** * 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(); }
Example 3
Source File: TestValueQueue.java From big-c with Apache License 2.0 | 6 votes |
/** * 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(); }
Example 4
Source File: TestValueQueue.java From big-c with Apache License 2.0 | 6 votes |
/** * 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(); }
Example 5
Source File: TestValueQueue.java From hadoop with Apache License 2.0 | 5 votes |
/** * 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(); }
Example 6
Source File: TestValueQueue.java From hadoop with Apache License 2.0 | 5 votes |
/** * 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(); }
Example 7
Source File: TestValueQueue.java From hadoop with Apache License 2.0 | 5 votes |
/** * 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(); }
Example 8
Source File: TestValueQueue.java From hadoop with Apache License 2.0 | 5 votes |
@Test 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(); }
Example 9
Source File: TestValueQueue.java From big-c with Apache License 2.0 | 5 votes |
/** * 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(); }
Example 10
Source File: TestValueQueue.java From big-c with Apache License 2.0 | 5 votes |
/** * 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(); }
Example 11
Source File: TestValueQueue.java From big-c with Apache License 2.0 | 5 votes |
/** * 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(); }
Example 12
Source File: TestValueQueue.java From big-c with Apache License 2.0 | 5 votes |
@Test 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(); }