# HG changeset patch # User Jon VanAlten # Date 1349214217 14400 # Node ID 486a299ab9059121615196df2e8b08a206b28a3d # Parent 73c182a706fc64c8e409b93f2865e741c174dea7 Move command descriptions to properties file Reviewed-by: sgehwolf Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2012-September/003394.html diff -r 73c182a706fc -r 486a299ab905 agent/cli/src/main/java/com/redhat/thermostat/agent/cli/AgentApplication.java --- a/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/AgentApplication.java Tue Oct 02 17:43:25 2012 -0400 +++ b/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/AgentApplication.java Tue Oct 02 17:43:37 2012 -0400 @@ -84,9 +84,8 @@ private static final String NAME = "agent"; // TODO: Use LocaleResources for i18n-ized strings. - private static final String DESCRIPTION = "starts and stops the thermostat agent"; - private static final String USAGE = DESCRIPTION; + private static final String USAGE = "thermostat agent -d [-u -p ] [-s] [--debug]"; private AgentStartupConfiguration configuration; private AgentOptionParser parser; @@ -220,11 +219,6 @@ } @Override - public String getDescription() { - return DESCRIPTION; - } - - @Override public String getUsage() { return USAGE; } diff -r 73c182a706fc -r 486a299ab905 agent/cli/src/main/java/com/redhat/thermostat/agent/cli/ServiceCommand.java --- a/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/ServiceCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/ServiceCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -61,8 +61,7 @@ public class ServiceCommand extends SimpleCommand implements ActionListener { private static final String NAME = "service"; - private static final String DESCRIPTION = Translate.localize(LocaleResources.COMMAND_SERVICE_DESCRIPTION); - private static final String USAGE = DESCRIPTION; + private static final String USAGE = "thermostat service"; private List> listeners; @@ -120,11 +119,6 @@ } @Override - public String getDescription() { - return DESCRIPTION; - } - - @Override public String getUsage() { return USAGE; } diff -r 73c182a706fc -r 486a299ab905 agent/cli/src/main/java/com/redhat/thermostat/agent/cli/StorageCommand.java --- a/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/StorageCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/StorageCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -47,8 +47,6 @@ import com.redhat.thermostat.agent.cli.db.DBOptionParser; import com.redhat.thermostat.agent.cli.db.DBStartupConfiguration; import com.redhat.thermostat.agent.cli.db.MongoProcessRunner; -import com.redhat.thermostat.agent.cli.impl.locale.LocaleResources; -import com.redhat.thermostat.agent.cli.impl.locale.Translate; import com.redhat.thermostat.common.cli.Arguments; import com.redhat.thermostat.common.cli.CommandContext; import com.redhat.thermostat.common.cli.CommandException; @@ -62,9 +60,7 @@ private static final String NAME = "storage"; - private static final String DESCRIPTION = Translate.localize(LocaleResources.COMMAND_STORAGE_DESCRIPTION); - - private static final String USAGE = DESCRIPTION; + private static final String USAGE = "thermostat storage <--start|--stop>"; private DBStartupConfiguration configuration; private DBOptionParser parser; @@ -190,11 +186,6 @@ } @Override - public String getDescription() { - return DESCRIPTION; - } - - @Override public String getUsage() { return USAGE; } diff -r 73c182a706fc -r 486a299ab905 agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/locale/LocaleResources.java --- a/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/locale/LocaleResources.java Tue Oct 02 17:43:25 2012 -0400 +++ b/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/locale/LocaleResources.java Tue Oct 02 17:43:37 2012 -0400 @@ -38,11 +38,8 @@ public enum LocaleResources { - COMMAND_SERVICE_DESCRIPTION, - STARTING_AGENT, - COMMAND_STORAGE_DESCRIPTION, COMMAND_STORAGE_ARGUMENT_REQUIRED, COMMAND_STORAGE_ARGUMENT_CLUSTER_DESCRIPTION, COMMAND_STORAGE_ARGUMENT_DRYRUN_DESCRIPTION, diff -r 73c182a706fc -r 486a299ab905 agent/cli/src/main/resources/com/redhat/thermostat/agent/cli/impl/strings.properties --- a/agent/cli/src/main/resources/com/redhat/thermostat/agent/cli/impl/strings.properties Tue Oct 02 17:43:25 2012 -0400 +++ b/agent/cli/src/main/resources/com/redhat/thermostat/agent/cli/impl/strings.properties Tue Oct 02 17:43:37 2012 -0400 @@ -1,8 +1,5 @@ -COMMAND_SERVICE_DESCRIPTION = starts thermostat storage and agent - STARTING_AGENT = starting agent now... -COMMAND_STORAGE_DESCRIPTION = starts and stops the thermostat storage COMMAND_STORAGE_ARGUMENT_REQUIRED = either --start or --stop must be given COMMAND_STORAGE_ARGUMENT_CLUSTER_DESCRIPTION = launch the db in cluster mode, if not specified, local mode is the default @@ -24,4 +21,4 @@ STARTING_STORAGE_SERVER = starting storage server... CANNOT_EXECUTE_PROCESS = can not execute {0} process. is it installed? SERVER_LISTENING_ON = server listening on ip: {0} -PID_IS = pid: {0} \ No newline at end of file +PID_IS = pid: {0} diff -r 73c182a706fc -r 486a299ab905 agent/cli/src/test/java/com/redhat/thermostat/agent/cli/AgentApplicationTest.java --- a/agent/cli/src/test/java/com/redhat/thermostat/agent/cli/AgentApplicationTest.java Tue Oct 02 17:43:25 2012 -0400 +++ b/agent/cli/src/test/java/com/redhat/thermostat/agent/cli/AgentApplicationTest.java Tue Oct 02 17:43:37 2012 -0400 @@ -72,15 +72,9 @@ } @Test - public void testDescription() { - String description = agent.getDescription(); - assertEquals("starts and stops the thermostat agent", description); - } - - @Test public void testUsage() { String usage = agent.getUsage(); - assertEquals("starts and stops the thermostat agent", usage); + assertEquals("thermostat agent -d [-u -p ] [-s] [--debug]", usage); } @Test diff -r 73c182a706fc -r 486a299ab905 agent/cli/src/test/java/com/redhat/thermostat/agent/cli/DBServiceTest.java --- a/agent/cli/src/test/java/com/redhat/thermostat/agent/cli/DBServiceTest.java Tue Oct 02 17:43:25 2012 -0400 +++ b/agent/cli/src/test/java/com/redhat/thermostat/agent/cli/DBServiceTest.java Tue Oct 02 17:43:37 2012 -0400 @@ -244,17 +244,10 @@ } @Test - public void testDescription() { - StorageCommand dbService = new StorageCommand(); - String desc = dbService.getDescription(); - assertEquals("starts and stops the thermostat storage", desc); - } - - @Test public void testUsage() { StorageCommand dbService = new StorageCommand(); String usage = dbService.getUsage(); - assertEquals("starts and stops the thermostat storage", usage); + assertEquals("thermostat storage <--start|--stop>", usage); } @Test diff -r 73c182a706fc -r 486a299ab905 agent/cli/src/test/java/com/redhat/thermostat/agent/cli/ThermostatServiceTest.java --- a/agent/cli/src/test/java/com/redhat/thermostat/agent/cli/ThermostatServiceTest.java Tue Oct 02 17:43:25 2012 -0400 +++ b/agent/cli/src/test/java/com/redhat/thermostat/agent/cli/ThermostatServiceTest.java Tue Oct 02 17:43:37 2012 -0400 @@ -67,15 +67,9 @@ } @Test - public void testDescription() { - String desc = thermostatService.getDescription(); - assertEquals("starts thermostat storage and agent", desc); - } - - @Test public void testUsage() { String usage = thermostatService.getUsage(); - assertEquals("starts thermostat storage and agent", usage); + assertEquals("thermostat service", usage); } @Test diff -r 73c182a706fc -r 486a299ab905 client/command/src/main/java/com/redhat/thermostat/client/command/cli/PingCommand.java --- a/client/command/src/main/java/com/redhat/thermostat/client/command/cli/PingCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/client/command/src/main/java/com/redhat/thermostat/client/command/cli/PingCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -62,7 +62,6 @@ private static final String NAME = "ping"; private static final String USAGE = "ping "; - private static final String DESC = "Using the Command Channel, send a ping to a running agent."; private class PongListener implements RequestResponseListener { @@ -165,11 +164,6 @@ } @Override - public String getDescription() { - return DESC; - } - - @Override public String getUsage() { return USAGE; } diff -r 73c182a706fc -r 486a299ab905 client/core/src/main/java/com/redhat/thermostat/client/internal/GUIClientCommand.java --- a/client/core/src/main/java/com/redhat/thermostat/client/internal/GUIClientCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/client/core/src/main/java/com/redhat/thermostat/client/internal/GUIClientCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -42,8 +42,6 @@ import com.redhat.thermostat.client.internal.osgi.ApplicationServiceProvider; import com.redhat.thermostat.client.internal.osgi.ContextActionServiceProvider; -import com.redhat.thermostat.client.locale.LocaleResources; -import com.redhat.thermostat.client.locale.Translate; import com.redhat.thermostat.client.osgi.service.ApplicationService; import com.redhat.thermostat.client.osgi.service.ContextAction; import com.redhat.thermostat.common.cli.CommandContext; @@ -84,13 +82,8 @@ } @Override - public String getDescription() { - return Translate.localize(LocaleResources.COMMAND_GUI_DESCRIPTION); - } - - @Override public String getUsage() { - return getDescription(); + return "thermostat gui"; } @Override diff -r 73c182a706fc -r 486a299ab905 client/core/src/main/java/com/redhat/thermostat/client/locale/LocaleResources.java --- a/client/core/src/main/java/com/redhat/thermostat/client/locale/LocaleResources.java Tue Oct 02 17:43:25 2012 -0400 +++ b/client/core/src/main/java/com/redhat/thermostat/client/locale/LocaleResources.java Tue Oct 02 17:43:37 2012 -0400 @@ -41,8 +41,6 @@ MISSING_INFO, INFORMATION_NOT_AVAILABLE, - COMMAND_GUI_DESCRIPTION, - MAIN_WINDOW_TREE_ROOT_NAME, CONNECTION_FAILED_TO_CONNECT_TITLE, diff -r 73c182a706fc -r 486a299ab905 client/core/src/main/resources/com/redhat/thermostat/client/locale/strings.properties --- a/client/core/src/main/resources/com/redhat/thermostat/client/locale/strings.properties Tue Oct 02 17:43:25 2012 -0400 +++ b/client/core/src/main/resources/com/redhat/thermostat/client/locale/strings.properties Tue Oct 02 17:43:37 2012 -0400 @@ -5,8 +5,6 @@ CONNECTION_FAILED_TO_CONNECT_DESCRIPTION = Thermostat failed to connect to the data collector. CONNECTION_WIZARD = Configure... CONNECTION_QUIT = Quit - -COMMAND_GUI_DESCRIPTION = launches the GUI client MAIN_WINDOW_TREE_ROOT_NAME = Thermostat diff -r 73c182a706fc -r 486a299ab905 client/core/src/test/java/com/redhat/thermostat/client/internal/GUIClientCommandTest.java --- a/client/core/src/test/java/com/redhat/thermostat/client/internal/GUIClientCommandTest.java Tue Oct 02 17:43:25 2012 -0400 +++ b/client/core/src/test/java/com/redhat/thermostat/client/internal/GUIClientCommandTest.java Tue Oct 02 17:43:37 2012 -0400 @@ -101,13 +101,8 @@ } @Test - public void testDescription() { - assertEquals("launches the GUI client", cmd.getDescription()); - } - - @Test public void testUsage() { - assertEquals("launches the GUI client", cmd.getUsage()); + assertEquals("thermostat gui", cmd.getUsage()); } @Test diff -r 73c182a706fc -r 486a299ab905 client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/LocaleResources.java --- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/LocaleResources.java Tue Oct 02 17:43:25 2012 -0400 +++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/LocaleResources.java Tue Oct 02 17:43:37 2012 -0400 @@ -57,18 +57,11 @@ ARGUMENT_LIMIT_DESCRIPTION, ARGUMENT_FILE_NAME_DESCRIPTION, - COMMAND_DUMP_HEAP_DESCRIPTION, COMMAND_HEAP_DUMP_DONE, - COMMAND_FIND_OBJECTS_DESCRIPTION, - - COMMAND_FIND_ROOT_DESCRIPTION, COMMAND_FIND_ROOT_ARGUMENT_ALL, COMMAND_FIND_ROOT_NO_ROOT_FOUND, - COMMAND_LIST_HEAP_DUMPS_DESCRIPTION, - - COMMAND_OBJECT_INFO_DESCRIPTION, COMMAND_OBJECT_INFO_OBJECT_ID, COMMAND_OBJECT_INFO_TYPE, COMMAND_OBJECT_INFO_SIZE, @@ -76,13 +69,10 @@ COMMAND_OBJECT_INFO_REFERENCES, COMMAND_OBJECT_INFO_REFERRERS, - COMMAND_SAVE_HEAP_DUMP_DESCRIPTION, COMMAND_SAVE_HEAP_DUMP_SAVED_TO_FILE, COMMAND_SAVE_HEAP_DUMP_ERROR_SAVING, COMMAND_SAVE_HEAP_DUMP_ERROR_CLOSING_STREAM, - COMMAND_SHOW_HEAP_HISTOGRAM_DESCRIPTION, - HEAP_SECTION_TITLE, HEAP_OVERVIEW_TITLE, HEAP_CHART_TITLE, diff -r 73c182a706fc -r 486a299ab905 client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/DumpHeapCommand.java --- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/DumpHeapCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/DumpHeapCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -51,8 +51,7 @@ public class DumpHeapCommand extends SimpleCommand { private static final String NAME = "dump-heap"; - private static final String DESCRIPTION = Translate.localize(LocaleResources.COMMAND_DUMP_HEAP_DESCRIPTION); - private static final String USAGE = DESCRIPTION; + private static final String USAGE = "thermostat dump-heap --hostId --vmId "; private final HeapDumperCommand implementation; @@ -70,11 +69,6 @@ } @Override - public String getDescription() { - return DESCRIPTION; - } - - @Override public String getUsage() { return USAGE; } diff -r 73c182a706fc -r 486a299ab905 client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/FindObjectsCommand.java --- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/FindObjectsCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/FindObjectsCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -58,7 +58,7 @@ private static final String HEAP_ID_ARG = "heapId"; private static final String LIMIT_ARG = "limit"; private static final String NAME = "find-objects"; - private static final String DESCRIPTION = Translate.localize(LocaleResources.COMMAND_FIND_OBJECTS_DESCRIPTION); + private static final String USAGE = "thermostat find-objects --heapId --limit "; private static final String HEADER_OBJECT_ID = Translate.localize(LocaleResources.HEADER_OBJECT_ID); private static final String HEADER_TYPE = Translate.localize(LocaleResources.HEADER_OBJECT_TYPE); private static final int DEFAULT_LIMIT = 10; @@ -110,13 +110,8 @@ } @Override - public String getDescription() { - return DESCRIPTION; - } - - @Override public String getUsage() { - return DESCRIPTION; + return USAGE; } @Override diff -r 73c182a706fc -r 486a299ab905 client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/FindRootCommand.java --- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/FindRootCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/FindRootCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -57,8 +57,8 @@ public class FindRootCommand extends SimpleCommand { private static final String ALL_ARG = "all"; - private static final String DESCRIPTION = Translate.localize(LocaleResources.COMMAND_FIND_ROOT_DESCRIPTION); private static final String NAME = "find-root"; + private static final String USAGE = "thermostat find-root --heapId --objectId [-a]"; @Override public void run(CommandContext ctx) throws CommandException { @@ -118,13 +118,8 @@ } @Override - public String getDescription() { - return DESCRIPTION; - } - - @Override public String getUsage() { - return DESCRIPTION; + return USAGE; } @Override diff -r 73c182a706fc -r 486a299ab905 client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ListHeapDumpsCommand.java --- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ListHeapDumpsCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ListHeapDumpsCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -61,8 +61,7 @@ public class ListHeapDumpsCommand extends SimpleCommand { private static final String NAME = "list-heap-dumps"; - private static final String DESCRIPTION = Translate.localize(LocaleResources.COMMAND_LIST_HEAP_DUMPS_DESCRIPTION); - private static final String USAGE = DESCRIPTION; + private static final String USAGE = "same_as_desc"; // TODO localize private static final String[] COLUMN_NAMES = { @@ -78,11 +77,6 @@ } @Override - public String getDescription() { - return DESCRIPTION; - } - - @Override public String getUsage() { return USAGE; } diff -r 73c182a706fc -r 486a299ab905 client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ObjectInfoCommand.java --- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ObjectInfoCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ObjectInfoCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -57,8 +57,8 @@ public class ObjectInfoCommand extends SimpleCommand { - private static final String DESCRIPTION = Translate.localize(LocaleResources.COMMAND_OBJECT_INFO_DESCRIPTION); private static final String NAME = "object-info"; + private static final String USAGE = "thermostat object-info --heapId --objectId "; private Snapshot snapshot; @@ -122,13 +122,8 @@ } @Override - public String getDescription() { - return DESCRIPTION; - } - - @Override public String getUsage() { - return DESCRIPTION; + return USAGE; } @Override diff -r 73c182a706fc -r 486a299ab905 client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/SaveHeapDumpToFileCommand.java --- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/SaveHeapDumpToFileCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/SaveHeapDumpToFileCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -61,8 +61,7 @@ public class SaveHeapDumpToFileCommand extends SimpleCommand { private static final String NAME = "save-heap-dump-to-file"; - private static final String DESCRIPTION = Translate.localize(LocaleResources.COMMAND_SAVE_HEAP_DUMP_DESCRIPTION); - private static final String USAGE = DESCRIPTION; + private static final String USAGE = "same as desc"; private static final String HEAP_ID_ARGUMENT = "heapId"; private static final String FILE_NAME_ARGUMENT = "file"; @@ -83,11 +82,6 @@ } @Override - public String getDescription() { - return DESCRIPTION; - } - - @Override public String getUsage() { return USAGE; } diff -r 73c182a706fc -r 486a299ab905 client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ShowHeapHistogramCommand.java --- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ShowHeapHistogramCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ShowHeapHistogramCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -57,8 +57,7 @@ public class ShowHeapHistogramCommand extends SimpleCommand { private static final String NAME = "show-heap-histogram"; - private static final String DESCRIPTION = Translate.localize(LocaleResources.COMMAND_SHOW_HEAP_HISTOGRAM_DESCRIPTION); - private static final String USAGE = DESCRIPTION; + private static final String USAGE = "same as desc"; @Override public String getName() { @@ -66,11 +65,6 @@ } @Override - public String getDescription() { - return DESCRIPTION; - } - - @Override public String getUsage() { return USAGE; } diff -r 73c182a706fc -r 486a299ab905 client/heapdumper/src/main/resources/com/redhat/thermostat/client/heap/strings.properties --- a/client/heapdumper/src/main/resources/com/redhat/thermostat/client/heap/strings.properties Tue Oct 02 17:43:25 2012 -0400 +++ b/client/heapdumper/src/main/resources/com/redhat/thermostat/client/heap/strings.properties Tue Oct 02 17:43:37 2012 -0400 @@ -17,18 +17,11 @@ ARGUMENT_LIMIT_DESCRIPTION = limit search to top N results, defaults to {0} ARGUMENT_FILE_NAME_DESCRIPTION = the file name to save to -COMMAND_DUMP_HEAP_DESCRIPTION = trigger a heap dump on the VM COMMAND_HEAP_DUMP_DONE = Done -COMMAND_FIND_OBJECTS_DESCRIPTION = Finds objects in a heapdump - -COMMAND_FIND_ROOT_DESCRIPTION = finds the shortest path from an object to a GC root COMMAND_FIND_ROOT_ARGUMENT_ALL = finds all paths to GC roots COMMAND_FIND_ROOT_NO_ROOT_FOUND = No root found for: {0} -COMMAND_LIST_HEAP_DUMPS_DESCRIPTION = list all heap dumps - -COMMAND_OBJECT_INFO_DESCRIPTION = prints information about an object in a heap dump COMMAND_OBJECT_INFO_OBJECT_ID = Object ID: COMMAND_OBJECT_INFO_TYPE = Type: COMMAND_OBJECT_INFO_SIZE = Size: @@ -36,13 +29,10 @@ COMMAND_OBJECT_INFO_REFERENCES = References: COMMAND_OBJECT_INFO_REFERRERS = Referrers: -COMMAND_SAVE_HEAP_DUMP_DESCRIPTION = saves a heap dump to a local file COMMAND_SAVE_HEAP_DUMP_SAVED_TO_FILE = Saved heap dump to {0} COMMAND_SAVE_HEAP_DUMP_ERROR_SAVING = error saving heap to file: {0} COMMAND_SAVE_HEAP_DUMP_ERROR_CLOSING_STREAM = error closing heap stream: {0} -COMMAND_SHOW_HEAP_HISTOGRAM_DESCRIPTION = show the heap histogram - HEAP_SECTION_TITLE = Memory Analyzer HEAP_OVERVIEW_TITLE = Heap Usage Overview HEAP_CHART_TITLE = Used Heap vs. Heap Capacity diff -r 73c182a706fc -r 486a299ab905 client/heapdumper/src/test/java/com/redhat/thermostat/client/heap/cli/DumpHeapCommandTest.java --- a/client/heapdumper/src/test/java/com/redhat/thermostat/client/heap/cli/DumpHeapCommandTest.java Tue Oct 02 17:43:25 2012 -0400 +++ b/client/heapdumper/src/test/java/com/redhat/thermostat/client/heap/cli/DumpHeapCommandTest.java Tue Oct 02 17:43:37 2012 -0400 @@ -62,7 +62,7 @@ Command command = new DumpHeapCommand(); assertEquals("dump-heap", command.getName()); assertNotNull(command.getDescription()); - assertNotNull(command.getUsage()); + assertEquals("thermostat dump-heap --hostId --vmId ", command.getUsage()); } @Test diff -r 73c182a706fc -r 486a299ab905 client/heapdumper/src/test/java/com/redhat/thermostat/client/heap/cli/FindObjectsCommandTest.java --- a/client/heapdumper/src/test/java/com/redhat/thermostat/client/heap/cli/FindObjectsCommandTest.java Tue Oct 02 17:43:25 2012 -0400 +++ b/client/heapdumper/src/test/java/com/redhat/thermostat/client/heap/cli/FindObjectsCommandTest.java Tue Oct 02 17:43:37 2012 -0400 @@ -136,13 +136,8 @@ } @Test - public void testDescription() { - assertEquals("Finds objects in a heapdump", cmd.getDescription()); - } - - @Test public void testUsage() { - assertEquals("Finds objects in a heapdump", cmd.getUsage()); + assertEquals("thermostat find-objects --heapId --limit ", cmd.getUsage()); } @Test diff -r 73c182a706fc -r 486a299ab905 client/heapdumper/src/test/java/com/redhat/thermostat/client/heap/cli/FindRootCommandTest.java --- a/client/heapdumper/src/test/java/com/redhat/thermostat/client/heap/cli/FindRootCommandTest.java Tue Oct 02 17:43:25 2012 -0400 +++ b/client/heapdumper/src/test/java/com/redhat/thermostat/client/heap/cli/FindRootCommandTest.java Tue Oct 02 17:43:37 2012 -0400 @@ -191,13 +191,8 @@ } @Test - public void testDescription() { - assertEquals("finds the shortest path from an object to a GC root", cmd.getDescription()); - } - - @Test public void testUsage() { - assertEquals("finds the shortest path from an object to a GC root", cmd.getUsage()); + assertEquals("thermostat find-root --heapId --objectId [-a]", cmd.getUsage()); } @Test diff -r 73c182a706fc -r 486a299ab905 client/heapdumper/src/test/java/com/redhat/thermostat/client/heap/cli/ObjectInfoCommandTest.java --- a/client/heapdumper/src/test/java/com/redhat/thermostat/client/heap/cli/ObjectInfoCommandTest.java Tue Oct 02 17:43:25 2012 -0400 +++ b/client/heapdumper/src/test/java/com/redhat/thermostat/client/heap/cli/ObjectInfoCommandTest.java Tue Oct 02 17:43:37 2012 -0400 @@ -157,13 +157,8 @@ } @Test - public void testDescription() { - assertEquals("prints information about an object in a heap dump", cmd.getDescription()); - } - - @Test public void testUsage() { - assertEquals("prints information about an object in a heap dump", cmd.getUsage()); + assertEquals("thermostat object-info --heapId --objectId ", cmd.getUsage()); } @Test diff -r 73c182a706fc -r 486a299ab905 common/core/src/main/java/com/redhat/thermostat/common/cli/CommandInfo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/core/src/main/java/com/redhat/thermostat/common/cli/CommandInfo.java Tue Oct 02 17:43:37 2012 -0400 @@ -0,0 +1,13 @@ +package com.redhat.thermostat.common.cli; + +import java.util.List; + +public interface CommandInfo { + + public String getName(); + + public String getDescription(); + + public List getDependencyResourceNames(); + +} diff -r 73c182a706fc -r 486a299ab905 common/core/src/main/java/com/redhat/thermostat/common/cli/CommandWithInfo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/core/src/main/java/com/redhat/thermostat/common/cli/CommandWithInfo.java Tue Oct 02 17:43:37 2012 -0400 @@ -0,0 +1,56 @@ +package com.redhat.thermostat.common.cli; + +import org.apache.commons.cli.Options; + +public abstract class CommandWithInfo implements Command { + + private CommandInfo info; + private static final String noDesc = "Description not available."; + + void setCommandInfo(CommandInfo info) { + this.info = info; + } + + @Override + public String getDescription() { + String desc = null; + try { + desc = info.getDescription(); + } catch (NullPointerException infoWasNotSet) {} + if (desc == null) { + desc = noDesc; + } + return desc; + } + + @Override + public String getUsage() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Options getOptions() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean isStorageRequired() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isAvailableInShell() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isAvailableOutsideShell() { + // TODO Auto-generated method stub + return false; + } + +} diff -r 73c182a706fc -r 486a299ab905 common/core/src/main/java/com/redhat/thermostat/common/cli/SimpleCommand.java --- a/common/core/src/main/java/com/redhat/thermostat/common/cli/SimpleCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/common/core/src/main/java/com/redhat/thermostat/common/cli/SimpleCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -36,7 +36,7 @@ package com.redhat.thermostat.common.cli; -public abstract class SimpleCommand implements Command { +public abstract class SimpleCommand extends CommandWithInfo { @Override public boolean isStorageRequired() { diff -r 73c182a706fc -r 486a299ab905 common/core/src/main/java/com/redhat/thermostat/common/tools/BasicCommand.java --- a/common/core/src/main/java/com/redhat/thermostat/common/tools/BasicCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/common/core/src/main/java/com/redhat/thermostat/common/tools/BasicCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -37,13 +37,13 @@ package com.redhat.thermostat.common.tools; import com.redhat.thermostat.common.ActionNotifier; -import com.redhat.thermostat.common.cli.Command; +import com.redhat.thermostat.common.cli.CommandWithInfo; import com.redhat.thermostat.common.config.StartupConfiguration; /** * Common base class for all daemon and application */ -public abstract class BasicCommand implements Command { +public abstract class BasicCommand extends CommandWithInfo { private ActionNotifier notifier; private boolean storageRequired; diff -r 73c182a706fc -r 486a299ab905 distribution/config/commands/agent.properties --- a/distribution/config/commands/agent.properties Tue Oct 02 17:43:25 2012 -0400 +++ b/distribution/config/commands/agent.properties Tue Oct 02 17:43:37 2012 -0400 @@ -8,3 +8,5 @@ thermostat-agent-killvm-@project.version@.jar, \ thermostat-thread-collector-@project.version@.jar, \ thermostat-thread-harvester-@project.version@.jar + +description = starts and stops the thermostat agent \ No newline at end of file diff -r 73c182a706fc -r 486a299ab905 distribution/config/commands/connect.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/distribution/config/commands/connect.properties Tue Oct 02 17:43:37 2012 -0400 @@ -0,0 +1,4 @@ +# ConnectCommand is provided by the tools bundle, which is a bootstrap bundle, and requires no other bundles. +bundles = + +description = persistently connect to a database diff -r 73c182a706fc -r 486a299ab905 distribution/config/commands/disconnect.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/distribution/config/commands/disconnect.properties Tue Oct 02 17:43:37 2012 -0400 @@ -0,0 +1,4 @@ +# DisconnectCommand is provided by the tools bundle, which is a bootstrap bundle, and requires no other bundles. +bundles = + +description = disconnect from the currently used database diff -r 73c182a706fc -r 486a299ab905 distribution/config/commands/dump-heap.properties --- a/distribution/config/commands/dump-heap.properties Tue Oct 02 17:43:25 2012 -0400 +++ b/distribution/config/commands/dump-heap.properties Tue Oct 02 17:43:37 2012 -0400 @@ -5,3 +5,5 @@ thermostat-client-heapdumper-@project.version@.jar, \ thermostat-swing-components-@project.version@.jar, \ thermostat-laf-@project.version@.jar + +description = trigger a heap dump on the VM diff -r 73c182a706fc -r 486a299ab905 distribution/config/commands/find-objects.properties --- a/distribution/config/commands/find-objects.properties Tue Oct 02 17:43:25 2012 -0400 +++ b/distribution/config/commands/find-objects.properties Tue Oct 02 17:43:37 2012 -0400 @@ -5,3 +5,5 @@ thermostat-client-heapdumper-@project.version@.jar, \ thermostat-swing-components-@project.version@.jar, \ thermostat-laf-@project.version@.jar + +description = Finds objects in a heapdump diff -r 73c182a706fc -r 486a299ab905 distribution/config/commands/find-root.properties --- a/distribution/config/commands/find-root.properties Tue Oct 02 17:43:25 2012 -0400 +++ b/distribution/config/commands/find-root.properties Tue Oct 02 17:43:37 2012 -0400 @@ -5,3 +5,5 @@ thermostat-client-heapdumper-@project.version@.jar, \ thermostat-swing-components-@project.version@.jar, \ thermostat-laf-@project.version@.jar + +description = finds the shortest path from an object to a GC root diff -r 73c182a706fc -r 486a299ab905 distribution/config/commands/gui.properties --- a/distribution/config/commands/gui.properties Tue Oct 02 17:43:25 2012 -0400 +++ b/distribution/config/commands/gui.properties Tue Oct 02 17:43:37 2012 -0400 @@ -16,3 +16,4 @@ thermostat-osgi-process-handler-@project.version@.jar, \ thermostat-client-command-@project.version@.jar +description = launches the GUI client diff -r 73c182a706fc -r 486a299ab905 distribution/config/commands/help.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/distribution/config/commands/help.properties Tue Oct 02 17:43:37 2012 -0400 @@ -0,0 +1,3 @@ +# HelpCommand is provided by launcher, and needs no other bundles to be loaded. +bundles = +description = show help for a given command or help overview diff -r 73c182a706fc -r 486a299ab905 distribution/config/commands/list-heap-dumps.properties --- a/distribution/config/commands/list-heap-dumps.properties Tue Oct 02 17:43:25 2012 -0400 +++ b/distribution/config/commands/list-heap-dumps.properties Tue Oct 02 17:43:37 2012 -0400 @@ -5,3 +5,5 @@ thermostat-client-heapdumper-@project.version@.jar, \ thermostat-swing-components-@project.version@.jar, \ thermostat-laf-@project.version@.jar + +description = list all heap dumps diff -r 73c182a706fc -r 486a299ab905 distribution/config/commands/list-vms.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/distribution/config/commands/list-vms.properties Tue Oct 02 17:43:37 2012 -0400 @@ -0,0 +1,4 @@ +# ListVmsCommand is provided by tools bundle (a bootstrap bundle) and needs no other bundles +bundles = + +description = lists all currently monitored VMs diff -r 73c182a706fc -r 486a299ab905 distribution/config/commands/object-info.properties --- a/distribution/config/commands/object-info.properties Tue Oct 02 17:43:25 2012 -0400 +++ b/distribution/config/commands/object-info.properties Tue Oct 02 17:43:37 2012 -0400 @@ -5,3 +5,5 @@ thermostat-client-heapdumper-@project.version@.jar, \ thermostat-swing-components-@project.version@.jar, \ thermostat-laf-@project.version@.jar + +description = prints information about an object in a heap dump diff -r 73c182a706fc -r 486a299ab905 distribution/config/commands/ping.properties --- a/distribution/config/commands/ping.properties Tue Oct 02 17:43:25 2012 -0400 +++ b/distribution/config/commands/ping.properties Tue Oct 02 17:43:37 2012 -0400 @@ -1,2 +1,4 @@ bundles = thermostat-common-command-@project.version@.jar, \ thermostat-client-command-@project.version@.jar + +description = using the Command Channel, send a ping to a running agent diff -r 73c182a706fc -r 486a299ab905 distribution/config/commands/save-heap-dump-to-file.properties --- a/distribution/config/commands/save-heap-dump-to-file.properties Tue Oct 02 17:43:25 2012 -0400 +++ b/distribution/config/commands/save-heap-dump-to-file.properties Tue Oct 02 17:43:37 2012 -0400 @@ -5,3 +5,5 @@ thermostat-client-heapdumper-@project.version@.jar, \ thermostat-swing-components-@project.version@.jar, \ thermostat-laf-@project.version@.jar + +description = saves a heap dump to a local file diff -r 73c182a706fc -r 486a299ab905 distribution/config/commands/service.properties --- a/distribution/config/commands/service.properties Tue Oct 02 17:43:25 2012 -0400 +++ b/distribution/config/commands/service.properties Tue Oct 02 17:43:37 2012 -0400 @@ -4,3 +4,5 @@ thermostat-common-command-@project.version@.jar, \ thermostat-agent-command-@project.version@.jar, \ thermostat-agent-cli-@project.version@.jar + +description = starts and stops the thermostat storage and agent diff -r 73c182a706fc -r 486a299ab905 distribution/config/commands/shell.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/distribution/config/commands/shell.properties Tue Oct 02 17:43:37 2012 -0400 @@ -0,0 +1,4 @@ +# ShellCommand is provided by the tools bundle, which is a bootstrap bundle, and requires no other bundles. +bundles = + +description = launches the Thermostat interactive shell diff -r 73c182a706fc -r 486a299ab905 distribution/config/commands/show-heap-histogram.properties --- a/distribution/config/commands/show-heap-histogram.properties Tue Oct 02 17:43:25 2012 -0400 +++ b/distribution/config/commands/show-heap-histogram.properties Tue Oct 02 17:43:37 2012 -0400 @@ -5,3 +5,5 @@ thermostat-client-heapdumper-@project.version@.jar, \ thermostat-swing-components-@project.version@.jar, \ thermostat-laf-@project.version@.jar + +description = show the heap histogram diff -r 73c182a706fc -r 486a299ab905 distribution/config/commands/storage.properties --- a/distribution/config/commands/storage.properties Tue Oct 02 17:43:25 2012 -0400 +++ b/distribution/config/commands/storage.properties Tue Oct 02 17:43:37 2012 -0400 @@ -4,3 +4,5 @@ thermostat-agent-cli-@project.version@.jar, \ thermostat-common-command-@project.version@.jar, \ thermostat-agent-command-@project.version@.jar + +description = starts and stops the thermostat storage diff -r 73c182a706fc -r 486a299ab905 distribution/config/commands/vm-info.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/distribution/config/commands/vm-info.properties Tue Oct 02 17:43:37 2012 -0400 @@ -0,0 +1,4 @@ +# VMInfoCommand is provided by the tools bundle, a bootstrap bundle, and requires no other bundles. +bundles = + +description = shows basic information about a VM diff -r 73c182a706fc -r 486a299ab905 distribution/config/commands/vm-stat.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/distribution/config/commands/vm-stat.properties Tue Oct 02 17:43:37 2012 -0400 @@ -0,0 +1,4 @@ +# VMStatCommand is provided by tools bundle, a bootstrap bundle, and requires no other bundles. +bundles = + +description = show various statistics about a VM diff -r 73c182a706fc -r 486a299ab905 launcher/src/main/java/com/redhat/thermostat/launcher/internal/Activator.java --- a/launcher/src/main/java/com/redhat/thermostat/launcher/internal/Activator.java Tue Oct 02 17:43:25 2012 -0400 +++ b/launcher/src/main/java/com/redhat/thermostat/launcher/internal/Activator.java Tue Oct 02 17:43:37 2012 -0400 @@ -74,7 +74,7 @@ } private void informRegistryAboutCommandDependencies(CommandInfoSource commands, OSGiRegistry bundleService) { - for (CommandInfo info : commands.getCommandInfos()) { + for (CommandInfoImpl info : commands.getCommandInfos()) { bundleService.setCommandBundleDependencies(info.getName(), info.getDependencyResourceNames()); } diff -r 73c182a706fc -r 486a299ab905 launcher/src/main/java/com/redhat/thermostat/launcher/internal/CommandInfo.java --- a/launcher/src/main/java/com/redhat/thermostat/launcher/internal/CommandInfo.java Tue Oct 02 17:43:25 2012 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* - * Copyright 2012 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * . - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.launcher.internal; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map.Entry; -import java.util.Properties; -import java.util.logging.Logger; - - -public class CommandInfo { - - private static final Logger logger = Logger.getLogger(CommandInfoSource.class.getSimpleName()); - private static final String PROPERTY_BUNDLES = "bundles"; - - private String name; - private List dependencies; - - CommandInfo(String name, Properties properties, String thermostatHome) { - this.name = name; - for (Entry entry: properties.entrySet()) { - String key = (String) entry.getKey(); - if (key.equals(PROPERTY_BUNDLES)) { - learnDependencies(entry, thermostatHome); - } - - } - } - - private void learnDependencies(Entry bundlesEntry, String thermostatHome) { - String libRoot = thermostatHome + File.separator + "libs"; - List resourceNames = Arrays.asList(((String)bundlesEntry.getValue()).split(",")); - dependencies = new ArrayList<>(resourceNames.size()); - for (String value: resourceNames) { - File file = new File(libRoot, value.trim()); - String path = file.toURI().toString(); - if (!file.exists()) { - logger.severe("Bundle " + path + " required by " + getName() + - " command does not exist in the filesystem. This will cause" + - " osgi wiring issue when attempting to run this command."); - // Allow to proceed because this command may never be called. - } else { - dependencies.add(path); - } - } - } - - public String getName() { - return name; - } - - List getDependencyResourceNames() { - return dependencies; - } -} diff -r 73c182a706fc -r 486a299ab905 launcher/src/main/java/com/redhat/thermostat/launcher/internal/CommandInfoImpl.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/launcher/src/main/java/com/redhat/thermostat/launcher/internal/CommandInfoImpl.java Tue Oct 02 17:43:37 2012 -0400 @@ -0,0 +1,103 @@ +/* + * Copyright 2012 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * . + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.launcher.internal; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.logging.Logger; + +import com.redhat.thermostat.common.cli.CommandInfo; +import com.redhat.thermostat.common.utils.LoggingUtils; + + +public class CommandInfoImpl implements CommandInfo { + + private static final Logger logger = LoggingUtils.getLogger(CommandInfoSource.class); + private static final String PROPERTY_BUNDLES = "bundles"; + private static final String PROPERTY_DESC = "description"; + + private String name; + private String description; + private List dependencies; + + CommandInfoImpl(String name, Properties properties, String thermostatHome) { + this.name = name; + for (Entry entry: properties.entrySet()) { + String key = (String) entry.getKey(); + if (key.equals(PROPERTY_BUNDLES)) { + learnDependencies(entry, thermostatHome); + } else if (key.equals(PROPERTY_DESC)) { + description = properties.getProperty(key); + } + + } + } + + private void learnDependencies(Entry bundlesEntry, String thermostatHome) { + String libRoot = thermostatHome + File.separator + "libs"; + List resourceNames = Arrays.asList(((String)bundlesEntry.getValue()).split(",")); + dependencies = new ArrayList<>(resourceNames.size()); + for (String value: resourceNames) { + File file = new File(libRoot, value.trim()); + String path = file.toURI().toString(); + if (!file.exists()) { + logger.severe("Bundle " + path + " required by " + getName() + + " command does not exist in the filesystem. This will cause" + + " osgi wiring issue when attempting to run this command."); + // Allow to proceed because this command may never be called. + } else { + dependencies.add(path); + } + } + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public List getDependencyResourceNames() { + return dependencies; + } +} diff -r 73c182a706fc -r 486a299ab905 launcher/src/main/java/com/redhat/thermostat/launcher/internal/CommandInfoSource.java --- a/launcher/src/main/java/com/redhat/thermostat/launcher/internal/CommandInfoSource.java Tue Oct 02 17:43:25 2012 -0400 +++ b/launcher/src/main/java/com/redhat/thermostat/launcher/internal/CommandInfoSource.java Tue Oct 02 17:43:37 2012 -0400 @@ -49,7 +49,7 @@ public class CommandInfoSource { private static final Logger logger = Logger.getLogger(CommandInfoSource.class.getSimpleName()); - private Map commands; + private Map commands; CommandInfoSource(String thermostatHome) { commands = new HashMap<>(); @@ -77,7 +77,7 @@ logger.warning("Issue loading properties file: " + file.getPath()); } String commandName = deduceCommandName(file.getName()); - commands.put(commandName, new CommandInfo(commandName, commandProps, thermostatHome)); + commands.put(commandName, new CommandInfoImpl(commandName, commandProps, thermostatHome)); } } else { logger.warning("Command configuration directory not found or not a directory: " + dir.getPath()); @@ -89,11 +89,11 @@ return fileName.substring(0, dotIndex); } - public CommandInfo getCommandInfo(String name) { + public CommandInfoImpl getCommandInfo(String name) { return commands.get(name); } - public Collection getCommandInfos() { + public Collection getCommandInfos() { return commands.values(); } diff -r 73c182a706fc -r 486a299ab905 launcher/src/main/java/com/redhat/thermostat/launcher/internal/HelpCommand.java --- a/launcher/src/main/java/com/redhat/thermostat/launcher/internal/HelpCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/launcher/src/main/java/com/redhat/thermostat/launcher/internal/HelpCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -58,8 +58,7 @@ private static final int COMMANDS_COLUMNS_WIDTH = 14; private static final String NAME = "help"; - private static final String DESCRIPTION = "show help for a given command or help overview"; - private static final String USAGE = DESCRIPTION; + private static final String USAGE = "thermostat help [command-name]"; private static final CommandComparator comparator = new CommandComparator(); @@ -119,11 +118,6 @@ } @Override - public String getDescription() { - return DESCRIPTION; - } - - @Override public String getUsage() { return USAGE; } diff -r 73c182a706fc -r 486a299ab905 launcher/src/test/java/com/redhat/thermostat/launcher/LauncherTest.java --- a/launcher/src/test/java/com/redhat/thermostat/launcher/LauncherTest.java Tue Oct 02 17:43:25 2012 -0400 +++ b/launcher/src/test/java/com/redhat/thermostat/launcher/LauncherTest.java Tue Oct 02 17:43:37 2012 -0400 @@ -194,7 +194,7 @@ @Test public void testMainNoArgs() { String expected = "list of commands:\n\n" - + " help show help for a given command or help overview\n" + + " help Description not available.\n" // We haven't actually set up CommandInfo here. + " basic nothing that means anything\n" + " test1 description 1\n" + " test2 description 2\n" @@ -213,7 +213,7 @@ public void testMainBadCommand1() { String expected = "unknown command '--help'\n" + "list of commands:\n\n" - + " help show help for a given command or help overview\n" + + " help Description not available.\n" + " basic nothing that means anything\n" + " test1 description 1\n" + " test2 description 2\n" @@ -225,7 +225,7 @@ public void testMainBadCommand2() { String expected = "unknown command '-help'\n" + "list of commands:\n\n" - + " help show help for a given command or help overview\n" + + " help Description not available.\n" + " basic nothing that means anything\n" + " test1 description 1\n" + " test2 description 2\n" @@ -237,7 +237,7 @@ public void testMainBadCommand3() { String expected = "unknown command 'foobarbaz'\n" + "list of commands:\n\n" - + " help show help for a given command or help overview\n" + + " help Description not available.\n" + " basic nothing that means anything\n" + " test1 description 1\n" + " test2 description 2\n" @@ -249,7 +249,7 @@ public void testMainBadCommand4() { String expected = "unknown command 'foo'\n" + "list of commands:\n\n" - + " help show help for a given command or help overview\n" + + " help Description not available.\n" + " basic nothing that means anything\n" + " test1 description 1\n" + " test2 description 2\n" diff -r 73c182a706fc -r 486a299ab905 launcher/src/test/java/com/redhat/thermostat/launcher/internal/ActivatorTest.java --- a/launcher/src/test/java/com/redhat/thermostat/launcher/internal/ActivatorTest.java Tue Oct 02 17:43:25 2012 -0400 +++ b/launcher/src/test/java/com/redhat/thermostat/launcher/internal/ActivatorTest.java Tue Oct 02 17:43:37 2012 -0400 @@ -107,7 +107,7 @@ when(registryService.getConfiguration()).thenReturn(config); CommandInfoSource commands = mock(CommandInfoSource.class); - when(commands.getCommandInfos()).thenReturn(new ArrayList()); + when(commands.getCommandInfos()).thenReturn(new ArrayList()); whenNew(CommandInfoSource.class). withParameterTypes(String.class). withArguments(isA(String.class)).thenReturn(commands); diff -r 73c182a706fc -r 486a299ab905 launcher/src/test/java/com/redhat/thermostat/launcher/internal/CommandInfoImplTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/launcher/src/test/java/com/redhat/thermostat/launcher/internal/CommandInfoImplTest.java Tue Oct 02 17:43:37 2012 -0400 @@ -0,0 +1,143 @@ +/* + * Copyright 2012 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * . + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.launcher.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.Properties; + +import org.junit.Before; +import org.junit.Test; + +public class CommandInfoImplTest { + + private Path tempThermostatHome, someJarName1, someJarName2, missingJarName; + + @Before + public void setUp() throws IOException { + tempThermostatHome = Files.createTempDirectory("test"); + tempThermostatHome.toFile().deleteOnExit(); + System.setProperty("THERMOSTAT_HOME", tempThermostatHome.toString()); + + File tempLibs = new File(tempThermostatHome.toFile(), "libs"); + tempLibs.mkdirs(); + tempLibs.deleteOnExit(); + + File someJar1 = new File(tempLibs, "thermostat-osgi-fluff1.jar"); + someJar1.createNewFile(); + someJar1.deleteOnExit(); + someJarName1 = someJar1.toPath(); + + File someJar2 = new File(tempLibs, "thermostat-osgi-fluff2.jar"); + someJar2.createNewFile(); + someJar2.deleteOnExit(); + someJarName2 = someJar2.toPath(); + + File missingJar = new File(tempLibs, "thisjar_noexist.jar"); + missingJarName = missingJar.toPath(); + } + + private String resolvedJar(Path jar) { + return "file:" + jar.toString(); + } + + @Test + public void verifyGetName() { + Properties props = new Properties(); + String name = "name"; + CommandInfoImpl info = new CommandInfoImpl(name, props, ""); + + String commandName = info.getName(); + assertEquals(name, commandName); + } + + @Test + public void verifySingleResource() { + Properties props = new Properties(); + props.setProperty("bundles", someJarName1.getFileName().toString()); + String name = "name"; + CommandInfoImpl info = new CommandInfoImpl(name, props, tempThermostatHome.toString()); + + List resources = info.getDependencyResourceNames(); + assertEquals(1, resources.size()); + assertTrue(resources.contains(resolvedJar(someJarName1))); + } + + @Test + public void verifyMultipleResources() { + Properties props = new Properties(); + props.setProperty("bundles", someJarName1.getFileName() + "," + someJarName2.getFileName()); + String name = "name"; + CommandInfoImpl info = new CommandInfoImpl(name, props, tempThermostatHome.toString()); + + List resources = info.getDependencyResourceNames(); + assertEquals(2, resources.size()); + assertTrue(resources.contains(resolvedJar(someJarName1))); + assertTrue(resources.contains(resolvedJar(someJarName2))); + } + + @Test + public void verifyMissingResource() { + Properties props = new Properties(); + props.setProperty("bundles", missingJarName.getFileName().toString()); + String name = "name"; + CommandInfoImpl info = new CommandInfoImpl(name, props, tempThermostatHome.toString()); + + List resources = info.getDependencyResourceNames(); + assertEquals(0, resources.size()); + assertFalse(resources.contains(resolvedJar(missingJarName))); + } + + @Test + public void verifyGetDescription() { + Properties props = new Properties(); + String name = "name"; + String desc = "desc"; + props.put("description", desc); + CommandInfoImpl info = new CommandInfoImpl(name, props, tempThermostatHome.toString()); + + String commandDesc = info.getDescription(); + assertEquals(desc, commandDesc); + } +} diff -r 73c182a706fc -r 486a299ab905 launcher/src/test/java/com/redhat/thermostat/launcher/internal/CommandInfoSourceTest.java --- a/launcher/src/test/java/com/redhat/thermostat/launcher/internal/CommandInfoSourceTest.java Tue Oct 02 17:43:25 2012 -0400 +++ b/launcher/src/test/java/com/redhat/thermostat/launcher/internal/CommandInfoSourceTest.java Tue Oct 02 17:43:37 2012 -0400 @@ -93,7 +93,7 @@ @Test public void testGetCommandInfo() { CommandInfoSource bundles = new CommandInfoSource(tempThermostatHome.toString()); - CommandInfo info = bundles.getCommandInfo("foo"); + CommandInfoImpl info = bundles.getCommandInfo("foo"); assertNotNull(info); assertEquals("foo", info.getName()); } @@ -101,10 +101,10 @@ @Test public void testGetCommandInfos() { CommandInfoSource bundles = new CommandInfoSource(tempThermostatHome.toString()); - Collection infos = bundles.getCommandInfos(); + Collection infos = bundles.getCommandInfos(); assertNotNull(infos); assertEquals(1, infos.size()); - CommandInfo info = infos.iterator().next(); + CommandInfoImpl info = infos.iterator().next(); assertNotNull(info); assertEquals("foo", info.getName()); } diff -r 73c182a706fc -r 486a299ab905 launcher/src/test/java/com/redhat/thermostat/launcher/internal/CommandInfoTest.java --- a/launcher/src/test/java/com/redhat/thermostat/launcher/internal/CommandInfoTest.java Tue Oct 02 17:43:25 2012 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -/* - * Copyright 2012 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * . - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.launcher.internal; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.List; -import java.util.Properties; - -import org.junit.Before; -import org.junit.Test; - -public class CommandInfoTest { - - private Path tempThermostatHome, someJarName1, someJarName2, missingJarName; - - @Before - public void setUp() throws IOException { - tempThermostatHome = Files.createTempDirectory("test"); - tempThermostatHome.toFile().deleteOnExit(); - System.setProperty("THERMOSTAT_HOME", tempThermostatHome.toString()); - - File tempLibs = new File(tempThermostatHome.toFile(), "libs"); - tempLibs.mkdirs(); - tempLibs.deleteOnExit(); - - File someJar1 = new File(tempLibs, "thermostat-osgi-fluff1.jar"); - someJar1.createNewFile(); - someJar1.deleteOnExit(); - someJarName1 = someJar1.toPath(); - - File someJar2 = new File(tempLibs, "thermostat-osgi-fluff2.jar"); - someJar2.createNewFile(); - someJar2.deleteOnExit(); - someJarName2 = someJar2.toPath(); - - File missingJar = new File(tempLibs, "thisjar_noexist.jar"); - missingJarName = missingJar.toPath(); - } - - private String resolvedJar(Path jar) { - return "file:" + jar.toString(); - } - - @Test - public void verifyGetName() { - Properties props = new Properties(); - String name = "name"; - CommandInfo info = new CommandInfo(name, props, ""); - - String commandName = info.getName(); - assertEquals(name, commandName); - } - - @Test - public void verifySingleResource() { - Properties props = new Properties(); - props.setProperty("bundles", someJarName1.getFileName().toString()); - String name = "name"; - CommandInfo info = new CommandInfo(name, props, tempThermostatHome.toString()); - - List resources = info.getDependencyResourceNames(); - assertEquals(1, resources.size()); - assertTrue(resources.contains(resolvedJar(someJarName1))); - } - - @Test - public void verifyMultipleResources() { - Properties props = new Properties(); - props.setProperty("bundles", someJarName1.getFileName() + "," + someJarName2.getFileName()); - String name = "name"; - CommandInfo info = new CommandInfo(name, props, tempThermostatHome.toString()); - - List resources = info.getDependencyResourceNames(); - assertEquals(2, resources.size()); - assertTrue(resources.contains(resolvedJar(someJarName1))); - assertTrue(resources.contains(resolvedJar(someJarName2))); - } - - @Test - public void verifyMissingResource() { - Properties props = new Properties(); - props.setProperty("bundles", missingJarName.getFileName().toString()); - String name = "name"; - CommandInfo info = new CommandInfo(name, props, tempThermostatHome.toString()); - - List resources = info.getDependencyResourceNames(); - assertEquals(0, resources.size()); - assertFalse(resources.contains(resolvedJar(missingJarName))); - } -} diff -r 73c182a706fc -r 486a299ab905 launcher/src/test/java/com/redhat/thermostat/launcher/internal/HelpCommandTest.java --- a/launcher/src/test/java/com/redhat/thermostat/launcher/internal/HelpCommandTest.java Tue Oct 02 17:43:25 2012 -0400 +++ b/launcher/src/test/java/com/redhat/thermostat/launcher/internal/HelpCommandTest.java Tue Oct 02 17:43:37 2012 -0400 @@ -199,15 +199,9 @@ } @Test - public void testDescription() { - HelpCommand cmd = new HelpCommand(); - assertEquals("show help for a given command or help overview", cmd.getDescription()); - } - - @Test public void testUsage() { HelpCommand cmd = new HelpCommand(); - String expected = "show help for a given command or help overview"; + String expected = "thermostat help [command-name]"; assertEquals(expected, cmd.getUsage()); } diff -r 73c182a706fc -r 486a299ab905 tools/src/main/java/com/redhat/thermostat/tools/LocaleResources.java --- a/tools/src/main/java/com/redhat/thermostat/tools/LocaleResources.java Tue Oct 02 17:43:25 2012 -0400 +++ b/tools/src/main/java/com/redhat/thermostat/tools/LocaleResources.java Tue Oct 02 17:43:37 2012 -0400 @@ -42,20 +42,11 @@ VALUE_AND_UNIT, - COMMAND_LIST_VMS_DESCRIPTION, - - COMMAND_SHELL_DESCRIPTION, + COMMAND_VM_STAT_ARGUMENT_CONTINUOUS_DESCRIPTION, - COMMAND_VM_INFO_DESCRIPTION, - - COMMAND_VM_STAT_DESCRIPTION, - COMMAND_VM_STAT_ARGUMENT_CONTINUOUS_DESCRIPTION, - - COMMAND_CONNECT_DESCRIPTION, COMMAND_CONNECT_ALREADY_CONNECTED, COMMAND_CONNECT_FAILED_TO_CONNECT, - - COMMAND_DISCONNECT_DESCRIPTION, + COMMAND_DISCONNECT_NOT_CONNECTED, COMMAND_DISCONNECT_ERROR, diff -r 73c182a706fc -r 486a299ab905 tools/src/main/java/com/redhat/thermostat/tools/cli/ConnectCommand.java --- a/tools/src/main/java/com/redhat/thermostat/tools/cli/ConnectCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/tools/src/main/java/com/redhat/thermostat/tools/cli/ConnectCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -65,7 +65,6 @@ private static final String NAME = "connect"; private static final String USAGE = "connect -d [-u ] [-p ]"; - private static final String DESC = Translate.localize(LocaleResources.COMMAND_CONNECT_DESCRIPTION); private ClientPreferences prefs; @@ -102,11 +101,6 @@ } @Override - public String getDescription() { - return DESC; - } - - @Override public String getUsage() { return USAGE; } diff -r 73c182a706fc -r 486a299ab905 tools/src/main/java/com/redhat/thermostat/tools/cli/DisconnectCommand.java --- a/tools/src/main/java/com/redhat/thermostat/tools/cli/DisconnectCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/tools/src/main/java/com/redhat/thermostat/tools/cli/DisconnectCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -52,8 +52,6 @@ private static final String NAME = "disconnect"; private static final String USAGE = NAME; - private static final String DESC = Translate.localize(LocaleResources.COMMAND_DISCONNECT_DESCRIPTION); - @SuppressWarnings("rawtypes") @Override @@ -79,11 +77,6 @@ } @Override - public String getDescription() { - return DESC; - } - - @Override public String getUsage() { return USAGE; } diff -r 73c182a706fc -r 486a299ab905 tools/src/main/java/com/redhat/thermostat/tools/cli/ListVMsCommand.java --- a/tools/src/main/java/com/redhat/thermostat/tools/cli/ListVMsCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/tools/src/main/java/com/redhat/thermostat/tools/cli/ListVMsCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -50,16 +50,12 @@ import com.redhat.thermostat.common.dao.VmInfoDAO; import com.redhat.thermostat.common.dao.VmRef; import com.redhat.thermostat.common.model.VmInfo; -import com.redhat.thermostat.tools.LocaleResources; -import com.redhat.thermostat.tools.Translate; public class ListVMsCommand extends SimpleCommand { private static final String NAME = "list-vms"; - private static final String DESCRIPTION = Translate.localize(LocaleResources.COMMAND_LIST_VMS_DESCRIPTION); - - private static final String USAGE = DESCRIPTION; + private static final String USAGE = "thermostat list-vms [-d [-u -p ]]"; @Override public void run(CommandContext ctx) throws CommandException { @@ -85,11 +81,6 @@ } @Override - public String getDescription() { - return DESCRIPTION; - } - - @Override public String getUsage() { return USAGE; } diff -r 73c182a706fc -r 486a299ab905 tools/src/main/java/com/redhat/thermostat/tools/cli/ShellCommand.java --- a/tools/src/main/java/com/redhat/thermostat/tools/cli/ShellCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/tools/src/main/java/com/redhat/thermostat/tools/cli/ShellCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -61,8 +61,6 @@ import com.redhat.thermostat.common.config.InvalidConfigurationException; import com.redhat.thermostat.common.utils.LoggingUtils; import com.redhat.thermostat.launcher.Launcher; -import com.redhat.thermostat.tools.LocaleResources; -import com.redhat.thermostat.tools.Translate; public class ShellCommand extends SimpleCommand implements OSGiContext { @@ -72,13 +70,10 @@ private static final String NAME = "shell"; - private static final String DESCRIPTION = Translate.localize(LocaleResources.COMMAND_SHELL_DESCRIPTION); - - private static final String USAGE = DESCRIPTION; + private static final String USAGE = "thermostat shell"; private static final String PROMPT = "Thermostat > "; - //private CommandContext context; private HistoryProvider historyProvider; private BundleContext bundleContext; @@ -179,11 +174,6 @@ } @Override - public String getDescription() { - return DESCRIPTION; - } - - @Override public String getUsage() { return USAGE; } diff -r 73c182a706fc -r 486a299ab905 tools/src/main/java/com/redhat/thermostat/tools/cli/VMInfoCommand.java --- a/tools/src/main/java/com/redhat/thermostat/tools/cli/VMInfoCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/tools/src/main/java/com/redhat/thermostat/tools/cli/VMInfoCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -60,8 +60,7 @@ public class VMInfoCommand extends SimpleCommand { private static final String NAME = "vm-info"; - private static final String DESCRIPTION = Translate.localize(LocaleResources.COMMAND_VM_INFO_DESCRIPTION); - + private static final String USAGE = "thermostat vm-info [--vmId ] [--hostId ]"; private static final String STILL_ALIVE = Translate.localize(LocaleResources.VM_STOP_TIME_RUNNING); @Override @@ -118,13 +117,8 @@ } @Override - public String getDescription() { - return DESCRIPTION; - } - - @Override public String getUsage() { - return DESCRIPTION; + return USAGE; } @Override diff -r 73c182a706fc -r 486a299ab905 tools/src/main/java/com/redhat/thermostat/tools/cli/VMStatCommand.java --- a/tools/src/main/java/com/redhat/thermostat/tools/cli/VMStatCommand.java Tue Oct 02 17:43:25 2012 -0400 +++ b/tools/src/main/java/com/redhat/thermostat/tools/cli/VMStatCommand.java Tue Oct 02 17:43:37 2012 -0400 @@ -63,7 +63,7 @@ private static final Logger log = Logger.getLogger(VMStatCommand.class.getName()); private static final String CMD_NAME = "vm-stat"; - private static final String CMD_DESCRIPTION = Translate.localize(LocaleResources.COMMAND_VM_STAT_DESCRIPTION); + private static final String USAGE = "thermostat vm-stat --hostId --vmId "; @Override public void run(final CommandContext ctx) throws CommandException { @@ -123,13 +123,8 @@ } @Override - public String getDescription() { - return CMD_DESCRIPTION; - } - - @Override public String getUsage() { - return CMD_DESCRIPTION; + return USAGE; } @Override diff -r 73c182a706fc -r 486a299ab905 tools/src/main/resources/com/redhat/thermostat/tools/strings.properties --- a/tools/src/main/resources/com/redhat/thermostat/tools/strings.properties Tue Oct 02 17:43:25 2012 -0400 +++ b/tools/src/main/resources/com/redhat/thermostat/tools/strings.properties Tue Oct 02 17:43:37 2012 -0400 @@ -2,20 +2,11 @@ VALUE_AND_UNIT = {0} {1} -COMMAND_LIST_VMS_DESCRIPTION = lists all currently monitored VMs - -COMMAND_SHELL_DESCRIPTION = launches the Thermostat interactive shell - -COMMAND_VM_INFO_DESCRIPTION = shows basic information about a VM - -COMMAND_VM_STAT_DESCRIPTION = show various statistics about a VM COMMAND_VM_STAT_ARGUMENT_CONTINUOUS_DESCRIPTION = print data continuously -COMMAND_CONNECT_DESCRIPTION = persistenly connect to a database COMMAND_CONNECT_ALREADY_CONNECTED = Already connected to storage. Please use disconnect command to disconnect. COMMAND_CONNECT_FAILED_TO_CONNECT = Could not connect to db {0} -COMMAND_DISCONNECT_DESCRIPTION = disconnect from the currently used database COMMAND_DISCONNECT_NOT_CONNECTED = Not connected to storage. You may use the connect command for establishing connections. COMMAND_DISCONNECT_ERROR = Failed to disconnect from database. diff -r 73c182a706fc -r 486a299ab905 tools/src/test/java/com/redhat/thermostat/tools/cli/ConnectCommandTest.java --- a/tools/src/test/java/com/redhat/thermostat/tools/cli/ConnectCommandTest.java Tue Oct 02 17:43:25 2012 -0400 +++ b/tools/src/test/java/com/redhat/thermostat/tools/cli/ConnectCommandTest.java Tue Oct 02 17:43:37 2012 -0400 @@ -163,11 +163,6 @@ } @Test - public void testDescription() { - assertEquals("persistenly connect to a database", cmd.getDescription()); - } - - @Test public void testUsage() { String expected = "connect -d [-u ] [-p ]"; diff -r 73c182a706fc -r 486a299ab905 tools/src/test/java/com/redhat/thermostat/tools/cli/DisconnectCommandTest.java --- a/tools/src/test/java/com/redhat/thermostat/tools/cli/DisconnectCommandTest.java Tue Oct 02 17:43:25 2012 -0400 +++ b/tools/src/test/java/com/redhat/thermostat/tools/cli/DisconnectCommandTest.java Tue Oct 02 17:43:37 2012 -0400 @@ -152,11 +152,6 @@ } @Test - public void testDescription() { - assertEquals("disconnect from the currently used database", cmd.getDescription()); - } - - @Test public void testUsage() { String expected = "disconnect"; assertEquals(expected, cmd.getUsage()); diff -r 73c182a706fc -r 486a299ab905 tools/src/test/java/com/redhat/thermostat/tools/cli/ListVMsCommandTest.java --- a/tools/src/test/java/com/redhat/thermostat/tools/cli/ListVMsCommandTest.java Tue Oct 02 17:43:25 2012 -0400 +++ b/tools/src/test/java/com/redhat/thermostat/tools/cli/ListVMsCommandTest.java Tue Oct 02 17:43:37 2012 -0400 @@ -161,13 +161,8 @@ } @Test - public void testDescription() { - assertEquals("lists all currently monitored VMs", cmd.getDescription()); - } - - @Test public void testUsage() { - String expected = "lists all currently monitored VMs"; + String expected = "thermostat list-vms [-d [-u -p ]]"; assertEquals(expected, cmd.getUsage()); } diff -r 73c182a706fc -r 486a299ab905 tools/src/test/java/com/redhat/thermostat/tools/cli/ShellCommandTest.java --- a/tools/src/test/java/com/redhat/thermostat/tools/cli/ShellCommandTest.java Tue Oct 02 17:43:25 2012 -0400 +++ b/tools/src/test/java/com/redhat/thermostat/tools/cli/ShellCommandTest.java Tue Oct 02 17:43:37 2012 -0400 @@ -234,13 +234,8 @@ } @Test - public void testDescription() { - assertEquals("launches the Thermostat interactive shell", cmd.getDescription()); - } - - @Test public void testUsage() { - assertEquals("launches the Thermostat interactive shell", cmd.getUsage()); + assertEquals("thermostat shell", cmd.getUsage()); } @Test diff -r 73c182a706fc -r 486a299ab905 tools/src/test/java/com/redhat/thermostat/tools/cli/VMInfoCommandTest.java --- a/tools/src/test/java/com/redhat/thermostat/tools/cli/VMInfoCommandTest.java Tue Oct 02 17:43:25 2012 -0400 +++ b/tools/src/test/java/com/redhat/thermostat/tools/cli/VMInfoCommandTest.java Tue Oct 02 17:43:37 2012 -0400 @@ -184,11 +184,6 @@ assertEquals("vm-info", cmd.getName()); } - @Test - public void testDescription() { - assertEquals("shows basic information about a VM", cmd.getDescription()); - } - @Bug(id="1046", summary="CLI vm-info display wrong stop time for living vms", url="http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1046") @@ -216,7 +211,7 @@ @Test public void testUsage() { - String expected = "shows basic information about a VM"; + String expected = "thermostat vm-info [--vmId ] [--hostId ]"; assertEquals(expected, cmd.getUsage()); } diff -r 73c182a706fc -r 486a299ab905 tools/src/test/java/com/redhat/thermostat/tools/cli/VmStatCommandTest.java --- a/tools/src/test/java/com/redhat/thermostat/tools/cli/VmStatCommandTest.java Tue Oct 02 17:43:25 2012 -0400 +++ b/tools/src/test/java/com/redhat/thermostat/tools/cli/VmStatCommandTest.java Tue Oct 02 17:43:37 2012 -0400 @@ -296,13 +296,8 @@ } @Test - public void testDescription() { - assertEquals("show various statistics about a VM", cmd.getDescription()); - } - - @Test public void testUsage() { - assertEquals("show various statistics about a VM", cmd.getUsage()); + assertEquals("thermostat vm-stat --hostId --vmId ", cmd.getUsage()); } @Test