changeset 323:1538ecbaa660

Merge
author Roman Kennke <rkennke@redhat.com>
date Tue, 22 May 2012 17:54:17 +0200
parents 37659cac5fd4 (current diff) b0e9497f405a (diff)
children fc2afcd3ba63
files agent/src/main/java/com/redhat/thermostat/agent/AgentApplication.java common/pom.xml common/src/main/java/com/redhat/thermostat/test/TestCommandContextFactory.java common/src/main/resources/com/redhat/thermostat/app-info.properties tools/src/main/java/com/redhat/thermostat/tools/cli/ShellCommand.java tools/src/test/java/com/redhat/thermostat/tools/cli/ShellCommandTest.java
diffstat 12 files changed, 49 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/README	Tue May 22 17:51:02 2012 +0200
+++ b/README	Tue May 22 17:54:17 2012 +0200
@@ -2,10 +2,14 @@
 
 REQUIREMENTS:
 
+OpenJDK7
+Thermostat requires at least Java 7 to build and run. Thermostat has been tested
+with OpenJDK7. Other VMs or versons may or may not work.
+
 Maven (it will download all the java dependencies for you)
 
-MongoDB
-http://www.mongodb.org/
+MongoDB server
+Thermostat requires mongodb (http://www.mongodb.org/) server >= 2.0.0
 
 Either a /etc/os-release file or lsb_release
 
@@ -21,5 +25,8 @@
 1. To start the agent and the db:
    bin/thermostat service --start
 
-2. To start the client:
+2. To start the gui client:
    bin/thermostat-client-gui
+
+3. To start the cli client:
+   bin/thermostat [--help]
--- a/agent/src/main/java/com/redhat/thermostat/agent/AgentApplication.java	Tue May 22 17:51:02 2012 +0200
+++ b/agent/src/main/java/com/redhat/thermostat/agent/AgentApplication.java	Tue May 22 17:54:17 2012 +0200
@@ -152,6 +152,7 @@
         logger.fine("Agent started.");
 
         ctx.getConsole().getOutput().println("Agent id: " + agent.getId());
+        ctx.getConsole().getOutput().println("agent started.");
         logger.fine("Agent id: " + agent.getId());
         
         try {
--- a/client/core/pom.xml	Tue May 22 17:51:02 2012 +0200
+++ b/client/core/pom.xml	Tue May 22 17:54:17 2012 +0200
@@ -107,6 +107,14 @@
   </dependencies>
 
   <build>
+
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+
     <plugins>
       <plugin>
         <groupId>org.apache.felix</groupId>
--- a/client/core/src/main/java/com/redhat/thermostat/client/ApplicationInfo.java	Tue May 22 17:51:02 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ApplicationInfo.java	Tue May 22 17:54:17 2012 +0200
@@ -55,14 +55,12 @@
 
     private static final Logger logger = LoggingUtils.getLogger(ApplicationInfo.class);
 
-    private static final String APP_INFO_ROOT = "com/redhat/thermostat/";
-
     private Properties appInfo;
 
     public ApplicationInfo() {
         appInfo = new Properties();
-        ClassLoader cl = this.getClass().getClassLoader();
-        InputStream res = cl.getResourceAsStream(APP_INFO_ROOT + "app-info.properties");
+        // the properties file should be in the same package as this class
+        InputStream res = getClass().getResourceAsStream("app-info.properties");
         if (res != null) {
             try {
                 appInfo.load(res);
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/VmGcPanel.java	Tue May 22 17:51:02 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/VmGcPanel.java	Tue May 22 17:54:17 2012 +0200
@@ -147,6 +147,7 @@
                 subPanels.put(tag, subPanel);
                 add(subPanel, gcPanelConstraints);
                 gcPanelConstraints.gridy++;
+                revalidate();
             }
         });
     }
@@ -159,7 +160,7 @@
                 dataset.remove(tag);
                 JPanel subPanel = subPanels.remove(tag);
                 remove(subPanel);
-                invalidate();
+                revalidate();
                 gcPanelConstraints.gridy--;
             }
         });
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/core/src/main/resources/com/redhat/thermostat/client/app-info.properties	Tue May 22 17:54:17 2012 +0200
@@ -0,0 +1,7 @@
+APP_NAME = Thermostat
+APP_VERSION = ${project.version}
+APP_RELEASE_DATE = ${thermostat.releasedate}
+APP_EMAIL = ${thermostat.email}
+APP_WEBSITE = ${thermostat.url}
+APP_COPYRIGHT = Copyright 2012 Red Hat, Inc.
+
--- a/common/pom.xml	Tue May 22 17:51:02 2012 +0200
+++ b/common/pom.xml	Tue May 22 17:54:17 2012 +0200
@@ -52,13 +52,6 @@
   <url>${project.parent.url}</url>
 
   <build>
-    <resources>
-      <resource>
-        <directory>src/main/resources</directory>
-        <filtering>true</filtering>
-      </resource>
-    </resources>
-
     <plugins>
       <plugin>
         <groupId>org.apache.felix</groupId>
--- a/common/src/main/java/com/redhat/thermostat/test/TestCommandContextFactory.java	Tue May 22 17:51:02 2012 +0200
+++ b/common/src/main/java/com/redhat/thermostat/test/TestCommandContextFactory.java	Tue May 22 17:54:17 2012 +0200
@@ -146,7 +146,7 @@
         in.setInput(input);
     }
 
-    public Object getError() {
+    public String getError() {
         return new String(err.toByteArray());
     }
 
--- a/common/src/main/resources/com/redhat/thermostat/app-info.properties	Tue May 22 17:51:02 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-APP_NAME = Thermostat
-APP_VERSION = ${project.version}
-APP_RELEASE_DATE = ${thermostat.releasedate}
-APP_EMAIL = ${thermostat.email}
-APP_WEBSITE = ${project.url}
-APP_COPYRIGHT = Copyright 2012 Red Hat, Inc.
-
--- a/pom.xml	Tue May 22 17:51:02 2012 +0200
+++ b/pom.xml	Tue May 22 17:54:17 2012 +0200
@@ -45,12 +45,13 @@
   <packaging>pom</packaging>
 
   <name>Thermostat</name>
-  <url>http://icedtea.classpath.org/thermostat/</url>
+  <url>${thermostat.url}</url>
 
   <properties>
     <maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format>
     <thermostat.releasedate>${maven.build.timestamp}</thermostat.releasedate>
     <thermostat.email>thermostat@icedtea.classpath.org</thermostat.email>
+    <thermostat.url>http://icedtea.classpath.org/thermostat/</thermostat.url>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <thermostat.build.directory>target</thermostat.build.directory>
     <thermostat.java.version>1.7</thermostat.java.version>
--- a/tools/src/main/java/com/redhat/thermostat/tools/cli/ShellCommand.java	Tue May 22 17:51:02 2012 +0200
+++ b/tools/src/main/java/com/redhat/thermostat/tools/cli/ShellCommand.java	Tue May 22 17:54:17 2012 +0200
@@ -93,7 +93,11 @@
     }
 
     private boolean handleConsoleInput(ConsoleReader reader) throws IOException, CommandException {
-        String line = reader.readLine(PROMPT).trim();
+        String line = reader.readLine(PROMPT);
+        if (line == null) {
+            return false;
+        }
+        line = line.trim();
         if (line.equals("")) {
             return true;
         } else if (line.equals("exit")) {
--- a/tools/src/test/java/com/redhat/thermostat/tools/cli/ShellCommandTest.java	Tue May 22 17:51:02 2012 +0200
+++ b/tools/src/test/java/com/redhat/thermostat/tools/cli/ShellCommandTest.java	Tue May 22 17:54:17 2012 +0200
@@ -95,6 +95,17 @@
     }
 
     @Test
+    public void testEofExits() throws CommandException {
+        TestCommandContextFactory ctxFactory = new TestCommandContextFactory();
+        ctxFactory.setInput("\u0004"); // EOF
+        Arguments args = new SimpleArguments();
+        CommandContext ctx = ctxFactory.createContext(args);
+        cmd.run(ctx);
+        assertEquals("Thermostat > ", ctxFactory.getOutput());
+        assertEquals("", ctxFactory.getError());
+    }
+
+    @Test
     public void testDoNothingWithoutInput() throws CommandException {
         TestCommandContextFactory ctxFactory = new TestCommandContextFactory();
         ctxFactory.setInput("\nexit\n");