Search in sources :

Example 1 with AppModuleBuilder

use of org.apache.openejb.core.builder.AppModuleBuilder in project tomee by apache.

the class ActivationConfigPropertyOverrideTest method testNoOverrideSetShouldNotOverride.

public void testNoOverrideSetShouldNotOverride() throws OpenEJBException {
    if (SystemInstance.get().getProperties().containsKey("ENTERPRISEBEAN.mdb.activation.destinationType")) {
        SystemInstance.get().getProperties().remove("ENTERPRISEBEAN.mdb.activation.destinationType");
    }
    System.clearProperty("ENTERPRISEBEAN.mdb.activation.destinationType");
    final MessageDrivenBean mdb = new MdbBuilder().anMdb().withActivationProperty("destinationType", "shouldNotBeOverriddenString").build();
    final AppModule appModule = new AppModuleBuilder().anAppModule().withAnMdb(mdb).build();
    final ActivationConfigPropertyOverride activationPropertyOverride = new ActivationConfigPropertyOverride();
    activationPropertyOverride.deploy(appModule);
    assertTrue(containsActivationKeyValuePair(mdb, "destinationType", "shouldNotBeOverriddenString"));
}
Also used : MdbBuilder(org.apache.openejb.core.builder.MdbBuilder) MessageDrivenBean(org.apache.openejb.jee.MessageDrivenBean) AppModuleBuilder(org.apache.openejb.core.builder.AppModuleBuilder)

Example 2 with AppModuleBuilder

use of org.apache.openejb.core.builder.AppModuleBuilder in project tomee by apache.

the class ActivationConfigPropertyOverrideTest method testAddActivationConfigPropertyIfNotAlreadyPresent.

/**
     * If activation property was not present initially, then add the specified
     * one.
     *
     * @throws OpenEJBException
     */
public void testAddActivationConfigPropertyIfNotAlreadyPresent() throws OpenEJBException {
    // set overrides
    System.setProperty("ENTERPRISEBEAN.mdb.activation.destinationType", "testString");
    // deploy with an mdb that has no "destinationType" activationConfigProp
    final MessageDrivenBean mdb = new MdbBuilder().anMdb().build();
    final AppModule appModule = new AppModuleBuilder().anAppModule().withAnMdb(mdb).build();
    final ActivationConfigPropertyOverride activationPropertyOverride = new ActivationConfigPropertyOverride();
    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)

Example 3 with AppModuleBuilder

use of org.apache.openejb.core.builder.AppModuleBuilder in project tomee by apache.

the class ActivationConfigPropertyOverrideTest method testOverrideActivationConfigProperty.

/**
     * System property set should override activationConfigProperty
     *
     * @throws OpenEJBException
     */
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)

Aggregations

AppModuleBuilder (org.apache.openejb.core.builder.AppModuleBuilder)3 MdbBuilder (org.apache.openejb.core.builder.MdbBuilder)3 MessageDrivenBean (org.apache.openejb.jee.MessageDrivenBean)3