Search in sources :

Example 1 with JettyConfiguration

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;
}
Also used : JettyConfiguration(org.teknux.jettybootstrap.configuration.JettyConfiguration) JettyBootstrap(org.teknux.jettybootstrap.JettyBootstrap)

Example 2 with JettyConfiguration

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());
}
Also used : IJettyConfiguration(org.teknux.jettybootstrap.configuration.IJettyConfiguration) JettyConfiguration(org.teknux.jettybootstrap.configuration.JettyConfiguration) IJettyConfiguration(org.teknux.jettybootstrap.configuration.IJettyConfiguration) JettyConnector(org.teknux.jettybootstrap.configuration.JettyConnector) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

JettyConfiguration (org.teknux.jettybootstrap.configuration.JettyConfiguration)2 HashSet (java.util.HashSet)1 Test (org.junit.Test)1 JettyBootstrap (org.teknux.jettybootstrap.JettyBootstrap)1 IJettyConfiguration (org.teknux.jettybootstrap.configuration.IJettyConfiguration)1 JettyConnector (org.teknux.jettybootstrap.configuration.JettyConnector)1