Package com.vercer.engine.persist.annotation

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


                }
        }
       
        @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

    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

public class SerializeCollectionsTest extends LocalDatastoreTestCase
{
  @Test
  public void test()
  {
    ObjectDatastore datastore = new AnnotationObjectDatastore()
    {
      @Override
      protected CombinedTypeConverter createTypeConverter()
      {
        DefaultTypeConverter dtc = new DefaultTypeConverter();
        dtc.prepend(new DefaultTypeConverter.SlowBlobToAnything());
        dtc.prepend(new DefaultTypeConverter.SlowSerializableToBlob());
        return dtc;
      }
    };
   
   
    TypeWithCollections item = new TypeWithCollections();
    item.classes.add(String.class);
    item.classes.add(Integer.class);
    item.classes.add(Collection.class);
   
    Key key = datastore.store(item);
   
    TypeWithEnum thing = new TypeWithEnum();
    thing.watsit = MyEnum.TWOK10;
    item.things.add(thing);
    item.things.add(null);
   
    datastore.disassociateAll();
   
    TypeWithCollections loaded = datastore.load(key);
    Assert.assertNotNull(loaded);
  }
View Full Code Here

TOP

Related Classes of com.vercer.engine.persist.annotation.AnnotationObjectDatastore

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.