if (supportsXA()) {
System.out.println("Checking connections with XADataSource");
System.out.println("XADataSource with no default user");
EmbeddedXADataSource ds = new EmbeddedXADataSource();
ds.setDatabaseName("wombat");
try {
ds.getXAConnection().close();
System.out.println("FAIL - get XADataSource connection with no user");
} catch (SQLException sqle) {
System.out.println("EXPECTED CONNFAIL " + sqle.getMessage());
}
try {
ds.getXAConnection("cynthia", "sara").close();
System.out.println("FAIL - get XADataSource connection with invalid user");
} catch (SQLException sqle) {
System.out.println("EXPECTED CONNFAIL " + sqle.getMessage());
}
checkConnection(ds.getXAConnection("EDWARD", "noodle"));
checkConnection(ds.getXAConnection("FRANCES", "isabella"));
if (supportsUnicodeNames()) {
checkConnection(ds.getXAConnection(zeus, apollo));
}
shutdown();
System.out.println("XADataSource with invalid default user");
ds = new EmbeddedXADataSource();
ds.setDatabaseName("wombat");
ds.setUser("edward");
ds.setPassword("sara");
try {
ds.getXAConnection().close();
System.out.println("FAIL - get XADataSource connection with no user and invalid defaults");
} catch (SQLException sqle) {
System.out.println("EXPECTED CONNFAIL " + sqle.getMessage());
}
checkConnection(ds.getXAConnection("FRANCES", "isabella"));
shutdown();
System.out.println("XADataSource with valid default user");
ds = new EmbeddedXADataSource();
ds.setDatabaseName("wombat");
ds.setUser("EDWARD");
ds.setPassword("noodle");
checkConnection(ds.getXAConnection());
checkConnection(ds.getXAConnection("FRANCES", "isabella"));
shutdown();
}
}