Example #1
0
 public void testLike() {
   Query q = st.query();
   q.constrain(new STInteger(90));
   q.descend("i_int").constraints().like();
   st.expectOne(q, new STInteger(909));
   q = st.query();
   q.constrain(new STInteger(10));
   q.descend("i_int").constraints().like();
   st.expectNone(q);
 }
Example #2
0
 public void testIdentity() {
   Query q = st.query();
   q.constrain(new STInteger(1));
   ObjectSet set = q.execute();
   STInteger identityConstraint = (STInteger) set.next();
   identityConstraint.i_int = 9999;
   q = st.query();
   q.constrain(identityConstraint).identity();
   identityConstraint.i_int = 1;
   st.expectOne(q, store()[1]);
 }
Example #3
0
 public void test() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(new Helper("aaa"));
   ObjectSet os = q.execute();
   Helper helperA = (Helper) os.next();
   q = st.query();
   q.constrain(STIdentityEvaluation.class);
   q.descend("helper").constrain(helperA).identity();
   q.constrain(new IncludeAllEvaluation());
   st.expect(q, new Object[] {r[1], r[2], r[3]});
 }
Example #4
0
 public void testNotIdentity() {
   Query q = st.query();
   q.constrain(new STInteger(1));
   ObjectSet set = q.execute();
   STInteger identityConstraint = (STInteger) set.next();
   identityConstraint.i_int = 9080;
   q = st.query();
   q.constrain(identityConstraint).identity().not();
   identityConstraint.i_int = 1;
   Object[] r = store();
   st.expect(q, new Object[] {r[0], r[2], r[3]});
 }
Example #5
0
 public void testEqualsNull() {
   Query q = st.query();
   q.constrain(new STOrU(1000, null));
   q.descend("orInt").constraints().or(q.descend("orString").constrain(null));
   Object[] r = store();
   st.expect(q, new Object[] {r[1], r[2], r[4]});
 }
Example #6
0
 // FIXME: the SodaQueryComparator changes seem to have broken this
 public void _testMemberClassConstraint() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(STIdentityEvaluation.class);
   q.descend("helper").constrain(HelperDerivate.class);
   st.expect(q, new Object[] {r[4]});
 }
Example #7
0
 public void testDescendantDescendantNotNull() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(new STRUH1());
   q.descend("h2").descend("h3").constrain(null).not();
   st.expect(q, new Object[] {r[4], r[5]});
 }
Example #8
0
 public void testDescendOne() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(STVectorEU.class);
   q.descend("col").constrain(new Integer(17));
   st.expect(q, new Object[] {r[0]});
 }
 public void testDescendOne() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(STOwnCollectionW.class);
   q.descend("col").constrain(new Integer(17));
   st.expect(q, new Object[] {r[3], r[4]});
 }
Example #10
0
 public void testGreater() {
   Query q = st.query();
   q.constrain(new STInteger(9));
   q.descend("i_int").constraints().greater();
   Object[] r = store();
   st.expect(q, new Object[] {r[2], r[3]});
 }
Example #11
0
 public void testNotContains() {
   Query q = st.query();
   q.constrain(new STInteger(0));
   q.descend("i_int").constrain(new Integer(0)).contains().not();
   Object[] r = store();
   st.expect(q, new Object[] {r[1], r[2]});
 }
Example #12
0
 public void testDescendOne() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(STArrIntegerON.class);
   q.descend("intArr").constrain(new Integer(17));
   st.expect(q, new Object[] {r[3], r[4]});
 }
Example #13
0
 public void testNotEquals() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(r[0]);
   q.descend("i_int").constrain(new Integer(0)).not();
   st.expect(q, new Object[] {r[1], r[2], r[3]});
 }
Example #14
0
 public void testStrNull() {
   Query q = st.query();
   q.constrain(new STRUH1());
   q.descend("foo1").constrain(null);
   Object[] r = store();
   st.expect(q, new Object[] {r[0], r[2], r[3], r[4], r[5]});
 }
Example #15
0
 public void testDescendToObject() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(new STHashtableT());
   q.descend("col").descend("foo1").constrain("bar");
   st.expect(q, new Object[] {r[5], r[6]});
 }
Example #16
0
 public void testBothNull() {
   Query q = st.query();
   q.constrain(new STRUH1());
   q.descend("foo1").constrain(null);
   q.descend("h2").constrain(null);
   st.expectOne(q, store()[0]);
 }
Example #17
0
 public void testDescendantDescendantStringPath() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(new STRUH1());
   q.descend("h2").descend("h3").descend("foo3").constrain("str3");
   st.expect(q, new Object[] {r[4], r[5]});
 }
Example #18
0
 public void testNotLike() {
   Query q = st.query();
   q.constrain(new STInteger(1));
   q.descend("i_int").constraints().like().not();
   Object[] r = store();
   st.expect(q, new Object[] {r[0], r[2], r[3]});
 }
Example #19
0
 public void testGreaterEquals() {
   Query q = st.query();
   q.constrain(new STOrU());
   Query sub = q.descend("orInt");
   sub.constrain(new Integer(1000)).greater().or(sub.constrain(new Integer(0)));
   Object[] r = store();
   st.expect(q, new Object[] {r[0], r[3], r[4]});
 }
Example #20
0
 public void testDescendSmaller() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(STHashtableT.class);
   Query qElements = q.descend("col");
   qElements.constrain(new Integer(3)).smaller();
   st.expect(q, new Object[] {r[2], r[3]});
 }
Example #21
0
 public void testNotGreaterGreater() {
   Query q = st.query();
   q.constrain(new STOrU());
   Query sub = q.descend("orInt");
   (sub.constrain(new Integer(30000)).greater().or(sub.constrain(new Integer(5)).greater())).not();
   Object[] r = store();
   st.expect(q, new Object[] {r[0], r[1]});
 }
Example #22
0
 public void testDescendNotSmaller() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(STArrIntegerON.class);
   Query qElements = q.descend("intArr");
   qElements.constrain(new Integer(3)).smaller();
   st.expect(q, new Object[] {r[2], r[3]});
 }
Example #23
0
 public void testDefaultContainsOne() {
   Query q = st.query();
   Object[] r = store();
   int[][][] content = new int[1][1][1];
   content[0][0][0] = 17;
   q.constrain(new STArrIntegerON(content));
   st.expect(q, new Object[] {r[3], r[4]});
 }
Example #24
0
 public void testTwoLevelOr() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(new STRUH1("str1"));
   q.descend("foo1")
       .constraints()
       .or(q.descend("h2").descend("h3").descend("foo3").constrain("str3"));
   st.expect(q, new Object[] {r[1], r[4], r[5]});
 }
Example #25
0
  public void testEquals() {
    Query q = st.query();
    q.constrain(new STInteger(0));

    // Primitive default values are ignored, so we need an
    // additional constraint:
    q.descend("i_int").constrain(new Integer(0));
    st.expectOne(q, store()[0]);
  }
Example #26
0
 public void testDescendTwo() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(STHashtableT.class);
   Query qElements = q.descend("col");
   qElements.constrain(new Integer(17));
   qElements.constrain(new Integer(25));
   st.expect(q, new Object[] {r[4]});
 }
Example #27
0
 public void testOrAndOr() {
   Query q = st.query();
   q.constrain(new STOrU(0, null));
   (q.descend("orInt").constrain(new Integer(5)).or(q.descend("orString").constrain(null)))
       .and(
           q.descend("orInt")
               .constrain(new Integer(Integer.MAX_VALUE - 1))
               .or(q.descend("orString").constrain("joho")));
   st.expectOne(q, store()[4]);
 }
Example #28
0
 public void testConstraints() {
   Query q = st.query();
   q.constrain(new STInteger(1));
   q.constrain(new STInteger(0));
   Constraints cs = q.constraints();
   Constraint[] csa = cs.toArray();
   if (csa.length != 2) {
     st.error("Constraints not returned");
   }
 }
Example #29
0
 public void testAndOrAnd() {
   Query q = st.query();
   q.constrain(new STOrU(0, null));
   (q.descend("orInt").constrain(new Integer(5)).and(q.descend("orString").constrain(null)))
       .or(
           q.descend("orInt")
               .constrain(new Integer(1000))
               .and(q.descend("orString").constrain("joho")));
   Object[] r = store();
   st.expect(q, new Object[] {r[1], r[2]});
 }
Example #30
0
 public void testNotOrOrAnd() {
   Query q = st.query();
   q.constrain(new STOrU(0, null));
   (q.descend("orInt")
           .constrain(new Integer(Integer.MAX_VALUE - 1))
           .or(q.descend("orString").constrain("joho")))
       .or(q.descend("orInt").constrain(new Integer(5)).and(q.descend("orString").constrain(null)))
       .not();
   Object[] r = store();
   st.expect(q, new Object[] {r[0], r[3]});
 }