KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > db4o > db4ounit > jre12 > soda > experiments > STCurrentTestCase


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.db4ounit.jre12.soda.experiments;
22 import java.util.*;
23
24 import com.db4o.query.*;
25 import com.db4o.test.legacy.soda.collections.*;
26
27
28
29
30 public class STCurrentTestCase extends com.db4o.db4ounit.common.soda.util.SodaBaseTestCase {
31
32     public String JavaDoc mystr;
33
34     public STCurrentTestCase() {
35     }
36
37     public STCurrentTestCase(String JavaDoc str) {
38         this.mystr = str;
39     }
40
41     public String JavaDoc toString() {
42         return "STCurrentTestCase: " + mystr;
43     }
44
45     public Object JavaDoc[] createData() {
46         return new Object JavaDoc[] {
47             new STVectorEU(new Object JavaDoc[] { new Integer JavaDoc(17)}),
48             new STVectorEU(
49                 new Object JavaDoc[] {
50                     new Integer JavaDoc(3),
51                     new Integer JavaDoc(17),
52                     new Integer JavaDoc(25),
53                     new Integer JavaDoc(Integer.MAX_VALUE - 2)}),
54             new STVectorT(new Object JavaDoc[] { new Integer JavaDoc(17)}),
55             new STVectorU(
56                 new Object JavaDoc[] {
57                     new Integer JavaDoc(3),
58                     new Integer JavaDoc(17),
59                     new Integer JavaDoc(25),
60                     new Integer JavaDoc(Integer.MAX_VALUE - 2)}),
61             };
62     }
63
64     // FIXME
65
public void _testDescendOne() {
66         Query q = newQuery();
67         
68         q.constrain(STVectorEU.class);
69         q.descend("col").constrain(new Integer JavaDoc(17));
70         expect(q, new int[] { 0 });
71     }
72
73     // public void testIdentity(){
74
// Query q = SodaTenewQuery();
75
// Constraint c = q.constrain(new STCurrentTestCase("hi"));
76
// ObjectSet set = q.execute();
77
// STCurrentTestCase identityConstraint = (STCurrentTestCase)set.next();
78
// identityConstraint.mystr = "jdjdjd";
79
// q = SodaTenewQuery();
80
// q.constrain(identityConstraint).identity();
81
// identityConstraint.mystr = "hi";
82
// SodaTecom.db4o.db4ounit.common.soda.util.SodaTestUtil.expectOne(q,new STCurrentTestCase("hi"));
83
// }
84

85     // public void all_Depts_that_have_no_emp(){
86
// Query q = pm.query();
87
// q.constrain(Department.class);
88
// Query qEmps = q.descendant("emps");
89
// qEmps.constrain(null).or(
90
// qEmps.constrain(new Integer(0)).length()
91
// );
92
// ObjectSet noEmps = q.execute();
93
// }
94
//
95
// public void all_Depts_that_have_exaclty_one_emp(){
96
// Query q = pm.query();
97
// q.constrain(Department.class);
98
// Query qEmps = q.descendant("emps");
99
// qEmps.constrain(new Integer(1)).length();
100
// ObjectSet oneEmp = q.execute();
101
// }
102
//
103
// public void tiger_teams(){
104
// Query q = pm.query();
105
// q.constrain(Department.class);
106
// Query qEmps = q.descendant("emps");
107
// qEmps.constrain(new Integer(2)).length().greater();
108
// qEmps.constrain(new Integer(5)).length().smaller();
109
// qEmps.descendant("salary").constrain(new Float(50000)).greater();
110
// ObjectSet tigerTeams = q.execute();
111
// }
112

113     public static class Employee {
114         public String JavaDoc name;
115         public Float JavaDoc salary;
116         public Department dept;
117         public Employee boss;
118     }
119
120     public static class Department {
121         public String JavaDoc name;
122         public Collection emps;
123         public Department() {
124         }
125         public Department(String JavaDoc name) {
126         }
127     }
128
129 }
130
131
Popular Tags