use of ee.jakarta.tck.ws.rs.common.webclient.WebTestCase in project jaxrs-api by eclipse-ee4j.
the class JAXRSCommonClient method invoke.
/*
* protected methods
* ========================================================================
*/
/**
* <PRE>
* Invokes a test based on the properties
* stored in TEST_PROPS. Once the test has completed,
* the properties in TEST_PROPS will be cleared.
* </PRE>
*
* @throws Fault
* If an error occurs during the test run
*/
protected void invoke() throws Fault {
TestUtil.logTrace("[JAXRSCommonClient] invoke");
try {
_testCase = new WebTestCase();
setTestProperties(_testCase);
TestUtil.logTrace("[JAXRSCommonClient] EXECUTING");
if (_useSavedState && _state != null) {
_testCase.getRequest().setState(_state);
}
if (_redirect != false) {
TestUtil.logTrace("##########Call setFollowRedirects");
_testCase.getRequest().setFollowRedirects(_redirect);
}
_testCase.execute();
if (_saveState) {
_state = _testCase.getResponse().getState();
}
} catch (TestFailureException tfe) {
Throwable t = tfe.getRootCause();
if (t != null) {
TestUtil.logErr("Root cause of Failure: " + t.getMessage(), t);
if (t instanceof RuntimeException) {
throw (RuntimeException) t;
} else if (t instanceof Error) {
throw (Error) t;
} else {
throw new RuntimeException(t);
}
}
throw new Fault("[JAXRSCommonClient] " + _testName + " failed! Check output for cause of failure.", tfe);
} finally {
_useSavedState = false;
_saveState = false;
_redirect = false;
clearTestProperties();
}
}
Aggregations