Search in sources :

Example 11 with SocketConnector

use of org.mortbay.jetty.bio.SocketConnector in project nhin-d by DirectProject.

the class RoutingResolverImplTest method startService.

private void startService() throws Exception {
    /*
         * Setup the configuration service server
         */
    server = new Server();
    SocketConnector connector = new SocketConnector();
    HTTPPort = AvailablePortFinder.getNextAvailable(1024);
    connector.setPort(HTTPPort);
    WebAppContext context = new WebAppContext();
    context.setContextPath("/config");
    context.setServer(server);
    context.setWar("war/config-service.war");
    server.setSendServerVersion(false);
    server.addConnector(connector);
    server.addHandler(context);
    server.start();
    configServiceURL = "http://localhost:" + HTTPPort + "/config/ConfigurationService";
    proxy = new ConfigurationServiceProxy(configServiceURL);
    cleanConfig();
}
Also used : WebAppContext(org.mortbay.jetty.webapp.WebAppContext) Server(org.mortbay.jetty.Server) SocketConnector(org.mortbay.jetty.bio.SocketConnector) ConfigurationServiceProxy(org.nhind.config.ConfigurationServiceProxy)

Example 12 with SocketConnector

use of org.mortbay.jetty.bio.SocketConnector in project nhin-d by DirectProject.

the class ServiceRunner method startServices.

public static synchronized void startServices() throws Exception {
    if (server == null) {
        /*
			 * Setup the configuration service server
			 */
        server = new Server();
        SocketConnector connector = new SocketConnector();
        HTTPPort = AvailablePortFinder.getNextAvailable(1024);
        connector.setPort(HTTPPort);
        WebAppContext context = new WebAppContext("src/test/resources/webapp", "/");
        server.setSendServerVersion(false);
        server.addConnector(connector);
        server.addHandler(context);
        server.start();
        txsServiceURL = "http://localhost:" + HTTPPort + "/";
    }
}
Also used : WebAppContext(org.mortbay.jetty.webapp.WebAppContext) Server(org.mortbay.jetty.Server) SocketConnector(org.mortbay.jetty.bio.SocketConnector)

Example 13 with SocketConnector

use of org.mortbay.jetty.bio.SocketConnector in project nhin-d by DirectProject.

the class MonitorServiceRunner method startMonitorService.

public static synchronized void startMonitorService() throws Exception {
    if (server == null) {
        /*
			 * Setup the configuration service server
			 */
        server = new Server();
        SocketConnector connector = new SocketConnector();
        HTTPPort = AvailablePortFinder.getNextAvailable(8090);
        connector.setPort(HTTPPort);
        // certificate service
        WebAppContext context = new WebAppContext("src/test/resources/webapp-liverun", "/");
        server.setSendServerVersion(false);
        server.addConnector(connector);
        server.addHandler(context);
        server.start();
        serviceURL = "http://localhost:" + HTTPPort + "/";
    }
}
Also used : WebAppContext(org.mortbay.jetty.webapp.WebAppContext) Server(org.mortbay.jetty.Server) SocketConnector(org.mortbay.jetty.bio.SocketConnector)

Example 14 with SocketConnector

use of org.mortbay.jetty.bio.SocketConnector in project jackrabbit by apache.

the class LitmusTest method testLitmus.

public void testLitmus() throws Exception {
    File dir = new File("target", "litmus");
    String litmus = System.getProperty("litmus", "litmus");
    if (Boolean.getBoolean("jackrabbit.test.integration") && isLitmusAvailable(litmus)) {
        final Repository repository = JcrUtils.getRepository("jcr-jackrabbit://" + Text.escapePath(dir.getCanonicalPath()));
        // for the TransientRepository
        Session session = repository.login();
        try {
            SocketConnector connector = new SocketConnector();
            connector.setHost("localhost");
            connector.setPort(Integer.getInteger("litmus.port", 0));
            Server server = new Server();
            server.addConnector(connector);
            ServletHolder holder = new ServletHolder(new SimpleWebdavServlet() {

                @Override
                public Repository getRepository() {
                    return repository;
                }
            });
            holder.setInitParameter("resource-config", "/config.xml");
            Context context = new Context(server, "/");
            context.setResourceBase("src/test/resources");
            context.addServlet(holder, "/*");
            server.addHandler(context);
            server.start();
            try {
                int port = connector.getLocalPort();
                String url = "http://localhost:" + port + "/default";
                ProcessBuilder builder = new ProcessBuilder(litmus, url, "admin", "admin");
                builder.directory(dir);
                builder.redirectErrorStream();
                assertLitmus(builder, "basic", 0);
                assertLitmus(builder, "http", 0);
                assertLitmus(builder, "props", 0);
                // FIXME: JCR-2637: WebDAV shallow copy test failure
                assertLitmus(builder, "copymove", 1);
                // FIXME: JCR-2638: Litmus locks test failures
                assertLitmus(builder, "locks", 1);
            } finally {
                server.stop();
            }
        } finally {
            session.logout();
        }
    }
}
Also used : Context(org.mortbay.jetty.servlet.Context) Repository(javax.jcr.Repository) Server(org.mortbay.jetty.Server) ServletHolder(org.mortbay.jetty.servlet.ServletHolder) File(java.io.File) SocketConnector(org.mortbay.jetty.bio.SocketConnector) Session(javax.jcr.Session)

Example 15 with SocketConnector

use of org.mortbay.jetty.bio.SocketConnector in project nhin-d by DirectProject.

the class ConfigServiceRunner method startConfigService.

public static synchronized void startConfigService() throws Exception {
    if (server == null) {
        /*
			 * Setup the configuration service server
			 */
        server = new Server();
        SocketConnector connector = new SocketConnector();
        HTTPPort = AvailablePortFinder.getNextAvailable(1024);
        connector.setPort(HTTPPort);
        WebAppContext context = new WebAppContext("src/test/resources/webapp", "/");
        server.setSendServerVersion(false);
        server.addConnector(connector);
        server.addHandler(context);
        server.start();
        configServiceURL = "http://localhost:" + HTTPPort + "/ConfigurationService";
        restAPIBaseURL = "http://localhost:" + HTTPPort + "/api";
    }
}
Also used : WebAppContext(org.mortbay.jetty.webapp.WebAppContext) Server(org.mortbay.jetty.Server) SocketConnector(org.mortbay.jetty.bio.SocketConnector)

Aggregations

SocketConnector (org.mortbay.jetty.bio.SocketConnector)18 Server (org.mortbay.jetty.Server)16 WebAppContext (org.mortbay.jetty.webapp.WebAppContext)11 Context (org.mortbay.jetty.servlet.Context)3 ServletHolder (org.mortbay.jetty.servlet.ServletHolder)3 File (java.io.File)2 IOException (java.io.IOException)2 Repository (javax.jcr.Repository)2 Connector (org.mortbay.jetty.Connector)2 HandlerList (org.mortbay.jetty.handler.HandlerList)2 ResourceHandler (org.mortbay.jetty.handler.ResourceHandler)2 TearDown (com.google.common.testing.TearDown)1 ThreadPoolExecutorAdapter (com.google.util.threads.ThreadPoolExecutorAdapter)1 BindException (java.net.BindException)1 ServerSocket (java.net.ServerSocket)1 URL (java.net.URL)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1