Package org.slim3.datastore.model

Examples of org.slim3.datastore.model.Hoge


    /**
     * @throws Exception
     */
    @Test
    public void accept() throws Exception {
        Hoge hoge = new Hoge();
        hoge.setMyString("c");
        InMemoryGreaterThanOrEqualCriterion c =
            new InMemoryGreaterThanOrEqualCriterion(meta.myString, "b");
        assertThat(c.accept(hoge), is(true));
        hoge.setMyString("b");
        assertThat(c.accept(hoge), is(true));
        hoge.setMyString("a");
        assertThat(c.accept(hoge), is(false));
    }
View Full Code Here


    public void acceptForEnum() throws Exception {
        InMemoryGreaterThanOrEqualCriterion c =
            new InMemoryGreaterThanOrEqualCriterion(
                meta.myEnum,
                SortDirection.ASCENDING);
        Hoge hoge = new Hoge();
        assertThat(c.accept(hoge), is(false));
        hoge.setMyEnum(SortDirection.ASCENDING);
        assertThat(c.accept(hoge), is(true));
        hoge.setMyEnum(SortDirection.DESCENDING);
        assertThat(c.accept(hoge), is(true));
    }
View Full Code Here

    /**
     * @throws Exception
     */
    @Test
    public void acceptForNull() throws Exception {
        Hoge hoge = new Hoge();
        hoge.setMyString("c");
        InMemoryGreaterThanOrEqualCriterion c =
            new InMemoryGreaterThanOrEqualCriterion(meta.myString, null);
        assertThat(c.accept(hoge), is(true));
        hoge.setMyString(null);
        assertThat(c.accept(hoge), is(true));
    }
View Full Code Here

    /**
     * @throws Exception
     */
    @Test
    public void acceptForCollection() throws Exception {
        Hoge hoge = new Hoge();
        hoge.setMyIntegerList(Arrays.asList(1));
        InMemoryGreaterThanOrEqualCriterion c =
            new InMemoryGreaterThanOrEqualCriterion(meta.myIntegerList, 1);
        assertThat(c.accept(hoge), is(true));
        hoge.setMyIntegerList(Arrays.asList(2));
        assertThat(c.accept(hoge), is(true));
        hoge.setMyIntegerList(Arrays.asList(0));
        assertThat(c.accept(hoge), is(false));
    }
View Full Code Here

    /**
     * @throws Exception
     */
    @Test
    public void accept() throws Exception {
        Hoge hoge = new Hoge();
        hoge.setMyString("abc");
        InMemoryFilterCriterion c = new InMemoryEndsWithCriterion(meta.myString, "bc");
        assertThat(c.accept(hoge), is(true));
        hoge.setMyString("ab");
        assertThat(c.accept(hoge), is(false));
        hoge.setMyString(null);
        assertThat(c.accept(hoge), is(false));
    }
View Full Code Here

    /**
     * @throws Exception
     */
    @Test
    public void acceptForNull() throws Exception {
        Hoge hoge = new Hoge();
        hoge.setMyString("abc");
        InMemoryFilterCriterion c = new InMemoryEndsWithCriterion(meta.myString, null);
        assertThat(c.accept(hoge), is(false));
        hoge.setMyString(null);
        assertThat(c.accept(hoge), is(true));
    }
View Full Code Here

    /**
     * @throws Exception
     */
    @Test
    public void acceptForCollection() throws Exception {
        Hoge hoge = new Hoge();
        hoge.setMyStringList(Arrays.asList("abc"));
        InMemoryFilterCriterion c =
            new InMemoryEndsWithCriterion(meta.myStringList, "bc");
        assertThat(c.accept(hoge), is(true));
        hoge.setMyStringList(Arrays.asList("bbb"));
        assertThat(c.accept(hoge), is(false));
    }
View Full Code Here

    /**
     * @throws Exception
     */
    @Test
    public void asListAndFilterInMemory() throws Exception {
        Hoge hoge = new Hoge();
        hoge.setMyString("aaa");
        DatastoreUtil.put(ds, null, meta.modelToEntity(hoge));
        Hoge hoge2 = new Hoge();
        hoge2.setMyString("bbb");
        DatastoreUtil.put(ds, null, meta.modelToEntity(hoge2));
        List<Hoge> list =
            new ModelQuery<Hoge>(ds, meta).filterInMemory(
                meta.myString.equal("aaa")).asList();
        assertThat(list.size(), is(1));
View Full Code Here

    /**
     * @throws Exception
     */
    @Test
    public void asListAndSortInMemory() throws Exception {
        Hoge hoge = new Hoge();
        hoge.setMyString("aaa");
        DatastoreUtil.put(ds, null, meta.modelToEntity(hoge));
        Hoge hoge2 = new Hoge();
        hoge2.setMyString("bbb");
        DatastoreUtil.put(ds, null, meta.modelToEntity(hoge2));
        List<Hoge> list =
            new ModelQuery<Hoge>(ds, meta)
                .sortInMemory(meta.myString.desc)
                .asList();
View Full Code Here

    /**
     * @throws Exception
     */
    @Test
    public void asQueryResultList() throws Exception {
        Hoge hoge = new Hoge();
        hoge.setMyString("aaa");
        hoge.setMyInteger(1);
        DatastoreUtil.put(ds, null, meta.modelToEntity(hoge));
        Hoge hoge2 = new Hoge();
        hoge2.setMyString("aaa");
        hoge2.setMyInteger(2);
        DatastoreUtil.put(ds, null, meta.modelToEntity(hoge2));
        Hoge hoge3 = new Hoge();
        hoge3.setMyString("aaa");
        hoge3.setMyInteger(3);
        DatastoreUtil.put(ds, null, meta.modelToEntity(hoge3));
        ModelQuery<Hoge> query = new ModelQuery<Hoge>(ds, meta);
        S3QueryResultList<Hoge> list =
            query
                .filter(meta.myString.equal("aaa"))
View Full Code Here

TOP

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

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.