Author: hlship
Date: Tue Oct 19 22:23:44 2010
New Revision: 1024436
URL: http://svn.apache.org/viewvc?rev=1024436&view=rev
Log:
TAP5-1317: Upgrade Hibernate dependencies to latest, 3.6.0.Final
Removed:
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/main/java/org/apache/tapestry5/internal/hibernate/ImmutableConfiguration.java
Modified:
tapestry/tapestry5/trunk/tapestry-hibernate-core/pom.xml
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/main/java/org/apache/tapestry5/internal/hibernate/HibernateCoreMessages.java
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/main/java/org/apache/tapestry5/internal/hibernate/HibernateSessionSourceImpl.java
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/main/resources/org/apache/tapestry5/internal/hibernate/HibernateCoreStrings.properties
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/test/java/org/apache/tapestry5/internal/hibernate/DefaultHibernateConfigurerFilterTest.java
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/test/java/org/apache/tapestry5/internal/hibernate/HibernateSessionSourceImplTest.java
tapestry/tapestry5/trunk/tapestry-hibernate/pom.xml
Modified: tapestry/tapestry5/trunk/tapestry-hibernate-core/pom.xml
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-hibernate-core/pom.xml?rev=1024436&r1=1024435&r2=1024436&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-hibernate-core/pom.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-hibernate-core/pom.xml Tue Oct 19
22:23:44 2010
@@ -31,12 +31,6 @@
<artifactId>easymock</artifactId>
</dependency>
<dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymockclassextension</artifactId>
- <version>2.2.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
@@ -74,21 +68,6 @@ it can be tricky because there are overl
<version>1.0-M1</version>
</dependency>
- <!-- The annotation should be compatible with the 3.2.2.ga release of
the
- core package. -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-annotations</artifactId>
- <version>${hibernate-version}</version>
- <exclusions>
- <!-- Make sure we use the version defined by tapestry-ioc. -->
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
@@ -176,6 +155,6 @@ it can be tricky because there are overl
</reporting>
<properties>
- <hibernate-version>3.5.4-Final</hibernate-version>
+ <hibernate-version>3.6.0.Final</hibernate-version>
</properties>
</project>
Modified:
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/main/java/org/apache/tapestry5/internal/hibernate/HibernateCoreMessages.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-hibernate-core/src/main/java/org/apache/tapestry5/internal/hibernate/HibernateCoreMessages.java?rev=1024436&r1=1024435&r2=1024436&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/main/java/org/apache/tapestry5/internal/hibernate/HibernateCoreMessages.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/main/java/org/apache/tapestry5/internal/hibernate/HibernateCoreMessages.java
Tue Oct 19 22:23:44 2010
@@ -24,11 +24,6 @@ public class HibernateCoreMessages
{
private static final Messages MESSAGES =
MessagesImpl.forClass(HibernateCoreMessages.class);
- public static String configurationImmutable()
- {
- return MESSAGES.get("configuration-immutable");
- }
-
public static String startupTiming(long toConfigure, long overall)
{
return MESSAGES.format("startup-timing", toConfigure, overall);
Modified:
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/main/java/org/apache/tapestry5/internal/hibernate/HibernateSessionSourceImpl.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-hibernate-core/src/main/java/org/apache/tapestry5/internal/hibernate/HibernateSessionSourceImpl.java?rev=1024436&r1=1024435&r2=1024436&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/main/java/org/apache/tapestry5/internal/hibernate/HibernateSessionSourceImpl.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/main/java/org/apache/tapestry5/internal/hibernate/HibernateSessionSourceImpl.java
Tue Oct 19 22:23:44 2010
@@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
-// http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,6 +14,8 @@
package org.apache.tapestry5.internal.hibernate;
+import java.util.List;
+
import org.apache.tapestry5.hibernate.HibernateConfigurer;
import org.apache.tapestry5.hibernate.HibernateSessionSource;
import org.apache.tapestry5.ioc.services.RegistryShutdownListener;
@@ -23,8 +25,6 @@ import org.hibernate.cfg.AnnotationConfi
import org.hibernate.cfg.Configuration;
import org.slf4j.Logger;
-import java.util.List;
-
public class HibernateSessionSourceImpl implements HibernateSessionSource,
RegistryShutdownListener
{
private final SessionFactory sessionFactory;
@@ -35,7 +35,7 @@ public class HibernateSessionSourceImpl
{
long startTime = System.currentTimeMillis();
- Configuration configuration = new AnnotationConfiguration();
+ configuration = new AnnotationConfiguration();
for (HibernateConfigurer configurer : hibernateConfigurers)
configurer.configure(configuration);
@@ -43,17 +43,12 @@ public class HibernateSessionSourceImpl
long configurationComplete = System.currentTimeMillis();
sessionFactory = configuration.buildSessionFactory();
- this.configuration = new ImmutableConfiguration(configuration);
long factoryCreated = System.currentTimeMillis();
- logger.info(HibernateCoreMessages.startupTiming(
- configurationComplete - startTime,
- factoryCreated - startTime));
-
- logger
-
.info(HibernateCoreMessages.entityCatalog(sessionFactory.getAllClassMetadata()
- .keySet()));
+ logger.info(HibernateCoreMessages.startupTiming(configurationComplete
- startTime, factoryCreated - startTime));
+
+
logger.info(HibernateCoreMessages.entityCatalog(sessionFactory.getAllClassMetadata().keySet()));
}
public Session create()
Modified:
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/main/resources/org/apache/tapestry5/internal/hibernate/HibernateCoreStrings.properties
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-hibernate-core/src/main/resources/org/apache/tapestry5/internal/hibernate/HibernateCoreStrings.properties?rev=1024436&r1=1024435&r2=1024436&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/main/resources/org/apache/tapestry5/internal/hibernate/HibernateCoreStrings.properties
(original)
+++
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/main/resources/org/apache/tapestry5/internal/hibernate/HibernateCoreStrings.properties
Tue Oct 19 22:23:44 2010
@@ -1,4 +1,4 @@
-# Copyright 2008 The Apache Software Foundation
+# Copyright 2008, 2010 The Apache Software Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,6 +12,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-configuration-immutable=The Hibernate configuration is now immutable since the
SessionFactory has already been created.
startup-timing=Hibernate startup: %,d ms to configure, %,d ms overall.
entity-catalog=Configured Hibernate entities: %s
Modified:
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/test/java/org/apache/tapestry5/internal/hibernate/DefaultHibernateConfigurerFilterTest.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-hibernate-core/src/test/java/org/apache/tapestry5/internal/hibernate/DefaultHibernateConfigurerFilterTest.java?rev=1024436&r1=1024435&r2=1024436&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/test/java/org/apache/tapestry5/internal/hibernate/DefaultHibernateConfigurerFilterTest.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/test/java/org/apache/tapestry5/internal/hibernate/DefaultHibernateConfigurerFilterTest.java
Tue Oct 19 22:23:44 2010
@@ -1,10 +1,10 @@
-// Copyright 2007, 2008 The Apache Software Foundation
+// Copyright 2007, 2008, 2010 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
-// http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,35 +14,33 @@
package org.apache.tapestry5.internal.hibernate;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.classextension.EasyMock.*;
+import org.apache.tapestry5.ioc.test.TestBase;
import org.hibernate.cfg.Configuration;
import org.testng.annotations.Test;
@Test
-public class DefaultHibernateConfigurerFilterTest
+public class DefaultHibernateConfigurerFilterTest extends TestBase
{
public void configure_with_default_configuration_on() throws Exception
{
- Configuration config = createMock(Configuration.class);
+ Configuration config = newMock(Configuration.class);
expect(config.configure()).andReturn(config);
-
- replay(config);
+ replay();
new DefaultHibernateConfigurer(true).configure(config);
- verify(config);
+ verify();
}
public void configure_with_default_configuration_off() throws Exception
{
- Configuration config = createMock(Configuration.class);
+ Configuration config = newMock(Configuration.class);
- replay(config);
+ replay();
new DefaultHibernateConfigurer(false).configure(config);
- verify(config);
+ verify();
}
}
Modified:
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/test/java/org/apache/tapestry5/internal/hibernate/HibernateSessionSourceImplTest.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-hibernate-core/src/test/java/org/apache/tapestry5/internal/hibernate/HibernateSessionSourceImplTest.java?rev=1024436&r1=1024435&r2=1024436&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/test/java/org/apache/tapestry5/internal/hibernate/HibernateSessionSourceImplTest.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-hibernate-core/src/test/java/org/apache/tapestry5/internal/hibernate/HibernateSessionSourceImplTest.java
Tue Oct 19 22:23:44 2010
@@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
-// http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@@ -37,22 +37,19 @@ import java.util.List;
public class HibernateSessionSourceImplTest extends IOCTestCase
{
- private final Logger log = LoggerFactory
- .getLogger("tapestry.hibernate.HibernateSessionSourceTest");
+ private final Logger log =
LoggerFactory.getLogger("tapestry.hibernate.HibernateSessionSourceTest");
@Test
public void startup_without_packages()
{
- Collection<String> packageNames = CollectionFactory.newList(
- "org.example.myapp.entities",
+ Collection<String> packageNames =
CollectionFactory.newList("org.example.myapp.entities",
"org.example.app0.entities");
HibernateEntityPackageManager packageManager =
newMock(HibernateEntityPackageManager.class);
TestBase.expect(packageManager.getPackageNames()).andReturn(packageNames);
- List<HibernateConfigurer> filters = Arrays.asList(
- new DefaultHibernateConfigurer(true),
- new PackageNameHibernateConfigurer(packageManager,
- new
ClassNameLocatorImpl(new ClasspathURLConverterImpl())));
+ List<HibernateConfigurer> filters = Arrays.asList(new
DefaultHibernateConfigurer(true),
+ new PackageNameHibernateConfigurer(packageManager, new
ClassNameLocatorImpl(
+ new ClasspathURLConverterImpl())));
replay();
HibernateSessionSource source = new HibernateSessionSourceImpl(log,
filters);
@@ -78,22 +75,12 @@ public class HibernateSessionSourceImplT
configuration.configure();
}
};
- HibernateSessionSource source = new HibernateSessionSourceImpl(log,
Arrays
- .asList(configurer));
+ HibernateSessionSource source = new HibernateSessionSourceImpl(log,
Arrays.asList(configurer));
Configuration config = source.getConfiguration();
Assert.assertNotNull(config);
Assert.assertEquals("bar", config.getProperty("foo"));
- // configuration should be immutable
- try
- {
- config.setProperty("hibernate.dialect", "foo");
- Assert.fail("did not throw");
- }
- catch (UnsupportedOperationException e)
- {
- Assert.assertTrue(e.getMessage().contains("immutable"));
- }
+ // Configuration was immutable in 5.1, but Hibernate 3.6.0.Final made
that impossible
}
}
Modified: tapestry/tapestry5/trunk/tapestry-hibernate/pom.xml
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-hibernate/pom.xml?rev=1024436&r1=1024435&r2=1024436&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-hibernate/pom.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-hibernate/pom.xml Tue Oct 19 22:23:44 2010
@@ -38,12 +38,6 @@
<artifactId>easymock</artifactId>
</dependency>
<dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymockclassextension</artifactId>
- <version>2.2.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.7</version>