Package org.apache.openejb.config

Examples of org.apache.openejb.config.ConfigurationFactory$Chain


        File file = getFile("org/apache/openejb/openejb-itests-beans/3.0.0-SNAPSHOT/openejb-itests-beans-3.0.0-SNAPSHOT.jar");
        if (file == null) return;

        System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, InitContextFactory.class.getName());

        ConfigurationFactory config = new ConfigurationFactory();
        Assembler assembler = new Assembler();

        assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
        assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
        assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));

        assembler.createConnectionManager(config.configureService(ConnectionManagerInfo.class));

        // managed JDBC
        assembler.createResource(config.configureService("Default JDBC Database", ResourceInfo.class));

        // unmanaged JDBC
        assembler.createResource(config.configureService("Default Unmanaged JDBC Database", ResourceInfo.class));

        // JMS
        assembler.createResource(config.configureService("Default JMS Resource Adapter", ResourceInfo.class));
        assembler.createResource(config.configureService("Default JMS Connection Factory", ResourceInfo.class));

        // containers
        assembler.createContainer(config.configureService(BmpEntityContainerInfo.class));
        assembler.createContainer(config.configureService(CmpEntityContainerInfo.class));
        assembler.createContainer(config.configureService(StatefulSessionContainerInfo.class));
        assembler.createContainer(config.configureService(StatelessSessionContainerInfo.class));
        assembler.createContainer(config.configureService(MdbContainerInfo.class));

        createAndDestroy(assembler, config, file);
        createAndDestroy(assembler, config, file);
        createAndDestroy(assembler, config, file);
    }
View Full Code Here


    private AppInfo configureApplication(AppModule appModule, Configuration configuration) throws OpenEJBException {
        OpenEjbConfiguration openEjbConfiguration = new OpenEjbConfiguration();
        openEjbConfiguration.containerSystem = new ContainerSystemInfo();
        openEjbConfiguration.facilities = new FacilitiesInfo();
        boolean offline = true;
        ConfigurationFactory configurationFactory = new ConfigurationFactory(offline, openEjbConfiguration);
        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(appModule.getClassLoader());
        try {
            addContainerInfos(configuration, openEjbConfiguration.containerSystem, configurationFactory);
            addResourceAdapterMDBInfos(configuration, openEjbConfiguration.containerSystem, configurationFactory);
            //process resource adapters

            return configurationFactory.configureApplication(appModule);
        } finally {
            Thread.currentThread().setContextClassLoader(oldClassLoader);
        }
    }
View Full Code Here

        if (transactionManager == null) {
            throw new NullPointerException("transactionManager is null");
        }

        boolean offline = true;
        configurationFactory = new ConfigurationFactory(offline);
        assembler = new Assembler();

        // install application server
        ApplicationServer applicationServer = new ServerFederation();
        SystemInstance.get().setComponent(ApplicationServer.class, applicationServer);
View Full Code Here

        if (transactionManager == null) {
            throw new NullPointerException("transactionManager is null");
        }

        boolean offline = true;
        configurationFactory = new ConfigurationFactory(offline);
        assembler = new Assembler();

        // install application server
        ApplicationServer applicationServer = new ServerFederation();
        SystemInstance.get().setComponent(ApplicationServer.class, applicationServer);
View Full Code Here

        if (file == null) return;

        System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, InitContextFactory.class.getName());

        ConfigurationFactory config = new ConfigurationFactory();
        Assembler assembler = new Assembler();

        assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
        assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
        assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));

        // managed JDBC
        assembler.createResource(config.configureService("Default JDBC Database", ResourceInfo.class));

        // unmanaged JDBC
        assembler.createResource(config.configureService("Default Unmanaged JDBC Database", ResourceInfo.class));

        // JMS
        assembler.createResource(config.configureService("Default JMS Resource Adapter", ResourceInfo.class));
        assembler.createResource(config.configureService("Default JMS Connection Factory", ResourceInfo.class));

        // containers
        assembler.createContainer(config.configureService(BmpEntityContainerInfo.class));
        assembler.createContainer(config.configureService(CmpEntityContainerInfo.class));
        assembler.createContainer(config.configureService(StatefulSessionContainerInfo.class));
        assembler.createContainer(config.configureService(StatelessSessionContainerInfo.class));
        assembler.createContainer(config.configureService(MdbContainerInfo.class));

        createAndDestroy(assembler, config, file);
        createAndDestroy(assembler, config, file);
        createAndDestroy(assembler, config, file);
    }
View Full Code Here

*/
public class JmsMdbContainerTest extends TestCase {
    public void test() throws Exception {
        System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, InitContextFactory.class.getName());

        ConfigurationFactory config = new ConfigurationFactory();
        Assembler assembler = new Assembler();

        assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
        assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));

        // Setup the descriptor information

        WidgetBean.lifecycle.clear();

        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new MessageDrivenBean(WidgetBean.class));

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

        InitialContext initialContext = new InitialContext();

        ConnectionFactory connectionFactory = (ConnectionFactory) initialContext.lookup("java:openejb/Resource/Default JMS Connection Factory");

View Full Code Here

*/
public class CustomMdbContainerTest extends TestCase {
    public void test() throws Exception {
        System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, InitContextFactory.class.getName());

        ConfigurationFactory config = new ConfigurationFactory();
        Assembler assembler = new Assembler();

        assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
        assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));

        // Setup the descriptor information

        EmailBean.lifecycle.clear();


        AppModule app = new AppModule(this.getClass().getClassLoader(), "testapp");

        Connector connector = new Connector("email-ra");
        ResourceAdapter adapter = connector.setResourceAdapter(new ResourceAdapter(EmailResourceAdapter.class));
        InboundResource inbound = adapter.setInboundResourceAdapter(new InboundResource());
        MessageAdapter messageAdapter = inbound.setMessageAdapter(new MessageAdapter());
        MessageListener listener = messageAdapter.addMessageListener(new MessageListener(EmailConsumer.class, EmailAccountInfo.class));
        listener.getActivationSpec().addRequiredConfigProperty("address");
        app.getResourceModules().add(new ConnectorModule(connector));

        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new MessageDrivenBean(EmailBean.class));
        app.getEjbModules().add(new EjbModule(ejbJar));

        AppInfo appInfo = config.configureApplication(app);
        assembler.createApplication(appInfo);

        InitialContext initialContext = new InitialContext();

        EmailResourceAdapter ra = (EmailResourceAdapter) initialContext.lookup("java:openejb/Resource/email-raRA");
View Full Code Here

public class StatefulInterceptorTest extends TestCase {

    public void test() throws Exception {
        System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, InitContextFactory.class.getName());

        ConfigurationFactory config = new ConfigurationFactory();
        Assembler assembler = new Assembler();

        assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
        assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
        assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));

        // containers
        assembler.createContainer(config.configureService(StatefulSessionContainerInfo.class));

        EjbJarInfo ejbJar = config.configureApplication(buildTestApp());
        assertNotNull(ejbJar);
        assertEquals(1, ejbJar.enterpriseBeans.size());
        assertEquals(1, ejbJar.enterpriseBeans.get(0).aroundInvoke.size());
        assertEquals(1, ejbJar.enterpriseBeans.get(0).postConstruct.size());
View Full Code Here

    public void asList(Object... objects){
        Arrays.asList(objects);
    }

    protected void setUp() throws Exception {
        config = new ConfigurationFactory();
        assembler = new Assembler();

        assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
        assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
        assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();

        System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, InitContextFactory.class.getName());

        ConfigurationFactory config = new ConfigurationFactory();
        Assembler assembler = new Assembler();

        assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
        assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
        assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));

        // containers
        StatefulSessionContainerInfo statefulContainerInfo = config.configureService(StatefulSessionContainerInfo.class);
        statefulContainerInfo.properties.setProperty("PoolSize", "0");
        statefulContainerInfo.properties.setProperty("BulkPassivate", "1");
        assembler.createContainer(statefulContainerInfo);

        // Setup the descriptor information

        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new StatefulBean(WidgetBean.class));

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

        WidgetBean.lifecycle.clear();

        expectedLifecycle = Arrays.asList(Lifecycle.values());
        inTxExpectedLifecycle = new ArrayList<Lifecycle>();
View Full Code Here

TOP

Related Classes of org.apache.openejb.config.ConfigurationFactory$Chain

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.