Skip to content

Commit

Permalink
Minor fix for change to AdminClient
Browse files Browse the repository at this point in the history
src/java/voldemort/client/protocol/admin/AdminClient.java
- do not close down AdminStoreClient from queryKeys

test/unit/voldemort/client/AdminServiceBasicTest.java
- added some additional checks to test to confirm (non)existence of exceptions&values
  • Loading branch information
jayjwylie committed Mar 20, 2013
1 parent ad7ca98 commit 96ed494
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/java/voldemort/client/protocol/admin/AdminClient.java
Expand Up @@ -2154,7 +2154,6 @@ public Iterator<QueryKeyResult> queryKeys(int nodeId,
store = adminStoreClient.getSocketStore(nodeId, storeName);

} catch(Exception e) {
AdminClient.this.close();
throw new VoldemortException(e);
}

Expand All @@ -2165,7 +2164,6 @@ public QueryKeyResult computeNext() {
ByteArray key;
List<Versioned<byte[]>> value = null;
if(!keys.hasNext()) {
AdminClient.this.close();
return endOfData();
} else {
key = keys.next();
Expand Down
11 changes: 10 additions & 1 deletion test/unit/voldemort/client/AdminServiceBasicTest.java
Expand Up @@ -1437,6 +1437,8 @@ public void testQuery() {
entry = results.next();
assertFalse("There should not be more results", results.hasNext());
assertEquals("Not the right key", queryKeys.get(0), entry.getKey());
assertFalse("There should not be exception", entry.hasException());
assertTrue("There should be values", entry.hasValues());
assertNotNull("Response should be non-null", entry.getValues());
assertEquals("Value should be empty list", 0, entry.getValues().size());
assertNull("There should not be exception", entry.getException());
Expand All @@ -1449,6 +1451,8 @@ public void testQuery() {
entry = results.next();
assertFalse("There should not be more results", results.hasNext());
assertEquals("Not the right key", queryKeys.get(0), entry.getKey());
assertTrue("There should be exception", entry.hasException());
assertFalse("There should not be values", entry.hasValues());
assertNull("Value should be null", entry.getValues());
assertTrue("There should be InvalidMetadataException exception",
entry.getException() instanceof InvalidMetadataException);
Expand All @@ -1461,6 +1465,8 @@ public void testQuery() {
entry = results.next();
assertFalse("There should not be more results", results.hasNext());
assertEquals("Not the right key", queryKeys.get(0), entry.getKey());
assertTrue("There should be exception", entry.hasException());
assertFalse("There should not be values", entry.hasValues());
assertNull("Value should be null", entry.getValues());
assertTrue("There should be InvalidMetadataException exception",
entry.getException() instanceof InvalidMetadataException);
Expand All @@ -1473,9 +1479,10 @@ public void testQuery() {
assertTrue("Results should not be empty", results.hasNext());
entry = results.next();
assertFalse("There should not be more results", results.hasNext());
assertFalse("There should not be exception", entry.hasException());
assertTrue("There should be values", entry.hasValues());
assertEquals("Not the right key", queryKeys.get(0), entry.getKey());
assertEquals("Value should be empty list", 0, entry.getValues().size());
assertNull("There should not be exception", entry.getException());

// test empty request
queryKeys = new ArrayList<ByteArray>();
Expand All @@ -1490,6 +1497,8 @@ public void testQuery() {
assertTrue("Results should not be empty", results.hasNext());
entry = results.next();
assertFalse("There should not be more results", results.hasNext());
assertTrue("There should be exception", entry.hasException());
assertFalse("There should not be values", entry.hasValues());
assertNull("Value should be null", entry.getValues());
assertTrue("There should be IllegalArgumentException exception",
entry.getException() instanceof IllegalArgumentException);
Expand Down

0 comments on commit 96ed494

Please sign in to comment.