Package org.apache.openejb.assembler.classic

Examples of org.apache.openejb.assembler.classic.Assembler


    {

        try
        {
            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.createContainer(config.configureService(StatelessSessionContainerInfo.class));
            assembler.createContainer(config.configureService(StatefulSessionContainerInfo.class));
            assembler.createContainer(config.configureService(SingletonSessionContainerInfo.class));

            EjbJarInfo ejbJar = config.configureApplication(buildTestApp(classes));

            assembler.createApplication(ejbJar);

            System.setProperty("openejb.validation.output.level", "VERBOSE");
            Properties properties = new Properties(System.getProperties());
            properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, InitContextFactory.class.getName());
            new InitialContext(properties);
View Full Code Here


        assertEquals(1, appInfo.ejbJars.size());
    }

    public void testMultitplePrefixes() throws Exception {
        System.out.println("*** testMultitplePrefixes ***");
        Assembler assmbler = new Assembler();
        SystemInstance.get().setProperty("openejb.altdd.prefix", "footest, test");
        ConfigurationFactory factory = new ConfigurationFactory();

        URL resource = AltDDPrefixTest.class.getClassLoader().getResource("altddapp2");
        File file = URLs.toFile(resource);
View Full Code Here

     *
     * @throws Exception if something wrong happen
     */
    public void testPersistenceUnit() throws Exception {
        System.out.println("*** testPersistenceUnit ***");
        Assembler assmbler = new Assembler();
        SystemInstance.get().setProperty("openejb.altdd.prefix", "footest, test");
        ConfigurationFactory factory = new ConfigurationFactory();

        URL resource = AltDDPrefixTest.class.getClassLoader().getResource("altddPU1");
        File file = URLs.toFile(resource);
View Full Code Here

     *
     * @throws Exception if something wrong happen
     */
    public void testPersistenceUnitWithAllDD() throws Exception {
        System.out.println("*** testPersistenceUnitWithAllDD ***");
        Assembler assmbler = new Assembler();
        // TODO should be better to add a remove property method
        SystemInstance.get().getProperties().remove("openejb.altdd.prefix");
        ConfigurationFactory factory = new ConfigurationFactory();

        URL resource = AltDDPrefixTest.class.getClassLoader().getResource("altddPU1");
View Full Code Here

    private Assembler assembler;
    private List<ResourceInfo> resources;

    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

     *
     * @throws Exception
     */
    public void testTestOnlyModule() throws Exception {
        System.out.println("*** testTestOnlyModule ***");
        Assembler assmbler = new Assembler();
        SystemInstance.get().setProperty("openejb.altdd.prefix", "test");
        ConfigurationFactory factory = new ConfigurationFactory();

        URL resource = AltDDPrefixTest.class.getClassLoader().getResource("altddapp1");
        File file = URLs.toFile(resource);
View Full Code Here

    /**
     *  For https://issues.apache.org/jira/browse/OPENEJB-1063
     */
    public void badMainClassFormatTest() throws Exception {
  ConfigurationFactory config = new ConfigurationFactory();
        Assembler assembler = new Assembler();

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

        ClientModule clientModule = new ClientModule(null, app.getClassLoader(), app.getJarLocation(), null, null);
       
        // change "." --> "/" to check that main class is changed by the AnnotationDeployer
        String mainClass = MyMainClass.class.getName().replaceAll("\\.", "/");
        clientModule.setMainClass(mainClass);

        app.getClientModules().add(clientModule);
       
        AppInfo appInfo = config.configureApplication(app);
       
        assembler.createApplication(appInfo);
       
        ClientInfo clientInfo = appInfo.clients.get(0);
        Assert.assertNotNull(clientInfo);
        Assert.assertEquals(MyMainClass.class.getName(), clientInfo.mainClass);
    }
View Full Code Here

    @PersistenceContext
    private EntityManager em;

    public void setUp() throws OpenEJBException, NamingException, IOException {
        ConfigurationFactory config = new ConfigurationFactory();
        Assembler assembler = new Assembler();

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

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

        Persistence persistence = new Persistence(new org.apache.openejb.jee.jpa.unit.PersistenceUnit("foo-unit"));
        app.getPersistenceModules().add(new PersistenceModule("root", persistence));

        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new StatelessBean(SuperBean.class));
        app.getEjbModules().add(new EjbModule(ejbJar));

        ClientModule clientModule = new ClientModule(null, app.getClassLoader(), app.getJarLocation(), null, null);
        clientModule.getLocalClients().add(this.getClass().getName());

        app.getClientModules().add(clientModule);
       
        assembler.createApplication(config.configureApplication(app));
    }
View Full Code Here

*/
public class OpenejbLookupTest extends TestCase {

    public void testPlainInitialContext() throws Exception {

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

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

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

        Context context = new InitialContext();

        assertOpenejbUrlLookups(context);
    }
View Full Code Here

        assertOpenejbUrlLookups(context);
    }

    public void testLocalInitialContext() throws Exception {

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

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

        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new StatelessBean(FooBean.class));
        assembler.createApplication(config.configureApplication(ejbJar));
       
        Properties properties = new Properties();
        properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());

        Context context = new InitialContext(properties);
View Full Code Here

TOP

Related Classes of org.apache.openejb.assembler.classic.Assembler

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.