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.jre12.soda.experiments;
022:
023: import java.util.*;
024:
025: import com.db4o.query.*;
026: import com.db4o.test.legacy.soda.collections.*;
027:
028: public class STCurrentTestCase extends
029: com.db4o.db4ounit.common.soda.util.SodaBaseTestCase {
030:
031: public String mystr;
032:
033: public STCurrentTestCase() {
034: }
035:
036: public STCurrentTestCase(String str) {
037: this .mystr = str;
038: }
039:
040: public String toString() {
041: return "STCurrentTestCase: " + mystr;
042: }
043:
044: public Object[] createData() {
045: return new Object[] {
046: new STVectorEU(new Object[] { new Integer(17) }),
047: new STVectorEU(new Object[] { new Integer(3),
048: new Integer(17), new Integer(25),
049: new Integer(Integer.MAX_VALUE - 2) }),
050: new STVectorT(new Object[] { new Integer(17) }),
051: new STVectorU(new Object[] { new Integer(3),
052: new Integer(17), new Integer(25),
053: new Integer(Integer.MAX_VALUE - 2) }), };
054: }
055:
056: // FIXME
057: public void _testDescendOne() {
058: Query q = newQuery();
059:
060: q.constrain(STVectorEU.class);
061: q.descend("col").constrain(new Integer(17));
062: expect(q, new int[] { 0 });
063: }
064:
065: // public void testIdentity(){
066: // Query q = SodaTenewQuery();
067: // Constraint c = q.constrain(new STCurrentTestCase("hi"));
068: // ObjectSet set = q.execute();
069: // STCurrentTestCase identityConstraint = (STCurrentTestCase)set.next();
070: // identityConstraint.mystr = "jdjdjd";
071: // q = SodaTenewQuery();
072: // q.constrain(identityConstraint).identity();
073: // identityConstraint.mystr = "hi";
074: // SodaTecom.db4o.db4ounit.common.soda.util.SodaTestUtil.expectOne(q,new STCurrentTestCase("hi"));
075: // }
076:
077: // public void all_Depts_that_have_no_emp(){
078: // Query q = pm.query();
079: // q.constrain(Department.class);
080: // Query qEmps = q.descendant("emps");
081: // qEmps.constrain(null).or(
082: // qEmps.constrain(new Integer(0)).length()
083: // );
084: // ObjectSet noEmps = q.execute();
085: // }
086: //
087: // public void all_Depts_that_have_exaclty_one_emp(){
088: // Query q = pm.query();
089: // q.constrain(Department.class);
090: // Query qEmps = q.descendant("emps");
091: // qEmps.constrain(new Integer(1)).length();
092: // ObjectSet oneEmp = q.execute();
093: // }
094: //
095: // public void tiger_teams(){
096: // Query q = pm.query();
097: // q.constrain(Department.class);
098: // Query qEmps = q.descendant("emps");
099: // qEmps.constrain(new Integer(2)).length().greater();
100: // qEmps.constrain(new Integer(5)).length().smaller();
101: // qEmps.descendant("salary").constrain(new Float(50000)).greater();
102: // ObjectSet tigerTeams = q.execute();
103: // }
104:
105: public static class Employee {
106: public String name;
107: public Float salary;
108: public Department dept;
109: public Employee boss;
110: }
111:
112: public static class Department {
113: public String name;
114: public Collection emps;
115:
116: public Department() {
117: }
118:
119: public Department(String name) {
120: }
121: }
122:
123: }
|