Search in sources :

Example 21 with Container

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"));
}
Also used : StatelessSessionContainerInfo(org.apache.openejb.assembler.classic.StatelessSessionContainerInfo) Container(org.apache.openejb.config.sys.Container)

Example 22 with Container

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);
    }
}
Also used : Container(org.apache.openejb.config.sys.Container) ContainerInfo(org.apache.openejb.assembler.classic.ContainerInfo)

Aggregations

Container (org.apache.openejb.config.sys.Container)22 StatelessSessionContainerInfo (org.apache.openejb.assembler.classic.StatelessSessionContainerInfo)10 ContainerInfo (org.apache.openejb.assembler.classic.ContainerInfo)7 AppInfo (org.apache.openejb.assembler.classic.AppInfo)4 MdbContainerInfo (org.apache.openejb.assembler.classic.MdbContainerInfo)4 Resource (org.apache.openejb.config.sys.Resource)4 EjbJar (org.apache.openejb.jee.EjbJar)4 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)3 File (java.io.File)2 URI (java.net.URI)2 Properties (java.util.Properties)2 EJBContainer (javax.ejb.embeddable.EJBContainer)2 MessageListener (javax.jms.MessageListener)2 Assembler (org.apache.openejb.assembler.classic.Assembler)2 BmpEntityContainerInfo (org.apache.openejb.assembler.classic.BmpEntityContainerInfo)2 CmpEntityContainerInfo (org.apache.openejb.assembler.classic.CmpEntityContainerInfo)2 ManagedContainerInfo (org.apache.openejb.assembler.classic.ManagedContainerInfo)2 OpenEjbConfiguration (org.apache.openejb.assembler.classic.OpenEjbConfiguration)2 ResourceInfo (org.apache.openejb.assembler.classic.ResourceInfo)2