19 package testsuite.clusterj;
21 import com.mysql.clusterj.Query;
23 import com.mysql.clusterj.query.QueryDomainType;
24 import com.mysql.clusterj.query.QueryBuilder;
26 import java.util.ArrayList;
27 import java.util.HashSet;
28 import java.util.List;
31 import testsuite.clusterj.model.Employee;
35 protected static final int NUMBER_TO_INSERT = 4;
39 createSessionFactory();
41 createEmployeeInstances(NUMBER_TO_INSERT);
50 nontransactionalMakePersistent(0);
51 assertTransactionNotActive(
"nontransactionalMakePersistent(0)");
52 nontransactionalFind(0);
53 assertTransactionNotActive(
"nontransactionalFind(0)");
54 nontransactionalQuery(0);
55 assertTransactionNotActive(
"nontransactionalQuery(0)");
56 nontransactionalUpdate(0, 9);
57 assertTransactionNotActive(
"nontransactionalUpdate(0, 9)");
58 nontransactionalMakePersistentAll(1, 4);
59 assertTransactionNotActive(
"nontransactionalMakePersistentAll(1, 4)");
60 nontransactionalUpdateAll(1, 3, 9);
61 assertTransactionNotActive(
"nontransactionalUpdateAll(1, 3, 9)");
62 nontransactionalQuery(0, 1, 2, 3);
63 assertTransactionNotActive(
"nontransactionalQuery(0, 1, 2, 3");
64 nontransactionalDeletePersistent(2);
65 assertTransactionNotActive(
"nontransactionalDeletePersistent(2)");
66 nontransactionalQuery(0, 1, 3);
67 assertTransactionNotActive(
"nontransactionalQuery(0, 1, 3)");
68 nontransactionalDeletePersistentAll(0, 1);
69 assertTransactionNotActive(
"nontransactionalDeletePersistentAll(0, 1)");
70 nontransactionalQuery(1, 3);
71 assertTransactionNotActive(
"nontransactionalQuery(1, 3)");
72 nontransactionalDeletePersistentAll();
73 assertTransactionNotActive(
"nontransactionalDeletePersistentAll()");
74 nontransactionalQuery();
75 assertTransactionNotActive(
"nontransactionalQuery()");
79 protected void nontransactionalDeletePersistent(
int which) {
83 protected void nontransactionalDeletePersistentAll() {
87 protected void nontransactionalDeletePersistentAll(
int low,
int high) {
91 protected void nontransactionalMakePersistent(
int which) {
95 protected void nontransactionalMakePersistentAll(
int low,
int high) {
100 protected void nontransactionalQuery(
int... expected) {
108 for (
int i: expected) {
113 actualList.add(e.getId());
115 errorIfNotEqual(
"Mismatch in query result", expectedList, actualList);
118 protected void nontransactionalUpdate(
int which,
int newAge) {
123 errorIfNotEqual(
"Mismatch in updateAll result", newAge, e.getAge());
126 protected void nontransactionalUpdateAll(
int low,
int high,
int newAge) {
128 for (
int i = low;
i < high; ++
i) {
134 for (
int i = low;
i < high; ++
i) {
136 errorIfNotEqual(
"Mismatch in updateAll result", newAge, e.getAge());
140 private void assertTransactionNotActive(
String where) {
142 error(
"After " + where +
" the transaction was active." );
146 private void nontransactionalFind(
int which) {