use of com.adaptris.core.management.webserver.JettyServerManager in project interlok by adaptris.
the class JettyMgmtComponentTest method testFromProperties.
@Test
public void testFromProperties() throws Exception {
JettyServerComponent jetty = new JettyServerComponent();
int portForServer = PortManager.nextUnusedPort(18080);
try {
Properties jettyConfig = new Properties();
jettyConfig.setProperty(ServerBuilder.WEB_SERVER_PORT_CFG_KEY, String.valueOf(portForServer));
jetty.init(jettyConfig);
jetty.start();
Thread.sleep(250);
final JettyServerManager mgr = JettyServerManager.getInstance();
Awaitility.await().atMost(MAX_STARTUP_WAIT).with().pollInterval(STARTUP_POLL).until(() -> mgr.isStarted());
} finally {
stopAndDestroy(jetty);
PortManager.release(portForServer);
}
}
use of com.adaptris.core.management.webserver.JettyServerManager in project interlok by adaptris.
the class JettyMgmtComponentTest method testFromXml.
@Test
public void testFromXml() throws Exception {
JettyServerComponent jetty = new JettyServerComponent();
String xmlFile = BaseCase.PROPERTIES.getProperty(JETTY_MGMT_XML);
int portForServer = PortManager.nextUnusedPort(18080);
try {
Properties jettyConfig = new Properties();
jettyConfig.setProperty("jetty.http.port", String.valueOf(portForServer));
jettyConfig.setProperty(ServerBuilder.WEB_SERVER_CONFIG_FILE_NAME_CGF_KEY, xmlFile);
jetty.init(jettyConfig);
jetty.start();
Thread.sleep(250);
final JettyServerManager mgr = JettyServerManager.getInstance();
Awaitility.await().atMost(MAX_STARTUP_WAIT).with().pollInterval(STARTUP_POLL).until(() -> mgr.isStarted());
} finally {
stopAndDestroy(jetty);
PortManager.release(portForServer);
}
}
use of com.adaptris.core.management.webserver.JettyServerManager in project interlok by adaptris.
the class JettyMgmtComponentTest method testFromProperties_withWebappurl.
@Test
public void testFromProperties_withWebappurl() throws Exception {
JettyServerComponent jetty = new JettyServerComponent();
int portForServer = PortManager.nextUnusedPort(18080);
try {
Properties jettyConfig = new Properties();
jettyConfig.setProperty(ServerBuilder.WEB_SERVER_PORT_CFG_KEY, String.valueOf(portForServer));
jettyConfig.setProperty(ServerBuilder.WEB_SERVER_WEBAPP_URL_CFG_KEY, "./webapps");
jetty.init(jettyConfig);
jetty.start();
Thread.sleep(250);
final JettyServerManager mgr = JettyServerManager.getInstance();
Awaitility.await().atMost(MAX_STARTUP_WAIT).with().pollInterval(STARTUP_POLL).until(() -> mgr.isStarted());
} finally {
stopAndDestroy(jetty);
PortManager.release(portForServer);
}
}
use of com.adaptris.core.management.webserver.JettyServerManager in project interlok by adaptris.
the class EmbeddedConnection method removeServlet.
@Override
public void removeServlet(ServletWrapper wrapper) throws CoreException {
try {
JettyServerManager serverManager = JettyServerManager.getInstance();
serverManager.stopDeployment(SERVER_ID, wrapper.getUrl());
serverManager.removeDeployment(SERVER_ID, wrapper.getUrl());
serverManager.removeDeployment(SERVER_ID, wrapper.getServletHolder(), wrapper.getUrl());
log.trace("Removed {} from {}", wrapper.getServletHolder(), wrapper.getUrl());
} catch (Exception ex) {
throw ExceptionHelper.wrapCoreException(ex);
}
}
use of com.adaptris.core.management.webserver.JettyServerManager in project interlok by adaptris.
the class EmbeddedConnection method addServlet.
@Override
public void addServlet(ServletWrapper wrapper) throws CoreException {
try {
JettyServerManager serverManager = JettyServerManager.getInstance();
HashMap<String, Object> additionalProperties = new HashMap<String, Object>();
additionalProperties.put(JettyServerManager.CONTEXT_PATH, wrapper.getUrl());
additionalProperties.put(JettyServerManager.SECURITY_CONSTRAINTS, getSecurityHandler());
serverManager.addServlet(SERVER_ID, wrapper.getServletHolder(), additionalProperties);
serverManager.startDeployment(SERVER_ID, wrapper.getUrl());
log.trace("Added " + wrapper.getServletHolder() + " against " + wrapper.getUrl());
} catch (Exception ex) {
throw ExceptionHelper.wrapCoreException(ex);
}
}
Aggregations