Package org.slim3.datastore.model

Examples of org.slim3.datastore.model.Bbb


     * @throws Exception
     */
    @Test
    public void asListForPolyModel() throws Exception {
        DatastoreUtil.put(ds, null, AaaMeta.get().modelToEntity(new Aaa()));
        DatastoreUtil.put(ds, null, BbbMeta.get().modelToEntity(new Bbb()));
        DatastoreUtil.put(ds, null, CccMeta.get().modelToEntity(new Ccc()));

        ModelQuery<Aaa> query = new ModelQuery<Aaa>(ds, aaaMeta);
        List<Aaa> list = query.asList();
        assertThat(list.size(), is(3));
View Full Code Here


     * @throws Exception
     */
    @Test
    public void asKeyListForPolyModel() throws Exception {
        DatastoreUtil.put(ds, null, AaaMeta.get().modelToEntity(new Aaa()));
        DatastoreUtil.put(ds, null, BbbMeta.get().modelToEntity(new Bbb()));

        ModelQuery<Aaa> query = new ModelQuery<Aaa>(ds, aaaMeta);
        List<Key> list = query.asKeyList();
        assertThat(list.size(), is(2));

View Full Code Here

     * @throws Exception
     */
    @Test
    public void asIteratorForPolyModel() throws Exception {
        DatastoreUtil.put(ds, null, AaaMeta.get().modelToEntity(new Aaa()));
        DatastoreUtil.put(ds, null, BbbMeta.get().modelToEntity(new Bbb()));
        DatastoreUtil.put(ds, null, CccMeta.get().modelToEntity(new Ccc()));

        ModelQuery<Aaa> query = new ModelQuery<Aaa>(ds, aaaMeta);
        Iterator<Aaa> iterator = query.asIterator();
        assertThat(
View Full Code Here

     */
    @Test
    public void minForPolyModel() throws Exception {
        Aaa aaa = new Aaa();
        aaa.setVersion(1L);
        Bbb bbb = new Bbb();
        bbb.setVersion(2L);
        DatastoreUtil.put(ds, null, DatastoreUtil.modelToEntity(ds, aaa));
        DatastoreUtil.put(ds, null, DatastoreUtil.modelToEntity(ds, bbb));

        ModelQuery<Aaa> query = new ModelQuery<Aaa>(ds, aaaMeta);
        assertThat(query.min(aaaMeta.version), is(2L));
View Full Code Here

     */
    @Test
    public void maxForPolyModel() throws Exception {
        Aaa aaa = new Aaa();
        aaa.setVersion(2L);
        Bbb bbb = new Bbb();
        bbb.setVersion(1L);
        DatastoreUtil.put(ds, null, DatastoreUtil.modelToEntity(ds, aaa));
        DatastoreUtil.put(ds, null, DatastoreUtil.modelToEntity(ds, bbb));

        ModelQuery<Aaa> query = new ModelQuery<Aaa>(ds, aaaMeta);
        assertThat(query.max(aaaMeta.version), is(3L));
View Full Code Here

     * @throws Exception
     */
    @Test
    public void countForPolyModel() throws Exception {
        DatastoreUtil.put(ds, null, DatastoreUtil.modelToEntity(ds, new Aaa()));
        DatastoreUtil.put(ds, null, DatastoreUtil.modelToEntity(ds, new Bbb()));

        ModelQuery<Aaa> query = new ModelQuery<Aaa>(ds, aaaMeta);
        assertThat(query.count(), is(2));

        ModelQuery<Bbb> query2 = new ModelQuery<Bbb>(ds, bbbMeta);
View Full Code Here

     * @throws Exception
     */
    @Test
    public void getModel() throws Exception {
        Datastore.put(hoge);
        Bbb bbb = new Bbb();
        bbb.getHogeRef().setModel(hoge);
        Datastore.put(bbb);
        Bbb model = ref.getModel();
        assertThat(bbb, is(notNullValue()));
        assertThat(ref.getModel(), is(sameInstance(model)));
    }
View Full Code Here

     * @throws Exception
     */
    @Test
    public void refresh() throws Exception {
        Datastore.put(hoge);
        Bbb bbb = new Bbb();
        bbb.getHogeRef().setModel(hoge);
        Datastore.put(bbb);
        Bbb model = ref.refresh();
        assertThat(bbb, is(notNullValue()));
        assertThat(ref.refresh(), is(not(sameInstance(model))));
    }
View Full Code Here

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

     * @throws Exception
     */
    @Test
    public void getModelList() 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.getModelList();
        assertThat(models.size(), is(2));
        assertThat(models.get(0).getKey(), is(bbb.getKey()));
        assertThat(models.get(1).getKey(), is(bbb2.getKey()));
        assertThat(ref.getModelList(), is(sameInstance(models)));
    }
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.