Search in sources :

Example 1 with DeploymentLoader

use of org.apache.openejb.config.DeploymentLoader in project tomee by apache.

the class ResourcesEarTest method checkAppModuleGetResources.

@Test
public void checkAppModuleGetResources() throws IOException, OpenEJBException {
    final File root = new File("target/ResourcesEarTest/myear/");
    final File temp = Files.mkdirs(new File(root, "META-INF/"));
    IO.copy(URLs.toFile(Thread.currentThread().getContextClassLoader().getResource("descriptor-resources.xml")), new File(temp, "resources.xml"));
    Files.deleteOnExit(root);
    final AtomicReference<AppModule> moduleAtomicReference = new AtomicReference<>();
    new DeploymentLoader() {

        {
            moduleAtomicReference.set(createAppModule(root.getAbsoluteFile(), root.getPath()));
        }
    };
    final AppModule object = moduleAtomicReference.get();
    assertNotNull(object);
    assertEquals(1, object.getResources().size());
    assertEquals("jdbc/descriptors", object.getResources().iterator().next().getId());
}
Also used : AppModule(org.apache.openejb.config.AppModule) DeploymentLoader(org.apache.openejb.config.DeploymentLoader) AtomicReference(java.util.concurrent.atomic.AtomicReference) File(java.io.File) Test(org.junit.Test)

Aggregations

File (java.io.File)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 AppModule (org.apache.openejb.config.AppModule)1 DeploymentLoader (org.apache.openejb.config.DeploymentLoader)1 Test (org.junit.Test)1