Examples of AppModule


Examples of org.apache.openejb.config.AppModule

                moduleLocations = configurationFactory.getModulesFromClassPath(null, classLoader);

            } else {

                AppModule appModule = load(map);

                if (appModule != null) return appModule;

                throw invalidModulesValue(modules);
View Full Code Here

Examples of org.apache.openejb.config.AppModule


            final Object modules = map.get(EJBContainer.MODULES);

            map.size();
            AppModule m;

            {
                final Object obj = modules;
                Application application = null;
                AppModule appModule = new AppModule(this.getClass().getClassLoader(), appId);

                {
                    if (obj instanceof EjbJar) {

                        final EjbJar ejbJar = (EjbJar) obj;
                        appModule.getEjbModules().add(new EjbModule(ejbJar));

                    } else if (obj instanceof EnterpriseBean) {

                        final EnterpriseBean bean = (EnterpriseBean) obj;
                        final EjbJar ejbJar = new EjbJar();
                        ejbJar.addEnterpriseBean(bean);
                        appModule.getEjbModules().add(new EjbModule(ejbJar));

                    } else if (obj instanceof Application) {

                        application = (Application) obj;

                    } else if (obj instanceof Connector) {

                        final Connector connector = (Connector) obj;
                        appModule.getConnectorModules().add(new ConnectorModule(connector));

                    } else if (obj instanceof Persistence) {

                        final Persistence persistence = (Persistence) obj;
                        appModule.getPersistenceModules().add(new PersistenceModule("", persistence));

                    } else if (obj instanceof PersistenceUnit) {

                        final PersistenceUnit unit = (PersistenceUnit) obj;
                        appModule.getPersistenceModules().add(new PersistenceModule("", new Persistence(unit)));

                    } else if (obj instanceof Beans) {

                        final Beans beans = (Beans) obj;
                        final EjbModule ejbModule = new EjbModule(new EjbJar());
                        ejbModule.setBeans(beans);
                        appModule.getEjbModules().add(ejbModule);
                    }
                }

                // Application is final in AppModule, which is fine, so we'll create a new one and move everything
                if (application != null) {
                    final AppModule newModule = new AppModule(appModule.getClassLoader(), appModule.getModuleId(), application, false);
                    newModule.getClientModules().addAll(appModule.getClientModules());
                    newModule.getPersistenceModules().addAll(appModule.getPersistenceModules());
                    newModule.getEjbModules().addAll(appModule.getEjbModules());
                    newModule.getConnectorModules().addAll(appModule.getConnectorModules());
                    appModule = newModule;
                }

                m = appModule;
            }
View Full Code Here

Examples of org.apache.openejb.config.AppModule

                    EjbJar actual = new EjbJar("actual");
                    actual.addEnterpriseBean(newBean(beanType, annotation.actual()));


                    AppModule app = new AppModule(this.getClass().getClassLoader(), "test");
                    app.getEjbModules().add(module(expected));
                    app.getEjbModules().add(module(actual));

                    AppInfo appInfo = factory.configureApplication(app);

                    List<ContainerTransaction> expectedList = expected.getAssemblyDescriptor().getContainerTransaction();
                    List<ContainerTransaction> actualList = actual.getAssemblyDescriptor().getContainerTransaction();
View Full Code Here

Examples of org.apache.openejb.config.AppModule

  @Test
  public void testMethodScopeAsynch() throws Exception{
      System.out.println(long.class.getName());
      System.out.println(String[].class.getCanonicalName());
      //Build the application
      AppModule app = new AppModule(this.getClass().getClassLoader(), "testasynch");
        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new StatelessBean(TestBeanC.class));
        ejbJar.addEnterpriseBean(new SingletonBean(TestBeanD.class));
        app.getEjbModules().add(new EjbModule(ejbJar));

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

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

Examples of org.apache.openejb.config.AppModule

  }

  @Test
  public void testClassScopeAsynch() throws Exception {
      //Build the application
        AppModule app = new AppModule(this.getClass().getClassLoader(), "testclassasynch");
        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new SingletonBean(TestBeanA.class));
        app.getEjbModules().add(new EjbModule(ejbJar));

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

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

Examples of org.apache.openejb.config.AppModule

  }

    @Test
    public void testSessionContext() throws Exception {
        //Build the application
        AppModule app = new AppModule(this.getClass().getClassLoader(), "testcanceltask");
        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new StatelessBean(TestBeanB.class));
        app.getEjbModules().add(new EjbModule(ejbJar));

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

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

Examples of org.apache.openejb.config.AppModule

        transactions.add(new ContainerTransaction(TransAttribute.SUPPORTS, null, "MyBmpBean", "*"));
        transactions.add(new ContainerTransaction(TransAttribute.SUPPORTS, null, "MyCmpBean", "*"));
        transactions.add(new ContainerTransaction(TransAttribute.SUPPORTS, null, "MySingletonBean", "*"));

        AppModule module = new AppModule(this.getClass().getClassLoader(), "test");
        module.getEjbModules().add(new EjbModule(ejbJar));
        assembler.createApplication(config.configureApplication(module));

    }
View Full Code Here

Examples of org.apache.openejb.config.AppModule

            // where the same java:module java:app java:global names
            // are re-declared in a compatible way
            ejbJar.addEnterpriseBean(new SingletonBean("Other", Bean.class));

            EjbModule ejbModule = new EjbModule(ejbJar);
            AppModule module = new AppModule(ejbModule);
            app = assembler.createApplication(config.configureApplication(module));
        }

        BeanContext bean = app.getBeanContexts().get(0);

        ModuleContext module = bean.getModuleContext();


        { // app context lookups
            Context context = app.getAppJndiContext();

            assertTrue(context.lookup("app") instanceof Context);
            assertTrue(context.lookup("app/AppName") instanceof String);
            assertTrue(context.lookup("app/green") instanceof DataSource);
            assertTrue(context.lookup("app/testmodule") instanceof Context);
            assertTrue(context.lookup("app/testmodule/Bean") instanceof Bean);
            assertTrue(context.lookup("app/testmodule/Bean!" + Bean.class.getName()) instanceof Bean);
            assertTrue(context.lookup("app/testmodule/Other") instanceof Bean);
            assertTrue(context.lookup("app/testmodule/Other!" + Bean.class.getName()) instanceof Bean);

            assertEquals("testmodule", context.lookup("app/AppName"));
        }

        { // module context lookups
            Context context = module.getModuleJndiContext();

            assertTrue(context.lookup("module") instanceof Context);
            assertTrue(context.lookup("module/ModuleName") instanceof String);
            assertTrue(context.lookup("module/blue") instanceof DataSource);
            assertTrue(context.lookup("module/Bean") instanceof Bean);
View Full Code Here

Examples of org.apache.openejb.config.AppModule

        // where the same java:module java:app java:global names
        // are re-declared in a compatible way
        ejbJar.addEnterpriseBean(new SingletonBean("Other", Bean.class));

        EjbModule ejbModule = new EjbModule(ejbJar);
        AppModule module = new AppModule(ejbModule);
        return assembler.createApplication(config.configureApplication(module));
    }
View Full Code Here

Examples of org.apache.openejb.config.AppModule

        final ClassLoader loader = this.getClass().getClassLoader();

        final ClientModule clientModule = new ClientModule(new ApplicationClient(), loader, "orange-client", OrangeAppClient.class.getName(), "orange-client");

        final AppModule appModule = new AppModule(loader, "testapp");

        appModule.getClientModules().add(clientModule);
        appModule.getEjbModules().add(ejbModule);

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

        final Properties props = new Properties();
        props.put("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.