Update MySQL JDBC driver for JDK7.

Update documentation info about MySQL.
Code refactoring.
POM / DB changelog files refactoring.
This commit is contained in:
Vova Perebykivskyi 2016-05-06 13:01:38 +03:00 committed by Dgray16
parent 51267d58b1
commit 29bfd15a81
6 changed files with 60 additions and 48 deletions

View file

@ -27,6 +27,10 @@ Compilation requirements
Database server Database server
* *MySQL* - Relational SQL database
Alternative database server
* *Python Docutils* - Utilities for the documentation of Python modules * *Python Docutils* - Utilities for the documentation of Python modules
Used to generate HTMLs help files from RST files (reStructuredText) Used to generate HTMLs help files from RST files (reStructuredText)
@ -561,6 +565,7 @@ pushing a patch.
MySQL MySQL
----- -----
Strongly preferred to use 5.6+ version
For MySQL users here are specific instructions. For MySQL users here are specific instructions.
@ -568,8 +573,9 @@ For MySQL users here are specific instructions.
CREATE DATABASE libreplandev; CREATE DATABASE libreplandev;
CREATE DATABASE libreplandevtest; CREATE DATABASE libreplandevtest;
GRANT ALL ON libreplandev.* to 'libreplan'@'localhost' identified by 'libreplan'; CREATE USER 'libreplan'@'localhost' IDENTIFIED BY 'libreplan';
GRANT ALL ON libreplandevtest.* to '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:: * Compile project::

View file

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd"> <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
<changeSet author="mrego" id="initial-database-creation-1"> <changeSet author="mrego" id="initial-database-creation-1">
<createTable tableName="advance_assignment"> <createTable tableName="advance_assignment">
<column name="id" type="BIGINT"> <column name="id" type="BIGINT">
@ -2163,5 +2166,4 @@
</insert> </insert>
</changeSet> </changeSet>
</databaseChangeLog> </databaseChangeLog>

View file

@ -47,7 +47,8 @@ import org.springframework.transaction.annotation.Transactional;
*/ */
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { BUSINESS_SPRING_CONFIG_FILE, @ContextConfiguration(locations = {
BUSINESS_SPRING_CONFIG_FILE,
BUSINESS_SPRING_CONFIG_TEST_FILE }) BUSINESS_SPRING_CONFIG_TEST_FILE })
public class EntitySequenceTest { public class EntitySequenceTest {
@ -69,8 +70,7 @@ public class EntitySequenceTest {
@Transactional @Transactional
public void testCreateActiveEntitySequence() { public void testCreateActiveEntitySequence() {
try { try {
entitySequenceDAO.save(givenEntitySequence("prefix-" entitySequenceDAO.save(givenEntitySequence("prefix-" + UUID.randomUUID(), EntityNameEnum.CALENDAR, true));
+ UUID.randomUUID(), EntityNameEnum.CALENDAR, true));
entitySequenceDAO.flush(); entitySequenceDAO.flush();
} catch (ValidationException e) { } catch (ValidationException e) {
fail("It should not throw an exception"); fail("It should not throw an exception");
@ -83,8 +83,7 @@ public class EntitySequenceTest {
@Transactional @Transactional
public void testCreateEntitySequenceWithEmptyPrefix() { public void testCreateEntitySequenceWithEmptyPrefix() {
try { try {
entitySequenceDAO.save(givenEntitySequence("", entitySequenceDAO.save(givenEntitySequence("", EntityNameEnum.CALENDAR, true));
EntityNameEnum.CALENDAR, true));
fail("It should throw an exception"); fail("It should throw an exception");
} catch (ValidationException e) { } catch (ValidationException e) {
// It should throw an exception // It should throw an exception
@ -96,8 +95,7 @@ public class EntitySequenceTest {
@Transactional @Transactional
public void testCreateEntitySequenceWithPrefixWithWhiteSpace() { public void testCreateEntitySequenceWithPrefixWithWhiteSpace() {
try { try {
entitySequenceDAO.save(givenEntitySequence( entitySequenceDAO.save(givenEntitySequence("prefix with white spaces", EntityNameEnum.CALENDAR, true));
"prefix with white spaces", EntityNameEnum.CALENDAR, true));
fail("It should throw an exception"); fail("It should throw an exception");
} catch (ValidationException e) { } catch (ValidationException e) {
// It should throw an exception // It should throw an exception
@ -109,8 +107,7 @@ public class EntitySequenceTest {
@Transactional @Transactional
public void testCreateEntitySequenceWithEmptyEntityName() { public void testCreateEntitySequenceWithEmptyEntityName() {
try { try {
entitySequenceDAO.save(givenEntitySequence("prefix-" entitySequenceDAO.save(givenEntitySequence("prefix-" + UUID.randomUUID(), null, false));
+ UUID.randomUUID(), null, false));
fail("It should throw an exception"); fail("It should throw an exception");
} catch (ValidationException e) { } catch (ValidationException e) {
// It should throw an exception // It should throw an exception
@ -122,8 +119,9 @@ public class EntitySequenceTest {
@Transactional @Transactional
public void testCreateEntitySequenceWithNumberOfDigitsNotSpecified() { public void testCreateEntitySequenceWithNumberOfDigitsNotSpecified() {
try { try {
EntitySequence entitySequence = givenEntitySequence("prefix-" EntitySequence entitySequence =
+ UUID.randomUUID(), EntityNameEnum.CRITERION, true); givenEntitySequence("prefix-" + UUID.randomUUID(), EntityNameEnum.CRITERION, true);
entitySequence.setNumberOfDigits(null); entitySequence.setNumberOfDigits(null);
entitySequenceDAO.save(entitySequence); entitySequenceDAO.save(entitySequence);
fail("It should throw an exception"); fail("It should throw an exception");
@ -137,8 +135,9 @@ public class EntitySequenceTest {
@Transactional @Transactional
public void testCreateEntitySequenceWithNumberOfDigitsOutRange() { public void testCreateEntitySequenceWithNumberOfDigitsOutRange() {
try { try {
EntitySequence entitySequence = givenEntitySequence("prefix-" EntitySequence entitySequence =
+ UUID.randomUUID(), EntityNameEnum.CRITERION, true); givenEntitySequence("prefix-" + UUID.randomUUID(), EntityNameEnum.CRITERION, true);
entitySequence.setNumberOfDigits(15); entitySequence.setNumberOfDigits(15);
entitySequenceDAO.save(entitySequence); entitySequenceDAO.save(entitySequence);
fail("It should throw an exception"); fail("It should throw an exception");
@ -151,13 +150,15 @@ public class EntitySequenceTest {
@Test @Test
@Transactional @Transactional
public void testCreateTwoActiveEntitySequenceWithTheSameEntityName() { public void testCreateTwoActiveEntitySequenceWithTheSameEntityName() {
EntitySequence entitySequenceA = givenEntitySequence("prefix-" EntitySequence entitySequenceA =
+ UUID.randomUUID(), EntityNameEnum.CRITERION, true); givenEntitySequence("prefix-" + UUID.randomUUID(), EntityNameEnum.CRITERION, true);
entitySequenceDAO.save(entitySequenceA); entitySequenceDAO.save(entitySequenceA);
entitySequenceDAO.flush(); entitySequenceDAO.flush();
try { try {
EntitySequence entitySequenceB = givenEntitySequence("prefix-" EntitySequence entitySequenceB =
+ UUID.randomUUID(), EntityNameEnum.CRITERION, true); givenEntitySequence("prefix-" + UUID.randomUUID(), EntityNameEnum.CRITERION, true);
entitySequenceDAO.save(entitySequenceB); entitySequenceDAO.save(entitySequenceB);
fail("Expected ValidationException"); fail("Expected ValidationException");
} catch (ValidationException e) { } catch (ValidationException e) {
@ -167,13 +168,13 @@ public class EntitySequenceTest {
@Test @Test
@Transactional @Transactional
public void testCreateTwoEntitySequenceWithTheSameEntityName() { public void testCreateTwoEntitySequenceWithTheSameEntityName() {
EntitySequence entitySequenceA = givenEntitySequence("prefix-" EntitySequence entitySequenceA = givenEntitySequence("prefix-" + UUID.randomUUID(), EntityNameEnum.LABEL, true);
+ UUID.randomUUID(), EntityNameEnum.LABEL, true);
entitySequenceDAO.save(entitySequenceA); entitySequenceDAO.save(entitySequenceA);
entitySequenceDAO.flush(); entitySequenceDAO.flush();
try { try {
EntitySequence entitySequenceB = givenEntitySequence("prefix-" EntitySequence entitySequenceB =
+ UUID.randomUUID(), EntityNameEnum.LABEL, false); givenEntitySequence("prefix-" + UUID.randomUUID(), EntityNameEnum.LABEL, false);
entitySequenceDAO.save(entitySequenceB); entitySequenceDAO.save(entitySequenceB);
} catch (ValidationException e) { } catch (ValidationException e) {
fail("It shouldn't throw an exception"); fail("It shouldn't throw an exception");
@ -183,30 +184,29 @@ public class EntitySequenceTest {
@Test @Test
@Transactional @Transactional
public void testCreateAndRemoveTwoEntitySequenceWithTheSameEntityName() { public void testCreateAndRemoveTwoEntitySequenceWithTheSameEntityName() {
EntitySequence entitySequenceA = givenEntitySequence("prefix-" EntitySequence entitySequenceA =
+ UUID.randomUUID(), EntityNameEnum.MACHINE, true); givenEntitySequence("prefix-" + UUID.randomUUID(), EntityNameEnum.MACHINE, true);
entitySequenceDAO.save(entitySequenceA); entitySequenceDAO.save(entitySequenceA);
try { try {
entitySequenceDAO.remove(entitySequenceA.getId()); entitySequenceDAO.remove(entitySequenceA.getId());
} catch (ValidationException e) { } catch (ValidationException | InstanceNotFoundException e) {
fail("It shouldn't throw an exception");
} catch (InstanceNotFoundException o) {
fail("It shouldn't throw an exception"); fail("It shouldn't throw an exception");
} }
try { try {
EntitySequence entitySequenceB = givenEntitySequence("prefix-" EntitySequence entitySequenceB =
+ UUID.randomUUID(), EntityNameEnum.MACHINE, true); givenEntitySequence("prefix-" + UUID.randomUUID(), EntityNameEnum.MACHINE, true);
entitySequenceDAO.save(entitySequenceB); entitySequenceDAO.save(entitySequenceB);
} catch (ValidationException e) { } catch (ValidationException e) {
fail("It shouldn't throw an exception"); fail("It shouldn't throw an exception");
} }
} }
private EntitySequence givenEntitySequence(String prefix, private EntitySequence givenEntitySequence(String prefix, EntityNameEnum entityName, boolean active) {
EntityNameEnum entityName, boolean active) { EntitySequence entitySequence = EntitySequence.create(prefix, entityName);
EntitySequence entitySequence = EntitySequence.create(prefix,
entityName);
entitySequence.setActive(active); entitySequence.setActive(active);
return entitySequence; return entitySequence;
} }

View file

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-access="field"> <hibernate-mapping default-access="field">
<class name="org.libreplan.business.test.workingday.hibernate.EntityContainingResourcePerDay" table="entity_containing_resource_per_day">
<class name="org.libreplan.business.test.workingday.hibernate.EntityContainingResourcePerDay"
table="entity_containing_resource_per_day">
<id name="id"> <id name="id">
<generator class="hilo"> <generator class="hilo">
<param name="max_lo">100</param> <param name="max_lo">100</param>
@ -11,7 +13,8 @@
column="resources_per_day" /> column="resources_per_day" />
</class> </class>
<class name="org.libreplan.business.test.workingday.hibernate.EntityContainingEffortDuration" table="entity_containing_effort_duration"> <class name="org.libreplan.business.test.workingday.hibernate.EntityContainingEffortDuration"
table="entity_containing_effort_duration">
<id name="id"> <id name="id">
<generator class="hilo"> <generator class="hilo">
<param name="max_lo">100</param> <param name="max_lo">100</param>

View file

@ -360,6 +360,12 @@
<artifactId>spring-security-ldap</artifactId> <artifactId>spring-security-ldap</artifactId>
</dependency> </dependency>
<!-- Spring Test -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<!-- BSH --> <!-- BSH -->
<dependency> <dependency>
<groupId>org.beanshell</groupId> <groupId>org.beanshell</groupId>
@ -430,11 +436,6 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<!-- Easymock --> <!-- Easymock -->
<dependency> <dependency>
<groupId>org.easymock</groupId> <groupId>org.easymock</groupId>

10
pom.xml
View file

@ -130,7 +130,7 @@
</profile> </profile>
<!-- MySQL profile <!-- MySQL profile
TODO chagne version mysql for JDK8 TODO change version mysql for JDK8
--> -->
<profile> <profile>
<id>mysql</id> <id>mysql</id>
@ -138,7 +138,7 @@
<!-- JDBC driver properties --> <!-- JDBC driver properties -->
<jdbcDriver.groupId>mysql</jdbcDriver.groupId> <jdbcDriver.groupId>mysql</jdbcDriver.groupId>
<jdbcDriver.artifactId>mysql-connector-java</jdbcDriver.artifactId> <jdbcDriver.artifactId>mysql-connector-java</jdbcDriver.artifactId>
<jdbcDriver.version>6.0.2</jdbcDriver.version> <jdbcDriver.version>5.1.38</jdbcDriver.version>
<jdbcDriver.className>com.mysql.jdbc.Driver</jdbcDriver.className> <jdbcDriver.className>com.mysql.jdbc.Driver</jdbcDriver.className>
<!-- Data source properties --> <!-- Data source properties -->
<dataSource.url>jdbc:mysql://localhost/libreplan${libreplan.mode}</dataSource.url> <dataSource.url>jdbc:mysql://localhost/libreplan${libreplan.mode}</dataSource.url>
@ -912,9 +912,9 @@
<!-- =========================================================== --> <!-- =========================================================== -->
<!-- LiquiBase plugin --> <!-- LiquiBase plugin -->
<plugin> <plugin>
<groupId>org.liquibase</groupId> <groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId> <artifactId>liquibase-maven-plugin</artifactId>
<version>3.5.0</version> <version>3.5.0</version>
</plugin> </plugin>