001: /* Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com
002:
003: This file is part of the db4o open source object database.
004:
005: db4o is free software; you can redistribute it and/or modify it under
006: the terms of version 2 of the GNU General Public License as published
007: by the Free Software Foundation and as clarified by db4objects' GPL
008: interpretation policy, available at
009: http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
010: Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
011: Suite 350, San Mateo, CA 94403, USA.
012:
013: db4o is distributed in the hope that it will be useful, but WITHOUT ANY
014: WARRANTY; without even the implied warranty of MERCHANTABILITY or
015: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
016: for more details.
017:
018: You should have received a copy of the GNU General Public License along
019: with this program; if not, write to the Free Software Foundation, Inc.,
020: 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
021: package com.db4o.db4ounit.jre5.concurrency.collections;
022:
023: import com.db4o.collections.*;
024: import com.db4o.config.*;
025: import com.db4o.db4ounit.jre5.collections.*;
026: import com.db4o.ext.*;
027: import com.db4o.ta.*;
028:
029: import db4ounit.extensions.*;
030:
031: /**
032: * @exclude
033: */
034: public class ArrayList4TestCase extends Db4oConcurrenyTestCase {
035: public static void main(String[] args) {
036: new ArrayList4TestCase().runEmbeddedConcurrency();
037: }
038:
039: protected void store() throws Exception {
040: ArrayList4<Integer> list = new ArrayList4<Integer>();
041: ArrayList4Asserter.createList(list);
042: store(list);
043: }
044:
045: @Override
046: protected void configure(Configuration config) throws Exception {
047: config.add(new TransparentActivationSupport());
048: super .configure(config);
049: }
050:
051: public void conc(ExtObjectContainer oc) throws Exception {
052: retrieveAndAssertNullArrayList4(oc);
053: }
054:
055: public void concAdd(ExtObjectContainer oc, int seq)
056: throws Exception {
057: ArrayList4<Integer> list = retrieveAndAssertNullArrayList4(oc);
058: ArrayList4Asserter.assertAdd(list);
059: markTaskDone(seq, true);
060: waitForAllTasksDone();
061: oc.set(list);
062: }
063:
064: public void checkAdd(ExtObjectContainer oc) throws Exception {
065: ArrayList4<Integer> list = retrieveAndAssertNullArrayList4(oc);
066: ArrayList4Asserter.checkAdd(list);
067: }
068:
069: public void concAdd_LObject(ExtObjectContainer oc, int seq)
070: throws Exception {
071: ArrayList4<Integer> list = retrieveAndAssertNullArrayList4(oc);
072: ArrayList4Asserter.assertAdd_LObject(list);
073: markTaskDone(seq, true);
074: waitForAllTasksDone();
075: oc.set(list);
076: }
077:
078: public void checkAdd_LObject(ExtObjectContainer oc)
079: throws Exception {
080: ArrayList4<Integer> list = retrieveAndAssertNullArrayList4(oc);
081: ArrayList4Asserter.checkAdd_LObject(list);
082: }
083:
084: public void concAddAll_LCollection(ExtObjectContainer oc, int seq)
085: throws Exception {
086: ArrayList4<Integer> list = retrieveAndAssertNullArrayList4(oc);
087: ArrayList4Asserter.assertAddAll_LCollection(list);
088: markTaskDone(seq, true);
089: waitForAllTasksDone();
090: oc.set(list);
091: }
092:
093: public void checkAddAll_LCollection(ExtObjectContainer oc)
094: throws Exception {
095: ArrayList4<Integer> list = retrieveAndAssertNullArrayList4(oc);
096: ArrayList4Asserter.checkAddAll_LCollection(list);
097: }
098:
099: public void concClear(ExtObjectContainer oc, int seq)
100: throws Exception {
101: ArrayList4<Integer> list = retrieveAndAssertNullArrayList4(oc);
102: ArrayList4Asserter.assertClear(list);
103: markTaskDone(seq, true);
104: waitForAllTasksDone();
105: oc.set(list);
106: }
107:
108: public void checkClear(ExtObjectContainer oc) throws Exception {
109: ArrayList4<Integer> list = retrieveAndAssertNullArrayList4(oc);
110: ArrayList4Asserter.checkClear(list);
111: }
112:
113: public void concContains(ExtObjectContainer oc) throws Exception {
114: ArrayList4Asserter
115: .assertContains(retrieveAndAssertNullArrayList4(oc));
116: }
117:
118: public void concContainsAll(ExtObjectContainer oc) throws Exception {
119: ArrayList4Asserter
120: .assertContainsAll(retrieveAndAssertNullArrayList4(oc));
121: }
122:
123: public void concIndexOf(ExtObjectContainer oc) throws Exception {
124: ArrayList4Asserter
125: .assertIndexOf(retrieveAndAssertNullArrayList4(oc));
126: }
127:
128: public void concIsEmpty(ExtObjectContainer oc) throws Exception {
129: ArrayList4Asserter
130: .assertIsEmpty(retrieveAndAssertNullArrayList4(oc));
131: }
132:
133: public void concIterator(ExtObjectContainer oc) throws Exception {
134: ArrayList4Asserter
135: .assertIterator(retrieveAndAssertNullArrayList4(oc));
136: }
137:
138: public void concLastIndexOf(ExtObjectContainer oc) throws Exception {
139: ArrayList4Asserter
140: .assertLastIndexOf(retrieveAndAssertNullArrayList4(oc));
141: }
142:
143: public void concRemove_LObject(ExtObjectContainer oc, int seq)
144: throws Exception {
145: ArrayList4<Integer> list = retrieveAndAssertNullArrayList4(oc);
146: ArrayList4Asserter.assertRemove_LObject(list);
147: markTaskDone(seq, true);
148: waitForAllTasksDone();
149: oc.set(list);
150: }
151:
152: public void checkRemove_LObject(ExtObjectContainer oc)
153: throws Exception {
154: ArrayList4<Integer> list = retrieveAndAssertNullArrayList4(oc);
155: ArrayList4Asserter.checkRemove_LObject(list);
156: }
157:
158: public void concRemoveAll(ExtObjectContainer oc, int seq)
159: throws Exception {
160: ArrayList4<Integer> list = retrieveAndAssertNullArrayList4(oc);
161: ArrayList4Asserter.assertRemoveAll(list);
162: markTaskDone(seq, true);
163: waitForAllTasksDone();
164: oc.set(list);
165: }
166:
167: public void checkRemoveAll(ExtObjectContainer oc) throws Exception {
168: ArrayList4<Integer> list = retrieveAndAssertNullArrayList4(oc);
169: ArrayList4Asserter.checkRemoveAll(list);
170: }
171:
172: public void concSet(ExtObjectContainer oc) throws Exception {
173: ArrayList4Asserter
174: .assertSet(retrieveAndAssertNullArrayList4(oc));
175: }
176:
177: public void concSize(ExtObjectContainer oc) throws Exception {
178: ArrayList4Asserter
179: .assertSize(retrieveAndAssertNullArrayList4(oc));
180: }
181:
182: public void concToArray(ExtObjectContainer oc) throws Exception {
183: ArrayList4Asserter
184: .assertToArray(retrieveAndAssertNullArrayList4(oc));
185: }
186:
187: public void concToArray_LObject(ExtObjectContainer oc)
188: throws Exception {
189: ArrayList4Asserter
190: .assertToArray_LObject(retrieveAndAssertNullArrayList4(oc));
191: }
192:
193: public void concToString(ExtObjectContainer oc) throws Exception {
194: ArrayList4Asserter
195: .assertToString(retrieveAndAssertNullArrayList4(oc));
196: }
197:
198: public void concTrimToSize_EnsureCapacity(ExtObjectContainer oc,
199: int seq) throws Exception {
200: ArrayList4<Integer> list = retrieveAndAssertNullArrayList4(oc);
201: ArrayList4Asserter.assertTrimToSize_EnsureCapacity(list);
202: markTaskDone(seq, true);
203: waitForAllTasksDone();
204: oc.set(list);
205: }
206:
207: public void checkTrimToSize_EnsureCapacity(ExtObjectContainer oc)
208: throws Exception {
209: ArrayList4Asserter
210: .checkTrimToSize_EnsureCapacity(retrieveAndAssertNullArrayList4(oc));
211: }
212:
213: public void concExtOTrimToSize_Remove(ExtObjectContainer oc)
214: throws Exception {
215: ArrayList4Asserter
216: .assertTrimToSize_Remove(retrieveAndAssertNullArrayList4(oc));
217: }
218:
219: public void concTrimToSize_Iterator(ExtObjectContainer oc)
220: throws Exception {
221: ArrayList4Asserter
222: .assertTrimToSize_Iterator(retrieveAndAssertNullArrayList4(oc));
223: }
224:
225: public void concEnsureCapacity_Iterator(ExtObjectContainer oc)
226: throws Exception {
227: ArrayList4Asserter
228: .assertEnsureCapacity_Iterator(retrieveAndAssertNullArrayList4(oc));
229: }
230:
231: public void concClear_Iterator(ExtObjectContainer oc)
232: throws Exception {
233: ArrayList4Asserter
234: .assertClear_Iterator(retrieveAndAssertNullArrayList4(oc));
235: }
236:
237: public void concClone(ExtObjectContainer oc) throws Exception {
238: ArrayList4Asserter
239: .assertClone(retrieveAndAssertNullArrayList4(oc));
240: }
241:
242: public void concEquals(ExtObjectContainer oc) throws Exception {
243: ArrayList4Asserter
244: .assertEquals(retrieveAndAssertNullArrayList4(oc));
245: }
246:
247: public void concIteratorNext_NoSuchElementException(
248: ExtObjectContainer oc) throws Exception {
249: ArrayList4Asserter
250: .assertIteratorNext_NoSuchElementException(retrieveAndAssertNullArrayList4(oc));
251: }
252:
253: public void concIteratorNext_ConcurrentModificationException(
254: ExtObjectContainer oc) throws Exception {
255: ArrayList4Asserter
256: .assertIteratorNext_ConcurrentModificationException(retrieveAndAssertNullArrayList4(oc));
257: }
258:
259: public void concIteratorNext(ExtObjectContainer oc)
260: throws Exception {
261: ArrayList4Asserter
262: .assertIteratorNext(retrieveAndAssertNullArrayList4(oc));
263: }
264:
265: public void concIteratorRemove(ExtObjectContainer oc)
266: throws Exception {
267: ArrayList4Asserter
268: .assertIteratorRemove(retrieveAndAssertNullArrayList4(oc));
269: }
270:
271: public void concRemove_IllegalStateException(ExtObjectContainer oc)
272: throws Exception {
273: ArrayList4Asserter
274: .assertRemove_IllegalStateException(retrieveAndAssertNullArrayList4(oc));
275: }
276:
277: public void concIteratorRemove_ConcurrentModificationException(
278: ExtObjectContainer oc) throws Exception {
279: ArrayList4Asserter
280: .assertIteratorRemove_ConcurrentModificationException(retrieveAndAssertNullArrayList4(oc));
281: }
282:
283: public void concSubList(ExtObjectContainer oc) throws Exception {
284: ArrayList4Asserter
285: .assertSubList(retrieveAndAssertNullArrayList4(oc));
286: }
287:
288: public void concSubList_ConcurrentModification(ExtObjectContainer oc)
289: throws Exception {
290: ArrayList4Asserter
291: .assertSubList_ConcurrentModification(retrieveAndAssertNullArrayList4(oc));
292: }
293:
294: private ArrayList4<Integer> retrieveAndAssertNullArrayList4(
295: ExtObjectContainer oc) throws Exception {
296: return CollectionsUtil.retrieveAndAssertNullArrayList4(oc,
297: reflector());
298: }
299: }
|