Mercurial > hg > ThermostatQA
view src/org/thermostat/qa2/tests/CliClientAgentInfoTest.java @ 203:a74aa91ab44c
Fixed setup/gnome-keyring/collections + added debugging
changes:
org.thermostat.qa2.framework.services.GnomeKeyring:
- changed way how gnome-keyring is started (+ now encrypted)
org.thermostat.qa2.framework.services.ShellService:
- fix for arguments with spaces
org.thermostat.qa2.framework.services.ThermostatAgent:
org.thermostat.qa2.framework.services.ThermostatGui:
org.thermostat.qa2.framework.services.ThermostatService:
org.thermostat.qa2.framework.services.ThermostatStorage:
- thermostat is now started with collection enabled when configured.
org.thermostat.qa2.framework.utils.FileUtilities:
- copyFile method now operates recursively on directories
org.thermostat.qa2.framework.utils.ProcessUtilities:
- new helper functions to run command witch collection enabled,
handle arguments with spaces
org.thermostat.qa2.framework.utils.ThermostatUtilities:
- fixed method performing thermostat setup
- new helper functions to get thermostat command line, passing of credentials
removed from shell helper function
org.thermostat.qa2.framework.NativeProcess:
- logging of command which has arguments with spaces fixed
org.thermostat.qa2.framework.TestRunner:
- changes related to thermostat setup, gnome-keyring startup
- added support for debugging
org.thermostat.qa2.framework.ThermostatQAConfig:
Makefile:
- support of new properties required for debugging, gnome-keyring,
collections support
org.thermostat.qa2.framework.tests.*:
- changes to tests which operate on thermostat shell,
credentials no longer needed (use keyring)
author | Zdenek Zambersky <zzambers@redhat.com> |
---|---|
date | Mon, 30 Nov 2015 19:08:04 +0100 |
parents | 5d335809cd51 |
children |
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.tests; 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.annotations.RunAgent; import org.thermostat.qa2.framework.utils.CommonUtilities; import org.thermostat.qa2.framework.utils.ProcessUtilities; /** * Test class using thermostat shell - testing commands list-agents * and agents-info. * * @author jfabriko */ @SetupStorage(type = "mongo") @RunGnomeKeyring @RunStorage public class CliClientAgentInfoTest { String[] patternListAgents = { "Thermostat version ", "Thermostat - > list-agents", "Agent ID", "Command Channel", "Address", "Start Time", "Stop Time", "Currently Active", "Thermostat + > exit"}; String[] patternAgentInfo = { "Thermostat version ", "Thermostat - > agent-info -a ", "Agent ID ", "Command Channel Address ", "Start Time ", "Stop Time Currently Active", "Backend Status Description", "System Backend Active Gathers basic information from the system", "Host CPU Backend Active Gathers CPU statistics about a host", "VM CPU Backend Active Gathers CPU statistics about a JVM", "Host Memory Backend Active Gathers memory statistics about a host", "VM GC Backend Active Gathers garbage collection statistics about a JVM", "VM Classes Backend Active Gathers class loading statistics about a JVM", "VM Memory Backend Active Gathers memory statistics about a JVM", "NUMA Backend Active Gathers NUMA statistics about a host", "VM IO Backend Active Gathers IO statistics about a JVM", "VM Thread Counting Backend Active Gathers thread counts for a JVM", "VM Thread Backend Active Gathers thread information about a JVM", "VM JMX Backend Active gathers JMX information using JMX", "Thermostat + > exit"}; public String getAgentIdFromListAgents() throws Exception{ //shell list agents Shell thermostat = ProcessUtilities.createThermostatShell(); thermostat.setEnvironmentVariable("USER_THERMOSTAT_HOME", ThermostatQAConfig.getThermostatUserHome()); thermostat.setStdOutMode(NativeProcess.MODE_LOG_AND_BUFFER); thermostat.start(); thermostat.writeln("list-agents"); thermostat.writeln("exit"); thermostat.waitFor(); List<String> output = thermostat.getStdoutLines(); //check output Assert.assertContainsPatterns(output, patternListAgents); //preparate agent id int index = CommonUtilities.getLineIndex(output, "Agent ID", false); return output.get(index + 1).split(" ")[0]; } public void checkAgentInfo(String agentId) throws Exception { Shell thermostat = ProcessUtilities.createThermostatShell(); thermostat.setEnvironmentVariable("USER_THERMOSTAT_HOME", ThermostatQAConfig.getThermostatUserHome()); thermostat.setStdOutMode(NativeProcess.MODE_LOG_AND_BUFFER); thermostat.start(); thermostat.writeln("agent-info -a "+agentId); thermostat.writeln("exit"); thermostat.waitFor(); List<String> output = thermostat.getStdoutLines(); //check agent info in output Assert.assertContainsPatterns(output, patternAgentInfo); } @Test @RunAgent public void agentInfo() throws Exception { //get the login data String agentId = getAgentIdFromListAgents(); //run shell again + agent info checkAgentInfo(agentId); } }