use of org.apache.openejb.core.builder.MdbBuilder 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"));
}
use of org.apache.openejb.core.builder.MdbBuilder 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");
}
use of org.apache.openejb.core.builder.MdbBuilder 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");
}
Aggregations