in src/main/java/org/apache/openejb/cts/deploy/DeployTestUtil.java [470:515]
public boolean testDistributeModule(ModuleType moduleType, File moduleArchive,
File deploymentPlan, String archiveType, boolean oneDotFiveApi)
throws Exception {
DeploymentManager dm = getDeploymentManager();
Target[] targets = dm.getTargets();
if (targets.length == 0)
return false;
Target targetToDeploy = targets[0];
TargetModuleID distributedModuleID = null;
TargetModuleID[] moduleIDsBeforeDistribute = dm
.getAvailableModules(moduleType, new Target[] { targetToDeploy });
if (archiveType.equals(FILE_ARCHIVE)) {
distributedModuleID = distributeModuleArchive(
new Target[] { targetToDeploy }, moduleArchive, deploymentPlan);
} else {
FileInputStream moduleStream = (moduleArchive == null) ? null
: new FileInputStream(moduleArchive);
FileInputStream planStream = (deploymentPlan == null) ? null
: new FileInputStream(deploymentPlan);
distributedModuleID = distributeModuleStream(
new Target[] { targetToDeploy }, moduleType, moduleStream, planStream,
oneDotFiveApi);
}
// If the distributedModuleID == null, the test is failed
if (distributedModuleID == null)
return false;
// Check if distriburtedModuleID has the same target as deployed target
if (!distributedModuleID.getTarget().getName()
.equals(targetToDeploy.getName()))
return false;
TargetModuleID[] moduleIDsAfterDistribute = dm
.getAvailableModules(moduleType, new Target[] { targetToDeploy });
boolean moduleExistsBeforeDistribute = checkIfModuleExists(
distributedModuleID, moduleIDsBeforeDistribute);
boolean moduleExistsAfterDistribute = checkIfModuleExists(
distributedModuleID, moduleIDsAfterDistribute);
// Clean up....
// undeploy the module
undeployModule(distributedModuleID);
if ((!moduleExistsBeforeDistribute) && moduleExistsAfterDistribute)
return true;
else
return false;
}