Package org.apache.openejb.server

Examples of org.apache.openejb.server.ServiceDaemon$SocketMonitor


    private ServiceDaemon createServiceDaemon(final int poolSize, final EjbServer ejbServer, final URI uri) throws ServiceException {
        final ServiceIdentifier serviceIdentifier = new ServiceIdentifier(ejbServer, uri);
        final KeepAliveServer keepAliveServer = new KeepAliveServer(serviceIdentifier);
        final ServicePool pool = new ServicePool(keepAliveServer, poolSize);
        final ServiceDaemon daemon = new ServiceDaemon(pool, 0, "localhost");
        daemon.start();
        return daemon;
    }
View Full Code Here


        initProps.setProperty("openejb.deployments.classpath.filter.descriptors", "true");
        OpenEJB.init(initProps, new ServerFederation());
        ejbServer.init(new Properties());

        final ServicePool pool = new ServicePool(ejbServer, 10);
        final ServiceDaemon serviceDaemon = new ServiceDaemon(pool, 0, "localhost");
        serviceDaemon.start();

        final int port = serviceDaemon.getPort();

        final Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
        final ConfigurationFactory config = new ConfigurationFactory();

        final EjbJar ejbJar = new EjbJar();
View Full Code Here

        initProps.setProperty("openejb.deployments.classpath.filter.descriptors", "true");
        OpenEJB.init(initProps, new ServerFederation());
        ejbServer.init(new Properties());

        final ServicePool pool = new ServicePool(ejbServer, 10);
        final ServiceDaemon serviceDaemon = new ServiceDaemon(pool, 0, "localhost");
        serviceDaemon.start();

        final int port = serviceDaemon.getPort();

        final Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
        final ConfigurationFactory config = new ConfigurationFactory();

        final EjbModule ejbModule = new EjbModule(new EjbJar(), new OpenejbJar());
View Full Code Here

    private ServerService server(final Host host) throws Exception {
        ServerService server = new EjbServer();

        server = new HostFilter(server, host);

        server = new ServiceDaemon(server, 0, "localhost");

        server = new AgentFilter(server, agent, host);

        server.init(new Properties());
View Full Code Here

        initProps.setProperty("openejb.deployments.classpath.filter.descriptors", "true");
        OpenEJB.init(initProps, new ServerFederation());
        ejbServer.init(new Properties());

        final ServicePool pool = new ServicePool(keepAliveServer, 10, 5000, true);
        final ServiceDaemon serviceDaemon = new ServiceDaemon(pool, 0, "localhost");
        serviceDaemon.start();

        try {

            final int port = serviceDaemon.getPort();

            final Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
            final ConfigurationFactory config = new ConfigurationFactory();

            final EjbJar ejbJar = new EjbJar();
            ejbJar.addEnterpriseBean(new StatelessBean(EchoBean.class));

            assembler.createApplication(config.configureApplication(ejbJar));

            // good creds

            final int threads = 1;
            final CountDownLatch latch = new CountDownLatch(threads);

            for (int i = 0; i < threads; i++) {
                final Client client = new Client(latch, i, port);
                thread(client, false);
            }

            final boolean await = latch.await(60, TimeUnit.SECONDS);
            assertTrue(await);
        } finally {
            serviceDaemon.stop();
            OpenEJB.destroy();
        }
    }
View Full Code Here

    private int server() throws Exception {
        final EjbServer ejbServer = new EjbServer();
        ejbServer.init(new Properties());

        final ServicePool pool = new ServicePool(ejbServer, 10, 5000, true);
        final ServiceDaemon serviceDaemon = new ServiceDaemon(pool, 0, "localhost");
        serviceDaemon.start();

        return serviceDaemon.getPort();
    }
View Full Code Here

    private ServerService server(final Host host) throws Exception {
        ServerService server = new EjbServer();

        server = new HostFilter(server, host);

        server = new ServiceDaemon(server, 0, "localhost");

        server = new AgentFilter(server, agent, host);

        server.init(new Properties());
View Full Code Here

        initProps.setProperty("openejb.deployments.classpath.filter.descriptors", "true");
        OpenEJB.init(initProps, new ServerFederation());
        ejbServer.init(new Properties());

        final ServicePool pool = new ServicePool(ejbServer, 10);
        final ServiceDaemon serviceDaemon = new ServiceDaemon(pool, 0, "localhost");
        serviceDaemon.start();

        final int port = serviceDaemon.getPort();

        final Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
        final ConfigurationFactory config = new ConfigurationFactory();

        final EjbModule ejbModule = new EjbModule(new EjbJar("testejbmodule"), new OpenejbJar());
View Full Code Here

        final EjbServer ejbServer = new EjbServer();

        OpenEJB.init(new PropertiesBuilder().p(DeploymentsResolver.DEPLOYMENTS_CLASSPATH_PROPERTY, "false").build(), new ServerFederation());
        ejbServer.init(new Properties());

        final ServiceDaemon serviceDaemon = new ServiceDaemon(ejbServer, 0, "localhost");
        serviceDaemon.start();

        final int port = serviceDaemon.getPort();

        final Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
        final ConfigurationFactory config = new ConfigurationFactory();

        final EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new StatelessBean(RemoteWithSecurity.class));
        assembler.createApplication(config.configureApplication(ejbJar));

        try {

            final Context context = new InitialContext(new PropertiesBuilder()
                .p(Context.INITIAL_CONTEXT_FACTORY, RemoteInitialContextFactory.class.getName())
                .p(Context.PROVIDER_URL, "ejbd://127.0.0.1:" + port)
                .p(JNDIContext.AUTHENTICATE_WITH_THE_REQUEST, "true")
                .p("java.naming.security.principal", "foo")
                .p("java.naming.security.credentials", "bar")
                .p("openejb.authentication.realmName", "LM")
                .build());
            final AnInterfaceRemote client = AnInterfaceRemote.class.cast(context.lookup("RemoteWithSecurityRemote"));
            assertNotNull(client);

            assertEquals("foo", client.call());
        } finally {
            serviceDaemon.stop();
            OpenEJB.destroy();
        }
    }
View Full Code Here

        final Properties initProps = new Properties();
        initProps.put(DeploymentsResolver.DEPLOYMENTS_CLASSPATH_PROPERTY, Boolean.toString(false));
        OpenEJB.init(initProps, new ServerFederation());
        ejbServer.init(new Properties());

        final ServiceDaemon serviceDaemon = new ServiceDaemon(ejbServer, 0, "localhost");
        serviceDaemon.start();

        final int port = serviceDaemon.getPort();

        try {

            // good creds
            final Properties props = new Properties();
            props.put("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
            props.put("java.naming.provider.url", "ejbd://127.0.0.1:" + port);
            props.put("openejb.authentication.realmName", "LM"); // reusing LoginModule from AuthentWithRequestTest since it is more specific
            props.put(Context.SECURITY_PRINCIPAL, "foo");
            props.put(Context.SECURITY_CREDENTIALS, "bar");
            new InitialContext(props);

            try {
                props.put(Context.SECURITY_PRINCIPAL, "alfred");
                props.put(Context.SECURITY_CREDENTIALS, "doesnotexist");
                new InitialContext(props);
            } catch (final javax.naming.AuthenticationException e) {
                // pass -- user does not exist
            }

        } catch (final NamingException e) {
            throw e;
        } finally {
            serviceDaemon.stop();
            OpenEJB.destroy();
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.openejb.server.ServiceDaemon$SocketMonitor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.