use of org.apache.openejb.config.sys.Container in project tomee by apache.
the class ConfigurationFactory method getContainerIds.
protected List<String> getContainerIds() {
final List<String> containerIds = new ArrayList<String>();
final OpenEjbConfiguration runningConfig = getRunningConfig();
if (runningConfig != null) {
for (final ContainerInfo containerInfo : runningConfig.containerSystem.containers) {
containerIds.add(containerInfo.id);
}
}
if (sys != null) {
for (final ContainerInfo containerInfo : sys.containerSystem.containers) {
containerIds.add(containerInfo.id);
}
// the above sys instance
if (openejb != null) {
for (final Container container : openejb.getContainer()) {
containerIds.add(container.getId());
}
}
}
return containerIds;
}
use of org.apache.openejb.config.sys.Container in project tomee by apache.
the class AppContainerTest method resources.
@org.apache.openejb.testing.Module
public Resources resources() {
final Resources resources = new Resources();
final Container container = new Container();
container.setId("theMine");
container.setType("SINGLETON");
container.setClassName("org.apache.openejb.config.AppContainerTest$MySingletonContainer");
resources.getContainer().add(container);
return resources;
}
use of org.apache.openejb.config.sys.Container in project tomee by apache.
the class AppInfoBuilderTest method testShouldCreateContainer.
public void testShouldCreateContainer() throws Exception {
final EjbJar ejbJar = new EjbJar();
final OpenejbJar openejbJar = new OpenejbJar();
final EjbModule ejbModule = new EjbModule(ejbJar, openejbJar);
final AppModule appModule = new AppModule(ejbModule);
appModule.getContainers().add(new Container("my-container", "MESSAGE", null));
final AppInfo appInfo = new AppInfoBuilder(new ConfigurationFactory()).build(appModule);
assertEquals(1, appInfo.containers.size());
final ContainerInfo containerInfo = appInfo.containers.get(0);
assertEquals(appInfo.appId + "/my-container", containerInfo.id);
assertEquals(1, containerInfo.types.size());
assertEquals("MESSAGE", containerInfo.types.get(0));
assertEquals(MdbContainerFactory.class.getName(), containerInfo.className);
assertEquals("Default JMS Resource Adapter", containerInfo.properties.get("ResourceAdapter"));
assertEquals(MessageListener.class.getName(), containerInfo.properties.get("MessageListenerInterface"));
assertEquals(TomEEMessageActivationSpec.class.getName(), containerInfo.properties.get("ActivationSpecClass"));
assertEquals("10", containerInfo.properties.get("InstanceLimit"));
assertEquals("true", containerInfo.properties.get("FailOnUnknownActivationSpec"));
}
use of org.apache.openejb.config.sys.Container in project tomee by apache.
the class ApplicationWideTest method testShouldCreateAResourceAndNotRemoveOnUndeploy.
public void testShouldCreateAResourceAndNotRemoveOnUndeploy() throws Exception {
final EjbModule ejbModule = new EjbModule(new EjbJar(), new OpenejbJar());
final EjbJar ejbJar = ejbModule.getEjbJar();
ejbJar.addEnterpriseBean(new StatelessBean(EchoBean.class));
final AppModule appModule = new AppModule(ejbModule);
final Container container = new Container();
container.setId("My Container");
container.setCtype("STATELESS");
container.getProperties().setProperty("ApplicationWide", "true");
appModule.getContainers().add(container);
final ConfigurationFactory config = new ConfigurationFactory();
final Assembler assembler = new Assembler();
{
// setup the system
assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
}
final AppInfo appInfo = config.configureApplication(appModule);
assembler.createApplication(appInfo);
{
final ContainerSystem containerSystem = assembler.getContainerSystem();
final org.apache.openejb.Container appContainer = containerSystem.getContainer(ejbModule.getModuleId() + "/My Container");
assertNotNull(appContainer);
}
assembler.destroyApplication(appInfo);
{
final ContainerSystem containerSystem = assembler.getContainerSystem();
final org.apache.openejb.Container appContainer = containerSystem.getContainer(ejbModule.getModuleId() + "/My Container");
assertNotNull(appContainer);
}
}
use of org.apache.openejb.config.sys.Container in project tomee by apache.
the class AutoConfigMdbContainerTest method _testConfiguredContainerSelection.
public void _testConfiguredContainerSelection() throws Exception {
// Create a JMS MDB Container
final MdbContainerInfo info = config.configureService(MdbContainerInfo.class);
assertEquals(MessageListener.class.getName(), info.properties.get("MessageListenerInterface"));
assembler.createContainer(info);
// Create an Email MDB Container
final Container container = new Container("EmailContainer", "MESSAGE", null);
final Properties properties = container.getProperties();
properties.setProperty("ResourceAdapter", EmailResourceAdapter.class.getSimpleName());
properties.setProperty("MessageListenerInterface", EmailConsumer.class.getName());
properties.setProperty("ActivationSpecClass", EmailAccountInfo.class.getName());
assembler.createContainer(config.configureService(container, MdbContainerInfo.class));
}
Aggregations