Mercurial > hg > ThermostatQA
changeset 186:7bc828291ea4
Added support for packed thermostat (non-webstorage tests)
Changes:
Makefile:
- introduced new makefile variables THERMOSTAT_HOME_DIR and
THERMOSTAT_OTHER_HOME_DIR - by setting them manually it is possible to test
packed thermostat
src/org/thermostat/qa2/framework/ThermostatQAConfig.java:
- single user is now used for client, agent when mongo storage is configured
(that configured with thermostat-setup)
src/org/thermostat/qa2/framework/utils/ThermostatUtilities.java:
- added support for thermostat-setup (in addition to thermostat-devsetup
which is not present in packed thermostat)
- removed creating new mongo users, which are not needed now
storageconfig/keyrings/Default.keyring
- updated config for gnome keyring
src/org/thermostat/qa2/tests/ShellCommandsTest.java
- test is now using method to get client login instead of field
as required now
src/org/thermostat/qa2/tests/ServicesSmokeTest.java
- added delay after stoping service, before checking port (not related)
author | Zdenek Zambersky <zzambers@redhat.com> |
---|---|
date | Fri, 22 May 2015 01:23:01 +0200 |
parents | 3ec1dcfecb16 |
children | 877b403e8344 |
files | Makefile src/org/thermostat/qa2/framework/ThermostatQAConfig.java src/org/thermostat/qa2/framework/utils/ThermostatUtilities.java src/org/thermostat/qa2/tests/ServicesSmokeTest.java src/org/thermostat/qa2/tests/ShellCommandsTest.java storageconfig/keyrings/Default.keyring |
diffstat | 6 files changed, 31 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Fri May 15 19:12:02 2015 +0200 +++ b/Makefile Fri May 22 01:23:01 2015 +0200 @@ -43,11 +43,13 @@ THERMOSTAT_REPO_URL=http://icedtea.classpath.org/hg/thermostat/ THERMOSTAT_USER_DIR=$(BUILD_DIR)/.thermostat THERMOSTAT_DIR=$(BUILD_DIR)/thermostat +THERMOSTAT_HOME_DIR=$(THERMOSTAT_DIR)/distribution/target/image THERMOSTAT_WEB_DEPLOY_DIR=$(TOMCAT_DIR)/webapps/thermostat # refers to thermostat against which compatibility is tested THERMOSTAT_OTHER_VERSION=1.2 THERMOSTAT_OTHER_DIR=$(BUILD_DIR)/thermostat-other +THERMOSTAT_OTHER_HOME_DIR=$(THERMOSTAT_OTHER_DIR)/distribution/target/image THERMOSTAT_OTHER_REPO_URL=http://icedtea.classpath.org/hg/release/thermostat-1.2/ JAPI_COMPILANCE_CHECKER_VERSION=1.3.7 @@ -125,10 +127,10 @@ USER_THERMOSTAT_HOME=$(THERMOSTAT_USER_DIR) \ $(JAVA) -cp $(CLASSES_DIR) \ -Dtomcat.home=$(TOMCAT_DIR) \ - -Dthermostat.home=$(THERMOSTAT_DIR)/distribution/target/image \ + -Dthermostat.home=$(THERMOSTAT_HOME_DIR) \ -Dthermostat.user.home=$(THERMOSTAT_USER_DIR) \ -Dthermostat.executable.name=thermostat \ - -Dthermostat.executable.path=$(THERMOSTAT_DIR)/distribution/target/image/bin \ + -Dthermostat.executable.path=$(THERMOSTAT_HOME_DIR)/bin \ -Dthermostat.webapp.path=$(THERMOSTAT_DIR)/web/war/target \ -Dthermostat.version=$(THERMOSTAT_VERSION) \ -Dscreenshot.source=$(SCREENSHOT_SOURCE) \ @@ -150,12 +152,12 @@ USER_THERMOSTAT_HOME=$(THERMOSTAT_USER_DIR) \ $(JAVA) -cp $(CLASSES_DIR) \ -Dtomcat.home=$(TOMCAT_DIR) \ - -Dthermostat.home=$(THERMOSTAT_DIR)/distribution/target/image \ + -Dthermostat.home=$(THERMOSTAT_HOME_DIR) \ -Dthermostat.user.home=$(THERMOSTAT_USER_DIR) \ - -Dthermostat.executable.path=$(THERMOSTAT_DIR)/distribution/target/image/bin \ + -Dthermostat.executable.path=$(THERMOSTAT_HOME_DIR)/bin \ -Dthermostat.version=$(THERMOSTAT_VERSION) \ -Dthermostat.webapp.path=$(THERMOSTAT_DIR)/web/war/target \ - -Dthermostat.other.home=$(THERMOSTAT_OTHER_DIR)/distribution/target/image \ + -Dthermostat.other.home=$(THERMOSTAT_OTHER_HOME_DIR) \ -Dthermostat.other.version=$(THERMOSTAT_OTHER_VERSION) \ -Dthermostat.other.webapp.path=$(THERMOSTAT_OTHER_DIR)/web/war/target \ -Dgnome-keyring.config.path=$(GNOME_KEYRING_USER_DATA_DIR) \ @@ -362,12 +364,12 @@ cp -rT "$$( echo $(THERMOSTAT_DIR)/web/war/target/*.war | sed 's/.war$$//g' )" $(THERMOSTAT_WEB_DEPLOY_DIR) .PHONY: thermostat-build -thermostat-build: | $(THERMOSTAT_DIR)/distribution/target/image - -$(THERMOSTAT_DIR)/distribution/target/image: | $(THERMOSTAT_DIR)/pom.xml +thermostat-build: | $(THERMOSTAT_HOME_DIR) + +$(THERMOSTAT_HOME_DIR): | $(THERMOSTAT_DIR)/pom.xml cd $(THERMOSTAT_DIR) &&\ mvn -Dmaven.test.skip=true clean install - + $(THERMOSTAT_DIR)/pom.xml: | $(THERMOSTAT_DIR) hg clone $(THERMOSTAT_REPO_URL) $(THERMOSTAT_DIR) @@ -375,9 +377,9 @@ mkdir -p $(THERMOSTAT_DIR) .PHONY: thermostat-other-build -thermostat-other-build: | $(THERMOSTAT_OTHER_DIR)/distribution/target/image +thermostat-other-build: | $(THERMOSTAT_OTHER_HOME_DIR) -$(THERMOSTAT_OTHER_DIR)/distribution/target/image: | $(THERMOSTAT_OTHER_DIR)/pom.xml +$(THERMOSTAT_OTHER_HOME_DIR): | $(THERMOSTAT_OTHER_DIR)/pom.xml cd $(THERMOSTAT_OTHER_DIR) &&\ mvn -Dmaven.test.skip=true clean install
--- a/src/org/thermostat/qa2/framework/ThermostatQAConfig.java Fri May 15 19:12:02 2015 +0200 +++ b/src/org/thermostat/qa2/framework/ThermostatQAConfig.java Fri May 22 01:23:01 2015 +0200 @@ -32,6 +32,7 @@ import java.io.File; import java.io.PrintStream; +import org.thermostat.qa2.framework.utils.ThermostatUtilities; /** * @@ -171,15 +172,15 @@ } public static Login getAgentLogin() { - return agentLogin; + return ThermostatUtilities.isWebStorageConfigured() ? agentLogin : mongoLogin; } public static Login getClientLogin() { - return clientLogin; + return ThermostatUtilities.isWebStorageConfigured() ? clientLogin : mongoLogin; } public static Login getCommandChannelLogin() { - return clientLogin; + return ThermostatUtilities.isWebStorageConfigured() ? clientLogin : mongoLogin; } public static Login getAgentBadLogin() {
--- a/src/org/thermostat/qa2/framework/utils/ThermostatUtilities.java Fri May 15 19:12:02 2015 +0200 +++ b/src/org/thermostat/qa2/framework/utils/ThermostatUtilities.java Fri May 22 01:23:01 2015 +0200 @@ -68,11 +68,15 @@ NativeProcess process; CommonUtilities.printHeading("Running Thermostat setup ..."); String setupPath1 = thermostatHome + File.separator + "bin" + File.separator + "thermostat-devsetup"; - String setupPath2 = thermostatHome + File.separator + "bin" + File.separator + "thermostat-setup-user-home"; + String setupPath2 = thermostatHome + File.separator + "bin" + File.separator + "thermostat-setup"; + String setupPath3 = thermostatHome + File.separator + "bin" + File.separator + "thermostat-setup-user-home"; if (new File(setupPath1).exists()) { process = new NativeProcess(setupPath1); } else if (new File(setupPath2).exists()) { - process = new NativeProcess(setupPath2); + Login mongoLogin = ThermostatQAConfig.getMongoLogin(); + process = new NativeProcess("bash", "-c", "echo -e \"yes\\n" + mongoLogin.getUsername() + "\\n" + mongoLogin.getPassword() + "\\n" + mongoLogin.getPassword() + "\\n\" | " + setupPath2); + } else if (new File(setupPath3).exists()) { + process = new NativeProcess(setupPath3); } else { throw new Exception("script to setup thermostat cannot be found in: " + thermostatHome + File.separator + "bin"); } @@ -86,9 +90,7 @@ it does not modify existing storage (database), it can also start backup services if reqested */ public static void setupStorage(String setupTarget, boolean web, boolean badAgentLogin, boolean badClientLogin, boolean agentSaveOnExit, boolean backupThermostatConfig, boolean backupUserHome) throws Exception { - if (!web) { - setupDefaultMongoUsers(setupTarget); - } else { + if (web) { deployThermostatWebApp(setupTarget); String tomcatHome = ThermostatQAConfig.getTomcatHome();
--- a/src/org/thermostat/qa2/tests/ServicesSmokeTest.java Fri May 15 19:12:02 2015 +0200 +++ b/src/org/thermostat/qa2/tests/ServicesSmokeTest.java Fri May 22 01:23:01 2015 +0200 @@ -34,6 +34,7 @@ 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.CommonUtilities; import org.thermostat.qa2.framework.utils.ProcessUtilities; /** @@ -63,6 +64,8 @@ assertTrue(getNumberOfRunningAgents() > 0, "there should be >0 running thermostat agents"); service.stop(); + + CommonUtilities.sleep(2000); 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");
--- a/src/org/thermostat/qa2/tests/ShellCommandsTest.java Fri May 15 19:12:02 2015 +0200 +++ b/src/org/thermostat/qa2/tests/ShellCommandsTest.java Fri May 22 01:23:01 2015 +0200 @@ -105,7 +105,7 @@ public static void connect(Shell shell) throws IOException { shell.writeln("connect -d " + ThermostatQAConfig.getStroageUrl(false)); - Login login = ThermostatQAConfig.clientLogin; + Login login = ThermostatQAConfig.getClientLogin(); shell.writeln(login.getUsername()); shell.writeln(login.getPassword()); }
--- a/storageconfig/keyrings/Default.keyring Fri May 15 19:12:02 2015 +0200 +++ b/storageconfig/keyrings/Default.keyring Fri May 22 01:23:01 2015 +0200 @@ -24,8 +24,8 @@ [2] item-type=0 -display-name=Thermostat auth info for: client-tester@mongodb://127.0.0.1:27518 -secret=heslo2 +display-name=Thermostat auth info for: mongodevuser@mongodb://127.0.0.1:27518 +secret=mongodevpassword mtime=1411732260 ctime=1411732260 @@ -37,7 +37,7 @@ [2:attribute1] name=username type=string -value=client-tester +value=mongodevuser [1] item-type=0