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.test.legacy.soda.classes.untypedhierarchy; // Generierter package-Name
022:
023: import com.db4o.query.*;
024: import com.db4o.test.legacy.soda.*;
025: import com.db4o.test.legacy.soda.engines.db4o.*;
026:
027: /**
028: * epaul:
029: * Shows a bug.
030: *
031: * carlrosenberger:
032: * Fixed!
033: * The error was due to the the behaviour of STCompare.java.
034: * It compared the syntetic fields in inner classes also.
035: * I changed the behaviour to neglect all fields that
036: * contain a "$".
037: *
038: *
039: * @author <a href="mailto:Paul-Ebermann@gmx.de">Paul Ebermann</a>
040: * @version 0.1
041: */
042: public class STInnerClasses implements STClass {
043:
044: public static transient SodaTest st;
045:
046: public class Parent {
047: public Object child;
048:
049: public Parent(Object o) {
050: child = o;
051: }
052:
053: public String toString() {
054: return "Parent[" + child + "]";
055: }
056:
057: public Parent() {
058: }
059: }
060:
061: public class FirstClass {
062: public Object childFirst;
063:
064: public FirstClass(Object o) {
065: childFirst = o;
066: }
067:
068: public String toString() {
069: return "First[" + childFirst + "]";
070: }
071:
072: public FirstClass() {
073: }
074: }
075:
076: public STInnerClasses() {
077: }
078:
079: public Object[] store() {
080: return new Object[] { new Parent(new FirstClass("Example")),
081: new Parent(new FirstClass("no Example")), };
082: }
083:
084: /**
085: * Only
086: */
087: public void testNothing() {
088: Query q = st.query();
089: Query q2 = q.descend("child");
090: Object[] r = store();
091: st.expect(q, r);
092: //SodaTest.log(q);
093: }
094:
095: /**
096: * Start the test.
097: */
098: public static void main(String[] params) {
099: new SodaTest().run(new STClass[] { new STInnerClasses() },
100: new STEngine[] { new STDb4o() }, false);
101:
102: }
103:
104: }// STSomeClasses
|