Class AbstractUrlClient
java.lang.Object
com.sun.ts.lib.harness.EETest
com.sun.ts.tests.common.webclient.BaseUrlClient
com.sun.ts.tests.servlet.common.client.AbstractUrlClient
- All Implemented Interfaces:
Serializable
Base client for Servlet tests.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.sun.ts.lib.harness.EETest
EETest.Fault, EETest.SetupException -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringapitest property nameprotected static final Stringno servlet nameprotected final org.slf4j.LoggerThe logger for this class.Fields inherited from class com.sun.ts.tests.common.webclient.BaseUrlClient
_contextRoot, _generalURI, _hostname, _port, _props, _redirect, _saveState, _state, _testCase, _testName, _tsHome, _useSavedState, BASIC_AUTH_PASSWD, BASIC_AUTH_REALM, BASIC_AUTH_USER, CONTENT, CONTINUE, CREATED, EXPECT_RESPONSE_BODY, EXPECTED_HEADERS, FOLLOW_REDIRECT, FORBIDDEN, GET, GF_SUFFIX, GOLDENFILE, GOLDENFILEDIR, GONE, HTTP10, HTTP11, IGNORE_BODY, IGNORE_STATUS_CODE, INTERNAL_SERVER_ERROR, JSP_SUFFIX, LENGTH_REQUIRED, MOVED_TEMPORARY, NOT_FOUND, OK, REASON_PHRASE, REQUEST, REQUEST_HEADERS, RESPONSE_MATCH, SAVE_STATE, SEARCH_STRING, SEARCH_STRING_IGNORE_CASE, SERVICE_UNAVAILABLE, SERVLETHOSTPROP, SERVLETPORTPROP, SL, STANDARD, STATUS_CODE, STRATEGY, TEST_NAME, TEST_PROPS, TESTDIR, TSHOME, UNAUTHORIZED, UNEXPECTED_HEADERS, UNEXPECTED_RESPONSE_MATCH, UNORDERED_SEARCH_STRING, USE_SAVED_STATEFields inherited from class com.sun.ts.lib.harness.EETest
err, iLogDelaySeconds, log, sTestCase -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetHttpsURLConnection(URL newURL) Opens a URLConnection.protected StringgetLocalInterfaceInfo(boolean returnAddresses) Returns a string containing the local interface information.protected StringgetRequest(String rq) Returns the request string.protected StringGets the name of the servlet to use when building a request for a single servlet API test.protected URLBuilds a URL.protected StringgetURLString(String protocol, String hostname, int portnum, String sContext) Builds a url string.protected voidsetServletName(String servlet) Sets the name of the servlet to use when building a request for a single servlet API test.protected voidsetTestProperties(WebTestCase testCase) Sets the appropriate test properties based on the values stored in TEST_PROPSMethods inherited from class com.sun.ts.tests.common.webclient.BaseUrlClient
cleanup, getContextRoot, invoke, setContextRoot, setGeneralURI, setGoldenFileDir, setTestDir, setupMethods inherited from class com.sun.ts.lib.harness.EETest
getPropsReady, getTestPropsFromArgs, initializeProperties, logErr, logErr, logMsg, logTrace, logTrace, run, run, run, run, runAllTestCases, setTestStatus
-
Field Details
-
logger
protected final org.slf4j.Logger loggerThe logger for this class. -
APITEST
apitest property name- See Also:
-
DONOTUSEServletName
no servlet name- See Also:
-
-
Constructor Details
-
AbstractUrlClient
protected AbstractUrlClient()Constructor.
-
-
Method Details
-
setTestProperties
Description copied from class:BaseUrlClientSets the appropriate test properties based on the values stored in TEST_PROPS- Overrides:
setTestPropertiesin classBaseUrlClient- Parameters:
testCase- aWebTestCasevalue
-
setServletName
Sets the name of the servlet to use when building a request for a single servlet API test.- Parameters:
servlet- - the name of the servlet
-
getServletName
Gets the name of the servlet to use when building a request for a single servlet API test.- Returns:
- the name of the servlet
-
getLocalInterfaceInfo
Returns a string containing the local interface information.- Parameters:
returnAddresses- if true, returns IP addresses; if false, returns hostnames- Returns:
- a string containing the local interface information
-
getRequest
Returns the request string.- Parameters:
rq- - the request string- Returns:
- the request string
-
getURLString
Builds a url string.- Parameters:
protocol- - the protocolhostname- - the hostnameportnum- - the port numbersContext- - the context- Returns:
- the url string
-
getURL
protected URL getURL(String protocol, String hostname, int portnum, String sContext) throws MalformedURLException Builds a URL.- Parameters:
protocol- - the protocolhostname- - the hostnameportnum- - the port numbersContext- - the context- Returns:
- the url string
- Throws:
MalformedURLException- - if an error occurs
-
getHttpsURLConnection
Opens a URLConnection.- Parameters:
newURL- - the URL- Returns:
- the URLConnection
- Throws:
IOException- - if an error occurs
-