Query extends Operation { public Query(Repository repository) { super(repository); } Query(Repository repository); Match<Propoid> now(Propoid propoid, Where where); static Uri getUri(Class<? extends Propoid> type);  }
@Test public void testFoo() { Iterator<Foo> foos = repository.query(new Foo()).list().iterator(); assertTrue(foos.hasNext()); assertTrue(foos.next().getClass() == Foo.class); assertTrue(foos.hasNext()); assertTrue(foos.next().getClass() == FooEx.class); assertFalse(foos.hasNext()); }
@Test public void testFooEx() { Iterator<FooEx> foos = repository.query(new FooEx()).list().iterator(); assertTrue(foos.hasNext()); assertTrue(foos.next().getClass() == FooEx.class); assertFalse(foos.hasNext()); }
@Test public void testFooOrdered() { Foo foo = new Foo(); Bar bar = new Bar(); Iterator<Foo> descending = repository.query(foo) .list(Order.descending(foo.barP, bar.intP), Order.descending(foo.barP, bar.stringP)) .iterator(); assertTrue(descending.hasNext()); assertTrue(descending.next().getClass() == Foo.class); assertTrue(descending.hasNext()); assertTrue(descending.next().getClass() == FooEx.class); assertFalse(descending.hasNext()); Iterator<Foo> ascending = repository.query(foo) .list(Order.ascending(foo.barP, bar.intP), Order.ascending(foo.barP, bar.stringP)) .iterator(); assertTrue(ascending.hasNext()); assertTrue(ascending.next().getClass() == FooEx.class); assertTrue(ascending.hasNext()); assertTrue(ascending.next().getClass() == Foo.class); assertFalse(ascending.hasNext()); }
@Test public void testFooHasBarOrdered() { Foo foo = new Foo(); Bar bar = new Bar(); repository.query(foo, Where.has(foo.barP, bar, Where.any())).first( Order.ascending(foo.barP, bar.stringP)); }
@Test public void testFooHasBar() { Foo foo = new Foo(); Bar bar = new Bar(); assertEquals(1, repository.query(foo, Where.has(foo.barP, bar, Where.any())) .count()); }
@Test public void testFooHasNotBar() { Foo foo = new Foo(); Bar bar = new Bar(); assertEquals( 1, repository.query(foo, Where.not(Where.has(foo.barP, bar, Where.any()))) .count()); }
@Test public void testFooHasOneBar() { Foo foo = new Foo(); Bar bar = new Bar(); assertEquals(1, repository.query(foo, Where.hasOne(foo.barsP, bar, Where.any())) .count()); }
@Test public void testFooSetBar() { Foo foo = new Foo(); repository.query(foo).set(foo.barP, null); assertEquals(2, repository.query(foo, Where.equal(foo.barP, null)) .count()); }
@Test public void testFooSetBars() { Foo foo = new Foo(); repository.query(foo).set(foo.barsP, null); assertEquals(2, repository.query(foo, Where.equal(foo.barsP, null)).count()); }
@Test public void testFooExDelete() { FooEx fooEx = new FooEx(); repository.query(fooEx).delete(); assertEquals(1, repository.query(new Foo()).count()); }
@Test public void testFooSingle() { try { repository.query(new Foo()).single(); } catch (RepositoryException expected) { } repository.query(new FooEx()).single(); }