1 21 package com.db4o.test; 22 23 import java.util.*; 24 25 import com.db4o.*; 26 import com.db4o.inside.marshall.*; 27 import com.db4o.query.*; 28 29 30 33 public class NullWrapperQueries { 34 35 public Boolean m1; 36 public Boolean m2; 38 public Character m3; 39 public Date m4; 40 public Double m5; 41 public Float m6; 42 public Integer m7; 43 public Long m8; 44 public Short m9; 45 public String m10; 46 47 public void configure(){ 48 for (int i = 1; i < 11; i++) { 49 String desc = "m" + i; 50 Db4o.configure().objectClass(this).objectField(desc).indexed(true); 51 } 52 } 53 54 public void store(){ 55 Test.deleteAllInstances(this); 56 NullWrapperQueries nwq = new NullWrapperQueries(); 57 nwq.fill1(); 58 Test.store(nwq); 59 nwq = new NullWrapperQueries(); 60 nwq.fill0(); 61 Test.store(nwq); 62 nwq = new NullWrapperQueries(); 63 nwq.fill0(); 64 Test.store(nwq); 65 nwq = new NullWrapperQueries(); 66 nwq.fill1(); 67 Test.store(nwq); 68 nwq = new NullWrapperQueries(); 69 Test.store(nwq); 70 nwq = new NullWrapperQueries(); 71 Test.store(nwq); 72 } 73 74 public void test(){ 75 for (int i = 1; i < 11; i++) { 76 Query q = Test.query(); 77 q.constrain(NullWrapperQueries.class); 78 String desc = "m" + i; 79 q.descend(desc).constrain(null); 80 Test.ensureEquals(2,q.execute().size()); 81 } 82 } 83 84 private void fill0(){ 85 m1 = new Boolean (false); 86 m2 = new Boolean (false); 88 89 m3 = new Character ((char)0); 90 m4 = new Date(0); 91 m5 = new Double (0); 92 m6 = new Float (0); 93 m7 = new Integer (0); 94 m8 = new Long (0); 95 m9 = new Short ((short)0); 96 m10 = ""; 97 } 98 99 private void fill1(){ 100 m1 = new Boolean (true); 101 m2 = new Boolean (true); 103 m3 = new Character ((char)1); 104 m4 = new Date(1); 105 m5 = new Double (1); 106 m6 = new Float (1); 107 m7 = new Integer (1); 108 m8 = new Long (1); 109 m9 = new Short ((short)1); 110 m10 = "1"; 111 } 112 113 114 115 116 117 118 119 120 121 122 123 124 } 125 | Popular Tags |