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
* *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::

View file

@ -1,5 +1,8 @@
<?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">
<createTable tableName="advance_assignment">
<column name="id" type="BIGINT">
@ -2163,5 +2166,4 @@
</insert>
</changeSet>
</databaseChangeLog>

View file

@ -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;
}

View file

@ -1,7 +1,9 @@
<?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">
<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">
<generator class="hilo">
<param name="max_lo">100</param>
@ -11,7 +13,8 @@
column="resources_per_day" />
</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">
<generator class="hilo">
<param name="max_lo">100</param>

View file

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

10
pom.xml
View file

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