use of com.axway.ats.log.autodb.TestCaseState in project ats-framework by Axway.
the class AgentWsImpl method onTestEnd.
/**
* Web method for ending a testcase
*/
@WebMethod
public void onTestEnd() {
final String caller = getCaller();
ThreadsPerCaller.registerThread(caller);
TestCaseState currentState = log.getCurrentTestCaseState();
try {
/* If the agent is not configured, this means we are coming here for second time during same test.
* Ignore this event.
*/
if (currentState != null && currentState.isInitialized()) {
log.leaveTestCase();
// take care of chained ATS agents(if there are any)
TestcaseStateEventsDispacher.getInstance().onTestEnd();
}
} finally {
ThreadsPerCaller.unregisterThread();
}
}
use of com.axway.ats.log.autodb.TestCaseState in project ats-framework by Axway.
the class AgentWsImpl method onTestStart.
/**
* Web method for starting a testcase
*
* @param testCaseState contains the id of the test case in the logging system (if passive logging is to be used, otherwise pass null)
* @throws AgentException if any error occurs
*/
/* TODO:
* add possibility for the user to set whether all queues from this agent have to be stopped
* each time a new run, from a different caller to the same agent are started
*/
@WebMethod
public void onTestStart(@WebParam(name = "testCaseState") TestCaseState testCaseState) throws AgentException {
if (testCaseState == null) {
// the user has not initialized our DB appender on the Test Executor side
return;
}
final String caller = getCaller();
ThreadsPerCaller.registerThread(caller);
try {
// cancel all action tasks, that are started on an agent, locate on the current caller host.
// current caller and the agent must have the same IP, in order for queue to be cancelled
MultiThreadedActionHandler.cancellAllQueuesFromAgent(caller);
// get the current state on the remote machine
TestCaseState currentState = log.getCurrentTestCaseState();
boolean joinToNewTescase = true;
if (currentState != null && currentState.isInitialized()) {
/* This agent is already configured.
*
* Now check if the state is the same as the new one, this would mean we are trying to
* configure this agent for second time.
* This is normal as we get here when Test Executor or another agent calls this agent for first time.
*
* If the state is different, we hit an error which means this agent did not get On Test End event
* for the previous test case.
*/
if (!currentState.equals(testCaseState)) {
log.error("This test appears to be aborted by the user on the test executor side, but it kept running on the agent side." + " Now we cancel any further logging from the agent.");
log.leaveTestCase();
} else {
joinToNewTescase = false;
}
}
if (joinToNewTescase) {
// connect to the new test case
log.joinTestCase(testCaseState);
// take care of chained ATS agents(if there are any)
TestcaseStateEventsDispacher.getInstance().onTestStart();
}
logClassPath(testCaseState);
} finally {
ThreadsPerCaller.unregisterThread();
}
}
Aggregations