}
}
public void testUndeployAndDeployAgain() throws Exception
{
FileDeploymentManager fdm = new FileDeploymentManager(Long.MAX_VALUE);
fdm.start();
String filename = "fdm_test_file.xml1";
File file = new File("tests/tmpfiles/" + filename);
file.createNewFile();
FakeDeployer deployer = new FakeDeployer(filename);
try
{
URL url = file.toURI().toURL();
deployer.deploy(url);
fdm.registerDeployer(deployer);
Assert.assertEquals(1, fdm.getDeployers().size());
Assert.assertTrue(fdm.getDeployers().contains(deployer));
Assert.assertEquals(1, fdm.getDeployed().size());
Assert.assertEquals(file.toURI().toURL(), deployer.deployedUrl);
deployer.deployedUrl = null;
file.delete();
// This should cause undeployment
deployer.undeploy(url);
Assert.assertEquals(file.toURI().toURL(), deployer.unDeployedUrl);
fdm.run();
Assert.assertEquals(1, fdm.getDeployers().size());
Assert.assertTrue(fdm.getDeployers().contains(deployer));
Assert.assertEquals(0, fdm.getDeployed().size());
// Recreate file and it should be redeployed
file.createNewFile();
deployer.deploy(url);
fdm.run();
Assert.assertEquals(1, fdm.getDeployers().size());
Assert.assertTrue(fdm.getDeployers().contains(deployer));
Assert.assertEquals(1, fdm.getDeployed().size());
Assert.assertEquals(file.toURI().toURL(), deployer.deployedUrl);
}
finally
{