Package org.slim3.datastore.model

Examples of org.slim3.datastore.model.Bbb


     * @throws Exception
     */
    @Test
    public void asQueryResultList() throws Exception {
        Datastore.put(hoge);
        Bbb bbb = new Bbb();
        bbb.getHoge2Ref().setModel(hoge);
        Datastore.put(bbb);
        Bbb bbb2 = new Bbb();
        bbb2.getHoge2Ref().setModel(hoge);
        Datastore.put(bbb2);
        S3QueryResultList<Bbb> list = ref.query().asQueryResultList();
        assertThat(list.size(), is(2));
        assertThat(list.get(0).getKey(), is(bbb.getKey()));
        assertThat(list.get(1).getKey(), is(bbb2.getKey()));
        assertThat(list.getEncodedCursor(), is(notNullValue()));
        assertThat(list.getEncodedFilter(), is(notNullValue()));
        assertThat(list.getEncodedSorts(), is(notNullValue()));
    }
View Full Code Here


     * @throws Exception
     */
    @Test
    public void queryWithSort() throws Exception {
        Datastore.put(hoge);
        Bbb bbb = new Bbb();
        bbb.getHoge2Ref().setModel(hoge);
        Datastore.put(bbb);
        Bbb bbb2 = new Bbb();
        bbb2.getHoge2Ref().setModel(hoge);
        Datastore.put(bbb2);
        List<Bbb> models =
            ref.query().sort(BbbMeta.get().key.desc).getModelList();
        assertThat(models.size(), is(2));
        assertThat(models.get(0).getKey(), is(bbb2.getKey()));
        assertThat(models.get(1).getKey(), is(bbb.getKey()));
        assertThat(ref.getModelList(), is(sameInstance(models)));
    }
View Full Code Here

     * @throws Exception
     */
    @Test
    public void queryWithInMemorySort() throws Exception {
        Datastore.put(hoge);
        Bbb bbb = new Bbb();
        bbb.getHoge2Ref().setModel(hoge);
        Datastore.put(bbb);
        Bbb bbb2 = new Bbb();
        bbb2.getHoge2Ref().setModel(hoge);
        Datastore.put(bbb2);
        List<Bbb> models =
            ref.query().sortInMemory(BbbMeta.get().key.desc).getModelList();
        assertThat(models.size(), is(2));
        assertThat(models.get(0).getKey(), is(bbb2.getKey()));
        assertThat(models.get(1).getKey(), is(bbb.getKey()));
        assertThat(ref.getModelList(), is(sameInstance(models)));
    }
View Full Code Here

     * @throws Exception
     */
    @Test
    public void queryWithFilter() throws Exception {
        Datastore.put(hoge);
        Bbb bbb = new Bbb();
        bbb.getHoge2Ref().setModel(hoge);
        Datastore.put(bbb);
        Bbb bbb2 = new Bbb();
        bbb2.getHoge2Ref().setModel(hoge);
        Datastore.put(bbb2);
        List<Bbb> models =
            ref
                .query()
                .filter(BbbMeta.get().key.equal(bbb.getKey()))
View Full Code Here

     * @throws Exception
     */
    @Test
    public void queryWithInMemoryFilter() throws Exception {
        Datastore.put(hoge);
        Bbb bbb = new Bbb();
        bbb.getHoge2Ref().setModel(hoge);
        Datastore.put(bbb);
        Bbb bbb2 = new Bbb();
        bbb2.getHoge2Ref().setModel(hoge);
        Datastore.put(bbb2);
        List<Bbb> models =
            ref
                .query()
                .filterInMemory(BbbMeta.get().key.equal(bbb.getKey()))
View Full Code Here

     * @throws Exception
     */
    @Test
    public void queryWithLimit() throws Exception {
        Datastore.put(hoge);
        Bbb bbb = new Bbb();
        bbb.getHoge2Ref().setModel(hoge);
        Datastore.put(bbb);
        Bbb bbb2 = new Bbb();
        bbb2.getHoge2Ref().setModel(hoge);
        Datastore.put(bbb2);
        List<Bbb> models = ref.query().limit(1).getModelList();
        assertThat(models.size(), is(1));
        assertThat(models.get(0).getKey(), is(bbb.getKey()));
    }
View Full Code Here

     * @throws Exception
     */
    @Test
    public void queryWithOffset() throws Exception {
        Datastore.put(hoge);
        Bbb bbb = new Bbb();
        bbb.getHoge2Ref().setModel(hoge);
        Datastore.put(bbb);
        Bbb bbb2 = new Bbb();
        bbb2.getHoge2Ref().setModel(hoge);
        Datastore.put(bbb2);
        List<Bbb> models = ref.query().offset(1).getModelList();
        assertThat(models.size(), is(1));
        assertThat(models.get(0).getKey(), is(bbb2.getKey()));
    }
View Full Code Here

     * @throws Exception
     */
    @Test
    public void queryWithEncodedStartCursor() throws Exception {
        Datastore.put(hoge);
        Bbb bbb = new Bbb();
        bbb.getHoge2Ref().setModel(hoge);
        Datastore.put(bbb);
        Bbb bbb2 = new Bbb();
        bbb2.getHoge2Ref().setModel(hoge);
        Datastore.put(bbb2);
        S3QueryResultList<Bbb> models =
            ref.query().limit(1).asQueryResultList();
        S3QueryResultList<Bbb> models2 =
            ref
                .query()
                .encodedStartCursor(models.getEncodedCursor())
                .asQueryResultList();
        assertThat(models2.size(), is(1));
        assertThat(models2.get(0).getKey(), is(bbb2.getKey()));
    }
View Full Code Here

     * @throws Exception
     */
    @Test
    public void queryWithEncodedEndCursor() throws Exception {
        Datastore.put(hoge);
        Bbb bbb = new Bbb();
        bbb.getHoge2Ref().setModel(hoge);
        Datastore.put(bbb);
        Bbb bbb2 = new Bbb();
        bbb2.getHoge2Ref().setModel(hoge);
        Datastore.put(bbb2);
        S3QueryResultList<Bbb> models =
            ref.query().limit(1).asQueryResultList();
        S3QueryResultList<Bbb> models2 =
            ref
View Full Code Here

     * @throws Exception
     */
    @Test
    public void clear() throws Exception {
        Datastore.put(hoge);
        Bbb bbb = new Bbb();
        bbb.getHoge2Ref().setModel(hoge);
        Datastore.put(bbb);
        ref.getModelList();
        ref.clear();
        assertThat(ref.modelList, is(nullValue()));
    }
View Full Code Here

TOP

Related Classes of org.slim3.datastore.model.Bbb

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.