public class HttpServerFunctionalTest
extends Assert
HttpServer.
The methods are static for other classes to import statically.| Modifier and Type | Field and Description |
|---|---|
static java.lang.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(java.lang.String webapp)
Create an HttpServer instance for the given webapp
|
static HttpServer |
createServer(java.lang.String webapp,
Configuration conf)
Create an HttpServer instance for the given webapp
|
static HttpServer |
createServer(java.lang.String webapp,
Configuration conf,
AccessControlList adminsAcl) |
static HttpServer |
createServer(java.lang.String webapp,
Configuration conf,
java.lang.String[] pathSpecs)
Create an HttpServer instance for the given webapp
|
static HttpServer |
createServer(java.lang.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,
java.lang.String[] pathSpecs)
Create but do not start the test webapp server.
|
static HttpServer |
createTestServerWithSecurity(Configuration conf) |
protected static void |
deleteRecursively(java.io.File d)
Recursively deletes a
File. |
protected static int |
getFreePort()
Picks a free port on the host by binding a Socket to '0'.
|
static java.net.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 java.lang.String |
readOutput(java.net.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 java.lang.String TEST_BUILD_WEBAPPS
public static HttpServer createTestServer() throws java.io.IOException
java.io.IOException - if a problem occursjava.lang.AssertionError - if a condition was not metpublic static HttpServer createTestServer(Configuration conf) throws java.io.IOException
conf - the server configuration to usejava.io.IOException - if a problem occursjava.lang.AssertionError - if a condition was not metpublic static HttpServer createTestServer(Configuration conf, AccessControlList adminsAcl) throws java.io.IOException
java.io.IOExceptionpublic static HttpServer createTestServer(Configuration conf, java.lang.String[] pathSpecs) throws java.io.IOException
conf - the server configuration to usejava.io.IOException - if a problem occursjava.lang.AssertionError - if a condition was not metpublic static HttpServer createTestServerWithSecurity(Configuration conf) throws java.io.IOException
java.io.IOExceptionprotected static void prepareTestWebapp()
java.lang.AssertionError - if a condition was not metpublic static HttpServer createServer(java.lang.String host, int port) throws java.io.IOException
host - to bindport - to bindjava.io.IOException - if it could not be createdpublic static HttpServer createServer(java.lang.String webapp) throws java.io.IOException
webapp - the webapp to work withjava.io.IOException - if it could not be createdpublic static HttpServer createServer(java.lang.String webapp, Configuration conf) throws java.io.IOException
webapp - the webapp to work withconf - the configuration to use for the serverjava.io.IOException - if it could not be createdpublic static HttpServer createServer(java.lang.String webapp, Configuration conf, AccessControlList adminsAcl) throws java.io.IOException
java.io.IOExceptionpublic static HttpServer createServer(java.lang.String webapp, Configuration conf, java.lang.String[] pathSpecs) throws java.io.IOException
webapp - the webapp to work withconf - the configuration to use for the serverpathSpecs - the paths specifications the server will servicejava.io.IOException - if it could not be createdpublic static HttpServer createAndStartTestServer() throws java.io.IOException
java.io.IOException - on any failurejava.lang.AssertionError - if a condition was not metpublic static void stop(HttpServer server) throws java.lang.Exception
server - to stopjava.lang.Exception - on any failurepublic static java.net.URL getServerURL(HttpServer server) throws java.net.MalformedURLException
server - serverjava.net.MalformedURLException - if the URL cannot be created.protected static java.lang.String readOutput(java.net.URL url)
throws java.io.IOException
url - URL To readjava.io.IOException - if something went wrongprotected static void deleteRecursively(java.io.File d)
File.protected static int getFreePort()
throws java.io.IOException
java.io.IOException