Search in sources :

Example 1 with XmlConfiguredJetty

use of org.eclipse.jetty.deploy.test.XmlConfiguredJetty in project jetty.project by eclipse.

the class DeploymentManagerTest method testXmlConfigured.

@Test
public void testXmlConfigured() throws Exception {
    XmlConfiguredJetty jetty = null;
    try {
        jetty = new XmlConfiguredJetty(testdir);
        jetty.addConfiguration("jetty.xml");
        jetty.addConfiguration("jetty-http.xml");
        jetty.addConfiguration("jetty-deploymgr-contexts.xml");
        // Should not throw an Exception
        jetty.load();
        // Start it
        jetty.start();
    } finally {
        if (jetty != null) {
            try {
                jetty.stop();
            } catch (Exception ignore) {
            // ignore
            }
        }
    }
}
Also used : XmlConfiguredJetty(org.eclipse.jetty.deploy.test.XmlConfiguredJetty) Test(org.junit.Test)

Example 2 with XmlConfiguredJetty

use of org.eclipse.jetty.deploy.test.XmlConfiguredJetty in project jetty.project by eclipse.

the class WebAppProviderTest method setupEnvironment.

@Before
public void setupEnvironment() throws Exception {
    jetty = new XmlConfiguredJetty(testdir);
    jetty.addConfiguration("jetty.xml");
    jetty.addConfiguration("jetty-http.xml");
    jetty.addConfiguration("jetty-deploy-wars.xml");
    // Setup initial context
    jetty.copyWebapp("foo-webapp-1.war", "foo.war");
    // Make symlink
    Path pathWar3 = MavenTestingUtils.getTestResourcePathFile("webapps/foo-webapp-3.war");
    Path pathBar = jetty.getJettyDir("webapps/bar.war").toPath();
    try {
        Files.createSymbolicLink(pathBar, pathWar3);
        symlinkSupported = true;
    } catch (UnsupportedOperationException | FileSystemException e) {
        // if unable to create symlink, no point testing that feature
        // this is the path that Microsoft Windows takes.
        symlinkSupported = false;
    }
    // Should not throw an Exception
    jetty.load();
    // Start it
    jetty.start();
}
Also used : Path(java.nio.file.Path) FileSystemException(java.nio.file.FileSystemException) XmlConfiguredJetty(org.eclipse.jetty.deploy.test.XmlConfiguredJetty) Before(org.junit.Before)

Example 3 with XmlConfiguredJetty

use of org.eclipse.jetty.deploy.test.XmlConfiguredJetty in project jetty.project by eclipse.

the class GlobalWebappConfigBindingTest method setupEnvironment.

@Before
public void setupEnvironment() throws Exception {
    jetty = new XmlConfiguredJetty(testdir);
    jetty.addConfiguration("jetty.xml");
    jetty.addConfiguration("jetty-http.xml");
    // Setup initial context
    jetty.copyWebapp("foo.xml", "foo.xml");
    jetty.copyWebapp("foo-webapp-1.war", "foo.war");
}
Also used : XmlConfiguredJetty(org.eclipse.jetty.deploy.test.XmlConfiguredJetty) Before(org.junit.Before)

Example 4 with XmlConfiguredJetty

use of org.eclipse.jetty.deploy.test.XmlConfiguredJetty in project jetty.project by eclipse.

the class ScanningAppProviderRuntimeUpdatesTest method setupEnvironment.

@Before
public void setupEnvironment() throws Exception {
    testdir.ensureEmpty();
    Resource.setDefaultUseCaches(false);
    jetty = new XmlConfiguredJetty(testdir);
    jetty.addConfiguration("jetty.xml");
    jetty.addConfiguration("jetty-http.xml");
    jetty.addConfiguration("jetty-deploymgr-contexts.xml");
    // Should not throw an Exception
    jetty.load();
    // Start it
    jetty.start();
    // monitor tick
    DeploymentManager dm = jetty.getServer().getBean(DeploymentManager.class);
    for (AppProvider provider : dm.getAppProviders()) {
        if (provider instanceof ScanningAppProvider) {
            _providers++;
            ((ScanningAppProvider) provider).addScannerListener(new Scanner.ScanListener() {

                public void scan() {
                    _scans.incrementAndGet();
                }
            });
        }
    }
}
Also used : Scanner(org.eclipse.jetty.util.Scanner) AppProvider(org.eclipse.jetty.deploy.AppProvider) DeploymentManager(org.eclipse.jetty.deploy.DeploymentManager) XmlConfiguredJetty(org.eclipse.jetty.deploy.test.XmlConfiguredJetty) Before(org.junit.Before)

Example 5 with XmlConfiguredJetty

use of org.eclipse.jetty.deploy.test.XmlConfiguredJetty in project jetty.project by eclipse.

the class ScanningAppProviderStartupTest method setupEnvironment.

@Before
public void setupEnvironment() throws Exception {
    jetty = new XmlConfiguredJetty(testdir);
    jetty.addConfiguration("jetty.xml");
    jetty.addConfiguration("jetty-http.xml");
    jetty.addConfiguration("jetty-deploymgr-contexts.xml");
    // Setup initial context
    jetty.copyWebapp("foo.xml", "foo.xml");
    jetty.copyWebapp("foo-webapp-1.war", "foo.war");
    // Should not throw an Exception
    jetty.load();
    // Start it
    jetty.start();
}
Also used : XmlConfiguredJetty(org.eclipse.jetty.deploy.test.XmlConfiguredJetty) Before(org.junit.Before)

Aggregations

XmlConfiguredJetty (org.eclipse.jetty.deploy.test.XmlConfiguredJetty)5 Before (org.junit.Before)4 FileSystemException (java.nio.file.FileSystemException)1 Path (java.nio.file.Path)1 AppProvider (org.eclipse.jetty.deploy.AppProvider)1 DeploymentManager (org.eclipse.jetty.deploy.DeploymentManager)1 Scanner (org.eclipse.jetty.util.Scanner)1 Test (org.junit.Test)1