use of org.teknux.jettybootstrap.configuration.JettyConfiguration in project jetty-bootstrap by teknux-org.
the class AbstractJettyBootstrapTest method initServer.
protected JettyBootstrap initServer(boolean ssl) throws JettyBootstrapException, IOException {
JettyConfiguration jettyConfiguration = new JettyConfiguration();
jettyConfiguration.setStopAtShutdown(false);
jettyConfiguration.setAutoJoinOnStart(false);
jettyConfiguration.setTempDirectory(temporaryFolder.newFolder());
jettyConfiguration.setCleanTempDir(true);
jettyConfiguration.setPersistAppTempDirectories(false);
jettyConfiguration.setHost(HOST);
if (ssl) {
jettyConfiguration.setJettyConnectors(JettyConnector.HTTPS);
jettyConfiguration.setSslPort(SSL_PORT);
} else {
jettyConfiguration.setJettyConnectors(JettyConnector.HTTP);
jettyConfiguration.setPort(PORT);
}
this.ssl = ssl;
this.jettyBootstrap = new JettyBootstrap(jettyConfiguration);
return this.jettyBootstrap;
}
use of org.teknux.jettybootstrap.configuration.JettyConfiguration in project jetty-bootstrap by teknux-org.
the class JettyConfigurationTest method cloneTest.
@Test
public void cloneTest() throws CloneNotSupportedException {
JettyConfiguration jettyConfiguration = new JettyConfiguration();
jettyConfiguration.setAutoJoinOnStart(true);
jettyConfiguration.setHost("0.0.0.0");
jettyConfiguration.setJettyConnectors(JettyConnector.HTTPS);
IJettyConfiguration iJettyConfigurationCloned = jettyConfiguration.clone();
jettyConfiguration.setAutoJoinOnStart(false);
jettyConfiguration.setHost("127.0.0.1");
jettyConfiguration.setJettyConnectors(JettyConnector.HTTP);
Assert.assertEquals(false, jettyConfiguration.isAutoJoinOnStart());
Assert.assertEquals("127.0.0.1", jettyConfiguration.getHost());
Set<JettyConnector> expectedJettyConnectors = new HashSet<>();
expectedJettyConnectors.add(JettyConnector.HTTP);
Assert.assertEquals(expectedJettyConnectors, jettyConfiguration.getJettyConnectors());
Assert.assertEquals(true, iJettyConfigurationCloned.isAutoJoinOnStart());
Assert.assertEquals("0.0.0.0", iJettyConfigurationCloned.getHost());
Set<JettyConnector> expectedJettyConnectorsCloned = new HashSet<>();
expectedJettyConnectorsCloned.add(JettyConnector.HTTPS);
Assert.assertEquals(expectedJettyConnectorsCloned, iJettyConfigurationCloned.getJettyConnectors());
}
Aggregations