Permalink
Browse files

ISPN-2899 CLI: fix container stats and help

  • Loading branch information...
1 parent ce86510 commit 2ca5b073fc3ef1ee34e2c2fa324ec824aa5322c5 @tristantarrant tristantarrant committed with galderz Mar 7, 2013
@@ -1,16 +1,11 @@
.SH SYNOPSIS
.B stats [
-.I --container
-.B ] [
-.I cachename
+.I --container | cachename
.B ]
.SH DESCRIPTION
Shows statistics about the specified cache or about the active cache manager
.SH ARGUMENTS
.IP cachename
-(optional) the name of the cache for which information will be printed. If
-omitted, information about the current cache will be shown
-If the
-.I --container
-option is specified, then information about the current container will be shown
-instead.
+(optional) the name of the cache for which information will be printed. If omitted, information about the current cache will be shown. If the
+.I --container
+option is specified, then information about the current container will be shown instead.
@@ -88,8 +88,8 @@ private void printContainerStats(PrintWriter pw, DefaultCacheManager cacheManage
pw.printf(" coordinator: %s\n", cacheManager.getCoordinator());
pw.printf(" clusterSize: %d\n", cacheManager.getClusterSize());
pw.printf(" clusterMembers: %s\n", cacheManager.getClusterMembers());
- pw.printf(" createdCacheCount: %d\n", cacheManager.getCreatedCacheCount());
- pw.printf(" definedCacheCount: %d\n", cacheManager.getDefinedCacheCount());
+ pw.printf(" createdCacheCount: %s\n", cacheManager.getCreatedCacheCount());
+ pw.printf(" definedCacheCount: %s\n", cacheManager.getDefinedCacheCount());
pw.printf(" definedCacheNames: %s\n", cacheManager.getDefinedCacheNames());
pw.printf(" version: %s\n", cacheManager.getVersion());
pw.println("}");
@@ -184,4 +184,13 @@ public void testCacheNotYetSelected() throws Exception {
assert response.get(ResultKeys.ERROR.toString()).contains(errorMsg);
}
+ public void testStats() throws Exception {
+ GlobalComponentRegistry gcr = TestingUtil.extractGlobalComponentRegistry(this.cacheManager);
+ Interpreter interpreter = gcr.getComponent(Interpreter.class);
+ String sessionId = interpreter.createSessionId(BasicCacheContainer.DEFAULT_CACHE_NAME);
+ Map<String, String> response = interpreter.execute(sessionId, "stats;");
+ assert !response.containsKey(ResultKeys.ERROR.toString());
+ response = interpreter.execute(sessionId, "stats --container;");
+ assert !response.containsKey(ResultKeys.ERROR.toString());
+ }
}

0 comments on commit 2ca5b07

Please sign in to comment.