Package org.hibernate.event.service.internal

Examples of org.hibernate.event.service.internal.EventListenerRegistryImpl


*/
public class DuplicationStrategyTest {

  @Test
  public void testMultipleRegistrationOfEventListenerKeepsOriginalListener() {
    EventListenerRegistry eventListenerRegistry = new EventListenerRegistryImpl();

    EventListenerGroup<PostInsertEventListener> eventEventListenerGroup = eventListenerRegistry.getEventListenerGroup(
        EventType.POST_INSERT
    );
    assertTrue( "We should start of with no listeners", eventEventListenerGroup.count() == 0 );

    FullTextIndexEventListener firstFullTextIndexEventListener = new FullTextIndexEventListener();

    eventListenerRegistry.setListeners( EventType.POST_INSERT, firstFullTextIndexEventListener );
    eventListenerRegistry.addDuplicationStrategy(
        new HibernateSearchIntegrator.DuplicationStrategyImpl(
            FullTextIndexEventListener.class
        )
    );
    eventListenerRegistry.appendListeners( EventType.POST_INSERT, new FullTextIndexEventListener() );

    assertTrue(
        "We should only be one listener, but we have " + eventEventListenerGroup.count(),
        eventEventListenerGroup.count() == 1
    );
View Full Code Here

TOP

Related Classes of org.hibernate.event.service.internal.EventListenerRegistryImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.