use of org.infinispan.transaction.tm.DummyTransactionManager in project teiid by teiid.
the class TestExternalMatViews method createServer.
private FakeServer createServer(String nodeName, String ispn, String jgroups) throws Exception {
FakeServer server = new FakeServer(false);
EmbeddedConfiguration config = new EmbeddedConfiguration();
config.setInfinispanConfigFile(ispn);
config.setJgroupsConfigFile(jgroups);
config.setNodeName(nodeName);
config.setTransactionManager(new DummyTransactionManager());
server.start(config, true);
return server;
}
use of org.infinispan.transaction.tm.DummyTransactionManager in project teiid by teiid.
the class TestReplication method createServer.
private FakeServer createServer(String ispn, String jgroups) throws Exception {
FakeServer server = new FakeServer(false);
EmbeddedConfiguration config = new EmbeddedConfiguration();
config.setInfinispanConfigFile(ispn);
config.setJgroupsConfigFile(jgroups);
config.setTransactionManager(new DummyTransactionManager());
server.start(config, true);
return server;
}
use of org.infinispan.transaction.tm.DummyTransactionManager in project teiid by teiid.
the class TestEmbeddedServer method testTransactionWithCatchBlocks.
@Test
public void testTransactionWithCatchBlocks() throws Exception {
String ddl = "create procedure px1() returns (a string) as\n" + " begin atomic\n" + " begin\n" + " error 'aaaa';\n" + " end\n" + " exception e\n" + " select 'bbbbb';\n" + " end;\n" + " create procedure px2() returns (a string) as\n" + " begin atomic\n" + " select 'bbbbb';\n" + " end;" + " create foreign table batch_test (a varchar) options (updatable true);";
String sql = "begin \n" + " loop on (select s.a as a from (call procs.px1()) as s) as x \n" + " begin \n" + " insert into batch_test (a) values (x.a); \n" + " end \n" + "end;";
EmbeddedConfiguration ec = new EmbeddedConfiguration();
DummyTransactionManager tm = new DummyTransactionManager();
ec.setTransactionManager(tm);
ec.setUseDisk(false);
es.start(ec);
HardCodedExecutionFactory ef = new HardCodedExecutionFactory();
ef.addUpdate("INSERT INTO batch_test (a) VALUES ('bbbbb')", new int[] { 1 });
es.addTranslator("t", ef);
ModelMetaData mmd1 = new ModelMetaData();
mmd1.setName("procs");
mmd1.addSourceMetadata("ddl", ddl);
mmd1.addSourceMapping("t", "t", null);
es.deployVDB("vdb", mmd1);
Connection c = es.getDriver().connect("jdbc:teiid:vdb", null);
Statement s = c.createStatement();
s.execute(sql);
s.execute("set autoCommitTxn on");
try {
s.execute(sql);
fail();
} catch (SQLException e) {
}
assertNotNull(s.getWarnings());
}
use of org.infinispan.transaction.tm.DummyTransactionManager in project teiid by teiid.
the class TestInternalConnection method testInternalLocalNestedTransactions.
@Test
public void testInternalLocalNestedTransactions() throws Exception {
useTxn = true;
EmbeddedConfiguration config = new EmbeddedConfiguration();
config.setSecurityHelper(new ThreadLocalSecurityHelper());
config.setTransactionManager(new DummyTransactionManager());
es.start(config);
es.deployVDB(new ByteArrayInputStream(vdb.getBytes()));
Connection conn = null;
TeiidDriver driver = es.getDriver();
conn = driver.connect("jdbc:teiid:test;autoCommitTxn=on", null);
try {
PreparedStatement ps = conn.prepareStatement("select func(?)");
ps.setInt(1, 1);
ps.execute();
} finally {
if (conn != null) {
conn.close();
}
}
conn = driver.connect("jdbc:teiid:test;autoCommitTxn=on", null);
try {
conn.setAutoCommit(false);
PreparedStatement ps = conn.prepareStatement("select func(?)");
ps.setInt(1, 1);
ps.execute();
conn.commit();
} finally {
if (conn != null) {
conn.close();
}
}
}
Aggregations