Search in sources :

Example 31 with MessageDrivenBean

use of org.apache.openejb.jee.MessageDrivenBean in project tomee by apache.

the class ActivationConfigPropertyOverrideTest method testOverrideActivationConfigProperty.

/**
 * System property set should override activationConfigProperty
 *
 * @throws OpenEJBException
 */
@Test
public void testOverrideActivationConfigProperty() throws OpenEJBException {
    // set overrides for destinationType and check
    System.setProperty("ENTERPRISEBEAN.mdb.activation.destinationType", "testString");
    final MessageDrivenBean mdb = new MdbBuilder().anMdb().withActivationProperty("destinationType", "stringToBeOverriden").build();
    final ActivationConfigPropertyOverride activationPropertyOverride = new ActivationConfigPropertyOverride();
    final AppModule appModule = new AppModuleBuilder().anAppModule().withAnMdb(mdb).build();
    activationPropertyOverride.deploy(appModule);
    assertTrue(containsActivationKeyValuePair(mdb, "destinationType", "testString"));
    assertTrue(mdb.getActivationConfig().getActivationConfigProperty().size() == 1);
    System.clearProperty("ENTERPRISEBEAN.mdb.activation.destinationType");
}
Also used : MdbBuilder(org.apache.openejb.core.builder.MdbBuilder) MessageDrivenBean(org.apache.openejb.jee.MessageDrivenBean) AppModuleBuilder(org.apache.openejb.core.builder.AppModuleBuilder) Test(org.junit.Test) ActivationContainerOverwriteBothConfigurationTest(org.apache.openejb.activemq.ActivationContainerOverwriteBothConfigurationTest)

Example 32 with MessageDrivenBean

use of org.apache.openejb.jee.MessageDrivenBean in project tomee by apache.

the class AutoConfigMdbContainerTest method _testJmsMdbNoContainerConfigured.

public void _testJmsMdbNoContainerConfigured() throws Exception {
    final EjbJar ejbJar = new EjbJar();
    ejbJar.addEnterpriseBean(new MessageDrivenBean(JmsBean.class));
    final EjbJarInfo info = config.configureApplication(ejbJar);
// assembler.createApplication(info);
}
Also used : MessageDrivenBean(org.apache.openejb.jee.MessageDrivenBean) EjbJarInfo(org.apache.openejb.assembler.classic.EjbJarInfo) EjbJar(org.apache.openejb.jee.EjbJar)

Example 33 with MessageDrivenBean

use of org.apache.openejb.jee.MessageDrivenBean in project tomee by apache.

the class AutoConfig method getUsableContainer.

private String getUsableContainer(final Class<? extends ContainerInfo> containerInfoType, final Object bean, final AppResources appResources) {
    if (MessageDrivenBean.class.isInstance(bean)) {
        final MessageDrivenBean messageDrivenBean = (MessageDrivenBean) bean;
        final String messagingType = messageDrivenBean.getMessagingType();
        final List<String> containerIds = appResources.containerIdsByType.get(messagingType);
        if (containerIds != null && !containerIds.isEmpty()) {
            return containerIds.get(0);
        }
    }
    String containerInfo = matchContainer(containerInfoType, bean, appResources.getContainerInfos());
    if (containerInfo == null) {
        // avoid to build configFactory.getContainerInfos() if not needed
        containerInfo = matchContainer(containerInfoType, bean, configFactory.getContainerInfos());
    }
    if (containerInfo != null) {
        return containerInfo;
    }
    return null;
}
Also used : MessageDrivenBean(org.apache.openejb.jee.MessageDrivenBean)

Aggregations

MessageDrivenBean (org.apache.openejb.jee.MessageDrivenBean)32 EjbJar (org.apache.openejb.jee.EjbJar)17 Properties (java.util.Properties)10 ActivationContainerOverwriteBothConfigurationTest (org.apache.openejb.activemq.ActivationContainerOverwriteBothConfigurationTest)9 Test (org.junit.Test)9 EnterpriseBean (org.apache.openejb.jee.EnterpriseBean)7 OpenejbJar (org.apache.openejb.jee.oejb3.OpenejbJar)7 EjbModule (org.apache.openejb.config.EjbModule)6 ActivationConfig (org.apache.openejb.jee.ActivationConfig)6 EjbDeployment (org.apache.openejb.jee.oejb3.EjbDeployment)6 List (java.util.List)5 OpenEJBException (org.apache.openejb.OpenEJBException)4 Assembler (org.apache.openejb.assembler.classic.Assembler)4 SecurityServiceInfo (org.apache.openejb.assembler.classic.SecurityServiceInfo)4 TransactionServiceInfo (org.apache.openejb.assembler.classic.TransactionServiceInfo)4 AppModule (org.apache.openejb.config.AppModule)4 ConfigurationFactory (org.apache.openejb.config.ConfigurationFactory)4 InitContextFactory (org.apache.openejb.core.ivm.naming.InitContextFactory)4 ActivationConfigProperty (org.apache.openejb.jee.ActivationConfigProperty)4 InitialContext (javax.naming.InitialContext)3