use of org.neo4j.ogm.domain.music.Studio in project neo4j-ogm by neo4j.
the class TransactionTest method defaultTransactionShouldWorkAfterManagedTransaction.
@Test
public void defaultTransactionShouldWorkAfterManagedTransaction() {
Transaction tx = session.beginTransaction();
Studio emi = new Studio("EMI Studios, London");
session.save(emi);
tx.commit();
tx.close();
session.purgeDatabase();
}
use of org.neo4j.ogm.domain.music.Studio in project neo4j-ogm by neo4j.
the class TransactionTest method shouldBeAbleToRetrySaveOnTransactionRollback.
// GH-126
@Test
public void shouldBeAbleToRetrySaveOnTransactionRollback() {
Transaction tx = session.beginTransaction();
Studio emi = new Studio("EMI Studios, London");
Artist theBeatles = new Artist("The Beatles");
Album please = new Album("Please Please Me");
Recording pleaseRecording = new Recording(please, emi, 1963);
please.setRecording(pleaseRecording);
theBeatles.getAlbums().add(please);
please.setArtist(theBeatles);
session.save(theBeatles);
tx.rollback();
session.save(theBeatles);
session.clear();
theBeatles = session.loadAll(Artist.class, -1).iterator().next();
assertThat(theBeatles.getName()).isEqualTo("The Beatles");
assertThat(theBeatles.getAlbums()).hasSize(1);
assertThat(theBeatles.getAlbums().iterator().next().getName()).isEqualTo("Please Please Me");
assertThat(theBeatles.getAlbums().iterator().next().getRecording().getStudio().getName()).isEqualTo("EMI Studios, London");
}
use of org.neo4j.ogm.domain.music.Studio in project neo4j-ogm by neo4j.
the class FilterIntegrationTest method ignoreCaseShouldBeApplicableToEquals.
@Test
public void ignoreCaseShouldBeApplicableToEquals() {
final String emi = "EMI Studios, London";
session.save(new Studio(emi));
final Filter nameFilter = new Filter("name", ComparisonOperator.EQUALS, "eMi Studios, London").ignoreCase();
assertThat(session.loadAll(Studio.class, nameFilter, 0)).hasSize(1).extracting(Studio::getName).containsExactly(emi);
}
use of org.neo4j.ogm.domain.music.Studio in project neo4j-ogm by neo4j.
the class FilterIntegrationTest method ignoreCaseShouldBeApplicableToEndingWith.
@Test
public void ignoreCaseShouldBeApplicableToEndingWith() {
final String emi = "EMI Studios, London";
session.save(new Studio(emi));
final Filter nameFilter = new Filter("name", ComparisonOperator.ENDING_WITH, "london").ignoreCase();
assertThat(session.loadAll(Studio.class, nameFilter, 0)).hasSize(1).extracting(Studio::getName).containsExactly(emi);
}
use of org.neo4j.ogm.domain.music.Studio in project neo4j-ogm by neo4j.
the class MusicIntegrationTest method shouldLoadStudioWithLocationMissingInDomainModel.
/**
* @see DATAGRAPH-631
*/
@Test
public void shouldLoadStudioWithLocationMissingInDomainModel() {
session.query("CREATE (s:Studio {`studio-name`:'Abbey Road Studios'})", Collections.emptyMap());
Studio studio = session.loadAll(Studio.class, new Filter("name", ComparisonOperator.EQUALS, "Abbey Road Studios")).iterator().next();
assertThat(studio).isNotNull();
}
Aggregations