KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > db4o > test > legacy > soda > classes > untypedhierarchy > STInnerClasses


1 /* Copyright (C) 2004 - 2006 db4objects Inc. http://www.db4o.com
2
3 This file is part of the db4o open source object database.
4
5 db4o is free software; you can redistribute it and/or modify it under
6 the terms of version 2 of the GNU General Public License as published
7 by the Free Software Foundation and as clarified by db4objects' GPL
8 interpretation policy, available at
9 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.test.legacy.soda.classes.untypedhierarchy; // Generierter package-Name
22

23 import com.db4o.query.*;
24 import com.db4o.test.legacy.soda.*;
25 import com.db4o.test.legacy.soda.engines.db4o.*;
26
27 /**
28  * epaul:
29  * Shows a bug.
30  *
31  * carlrosenberger:
32  * Fixed!
33  * The error was due to the the behaviour of STCompare.java.
34  * It compared the syntetic fields in inner classes also.
35  * I changed the behaviour to neglect all fields that
36  * contain a "$".
37  *
38  *
39  * @author <a HREF="mailto:Paul-Ebermann@gmx.de">Paul Ebermann</a>
40  * @version 0.1
41  */

42 public class STInnerClasses implements STClass
43 {
44
45     public static transient SodaTest st;
46     
47     public class Parent
48     {
49         public Object JavaDoc child;
50         public Parent(Object JavaDoc o) { child = o; }
51         public String JavaDoc toString() { return "Parent[" + child + "]"; }
52         public Parent() {}
53     }
54
55
56     public class FirstClass
57     {
58         public Object JavaDoc childFirst;
59         public FirstClass(Object JavaDoc o ) { childFirst = o; }
60         public String JavaDoc toString() { return "First[" + childFirst + "]"; }
61         public FirstClass() {}
62     }
63
64     public STInnerClasses ()
65     {
66     }
67
68     public Object JavaDoc[] store() {
69         return new Object JavaDoc[]
70             {
71                 new Parent(new FirstClass("Example")),
72                 new Parent(new FirstClass("no Example")),
73             };
74     }
75
76     /**
77      * Only
78      */

79     public void testNothing()
80     {
81         Query q = st.query();
82         Query q2 = q.descend("child");
83         Object JavaDoc[] r = store();
84         st.expect(q, r);
85         //SodaTest.log(q);
86
}
87
88     /**
89      * Start the test.
90      */

91     public static void main(String JavaDoc[] params)
92     {
93         new SodaTest().run(new STClass[] { new STInnerClasses()}, new STEngine[] {new STDb4o()}, false);
94
95     }
96
97
98     
99 }// STSomeClasses
100
Popular Tags