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(STVectorEU.class); q.descend("col").constrain(new Integer(17)); st.expect(q, new Object[] {r[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]}); }
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 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]}); }
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]}); }
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]}); }
// 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]}); }
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]}); }
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]}); }
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 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]}); }
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]}); }
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 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]}); }
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]}); }
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]}); }
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]}); }
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]}); }
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]}); }
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]}); }
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]); }
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); }
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"); } }
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]); }
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 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]); }
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]}); }
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]); }
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]}); }