changeset 171:1d7ab9111fd2

- added tests ported to the new framework (package org.thermostat.qa2.tests) - added/updated required targets in Makefile - new info about dependecies added to README.md - authorization and error checking code added to mongo js scripts - done necessary changes to reporter, so it can be used with new framework - updated keyrings - added required pattern (for gui tests)
author Zdenek Zambersky <zzambers@redhat.com>
date Tue, 10 Mar 2015 13:48:12 +0100
parents 0d34a379de82
children 661ca2d7795f
files Makefile README.md patterns/1.1.0/noAA/ClientPreferencesDialog/ok_button3.png scripts/check-collections-heap-dump.js scripts/check-collections-smoke.js src/org/thermostat/qa/reporter/HistoryPagesGenerator.java src/org/thermostat/qa/reporter/LogPagesGenerator.java src/org/thermostat/qa2/tests/AgentTest.java src/org/thermostat/qa2/tests/AgentWebStorageTest.java src/org/thermostat/qa2/tests/CliClientDBModifWebStorageTest.java src/org/thermostat/qa2/tests/CliClientDBModificationsSmokeTest.java src/org/thermostat/qa2/tests/CliClientSmokeTest.java src/org/thermostat/qa2/tests/CommandChannelSmokeTest.java src/org/thermostat/qa2/tests/CommandChannelWebStorageTest.java src/org/thermostat/qa2/tests/DBCommandsHeapDumpTest.java src/org/thermostat/qa2/tests/DBGuiHeapDumpTest.java src/org/thermostat/qa2/tests/DBSchemeSmokeTest.java src/org/thermostat/qa2/tests/GuiClientDBModifWebStorageTest.java src/org/thermostat/qa2/tests/GuiClientDBModificationsSmokeTest.java src/org/thermostat/qa2/tests/GuiClientSmokeTest.java src/org/thermostat/qa2/tests/GuiClientWebStorageTest.java src/org/thermostat/qa2/tests/GuiHostViewSmokeTest.java src/org/thermostat/qa2/tests/OutputMessagesTest.java src/org/thermostat/qa2/tests/ServicesSmokeTest.java src/org/thermostat/qa2/tests/SmokeTests.java src/org/thermostat/qa2/tests/StorageSmokeTest.java src/org/thermostat/qa2/tests/compatibility/DBCompatibilityTest.java storageconfig/keyrings/Default.keyring
diffstat 28 files changed, 2487 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Tue Mar 10 13:38:36 2015 +0100
+++ b/Makefile	Tue Mar 10 13:48:12 2015 +0100
@@ -4,7 +4,7 @@
 # 
 
 SOURCE_DIR=src
-BUILD_DIR=bin
+BUILD_DIR=$(shell realpath -m bin)
 CLASSES_DIR=$(BUILD_DIR)/classes
 CLASSES_TEMP_DIR=$(BUILD_DIR)/.classes
 REPORT_DIR=reports
@@ -24,7 +24,7 @@
 COMMON_PACKAGE=$(ROOT_PACKAGE)/common
 FRAMEWORK_PACKAGE=$(ROOT_PACKAGE)/framework
 REPORTER_PACKAGE=$(ROOT_PACKAGE)/reporter
-TEST_PACKAGE=$(ROOT_PACKAGE)/testsuites
+TEST_PACKAGE=org/thermostat/qa2/tests
 
 FLOTR_NAME=prototype.flotr-0.2.0-alpha
 FLOTR_ARCHIVE=$(FLOTR_NAME).zip
@@ -32,7 +32,7 @@
 FLOTR_DIR=$(BUILD_DIR)/flotr
 FLOTR_LIB_DIR=$(FLOTR_DIR)/lib
 
-TOMCAT_VERSION=7.0.56
+TOMCAT_VERSION=7.0.59
 TOMCAT_NAME=apache-tomcat-$(TOMCAT_VERSION)
 TOMCAT_ARCHIVE=$(TOMCAT_NAME).tar.gz
 TOMCAT_URL=http://apache.mirror.rafal.ca/tomcat/tomcat-$(shell echo "$(TOMCAT_VERSION)" | sed 's/\..*//g' )/v$(TOMCAT_VERSION)/bin/$(TOMCAT_ARCHIVE)
@@ -44,7 +44,7 @@
 THERMOSTAT_DIR=$(BUILD_DIR)/thermostat
 THERMOSTAT_WEB_DEPLOY_DIR=$(TOMCAT_DIR)/webapps/thermostat
 
-SCREENSHOT_SOURCE=robot
+SCREENSHOT_SOURCE=xvfb
 
 GNOME_KEYRING_USER_DATA_DIR=$(shell realpath -m "$(BUILD_DIR)/.gnome-keyring" )
 
@@ -58,7 +58,7 @@
 ALL_SOURCES = $(shell find src -name *.java | tr '\n' ' ')
 
 # all testsuites ( in $(SOURCE_DIR)/$(TEST_PACKAGE) package )
-TESTS = $(shell ls -1 $(SOURCE_DIR)/$(TEST_PACKAGE) | sed -n -e 's/\([A-Za-z0-9]*\)\.java/\1/p')
+TESTS = $(shell ls -1 $(SOURCE_DIR)/$(TEST_PACKAGE) | grep -v package-info.java | sed -n -e 's/\([A-Za-z0-9]*\)\.java/\1/p')
 
 
 .PHONY: all
@@ -104,24 +104,13 @@
 .PHONY: runtests
 runtests:	$(TESTS)
 
-$(TESTS): build tomcat thermostat testwarning | $(GNOME_KEYRING_USER_DATA_DIR)
+$(TESTS): build tomcat thermostat-build testwarning checkdeps $(THERMOSTAT_WEB_DEPLOY_DIR) | $(GNOME_KEYRING_USER_DATA_DIR)
+	killall mongod &> /dev/null || true
+	killall gnome-keyring-daemon &> /dev/null || true
+	mkdir -p $(BUILD_DIR)/backup
 	mkdir -p $(SCREENSHOTS_DIR)
 	mkdir -p $(LOGS_DIR)
 	mkdir -p $(LOGS_DIR)/$(DATE)
-	# stop mongo database if running
-	killall mongod || true
-	# copy storage config files
-	cp storageconfig/$(THERMOSTAT_VERSION)/db-mongodb/agent.auth \
-	$(THERMOSTAT_USER_DIR)/etc/
-	cp storageconfig/$(THERMOSTAT_VERSION)/db-mongodb/agent.properties \
-	$(THERMOSTAT_USER_DIR)/etc/
-	cp storageconfig/$(THERMOSTAT_VERSION)/db-mongodb/client.properties \
-	$(THERMOSTAT_USER_DIR)/etc/
-	# (re)start gnome-keyring-daemon with custom configuration
-	killall gnome-keyring-daemon || true
-	export XDG_DATA_HOME="$(GNOME_KEYRING_USER_DATA_DIR)" ;	\
-	gnome-keyring-daemon --start --components=secrets
-	# start test with overwriten USER_THERMOSTAT_HOME and required parameters
 	USER_THERMOSTAT_HOME=$(THERMOSTAT_USER_DIR) \
 	$(JAVA) -cp $(CLASSES_DIR) \
 	-Dtomcat.home=$(TOMCAT_DIR) \
@@ -131,11 +120,10 @@
 	-Dthermostat.executable.path=$(THERMOSTAT_DIR)/distribution/target/image/bin \
 	-Dthermostat.version=$(THERMOSTAT_VERSION) \
 	-Dscreenshot.source=$(SCREENSHOT_SOURCE) \
-	-Dclean.after.gui.test=true \
-	$(TEST_PACKAGE).$@ 2>&1 | tee $(LOGS_DIR)/$(DATE)/$@.log
-	# stop gnome-keyring-daemon with custom config after test
-	killall gnome-keyring-daemon; 
-	
+	-Dclean.after.gui.test=true	\
+	-Dgnome-keyring.config.path=$(GNOME_KEYRING_USER_DATA_DIR) \
+	-Dbackup.path=$(BUILD_DIR)/backup \
+	org.thermostat.qa2.framework.TestRunner org.thermostat.qa2.tests.$@ 2>&1 | tee $(LOGS_DIR)/$(DATE)/$@.log
 
 .PHONY: testwarning
 testwarning:
@@ -171,6 +159,13 @@
 	fi ; \
 	true
 
+.PHONY: checkdeps
+checkdeps:
+	@which netstat &> /dev/null || { echo "netstat required by testsuite is missing please install it" ; false ; }
+	@which xdotool &> /dev/null || { echo "xdotool required by testsuite is missing please install it" ; false ; }
+	@which gnome-keyring-daemon &> /dev/null || { echo "gnome-keyring-daemon required by testsuite is missing please install it" ; false ; }
+	@which import &> /dev/null || { echo "import (ImageMagick) required by testsuite is missing please install it" ; false ; }
+
 .PHONY: listtests
 listtests:
 	for tst in $(TESTS); do \
@@ -179,7 +174,7 @@
 
 #### reports & javadoc ####
 	
-report:	$(ALL_CLASSES) flotr javadoc
+report:	$(CLASSES_DIR) flotr javadoc
 	mkdir -p $(REPORT_DIR)
 	cp -u $(TEMPLATE_DIR)/style.css $(REPORT_DIR)/style.css
 	cp -r $(FLOTR_DIR) $(REPORT_DIR)
--- a/README.md	Tue Mar 10 13:38:36 2015 +0100
+++ b/README.md	Tue Mar 10 13:48:12 2015 +0100
@@ -10,6 +10,8 @@
 
 gnome-keyring
 mongodb
+xdotool
+import (ImageMagick)
 lynx
 
 Running
Binary file patterns/1.1.0/noAA/ClientPreferencesDialog/ok_button3.png has changed
--- a/scripts/check-collections-heap-dump.js	Tue Mar 10 13:38:36 2015 +0100
+++ b/scripts/check-collections-heap-dump.js	Tue Mar 10 13:48:12 2015 +0100
@@ -6,6 +6,7 @@
 {
     // get the thermostat db
     db = db.getMongo().getDB( "thermostat" );
+    db.auth("mongodevuser","mongodevpassword");
 
     // initialize the arrays of collection field names + types
     fity = {
@@ -174,6 +175,7 @@
         // example:
         //   record.startTime.tojson() == 'NumberLong("1391084711073")'
         var record = mappedCollection(y).findOne();
+        try {
         var fieldsTypes = fity[y];
         if(debug) printjson(fieldsTypes);
         for(var i=0; i<fieldsTypes.length; i++)
@@ -183,7 +185,9 @@
            schemaPass = checkOneField(record, fieldsTypes[i][0], fieldsTypes[i][1]);
            wholeSchemaPass = wholeSchemaPass && schemaPass;
         }
-
+        } catch(err) {
+        	wholeSchemaPass = false;
+        }
         var isPass = wholeSchemaPass ? "OK" : "BAD";
         print("schema for " + y + " is " + isPass );
         return wholeSchemaPass;
--- a/scripts/check-collections-smoke.js	Tue Mar 10 13:38:36 2015 +0100
+++ b/scripts/check-collections-smoke.js	Tue Mar 10 13:48:12 2015 +0100
@@ -6,6 +6,7 @@
 {
     // get the thermostat db
     db = db.getMongo().getDB( "thermostat" );
+    db.auth("mongodevuser","mongodevpassword");
 
     // initialize the arrays of collection field names + types
     fity = { "agent-config" : 
@@ -163,6 +164,7 @@
         // example:
         //   record.startTime.tojson() == 'NumberLong("1391084711073")'
         var record = mappedCollection(y).findOne();
+        try { 
         var fieldsTypes = fity[y];
         if(debug) printjson(fieldsTypes);
         for(var i=0; i<fieldsTypes.length; i++)
@@ -172,7 +174,9 @@
            schemaPass = checkOneField(record, fieldsTypes[i][0], fieldsTypes[i][1]);
            wholeSchemaPass = wholeSchemaPass && schemaPass;
         }
-
+        } catch(err) {
+        wholeSchemaPass = false;
+        }
         var isPass = wholeSchemaPass ? "OK" : "BAD";
         print("schema for " + y + " is " + isPass );
         return wholeSchemaPass;
--- a/src/org/thermostat/qa/reporter/HistoryPagesGenerator.java	Tue Mar 10 13:38:36 2015 +0100
+++ b/src/org/thermostat/qa/reporter/HistoryPagesGenerator.java	Tue Mar 10 13:48:12 2015 +0100
@@ -307,7 +307,7 @@
 
     private static TestStatus getTestStatus(String testName, String date, Map<String, Map<String, List<String>>> testResults)
     {
-        String simpleName = date + "/" + testName.substring("org.thermostat.qa.testsuites.".length(), testName.lastIndexOf('.')) + ".log";
+        String simpleName = date + "/" + testName.substring("org.thermostat.qa2.tests.".length(), testName.lastIndexOf('.')) + ".log";
         for (Map.Entry<String, List<String>> test : testResults.get(date).entrySet())
         {
             if (test.getKey().endsWith(simpleName))
--- a/src/org/thermostat/qa/reporter/LogPagesGenerator.java	Tue Mar 10 13:38:36 2015 +0100
+++ b/src/org/thermostat/qa/reporter/LogPagesGenerator.java	Tue Mar 10 13:48:12 2015 +0100
@@ -49,7 +49,7 @@
  */
 public class LogPagesGenerator implements CommonGenerator
 {
-    private static final int TEST_NAME_PREFIX_LENGTH = "org.thermostat.qa.testsuites.".length();
+    private static final int TEST_NAME_PREFIX_LENGTH = "org.thermostat.qa2.tests.".length();
 
     /**
      * 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/AgentTest.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,58 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests;
+
+import static org.thermostat.qa2.framework.Assert.*;
+import org.thermostat.qa2.framework.annotations.*;
+import org.thermostat.qa2.framework.services.ThermostatAgent;
+
+/**
+ * Test class ported from old framework
+ * @author Zdeněk Žamberský
+ */
+@SetupStorage(type = "mongo")
+public class AgentTest {
+
+    @Test
+    public void withoutStorage() throws Exception {
+        ThermostatAgent agent = new ThermostatAgent();
+        assertFailsToStartAndRun(agent, "Agent should not run without storage");
+    }
+
+    @Test
+    @RunStorage
+    public void withStorage() throws Exception {
+        ThermostatAgent agent = new ThermostatAgent();
+        agent.start();
+        assertRuns(agent, "Agent should be running");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/AgentWebStorageTest.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,190 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import static org.thermostat.qa2.framework.Assert.*;
+import org.thermostat.qa2.framework.ThermostatQAConfig;
+import org.thermostat.qa2.framework.annotations.SetupStorage;
+import org.thermostat.qa2.framework.annotations.Test;
+import org.thermostat.qa2.framework.services.ThermostatAgent;
+import org.thermostat.qa2.framework.services.ThermostatStorage;
+import org.thermostat.qa2.framework.services.Tomcat;
+import org.thermostat.qa2.framework.utils.CommonUtilities;
+import org.thermostat.qa2.framework.utils.FileUtilities;
+
+/**
+ * Test class ported from old framework
+ * @author Zdeněk Žamberský
+ */
+@SetupStorage(type = "web")
+public class AgentWebStorageTest {
+
+    public static final String[] THERM_AGENT_WITH_TOMCAT_ONLY_THERMOSTAT_LOGS = new String[]{
+        "com.mongodb.MongoException.Network:",
+        //"com.mongodb.MongoException.Network: Read operation to server /127.0.0.1:27518 failed on database thermostat",
+        "java.net.ConnectException: Connection refused"
+    };
+    public static final String[] THERM_AGENT_WITH_TOMCAT_ONLY_CATALINA_LOGS = new String[]{
+        "WebStorageEndPoint: Initializing web service",
+        "WebStorageEndPoint: THERMOSTAT_HOME == " + ThermostatQAConfig.getThermostatHome("tested"),
+        "WARNING - MongoConnection: Failed to connect to storage",
+        "com.mongodb.MongoException.Network:",
+        //"com.mongodb.MongoException.Network: Read operation to server /127.0.0.1:27518 failed on database thermostat",
+        "java.net.ConnectException: Connection refused"
+    };
+
+    public static final String[] THERM_AGENT_WITH_WEB_STORAGE_THERMOSTAT_LOGS = new String[]{
+        "WebStorageEndPoint: Initializing web service",
+        "WebStorageEndPoint: THERMOSTAT_HOME == " + ThermostatQAConfig.getThermostatHome("tested"),
+        "MongoConnection: Using plain socket for mongodb://",
+        "WebStorageEndPoint: (id: 0) registered non-aggreate category:" //
+    //  "WebStorageEndPoint: (id: 0) registered non-aggreate category: vm-cpu-stats|com.redhat.thermostat.vm.cpu.common.model.VmCpuStat|{timeStamp=Key: timeStamp, agentId=Key: agentId, vmId=Key: vmId, cpuLoad=Key: cpuLoad}",
+    //  "WebStorageEndPoint: (id: 1) registered non-aggreate category: vm-heap-info|com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo|{timeStamp=Key: timeStamp, agentId=Key: agentId, vmId=Key: vmId, heapId=Key: heapId, heapDumpId=Key: heapDumpId, histogramId=Key: histogramId}",
+    //  "WebStorageEndPoint: (id: 2) registered non-aggreate category: vm-gc-stats|com.redhat.thermostat.vm.gc.common.model.VmGcStat|{runCount=Key: runCount, timeStamp=Key: timeStamp, agentId=Key: agentId, vmId=Key: vmId, wallTime=Key: wallTime, collectorName=Key: collectorName}",
+    //  "WebStorageEndPoint: (id: 3) registered non-aggreate category: vm-memory-stats|com.redhat.thermostat.vm.memory.common.model.VmMemoryStat|{timeStamp=Key: timeStamp, generations=Key: generations, agentId=Key: agentId, vmId=Key: vmId}",
+    //  "WebStorageEndPoint: (id: 4) registered non-aggreate category: numa-stat|com.redhat.thermostat.numa.common.NumaStat|{nodeStats=Key: nodeStats, timeStamp=Key: timeStamp, agentId=Key: agentId}",
+    //  "WebStorageEndPoint: (id: 5) registered non-aggreate category: numa-host-info|com.redhat.thermostat.numa.common.NumaHostInfo|{agentId=Key: agentId, hostNumNumaNodes=Key: hostNumNumaNodes}",
+    //  "WebStorageEndPoint: (id: 6) registered non-aggreate category: memory-stats|com.redhat.thermostat.host.memory.common.model.MemoryStat|{total=Key: total, cached=Key: cached, free=Key: free, timeStamp=Key: timeStamp, swapFree=Key: swapFree, swapTotal=Key: swapTotal, buffers=Key: buffers, agentId=Key: agentId, commitLimit=Key: commitLimit}"
+    };
+
+    public static final String[] THERM_AGENT_WITH_WEB_STORAGE_CATALINA_LOGS = new String[]{
+        "INFO: Deploying web application directory",
+        "/webapps/thermostat",
+        "WebStorageEndPoint: Initializing web service",
+        "WebStorageEndPoint: THERMOSTAT_HOME == " + ThermostatQAConfig.getThermostatHome("tested"),
+        "MongoConnection: Using plain socket for mongodb://",
+        "WebStorageEndPoint: (id: 0) registered non-aggreate category:" //
+    //  "WebStorageEndPoint: (id: 0) registered non-aggreate category: vm-cpu-stats|com.redhat.thermostat.vm.cpu.common.model.VmCpuStat|{timeStamp=Key: timeStamp, agentId=Key: agentId, vmId=Key: vmId, cpuLoad=Key: cpuLoad}",
+    //  "WebStorageEndPoint: (id: 1) registered non-aggreate category: vm-heap-info|com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo|{timeStamp=Key: timeStamp, agentId=Key: agentId, vmId=Key: vmId, heapId=Key: heapId, heapDumpId=Key: heapDumpId, histogramId=Key: histogramId}",
+    //  "WebStorageEndPoint: (id: 2) registered non-aggreate category: vm-gc-stats|com.redhat.thermostat.vm.gc.common.model.VmGcStat|{runCount=Key: runCount, timeStamp=Key: timeStamp, agentId=Key: agentId, vmId=Key: vmId, wallTime=Key: wallTime, collectorName=Key: collectorName}",
+    //  "WebStorageEndPoint: (id: 3) registered non-aggreate category: vm-memory-stats|com.redhat.thermostat.vm.memory.common.model.VmMemoryStat|{timeStamp=Key: timeStamp, generations=Key: generations, agentId=Key: agentId, vmId=Key: vmId}",
+    //  "WebStorageEndPoint: (id: 4) registered non-aggreate category: numa-stat|com.redhat.thermostat.numa.common.NumaStat|{nodeStats=Key: nodeStats, timeStamp=Key: timeStamp, agentId=Key: agentId}"
+    };
+
+    public static final String[] THERM_AGENT_BAD_LOGIN_CATALINA_LOGS = new String[]{
+        "WARNING: Login exception authenticating username \"doctor-evil\"",
+        "javax.security.auth.login.LoginException: User 'doctor-evil' not found"
+    };
+
+    public static final String logsPath = ThermostatQAConfig.tomcatHome + File.separator + "logs";
+
+    public static List<String> getLineListFromLogFiles(final String namePattern) throws IOException {
+        ArrayList<String> lines = new ArrayList();
+        File logsDir = new File(logsPath);
+        String[] files = logsDir.list(new FilenameFilter() {
+
+            @Override
+            public boolean accept(File dir, String name) {
+                return name.contains(namePattern);
+            }
+        });
+        for (String file : files) {
+            FileUtilities.addLinesFromFileToList(lines, logsDir.getPath() + File.separator + file);
+        }
+        return lines;
+    }
+
+    public static void checkForPatterns(String namePattern, String[] patterns) throws IOException {
+        List<String> list = getLineListFromLogFiles(namePattern);
+//        for(String s:list){
+//            System.out.println("INFO: " + s);
+//        }
+        for (String pattern : patterns) {
+            boolean b = CommonUtilities.findInLineList(list, pattern, false);
+            assertTrue(b, "pattern not found in log files: " + pattern);
+        }
+    }
+
+    @Test
+    public void agentWithoutStorageWithoutTomcat() throws Exception {
+        ThermostatAgent agent = new ThermostatAgent();
+        assertFailsToStartAndRun(agent, "Agent should not run without storage and without tomcat");
+    }
+
+    @Test
+    public void agentWithTomcatWithoutStorage() throws Exception {
+        Tomcat tomcat = new Tomcat();
+        ThermostatAgent agent = new ThermostatAgent();
+
+        tomcat.start();
+        assertFailsToStartAndRun(agent, "Agent should not run without storage");
+        tomcat.stop();
+
+        checkForPatterns("catalina", THERM_AGENT_WITH_TOMCAT_ONLY_CATALINA_LOGS);
+        checkForPatterns("thermostat-web-storage.", THERM_AGENT_WITH_TOMCAT_ONLY_THERMOSTAT_LOGS);
+    }
+
+    @Test
+    public void agentWithStorageWithoutTomcat() throws Exception {
+        ThermostatStorage storage = new ThermostatStorage();
+        ThermostatAgent agent = new ThermostatAgent();
+        assertFailsToStartAndRun(agent, "Agent should not run without tomcat");
+    }
+
+    @Test
+    public void agent() throws Exception {
+        ThermostatStorage storage = new ThermostatStorage();
+        Tomcat tomcat = new Tomcat();
+        ThermostatAgent agent = new ThermostatAgent();
+
+        storage.start();
+        tomcat.start();
+        agent.start();
+        assertRuns(agent, "Agent should be running");
+        agent.stop();
+        tomcat.stop();
+        storage.stop();
+
+        checkForPatterns("catalina", THERM_AGENT_WITH_WEB_STORAGE_CATALINA_LOGS);
+        checkForPatterns("thermostat-web-storage.", THERM_AGENT_WITH_WEB_STORAGE_THERMOSTAT_LOGS);
+    }
+
+    @Test
+    @SetupStorage(type = "web", badAgentLogin = true)
+    public void agentBadLogin() throws Exception {
+        ThermostatStorage storage = new ThermostatStorage();
+        Tomcat tomcat = new Tomcat();
+        ThermostatAgent agent = new ThermostatAgent();
+
+        storage.start();
+        tomcat.start();
+        assertFailsToStartAndRun(agent, "Agent should not run with bad login");
+        tomcat.stop();
+        storage.stop();
+
+        //checkForPatterns("catalina", THERM_AGENT_BAD_LOGIN_CATALINA_LOGS);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/CliClientDBModifWebStorageTest.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,57 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests;
+
+import org.thermostat.qa2.framework.annotations.SetupStorage;
+import org.thermostat.qa2.framework.annotations.RunGnomeKeyring;
+import org.thermostat.qa2.framework.annotations.RunStorage;
+import org.thermostat.qa2.framework.annotations.Test;
+
+/**
+ * Test class ported from old framework
+ * @author Zdeněk Žamberský
+ */
+@SetupStorage(type = "web")
+@RunGnomeKeyring
+@RunStorage
+public class CliClientDBModifWebStorageTest {
+
+    @Test
+    public void badLogin() throws Exception {
+        CliClientDBModificationsSmokeTest.cliDBTestBadLogin();
+    }
+
+    @Test
+    public void addVMandSeeItInShellWeb() throws Exception {
+        CliClientDBModificationsSmokeTest.cliDBTest();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/CliClientDBModificationsSmokeTest.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,112 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests;
+
+import java.io.File;
+import java.util.List;
+import static org.thermostat.qa2.framework.Assert.*;
+import org.thermostat.qa2.framework.NativeProcess;
+import org.thermostat.qa2.framework.Shell;
+import org.thermostat.qa2.framework.ThermostatQAConfig;
+import org.thermostat.qa2.framework.annotations.*;
+import org.thermostat.qa2.framework.utils.ProcessUtilities;
+
+/**
+ * Test class ported from old framework
+ *
+ * @author Zdeněk Žamberský
+ */
+@SetupStorage(type = "mongo")
+@RunGnomeKeyring
+@RunStorage
+public class CliClientDBModificationsSmokeTest {
+
+    public static final String[] headerPatterns = {"HOST_ID", "HOST", "VM_ID", "STATUS", "VM_NAME"};
+    public static final String[] agentPatterns = {"non-existing-agent-no1", "artif.added.host0.name", "12345", "RUNNING", "unknown"};
+
+    private static void cliDBTestCommon(boolean badLogin) throws Exception {
+        ThermostatQAConfig.Login mongoLogin = ThermostatQAConfig.getMongoLogin();
+
+        Shell mongo = ProcessUtilities.createMongoShell();
+        mongo.start();
+        mongo.writeln("use thermostat");
+        mongo.writeln("db.auth(\"" + mongoLogin.getUsername() + "\", \"" + mongoLogin.getPassword() + "\")");
+        mongo.writeln("db[\"agent-config\"].insert({ \"agentId\" : \"non-existing-agent-no1\", \"alive\" : true, \"configListenAddress\" : \"127.0.0.1:12345\", \"startTime\" : NumberLong(\"1234567891011\"), \"stopTime\" : NumberLong(0) })");
+        mongo.writeln("db[\"host-info\"].insert({ \"agentId\" : \"non-existing-agent-no1\", \"hostname\" : \"artif.added.host0.name\" })");
+        mongo.writeln("db[\"vm-info\"].insert({ \"agentId\" : \"non-existing-agent-no1\", \"environmentAsArray\" : [ { \"key\" : \"HOSTNAME\", \"value\" : \"artif.added.host0.name\" } ], \"startTimeStamp\" : NumberLong(\"1234567891011\"),  \"stopTimeStamp\" : NumberLong(\"-9223372036854775808\"), \"vmId\" : \"12345\", \"vmPid\" : NumberInt(\"12345\") })");
+        mongo.writeln("quit()");
+        mongo.waitFor();
+
+        String[] thermostatCmds = {ThermostatQAConfig.thermostatHome + File.separator + "bin" + File.separator + "thermostat", "shell"};
+        Shell thermostat = new Shell(thermostatCmds);
+        thermostat.setEnvironmentVariable("USER_THERMOSTAT_HOME", ThermostatQAConfig.getThermostatUserHome());
+        thermostat.setStdOutMode(NativeProcess.MODE_LOG_AND_BUFFER);
+        thermostat.start();
+        thermostat.writeln("list-vms");
+        if (badLogin) {
+            thermostat.writeln("baduser");
+            thermostat.writeln("badpassword");
+        } else {
+            ThermostatQAConfig.Login login = ThermostatQAConfig.getClientLogin();
+            thermostat.writeln(login.getUsername());
+            thermostat.writeln(login.getPassword());
+        }
+        thermostat.writeln("exit");
+        thermostat.waitFor();
+        List<String> stdoutLines = thermostat.getStdoutLines();
+        if (badLogin) {
+            assertNotContainsPatterns(stdoutLines, headerPatterns);
+            assertNotContainsPatterns(stdoutLines, agentPatterns);
+        } else {
+            assertContainsPatterns(stdoutLines, headerPatterns);
+            assertContainsPatterns(stdoutLines, agentPatterns);
+        }
+    }
+
+    public static void cliDBTest() throws Exception {
+        cliDBTestCommon(false);
+    }
+
+    public static void cliDBTestBadLogin() throws Exception {
+        cliDBTestCommon(true);
+    }
+
+    @Test
+    public void addVMandSeeItInShell() throws Exception {
+        cliDBTest();
+    }
+
+    @Test
+    public void badLogin() throws Exception {
+        cliDBTestBadLogin();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/CliClientSmokeTest.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,88 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests;
+
+import java.io.File;
+import java.util.List;
+import org.thermostat.qa2.framework.Assert;
+import org.thermostat.qa2.framework.NativeProcess;
+import org.thermostat.qa2.framework.Shell;
+import org.thermostat.qa2.framework.ThermostatQAConfig;
+import org.thermostat.qa2.framework.annotations.SetupStorage;
+import org.thermostat.qa2.framework.annotations.RunGnomeKeyring;
+import org.thermostat.qa2.framework.annotations.RunStorage;
+import org.thermostat.qa2.framework.annotations.Test;
+import org.thermostat.qa2.framework.utils.FileUtilities;
+import org.thermostat.qa2.framework.utils.ProcessUtilities;
+
+/**
+ * Test class ported from old framework
+ * @author Zdeněk Žamberský
+ */
+@SetupStorage(type = "mongo")
+@RunGnomeKeyring
+@RunStorage
+public class CliClientSmokeTest {
+
+    String exitThermShellFile = ThermostatQAConfig.getThermostatOutputTextsDir() + File.separator + "output_of_exit_therm_shell.txt";
+    String helpThermShellFile = ThermostatQAConfig.getThermostatOutputTextsDir() + File.separator + "output_of_help_therm_shell.txt";
+
+    @Test
+    public void startOutput() throws Exception {
+        Shell thermostat = ProcessUtilities.createThermostatShell();
+        thermostat.setEnvironmentVariable("USER_THERMOSTAT_HOME", ThermostatQAConfig.getThermostatUserHome());
+        thermostat.setStdOutMode(NativeProcess.MODE_LOG_AND_BUFFER);
+        thermostat.start();
+        thermostat.writeln("exit");
+        thermostat.waitFor();
+
+        List<String> output = thermostat.getStdoutLines();
+        List<String> expected = FileUtilities.getLineListFromFile(exitThermShellFile);
+        Assert.assertEquals(output, expected);
+    }
+
+    @Test
+    public void helpOutput() throws Exception {
+        Shell thermostat = ProcessUtilities.createThermostatShell();
+        thermostat.setEnvironmentVariable("USER_THERMOSTAT_HOME", ThermostatQAConfig.getThermostatUserHome());
+        thermostat.setStdOutMode(NativeProcess.MODE_LOG_AND_BUFFER);
+        thermostat.start();
+        thermostat.writeln("help");
+        thermostat.writeln("exit");
+        thermostat.waitFor();
+
+        List<String> output = thermostat.getStdoutLines();
+        List<String> expected = FileUtilities.getLineListFromFile(helpThermShellFile);
+        //expected.set(0, expected.get(0) + "abcd");
+        Assert.assertEquals(output, expected);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/CommandChannelSmokeTest.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,117 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests;
+
+import java.util.List;
+import org.thermostat.qa2.framework.Assert;
+import static org.thermostat.qa2.framework.Assert.*;
+import org.thermostat.qa2.framework.NativeProcess;
+import org.thermostat.qa2.framework.Shell;
+import org.thermostat.qa2.framework.ThermostatQAConfig;
+import org.thermostat.qa2.framework.annotations.SetupStorage;
+import org.thermostat.qa2.framework.annotations.RunGnomeKeyring;
+import org.thermostat.qa2.framework.annotations.RunStorage;
+import org.thermostat.qa2.framework.annotations.Test;
+import org.thermostat.qa2.framework.services.ThermostatAgent;
+import org.thermostat.qa2.framework.utils.ProcessUtilities;
+import org.thermostat.qa2.framework.utils.ThermostatUtilities;
+
+/**
+ * Test class ported from old framework
+ * @author Zdeněk Žamberský
+ */
+public class CommandChannelSmokeTest {
+
+    static final String[] patternRunningAgent = new String[]{
+        "Please enter username for storage at mongodb://127.0.0.1:",
+        "Please enter password for storage at mongodb://127.0.0.1:",
+        "Queuing ping request.  Destination: /127.0.0.1:12000",
+        "Response received from: /127.0.0.1:12000"
+    };
+
+    static final String[] patternStoppedAgent = new String[]{
+        "Please enter username for storage at mongodb://127.0.0.1:",
+        "Please enter password for storage at mongodb://127.0.0.1:",
+        "Invalid host ID or agent no longer running." // new
+    //"Queuing ping request.  Destination: /127.0.0.1:12000",
+    //"Error received from: /127.0.0.1:12000"
+    };
+
+    public static List<String> pingHost(String hostId, String username, String password) throws Exception {
+        String[] pingCmds = {ThermostatQAConfig.getThermostatExecutablePath(), "ping", hostId};
+        Shell ping = new Shell(pingCmds);
+        ping.setEnvironmentVariable("USER_THERMOSTAT_HOME", ThermostatQAConfig.getThermostatUserHome());
+        ping.setStdOutMode(NativeProcess.MODE_LOG_AND_BUFFER);
+        ping.start();
+        ping.writeln(username);
+        ping.writeln(password);
+        ping.waitFor();
+        return ping.getStdoutLines();
+    }
+
+    public static void pingAgentImpl(String username, String password, String[] patternsRunning, String[] patternsStopped) throws Exception {
+        ThermostatAgent agent = new ThermostatAgent();
+        agent.start();
+        Assert.assertRuns(agent, "Agent should be running");
+
+        List<String> pidLines = ProcessUtilities.shellRunGetOutput("jps | grep Thermostat | cut -d' ' -f1");
+        List<String> vmsLines = ThermostatUtilities.getListVmsOutput();
+
+        String hostId = null;
+        for (String vmsLine : vmsLines) {
+            if (vmsLine.contains("RUNNING")) {
+                for (String pid : pidLines) {
+                    if (vmsLine.contains(pid)) {
+                        hostId = vmsLine.split(" ")[0];
+                    }
+                }
+            }
+        }
+        assertTrue(hostId != null, "hostId of agent was not found");
+
+        List<String> ping1Lines = pingHost(hostId, username, password);
+        agent.stop();
+        List<String> ping2Lines = pingHost(hostId, username, password);
+
+        assertContainsPatterns(ping1Lines, patternsRunning);
+        assertContainsPatterns(ping2Lines, patternsStopped);
+    }
+
+    @Test
+    @SetupStorage(type = "mongo")
+    @RunStorage
+    @RunGnomeKeyring
+    public void pingAgent() throws Exception {
+        ThermostatQAConfig.Login login = ThermostatQAConfig.getClientLogin();
+        pingAgentImpl(login.getUsername(), login.getPassword(), patternRunningAgent, patternStoppedAgent);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/CommandChannelWebStorageTest.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,70 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests;
+
+import org.thermostat.qa2.framework.ThermostatQAConfig;
+import org.thermostat.qa2.framework.ThermostatQAConfig.Login;
+import org.thermostat.qa2.framework.annotations.SetupStorage;
+import org.thermostat.qa2.framework.annotations.RunGnomeKeyring;
+import org.thermostat.qa2.framework.annotations.RunStorage;
+import org.thermostat.qa2.framework.annotations.Test;
+
+/**
+ * Test class ported from old framework
+ * @author Zdeněk Žamberský
+ */
+public class CommandChannelWebStorageTest {
+
+    String[] patternRunningAgent = new String[]{
+        "Please enter username for storage at http://127.0.0.1:8080/thermostat/storage:",
+        "Please enter password for storage at http://127.0.0.1:8080/thermostat/storage:",
+        "Queuing ping request.  Destination: /127.0.0.1:12000",
+        "Response received from: /127.0.0.1:12000"
+    };
+
+    String[] patternStoppedAgent = new String[]{
+        "Please enter username for storage at http://127.0.0.1:8080/thermostat/storage:",
+        "Please enter password for storage at http://127.0.0.1:8080/thermostat/storage:",
+        "Invalid host ID or agent no longer running." // new
+        //"Queuing ping request.  Destination: /127.0.0.1:12000",
+        //"Error received from: /127.0.0.1:12000"
+    };
+
+    @Test
+    @SetupStorage(type = "web")
+    @RunStorage
+    @RunGnomeKeyring
+    public void pingAgent() throws Exception {
+        Login login = ThermostatQAConfig.getCommandChannelLogin();
+        CommandChannelSmokeTest.pingAgentImpl(login.getUsername(), login.getPassword(), patternRunningAgent, patternStoppedAgent);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/DBCommandsHeapDumpTest.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,163 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests;
+
+import java.io.File;
+import java.util.List;
+import static org.thermostat.qa2.framework.Assert.*;
+import org.thermostat.qa2.framework.Shell;
+import org.thermostat.qa2.framework.ThermostatQAConfig;
+import org.thermostat.qa2.framework.annotations.*;
+import org.thermostat.qa2.framework.utils.ProcessUtilities;
+import org.thermostat.qa2.framework.utils.ThermostatUtilities;
+
+/**
+ * Test class ported from old framework
+ * @author Zdeněk Žamberský
+ */
+public class DBCommandsHeapDumpTest {
+
+    List<String> scriptOutput;
+
+    @Before
+    @SetupStorage(type = "mongo")
+    @RunStorage
+    @RunAgent
+    @RunGnomeKeyring
+    public void setUp() throws Exception {
+        List<String> vmsLines = ThermostatUtilities.getListVmsOutput();
+        String vmLine = null;
+
+        for (String line : vmsLines) {
+            if (line.contains("RUNNING")) {
+                vmLine = line;
+                break;
+            }
+        }
+        assertTrue(vmLine != null, "Problem finding a running vm!");
+        String[] lineParts = vmLine.split(" ");
+        String hostId = lineParts[0];
+        String vmId = lineParts[2];
+
+        String[] thermostatCmds = {ThermostatQAConfig.getThermostatExecutablePath(), "dump-heap", "-a", hostId, "-v", vmId};
+        Shell thermostat = new Shell(thermostatCmds);
+        thermostat.setEnvironmentVariable("USER_THERMOSTAT_HOME", ThermostatQAConfig.getThermostatUserHome());
+        thermostat.start();
+        ThermostatQAConfig.Login login = ThermostatQAConfig.getClientLogin();
+        thermostat.writeln(login.getUsername());
+        thermostat.writeln(login.getPassword());
+        thermostat.waitFor();
+
+        String script = "." + File.separator + "scripts" + File.separator + "check-collections-heap-dump.js";
+        scriptOutput = ProcessUtilities.runGetOutput("mongo", "127.0.0.1:" + ThermostatQAConfig.mongoPort, script);
+    }
+
+    public static String errMessage = "problems running auxiliary script";
+    
+    @Test
+    public void hostInfo() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for host-info is OK");
+    }
+
+    @Test
+    public void memoryStats() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for memory-stats is OK");
+    }
+
+    @Test
+    public void networkInfo() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for network-info is OK");
+    }
+
+    @Test
+    public void numaHostInfo() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for numa-host-info is OK");
+    }
+
+    @Test
+    public void numaStat() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for numa-stat is OK");
+    }
+
+    @Test
+    public void vmClassStats() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for vm-class-stats is OK");
+    }
+
+    @Test
+    public void vmCpuStats() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for vm-cpu-stats is OK");
+    }
+
+    @Test
+    public void vmGcStats() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for vm-gc-stats is OK");
+    }
+
+    @Test
+    public void vmHeapInfo() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for vm-heap-info is OK");
+    }
+
+    @Test
+    public void vmInfo() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for vm-info is OK");
+    }
+
+    @Test
+    public void vmMemoryStats() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for vm-memory-stats is OK");
+    }
+
+    @Test
+    public void vmThreadCapabilities() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for vm-thread-capabilities is OK");
+    }
+
+    @Test
+    public void vmThreadHarvesting() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for vm-thread-harvesting is OK");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/DBGuiHeapDumpTest.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,179 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests;
+
+import java.io.File;
+import java.util.List;
+import static org.thermostat.qa2.framework.Assert.*;
+import org.thermostat.qa2.framework.Robot;
+import org.thermostat.qa2.framework.ThermostatQAConfig;
+import org.thermostat.qa2.framework.annotations.Before;
+import org.thermostat.qa2.framework.annotations.SetupStorage;
+import org.thermostat.qa2.framework.annotations.RunAgent;
+import org.thermostat.qa2.framework.annotations.RunGnomeKeyring;
+import org.thermostat.qa2.framework.annotations.RunStorage;
+import org.thermostat.qa2.framework.annotations.Test;
+import org.thermostat.qa2.framework.services.ThermostatGui;
+import org.thermostat.qa2.framework.utils.CommonUtilities;
+import org.thermostat.qa2.framework.utils.ProcessUtilities;
+
+/**
+ * Test class ported from old framework
+ * @author Zdeněk Žamberský
+ */
+public class DBGuiHeapDumpTest {
+    
+    List<String> scriptOutput;
+    
+    @Before
+    @SetupStorage(type = "mongo")
+    @RunStorage
+    @RunAgent
+    @RunGnomeKeyring
+    public void setUp() throws Exception {
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "thermostat gui should be running");
+        
+        Robot robot = new Robot();
+        robot.clickOnVMView();
+        robot.clickOnPattern("VMView/heap_analyzer_tab");
+        
+        robot.makeScreenshot("VMViewHeapAnalyzer1");
+        robot.checkForPattern("VMView/heap_analyzer_tab_chosen");
+        robot.saveScreenshot("VMViewHeapAnalyzer2");
+        // dump a heap
+        robot.clickOnPattern("VMView/HeapAnalyzerTab/heap_dump_icon");
+        CommonUtilities.sleep(5000);
+        
+        String script = "." + File.separator + "scripts" + File.separator + "check-collections-heap-dump.js";
+        scriptOutput = ProcessUtilities.runGetOutput("mongo", "127.0.0.1:" + ThermostatQAConfig.mongoPort, script);
+    }
+    
+    public static String errMessage = "problems running auxiliary script";
+    
+    @Test
+    public void agentConfig() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for agent-config is OK");
+    }
+    
+    @Test
+    public void backendInfo() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for backend-info is OK");
+    }
+    
+    @Test
+    public void cpuStats() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for cpu-stats is OK");
+    }
+    
+    @Test
+    public void hostInfo() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for host-info is OK");
+    }
+    
+    @Test
+    public void memoryStats() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for memory-stats is OK");
+    }
+    
+    @Test
+    public void networkInfo() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for network-info is OK");
+    }
+    
+    @Test
+    public void numaHostInfo() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for numa-host-info is OK");
+    }
+    
+    @Test
+    public void numaStat() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for numa-stat is OK");
+    }
+    
+    @Test
+    public void vmClassStats() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for vm-class-stats is OK");
+    }
+    
+    @Test
+    public void vmCpuStats() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for vm-cpu-stats is OK");
+    }
+    
+    @Test
+    public void vmGcStats() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for vm-gc-stats is OK");
+    }
+    
+    @Test
+    public void vmHeapInfo() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for vm-heap-info is OK");
+    }
+    
+    @Test
+    public void vmInfo() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for vm-info is OK");
+    }
+    
+    @Test
+    public void vmMemoryStats() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for vm-memory-stats is OK");
+    }
+    
+    @Test
+    public void vmThreadCapabilities() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for vm-thread-capabilities is OK");
+    }
+    
+    @Test
+    public void vmThreadHarvesting() {
+        assertNotNull(scriptOutput, errMessage);
+        assertContainsPattern(scriptOutput, "schema for vm-thread-harvesting is OK");
+    }
+    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/DBSchemeSmokeTest.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,155 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests;
+
+import java.io.File;
+import java.util.List;
+import static org.thermostat.qa2.framework.Assert.*;
+import org.thermostat.qa2.framework.NativeProcess;
+import org.thermostat.qa2.framework.ThermostatQAConfig;
+import org.thermostat.qa2.framework.annotations.Before;
+import org.thermostat.qa2.framework.annotations.SetupStorage;
+import org.thermostat.qa2.framework.annotations.RunGnomeKeyring;
+import org.thermostat.qa2.framework.annotations.RunStorage;
+import org.thermostat.qa2.framework.annotations.Test;
+import org.thermostat.qa2.framework.services.ThermostatAgent;
+import org.thermostat.qa2.framework.utils.CommonUtilities;
+
+/**
+ * Test class ported from old framework
+ * @author Zdeněk Žamberský
+ */
+public class DBSchemeSmokeTest {
+
+    List<String> scriptOutput;
+
+    @Before
+    @SetupStorage(type = "mongo")
+    @RunStorage
+    @RunGnomeKeyring
+    public void setUp() throws Exception {
+        ThermostatAgent agent = new ThermostatAgent();
+        agent.start();
+        assertRuns(agent, "agent should be running");
+        CommonUtilities.sleep(5000);
+        String script = "." + File.separator + "scripts" + File.separator + "check-collections-smoke.js";
+        NativeProcess process = new NativeProcess("mongo", "127.0.0.1:" + ThermostatQAConfig.mongoPort, script);
+        process.setStdOutMode(NativeProcess.MODE_LOG_AND_BUFFER);
+        process.start();
+        process.waitFor();
+        scriptOutput = process.getStdoutLines();
+    }
+
+    @Test
+    public void agentConfig() {
+        assertNotNull(scriptOutput, "problems running auxiliary js script in mongo shell");
+        assertContainsPattern(scriptOutput, "schema for agent-config is OK");
+    }
+
+    @Test
+    public void backendInfo() {
+        assertNotNull(scriptOutput, "problems running auxiliary js script in mongo shell");
+        assertContainsPattern(scriptOutput, "schema for backend-info is OK");
+    }
+
+    @Test
+    public void cpuStats() {
+        assertNotNull(scriptOutput, "problems running auxiliary js script in mongo shell");
+        assertContainsPattern(scriptOutput, "schema for cpu-stats is OK");
+    }
+
+    @Test
+    public void hostInfo() {
+        assertNotNull(scriptOutput, "problems running auxiliary js script in mongo shell");
+        assertContainsPattern(scriptOutput, "schema for host-info is OK");
+    }
+
+    @Test
+    public void memoryStats() {
+        assertNotNull(scriptOutput, "problems running auxiliary js script in mongo shell");
+        assertContainsPattern(scriptOutput, "schema for memory-stats is OK");
+    }
+
+    @Test
+    public void numaHostInfo() {
+        assertNotNull(scriptOutput, "problems running auxiliary js script in mongo shell");
+        assertContainsPattern(scriptOutput, "schema for numa-host-info is OK");
+    }
+
+    @Test
+    public void numaStat() {
+        assertNotNull(scriptOutput, "problems running auxiliary js script in mongo shell");
+        assertContainsPattern(scriptOutput, "schema for numa-stat is OK");
+    }
+
+    @Test
+    public void vmClassStats() {
+        assertNotNull(scriptOutput, "problems running auxiliary js script in mongo shell");
+        assertContainsPattern(scriptOutput, "schema for vm-class-stats is OK");
+    }
+
+    @Test
+    public void vmCpuStats() {
+        assertNotNull(scriptOutput, "problems running auxiliary js script in mongo shell");
+        assertContainsPattern(scriptOutput, "schema for vm-cpu-stats is OK");
+    }
+
+    @Test
+    public void vmGcStats() {
+        assertNotNull(scriptOutput, "problems running auxiliary js script in mongo shell");
+        assertContainsPattern(scriptOutput, "schema for vm-gc-stats is OK");
+    }
+
+    @Test
+    public void vmInfo() {
+        assertNotNull(scriptOutput, "problems running auxiliary js script in mongo shell");
+        assertContainsPattern(scriptOutput, "schema for vm-info is OK");
+    }
+
+    @Test
+    public void vmMemoryStats() {
+        assertNotNull(scriptOutput, "problems running auxiliary js script in mongo shell");
+        assertContainsPattern(scriptOutput, "schema for vm-memory-stats is OK");
+    }
+
+    @Test
+    public void vmThreadCapabilities() {
+        assertNotNull(scriptOutput, "problems running auxiliary js script in mongo shell");
+        assertContainsPattern(scriptOutput, "schema for vm-thread-capabilities is OK");
+    }
+
+    @Test
+    public void vmThreadHarvesting() {
+        assertNotNull(scriptOutput, "problems running auxiliary js script in mongo shell");
+        assertContainsPattern(scriptOutput, "schema for vm-thread-harvesting is OK");
+    }
+    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/GuiClientDBModifWebStorageTest.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,52 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests;
+
+import org.thermostat.qa2.framework.annotations.SetupStorage;
+import org.thermostat.qa2.framework.annotations.RunGnomeKeyring;
+import org.thermostat.qa2.framework.annotations.RunStorage;
+import org.thermostat.qa2.framework.annotations.Test;
+
+/**
+ * Test class ported from old framework
+ * @author Zdeněk Žamberský
+ */
+public class GuiClientDBModifWebStorageTest {
+
+    @Test
+    @SetupStorage(type = "web")
+    @RunStorage
+    @RunGnomeKeyring
+    public void addAgentAndSeeItInGUITest() throws Exception {
+        GuiClientDBModificationsSmokeTest.addAgentAndSeeItInGuiImpl();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/GuiClientDBModificationsSmokeTest.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,86 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests;
+
+import static org.thermostat.qa2.framework.Assert.assertRuns;
+import org.thermostat.qa2.framework.Robot;
+import org.thermostat.qa2.framework.Shell;
+import org.thermostat.qa2.framework.ThermostatQAConfig;
+import org.thermostat.qa2.framework.annotations.SetupStorage;
+import org.thermostat.qa2.framework.annotations.RunGnomeKeyring;
+import org.thermostat.qa2.framework.annotations.RunStorage;
+import org.thermostat.qa2.framework.annotations.Test;
+import org.thermostat.qa2.framework.services.ThermostatGui;
+import org.thermostat.qa2.framework.utils.ProcessUtilities;
+
+/**
+ * Test class ported from old framework
+ * @author Zdeněk Žamberský
+ */
+public class GuiClientDBModificationsSmokeTest {
+
+    public static void addAgentAndSeeItInGuiImpl() throws Exception {
+        ThermostatQAConfig.Login login = ThermostatQAConfig.getMongoLogin();
+
+        Shell mongo = ProcessUtilities.createMongoShell();
+        mongo.start();
+        mongo.writeln("use thermostat");
+        mongo.writeln("db.auth(\"" + login.getUsername() + "\",\"" + login.getPassword() + "\")");
+        mongo.writeln("db[\"agent-config\"].insert({ \"agentId\" : \"artif-added-agent-for-testing\", \"alive\" : true, \"configListenAddress\" : \"127.0.0.1:12345\", \"startTime\" : NumberLong(\"1234567891011\"), \"stopTime\" : NumberLong(0) })");
+        mongo.writeln("quit()");
+        mongo.waitFor();
+
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "thermostat gui should be running");
+
+        Robot robot = new Robot();
+        robot.enterMainMenu();
+        robot.pressRightKey();
+        robot.pressRightKey();
+        robot.pressDownKey();
+        robot.pressEnterKey();
+
+        robot.makeScreenshot("testAddAgentAndSeeItInGUIWSTest1");
+
+        robot.checkForPattern("AllAgentsDialog/added_agent");
+        robot.saveScreenshot("testAddAgentAndSeeItInGUIWSTest2");
+    }
+
+    @Test
+    @SetupStorage(type = "mongo")
+    @RunStorage
+    @RunGnomeKeyring
+    public void addAgentAndSeeItInGUITest() throws Exception {
+        addAgentAndSeeItInGuiImpl();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/GuiClientSmokeTest.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,229 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests;
+
+import static org.thermostat.qa2.framework.Assert.assertRuns;
+import org.thermostat.qa2.framework.Robot;
+import org.thermostat.qa2.framework.annotations.SetupStorage;
+import org.thermostat.qa2.framework.annotations.RunGnomeKeyring;
+import org.thermostat.qa2.framework.annotations.RunStorage;
+import org.thermostat.qa2.framework.annotations.Test;
+import org.thermostat.qa2.framework.services.ThermostatGui;
+
+/**
+ * Test class ported from old framework
+ * @author Zdeněk Žamberský
+ */
+@RunGnomeKeyring
+@SetupStorage(type = "mongo")
+public class GuiClientSmokeTest {
+
+    @Test
+    public void startGuiWithoutStorage() throws Exception {
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "thermostat gui should be running");
+
+        Robot robot = new Robot();
+        robot.makeScreenshot("FailureToConnectToStorageDialog1");
+        robot.checkForPattern("FailureToConnectToStorageDialog/error_icon");
+        robot.checkForPattern("FailureToConnectToStorageDialog/configure_button");
+        robot.checkForPattern("FailureToConnectToStorageDialog/quit_button");
+        robot.saveScreenshot("FailureToConnectToStorageDialog2");
+    }
+
+    @Test
+    @RunStorage
+    public void startGuiWithStorageBasicTest() throws Exception {
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "thermostat gui should be running");
+
+        Robot robot = new Robot();
+        robot.makeScreenshot("startGUIWithStorageBasicTest1");
+        robot.checkForPattern("MainWindow/magnify_icon");
+        robot.checkForPattern("MainWindow/main_menu");
+        robot.saveScreenshot("startGUIWithStorageBasicTest2");
+    }
+
+    @Test
+    @RunStorage
+    public void startGuiWithStorageMenuTest() throws Exception {
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "thermostat gui should be running");
+
+        Robot robot = new Robot();
+        robot.makeScreenshot("startGUIWithStorageMenuTest1");
+        robot.checkForPattern("MainMenu/menu_bar_file");
+        robot.checkForPattern("MainMenu/menu_bar_edit");
+        robot.checkForPattern("MainMenu/menu_bar_view");
+        robot.checkForPattern("MainMenu/menu_bar_help");
+        robot.saveScreenshot("startGUIWithStorageMenuTest2");
+    }
+
+    @Test
+    @RunStorage
+    public void startGuiWithStorageMenuFileTest() throws Exception {
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "thermostat gui should be running");
+
+        Robot robot = new Robot();
+        robot.enterMainMenu();
+
+        robot.makeScreenshot("startGUIWithStorageMenuFileTest1");
+        robot.checkForPattern("MainMenu/menu_file_exit");
+        robot.saveScreenshot("startGUIWithStorageMenuFileTest2");
+    }
+
+    @Test
+    @RunStorage
+    public void startGUIWithStorageMenuEditTest() throws Exception {
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "thermostat gui should be running");
+
+        Robot robot = new Robot();
+        robot.enterMainMenu();
+        robot.pressRightKey();
+        robot.pressLeftKey();
+        robot.pressRightKey();
+
+        robot.makeScreenshot("startGUIWithStorageMenuEditTest1");
+        robot.checkForPattern("MainMenu/menu_edit_client_preferences");
+        robot.checkForPattern("MainMenu/menu_edit_show_unconnected_hosts");
+        robot.checkForPattern("MainMenu/menu_edit_show_non_living_vm");
+        robot.saveScreenshot("startGUIWithStorageMenuEditTest2");
+    }
+
+    @Test
+    @RunStorage
+    public void startGUIWithStorageMenuViewTest() throws Exception {
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "thermostat gui should be running");
+
+        Robot robot = new Robot();
+        robot.enterMainMenu();
+        robot.pressRightKey();
+        robot.pressRightKey();
+
+        robot.makeScreenshot("startGUIWithStorageMenuViewTest1");
+        robot.checkForPattern("MainMenu/menu_view_all_agents");
+        robot.saveScreenshot("startGUIWithStorageMenuViewTest2");
+    }
+
+    @Test
+    @RunStorage
+    public void startGUIWithStorageMenuHelpTest() throws Exception {
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "thermostat gui should be running");
+
+        Robot robot = new Robot();
+        robot.enterMainMenu();
+        robot.pressRightKey();
+        robot.pressRightKey();
+        robot.pressRightKey();
+
+        robot.makeScreenshot("startGUIWithStorageMenuHelpTest1");
+        robot.checkForPattern("MainMenu/menu_help_about");
+        robot.saveScreenshot("startGUIWithStorageMenuHelpTest2");
+    }
+
+    @Test
+    @RunStorage
+    public void startGUIWithStorageMenuHelpAboutTest() throws Exception {
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "thermostat gui should be running");
+
+        Robot robot = new Robot();
+        robot.enterMainMenu();
+        robot.pressRightKey();
+        robot.pressRightKey();
+        robot.pressRightKey();
+        robot.pressDownKey();
+        robot.pressEnterKey();
+
+        robot.makeScreenshot("startGUIWithStorageMenuHelpAboutTest1");
+        robot.checkForPattern("AboutDialog/thermostat_logo");
+        robot.checkForPattern("AboutDialog/thermostat_title");
+        robot.checkForPattern("AboutDialog/about_text_upper_part");
+        robot.checkForPattern("AboutDialog/about_text_lower_part");
+        robot.saveScreenshot("startGUIWithStorageMenuHelpAboutTest2");
+    }
+
+    @Test
+    @RunStorage
+    public void editClientPreferences() throws Exception {
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "thermostat gui should be running");
+
+        Robot robot = new Robot();
+        robot.enterMainMenu();
+        robot.pressRightKey();
+        robot.pressDownKey();
+        robot.pressEnterKey();
+
+        robot.makeScreenshot("editClientPreferencesTest1");
+        robot.checkForPattern("ClientPreferencesDialog/ok_button");
+        robot.checkForPattern("ClientPreferencesDialog/cancel_button");
+        robot.checkForPattern("ClientPreferencesDialog/connection_info_label");
+        robot.checkForPattern("ClientPreferencesDialog/user_name_label");
+        robot.checkForPattern("ClientPreferencesDialog/password_label");
+        robot.checkForPattern("ClientPreferencesDialog/storage_url_label");
+        robot.checkForPattern("ClientPreferencesDialog/save_entitlements_checked");
+        robot.saveScreenshot("editClientPreferencesTest2");
+    }
+
+    @Test
+    @RunStorage
+    public void allAgentsDialog() throws Exception {
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "thermostat gui should be running");
+
+        Robot robot = new Robot();
+        robot.enterMainMenu();
+        robot.pressRightKey();
+        robot.pressRightKey();
+        robot.pressDownKey();
+        robot.pressEnterKey();
+
+        robot.makeScreenshot("allAgentsDialogTest1");
+        robot.checkForPattern("AllAgentsDialog/close_button");
+        robot.saveScreenshot("allAgentsDialogTest2");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/GuiClientWebStorageTest.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,246 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests;
+
+import static org.thermostat.qa2.framework.Assert.assertRuns;
+import org.thermostat.qa2.framework.Robot;
+import org.thermostat.qa2.framework.ThermostatQAConfig;
+import org.thermostat.qa2.framework.annotations.SetupStorage;
+import org.thermostat.qa2.framework.annotations.RunGnomeKeyring;
+import org.thermostat.qa2.framework.annotations.RunStorage;
+import org.thermostat.qa2.framework.annotations.Test;
+import org.thermostat.qa2.framework.services.ThermostatGui;
+import org.thermostat.qa2.framework.services.ThermostatStorage;
+import org.thermostat.qa2.framework.services.Tomcat;
+
+/**
+ * Test class ported from old framework
+ * @author Zdeněk Žamberský
+ */
+@SetupStorage(type = "web")
+@RunGnomeKeyring
+public class GuiClientWebStorageTest {
+
+    static final String[] thermGuiWithTomcatOnlyThermostatLogs = AgentWebStorageTest.THERM_AGENT_WITH_TOMCAT_ONLY_THERMOSTAT_LOGS;
+    static final String[] thermGuiWithTomcatOnlyCatalinaLogs = AgentWebStorageTest.THERM_AGENT_WITH_TOMCAT_ONLY_CATALINA_LOGS;
+    static final String[] thermGuiWithWebStorageThermostatLogs = AgentWebStorageTest.THERM_AGENT_WITH_WEB_STORAGE_THERMOSTAT_LOGS;
+    static final String[] thermGuiWithWebStorageCatalinaLogs = AgentWebStorageTest.THERM_AGENT_WITH_WEB_STORAGE_CATALINA_LOGS;
+    static final String[] thermGuiBadLoginCatalinaLogs = {
+        "org.apache.catalina.realm.JAASRealm authenticate",
+        "WARNING: Login exception authenticating username \"time-for-tea\"",
+        "javax.security.auth.login.LoginException: User 'time-for-tea' not found"
+    };
+
+    public static void checkForFailedConnectionPatterns(Robot robot) throws Exception {
+        robot.checkForPattern("FailureToConnectToStorageDialog/error_icon");
+        robot.checkForPattern("FailureToConnectToStorageDialog/configure_button");
+        robot.checkForPattern("FailureToConnectToStorageDialog/quit_button");
+    }
+
+    public static void checkForMainWindowPatterns(Robot robot) throws Exception {
+        robot.checkForPattern("MainMenu/menu_bar_file");
+        robot.checkForPattern("MainMenu/menu_bar_edit");
+        robot.checkForPattern("MainMenu/menu_bar_view");
+        robot.checkForPattern("MainMenu/menu_bar_help");
+    }
+
+    @Test
+    public void startWithTomcatWithoutStorage() throws Exception {
+        Tomcat tomcat = new Tomcat();
+        tomcat.start();
+
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "Gui should be running");
+
+        Robot robot = new Robot();
+        robot.makeScreenshot("FailureToConnectToWebStorageDialog01");
+        checkForFailedConnectionPatterns(robot);
+        robot.saveScreenshot("FailureToConnectToWebStorageDialog02");
+    }
+
+    @Test
+    public void startWithStorageWithoutTomcat() throws Exception {
+        ThermostatStorage storage = new ThermostatStorage();
+        storage.start();
+
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "Gui should be running");
+
+        Robot robot = new Robot();
+        robot.makeScreenshot("FailureToConnectToWebStorageDialog11");
+        checkForFailedConnectionPatterns(robot);
+        robot.saveScreenshot("FailureToConnectToWebStorageDialog12");
+    }
+
+    @Test
+    public void startGuiAndCheckTomcatLogs() throws Exception {
+        ThermostatStorage storage = new ThermostatStorage();
+        storage.start();
+
+        Tomcat tomcat = new Tomcat();
+        tomcat.start();
+
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "Gui should be running");
+
+        Robot robot = new Robot();
+        robot.makeScreenshot("GuiWithWebStorage1");
+        checkForMainWindowPatterns(robot);
+        robot.saveScreenshot("GuiWithWebStorage2");
+
+        gui.stop();
+        tomcat.stop();
+        storage.stop();
+
+        AgentWebStorageTest.checkForPatterns("catalina", thermGuiWithWebStorageCatalinaLogs);
+        AgentWebStorageTest.checkForPatterns("thermostat-web-storage.", thermGuiWithWebStorageThermostatLogs);
+    }
+
+    @Test
+    @SetupStorage(type = "web", badClientLogin = true)
+    public void startGuiWithBadLogin() throws Exception {
+        ThermostatStorage storage = new ThermostatStorage();
+        storage.start();
+
+        Tomcat tomcat = new Tomcat();
+        tomcat.start();
+
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "Gui should be running");
+
+        Robot robot = new Robot();
+        robot.makeScreenshot("guiWSBadLogin");
+        checkForFailedConnectionPatterns(robot);
+        robot.saveScreenshot("guiWSBadLogin2");
+
+        gui.stop();
+        tomcat.stop();
+        storage.stop();
+
+        //AgentWebStorageTest.checkForPatterns("catalina", thermGuiBadLoginCatalinaLogs);
+    }
+
+    @Test
+    @SetupStorage(type = "web", badClientLogin = true)
+    public void guiFixBadLoginWebStorage() throws Exception {
+        ThermostatStorage storage = new ThermostatStorage();
+        storage.start();
+
+        Tomcat tomcat = new Tomcat();
+        tomcat.start();
+
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "Gui should be running");
+
+        Robot robot = new Robot();
+        robot.makeScreenshot("guiWSBadLogin");
+        robot.clickOnPattern("FailureToConnectToStorageDialog/configure_button");
+
+        robot.makeScreenshot("guiWSConfigure");
+        robot.checkForPattern("ClientPreferencesDialog/web_storage_connection_info");
+
+        ThermostatQAConfig.Login login = ThermostatQAConfig.clientLogin;
+        robot.doubleClickOnPattern("ClientPreferencesDialog/bad_login_user_name");
+        robot.writeText(login.getUsername());
+
+        robot.doubleClickOnPattern("ClientPreferencesDialog/password_edit_and_label");
+        robot.writeText(login.getPassword());
+
+        robot.clickOnPattern("ClientPreferencesDialog/ok_button");
+        assertRuns(gui, "Gui should be running");
+
+        robot.makeScreenshot("guiWSFixedLogin");
+        checkForMainWindowPatterns(robot);
+
+        gui.stop();
+        tomcat.stop();
+        storage.stop();
+
+        //AgentWebStorageTest.checkForPatterns("catalina", thermGuiBadLoginCatalinaLogs);
+        AgentWebStorageTest.checkForPatterns("catalina", thermGuiWithWebStorageCatalinaLogs);
+        AgentWebStorageTest.checkForPatterns("thermostat-web-storage.", thermGuiWithWebStorageThermostatLogs);
+    }
+
+    @Test
+    public void startGUIWithoutWebStorage() throws Exception {
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "Gui should be running");
+
+        Robot robot = new Robot();
+        robot.makeScreenshot("FailureToConnectToWebStorageDialog1");
+        checkForFailedConnectionPatterns(robot);
+        robot.saveScreenshot("FailureToConnectToWebStorageDialog2");
+    }
+
+    @Test
+    @RunStorage
+    public void startGUIWithWebStorageMenuTest() throws Exception {
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "Gui should be running");
+
+        Robot robot = new Robot();
+        robot.makeScreenshot("testStartGUIWithWebStorageMenuTest1");
+        checkForMainWindowPatterns(robot);
+        robot.saveScreenshot("testStartGUIWithWebStorageMenuTest2");
+    }
+
+    @Test
+    @RunStorage
+    public void editClientPreferences() throws Exception {
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "Gui should be running");
+
+        Robot robot = new Robot();
+        robot.enterMainMenu();
+        robot.pressRightKey();
+        robot.pressDownKey();
+        robot.pressEnterKey();
+        assertRuns(gui, "Gui should be running");
+
+        robot.makeScreenshot("testEditClientPreferencesWSTest1");
+        robot.checkForPattern("ClientPreferencesDialog/ok_button");
+        robot.checkForPattern("ClientPreferencesDialog/cancel_button");
+        robot.checkForPattern("ClientPreferencesDialog/connection_info_label");
+        robot.checkForPattern("ClientPreferencesDialog/user_name_label");
+        robot.checkForPattern("ClientPreferencesDialog/password_label");
+        robot.checkForPattern("ClientPreferencesDialog/storage_url_label");
+        robot.checkForPattern("ClientPreferencesDialog/save_entitlements_checked");
+        robot.saveScreenshot("testEditClientPreferencesWSTest2");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/GuiHostViewSmokeTest.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,90 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests;
+
+import static org.thermostat.qa2.framework.Assert.assertRuns;
+import org.thermostat.qa2.framework.Robot;
+import org.thermostat.qa2.framework.annotations.SetupStorage;
+import org.thermostat.qa2.framework.annotations.RunAgent;
+import org.thermostat.qa2.framework.annotations.RunGnomeKeyring;
+import org.thermostat.qa2.framework.annotations.RunStorage;
+import org.thermostat.qa2.framework.annotations.Test;
+import org.thermostat.qa2.framework.services.ThermostatGui;
+
+/**
+ * Test class ported from old framework
+ * @author Zdeněk Žamberský
+ */
+@SetupStorage(type = "mongo")
+@RunStorage
+@RunGnomeKeyring
+@RunAgent
+public class GuiHostViewSmokeTest {
+
+    @Test
+    public void overviewTab() throws Exception {
+        ThermostatGui gui = new ThermostatGui();
+        gui.start();
+        assertRuns(gui, "Gui should be running");
+
+        Robot robot = new Robot();
+        robot.clickOnVMView();
+        robot.makeScreenshot("HostViewOverviewTab1");
+        robot.checkForPattern("HostView/overview_tab_chosen");
+//        robot.checkForPattern("HostView/processor_tab");
+//        robot.checkForPattern("HostView/memory_tab");
+//        robot.checkForPattern("HostView/numa_tab");
+//        robot.saveScreenshot("HostViewOverviewTab2");
+//
+//        Rectangle from = robot.checkForPattern("MainWindow/resizable");
+//        robot.resize(from, 100, 0);
+//        robot.makeScreenshot("HostViewOverviewTabResized1");
+//
+//        robot.checkForPattern("HostView/tiny_host_label");
+//        robot.checkForPattern("HostView/tiny_id_label");
+//
+//        robot.checkForPattern("HostView/OverviewTab/basics_label");
+//        robot.checkForPattern("HostView/OverviewTab/host_label");
+//        robot.checkForPattern("HostView/OverviewTab/hw_label");
+//        robot.checkForPattern("HostView/OverviewTab/interface_label");
+//        robot.checkForPattern("HostView/OverviewTab/ipv4_address_label");
+//        robot.checkForPattern("HostView/OverviewTab/ipv6_address_label");
+//        robot.checkForPattern("HostView/OverviewTab/network_label");
+//        robot.checkForPattern("HostView/OverviewTab/os_kernel_label");
+//        robot.checkForPattern("HostView/OverviewTab/os_name_label");
+//        robot.checkForPattern("HostView/OverviewTab/processor_count_label");
+//        robot.checkForPattern("HostView/OverviewTab/processor_model_label");
+//        robot.checkForPattern("HostView/OverviewTab/sw_label");
+//        robot.checkForPattern("HostView/OverviewTab/total_memory_label");
+//        robot.makeScreenshot("HostViewOverviewTabResized2");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/OutputMessagesTest.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,192 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests;
+
+import java.io.File;
+import java.util.List;
+import static org.thermostat.qa2.framework.Assert.assertEquals;
+import org.thermostat.qa2.framework.NativeProcess;
+import org.thermostat.qa2.framework.ThermostatQAConfig;
+import org.thermostat.qa2.framework.annotations.SetupThermostat;
+import org.thermostat.qa2.framework.annotations.Test;
+import org.thermostat.qa2.framework.utils.FileUtilities;
+
+/**
+ * Test class ported from old framework
+ * @author Zdeněk Žamberský
+ */
+@SetupThermostat
+public class OutputMessagesTest {
+
+    public static void checkHelpMessage(String[] commands) throws Exception {
+        String fileName = "thermostat";
+        String[] allCommands = new String[commands.length + 1];
+        allCommands[0] = ThermostatQAConfig.getThermostatExecutablePath();
+
+        for (int i = 0; i < commands.length; ++i) {
+            fileName += "_" + commands[i];
+            allCommands[i + 1] = commands[i];
+        }
+
+        NativeProcess process = new NativeProcess(allCommands);
+        process.setEnvironmentVariable("USER_THERMOSTAT_HOME", ThermostatQAConfig.getThermostatUserHome());
+        process.setStdOutMode(NativeProcess.MODE_LOG_AND_BUFFER);
+        process.setLabel("thermostat");
+        process.start();
+        process.waitFor();
+        List<String> output = process.getStdoutLines();
+
+        fileName = ThermostatQAConfig.getThermostatOutputTextsDir() + File.separator + fileName + ".txt";
+        List<String> expected = FileUtilities.getLineListFromFile(fileName);
+
+        assertEquals(output, expected);
+    }
+
+    @Test
+    public void standardMessage() throws Exception {
+        String[] commands = {};
+        checkHelpMessage(commands);
+    }
+
+    @Test
+    public void helpMessage() throws Exception {
+        String[] commands = {"help"};
+        checkHelpMessage(commands);
+    }
+
+    @Test
+    public void agentHelpMessage() throws Exception {
+        String[] commands = {"help", "agent"};
+        checkHelpMessage(commands);
+    }
+
+    @Test
+    public void ConnectHelpMessage() throws Exception {
+        String[] commands = {"help", "connect"};
+        checkHelpMessage(commands);
+    }
+
+    @Test
+    public void DisconnectHelpMessage() throws Exception {
+        String[] commands = {"help", "disconnect"};
+        checkHelpMessage(commands);
+    }
+
+    @Test
+    public void dumpHeapHelpMessage() throws Exception {
+        String[] commands = {"help", "dump-heap"};
+        checkHelpMessage(commands);
+    }
+
+    @Test
+    public void findObjectsHelpMessage() throws Exception {
+        String[] commands = {"help", "find-objects"};
+        checkHelpMessage(commands);
+    }
+
+    @Test
+    public void findRootHelpMessage() throws Exception {
+        String[] commands = {"help", "find-root"};
+        checkHelpMessage(commands);
+    }
+
+    @Test
+    public void guiHelpMessage() throws Exception {
+        String[] commands = {"help", "gui"};
+        checkHelpMessage(commands);
+    }
+
+    @Test
+    public void listHeapDumpsHelpMessage() throws Exception {
+        String[] commands = {"help", "list-heap-dumps"};
+        checkHelpMessage(commands);
+    }
+
+    @Test
+    public void listVmsHelpMessage() throws Exception {
+        String[] commands = {"help", "list-vms"};
+        checkHelpMessage(commands);
+    }
+
+    @Test
+    public void objectInfoHelpMessage() throws Exception {
+        String[] commands = {"help", "object-info"};
+        checkHelpMessage(commands);
+    }
+
+    @Test
+    public void pingHelpMessage() throws Exception {
+        String[] commands = {"help", "ping"};
+        checkHelpMessage(commands);
+    }
+
+    @Test
+    public void saveHeapDumpToFileHelpMessage() throws Exception {
+        String[] commands = {"help", "save-heap-dump-to-file"};
+        checkHelpMessage(commands);
+    }
+
+    @Test
+    public void showHeapHistogramHelpMessage() throws Exception {
+        String[] commands = {"help", "show-heap-histogram"};
+        checkHelpMessage(commands);
+    }
+
+    @Test
+    public void serviceHelpMessage() throws Exception {
+        String[] commands = {"help", "service"};
+        checkHelpMessage(commands);
+    }
+
+    @Test
+    public void shellHelpMessage() throws Exception {
+        String[] commands = {"help", "shell"};
+        checkHelpMessage(commands);
+    }
+
+    @Test
+    public void storageHelpMessage() throws Exception {
+        String[] commands = {"help", "storage"};
+        checkHelpMessage(commands);
+    }
+
+    @Test
+    public void vmInfoHelpMessage() throws Exception {
+        String[] commands = {"help", "vm-info"};
+        checkHelpMessage(commands);
+    }
+
+    @Test
+    public void vmStatHelpMessage() throws Exception {
+        String[] commands = {"help", "vm-stat"};
+        checkHelpMessage(commands);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/ServicesSmokeTest.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,71 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests;
+
+import static org.thermostat.qa2.framework.Assert.assertTrue;
+import org.thermostat.qa2.framework.annotations.SetupStorage;
+import org.thermostat.qa2.framework.annotations.Test;
+import org.thermostat.qa2.framework.services.ThermostatService;
+import org.thermostat.qa2.framework.utils.ProcessUtilities;
+
+/**
+ * Test class ported from old framework
+ * @author Zdeněk Žamberský
+ */
+public class ServicesSmokeTest {
+
+    public int getNumberOfRunningMongos() throws Exception {
+        return ProcessUtilities.shellRunGetOutput("ps x | grep \"[m]ongod\" | grep -v mongodb24 || true").size();
+    }
+
+    public int getNumberOfRunningAgents() throws Exception {
+        return ProcessUtilities.shellRunGetOutput("jps | grep Thermostat || true").size();
+    }
+
+    @Test
+    @SetupStorage(type="mongo")
+    public void serviceTest() throws Exception {
+        assertTrue(getNumberOfRunningMongos() == 0, "there should be no db running before the test");
+        assertTrue(getNumberOfRunningAgents() == 0, "there should not be any agent running before the test");
+
+        ThermostatService service = new ThermostatService();
+        service.start();
+
+        assertTrue(getNumberOfRunningMongos() > 0, "the db should be running after service started");
+        assertTrue(getNumberOfRunningAgents() > 0, "there should be >0 running thermostat agents");
+
+        service.stop();
+
+        assertTrue(getNumberOfRunningMongos() == 0, "there should be no db running after the test");
+        assertTrue(getNumberOfRunningAgents() == 0, "there should not be any agent running after the test");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/SmokeTests.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,93 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import static org.thermostat.qa2.framework.Assert.assertTrue;
+import org.thermostat.qa2.framework.NativeProcess;
+import org.thermostat.qa2.framework.ThermostatQAConfig;
+import org.thermostat.qa2.framework.annotations.SetupThermostat;
+import org.thermostat.qa2.framework.annotations.Test;
+import org.thermostat.qa2.framework.utils.ProcessUtilities;
+
+/**
+ * Test class ported from old framework
+ * @author Zdeněk Žamberský
+ */
+@SetupThermostat
+public class SmokeTests {
+
+    @Test
+    public void checkPatchToThermostatExecutable() {
+        String path = ThermostatQAConfig.getThermostatExecutablePath();
+        File f = new File(path);
+        assertTrue(f.exists(), path + " does not exist");
+    }
+
+    @Test
+    public void checkIfThermostatExecutableCanBeRead() {
+        String path = ThermostatQAConfig.getThermostatExecutablePath();
+        File f = new File(path);
+        assertTrue(f.canRead(), path + " is not readable");
+    }
+
+    @Test
+    public void checkIfThermostatExecutableCanBeExecuted() {
+        String path = ThermostatQAConfig.getThermostatExecutablePath();
+        File f = new File(path);
+        assertTrue(f.canExecute(), path + " is not executable");
+    }
+
+    @Test
+    public void tryToRunThermostatExecutable() throws IOException, InterruptedException {
+        ProcessUtilities.runRaw(ThermostatQAConfig.getThermostatExecutablePath());
+    }
+
+    @Test
+    public void checkExitValue() throws IOException, InterruptedException {
+        int exitValue = ProcessUtilities.runRaw(ThermostatQAConfig.getThermostatExecutablePath());
+        assertTrue(exitValue == 0, "thermostat returned non-zero value");
+    }
+
+    @Test
+    public void checkStandardMessage() throws IOException, Exception {
+        NativeProcess process = new NativeProcess(ThermostatQAConfig.getThermostatExecutablePath());
+        process.setEnvironmentVariable("USER_THERMOSTAT_HOME", ThermostatQAConfig.getThermostatUserHome());
+        process.setStdOutMode(NativeProcess.MODE_LOG_AND_BUFFER);
+        process.start();
+        process.waitFor();
+        List<String> processOutput = process.getStdoutLines();
+        assertTrue(processOutput.size() > 0, "no output from process");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/StorageSmokeTest.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,102 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests;
+
+import java.util.List;
+import static org.thermostat.qa2.framework.Assert.assertTrue;
+import static org.thermostat.qa2.framework.Assert.assertContainsPatterns;
+import org.thermostat.qa2.framework.ThermostatQAConfig;
+import org.thermostat.qa2.framework.annotations.SetupStorage;
+import org.thermostat.qa2.framework.annotations.Test;
+import org.thermostat.qa2.framework.services.ThermostatStorage;
+
+/**
+ * Test class ported from old framework
+ * @author Zdeněk Žamberský
+ */
+@SetupStorage(type = "mongo")
+public class StorageSmokeTest {
+
+    public final static String[] START_PATTERNS = {
+        "starting storage server...",
+        "server listening on ip: mongodb://127.0.0.1:" + ThermostatQAConfig.mongoPort,
+        "log file is here:",
+        "pid: "
+    };
+
+    public static String[] STOP_PATTERNS = {
+        "server shutdown complete: ",
+        "log file is here:"
+    };
+
+    public static List<String> startStorageGetStdout() throws Exception {
+        ThermostatStorage storage = new ThermostatStorage();
+        storage.setStartStdoutBuffering(true);
+        storage.start();
+        return storage.getStartStdoutLines();
+    }
+
+    public static List<String> stopStorageGetStdout() throws Exception {
+        ThermostatStorage storage = new ThermostatStorage();
+        storage.setStopStdoutBuffering(true);
+        storage.start();
+        storage.stop();
+        return storage.getStopStdoutLines();
+    }
+
+    @Test
+    public void startStorageTest() throws Exception {
+        List<String> stdout = startStorageGetStdout();
+        assertTrue(stdout.size() > 0, "there should be stdout output on start");
+    }
+
+    @Test
+    public void stopStorageTest() throws Exception {
+        List<String> stdout = stopStorageGetStdout();
+        assertTrue(stdout.size() > 0, "there should be stdout output on start");
+    }
+
+    @Test
+    public void startStorageMessageTest() throws Exception {
+        List<String> stdout = startStorageGetStdout();
+        assertTrue(stdout.size() > 0, "there should be stdout output on start");
+        assertContainsPatterns(stdout, START_PATTERNS);
+
+    }
+
+    @Test
+    public void stopStorageMessageTest() throws Exception {
+        List<String> stdout = stopStorageGetStdout();
+        assertTrue(stdout.size() > 0, "there should be stdout output on start");
+        assertContainsPatterns(stdout, STOP_PATTERNS);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa2/tests/compatibility/DBCompatibilityTest.java	Tue Mar 10 13:48:12 2015 +0100
@@ -0,0 +1,85 @@
+/*
+ ThermostatQA - test framework for Thermostat Monitoring Tool
+
+ Copyright 2015 Red Hat, Inc.
+
+ This file is part of ThermostatQA
+
+ ThermostatQA is distributed under the GNU General Public License,
+ version 2 or any later version (with a special exception described
+ below, commonly known as the "Classpath Exception").
+
+ A copy of GNU General Public License (GPL) is included in this
+ distribution, in the file COPYING.
+
+ Linking ThermostatQA code with other modules is making a combined work
+ based on ThermostatQA.  Thus, the terms and conditions of the GPL
+ cover the whole combination.
+
+ As a special exception, the copyright holders of ThermostatQA 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 ThermostatQA code.  If you modify ThermostatQA, you may
+ extend this exception to your version of the software, but you are
+ not obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+package org.thermostat.qa2.tests.compatibility;
+
+import static org.thermostat.qa2.framework.Assert.*;
+import org.thermostat.qa2.framework.annotations.SetupStorage;
+import org.thermostat.qa2.framework.annotations.Test;
+import org.thermostat.qa2.framework.annotations.ThermostatSetupTarget;
+import org.thermostat.qa2.framework.services.ThermostatAgent;
+import org.thermostat.qa2.framework.services.ThermostatStorage;
+
+/**
+ *
+ * @author Zdeněk Žamberský
+ */
+// setup "mongo" storage for "other" thermostat before every test
+@SetupStorage(type = "mongo")
+@ThermostatSetupTarget("other")
+public class DBCompatibilityTest {
+
+    @Test
+    public void simpleStorageTest() throws Exception {
+        // "other" thermostat
+        ThermostatStorage thermostatOtherStorage = new ThermostatStorage("other");
+        thermostatOtherStorage.start();
+        Thread.sleep(5000);
+        thermostatOtherStorage.stop();
+
+        // "tested" thermostat
+        ThermostatStorage thermostatStorage = new ThermostatStorage("tested");
+        thermostatStorage.start(); // if it fails to start it throws exception
+        // thermostatStorage is stopped automatically by framework       
+    }
+
+    @Test
+    public void simpleStorageAgentTest() throws Exception {
+        // "other" thermostat
+        ThermostatStorage thermostatOtherStorage = new ThermostatStorage("other");
+        ThermostatAgent thermostatOtherAgent = new ThermostatAgent("other");
+        thermostatOtherStorage.start();
+        thermostatOtherAgent.start();
+        Thread.sleep(10000);
+        assertTrue(thermostatOtherAgent.isRunning(), "Agent should be running");
+        thermostatOtherAgent.stop();
+        thermostatOtherStorage.stop();
+
+        // "tested" thermostat
+        ThermostatStorage thermostatStorage = new ThermostatStorage("tested");
+        ThermostatAgent thermostatAgent = new ThermostatAgent("tested");
+        thermostatStorage.start();
+        thermostatAgent.start();
+        Thread.sleep(10000);
+        assertTrue(thermostatAgent.isRunning(), "Agent should be running");
+        // thermostat storage and agent are stopped automatically by framework       
+    }
+
+}
--- a/storageconfig/keyrings/Default.keyring	Tue Mar 10 13:38:36 2015 +0100
+++ b/storageconfig/keyrings/Default.keyring	Tue Mar 10 13:48:12 2015 +0100
@@ -5,6 +5,23 @@
 lock-on-idle=false
 lock-after=false
 
+[3]
+item-type=0
+display-name=Thermostat auth info for: time-for-tea@http://127.0.0.1:8080/thermostat/storage
+secret=aaargh
+mtime=1421860675
+ctime=1421860675
+
+[3:attribute0]
+name=url
+type=string
+value=http://127.0.0.1:8080/thermostat/storage
+
+[3:attribute1]
+name=username
+type=string
+value=time-for-tea
+
 [2]
 item-type=0
 display-name=Thermostat auth info for: client-tester@mongodb://127.0.0.1:27518