Exemplo n.º 1
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]);
 }
Exemplo n.º 2
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]);
  }
Exemplo n.º 3
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);
 }
Exemplo n.º 4
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]);
 }
Exemplo n.º 5
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]);
 }
Exemplo n.º 6
0
 public void testSequentialAddition() {
   Query q = st.query();
   store();
   q.constrain(new STRUH1());
   Query cur = q.descend("h2");
   cur.constrain(new STRUH2());
   cur.descend("foo2").constrain("str2");
   cur = cur.descend("h3");
   cur.constrain(new STRUH3());
   cur.descend("foo3").constrain("str3");
   st.expectOne(q, store()[5]);
 }
Exemplo n.º 7
0
 public void testSmaller() {
   Query q = st.query();
   q.constrain(new STInteger(1));
   q.descend("i_int").constraints().smaller();
   st.expectOne(q, store()[0]);
 }