Search in sources :

Example 6 with AppInfo

use of org.apache.openejb.assembler.classic.AppInfo in project tomee by apache.

the class DeployerEjbTest method testDeployWarSave.

@Test
public void testDeployWarSave() throws Exception {
    final Collection<AppInfo> deployedApps = getDeployer().getDeployedApps();
    Assert.assertTrue("Found more than one app", deployedApps.size() < 2);
    final File deployments = new File(SystemInstance.get().getBase().getDirectory("conf", false), "deployments.xml");
    Assert.assertFalse("Found existing: " + deployments.getAbsolutePath(), deployments.exists());
    getAppInfo();
    Assert.assertTrue("Failed to find: " + deployments.getAbsolutePath(), deployments.exists());
}
Also used : File(java.io.File) AppInfo(org.apache.openejb.assembler.classic.AppInfo) Test(org.junit.Test)

Example 7 with AppInfo

use of org.apache.openejb.assembler.classic.AppInfo in project tomee by apache.

the class DeployerEjbTest method testUndeploy.

@Test
public void testUndeploy() throws Exception {
    final AppInfo appInfo = getDeployedApp();
    Assert.assertNotNull("Failed to deploy app", appInfo);
    final Deployer deployer = getDeployer();
    deployer.undeploy(appInfo.path);
    final Collection<AppInfo> appInfos = getAppInfos();
    Assert.assertTrue("Failed to undeploy app", appInfos.size() < 2);
}
Also used : AppInfo(org.apache.openejb.assembler.classic.AppInfo) Test(org.junit.Test)

Example 8 with AppInfo

use of org.apache.openejb.assembler.classic.AppInfo in project tomee by apache.

the class DeployerEjbTest method testReload.

@Test
public void testReload() throws Exception {
    final AppInfo appInfo = getDeployedApp();
    final Deployer deployer = getDeployer();
    deployer.reload(appInfo.path);
    final Collection<AppInfo> deployedApps = deployer.getDeployedApps();
    boolean found = false;
    for (final AppInfo app : deployedApps) {
        if (app.path.equals(appInfo.path)) {
            found = true;
        }
    }
    Assert.assertTrue("Failed to find app after redeploy", found);
}
Also used : AppInfo(org.apache.openejb.assembler.classic.AppInfo) Test(org.junit.Test)

Example 9 with AppInfo

use of org.apache.openejb.assembler.classic.AppInfo in project tomee by apache.

the class DeployerEjbTest method getDeployedApp.

private AppInfo getDeployedApp() throws Exception {
    final Collection<AppInfo> appInfos = getAppInfos();
    AppInfo appInfo = null;
    final File file = warArchive.get();
    if (appInfos.size() < 2) {
        appInfo = getAppInfo();
    } else {
        final String name = file.getName().toLowerCase();
        for (final AppInfo info : appInfos) {
            if (name.contains(info.appId.toLowerCase())) {
                appInfo = info;
            }
        }
    }
    return appInfo;
}
Also used : File(java.io.File) AppInfo(org.apache.openejb.assembler.classic.AppInfo)

Example 10 with AppInfo

use of org.apache.openejb.assembler.classic.AppInfo in project tomee by apache.

the class DeployerEjbTest method testDeployWarNoSave.

@Test
public void testDeployWarNoSave() throws Exception {
    final Collection<AppInfo> deployedApps = getDeployer().getDeployedApps();
    Assert.assertTrue("Found more than one app", deployedApps.size() < 2);
    final File deployments = new File(SystemInstance.get().getBase().getDirectory("conf", false), "deployments.xml");
    if (deployments.exists()) {
        Files.delete(deployments);
    }
    Assert.assertFalse("Found existing: " + deployments.getAbsolutePath(), deployments.exists());
    final Properties p = new Properties();
    p.setProperty(OPENEJB_DEPLOYER_SAVE_DEPLOYMENTS, Boolean.FALSE.toString());
    getAppInfo(p);
    Assert.assertFalse("Found existing: " + deployments.getAbsolutePath(), deployments.exists());
}
Also used : Properties(java.util.Properties) File(java.io.File) AppInfo(org.apache.openejb.assembler.classic.AppInfo) Test(org.junit.Test)

Aggregations

AppInfo (org.apache.openejb.assembler.classic.AppInfo)106 File (java.io.File)50 Assembler (org.apache.openejb.assembler.classic.Assembler)46 Test (org.junit.Test)31 HashMap (java.util.HashMap)29 WebAppInfo (org.apache.openejb.assembler.classic.WebAppInfo)25 EjbJarInfo (org.apache.openejb.assembler.classic.EjbJarInfo)16 OpenEJBException (org.apache.openejb.OpenEJBException)15 AppModule (org.apache.openejb.config.AppModule)14 Map (java.util.Map)13 EjbJar (org.apache.openejb.jee.EjbJar)13 ContainerSystem (org.apache.openejb.spi.ContainerSystem)13 Properties (java.util.Properties)10 EjbModule (org.apache.openejb.config.EjbModule)10 Persistence (org.apache.openejb.jee.jpa.unit.Persistence)10 ArrayList (java.util.ArrayList)9 PersistenceUnit (org.apache.openejb.jee.jpa.unit.PersistenceUnit)9 IOException (java.io.IOException)8 URL (java.net.URL)8 InitialContext (javax.naming.InitialContext)8