01: /*
02: * BatchModeTest.java
03: * JUnit based test
04: *
05: * Created on February 15, 2003, 12:47 AM
06: */
07:
08: package org.apache.ojb.odmg;
09:
10: import junit.framework.TestSuite;
11: import org.apache.ojb.junit.ODMGTestCase;
12: import org.apache.ojb.odmg.shared.Article;
13: import org.apache.ojb.odmg.shared.ProductGroup;
14: import org.odmg.Transaction;
15:
16: /**
17: * @author Oleg Nitz
18: */
19: public class BatchModeTest extends ODMGTestCase {
20: public static void main(String[] args) {
21: junit.textui.TestRunner.run(new TestSuite(BatchModeTest.class));
22: }
23:
24: public void testBatchStatementsOrder() {
25: // arminw: fixed
26: // if(ojbSkipKnownIssueProblem()) return;
27:
28: Transaction tx = odmg.newTransaction();
29: tx.begin();
30:
31: ProductGroup pg1 = new ProductGroup();
32: pg1.setName("BatchModeTest ProductGroup #1");
33: database.makePersistent(pg1);
34:
35: tx.checkpoint();
36:
37: Article a1 = Article.createInstance();
38: a1.setArticleName("BatchModeTest Article #1");
39: a1.setProductGroup(pg1);
40: pg1.addArticle(a1);
41: database.makePersistent(a1);
42:
43: ProductGroup pg2 = new ProductGroup();
44: pg2.setName("BatchModeTest ProductGroup #2");
45: database.makePersistent(pg2);
46:
47: Article a2 = Article.createInstance();
48: a2.setArticleName("BatchModeTest Article #2");
49: a2.setProductGroup(pg2);
50: pg2.addArticle(a2);
51:
52: tx.checkpoint();
53:
54: database.deletePersistent(a1);
55:
56: tx.checkpoint();
57:
58: database.deletePersistent(pg1);
59: database.deletePersistent(a2);
60: database.deletePersistent(pg2);
61:
62: tx.checkpoint();
63: tx.commit();
64: }
65: }
|