diff --git a/hibernate-core/src/main/java/org/hibernate/service/event/internal/EventListenerRegistryImpl.java b/hibernate-core/src/main/java/org/hibernate/service/event/internal/EventListenerRegistryImpl.java index fcf0c39b7c..0b88b9bfd5 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/event/internal/EventListenerRegistryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/service/event/internal/EventListenerRegistryImpl.java @@ -435,7 +435,7 @@ public class EventListenerRegistryImpl implements EventListenerRegistry { EventListenerRegistrationService.class ); for ( EventListenerRegistration registration : registrationService.getEventListenerRegistrations() ) { - registration.apply( registry, configuration, null, serviceRegistry ); + registration.apply( registry, configuration, configuration.getProperties(), serviceRegistry ); } return registry; diff --git a/hibernate-entitymanager/src/main/java/org/hibernate/ejb/event/JpaEventListenerRegistration.java b/hibernate-entitymanager/src/main/java/org/hibernate/ejb/event/JpaEventListenerRegistration.java index 5d8e6fc447..f43b693782 100644 --- a/hibernate-entitymanager/src/main/java/org/hibernate/ejb/event/JpaEventListenerRegistration.java +++ b/hibernate-entitymanager/src/main/java/org/hibernate/ejb/event/JpaEventListenerRegistration.java @@ -47,8 +47,8 @@ import org.hibernate.service.spi.ServiceRegistryImplementor; /** * Prepare the HEM-specific event listeners. - * - * @todo : tie this in with the "service locator" pattern defined by HHH-5562 + * + * @todo : make this into Integrator per HHH-5562 ?? * * @author Steve Ebersole */ @@ -83,11 +83,11 @@ public class JpaEventListenerRegistration implements EventListenerRegistration { @SuppressWarnings( {"unchecked"}) public void apply( EventListenerRegistry eventListenerRegistry, - Configuration configuration, Map configValues, ServiceRegistryImplementor serviceRegistry - ) { + Configuration configuration, + Map configValues, + ServiceRegistryImplementor serviceRegistry) { boolean isSecurityEnabled = configValues.containsKey( AvailableSettings.JACC_ENABLED ); - EventListenerRegistry eventListenerRegistry = serviceRegistry.getService( EventListenerRegistry.class ); eventListenerRegistry.addDuplicationStrategy( JPA_DUPLICATION_STRATEGY ); eventListenerRegistry.addDuplicationStrategy( JACC_DUPLICATION_STRATEGY ); diff --git a/hibernate-entitymanager/src/test/java/org/hibernate/ejb/test/ejb3configuration/ConfigurationObjectSettingTest.java b/hibernate-entitymanager/src/test/java/org/hibernate/ejb/test/ejb3configuration/ConfigurationObjectSettingTest.java index 1cc20b2aa8..b12ce943b3 100644 --- a/hibernate-entitymanager/src/test/java/org/hibernate/ejb/test/ejb3configuration/ConfigurationObjectSettingTest.java +++ b/hibernate-entitymanager/src/test/java/org/hibernate/ejb/test/ejb3configuration/ConfigurationObjectSettingTest.java @@ -22,20 +22,31 @@ * Boston, MA 02110-1301 USA */ package org.hibernate.ejb.test.ejb3configuration; -import java.util.Collections; + import javax.persistence.SharedCacheMode; import javax.persistence.ValidationMode; +import java.util.Collections; + import org.hibernate.HibernateException; import org.hibernate.ejb.AvailableSettings; import org.hibernate.ejb.Ejb3Configuration; import org.hibernate.ejb.packaging.PersistenceMetadata; +import org.junit.Test; + +import org.hibernate.testing.FailureExpected; +import org.hibernate.testing.junit4.BaseUnitTestCase; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + /** * Test passing along various config settings that take objects other than strings as values. * * @author Steve Ebersole */ -public class ConfigurationObjectSettingTest extends junit.framework.TestCase { +public class ConfigurationObjectSettingTest extends BaseUnitTestCase { + @Test public void testContainerBootstrapSharedCacheMode() { // first, via the integration vars PersistenceUnitInfoAdapter empty = new PersistenceUnitInfoAdapter(); @@ -46,7 +57,7 @@ public class ConfigurationObjectSettingTest extends junit.framework.TestCase { empty, Collections.singletonMap( AvailableSettings.SHARED_CACHE_MODE, SharedCacheMode.DISABLE_SELECTIVE ) ); - assertEquals( SharedCacheMode.DISABLE_SELECTIVE.name(), configured.getProperties().get( AvailableSettings.SHARED_CACHE_MODE ) ); + assertEquals( SharedCacheMode.DISABLE_SELECTIVE.name(),configured.getProperties().get( AvailableSettings.SHARED_CACHE_MODE ) ); } { // as string @@ -82,6 +93,7 @@ public class ConfigurationObjectSettingTest extends junit.framework.TestCase { } } + @Test public void testContainerBootstrapValidationMode() { // first, via the integration vars PersistenceUnitInfoAdapter empty = new PersistenceUnitInfoAdapter(); @@ -128,6 +140,8 @@ public class ConfigurationObjectSettingTest extends junit.framework.TestCase { } } + @Test + @FailureExpected( jiraKey = "HHH-6061") public void testContainerBootstrapValidationFactory() { final Object token = new Object(); PersistenceUnitInfoAdapter adapter = new PersistenceUnitInfoAdapter(); @@ -145,6 +159,7 @@ public class ConfigurationObjectSettingTest extends junit.framework.TestCase { } } + @Test public void testStandaloneBootstrapSharedCacheMode() { // first, via the integration vars PersistenceMetadata metadata = new PersistenceMetadata(); @@ -186,6 +201,7 @@ public class ConfigurationObjectSettingTest extends junit.framework.TestCase { } } + @Test public void testStandaloneBootstrapValidationMode() { // first, via the integration vars PersistenceMetadata metadata = new PersistenceMetadata(); @@ -227,6 +243,8 @@ public class ConfigurationObjectSettingTest extends junit.framework.TestCase { } } + @Test + @FailureExpected( jiraKey = "HHH-6061") public void testStandaloneBootstrapValidationFactory() { final Object token = new Object(); PersistenceMetadata metadata = new PersistenceMetadata();