use of org.neo4j.ogm.domain.filesystem.Document in project neo4j-ogm by neo4j.
the class DirtyObjectsTest method newObjectShouldBeDirty.
@Test
public void newObjectShouldBeDirty() {
Document d = new Document();
assertThat(session.context().isDirty(d)).isTrue();
}
use of org.neo4j.ogm.domain.filesystem.Document in project neo4j-ogm by neo4j.
the class DirtyObjectsTest method evictedObjectShouldBeDirty.
@Test
public void evictedObjectShouldBeDirty() {
Document d = new Document();
session.save(d);
session.clear();
assertThat(session.context().isDirty(d)).isTrue();
}
use of org.neo4j.ogm.domain.filesystem.Document in project neo4j-ogm by neo4j.
the class DirtyObjectsTest method unmodifiedLoadedObjectShouldNotBeDirty.
@Test
public void unmodifiedLoadedObjectShouldNotBeDirty() {
Document d = new Document();
session.save(d);
d = session.load(Document.class, d.getId());
assertThat(session.context().isDirty(d)).isFalse();
}
use of org.neo4j.ogm.domain.filesystem.Document in project neo4j-ogm by neo4j.
the class DirtyObjectsTest method evictedObjectThatIsIdenticalToTheLoadedObjectShouldNotBeDirty.
@Test
public void evictedObjectThatIsIdenticalToTheLoadedObjectShouldNotBeDirty() {
Document d = new Document();
session.save(d);
session.clear();
Document d2 = session.load(Document.class, d.getId());
assertThat(session.context().isDirty(d)).isFalse();
assertThat(session.context().isDirty(d2)).isFalse();
}
use of org.neo4j.ogm.domain.filesystem.Document in project neo4j-ogm by neo4j.
the class StaleObjectTest method init.
@Before
public void init() throws IOException {
SessionFactory sessionFactory = new SessionFactory(getDriver(), "org.neo4j.ogm.domain.filesystem");
session = sessionFactory.openSession();
session.purgeDatabase();
a = new Document();
a.setName("a");
b = new Document();
b.setName("b");
f = new Folder();
f.setName("f");
f.getDocuments().add(a);
f.getDocuments().add(b);
a.setFolder(f);
b.setFolder(f);
session.save(f);
assertThat(a.toString()).isEqualTo("Document{folder=Folder{name='f', documents=2, archived=0}, name='a'}");
assertThat(b.toString()).isEqualTo("Document{folder=Folder{name='f', documents=2, archived=0}, name='b'}");
}
Aggregations