Search in sources :

Example 1 with PersistenceEvent

use of org.neo4j.ogm.session.event.PersistenceEvent in project spring-boot by spring-projects.

the class Neo4jDataAutoConfigurationTests method eventListenersAreAutoRegistered.

@Test
public void eventListenersAreAutoRegistered() {
    load(EventListenerConfiguration.class);
    Session session = this.context.getBean(SessionFactory.class).openSession();
    session.notifyListeners(new PersistenceEvent(null, Event.TYPE.PRE_SAVE));
    verify(this.context.getBean("eventListenerOne", EventListener.class)).onPreSave(any(Event.class));
    verify(this.context.getBean("eventListenerTwo", EventListener.class)).onPreSave(any(Event.class));
}
Also used : SessionFactory(org.neo4j.ogm.session.SessionFactory) PersistenceEvent(org.neo4j.ogm.session.event.PersistenceEvent) Event(org.neo4j.ogm.session.event.Event) PersistenceEvent(org.neo4j.ogm.session.event.PersistenceEvent) Session(org.neo4j.ogm.session.Session) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 Session (org.neo4j.ogm.session.Session)1 SessionFactory (org.neo4j.ogm.session.SessionFactory)1 Event (org.neo4j.ogm.session.event.Event)1 PersistenceEvent (org.neo4j.ogm.session.event.PersistenceEvent)1