use of com.adaptris.core.management.webserver.JettyServerManager in project interlok by adaptris.
the class JettyMgmtComponentTest method testFromXml_Relative.
@Test
public void testFromXml_Relative() throws Exception {
JettyServerComponent jetty = new JettyServerComponent();
String xmlFile = BaseCase.PROPERTIES.getProperty(JETTY_MGMT_XML_RELATIVE);
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 testFailsafe_WithOverrideDescriptor.
@Test
public void testFailsafe_WithOverrideDescriptor() 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.put("jetty.deploy.defaultsDescriptorPath", getClass().getClassLoader().getResource(JettyServerManager.DEFAULT_DESCRIPTOR_XML).toString());
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 testFailsafe.
@Test
public void testFailsafe() 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(Constants.CFG_JMX_LOCAL_ADAPTER_UID, "service:jmx:jmxmp://localhost:5555");
jettyConfig.setProperty(Constants.BOOTSTRAP_PROPERTIES_RESOURCE_KEY, "bootstrap.properties");
jettyConfig.setProperty("jetty.http.port", 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 EmbeddedJettyHelper method startServer.
public void startServer() throws Exception {
jetty = new JettyServerComponent();
jetty.init(jettyConfig);
jetty.start();
Thread.sleep(250);
final JettyServerManager mgr = JettyServerManager.getInstance();
while (!mgr.isStarted()) {
Thread.sleep(250);
}
}
Aggregations