use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class RxDaoTest method testDeleteInTx.
public void testDeleteInTx() {
TestEntity foo = insertEntity("foo");
TestEntity bar = insertEntity("bar");
assertDeleted(rxDao.deleteInTx(foo, bar));
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class RxDaoTest method testRefresh.
public void testRefresh() {
TestEntity entity = insertEntity("foo");
entity.setSimpleStringNotNull("temp");
RxTestHelper.awaitTestSubscriber(rxDao.refresh(entity));
assertEquals("foo", entity.getSimpleStringNotNull());
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class DeleteQueryTest method testDeleteQueryChangeParameter.
public void testDeleteQueryChangeParameter() {
insert(3);
String value = getSimpleString(1);
DeleteQuery<TestEntity> deleteQuery = dao.queryBuilder().where(Properties.SimpleString.eq(value)).buildDelete();
deleteQuery.executeDeleteWithoutDetachingEntities();
assertEquals(2, dao.count());
deleteQuery.setParameter(0, getSimpleString(0));
deleteQuery.executeDeleteWithoutDetachingEntities();
assertEquals(1, dao.count());
TestEntity remaining = dao.loadAll().get(0);
assertEquals(getSimpleString(2), remaining.getSimpleString());
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class JoinTest method prepareData.
private void prepareData() {
List<TestEntity> targetEntities = new ArrayList<TestEntity>();
for (int i = 0; i < 10; i++) {
TestEntity testEntity = new TestEntity();
testEntity.setSimpleInt(i + 1);
testEntity.setSimpleStringNotNull("string-" + (i + 1));
targetEntities.add(testEntity);
}
testEntityDao.insertInTx(targetEntities);
List<RelationEntity> entities = new ArrayList<RelationEntity>();
for (int i = 0; i < 10; i++) {
RelationEntity entity = new RelationEntity();
entity.setSimpleString("entity-" + (i + 1));
entity.setTestNotNull(targetEntities.get(i));
entities.add(entity);
}
relationEntityDao.insertInTx(entities);
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class TestEntityIdentityScopeTest method testDetachOther.
public void testDetachOther() {
TestEntity entity = createEntity(null);
dao.insert(entity);
dao.detach(entity);
TestEntity entity2 = dao.load(entity.getId());
dao.detach(entity);
TestEntity entity3 = dao.load(entity.getId());
assertSame(entity2, entity3);
}
Aggregations