public class TestingFramework extends Object
Modifier and Type | Field and Description |
---|---|
static List<String> |
ALL_METHODS
Use the ALL_METHODS list to conveniently cycle through all HTTP methods.
|
static Object |
ALREADY_CHECKED
If an
ClassicTestClientTestingAdapter is unable to return a response in
the format this testing framework is needing, then it will need to check the
item in the response (such as body, status, headers, or contentType) itself and set
the returned value of the item as ALREADY_CHECKED. |
static String |
DEFAULT_REQUEST_BODY
If a test does not specify a body, this one is used.
|
static String |
DEFAULT_REQUEST_CONTENT_TYPE
If a test does not specify a request contentType, this one is used.
|
static Map<String,String> |
DEFAULT_REQUEST_HEADERS
If a test does not specify a request headers, these are used.
|
static String |
DEFAULT_REQUEST_PATH
If a test does not specify a path, this one is used.
|
static ProtocolVersion |
DEFAULT_REQUEST_PROTOCOL_VERSION
If a test does not specify a protocol version, this one is used.
|
static Map<String,String> |
DEFAULT_REQUEST_QUERY
If a test does not specify query parameters, these are used.
|
static String |
DEFAULT_RESPONSE_BODY
If a test does not specify an expected response body, this one is used.
|
static String |
DEFAULT_RESPONSE_CONTENT_TYPE
If a test does not specify an expected response contentType, this one is used.
|
static Map<String,String> |
DEFAULT_RESPONSE_HEADERS
If a test does not specify expected response headers, these are used.
|
static int |
DEFAULT_RESPONSE_STATUS
If a test does not specify an expected response status, this one is used.
|
Constructor and Description |
---|
TestingFramework() |
TestingFramework(ClientTestingAdapter adapter) |
Modifier and Type | Method and Description |
---|---|
void |
addTest()
Call to add a test with defaults.
|
void |
addTest(Map<String,Object> test)
Call to add a test.
|
static Object |
deepcopy(Object orig)
Used to make a "deep" copy of an object.
|
void |
deleteTests()
Deletes all tests.
|
void |
runTests()
Run the tests that have been previously added.
|
void |
setAdapter(ClientTestingAdapter adapter)
Sets the
ClientTestingAdapter . |
void |
setRequestHandler(TestingFrameworkRequestHandler requestHandler)
This is not likely to be used except during the testing of this class.
|
public static final List<String> ALL_METHODS
public static final Object ALREADY_CHECKED
ClassicTestClientTestingAdapter
is unable to return a response in
the format this testing framework is needing, then it will need to check the
item in the response (such as body, status, headers, or contentType) itself and set
the returned value of the item as ALREADY_CHECKED.public static final String DEFAULT_REQUEST_PATH
public static final String DEFAULT_REQUEST_BODY
public static final String DEFAULT_REQUEST_CONTENT_TYPE
public static final Map<String,String> DEFAULT_REQUEST_QUERY
public static final Map<String,String> DEFAULT_REQUEST_HEADERS
public static final ProtocolVersion DEFAULT_REQUEST_PROTOCOL_VERSION
public static final int DEFAULT_RESPONSE_STATUS
public static final String DEFAULT_RESPONSE_BODY
public static final String DEFAULT_RESPONSE_CONTENT_TYPE
public TestingFramework() throws TestingFrameworkException
TestingFrameworkException
public TestingFramework(ClientTestingAdapter adapter) throws TestingFrameworkException
TestingFrameworkException
public void setRequestHandler(TestingFrameworkRequestHandler requestHandler)
requestHandler
- public void runTests() throws TestingFrameworkException
HttpServer
is
started. Then, all the tests are completed by passing each test to the adapter
which will make the HTTP request.TestingFrameworkException
- if there is a test failure or unexpected problem.public void setAdapter(ClientTestingAdapter adapter)
ClientTestingAdapter
.adapter
- public void deleteTests()
public void addTest() throws TestingFrameworkException
TestingFrameworkException
public void addTest(Map<String,Object> test) throws TestingFrameworkException
ClientPOJOAdapter
for details on the format of the request and response.test
- Map with a REQUEST and a RESPONSE key.TestingFrameworkException
public static Object deepcopy(Object orig) throws TestingFrameworkException
orig
- a serializable object.TestingFrameworkException
Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.