use of com.orm.androrm.DatabaseAdapter in project androrm by androrm.
the class FieldCacheTest method testFieldShortcur.
public void testFieldShortcur() {
assertNull(ModelCache.getField(BlankModelNoAutoincrement.class, "mName"));
List<Class<? extends Model>> models = new ArrayList<Class<? extends Model>>();
models.add(BlankModelNoAutoincrement.class);
DatabaseAdapter adapter = DatabaseAdapter.getInstance(getContext());
adapter.setModels(models);
assertNotNull(ModelCache.getField(BlankModelNoAutoincrement.class, "mName"));
}
use of com.orm.androrm.DatabaseAdapter in project androrm by androrm.
the class TableDefinitionCacheTest method testTableDefinitionCache.
public void testTableDefinitionCache() {
assertFalse(ModelCache.knowsModel(Product.class));
assertNull(ModelCache.getTableDefinitions(Product.class));
List<Class<? extends Model>> models = new ArrayList<Class<? extends Model>>();
models.add(Product.class);
DatabaseAdapter adapter = DatabaseAdapter.getInstance(getContext());
adapter.setModels(models);
assertTrue(ModelCache.knowsModel(Product.class));
assertNotNull(ModelCache.getTableDefinitions(Product.class));
}
use of com.orm.androrm.DatabaseAdapter in project androrm by androrm.
the class TableDefinitionCacheTest method tearDown.
public void tearDown() {
DatabaseAdapter adapter = DatabaseAdapter.getInstance(getContext());
;
adapter.drop();
ModelCache.reset();
}
use of com.orm.androrm.DatabaseAdapter in project androrm by androrm.
the class TransactionTest method testRollback.
public void testRollback() {
assertEquals(0, BlankModel.objects(getContext()).count());
DatabaseAdapter adapter = DatabaseAdapter.getInstance(getContext());
adapter.beginTransaction();
BlankModel b1 = new BlankModel();
b1.save(getContext());
BlankModel b2 = new BlankModel();
b2.save(getContext());
adapter.rollbackTransaction();
assertEquals(0, BlankModel.objects(getContext()).count());
}
use of com.orm.androrm.DatabaseAdapter in project androrm by androrm.
the class TransactionTest method tearDown.
@Override
public void tearDown() {
DatabaseAdapter adapter = DatabaseAdapter.getInstance(getContext());
adapter.drop();
}
Aggregations