示例#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]);
 }
 public void testLastOrderWins() {
   Query query = newQuery(Data.class);
   query.descend("_id").orderDescending();
   query.descend("_id").orderAscending();
   query.descend("_id").constrain(new Integer(0)).greater();
   assertOrdered(query.execute());
 }
示例#3
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]});
 }
示例#4
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]});
 }
示例#5
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]);
 }
示例#6
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);
 }
示例#7
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]});
 }
示例#8
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]});
 }
  public void conc(ExtObjectContainer oc) {
    Query q = oc.query();
    q.constrain(QueryForUnknownFieldTestCase.class);
    q.descend("_name").constrain("name");
    Assert.areEqual(1, q.execute().size());

    q = oc.query();
    q.constrain(QueryForUnknownFieldTestCase.class);
    q.descend("name").constrain("name");
    Assert.areEqual(0, q.execute().size());
  }
 public void concUpdateDifferentObject(ExtObjectContainer oc, int seq) throws Exception {
   Query query = oc.query();
   query
       .descend("_s")
       .constrain(testString + seq)
       .and(query.descend("_i").constrain(new Integer(seq)));
   ObjectSet result = query.execute();
   Assert.areEqual(1, result.size());
   SimpleObject o = (SimpleObject) result.next();
   o.setI(seq + COUNT);
   oc.store(o);
 }
示例#11
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]);
 }
示例#12
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]});
 }
示例#13
0
  public void testGreater() {
    Query q = newQuery();
    q.constrain(new STDoubleTestCase(1));
    q.descend("i_double").constraints().greater();

    expect(q, new int[] {2, 3, 4});
  }
示例#14
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]});
 }
示例#15
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]});
 }
示例#16
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]});
 }
示例#17
0
  public void testGreaterOrEqual() {
    Query q = newQuery();
    q.constrain(_array[2]);
    q.descend("i_double").constraints().greater().equal();

    expect(q, new int[] {2, 3, 4});
  }
 private Item storedItem(String id) {
   Query query = newQuery(Item.class);
   query.descend("_id").constrain(id);
   ObjectSet<Item> result = query.execute();
   Assert.isTrue(result.hasNext());
   return result.next();
 }
示例#19
0
  // FIXME
  public void _testDescendOne() {
    Query q = newQuery();

    q.constrain(STVectorEU.class);
    q.descend("col").constrain(new Integer(17));
    expect(q, new int[] {0});
  }
示例#20
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]});
 }
  public void testDescendToObject() {
    Query q = newQuery();

    q.constrain(new STHashSetUTestCase());
    q.descend("col").descend("foo1").constrain("bar");
    expect(q, new int[] {5, 6});
  }
示例#22
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]});
 }
 private Item itemByName(String string) {
   Query q = db().query();
   q.constrain(Item.class);
   q.descend("_name").constrain(string);
   Object object = q.execute().next();
   return (Item) object;
 }
示例#24
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]});
 }
 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]});
 }
示例#26
0
  public void testSmaller() {
    Query q = newQuery();
    q.constrain(new STDoubleTestCase(1));
    q.descend("i_double").constraints().smaller();

    expect(q, new int[] {0, 1});
  }
示例#27
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]});
 }
  public void testDescendOne() {
    Query q = newQuery();

    q.constrain(STHashSetUTestCase.class);
    q.descend("col").constrain(new Integer(17));
    expect(q, new int[] {3, 4});
  }
示例#29
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]});
 }
示例#30
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]});
 }