diff --git a/HACKING.rst b/HACKING.rst index 31f67a0f9..b25814279 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -27,6 +27,10 @@ Compilation requirements Database server +* *MySQL* - Relational SQL database + + Alternative database server + * *Python Docutils* - Utilities for the documentation of Python modules Used to generate HTMLs help files from RST files (reStructuredText) @@ -561,6 +565,7 @@ pushing a patch. MySQL ----- +Strongly preferred to use 5.6+ version For MySQL users here are specific instructions. @@ -568,8 +573,9 @@ For MySQL users here are specific instructions. CREATE DATABASE libreplandev; CREATE DATABASE libreplandevtest; - GRANT ALL ON libreplandev.* to 'libreplan'@'localhost' identified by 'libreplan'; - GRANT ALL ON libreplandevtest.* to 'libreplan'@'localhost' identified by 'libreplan'; + CREATE USER 'libreplan'@'localhost' IDENTIFIED BY 'libreplan'; + GRANT ALL PRIVILEGES ON libreplandev.* TO 'libreplan'@'localhost' WITH GRANT OPTION; + GRANT ALL PRIVILEGES ON libreplandevtest.* TO 'libreplan'@'localhost' WITH GRANT OPTION; * Compile project:: diff --git a/libreplan-business/src/main/resources/db.changelog-database.xml b/libreplan-business/src/main/resources/db.changelog-database.xml index f3e1a71a2..4242fc6b8 100644 --- a/libreplan-business/src/main/resources/db.changelog-database.xml +++ b/libreplan-business/src/main/resources/db.changelog-database.xml @@ -1,5 +1,8 @@ - + + @@ -2163,5 +2166,4 @@ - diff --git a/libreplan-business/src/test/java/org/libreplan/business/common/EntitySequenceTest.java b/libreplan-business/src/test/java/org/libreplan/business/common/EntitySequenceTest.java index 2f19bcaca..ef1640421 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/common/EntitySequenceTest.java +++ b/libreplan-business/src/test/java/org/libreplan/business/common/EntitySequenceTest.java @@ -47,7 +47,8 @@ import org.springframework.transaction.annotation.Transactional; */ @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { BUSINESS_SPRING_CONFIG_FILE, +@ContextConfiguration(locations = { + BUSINESS_SPRING_CONFIG_FILE, BUSINESS_SPRING_CONFIG_TEST_FILE }) public class EntitySequenceTest { @@ -69,8 +70,7 @@ public class EntitySequenceTest { @Transactional public void testCreateActiveEntitySequence() { try { - entitySequenceDAO.save(givenEntitySequence("prefix-" - + UUID.randomUUID(), EntityNameEnum.CALENDAR, true)); + entitySequenceDAO.save(givenEntitySequence("prefix-" + UUID.randomUUID(), EntityNameEnum.CALENDAR, true)); entitySequenceDAO.flush(); } catch (ValidationException e) { fail("It should not throw an exception"); @@ -83,8 +83,7 @@ public class EntitySequenceTest { @Transactional public void testCreateEntitySequenceWithEmptyPrefix() { try { - entitySequenceDAO.save(givenEntitySequence("", - EntityNameEnum.CALENDAR, true)); + entitySequenceDAO.save(givenEntitySequence("", EntityNameEnum.CALENDAR, true)); fail("It should throw an exception"); } catch (ValidationException e) { // It should throw an exception @@ -96,8 +95,7 @@ public class EntitySequenceTest { @Transactional public void testCreateEntitySequenceWithPrefixWithWhiteSpace() { try { - entitySequenceDAO.save(givenEntitySequence( - "prefix with white spaces", EntityNameEnum.CALENDAR, true)); + entitySequenceDAO.save(givenEntitySequence("prefix with white spaces", EntityNameEnum.CALENDAR, true)); fail("It should throw an exception"); } catch (ValidationException e) { // It should throw an exception @@ -109,8 +107,7 @@ public class EntitySequenceTest { @Transactional public void testCreateEntitySequenceWithEmptyEntityName() { try { - entitySequenceDAO.save(givenEntitySequence("prefix-" - + UUID.randomUUID(), null, false)); + entitySequenceDAO.save(givenEntitySequence("prefix-" + UUID.randomUUID(), null, false)); fail("It should throw an exception"); } catch (ValidationException e) { // It should throw an exception @@ -122,8 +119,9 @@ public class EntitySequenceTest { @Transactional public void testCreateEntitySequenceWithNumberOfDigitsNotSpecified() { try { - EntitySequence entitySequence = givenEntitySequence("prefix-" - + UUID.randomUUID(), EntityNameEnum.CRITERION, true); + EntitySequence entitySequence = + givenEntitySequence("prefix-" + UUID.randomUUID(), EntityNameEnum.CRITERION, true); + entitySequence.setNumberOfDigits(null); entitySequenceDAO.save(entitySequence); fail("It should throw an exception"); @@ -137,8 +135,9 @@ public class EntitySequenceTest { @Transactional public void testCreateEntitySequenceWithNumberOfDigitsOutRange() { try { - EntitySequence entitySequence = givenEntitySequence("prefix-" - + UUID.randomUUID(), EntityNameEnum.CRITERION, true); + EntitySequence entitySequence = + givenEntitySequence("prefix-" + UUID.randomUUID(), EntityNameEnum.CRITERION, true); + entitySequence.setNumberOfDigits(15); entitySequenceDAO.save(entitySequence); fail("It should throw an exception"); @@ -151,13 +150,15 @@ public class EntitySequenceTest { @Test @Transactional public void testCreateTwoActiveEntitySequenceWithTheSameEntityName() { - EntitySequence entitySequenceA = givenEntitySequence("prefix-" - + UUID.randomUUID(), EntityNameEnum.CRITERION, true); + EntitySequence entitySequenceA = + givenEntitySequence("prefix-" + UUID.randomUUID(), EntityNameEnum.CRITERION, true); + entitySequenceDAO.save(entitySequenceA); entitySequenceDAO.flush(); try { - EntitySequence entitySequenceB = givenEntitySequence("prefix-" - + UUID.randomUUID(), EntityNameEnum.CRITERION, true); + EntitySequence entitySequenceB = + givenEntitySequence("prefix-" + UUID.randomUUID(), EntityNameEnum.CRITERION, true); + entitySequenceDAO.save(entitySequenceB); fail("Expected ValidationException"); } catch (ValidationException e) { @@ -167,13 +168,13 @@ public class EntitySequenceTest { @Test @Transactional public void testCreateTwoEntitySequenceWithTheSameEntityName() { - EntitySequence entitySequenceA = givenEntitySequence("prefix-" - + UUID.randomUUID(), EntityNameEnum.LABEL, true); + EntitySequence entitySequenceA = givenEntitySequence("prefix-" + UUID.randomUUID(), EntityNameEnum.LABEL, true); entitySequenceDAO.save(entitySequenceA); entitySequenceDAO.flush(); try { - EntitySequence entitySequenceB = givenEntitySequence("prefix-" - + UUID.randomUUID(), EntityNameEnum.LABEL, false); + EntitySequence entitySequenceB = + givenEntitySequence("prefix-" + UUID.randomUUID(), EntityNameEnum.LABEL, false); + entitySequenceDAO.save(entitySequenceB); } catch (ValidationException e) { fail("It shouldn't throw an exception"); @@ -183,30 +184,29 @@ public class EntitySequenceTest { @Test @Transactional public void testCreateAndRemoveTwoEntitySequenceWithTheSameEntityName() { - EntitySequence entitySequenceA = givenEntitySequence("prefix-" - + UUID.randomUUID(), EntityNameEnum.MACHINE, true); + EntitySequence entitySequenceA = + givenEntitySequence("prefix-" + UUID.randomUUID(), EntityNameEnum.MACHINE, true); + entitySequenceDAO.save(entitySequenceA); try { entitySequenceDAO.remove(entitySequenceA.getId()); - } catch (ValidationException e) { - fail("It shouldn't throw an exception"); - } catch (InstanceNotFoundException o) { + } catch (ValidationException | InstanceNotFoundException e) { fail("It shouldn't throw an exception"); } try { - EntitySequence entitySequenceB = givenEntitySequence("prefix-" - + UUID.randomUUID(), EntityNameEnum.MACHINE, true); + EntitySequence entitySequenceB = + givenEntitySequence("prefix-" + UUID.randomUUID(), EntityNameEnum.MACHINE, true); + entitySequenceDAO.save(entitySequenceB); } catch (ValidationException e) { fail("It shouldn't throw an exception"); } } - private EntitySequence givenEntitySequence(String prefix, - EntityNameEnum entityName, boolean active) { - EntitySequence entitySequence = EntitySequence.create(prefix, - entityName); + private EntitySequence givenEntitySequence(String prefix, EntityNameEnum entityName, boolean active) { + EntitySequence entitySequence = EntitySequence.create(prefix, entityName); entitySequence.setActive(active); + return entitySequence; } diff --git a/libreplan-business/src/test/resources/TestEntities.hbm.xml b/libreplan-business/src/test/resources/TestEntities.hbm.xml index 5358e662d..ce59c917c 100644 --- a/libreplan-business/src/test/resources/TestEntities.hbm.xml +++ b/libreplan-business/src/test/resources/TestEntities.hbm.xml @@ -1,7 +1,9 @@ - + + 100 @@ -11,7 +13,8 @@ column="resources_per_day" /> - + 100 diff --git a/libreplan-webapp/pom.xml b/libreplan-webapp/pom.xml index 8e1d623e0..87a9ca346 100644 --- a/libreplan-webapp/pom.xml +++ b/libreplan-webapp/pom.xml @@ -360,6 +360,12 @@ spring-security-ldap + + + org.springframework + spring-test + + org.beanshell @@ -430,11 +436,6 @@ test - - org.springframework - spring-test - - org.easymock diff --git a/pom.xml b/pom.xml index 02d3efc6d..b756a059a 100644 --- a/pom.xml +++ b/pom.xml @@ -130,7 +130,7 @@ mysql @@ -138,7 +138,7 @@ mysql mysql-connector-java - 6.0.2 + 5.1.38 com.mysql.jdbc.Driver jdbc:mysql://localhost/libreplan${libreplan.mode} @@ -904,9 +904,9 @@ - - org.liquibase - liquibase-maven-plugin + + org.liquibase + liquibase-maven-plugin 3.5.0