Class BaseUrlClient
java.lang.Object
com.sun.ts.tests.common.base.EETest
com.sun.ts.tests.common.webclient.BaseUrlClient
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AbstractUrlClient,SecBasicClient
Provides base test initialization and runtime logic into a common class. All test areas will need to extend this class to provided area specific functionality needed for that particular technology.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringContext root of target testsprotected StringGeneral file/request URI for both gfiles and testsprotected StringTarget webserver hostnameprotected intTarget webserver portProperties parametersprotected booleanprotected booleanSave state.protected org.apache.commons.httpclient.HttpStateHttpState that may be used for multiple invocations requiring state.protected WebTestCaseTest case.protected StringCurrent test nameprotected Stringlocation of _tsHomeprotected booleanUse saved state.protected static final StringBasic Auth passwordprotected static final StringBasic Auth realmprotected static final StringBasic Auth usernameprotected static final StringContent propertyprotected static final String100 - continueprotected static final String201 - createdprotected static final StringExpect response body propertyprotected static final StringExpected headers propertyprotected StringFollow redirect.protected static final String403 - Forbiddenprotected static final StringDefault request methodprotected static final StringGoldenfile suffixprotected static final StringGoldenfile propertyprotected StringGoldenfile directoryprotected static final String410 - GONEprotected static final StringHTTP 1.0protected static final StringHTTP 1.1protected static final StringIgnore response bodyprotected static final StringIgnore HTTP status codesprotected static final String500 - internal server errorprotected static final StringJSP suffixprotected static final String411 - length requiredprotected static final String302 - moved temporarilyprotected static final String404 - not foundprotected static final String200 - okprotected static final StringReason-Phrase propertyprotected static final StringRequest propertyprotected static final StringRequest headers propertyprotected static final StringResponse Match propertyprotected static final StringSave current HTTP state.protected static final StringSearch string propertyprotected static final StringSearch string case insensitive propertyprotected static final String503 - service unavailableprotected static final StringTS Webserver host propertyprotected static final StringTS Webserver port propertyprotected static final StringForward slashprotected static final StringStandard test propertyprotected static final StringStatusCode propertyprotected static final StringValidation strategyprotected static final StringTest name propertyprotected static final PropertiesTest propertiesprotected StringCurrent test directoryprotected static final StringTS home propertyprotected static final String401 - Unauthorizedprotected static final StringUnexpected header propertyprotected static final StringUnexpected response match propertyprotected static final StringUnordered search string propertyprotected static final StringUse any saved stateFields inherited from class com.sun.ts.tests.common.base.EETest
err, iLogDelaySeconds, log, sTestCase -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()cleanupis called by the test harness to cleanup after text executionprotected voidinvoke()Invokes a test based on the properties stored in TEST_PROPS.voidsetContextRoot(String root) voidsetGeneralURI(String URI) voidsetGoldenFileDir(String goldenDir) Sets the goldenfile directoryvoidsetTestDir(String testDir) setTestDirsets the current test directory.protected voidsetTestProperties(WebTestCase testCase) Sets the appropriate test properties based on the values stored in TEST_PROPSvoidsetup(String[] args, Properties p) setupis by the test harness to initialize the tests.Methods inherited from class com.sun.ts.tests.common.base.EETest
getPropsReady, getTestPropsFromArgs, initializeProperties, logErr, logErr, logMsg, logTrace, logTrace, run, run, run, run, runAllTestCases, setTestStatus
-
Field Details
-
_props
Properties parameters -
UNAUTHORIZED
401 - Unauthorized- See Also:
-
FORBIDDEN
403 - Forbidden- See Also:
-
NOT_FOUND
404 - not found- See Also:
-
OK
200 - ok- See Also:
-
CREATED
201 - created- See Also:
-
INTERNAL_SERVER_ERROR
500 - internal server error- See Also:
-
SERVICE_UNAVAILABLE
503 - service unavailable- See Also:
-
CONTINUE
100 - continue- See Also:
-
MOVED_TEMPORARY
302 - moved temporarily- See Also:
-
GONE
410 - GONE- See Also:
-
LENGTH_REQUIRED
411 - length required- See Also:
-
SERVLETHOSTPROP
TS Webserver host property- See Also:
-
SERVLETPORTPROP
TS Webserver port property- See Also:
-
TSHOME
TS home property- See Also:
-
TEST_PROPS
Test properties -
STATUS_CODE
StatusCode property- See Also:
-
REASON_PHRASE
Reason-Phrase property- See Also:
-
EXPECTED_HEADERS
Expected headers property- See Also:
-
UNEXPECTED_HEADERS
Unexpected header property- See Also:
-
EXPECT_RESPONSE_BODY
Expect response body property- See Also:
-
REQUEST
Request property- See Also:
-
REQUEST_HEADERS
Request headers property- See Also:
-
GOLDENFILE
Goldenfile property- See Also:
-
SEARCH_STRING
Search string property- See Also:
-
SEARCH_STRING_IGNORE_CASE
Search string case insensitive property- See Also:
-
BASIC_AUTH_USER
Basic Auth username- See Also:
-
BASIC_AUTH_PASSWD
Basic Auth password- See Also:
-
BASIC_AUTH_REALM
Basic Auth realm- See Also:
-
UNORDERED_SEARCH_STRING
Unordered search string property- See Also:
-
CONTENT
Content property- See Also:
-
TEST_NAME
Test name property- See Also:
-
RESPONSE_MATCH
Response Match property- See Also:
-
UNEXPECTED_RESPONSE_MATCH
Unexpected response match property- See Also:
-
STANDARD
Standard test property- See Also:
-
IGNORE_BODY
Ignore response body- See Also:
-
STRATEGY
Validation strategy- See Also:
-
TESTDIR
Current test directory -
GOLDENFILEDIR
Goldenfile directory -
GET
Default request method- See Also:
-
HTTP10
HTTP 1.0- See Also:
-
HTTP11
HTTP 1.1- See Also:
-
SL
Forward slash- See Also:
-
GF_SUFFIX
Goldenfile suffix- See Also:
-
JSP_SUFFIX
JSP suffix- See Also:
-
USE_SAVED_STATE
Use any saved state- See Also:
-
SAVE_STATE
Save current HTTP state.- See Also:
-
IGNORE_STATUS_CODE
Ignore HTTP status codes- See Also:
-
_testName
Current test name -
_tsHome
location of _tsHome -
_contextRoot
Context root of target tests -
_generalURI
General file/request URI for both gfiles and tests -
_hostname
Target webserver hostname -
_port
protected int _portTarget webserver port -
_state
protected org.apache.commons.httpclient.HttpState _stateHttpState that may be used for multiple invocations requiring state. -
_testCase
Test case. -
_useSavedState
protected boolean _useSavedStateUse saved state. -
_saveState
protected boolean _saveStateSave state. -
FOLLOW_REDIRECT
Follow redirect. -
_redirect
protected boolean _redirect
-
-
Constructor Details
-
BaseUrlClient
public BaseUrlClient()
-
-
Method Details
-
setTestDir
setTestDirsets the current test directory.- Parameters:
testDir- aStringvalue
-
setGeneralURI
-
setContextRoot
-
getContextRoot
-
setGoldenFileDir
Sets the goldenfile directory- Parameters:
goldenDir- goldenfile directory based off test directory
-
setup
setupis by the test harness to initialize the tests.- Parameters:
args- aString[]valuep- aPropertiesvalue- Throws:
Exception- if an error occurs
-
cleanup
cleanupis called by the test harness to cleanup after text execution- Throws:
Exception- if an error occurs
-
invoke
Invokes a test based on the properties stored in TEST_PROPS. Once the test has completed, the properties in TEST_PROPS will be cleared.
- Throws:
Exception- If an error occurs during the test run
-
setTestProperties
Sets the appropriate test properties based on the values stored in TEST_PROPS- Parameters:
testCase- aWebTestCasevalue
-