use of com.yahoo.elide.example.beans.FirstBean in project elide by yahoo.
the class MultiplexManagerTest method testValidCommit.
@Test
public void testValidCommit() throws IOException {
final FirstBean object = new FirstBean();
object.setId(null);
object.setName("Test");
try (DataStoreTransaction t = multiplexManager.beginTransaction()) {
assertFalse(t.loadObjects(EntityProjection.builder().type(FirstBean.class).build(), null).iterator().hasNext());
t.createObject(object, null);
assertFalse(t.loadObjects(EntityProjection.builder().type(FirstBean.class).build(), null).iterator().hasNext());
t.commit(null);
}
try (DataStoreTransaction t = multiplexManager.beginTransaction()) {
Iterable<Object> beans = t.loadObjects(EntityProjection.builder().type(FirstBean.class).build(), null);
assertNotNull(beans);
assertTrue(beans.iterator().hasNext());
FirstBean bean = (FirstBean) IterableUtils.first(beans);
assertTrue(bean.getId() != null && "Test".equals(bean.getName()));
}
}
Aggregations