diff --git a/ccm-core/pom.xml b/ccm-core/pom.xml index 6f67d2dbf..199e41045 100644 --- a/ccm-core/pom.xml +++ b/ccm-core/pom.xml @@ -48,7 +48,7 @@ org.hibernate hibernate-envers - + provided diff --git a/ccm-core/src/main/java/org/libreccm/modules/CcmIntegrator.java b/ccm-core/src/main/java/org/libreccm/modules/CcmIntegrator.java index ee333b8e3..65135ce23 100644 --- a/ccm-core/src/main/java/org/libreccm/modules/CcmIntegrator.java +++ b/ccm-core/src/main/java/org/libreccm/modules/CcmIntegrator.java @@ -23,10 +23,10 @@ import org.apache.logging.log4j.Logger; import org.flywaydb.core.Flyway; import org.flywaydb.core.api.MigrationInfo; import org.flywaydb.core.internal.util.jdbc.JdbcUtils; +import org.hibernate.boot.Metadata; import org.hibernate.cfg.Configuration; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.integrator.spi.Integrator; -import org.hibernate.metamodel.source.MetadataImplementor; import org.hibernate.service.spi.SessionFactoryServiceRegistry; import java.sql.Connection; @@ -67,15 +67,14 @@ public class CcmIntegrator implements Integrator { * Checks for new and updated modules when the persistence unit is started. * If there are updates the necessary database migrations are executed. * - * @param configuration + * @param metadata * @param sessionFactory * @param registry */ @Override - public void integrate(final Configuration configuration, + public void integrate(final Metadata metadata, final SessionFactoryImplementor sessionFactory, final SessionFactoryServiceRegistry registry) { - //Find all modules in the classpath LOGGER.info("Retrieving modules..."); modules = ServiceLoader.load(CcmModule.class); for (final CcmModule module : modules) { @@ -117,9 +116,6 @@ public class CcmIntegrator implements Integrator { // } } - //Build Hibernate mappings for the entities. - configuration.buildMappings(); - } catch (DependencyException | SQLException ex) { throw new IntegrationException("Failed to integrate modules", ex); } finally { @@ -298,13 +294,6 @@ public class CcmIntegrator implements Integrator { } } - @Override - public void integrate(final MetadataImplementor metadata, - final SessionFactoryImplementor sessionFactory, - final SessionFactoryServiceRegistry registry) { - //Nothing - } - /** * Called when the application is shutdown. Used to remove the database * schema of uninstalled modules. diff --git a/ccm-core/src/test/java/org/libreccm/categorization/EqualsAndHashCodeTest.java b/ccm-core/src/test/java/org/libreccm/categorization/EqualsAndHashCodeTest.java index 23adba63c..1edb70db3 100644 --- a/ccm-core/src/test/java/org/libreccm/categorization/EqualsAndHashCodeTest.java +++ b/ccm-core/src/test/java/org/libreccm/categorization/EqualsAndHashCodeTest.java @@ -23,6 +23,11 @@ import nl.jqno.equalsverifier.Warning; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; +import org.libreccm.core.CcmObject; +import org.libreccm.security.Group; +import org.libreccm.security.Permission; +import org.libreccm.security.Role; +import org.libreccm.security.User; import org.libreccm.tests.categories.UnitTest; import org.libreccm.web.CcmApplication; @@ -73,6 +78,32 @@ public class EqualsAndHashCodeTest { final CcmApplication application2 = new CcmApplication(); application2.setPrimaryUrl("http://application-two.exampl.org"); + final CcmObject ccmObject1 = new CcmObject(); + ccmObject1.setObjectId(-100); + ccmObject1.setDisplayName("Object 1"); + + final CcmObject ccmObject2 = new CcmObject(); + ccmObject1.setObjectId(-200); + ccmObject1.setDisplayName("Object 2"); + + final Role role1 = new Role(); + role1.setName("role1"); + + final Role role2 = new Role(); + role2.setName("role2"); + + final Group group1 = new Group(); + group1.setName("group1"); + + final Group group2 = new Group(); + group2.setName("group2"); + + final User user1 = new TestUser(); + user1.setName("user1"); + + final User user2 = new TestUser(); + user2.setName("user2"); + EqualsVerifier .forClass(entityClass) .suppress(Warning.STRICT_INHERITANCE) @@ -81,7 +112,21 @@ public class EqualsAndHashCodeTest { .withPrefabValues(Category.class, category1, category2) .withPrefabValues(Domain.class, domain1, domain2) .withPrefabValues(CcmApplication.class, application1, application2) + .withPrefabValues(CcmObject.class, ccmObject1, ccmObject2) + .withPrefabValues(Role.class, role1, role2) + .withPrefabValues(Group.class, group1, group2) + .withPrefabValues(User.class, user1, user2) .verify(); } + + private class TestUser extends User { + + private static final long serialVersionUID = -9052762220990453621L; + + protected TestUser() { + super(); + } + + } } diff --git a/pom.xml b/pom.xml index de0435dd1..309c11e96 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,7 @@ - LPLv2 or newer + LGPLv2 or newer http://www.gnu.org/licenses/lgpl-2.0.html @@ -76,7 +76,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 2.8 + 2.9 @@ -98,7 +98,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.3 + 3.5.1 1.8 1.8 @@ -135,7 +135,7 @@ org.apache.maven.plugins maven-site-plugin - 3.5 + 3.5.1 org.apache.maven.plugins @@ -192,13 +192,13 @@ de.jpdigital - hibernate4-ddl-maven-plugin + hibernate5-ddl-maven-plugin 1.0.0 org.jacoco jacoco-maven-plugin - 0.7.5.201505241946 + 0.7.6.201602180812 @@ -329,7 +329,7 @@ commons-cli commons-cli - 1.2 + 1.3.1 commons-codec @@ -339,7 +339,7 @@ commons-collections commons-collections - 3.2.1 + 3.2.2 commons-fileupload @@ -354,7 +354,7 @@ commons-io commons-io - 2.4 + 2.5 commons-lang @@ -376,7 +376,7 @@ net.sf.saxon Saxon-HE - 9.6.0-5 + 9.7.0-4 @@ -394,13 +394,13 @@ org.jsoup jsoup - 1.8.2 + 1.9.1 org.apache.maven maven-artifact - 3.3.3 + 3.3.9 @@ -485,7 +485,7 @@ org.jboss.arquillian arquillian-bom - 1.1.10.Final + 1.1.11.Final import pom @@ -514,7 +514,7 @@ org.jacoco org.jacoco.core - 0.7.5.201505241946 + 0.7.6.201602180812 test @@ -542,14 +542,14 @@ nl.jqno.equalsverifier equalsverifier - 1.7.6 + 1.7.8 com.h2database h2 - 1.4.190 + 1.4.191