use of org.apache.openejb.config.sys.Container in project tomee by apache.
the class ConfigureServiceTest method testConfigureServiceOverriddenProperty.
public void testConfigureServiceOverriddenProperty() throws Exception {
final ConfigurationFactory factory = new ConfigurationFactory();
final Container container = new Container("MyContainer", "STATELESS", "org.acme#CheddarContainer");
container.getProperties().setProperty("myProperty", "Cheese is good");
final StatelessSessionContainerInfo myStatelessContainer = factory.configureService(container, StatelessSessionContainerInfo.class);
assertNotNull(myStatelessContainer);
assertEquals("MyContainer", myStatelessContainer.id);
assertEquals("org.acme.SuperContainer", myStatelessContainer.className);
assertNotNull(myStatelessContainer.constructorArgs);
assertNotNull(myStatelessContainer.properties);
assertNotNull(myStatelessContainer.properties.getProperty("myProperty"));
assertEquals("Cheese is good", myStatelessContainer.properties.getProperty("myProperty"));
}
use of org.apache.openejb.config.sys.Container in project tomee by apache.
the class AutoConfig method processApplicationContainers.
private void processApplicationContainers(final AppModule module, final AppResources appResources) throws OpenEJBException {
if (module.getContainers().isEmpty()) {
return;
}
final String prefix = module.getModuleId() + "/";
for (final Container container : module.getContainers()) {
if (container.getId() == null) {
throw new IllegalStateException("a container can't get a null id: " + container.getType() + " from " + module.getModuleId());
}
if (!container.getId().startsWith(prefix)) {
container.setId(prefix + container.getId());
}
final ContainerInfo containerInfo = configFactory.createContainerInfo(container);
configFactory.install(containerInfo);
appResources.addContainer(containerInfo);
}
}
Aggregations