KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jorm > runtime > gcindex > TestGcIndexStoreLoad


1 /**
2  * JORM: an implementation of a generic mapping system for persistent Java
3  * objects. Two mapping are supported: to RDBMS and to binary files.
4  * Copyright (C) 2001-2003 France Telecom R&D - INRIA
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  * Contact: jorm-team@objectweb.org
21  *
22  */

23
24 package org.objectweb.jorm.runtime.gcindex;
25
26 import org.objectweb.jorm.runtime.TestRuntimeHelper;
27 import org.objectweb.jorm.naming.api.PBinder;
28 import org.objectweb.jorm.facility.naming.basidir.BasidBinder;
29 import org.objectweb.jorm.api.PClassMapping;
30 import org.objectweb.jorm.api.PException;
31 import org.objectweb.jorm.api.PBinding;
32 import org.objectweb.jorm.type.api.PType;
33
34 import java.util.Map JavaDoc;
35 import java.util.HashMap JavaDoc;
36 import java.util.Date JavaDoc;
37
38 /**
39  * @author P. Dechamboux
40  */

41 public class TestGcIndexStoreLoad extends TestRuntimeHelper {
42     private final static String JavaDoc LOGGER_NAME
43             = "test.org.objectweb.jorm.gcindex";
44     private Map JavaDoc cn2Binder = new HashMap JavaDoc();
45
46     public TestGcIndexStoreLoad(String JavaDoc name) throws Exception JavaDoc {
47         super(name);
48     }
49
50     protected String JavaDoc getLoggerName() {
51         return LOGGER_NAME;
52     }
53
54     protected PBinder getBinder(String JavaDoc className) throws Exception JavaDoc {
55         try {
56             PBinder pb = (PBinder) cn2Binder.get(className);
57             if (pb == null) {
58                 pb = new BasidBinder(mapper, className, PClassMapping.CLEANUP_REMOVEALL);
59                 cn2Binder.put(className, pb);
60             }
61             return pb;
62         } catch (PException e) {
63             Exception JavaDoc current = e;
64             while (current instanceof PException
65                     && ((PException) current).getNestedException() != null) {
66                 current = ((PException) current).getNestedException();
67             }
68             throw current;
69         }
70     }
71
72     // Definition of test units
73

74     // test units for byte index
75
private final static String JavaDoc CNIBYTE = "org.objectweb.jorm.pobject.gcindex.ByteIndexCol";
76
77     public void testIByteColEmpty() throws Exception JavaDoc {
78         changeLogger(LOGGER_NAME + ".ibyte");
79         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_BYTE, 0);
80         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_BYTE, 0);
81         PBinding bind = export(CNIBYTE, null);
82         PBinding gcbind = export(CNIBYTE + "/mygc", null);
83         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
84         GcRefAccessor acc2 = new GcRefAccessor(null);
85         writeRead(bind, acc1, acc2);
86         assertEquals("Cannot read the GC reference", acc1, acc2);
87         writeRead(gcbind, gcacc1, gcacc2);
88         assertEquals("Cannot read the byte indexed GC value", gcacc1, gcacc2);
89     }
90
91     public void testIByteColNullElem() throws Exception JavaDoc {
92         changeLogger(LOGGER_NAME + ".ibyte");
93         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_BYTE, 1);
94         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_BYTE, 1);
95         gcacc1.setElem(0, null);
96         PBinding bind = export(CNIBYTE, null);
97         PBinding gcbind = export(CNIBYTE + "/mygc", null);
98         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
99         GcRefAccessor acc2 = new GcRefAccessor(null);
100         writeRead(bind, acc1, acc2);
101         assertEquals("Cannot read the GC reference", acc1, acc2);
102         writeRead(gcbind, gcacc1, gcacc2);
103         assertEquals("Cannot read the byte indexed GC value", gcacc1, gcacc2);
104     }
105
106     public void testIByteColOneElem() throws Exception JavaDoc {
107         int NBELEM = 1;
108         changeLogger(LOGGER_NAME + ".ibyte");
109         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_BYTE, NBELEM);
110         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_BYTE, NBELEM);
111         for (int i = 0; i < NBELEM; i++) {
112             gcacc1.setElem(i, "The string " + i);
113         }
114         PBinding bind = export(CNIBYTE, null);
115         PBinding gcbind = export(CNIBYTE + "/mygc", null);
116         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
117         GcRefAccessor acc2 = new GcRefAccessor(null);
118         writeRead(bind, acc1, acc2);
119         assertEquals("Cannot read the GC reference", acc1, acc2);
120         writeRead(gcbind, gcacc1, gcacc2);
121         assertEquals("Cannot read the byte indexed GC value", gcacc1, gcacc2);
122     }
123
124     public void testIByteColTwoElem() throws Exception JavaDoc {
125         int NBELEM = 2;
126         changeLogger(LOGGER_NAME + ".ibyte");
127         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_BYTE, NBELEM);
128         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_BYTE, NBELEM);
129         for (int i = 0; i < NBELEM; i++) {
130             gcacc1.setElem(i, "The string " + i);
131         }
132         PBinding bind = export(CNIBYTE, null);
133         PBinding gcbind = export(CNIBYTE + "/mygc", null);
134         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
135         GcRefAccessor acc2 = new GcRefAccessor(null);
136         writeRead(bind, acc1, acc2);
137         assertEquals("Cannot read the GC reference", acc1, acc2);
138         writeRead(gcbind, gcacc1, gcacc2);
139         assertEquals("Cannot read the byte indexed GC value", gcacc1, gcacc2);
140     }
141
142     public void testIByteColTenElem() throws Exception JavaDoc {
143         int NBELEM = 10;
144         changeLogger(LOGGER_NAME + ".ibyte");
145         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_BYTE, NBELEM);
146         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_BYTE, NBELEM);
147         for (int i = 0; i < NBELEM; i++) {
148             gcacc1.setElem(i, "The string " + i);
149         }
150         PBinding bind = export(CNIBYTE, null);
151         PBinding gcbind = export(CNIBYTE + "/mygc", null);
152         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
153         GcRefAccessor acc2 = new GcRefAccessor(null);
154         writeRead(bind, acc1, acc2);
155         assertEquals("Cannot read the GC reference", acc1, acc2);
156         writeRead(gcbind, gcacc1, gcacc2);
157         assertEquals("Cannot read the byte indexed GC value", gcacc1, gcacc2);
158     }
159
160     public void testIByteColHundredElem() throws Exception JavaDoc {
161         int NBELEM = 100;
162         changeLogger(LOGGER_NAME + ".ibyte");
163         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_BYTE, NBELEM);
164         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_BYTE, NBELEM);
165         for (int i = 0; i < NBELEM; i++) {
166             gcacc1.setElem(i, "The string " + i);
167         }
168         PBinding bind = export(CNIBYTE, null);
169         PBinding gcbind = export(CNIBYTE + "/mygc", null);
170         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
171         GcRefAccessor acc2 = new GcRefAccessor(null);
172         writeRead(bind, acc1, acc2);
173         assertEquals("Cannot read the GC reference", acc1, acc2);
174         writeRead(gcbind, gcacc1, gcacc2);
175         assertEquals("Cannot read the byte indexed GC value", gcacc1, gcacc2);
176     }
177
178     // test units for char index
179
private final static String JavaDoc CNICHAR = "org.objectweb.jorm.pobject.gcindex.CharIndexCol";
180
181     public void testICharColEmpty() throws Exception JavaDoc {
182         changeLogger(LOGGER_NAME + ".ichar");
183         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_CHAR, 0);
184         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_CHAR, 0);
185         PBinding bind = export(CNICHAR, null);
186         PBinding gcbind = export(CNICHAR + "/mygc", null);
187         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
188         GcRefAccessor acc2 = new GcRefAccessor(null);
189         writeRead(bind, acc1, acc2);
190         assertEquals("Cannot read the GC reference", acc1, acc2);
191         writeRead(gcbind, gcacc1, gcacc2);
192         assertEquals("Cannot read the char indexed GC value", gcacc1, gcacc2);
193     }
194
195     public void testICharColNullElem() throws Exception JavaDoc {
196         changeLogger(LOGGER_NAME + ".ichar");
197         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_CHAR, 1);
198         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_CHAR, 1);
199         gcacc1.setElem(0, null);
200         PBinding bind = export(CNICHAR, null);
201         PBinding gcbind = export(CNICHAR + "/mygc", null);
202         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
203         GcRefAccessor acc2 = new GcRefAccessor(null);
204         writeRead(bind, acc1, acc2);
205         assertEquals("Cannot read the GC reference", acc1, acc2);
206         writeRead(gcbind, gcacc1, gcacc2);
207         assertEquals("Cannot read the char indexed GC value", gcacc1, gcacc2);
208     }
209
210     public void testICharColOneElem() throws Exception JavaDoc {
211         int NBELEM = 1;
212         changeLogger(LOGGER_NAME + ".ichar");
213         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_CHAR, NBELEM);
214         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_CHAR, NBELEM);
215         for (int i = 0; i < NBELEM; i++) {
216             gcacc1.setElem(i, "The string " + i);
217         }
218         PBinding bind = export(CNICHAR, null);
219         PBinding gcbind = export(CNICHAR + "/mygc", null);
220         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
221         GcRefAccessor acc2 = new GcRefAccessor(null);
222         writeRead(bind, acc1, acc2);
223         assertEquals("Cannot read the GC reference", acc1, acc2);
224         writeRead(gcbind, gcacc1, gcacc2);
225         assertEquals("Cannot read the char indexed GC value", gcacc1, gcacc2);
226     }
227
228     public void testICharColTwoElem() throws Exception JavaDoc {
229         int NBELEM = 2;
230         changeLogger(LOGGER_NAME + ".ichar");
231         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_CHAR, NBELEM);
232         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_CHAR, NBELEM);
233         for (int i = 0; i < NBELEM; i++) {
234             gcacc1.setElem(i, "The string " + i);
235         }
236         PBinding bind = export(CNICHAR, null);
237         PBinding gcbind = export(CNICHAR + "/mygc", null);
238         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
239         GcRefAccessor acc2 = new GcRefAccessor(null);
240         writeRead(bind, acc1, acc2);
241         assertEquals("Cannot read the GC reference", acc1, acc2);
242         writeRead(gcbind, gcacc1, gcacc2);
243         assertEquals("Cannot read the char indexed GC value", gcacc1, gcacc2);
244     }
245
246     public void testICharColTenElem() throws Exception JavaDoc {
247         int NBELEM = 10;
248         changeLogger(LOGGER_NAME + ".ichar");
249         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_CHAR, NBELEM);
250         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_CHAR, NBELEM);
251         for (int i = 0; i < NBELEM; i++) {
252             gcacc1.setElem(i, "The string " + i);
253         }
254         PBinding bind = export(CNICHAR, null);
255         PBinding gcbind = export(CNICHAR + "/mygc", null);
256         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
257         GcRefAccessor acc2 = new GcRefAccessor(null);
258         writeRead(bind, acc1, acc2);
259         assertEquals("Cannot read the GC reference", acc1, acc2);
260         writeRead(gcbind, gcacc1, gcacc2);
261         assertEquals("Cannot read the char indexed GC value", gcacc1, gcacc2);
262     }
263
264     public void testICharCol94Elem() throws Exception JavaDoc {
265         int NBELEM = 94;
266         changeLogger(LOGGER_NAME + ".ichar");
267         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_CHAR, NBELEM);
268         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_CHAR, NBELEM);
269         for (int i = 0; i < NBELEM; i++) {
270             gcacc1.setElem(i, "The string " + i);
271         }
272         PBinding bind = export(CNICHAR, null);
273         PBinding gcbind = export(CNICHAR + "/mygc", null);
274         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
275         GcRefAccessor acc2 = new GcRefAccessor(null);
276         writeRead(bind, acc1, acc2);
277         assertEquals("Cannot read the GC reference", acc1, acc2);
278         writeRead(gcbind, gcacc1, gcacc2);
279         assertEquals("Cannot read the char indexed GC value", gcacc1, gcacc2);
280     }
281
282     // test units for short index
283
private final static String JavaDoc CNISHORT = "org.objectweb.jorm.pobject.gcindex.ShortIndexCol";
284
285     public void testIShortColEmpty() throws Exception JavaDoc {
286         changeLogger(LOGGER_NAME + ".ishort");
287         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_SHORT, 0);
288         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_SHORT, 0);
289         PBinding bind = export(CNISHORT, null);
290         PBinding gcbind = export(CNISHORT + "/mygc", null);
291         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
292         GcRefAccessor acc2 = new GcRefAccessor(null);
293         writeRead(bind, acc1, acc2);
294         assertEquals("Cannot read the GC reference", acc1, acc2);
295         writeRead(gcbind, gcacc1, gcacc2);
296         assertEquals("Cannot read the short indexed GC value", gcacc1, gcacc2);
297     }
298
299     public void testIShortColNullElem() throws Exception JavaDoc {
300         changeLogger(LOGGER_NAME + ".ishort");
301         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_SHORT, 1);
302         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_SHORT, 1);
303         gcacc1.setElem(0, null);
304         PBinding bind = export(CNISHORT, null);
305         PBinding gcbind = export(CNISHORT + "/mygc", null);
306         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
307         GcRefAccessor acc2 = new GcRefAccessor(null);
308         writeRead(bind, acc1, acc2);
309         assertEquals("Cannot read the GC reference", acc1, acc2);
310         writeRead(gcbind, gcacc1, gcacc2);
311         assertEquals("Cannot read the short indexed GC value", gcacc1, gcacc2);
312     }
313
314     public void testIShortColOneElem() throws Exception JavaDoc {
315         int NBELEM = 1;
316         changeLogger(LOGGER_NAME + ".ishort");
317         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_SHORT, NBELEM);
318         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_SHORT, NBELEM);
319         for (int i = 0; i < NBELEM; i++) {
320             gcacc1.setElem(i, "The string " + i);
321         }
322         PBinding bind = export(CNISHORT, null);
323         PBinding gcbind = export(CNISHORT + "/mygc", null);
324         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
325         GcRefAccessor acc2 = new GcRefAccessor(null);
326         writeRead(bind, acc1, acc2);
327         assertEquals("Cannot read the GC reference", acc1, acc2);
328         writeRead(gcbind, gcacc1, gcacc2);
329         assertEquals("Cannot read the short indexed GC value", gcacc1, gcacc2);
330     }
331
332     public void testIShortColTwoElem() throws Exception JavaDoc {
333         int NBELEM = 2;
334         changeLogger(LOGGER_NAME + ".ishort");
335         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_SHORT, NBELEM);
336         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_SHORT, NBELEM);
337         for (int i = 0; i < NBELEM; i++) {
338             gcacc1.setElem(i, "The string " + i);
339         }
340         PBinding bind = export(CNISHORT, null);
341         PBinding gcbind = export(CNISHORT + "/mygc", null);
342         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
343         GcRefAccessor acc2 = new GcRefAccessor(null);
344         writeRead(bind, acc1, acc2);
345         assertEquals("Cannot read the GC reference", acc1, acc2);
346         writeRead(gcbind, gcacc1, gcacc2);
347         assertEquals("Cannot read the short indexed GC value", gcacc1, gcacc2);
348     }
349
350     public void testIShortColTenElem() throws Exception JavaDoc {
351         int NBELEM = 10;
352         changeLogger(LOGGER_NAME + ".ishort");
353         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_SHORT, NBELEM);
354         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_SHORT, NBELEM);
355         for (int i = 0; i < NBELEM; i++) {
356             gcacc1.setElem(i, "The string " + i);
357         }
358         PBinding bind = export(CNISHORT, null);
359         PBinding gcbind = export(CNISHORT + "/mygc", null);
360         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
361         GcRefAccessor acc2 = new GcRefAccessor(null);
362         writeRead(bind, acc1, acc2);
363         assertEquals("Cannot read the GC reference", acc1, acc2);
364         writeRead(gcbind, gcacc1, gcacc2);
365         assertEquals("Cannot read the short indexed GC value", gcacc1, gcacc2);
366     }
367
368     public void testIShortColHundredElem() throws Exception JavaDoc {
369         int NBELEM = 100;
370         changeLogger(LOGGER_NAME + ".ishort");
371         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_SHORT, NBELEM);
372         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_SHORT, NBELEM);
373         for (int i = 0; i < NBELEM; i++) {
374             gcacc1.setElem(i, "The string " + i);
375         }
376         PBinding bind = export(CNISHORT, null);
377         PBinding gcbind = export(CNISHORT + "/mygc", null);
378         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
379         GcRefAccessor acc2 = new GcRefAccessor(null);
380         writeRead(bind, acc1, acc2);
381         assertEquals("Cannot read the GC reference", acc1, acc2);
382         writeRead(gcbind, gcacc1, gcacc2);
383         assertEquals("Cannot read the short indexed GC value", gcacc1, gcacc2);
384     }
385
386     // test units for short index
387
private final static String JavaDoc CNIINT = "org.objectweb.jorm.pobject.gcindex.IntIndexCol";
388
389     public void testIIntColEmpty() throws Exception JavaDoc {
390         changeLogger(LOGGER_NAME + ".iint");
391         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_INT, 0);
392         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_INT, 0);
393         PBinding bind = export(CNIINT, null);
394         PBinding gcbind = export(CNIINT + "/mygc", null);
395         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
396         GcRefAccessor acc2 = new GcRefAccessor(null);
397         writeRead(bind, acc1, acc2);
398         assertEquals("Cannot read the GC reference", acc1, acc2);
399         writeRead(gcbind, gcacc1, gcacc2);
400         assertEquals("Cannot read the int indexed GC value", gcacc1, gcacc2);
401     }
402
403     public void testIIntColNullElem() throws Exception JavaDoc {
404         changeLogger(LOGGER_NAME + ".iint");
405         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_INT, 1);
406         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_INT, 1);
407         gcacc1.setElem(0, null);
408         PBinding bind = export(CNIINT, null);
409         PBinding gcbind = export(CNIINT + "/mygc", null);
410         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
411         GcRefAccessor acc2 = new GcRefAccessor(null);
412         writeRead(bind, acc1, acc2);
413         assertEquals("Cannot read the GC reference", acc1, acc2);
414         writeRead(gcbind, gcacc1, gcacc2);
415         assertEquals("Cannot read the int indexed GC value", gcacc1, gcacc2);
416     }
417
418     public void testIIntColOneElem() throws Exception JavaDoc {
419         int NBELEM = 1;
420         changeLogger(LOGGER_NAME + ".iint");
421         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_INT, NBELEM);
422         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_INT, NBELEM);
423         for (int i = 0; i < NBELEM; i++) {
424             gcacc1.setElem(i, "The string " + i);
425         }
426         PBinding bind = export(CNIINT, null);
427         PBinding gcbind = export(CNIINT + "/mygc", null);
428         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
429         GcRefAccessor acc2 = new GcRefAccessor(null);
430         writeRead(bind, acc1, acc2);
431         assertEquals("Cannot read the GC reference", acc1, acc2);
432         writeRead(gcbind, gcacc1, gcacc2);
433         assertEquals("Cannot read the int indexed GC value", gcacc1, gcacc2);
434     }
435
436     public void testIIntColTwoElem() throws Exception JavaDoc {
437         int NBELEM = 2;
438         changeLogger(LOGGER_NAME + ".iint");
439         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_INT, NBELEM);
440         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_INT, NBELEM);
441         for (int i = 0; i < NBELEM; i++) {
442             gcacc1.setElem(i, "The string " + i);
443         }
444         PBinding bind = export(CNIINT, null);
445         PBinding gcbind = export(CNIINT + "/mygc", null);
446         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
447         GcRefAccessor acc2 = new GcRefAccessor(null);
448         writeRead(bind, acc1, acc2);
449         assertEquals("Cannot read the GC reference", acc1, acc2);
450         writeRead(gcbind, gcacc1, gcacc2);
451         assertEquals("Cannot read the int indexed GC value", gcacc1, gcacc2);
452     }
453
454     public void testIIntColTenElem() throws Exception JavaDoc {
455         int NBELEM = 10;
456         changeLogger(LOGGER_NAME + ".iint");
457         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_INT, NBELEM);
458         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_INT, NBELEM);
459         for (int i = 0; i < NBELEM; i++) {
460             gcacc1.setElem(i, "The string " + i);
461         }
462         PBinding bind = export(CNIINT, null);
463         PBinding gcbind = export(CNIINT + "/mygc", null);
464         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
465         GcRefAccessor acc2 = new GcRefAccessor(null);
466         writeRead(bind, acc1, acc2);
467         assertEquals("Cannot read the GC reference", acc1, acc2);
468         writeRead(gcbind, gcacc1, gcacc2);
469         assertEquals("Cannot read the int indexed GC value", gcacc1, gcacc2);
470     }
471
472     public void testIIntColHundredElem() throws Exception JavaDoc {
473         int NBELEM = 100;
474         changeLogger(LOGGER_NAME + ".iint");
475         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_INT, NBELEM);
476         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_INT, NBELEM);
477         for (int i = 0; i < NBELEM; i++) {
478             gcacc1.setElem(i, "The string " + i);
479         }
480         PBinding bind = export(CNIINT, null);
481         PBinding gcbind = export(CNIINT + "/mygc", null);
482         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
483         GcRefAccessor acc2 = new GcRefAccessor(null);
484         writeRead(bind, acc1, acc2);
485         assertEquals("Cannot read the GC reference", acc1, acc2);
486         writeRead(gcbind, gcacc1, gcacc2);
487         assertEquals("Cannot read the int indexed GC value", gcacc1, gcacc2);
488     }
489
490     public void testIIntColThousandElem() throws Exception JavaDoc {
491         int NBELEM = 1000;
492         changeLogger(LOGGER_NAME + ".iint");
493         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_INT, NBELEM);
494         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_INT, NBELEM);
495         for (int i = 0; i < NBELEM; i++) {
496             gcacc1.setElem(i, "The string " + i);
497         }
498         PBinding bind = export(CNIINT, null);
499         PBinding gcbind = export(CNIINT + "/mygc", null);
500         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
501         GcRefAccessor acc2 = new GcRefAccessor(null);
502         writeRead(bind, acc1, acc2);
503         assertEquals("Cannot read the GC reference", acc1, acc2);
504         writeRead(gcbind, gcacc1, gcacc2);
505         assertEquals("Cannot read the int indexed GC value", gcacc1, gcacc2);
506     }
507
508     // test units for short index
509
private final static String JavaDoc CNILONG = "org.objectweb.jorm.pobject.gcindex.LongIndexCol";
510
511     public void testILongColEmpty() throws Exception JavaDoc {
512         changeLogger(LOGGER_NAME + ".ilong");
513         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_LONG, 0);
514         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_LONG, 0);
515         PBinding bind = export(CNILONG, null);
516         PBinding gcbind = export(CNILONG + "/mygc", null);
517         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
518         GcRefAccessor acc2 = new GcRefAccessor(null);
519         writeRead(bind, acc1, acc2);
520         assertEquals("Cannot read the GC reference", acc1, acc2);
521         writeRead(gcbind, gcacc1, gcacc2);
522         assertEquals("Cannot read the long indexed GC value", gcacc1, gcacc2);
523     }
524
525     public void testILongColNullElem() throws Exception JavaDoc {
526         changeLogger(LOGGER_NAME + ".ilong");
527         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_LONG, 1);
528         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_LONG, 1);
529         gcacc1.setElem(0, null);
530         PBinding bind = export(CNILONG, null);
531         PBinding gcbind = export(CNILONG + "/mygc", null);
532         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
533         GcRefAccessor acc2 = new GcRefAccessor(null);
534         writeRead(bind, acc1, acc2);
535         assertEquals("Cannot read the GC reference", acc1, acc2);
536         writeRead(gcbind, gcacc1, gcacc2);
537         assertEquals("Cannot read the long indexed GC value", gcacc1, gcacc2);
538     }
539
540     public void testILongColOneElem() throws Exception JavaDoc {
541         int NBELEM = 1;
542         changeLogger(LOGGER_NAME + ".ilong");
543         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_LONG, NBELEM);
544         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_LONG, NBELEM);
545         for (int i = 0; i < NBELEM; i++) {
546             gcacc1.setElem(i, "The string " + i);
547         }
548         PBinding bind = export(CNILONG, null);
549         PBinding gcbind = export(CNILONG + "/mygc", null);
550         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
551         GcRefAccessor acc2 = new GcRefAccessor(null);
552         writeRead(bind, acc1, acc2);
553         assertEquals("Cannot read the GC reference", acc1, acc2);
554         writeRead(gcbind, gcacc1, gcacc2);
555         assertEquals("Cannot read the long indexed GC value", gcacc1, gcacc2);
556     }
557
558     public void testILongColTwoElem() throws Exception JavaDoc {
559         int NBELEM = 2;
560         changeLogger(LOGGER_NAME + ".ilong");
561         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_LONG, NBELEM);
562         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_LONG, NBELEM);
563         for (int i = 0; i < NBELEM; i++) {
564             gcacc1.setElem(i, "The string " + i);
565         }
566         PBinding bind = export(CNILONG, null);
567         PBinding gcbind = export(CNILONG + "/mygc", null);
568         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
569         GcRefAccessor acc2 = new GcRefAccessor(null);
570         writeRead(bind, acc1, acc2);
571         assertEquals("Cannot read the GC reference", acc1, acc2);
572         writeRead(gcbind, gcacc1, gcacc2);
573         assertEquals("Cannot read the long indexed GC value", gcacc1, gcacc2);
574     }
575
576     public void testILongColTenElem() throws Exception JavaDoc {
577         int NBELEM = 10;
578         changeLogger(LOGGER_NAME + ".ilong");
579         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_LONG, NBELEM);
580         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_LONG, NBELEM);
581         for (int i = 0; i < NBELEM; i++) {
582             gcacc1.setElem(i, "The string " + i);
583         }
584         PBinding bind = export(CNILONG, null);
585         PBinding gcbind = export(CNILONG + "/mygc", null);
586         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
587         GcRefAccessor acc2 = new GcRefAccessor(null);
588         writeRead(bind, acc1, acc2);
589         assertEquals("Cannot read the GC reference", acc1, acc2);
590         writeRead(gcbind, gcacc1, gcacc2);
591         assertEquals("Cannot read the long indexed GC value", gcacc1, gcacc2);
592     }
593
594     public void testILongColHundredElem() throws Exception JavaDoc {
595         int NBELEM = 100;
596         changeLogger(LOGGER_NAME + ".ilong");
597         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_LONG, NBELEM);
598         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_LONG, NBELEM);
599         for (int i = 0; i < NBELEM; i++) {
600             gcacc1.setElem(i, "The string " + i);
601         }
602         PBinding bind = export(CNILONG, null);
603         PBinding gcbind = export(CNILONG + "/mygc", null);
604         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
605         GcRefAccessor acc2 = new GcRefAccessor(null);
606         writeRead(bind, acc1, acc2);
607         assertEquals("Cannot read the GC reference", acc1, acc2);
608         writeRead(gcbind, gcacc1, gcacc2);
609         assertEquals("Cannot read the long indexed GC value", gcacc1, gcacc2);
610     }
611
612     // test units for Byte index
613
private final static String JavaDoc CNIOBJBYTE = "org.objectweb.jorm.pobject.gcindex.ObyteIndexCol";
614
615     public void testIObyteColEmpty() throws Exception JavaDoc {
616         changeLogger(LOGGER_NAME + ".iByte");
617         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJBYTE, 0);
618         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJBYTE, 0);
619         PBinding bind = export(CNIOBJBYTE, null);
620         PBinding gcbind = export(CNIOBJBYTE + "/mygc", null);
621         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
622         GcRefAccessor acc2 = new GcRefAccessor(null);
623         writeRead(bind, acc1, acc2);
624         assertEquals("Cannot read the GC reference", acc1, acc2);
625         writeRead(gcbind, gcacc1, gcacc2);
626         assertEquals("Cannot read the Byte indexed GC value", gcacc1, gcacc2);
627     }
628
629     public void testIObyteColNullElem() throws Exception JavaDoc {
630         changeLogger(LOGGER_NAME + ".iByte");
631         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJBYTE, 1);
632         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJBYTE, 1);
633         gcacc1.setElem(0, null);
634         PBinding bind = export(CNIOBJBYTE, null);
635         PBinding gcbind = export(CNIOBJBYTE + "/mygc", null);
636         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
637         GcRefAccessor acc2 = new GcRefAccessor(null);
638         writeRead(bind, acc1, acc2);
639         assertEquals("Cannot read the GC reference", acc1, acc2);
640         writeRead(gcbind, gcacc1, gcacc2);
641         assertEquals("Cannot read the Byte indexed GC value", gcacc1, gcacc2);
642     }
643
644     public void testIObyteColOneElem() throws Exception JavaDoc {
645         int NBELEM = 1;
646         changeLogger(LOGGER_NAME + ".iByte");
647         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJBYTE, NBELEM);
648         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJBYTE, NBELEM);
649         for (int i = 0; i < NBELEM; i++) {
650             gcacc1.setElem(i, "The string " + i);
651         }
652         PBinding bind = export(CNIOBJBYTE, null);
653         PBinding gcbind = export(CNIOBJBYTE + "/mygc", null);
654         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
655         GcRefAccessor acc2 = new GcRefAccessor(null);
656         writeRead(bind, acc1, acc2);
657         assertEquals("Cannot read the GC reference", acc1, acc2);
658         writeRead(gcbind, gcacc1, gcacc2);
659         assertEquals("Cannot read the Byte indexed GC value", gcacc1, gcacc2);
660     }
661
662     public void testIObyteColTwoElem() throws Exception JavaDoc {
663         int NBELEM = 2;
664         changeLogger(LOGGER_NAME + ".iByte");
665         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJBYTE, NBELEM);
666         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJBYTE, NBELEM);
667         for (int i = 0; i < NBELEM; i++) {
668             gcacc1.setElem(i, "The string " + i);
669         }
670         PBinding bind = export(CNIOBJBYTE, null);
671         PBinding gcbind = export(CNIOBJBYTE + "/mygc", null);
672         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
673         GcRefAccessor acc2 = new GcRefAccessor(null);
674         writeRead(bind, acc1, acc2);
675         assertEquals("Cannot read the GC reference", acc1, acc2);
676         writeRead(gcbind, gcacc1, gcacc2);
677         assertEquals("Cannot read the Byte indexed GC value", gcacc1, gcacc2);
678     }
679
680     public void testIObyteColTenElem() throws Exception JavaDoc {
681         int NBELEM = 10;
682         changeLogger(LOGGER_NAME + ".iByte");
683         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJBYTE, NBELEM);
684         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJBYTE, NBELEM);
685         for (int i = 0; i < NBELEM; i++) {
686             gcacc1.setElem(i, "The string " + i);
687         }
688         PBinding bind = export(CNIOBJBYTE, null);
689         PBinding gcbind = export(CNIOBJBYTE + "/mygc", null);
690         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
691         GcRefAccessor acc2 = new GcRefAccessor(null);
692         writeRead(bind, acc1, acc2);
693         assertEquals("Cannot read the GC reference", acc1, acc2);
694         writeRead(gcbind, gcacc1, gcacc2);
695         assertEquals("Cannot read the Byte indexed GC value", gcacc1, gcacc2);
696     }
697
698     public void testIObyteColHundredElem() throws Exception JavaDoc {
699         int NBELEM = 100;
700         changeLogger(LOGGER_NAME + ".iByte");
701         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJBYTE, NBELEM);
702         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJBYTE, NBELEM);
703         for (int i = 0; i < NBELEM; i++) {
704             gcacc1.setElem(i, "The string " + i);
705         }
706         PBinding bind = export(CNIOBJBYTE, null);
707         PBinding gcbind = export(CNIOBJBYTE + "/mygc", null);
708         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
709         GcRefAccessor acc2 = new GcRefAccessor(null);
710         writeRead(bind, acc1, acc2);
711         assertEquals("Cannot read the GC reference", acc1, acc2);
712         writeRead(gcbind, gcacc1, gcacc2);
713         assertEquals("Cannot read the Byte indexed GC value", gcacc1, gcacc2);
714     }
715
716     // test units for Character index
717
private final static String JavaDoc CNIOBJCHAR = "org.objectweb.jorm.pobject.gcindex.OcharIndexCol";
718
719     public void testIOCharacterColEmpty() throws Exception JavaDoc {
720         changeLogger(LOGGER_NAME + ".iCharacter");
721         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJCHAR, 0);
722         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJCHAR, 0);
723         PBinding bind = export(CNIOBJCHAR, null);
724         PBinding gcbind = export(CNIOBJCHAR + "/mygc", null);
725         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
726         GcRefAccessor acc2 = new GcRefAccessor(null);
727         writeRead(bind, acc1, acc2);
728         assertEquals("Cannot read the GC reference", acc1, acc2);
729         writeRead(gcbind, gcacc1, gcacc2);
730         assertEquals("Cannot read the Character indexed GC value", gcacc1, gcacc2);
731     }
732
733     public void testIOCharacterColNullElem() throws Exception JavaDoc {
734         changeLogger(LOGGER_NAME + ".iCharacter");
735         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJCHAR, 1);
736         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJCHAR, 1);
737         gcacc1.setElem(0, null);
738         PBinding bind = export(CNIOBJCHAR, null);
739         PBinding gcbind = export(CNIOBJCHAR + "/mygc", null);
740         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
741         GcRefAccessor acc2 = new GcRefAccessor(null);
742         writeRead(bind, acc1, acc2);
743         assertEquals("Cannot read the GC reference", acc1, acc2);
744         writeRead(gcbind, gcacc1, gcacc2);
745         assertEquals("Cannot read the Character indexed GC value", gcacc1, gcacc2);
746     }
747
748     public void testIOCharacterColOneElem() throws Exception JavaDoc {
749         int NBELEM = 1;
750         changeLogger(LOGGER_NAME + ".iCharacter");
751         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJCHAR, NBELEM);
752         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJCHAR, NBELEM);
753         for (int i = 0; i < NBELEM; i++) {
754             gcacc1.setElem(i, "The string " + i);
755         }
756         PBinding bind = export(CNIOBJCHAR, null);
757         PBinding gcbind = export(CNIOBJCHAR + "/mygc", null);
758         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
759         GcRefAccessor acc2 = new GcRefAccessor(null);
760         writeRead(bind, acc1, acc2);
761         assertEquals("Cannot read the GC reference", acc1, acc2);
762         writeRead(gcbind, gcacc1, gcacc2);
763         assertEquals("Cannot read the Character indexed GC value", gcacc1, gcacc2);
764     }
765
766     public void testIOCharacterColTwoElem() throws Exception JavaDoc {
767         int NBELEM = 2;
768         changeLogger(LOGGER_NAME + ".iCharacter");
769         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJCHAR, NBELEM);
770         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJCHAR, NBELEM);
771         for (int i = 0; i < NBELEM; i++) {
772             gcacc1.setElem(i, "The string " + i);
773         }
774         PBinding bind = export(CNIOBJCHAR, null);
775         PBinding gcbind = export(CNIOBJCHAR + "/mygc", null);
776         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
777         GcRefAccessor acc2 = new GcRefAccessor(null);
778         writeRead(bind, acc1, acc2);
779         assertEquals("Cannot read the GC reference", acc1, acc2);
780         writeRead(gcbind, gcacc1, gcacc2);
781         assertEquals("Cannot read the Character indexed GC value", gcacc1, gcacc2);
782     }
783
784     public void testIOCharacterColTenElem() throws Exception JavaDoc {
785         int NBELEM = 10;
786         changeLogger(LOGGER_NAME + ".iCharacter");
787         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJCHAR, NBELEM);
788         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJCHAR, NBELEM);
789         for (int i = 0; i < NBELEM; i++) {
790             gcacc1.setElem(i, "The string " + i);
791         }
792         PBinding bind = export(CNIOBJCHAR, null);
793         PBinding gcbind = export(CNIOBJCHAR + "/mygc", null);
794         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
795         GcRefAccessor acc2 = new GcRefAccessor(null);
796         writeRead(bind, acc1, acc2);
797         assertEquals("Cannot read the GC reference", acc1, acc2);
798         writeRead(gcbind, gcacc1, gcacc2);
799         assertEquals("Cannot read the Character indexed GC value", gcacc1, gcacc2);
800     }
801
802     public void testIOCharacterCol94Elem() throws Exception JavaDoc {
803         int NBELEM = 94;
804         changeLogger(LOGGER_NAME + ".iCharacter");
805         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJCHAR, NBELEM);
806         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJCHAR, NBELEM);
807         for (int i = 0; i < NBELEM; i++) {
808             gcacc1.setElem(i, "The string " + i);
809         }
810         PBinding bind = export(CNIOBJCHAR, null);
811         PBinding gcbind = export(CNIOBJCHAR + "/mygc", null);
812         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
813         GcRefAccessor acc2 = new GcRefAccessor(null);
814         writeRead(bind, acc1, acc2);
815         assertEquals("Cannot read the GC reference", acc1, acc2);
816         writeRead(gcbind, gcacc1, gcacc2);
817         assertEquals("Cannot read the Character indexed GC value", gcacc1, gcacc2);
818     }
819
820     // test units for Short index
821
private final static String JavaDoc CNIOBJSHORT = "org.objectweb.jorm.pobject.gcindex.OshortIndexCol";
822
823     public void testIOshortColEmpty() throws Exception JavaDoc {
824         changeLogger(LOGGER_NAME + ".iShort");
825         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJSHORT, 0);
826         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJSHORT, 0);
827         PBinding bind = export(CNIOBJSHORT, null);
828         PBinding gcbind = export(CNIOBJSHORT + "/mygc", null);
829         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
830         GcRefAccessor acc2 = new GcRefAccessor(null);
831         writeRead(bind, acc1, acc2);
832         assertEquals("Cannot read the GC reference", acc1, acc2);
833         writeRead(gcbind, gcacc1, gcacc2);
834         assertEquals("Cannot read the Short indexed GC value", gcacc1, gcacc2);
835     }
836
837     public void testIOShortColNullElem() throws Exception JavaDoc {
838         changeLogger(LOGGER_NAME + ".iShort");
839         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJSHORT, 1);
840         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJSHORT, 1);
841         gcacc1.setElem(0, null);
842         PBinding bind = export(CNIOBJSHORT, null);
843         PBinding gcbind = export(CNIOBJSHORT + "/mygc", null);
844         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
845         GcRefAccessor acc2 = new GcRefAccessor(null);
846         writeRead(bind, acc1, acc2);
847         assertEquals("Cannot read the GC reference", acc1, acc2);
848         writeRead(gcbind, gcacc1, gcacc2);
849         assertEquals("Cannot read the Short indexed GC value", gcacc1, gcacc2);
850     }
851
852     public void testIOShortColOneElem() throws Exception JavaDoc {
853         int NBELEM = 1;
854         changeLogger(LOGGER_NAME + ".iShort");
855         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJSHORT, NBELEM);
856         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJSHORT, NBELEM);
857         for (int i = 0; i < NBELEM; i++) {
858             gcacc1.setElem(i, "The string " + i);
859         }
860         PBinding bind = export(CNIOBJSHORT, null);
861         PBinding gcbind = export(CNIOBJSHORT + "/mygc", null);
862         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
863         GcRefAccessor acc2 = new GcRefAccessor(null);
864         writeRead(bind, acc1, acc2);
865         assertEquals("Cannot read the GC reference", acc1, acc2);
866         writeRead(gcbind, gcacc1, gcacc2);
867         assertEquals("Cannot read the Short indexed GC value", gcacc1, gcacc2);
868     }
869
870     public void testIOShortColTwoElem() throws Exception JavaDoc {
871         int NBELEM = 2;
872         changeLogger(LOGGER_NAME + ".iShort");
873         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJSHORT, NBELEM);
874         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJSHORT, NBELEM);
875         for (int i = 0; i < NBELEM; i++) {
876             gcacc1.setElem(i, "The string " + i);
877         }
878         PBinding bind = export(CNIOBJSHORT, null);
879         PBinding gcbind = export(CNIOBJSHORT + "/mygc", null);
880         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
881         GcRefAccessor acc2 = new GcRefAccessor(null);
882         writeRead(bind, acc1, acc2);
883         assertEquals("Cannot read the GC reference", acc1, acc2);
884         writeRead(gcbind, gcacc1, gcacc2);
885         assertEquals("Cannot read the Short indexed GC value", gcacc1, gcacc2);
886     }
887
888     public void testIOShortColTenElem() throws Exception JavaDoc {
889         int NBELEM = 10;
890         changeLogger(LOGGER_NAME + ".iShort");
891         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJSHORT, NBELEM);
892         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJSHORT, NBELEM);
893         for (int i = 0; i < NBELEM; i++) {
894             gcacc1.setElem(i, "The string " + i);
895         }
896         PBinding bind = export(CNIOBJSHORT, null);
897         PBinding gcbind = export(CNIOBJSHORT + "/mygc", null);
898         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
899         GcRefAccessor acc2 = new GcRefAccessor(null);
900         writeRead(bind, acc1, acc2);
901         assertEquals("Cannot read the GC reference", acc1, acc2);
902         writeRead(gcbind, gcacc1, gcacc2);
903         assertEquals("Cannot read the Short indexed GC value", gcacc1, gcacc2);
904     }
905
906     public void testIOShortColHundredElem() throws Exception JavaDoc {
907         int NBELEM = 100;
908         changeLogger(LOGGER_NAME + ".iShort");
909         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJSHORT, NBELEM);
910         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJSHORT, NBELEM);
911         for (int i = 0; i < NBELEM; i++) {
912             gcacc1.setElem(i, "The string " + i);
913         }
914         PBinding bind = export(CNIOBJSHORT, null);
915         PBinding gcbind = export(CNIOBJSHORT + "/mygc", null);
916         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
917         GcRefAccessor acc2 = new GcRefAccessor(null);
918         writeRead(bind, acc1, acc2);
919         assertEquals("Cannot read the GC reference", acc1, acc2);
920         writeRead(gcbind, gcacc1, gcacc2);
921         assertEquals("Cannot read the Short indexed GC value", gcacc1, gcacc2);
922     }
923
924     // test units for Integer index
925
private final static String JavaDoc CNIOBJINT = "org.objectweb.jorm.pobject.gcindex.OintIndexCol";
926
927     public void testIOintColEmpty() throws Exception JavaDoc {
928         changeLogger(LOGGER_NAME + ".iInteger");
929         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJINT, 0);
930         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJINT, 0);
931         PBinding bind = export(CNIOBJINT, null);
932         PBinding gcbind = export(CNIOBJINT + "/mygc", null);
933         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
934         GcRefAccessor acc2 = new GcRefAccessor(null);
935         writeRead(bind, acc1, acc2);
936         assertEquals("Cannot read the GC reference", acc1, acc2);
937         writeRead(gcbind, gcacc1, gcacc2);
938         assertEquals("Cannot read the Integer indexed GC value", gcacc1, gcacc2);
939     }
940
941     public void testIOintColNullElem() throws Exception JavaDoc {
942         changeLogger(LOGGER_NAME + ".iInteger");
943         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJINT, 1);
944         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJINT, 1);
945         gcacc1.setElem(0, null);
946         PBinding bind = export(CNIOBJINT, null);
947         PBinding gcbind = export(CNIOBJINT + "/mygc", null);
948         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
949         GcRefAccessor acc2 = new GcRefAccessor(null);
950         writeRead(bind, acc1, acc2);
951         assertEquals("Cannot read the GC reference", acc1, acc2);
952         writeRead(gcbind, gcacc1, gcacc2);
953         assertEquals("Cannot read the Integer indexed GC value", gcacc1, gcacc2);
954     }
955
956     public void testIOintColOneElem() throws Exception JavaDoc {
957         int NBELEM = 1;
958         changeLogger(LOGGER_NAME + ".iInteger");
959         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJINT, NBELEM);
960         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJINT, NBELEM);
961         for (int i = 0; i < NBELEM; i++) {
962             gcacc1.setElem(i, "The string " + i);
963         }
964         PBinding bind = export(CNIOBJINT, null);
965         PBinding gcbind = export(CNIOBJINT + "/mygc", null);
966         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
967         GcRefAccessor acc2 = new GcRefAccessor(null);
968         writeRead(bind, acc1, acc2);
969         assertEquals("Cannot read the GC reference", acc1, acc2);
970         writeRead(gcbind, gcacc1, gcacc2);
971         assertEquals("Cannot read the Integer indexed GC value", gcacc1, gcacc2);
972     }
973
974     public void testIOintColTwoElem() throws Exception JavaDoc {
975         int NBELEM = 2;
976         changeLogger(LOGGER_NAME + ".iInteger");
977         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJINT, NBELEM);
978         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJINT, NBELEM);
979         for (int i = 0; i < NBELEM; i++) {
980             gcacc1.setElem(i, "The string " + i);
981         }
982         PBinding bind = export(CNIOBJINT, null);
983         PBinding gcbind = export(CNIOBJINT + "/mygc", null);
984         GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
985         GcRefAccessor acc2 = new GcRefAccessor(null);
986         writeRead(bind, acc1, acc2);
987         assertEquals("Cannot read the GC reference", acc1, acc2);
988         writeRead(gcbind, gcacc1, gcacc2);
989         assertEquals("Cannot read the Integer indexed GC value", gcacc1, gcacc2);
990     }
991
992     public void testIOintColTenElem() throws Exception JavaDoc {
993         int NBELEM = 10;
994         changeLogger(LOGGER_NAME + ".iInteger");
995         GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJINT, NBELEM);
996         GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJINT, NBELEM);
997         for (int i = 0; i < NBELEM; i++) {
998             gcacc1.setElem(i, "The string " + i);
999         }
1000        PBinding bind = export(CNIOBJINT, null);
1001        PBinding gcbind = export(CNIOBJINT + "/mygc", null);
1002        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1003        GcRefAccessor acc2 = new GcRefAccessor(null);
1004        writeRead(bind, acc1, acc2);
1005        assertEquals("Cannot read the GC reference", acc1, acc2);
1006        writeRead(gcbind, gcacc1, gcacc2);
1007        assertEquals("Cannot read the Integer indexed GC value", gcacc1, gcacc2);
1008    }
1009
1010    public void testIOintColHundredElem() throws Exception JavaDoc {
1011        int NBELEM = 100;
1012        changeLogger(LOGGER_NAME + ".iInteger");
1013        GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJINT, NBELEM);
1014        GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJINT, NBELEM);
1015        for (int i = 0; i < NBELEM; i++) {
1016            gcacc1.setElem(i, "The string " + i);
1017        }
1018        PBinding bind = export(CNIOBJINT, null);
1019        PBinding gcbind = export(CNIOBJINT + "/mygc", null);
1020        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1021        GcRefAccessor acc2 = new GcRefAccessor(null);
1022        writeRead(bind, acc1, acc2);
1023        assertEquals("Cannot read the GC reference", acc1, acc2);
1024        writeRead(gcbind, gcacc1, gcacc2);
1025        assertEquals("Cannot read the Integer indexed GC value", gcacc1, gcacc2);
1026    }
1027
1028    // test units for Long index
1029
private final static String JavaDoc CNIOBJLONG = "org.objectweb.jorm.pobject.gcindex.OlongIndexCol";
1030
1031    public void testIOlongColEmpty() throws Exception JavaDoc {
1032        changeLogger(LOGGER_NAME + ".iLong");
1033        GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJLONG, 0);
1034        GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJLONG, 0);
1035        PBinding bind = export(CNIOBJLONG, null);
1036        PBinding gcbind = export(CNIOBJLONG + "/mygc", null);
1037        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1038        GcRefAccessor acc2 = new GcRefAccessor(null);
1039        writeRead(bind, acc1, acc2);
1040        assertEquals("Cannot read the GC reference", acc1, acc2);
1041        writeRead(gcbind, gcacc1, gcacc2);
1042        assertEquals("Cannot read the Long indexed GC value", gcacc1, gcacc2);
1043    }
1044
1045    public void testIOlongColNullElem() throws Exception JavaDoc {
1046        changeLogger(LOGGER_NAME + ".iLong");
1047        GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJLONG, 1);
1048        GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJLONG, 1);
1049        gcacc1.setElem(0, null);
1050        PBinding bind = export(CNIOBJLONG, null);
1051        PBinding gcbind = export(CNIOBJLONG + "/mygc", null);
1052        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1053        GcRefAccessor acc2 = new GcRefAccessor(null);
1054        writeRead(bind, acc1, acc2);
1055        assertEquals("Cannot read the GC reference", acc1, acc2);
1056        writeRead(gcbind, gcacc1, gcacc2);
1057        assertEquals("Cannot read the Long indexed GC value", gcacc1, gcacc2);
1058    }
1059
1060    public void testIOlongColOneElem() throws Exception JavaDoc {
1061        int NBELEM = 1;
1062        changeLogger(LOGGER_NAME + ".iLong");
1063        GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJLONG, NBELEM);
1064        GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJLONG, NBELEM);
1065        for (int i = 0; i < NBELEM; i++) {
1066            gcacc1.setElem(i, "The string " + i);
1067        }
1068        PBinding bind = export(CNIOBJLONG, null);
1069        PBinding gcbind = export(CNIOBJLONG + "/mygc", null);
1070        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1071        GcRefAccessor acc2 = new GcRefAccessor(null);
1072        writeRead(bind, acc1, acc2);
1073        assertEquals("Cannot read the GC reference", acc1, acc2);
1074        writeRead(gcbind, gcacc1, gcacc2);
1075        assertEquals("Cannot read the Long indexed GC value", gcacc1, gcacc2);
1076    }
1077
1078    public void testIOlongColTwoElem() throws Exception JavaDoc {
1079        int NBELEM = 2;
1080        changeLogger(LOGGER_NAME + ".iLong");
1081        GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJLONG, NBELEM);
1082        GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJLONG, NBELEM);
1083        for (int i = 0; i < NBELEM; i++) {
1084            gcacc1.setElem(i, "The string " + i);
1085        }
1086        PBinding bind = export(CNIOBJLONG, null);
1087        PBinding gcbind = export(CNIOBJLONG + "/mygc", null);
1088        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1089        GcRefAccessor acc2 = new GcRefAccessor(null);
1090        writeRead(bind, acc1, acc2);
1091        assertEquals("Cannot read the GC reference", acc1, acc2);
1092        writeRead(gcbind, gcacc1, gcacc2);
1093        assertEquals("Cannot read the Long indexed GC value", gcacc1, gcacc2);
1094    }
1095
1096    public void testIOlongColTenElem() throws Exception JavaDoc {
1097        int NBELEM = 10;
1098        changeLogger(LOGGER_NAME + ".iLong");
1099        GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJLONG, NBELEM);
1100        GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJLONG, NBELEM);
1101        for (int i = 0; i < NBELEM; i++) {
1102            gcacc1.setElem(i, "The string " + i);
1103        }
1104        PBinding bind = export(CNIOBJLONG, null);
1105        PBinding gcbind = export(CNIOBJLONG + "/mygc", null);
1106        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1107        GcRefAccessor acc2 = new GcRefAccessor(null);
1108        writeRead(bind, acc1, acc2);
1109        assertEquals("Cannot read the GC reference", acc1, acc2);
1110        writeRead(gcbind, gcacc1, gcacc2);
1111        assertEquals("Cannot read the Long indexed GC value", gcacc1, gcacc2);
1112    }
1113
1114    public void testIOlongColHundredElem() throws Exception JavaDoc {
1115        int NBELEM = 100;
1116        changeLogger(LOGGER_NAME + ".iLong");
1117        GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_OBJLONG, NBELEM);
1118        GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_OBJLONG, NBELEM);
1119        for (int i = 0; i < NBELEM; i++) {
1120            gcacc1.setElem(i, "The string " + i);
1121        }
1122        PBinding bind = export(CNIOBJLONG, null);
1123        PBinding gcbind = export(CNIOBJLONG + "/mygc", null);
1124        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1125        GcRefAccessor acc2 = new GcRefAccessor(null);
1126        writeRead(bind, acc1, acc2);
1127        assertEquals("Cannot read the GC reference", acc1, acc2);
1128        writeRead(gcbind, gcacc1, gcacc2);
1129        assertEquals("Cannot read the Long indexed GC value", gcacc1, gcacc2);
1130    }
1131
1132    // test units for String index
1133
private final static String JavaDoc CNISTRING = "org.objectweb.jorm.pobject.gcindex.StringIndexCol";
1134
1135    public void testIStringColEmpty() throws Exception JavaDoc {
1136        changeLogger(LOGGER_NAME + ".iString");
1137        GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_STRING, 0);
1138        GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_STRING, 0);
1139        PBinding bind = export(CNISTRING, null);
1140        PBinding gcbind = export(CNISTRING + "/mygc", null);
1141        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1142        GcRefAccessor acc2 = new GcRefAccessor(null);
1143        writeRead(bind, acc1, acc2);
1144        assertEquals("Cannot read the GC reference", acc1, acc2);
1145        writeRead(gcbind, gcacc1, gcacc2);
1146        assertEquals("Cannot read the String indexed GC value", gcacc1, gcacc2);
1147    }
1148
1149    public void testIStringColNullElem() throws Exception JavaDoc {
1150        changeLogger(LOGGER_NAME + ".iString");
1151        GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_STRING, 1);
1152        GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_STRING, 1);
1153        gcacc1.setElem("index_" + 0, null);
1154        PBinding bind = export(CNISTRING, null);
1155        PBinding gcbind = export(CNISTRING + "/mygc", null);
1156        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1157        GcRefAccessor acc2 = new GcRefAccessor(null);
1158        writeRead(bind, acc1, acc2);
1159        assertEquals("Cannot read the GC reference", acc1, acc2);
1160        writeRead(gcbind, gcacc1, gcacc2);
1161        assertEquals("Cannot read the String indexed GC value", gcacc1, gcacc2);
1162    }
1163
1164    public void testIStringColOneElem() throws Exception JavaDoc {
1165        int NBELEM = 1;
1166        changeLogger(LOGGER_NAME + ".iString");
1167        GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_STRING, NBELEM);
1168        GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_STRING, NBELEM);
1169        for (int i = 0; i < NBELEM; i++) {
1170            gcacc1.setElem("index_" + i, "The string " + i);
1171        }
1172        PBinding bind = export(CNISTRING, null);
1173        PBinding gcbind = export(CNISTRING + "/mygc", null);
1174        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1175        GcRefAccessor acc2 = new GcRefAccessor(null);
1176        writeRead(bind, acc1, acc2);
1177        assertEquals("Cannot read the GC reference", acc1, acc2);
1178        writeRead(gcbind, gcacc1, gcacc2);
1179        assertEquals("Cannot read the String indexed GC value", gcacc1, gcacc2);
1180    }
1181
1182    public void testIStringColTwoElem() throws Exception JavaDoc {
1183        int NBELEM = 2;
1184        changeLogger(LOGGER_NAME + ".iString");
1185        GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_STRING, NBELEM);
1186        GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_STRING, NBELEM);
1187        for (int i = 0; i < NBELEM; i++) {
1188            gcacc1.setElem("index_" + i, "The string " + i);
1189        }
1190        PBinding bind = export(CNISTRING, null);
1191        PBinding gcbind = export(CNISTRING + "/mygc", null);
1192        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1193        GcRefAccessor acc2 = new GcRefAccessor(null);
1194        writeRead(bind, acc1, acc2);
1195        assertEquals("Cannot read the GC reference", acc1, acc2);
1196        writeRead(gcbind, gcacc1, gcacc2);
1197        assertEquals("Cannot read the String indexed GC value", gcacc1, gcacc2);
1198    }
1199
1200    public void testIStringColTenElem() throws Exception JavaDoc {
1201        int NBELEM = 10;
1202        changeLogger(LOGGER_NAME + ".iString");
1203        GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_STRING, NBELEM);
1204        GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_STRING, NBELEM);
1205        for (int i = 0; i < NBELEM; i++) {
1206            gcacc1.setElem("index_" + i, "The string " + i);
1207        }
1208        PBinding bind = export(CNISTRING, null);
1209        PBinding gcbind = export(CNISTRING + "/mygc", null);
1210        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1211        GcRefAccessor acc2 = new GcRefAccessor(null);
1212        writeRead(bind, acc1, acc2);
1213        assertEquals("Cannot read the GC reference", acc1, acc2);
1214        writeRead(gcbind, gcacc1, gcacc2);
1215        assertEquals("Cannot read the String indexed GC value", gcacc1, gcacc2);
1216    }
1217
1218    public void testIStringColHundredElem() throws Exception JavaDoc {
1219        int NBELEM = 100;
1220        changeLogger(LOGGER_NAME + ".iString");
1221        GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_STRING, NBELEM);
1222        GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_STRING, NBELEM);
1223        for (int i = 0; i < NBELEM; i++) {
1224            gcacc1.setElem("index_" + i, "The string " + i);
1225        }
1226        PBinding bind = export(CNISTRING, null);
1227        PBinding gcbind = export(CNISTRING + "/mygc", null);
1228        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1229        GcRefAccessor acc2 = new GcRefAccessor(null);
1230        writeRead(bind, acc1, acc2);
1231        assertEquals("Cannot read the GC reference", acc1, acc2);
1232        writeRead(gcbind, gcacc1, gcacc2);
1233        assertEquals("Cannot read the String indexed GC value", gcacc1, gcacc2);
1234    }
1235
1236    // test units for Date index
1237
private final static String JavaDoc CNIDATE = "org.objectweb.jorm.pobject.gcindex.DateIndexCol";
1238
1239    public void testIDateColEmpty() throws Exception JavaDoc {
1240        changeLogger(LOGGER_NAME + ".iDate");
1241        GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_DATE, 0);
1242        GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_DATE, 0);
1243        PBinding bind = export(CNIDATE, null);
1244        PBinding gcbind = export(CNIDATE + "/mygc", null);
1245        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1246        GcRefAccessor acc2 = new GcRefAccessor(null);
1247        writeRead(bind, acc1, acc2);
1248        assertEquals("Cannot read the GC reference", acc1, acc2);
1249        writeRead(gcbind, gcacc1, gcacc2);
1250        assertEquals("Cannot read the Date indexed GC value", gcacc1, gcacc2);
1251    }
1252
1253    public void testIDateColNullElem() throws Exception JavaDoc {
1254        changeLogger(LOGGER_NAME + ".iDate");
1255        GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_DATE, 1);
1256        GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_DATE, 1);
1257        gcacc1.setElem(getTime(), null);
1258        PBinding bind = export(CNIDATE, null);
1259        PBinding gcbind = export(CNIDATE + "/mygc", null);
1260        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1261        GcRefAccessor acc2 = new GcRefAccessor(null);
1262        writeRead(bind, acc1, acc2);
1263        assertEquals("Cannot read the GC reference", acc1, acc2);
1264        writeRead(gcbind, gcacc1, gcacc2);
1265        assertEquals("Cannot read the Date indexed GC value", gcacc1, gcacc2);
1266    }
1267
1268    public void testIDateColOneElem() throws Exception JavaDoc {
1269        int NBELEM = 1;
1270        changeLogger(LOGGER_NAME + ".iDate");
1271        GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_DATE, NBELEM);
1272        GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_DATE, NBELEM);
1273        for (int i = 0; i < NBELEM; i++) {
1274            gcacc1.setElem(new Date JavaDoc((long) (3456000 + i * 10000000)), "The string " + i);
1275        }
1276        PBinding bind = export(CNIDATE, null);
1277        PBinding gcbind = export(CNIDATE + "/mygc", null);
1278        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1279        GcRefAccessor acc2 = new GcRefAccessor(null);
1280        writeRead(bind, acc1, acc2);
1281        assertEquals("Cannot read the GC reference", acc1, acc2);
1282        writeRead(gcbind, gcacc1, gcacc2);
1283        assertEquals("Cannot read the Date indexed GC value", gcacc1, gcacc2);
1284    }
1285
1286    public void testIDateColTwoElem() throws Exception JavaDoc {
1287        int NBELEM = 2;
1288        changeLogger(LOGGER_NAME + ".iDate");
1289        GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_DATE, NBELEM);
1290        GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_DATE, NBELEM);
1291        for (int i = 0; i < NBELEM; i++) {
1292            gcacc1.setElem(new Date JavaDoc((long) (3456000 + i * 10000000)), "The string " + i);
1293        }
1294        PBinding bind = export(CNIDATE, null);
1295        PBinding gcbind = export(CNIDATE + "/mygc", null);
1296        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1297        GcRefAccessor acc2 = new GcRefAccessor(null);
1298        writeRead(bind, acc1, acc2);
1299        assertEquals("Cannot read the GC reference", acc1, acc2);
1300        writeRead(gcbind, gcacc1, gcacc2);
1301        assertEquals("Cannot read the Date indexed GC value", gcacc1, gcacc2);
1302    }
1303
1304    public void testIDateColTenElem() throws Exception JavaDoc {
1305        int NBELEM = 10;
1306        changeLogger(LOGGER_NAME + ".iDate");
1307        GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_DATE, NBELEM);
1308        GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_DATE, NBELEM);
1309        for (int i = 0; i < NBELEM; i++) {
1310            gcacc1.setElem(new Date JavaDoc((long) (3456000 + i * 10000000)), "The string " + i);
1311        }
1312        PBinding bind = export(CNIDATE, null);
1313        PBinding gcbind = export(CNIDATE + "/mygc", null);
1314        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1315        GcRefAccessor acc2 = new GcRefAccessor(null);
1316        writeRead(bind, acc1, acc2);
1317        assertEquals("Cannot read the GC reference", acc1, acc2);
1318        writeRead(gcbind, gcacc1, gcacc2);
1319        assertEquals("Cannot read the Date indexed GC value", gcacc1, gcacc2);
1320    }
1321
1322    public void testIDateColHundredElem() throws Exception JavaDoc {
1323        int NBELEM = 100;
1324        changeLogger(LOGGER_NAME + ".iDate");
1325        GcIndexAccessor gcacc1 = new GcIndexAccessor(PType.TYPECODE_DATE, NBELEM);
1326        GcIndexAccessor gcacc2 = new GcIndexAccessor(PType.TYPECODE_DATE, NBELEM);
1327        for (int i = 0; i < NBELEM; i++) {
1328            gcacc1.setElem(new Date JavaDoc((long) (3456000 + i * 10000000)), "The string " + i);
1329        }
1330        PBinding bind = export(CNIDATE, null);
1331        PBinding gcbind = export(CNIDATE + "/mygc", null);
1332        GcRefAccessor acc1 = new GcRefAccessor(gcbind.getPName());
1333        GcRefAccessor acc2 = new GcRefAccessor(null);
1334        writeRead(bind, acc1, acc2);
1335        assertEquals("Cannot read the GC reference", acc1, acc2);
1336        writeRead(gcbind, gcacc1, gcacc2);
1337        assertEquals("Cannot read the Date indexed GC value", gcacc1, gcacc2);
1338    }
1339}
1340
Popular Tags