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 testDescendToObject() { Query q = st.query(); Object[] r = store(); q.constrain(new STVectorT()); q.descend("col").descend("foo1").constrain("bar"); st.expect(q, new Object[] {r[5], r[6]}); }
// FIXME public void _testDescendOne() { Query q = newQuery(); q.constrain(STVectorEU.class); q.descend("col").constrain(new Integer(17)); expect(q, new int[] {0}); }
public void testDescendSmaller() { Query q = st.query(); Object[] r = store(); q.constrain(STVectorT.class); Query qElements = q.descend("col"); qElements.constrain(new Integer(3)).smaller(); st.expect(q, new Object[] {r[2], r[3]}); }
public void testDescendTwo() { Query q = st.query(); Object[] r = store(); q.constrain(STVectorT.class); Query qElements = q.descend("col"); qElements.constrain(new Integer(17)); qElements.constrain(new Integer(25)); st.expect(q, new Object[] {r[4]}); }
private void expect(Query query, Object[] results, boolean ordered) { testCases++; ObjectSet set = query.execute(); if (results == null || results.length == 0) { if (set.size() > 0) { error("No content expected."); } return; } int j = 0; if (set.size() == results.length) { while (set.hasNext()) { Object obj = set.next(); boolean found = false; if (ordered) { if (comparer.isEqual(results[j], obj)) { results[j] = null; found = true; } j++; } else { for (int i = 0; i < results.length; i++) { if (results[i] != null) { if (comparer.isEqual(results[i], obj)) { results[i] = null; found = true; break; } } } } if (!found) { error("Object not expected: " + obj); } } for (int i = 0; i < results.length; i++) { if (results[i] != null) { error("Expected object not returned: " + results[i]); } } } else { error("Unexpected size returned.\nExpected: " + results.length + " Returned: " + set.size()); } }
public void log(Query query) { ObjectSet set = query.execute(); while (set.hasNext()) { TLogger.log(set.next()); } }
public void testDefaultContainsTwo() { Query q = st.query(); Object[] r = store(); q.constrain(new STVectorT(new Object[] {new Integer(17), new Integer(25)})); st.expect(q, new Object[] {r[4]}); }
public void testDefaultContainsString() { Query q = st.query(); Object[] r = store(); q.constrain(new STVectorT(new Object[] {"foo"})); st.expect(q, new Object[] {r[5]}); }
public void testDefaultContainsObject() { Query q = st.query(); Object[] r = store(); q.constrain(new STVectorT(new Object[] {new STElement("bar", null)})); st.expect(q, new Object[] {r[5], r[6]}); }