01: /* Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com
02:
03: This file is part of the db4o open source object database.
04:
05: db4o is free software; you can redistribute it and/or modify it under
06: the terms of version 2 of the GNU General Public License as published
07: by the Free Software Foundation and as clarified by db4objects' GPL
08: interpretation policy, available at
09: http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
10: Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
11: Suite 350, San Mateo, CA 94403, USA.
12:
13: db4o is distributed in the hope that it will be useful, but WITHOUT ANY
14: WARRANTY; without even the implied warranty of MERCHANTABILITY or
15: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16: for more details.
17:
18: You should have received a copy of the GNU General Public License along
19: with this program; if not, write to the Free Software Foundation, Inc.,
20: 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
21: package com.db4o.db4ounit.common.concurrency;
22:
23: import com.db4o.ext.*;
24:
25: import db4ounit.*;
26: import db4ounit.extensions.*;
27:
28: public class ArrayNOrderTestCase extends Db4oClientServerTestCase {
29:
30: public static void main(String[] args) {
31: new ArrayNOrderTestCase().runConcurrency();
32: }
33:
34: public static class Item {
35: public String[][][] s1;
36:
37: public Object[][] o1;
38: }
39:
40: protected void store() {
41: Item item = new Item();
42: item.s1 = new String[2][2][3];
43: item.s1[0][0][0] = "000";
44: item.s1[0][0][1] = "001";
45: item.s1[0][0][2] = "002";
46: item.s1[0][1][0] = "010";
47: item.s1[0][1][1] = "011";
48: item.s1[0][1][2] = "012";
49: item.s1[1][0][0] = "100";
50: item.s1[1][0][1] = "101";
51: item.s1[1][0][2] = "102";
52: item.s1[1][1][0] = "110";
53: item.s1[1][1][1] = "111";
54: item.s1[1][1][2] = "112";
55:
56: item.o1 = new Object[2][2];
57: item.o1[0][0] = new Integer(0);
58: item.o1[0][1] = "01";
59: item.o1[1][0] = new Float(10);
60: item.o1[1][1] = new Double(1.1);
61: store(item);
62: }
63:
64: public void conc(ExtObjectContainer oc) {
65: Item item = (Item) retrieveOnlyInstance(Item.class);
66: assertItem(item);
67: }
68:
69: public void assertItem(Item item) {
70: Assert.areEqual(item.s1[0][0][0], "000");
71: Assert.areEqual(item.s1[0][0][1], "001");
72: Assert.areEqual(item.s1[0][0][2], "002");
73: Assert.areEqual(item.s1[0][1][0], "010");
74: Assert.areEqual(item.s1[0][1][1], "011");
75: Assert.areEqual(item.s1[0][1][2], "012");
76: Assert.areEqual(item.s1[1][0][0], "100");
77: Assert.areEqual(item.s1[1][0][1], "101");
78: Assert.areEqual(item.s1[1][0][2], "102");
79: Assert.areEqual(item.s1[1][1][0], "110");
80: Assert.areEqual(item.s1[1][1][1], "111");
81: Assert.areEqual(item.s1[1][1][2], "112");
82: Assert.areEqual(item.o1[0][0], new Integer(0));
83: Assert.areEqual(item.o1[0][1], "01");
84: Assert.areEqual(item.o1[1][0], new Float(10));
85: Assert.areEqual(item.o1[1][1], new Double(1.1));
86: }
87: }
|