// was deployment succesful?
assertTrue("deployed successful : " + isDeployed, isDeployed);
// see if we can get a connection
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup(jndiName);
Connection connection = ds.getConnection();
connection.close();
// undeploy module
undeployModule(module);
// remove module
removeModule(module);
// regenerate with wrong usename
props.put("user-name", "rogue-admin");
module = createModule(module, template, props);
// deploy again
isDeployed = deployModule(module);
// was deployment succesful?
assertTrue("deployed successful : " + isDeployed, isDeployed);
// lookup the datasource again and see if we can get a connection
// it should fail this time
try
{
ds = (DataSource) ic.lookup(jndiName);
connection = ds.getConnection();
fail("Shouldn't reach this point");
}
catch (Exception e)
{
// ok