public abstract class AbstractWebTest extends Object
Modifier and Type | Field and Description |
---|---|
protected String |
activeProfiles
List of Spring profiles (use comma separator) to activate
For example "resthub-web-server,resthub-jpa"
|
protected Boolean |
annotationBasedConfig
When set to true, activate Spring 3.1 JavaConfig based configuration, by setting context param contextClass to org.springframework.web.context.support.AnnotationConfigWebApplicationContext
|
protected Client |
client
RESThub http client used to send test requests
|
protected String |
contextLocations
Default Spring contexts imported.
|
protected static org.slf4j.Logger |
logger |
protected int |
port
HTTP port used for running web tests, default is 9797
|
protected static org.eclipse.jetty.server.Server |
reusableServer
Jetty reusable embedded server that will run your application
|
protected String |
rootUrl
Default rootUrl used to send requests
|
protected org.eclipse.jetty.server.Server |
server
Class specific Jetty embedded server that will run your application
|
protected int |
servletContextHandlerOption |
protected Boolean |
startServerOnce
Specify if the embedded Jetty server should run once (true, default value) or for each class (false)
|
protected Boolean |
useOpenEntityManagerInViewFilter
Define in OpenEntityManagerInViewFilter should be activated or not.
|
Constructor and Description |
---|
AbstractWebTest()
Default constructor
|
AbstractWebTest(int port)
Constructor allowing to specify HTTP port used to run the server
|
AbstractWebTest(String activeProfiles)
Constructor allowing to specify Spring active profiles
|
AbstractWebTest(String activeProfiles,
int port)
Constructor allowing to specify Spring active profiles and HTTP port used to run the server
|
Modifier and Type | Method and Description |
---|---|
void |
afterClass() |
void |
beforeClass() |
protected org.eclipse.jetty.servlet.ServletContextHandler |
customizeContextHandler(org.eclipse.jetty.servlet.ServletContextHandler context)
You should override it in order to customize the servlet context handler
|
Client.RequestHolder |
request(String urlSuffix)
Send a request to the embedded test webserver
|
protected int port
protected Boolean startServerOnce
protected static org.eclipse.jetty.server.Server reusableServer
protected org.eclipse.jetty.server.Server server
protected Client client
protected String rootUrl
protected String contextLocations
protected String activeProfiles
protected Boolean annotationBasedConfig
protected Boolean useOpenEntityManagerInViewFilter
protected int servletContextHandlerOption
protected static final org.slf4j.Logger logger
public AbstractWebTest()
public AbstractWebTest(String activeProfiles)
activeProfiles
- coma separated list of profilespublic AbstractWebTest(int port)
port
- HTTP port used for running web tests, default is 9797public AbstractWebTest(String activeProfiles, int port)
activeProfiles
- coma separated list of profilesport
- HTTP port used for running web tests, default is 9797protected org.eclipse.jetty.servlet.ServletContextHandler customizeContextHandler(org.eclipse.jetty.servlet.ServletContextHandler context) throws javax.servlet.ServletException
javax.servlet.ServletException
public Client.RequestHolder request(String urlSuffix)
urlSuffix
- The end of the request without starting /, for example "todo" urlSuffix will send a request to "http://localhost:9797/todo"public void afterClass()
Copyright © 2009–2014. All rights reserved.