18 package testsuite.clusterj;
20 import java.util.ArrayList;
21 import java.util.List;
23 import testsuite.clusterj.model.Employee;
27 private static final int NUMBER_TO_INSERT = 4;
31 createSessionFactory();
37 createEmployeeInstances(NUMBER_TO_INSERT);
44 public void testUpdate() {
46 for (
int i = 0;
i < NUMBER_TO_INSERT; ++
i) {
49 e.setAge(NUMBER_TO_INSERT -
i);
57 for (
int i = 0;
i < NUMBER_TO_INSERT; ++
i) {
60 int expected = NUMBER_TO_INSERT -
i;
61 int actual = e.getAge();
62 if (expected != actual) {
63 error(
"Failed update: for employee " + i
64 +
" expected age " + expected
65 +
" actual age " + actual);
72 public void testBlindUpdate() {
74 for (
int i = 0; i < NUMBER_TO_INSERT; ++
i) {
79 e.setAge(NUMBER_TO_INSERT - i);
87 for (
int i = 0; i < NUMBER_TO_INSERT; ++
i) {
90 int expected = NUMBER_TO_INSERT -
i;
91 int actual = e.getAge();
92 if (expected != actual) {
93 error(
"Failed update: for employee " + i
94 +
" expected age " + expected
95 +
" actual age " + actual);
102 public void testUpdateAll() {
105 for (
int i = 0; i < NUMBER_TO_INSERT; ++
i) {
108 e.setAge(NUMBER_TO_INSERT - i);
117 for (
int i = 0; i < NUMBER_TO_INSERT; ++
i) {
120 int expected = NUMBER_TO_INSERT -
i;
121 int actual = e.getAge();
122 if (expected != actual) {
123 error(
"Failed update: for employee " + i
124 +
" expected age " + expected
125 +
" actual age " + actual);
132 public void testBlindUpdateAll() {
135 for (
int i = 0; i < NUMBER_TO_INSERT; ++
i) {
140 e.setAge(NUMBER_TO_INSERT - i);
149 for (
int i = 0; i < NUMBER_TO_INSERT; ++
i) {
152 int expected = NUMBER_TO_INSERT -
i;
153 int actual = e.getAge();
154 if (expected != actual) {
155 error(
"Failed update: for employee " + i
156 +
" expected age " + expected
157 +
" actual age " + actual);
164 public void testUpdateAllAutocommit() {
166 for (
int i = 0; i < NUMBER_TO_INSERT; ++
i) {
169 e.setAge(NUMBER_TO_INSERT - i);
177 for (
int i = 0; i < NUMBER_TO_INSERT; ++
i) {
180 int expected = NUMBER_TO_INSERT -
i;
181 int actual = e.getAge();
182 if (expected != actual) {
183 error(
"Failed update: for employee " + i
184 +
" expected age " + expected
185 +
" actual age " + actual);
192 public void testBlindUpdateAllAutocommit() {
194 for (
int i = 0; i < NUMBER_TO_INSERT; ++
i) {
199 e.setAge(NUMBER_TO_INSERT - i);
207 for (
int i = 0; i < NUMBER_TO_INSERT; ++
i) {
210 int expected = NUMBER_TO_INSERT -
i;
211 int actual = e.getAge();
212 if (expected != actual) {
213 error(
"Failed update: for employee " + i
214 +
" expected age " + expected
215 +
" actual age " + actual);