Examples of AnnotationObjectDatastore


Examples of com.vercer.engine.persist.annotation.AnnotationObjectDatastore

public class PolymorphicCollectionsTest extends LocalDatastoreTestCase
{
  @Test
  public void test()
  {
    ObjectDatastore datastore = new AnnotationObjectDatastore();
     
    for(int i=0;i<10; i++){
      datastore.store(new Driver(new Car(new Date())));
      datastore.store(new Driver(new Lorry(new Long(50+i))));
    }
   
    QueryResultIterator<Driver> result = datastore.find().type(Driver.class).fetchNoFields().returnResultsNow();
   
    Assert.assertTrue(result.hasNext());
  }
View Full Code Here

Examples of com.vercer.engine.persist.annotation.AnnotationObjectDatastore

  }
 
  @Test
  public void missingStringField()
  {
    ObjectDatastore datastore = new AnnotationObjectDatastore();
   
    HasStringKey hasNullKey = new HasStringKey();
    datastore.store(hasNullKey);
   
    Assert.assertNotNull(hasNullKey.keyField);
  }
View Full Code Here

Examples of com.vercer.engine.persist.annotation.AnnotationObjectDatastore

  }

  @Test
  public void missingIntField()
  {
    ObjectDatastore datastore = new AnnotationObjectDatastore();
   
    HasIntKey hasNullKey = new HasIntKey();
    datastore.store(hasNullKey);
   
    Assert.assertTrue(hasNullKey.keyField > 0);
  }
View Full Code Here

Examples of com.vercer.engine.persist.annotation.AnnotationObjectDatastore

  }

  @Test
  public void missingLongField()
  {
    ObjectDatastore datastore = new AnnotationObjectDatastore();
   
    HasLongKey hasNullKey = new HasLongKey();
    datastore.store(hasNullKey);
   
    Assert.assertNotNull(hasNullKey.keyField);
  }
View Full Code Here

Examples of com.vercer.engine.persist.annotation.AnnotationObjectDatastore

  {
    EnumSet<MyEnum> myEnums = EnumSet.allOf(MyEnum.class);
    EnumContainer container = new EnumContainer();
    container.theEnumSet = myEnums;
   
    ObjectDatastore datastore = new AnnotationObjectDatastore();
    Key key = datastore.store(container);
   
    datastore.disassociateAll();
   
    EnumContainer loaded = datastore.load(key);
   
    Assert.assertTrue(loaded.theEnumSet instanceof EnumSet<?>);
    Assert.assertTrue(loaded.theEnumSet.size() == 2);
  }
View Full Code Here

Examples of com.vercer.engine.persist.annotation.AnnotationObjectDatastore

  }

  @org.junit.Test
  public void testJoinTable()
  {
    ObjectDatastore ds = new AnnotationObjectDatastore();

    A a;
    B b;
    ds.store(a = new A());
    ds.store(b = new B());
    ds.store(new AB(a, b));

    final AB ab = ds.find().type(AB.class).addFilter("a", Query.FilterOperator.EQUAL,
        ds.associatedKey(a)).returnResultsNow().next();

    if (!ab.b.equals(b))
      fail();
  }
View Full Code Here

Examples of com.vercer.engine.persist.annotation.AnnotationObjectDatastore

    c11.field = "c11";
    C c12 = new C();
    c12.field = "c12";
    b1.cs = Lists.newArrayList(c11, c12);
   
    ObjectDatastore datastore = new AnnotationObjectDatastore();
    Key key = datastore.store(a);
    datastore.disassociateAll();
    A reloaded = datastore.load(key);
   
    Assert.assertNull(reloaded.bs.get(0).cs.get(0).field);
  }
View Full Code Here

Examples of com.vercer.engine.persist.annotation.AnnotationObjectDatastore

                }
        }

        @Test
        public void bulkStoreAndRefreshOnSimpleModelShouldAssignKeysForEntities() {
                ObjectDatastore ods = new AnnotationObjectDatastore();
                ExampleModel[] models = new ExampleModel[] { new ExampleModel(),
                                new ExampleModel() };
                ods.storeAll(Lists.newArrayList(models));
                for (ExampleModel model : models) {
                        ods.refresh(model);
                        assertTrue(model.getAutoId() != 0);
                }
        }
View Full Code Here

Examples of com.vercer.engine.persist.annotation.AnnotationObjectDatastore

                }
        }
       
        @Test
        public void transientFieldWithStoreEqualsTrueShouldBePersisted(){
                ObjectDatastore ods1 = new AnnotationObjectDatastore();
                ExampleModel model = new ExampleModel();
                model.setTransientField("xxx");
                ods1.store(model);
                ObjectDatastore ods2 = new AnnotationObjectDatastore();
                ExampleModel reloadedModel = ods2.load(ods1.associatedKey(model));
                assertEquals("xxx", reloadedModel.getTransientField());
        }
View Full Code Here

Examples of com.vercer.engine.persist.annotation.AnnotationObjectDatastore

    created.blank.put("c1", new Contained("im the first", 99));
    created.blank.put("c2", new Contained("im the second", 84));
    created.initialised.put(45l, new Contained("dated one", 32));
    created.initialised.put(67l, new Contained("dated today", 18));
   
    AnnotationObjectDatastore datastore = new AnnotationObjectDatastore();
    Key key = datastore.store(created);
   
    datastore.disassociateAll();
   
    Object loaded = datastore.load(key);
   
    Assert.assertEquals(created, loaded);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.