Package org.apache.openejb.config

Examples of org.apache.openejb.config.EjbModule


*/
public class CheckInjectionTargetsTest extends TestCase {

    public void test() throws Exception {

        EjbModule module = new EjbModule(new EjbJar());
        StatelessBean bean = module.getEjbJar().addEnterpriseBean(new StatelessBean("CheeseEjb", "org.acme.CheeseEjb"));

        // Valid
        EnvEntry envEntry = new EnvEntry("count", Integer.class.getName(), "10");
        envEntry.getInjectionTarget().add(new InjectionTarget("org.acme.CheeseEjb", "org.acme.CheeseEjb/count"));
        bean.getEnvEntry().add(envEntry);

        // Invalid
        EnvEntry envEntry2 = new EnvEntry("color", String.class.getName(), "yellow");
        envEntry2.getInjectionTarget().add(new InjectionTarget("org.acme.CheeseEjb", "org.acme.CheeseEjb/setColor"));
        bean.getEnvEntry().add(envEntry2);

        // Invalid
        EnvEntry envEntry3 = new EnvEntry("age", Integer.class.getName(), "5");
        envEntry3.getInjectionTarget().add(new InjectionTarget("org.acme.CheeseEjb", "setAge"));
        bean.getEnvEntry().add(envEntry3);

        CheckInjectionTargets rule = new CheckInjectionTargets();
        rule.module = module;
        rule.validate(module);

        ValidationWarning[] warnings = module.getValidation().getWarnings();
        assertEquals(warnings.length, 2);

    }
View Full Code Here


        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();
View Full Code Here

        interceptor = ejbJar.addInterceptor(new Interceptor(EchoMethodInterceptor.class));
        InterceptorBinding binding = ad.addInterceptorBinding(new InterceptorBinding(bean, interceptor));
        binding.setMethod(new NamedMethod("echo"));

        return new EjbModule(this.getClass().getClassLoader(), this.getClass().getSimpleName(), "test", ejbJar, null);
    }
View Full Code Here

    }

    private void ear(EjbJar... ejbJars) throws OpenEJBException, NamingException, IOException {
        AppModule app = new AppModule(this.getClass().getClassLoader(), "classpath-"+ejbJars.hashCode());
        for (EjbJar ejbJar : ejbJars) {
            app.getEjbModules().add(new EjbModule(ejbJar));
        }
        assembler.createApplication(config.configureApplication(app));
    }
View Full Code Here

*/
public class CheckInjectionTargetsTest extends TestCase {

    public void test() throws Exception {

        EjbModule module = new EjbModule(new EjbJar());
        StatelessBean bean = module.getEjbJar().addEnterpriseBean(new StatelessBean("CheeseEjb", "org.acme.CheeseEjb"));

        // Valid
        EnvEntry envEntry = new EnvEntry("count", Integer.class.getName(), "10");
        envEntry.getInjectionTarget().add(new InjectionTarget("org.acme.CheeseEjb", "org.acme.CheeseEjb/count"));
        bean.getEnvEntry().add(envEntry);

        // Invalid
        EnvEntry envEntry2 = new EnvEntry("color", String.class.getName(), "yellow");
        envEntry2.getInjectionTarget().add(new InjectionTarget("org.acme.CheeseEjb", "org.acme.CheeseEjb/setColor"));
        bean.getEnvEntry().add(envEntry2);

        // Invalid
        EnvEntry envEntry3 = new EnvEntry("age", Integer.class.getName(), "5");
        envEntry3.getInjectionTarget().add(new InjectionTarget("org.acme.CheeseEjb", "setAge"));
        bean.getEnvEntry().add(envEntry3);

        CheckInjectionTargets rule = new CheckInjectionTargets();
        rule.module = module;
        rule.validate(module);

        ValidationWarning[] warnings = module.getValidation().getWarnings();
        assertEquals(warnings.length, 2);

    }
View Full Code Here

        // generate ejb jar application
        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(createJaxbMdb("JmsMdb", BasicMdbBean.class.getName(), MessageListener.class.getName()));
        ejbJar.addEnterpriseBean(createJaxbMdb("FakeMdb", FakeMdb.class.getName(), FakeMessageListener.class.getName()));
        EjbModule ejbModule = new EjbModule(getClass().getClassLoader(), "FakeEjbJar", "fake.jar", ejbJar, null);

        // configure and deploy it
        EjbJarInfo info = config.configureApplication(ejbModule);
        assembler.createEjbJar(info);
    }
View Full Code Here

        EjbJar ejbJar = new EjbJar();

        StatefulBean bean = ejbJar.addEnterpriseBean(new StatefulBean(StatefulSessionBeanTest.TargetBean.class));
        bean.setHomeAndRemote(TargetHome.class, Target.class);

        return new EjbModule(this.getClass().getClassLoader(), this.getClass().getSimpleName(), "test", ejbJar, null);
    }
View Full Code Here

        EjbJar ejbJar = new EjbJar();

        StatelessBean bean = ejbJar.addEnterpriseBean(new StatelessBean(EchoBean.class));
        bean.setServiceEndpoint(EchoServiceEndpoint.class.getName());

        return new EjbModule(this.getClass().getClassLoader(), this.getClass().getSimpleName(), "test", ejbJar, null);
    }
View Full Code Here

        EjbJar ejbJar = new EjbJar();
        StatefulBean bean = ejbJar.addEnterpriseBean(new StatefulBean(TargetBean.class));
        bean.setHomeAndRemote(TargetHome.class, Target.class);

        assembler.createApplication(config.configureApplication(new EjbModule(getClass().getClassLoader(), getClass().getSimpleName(), "test", ejbJar, null)));

        calls.clear();

        InitialContext ctx = new InitialContext();
        TargetHome home = (TargetHome) ctx.lookup("TargetBeanRemoteHome");
View Full Code Here

        EjbJar ejbJar = new EjbJar();

        StatelessBean bean = ejbJar.addEnterpriseBean(new StatelessBean(EchoBean.class));
        bean.setServiceEndpoint(EchoServiceEndpoint.class.getName());

        return new EjbModule(this.getClass().getClassLoader(), this.getClass().getSimpleName(), "test", ejbJar, null);
    }
View Full Code Here

TOP

Related Classes of org.apache.openejb.config.EjbModule

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.