Mercurial > hg > ThermostatQA
view src/org/thermostat/qa2/framework/ThermostatQAConfig.java @ 181:e37e710e45df
added support for compatibility tests and some other improvements (generating thermostat config files from templates, posiblity to show @Before methods logs in report, ...)
Changes:
Makefile:
- added targets new for compatibility testing (and report generation)
src/org/thermostat/qa2/framework/utils/ThermostatUtilities.java:
- all thermostat and storage configuration code moved from TestRunner to ThermostatUtilities class
- webapp deployment (tomcat) is moved from makefile to testsuite (ThermostatUtilities class)
- storage configuration files are now generated from templates,
which are placed in templates directory
- added helper methods, which make using thermostat shell simpler
src/org/thermostat/qa2/framework/utils/ThermostatUtilities.java:
- code needed for replacing patterns moved from reporters Generator class to CommonUtilities class
(because it is now also used to generate config files from templates)
src/org/thermostat/qa2/reporter/Generator.java:
src/org/thermostat/qa2/reporter/LogParser.java:
src/org/thermostat/qa2/reporter/result/TestClassResult.java:
src/org/thermostat/qa2/framework/TestRunner.java
- added possibility to show logs of methods annotaded with @Before annotation,
when some of tests in that their test class failes
src/org/thermostat/qa2/tests/DBCommandsHeapDumpTest.java:
- code updated to use new methods from ThermostatUtilities class
src/org/thermostat/qa2/framework/annotations/SetupStorage.java
- it is now possible set SAVE_ON_EXIT property in agent.properties using this annotation
src/org/thermostat/qa2/framework/services/ThermostatStorage.java
- framework is now not waiting for timeout, when message about thermostat setup is displayed
src/org/thermostat/qa2/framework/ThermostatQAConfig.java
- added/updated to contain framework new configuration data,
removed code not needed anymore
templates/storage-config/*
- added thermostat config files templates
author | Zdenek Zambersky <zzambers@redhat.com> |
---|---|
date | Fri, 15 May 2015 18:51:56 +0200 |
parents | e78173df9ba0 |
children | 40990362e151 |
line wrap: on
line source
/* 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.framework; import java.io.File; import java.io.PrintStream; /** * * @author Zdeněk Žamberský */ public class ThermostatQAConfig { public static PrintStream logStream = System.out; public static String tomcatHome; public static int mongoPort = 27518; public static int agentPort = 12000; public static int webStoragePort = 8080; public static String gnomeKeyringConfigDir; public static String backupDir; public static String logsDir; public static String reportDir; public static Login mongoLogin = new Login("mongodevuser", "mongodevpassword"); public static Login agentLogin = new Login("agent-tester", "heslo1"); public static Login clientLogin = new Login("client-tester", "heslo2"); public static Login agentBadLogin = new Login("doctor-evil", "mini-me"); public static Login clientBadLogin = new Login("time-for-tea", "aaargh"); /////////////////////// // tested thermostat // /////////////////////// public static String thermostatHome; public static String thermostatUserHome; public static String thermostatVersion; public static String thermostatWebAppDir; ////////////////////// // other thermostat // ////////////////////// public static String thermostatOtherHome; //static String ThermostatOtherUserHome; public static String thermostatOtherVersion; public static String thermostatOtherWebAppDir; static { tomcatHome = System.getProperty("tomcat.home"); thermostatHome = System.getProperty("thermostat.home"); thermostatUserHome = System.getProperty("thermostat.user.home"); thermostatVersion = System.getProperty("thermostat.version"); thermostatWebAppDir = System.getProperty("thermostat.webapp.path"); thermostatOtherHome = System.getProperty("thermostat.other.home"); thermostatOtherVersion = System.getProperty("thermostat.other.version"); thermostatOtherWebAppDir = System.getProperty("thermostat.other.webapp.path"); gnomeKeyringConfigDir = System.getProperty("gnome-keyring.config.path"); backupDir = System.getProperty("backup.path"); logsDir = System.getProperty("logs.path"); reportDir = System.getProperty("reports.path"); } static String getPatternsDir() { return "." + File.separator + "patterns" + File.separator + "1.1.0" + File.separator + "noAA"; } // true -> tested, false -> other static boolean getTargetAsBoolean(String target) { if (target.equals("tested")) { return true; } else if (target.equals("other")) { return false; } else { throw new IllegalArgumentException("Invalid target thermostat: " + target); } } // true -> web, false -> mongo static boolean getStorageTypeAsBoolean(String storageType) { if (storageType.equals("web")) { return true; } else if (storageType.equals("mongo")) { return false; } else { throw new IllegalArgumentException("Invalid storage type: " + storageType); } } public static String getTomcatHome() { return tomcatHome; } public static String getWebAppPath(String target) { String dir = getTargetAsBoolean(target) ? thermostatWebAppDir : thermostatOtherWebAppDir; File dirFile = new File(dir); File[] files = dirFile.listFiles(); for (File f : files) { String name = f.getName(); if (name.toLowerCase().endsWith(".war")) { return dir + File.separator + name.substring(0, name.length() - 4); } } throw new IllegalArgumentException("web app not found"); } public static String getThermostatHome(String target) { return getTargetAsBoolean(target) ? thermostatHome : thermostatOtherHome; } public static String getThermostatUserHome() { return getThermostatUserHome("tested"); } public static String getThermostatUserHome(String target) { return thermostatUserHome; } public static String getThermostatVersion(String target) { return getTargetAsBoolean(target) ? thermostatVersion : thermostatOtherVersion; } public static String getThermostatExecutablePath() { return getThermostatExecutablePath("tested"); } public static String getThermostatExecutablePath(String target) { return getThermostatHome(target) + File.separator + "bin" + File.separator + "thermostat"; } public static String getThermostatOutputTextsDir() { return "." + File.separator + "outputtexts" + File.separator + thermostatVersion; } public static Login getMongoLogin() { return mongoLogin; } public static Login getAgentLogin() { return agentLogin; } public static Login getClientLogin() { return clientLogin; } public static Login getCommandChannelLogin() { return clientLogin; } public static Login getAgentBadLogin() { return agentBadLogin; } public static Login getClientBadLogin() { return clientBadLogin; } public static String getStroageUrl(boolean web) { return web ? "http://127.0.0.1:" + webStoragePort + "/thermostat/storage" : "mongodb://127.0.0.1:" + mongoPort; } public static class Login { String username; String password; public Login(String username, String password) { this.username = username; this.password = password; } public String getUsername() { return username; } public String getPassword() { return password; } } }