Created
November 5, 2010 01:08
-
-
Save rsumbaly/663496 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Basic put with zone read = 0, zone write = 0 | |
Store<ByteArray, byte[], byte[]> s1 = getStore(cluster, | |
1, | |
1, | |
0, | |
0, | |
8, | |
null, | |
Sets.newHashSet(4, 5, 6, 7), | |
zoneReplicationFactor, | |
RoutingStrategyType.ZONE_STRATEGY, | |
81, | |
new VoldemortException()); | |
long start = System.nanoTime(); | |
try { | |
s1.put(new ByteArray("test".getBytes()), new Versioned<byte[]>(new byte[] { 1 }), null); | |
} finally { | |
long elapsed = (System.nanoTime() - start) / Time.NS_PER_MS; | |
assertTrue(elapsed + " < " + 81, elapsed < 81); | |
} | |
// Putting extra key to test getAll | |
s1.put(new ByteArray("test2".getBytes()), new Versioned<byte[]>(new byte[] { 1 }), null); | |
List<Versioned<byte[]>> value = null; | |
start = System.nanoTime(); | |
try { | |
value = s1.get(new ByteArray("test".getBytes()), null); | |
} finally { | |
long elapsed = (System.nanoTime() - start) / Time.NS_PER_MS; | |
assertTrue(elapsed + " < " + 81, elapsed < 81); | |
} | |
start = System.nanoTime(); | |
try { | |
if(value != null) | |
s1.delete(new ByteArray("test".getBytes()), value.get(0).getVersion()); | |
} finally { | |
long elapsed = (System.nanoTime() - start) / Time.NS_PER_MS; | |
assertTrue(elapsed + " < " + 81, elapsed < 81); | |
} | |
List<ByteArray> keys = Lists.newArrayList(new ByteArray("test".getBytes()), | |
new ByteArray("test2".getBytes())); | |
Map<ByteArray, List<Versioned<byte[]>>> values = s1.getAll(keys, null); | |
for(ByteArray key: values.keySet()) { | |
ByteUtils.compare(values.get(key).get(0).getValue(), new byte[] { 1 }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment