public class HttpServerFunctionalTest
extends Assert
HttpServer
.
The methods are static for other classes to import statically.Modifier and Type | Field and Description |
---|---|
static String |
TEST_BUILD_WEBAPPS
JVM property for the webapp test dir : "test.build.webapps"
|
Constructor and Description |
---|
HttpServerFunctionalTest() |
Modifier and Type | Method and Description |
---|---|
static HttpServer |
createAndStartTestServer()
Create and start a server with the test webapp
|
static HttpServer |
createServer(String webapp)
Create an HttpServer instance for the given webapp
|
static HttpServer |
createServer(String webapp,
Configuration conf)
Create an HttpServer instance for the given webapp
|
static HttpServer |
createServer(String webapp,
Configuration conf,
AccessControlList adminsAcl) |
static HttpServer |
createServer(String webapp,
Configuration conf,
String[] pathSpecs)
Create an HttpServer instance for the given webapp
|
static HttpServer |
createServer(String host,
int port)
Create an HttpServer instance on the given address for the given webapp
|
static HttpServer |
createTestServer()
Create but do not start the test webapp server.
|
static HttpServer |
createTestServer(Configuration conf)
Create but do not start the test webapp server.
|
static HttpServer |
createTestServer(Configuration conf,
AccessControlList adminsAcl) |
static HttpServer |
createTestServer(Configuration conf,
String[] pathSpecs)
Create but do not start the test webapp server.
|
static URL |
getServerURL(HttpServer server)
Pass in a server, return a URL bound to localhost and its port
|
protected static void |
prepareTestWebapp()
Prepare the test webapp by creating the directory from the test properties
fail if the directory cannot be created.
|
protected static String |
readOutput(URL url)
Read in the content from a URL
|
static void |
stop(HttpServer server)
If the server is non null, stop it
|
public static final String TEST_BUILD_WEBAPPS
public static HttpServer createTestServer() throws IOException
IOException
- if a problem occursAssertionError
- if a condition was not metpublic static HttpServer createTestServer(Configuration conf) throws IOException
conf
- the server configuration to useIOException
- if a problem occursAssertionError
- if a condition was not metpublic static HttpServer createTestServer(Configuration conf, AccessControlList adminsAcl) throws IOException
IOException
public static HttpServer createTestServer(Configuration conf, String[] pathSpecs) throws IOException
conf
- the server configuration to useIOException
- if a problem occursAssertionError
- if a condition was not metprotected static void prepareTestWebapp()
AssertionError
- if a condition was not metpublic static HttpServer createServer(String host, int port) throws IOException
host
- to bindport
- to bindIOException
- if it could not be createdpublic static HttpServer createServer(String webapp) throws IOException
webapp
- the webapp to work withIOException
- if it could not be createdpublic static HttpServer createServer(String webapp, Configuration conf) throws IOException
webapp
- the webapp to work withconf
- the configuration to use for the serverIOException
- if it could not be createdpublic static HttpServer createServer(String webapp, Configuration conf, AccessControlList adminsAcl) throws IOException
IOException
public static HttpServer createServer(String webapp, Configuration conf, String[] pathSpecs) throws IOException
webapp
- the webapp to work withconf
- the configuration to use for the serverpathSpecs
- the paths specifications the server will serviceIOException
- if it could not be createdpublic static HttpServer createAndStartTestServer() throws IOException
IOException
- on any failureAssertionError
- if a condition was not metpublic static void stop(HttpServer server) throws Exception
server
- to stopException
- on any failurepublic static URL getServerURL(HttpServer server) throws MalformedURLException
server
- serverMalformedURLException
- if the URL cannot be created.protected static String readOutput(URL url) throws IOException
url
- URL To readIOException
- if something went wrong