Merge pull request #89 from dgray16/master

Update Jax-Rs-API & PostgreSQL dialect
This commit is contained in:
Jeroen Baten 2016-05-10 14:59:42 +02:00
commit debf968d65
7 changed files with 100 additions and 135 deletions

View file

@ -41,6 +41,9 @@ Changes
* Update Commons Math * Update Commons Math
* Update Commons Collections * Update Commons Collections
* Update Commons Logging * Update Commons Logging
* Update Commons Gettext
* Update Сommons IO
* Update Commons Fileupload
* Update CXF-transports-http * Update CXF-transports-http
* Update CXF-frontend-jaxrs * Update CXF-frontend-jaxrs
@ -56,12 +59,12 @@ Changes
* Update JGraphT * Update JGraphT
* Update DBUnit * Update DBUnit
* Update JodaTime * Update JodaTime
* Update Gettext
* Update Jasper Reports * Update Jasper Reports
* Update EasyMock * Update EasyMock
* Update JDBC driver * Update JDBC driver
* Update Сommons-IO
* Update AspectJ Weaver * Update AspectJ Weaver
* Update JAX-RS API
* Update BeanShell
* Update LibrePlan version to 1.6.0 * Update LibrePlan version to 1.6.0

View file

@ -40,7 +40,6 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId> <artifactId>maven-source-plugin</artifactId>
<version>3.0.0</version>
<executions> <executions>
<execution> <execution>
<id>default</id> <id>default</id>
@ -57,6 +56,7 @@
</profile> </profile>
</profiles> </profiles>
<!-- TODO delete it? -->
<build> <build>
<pluginManagement> <pluginManagement>
<plugins> <plugins>
@ -72,13 +72,13 @@
<pluginExecutionFilter> <pluginExecutionFilter>
<groupId>org.xnap.commons</groupId> <groupId>org.xnap.commons</groupId>
<artifactId>maven-gettext-plugin</artifactId> <artifactId>maven-gettext-plugin</artifactId>
<versionRange>[1.2.0,)</versionRange> <versionRange>[1.2.4,)</versionRange>
<goals> <goals>
<goal>dist</goal> <goal>dist</goal>
</goals> </goals>
</pluginExecutionFilter> </pluginExecutionFilter>
<action> <action>
<ignore></ignore> <ignore/>
</action> </action>
</pluginExecution> </pluginExecution>
</pluginExecutions> </pluginExecutions>

View file

@ -40,9 +40,9 @@ public class DomainDependency<T> implements IDependency<T> {
private static final Log LOG = LogFactory.getLog(DomainDependency.class); private static final Log LOG = LogFactory.getLog(DomainDependency.class);
public static <T> List<Dependency> toDependencies( public static <T> List<Dependency> toDependencies(
IDomainAndBeansMapper<T> mapper, IDomainAndBeansMapper<T> mapper, Collection<DomainDependency<T>> dependencies) {
Collection<DomainDependency<T>> dependencies) {
List<Dependency> result = new ArrayList<Dependency>(); List<Dependency> result = new ArrayList<>();
for (DomainDependency<T> domainDependency : dependencies) { for (DomainDependency<T> domainDependency : dependencies) {
try { try {
result.add(domainDependency.toDependency(mapper)); result.add(domainDependency.toDependency(mapper));
@ -50,11 +50,11 @@ public class DomainDependency<T> implements IDependency<T> {
LOG.error("error creating dependency from domainDependency", e); LOG.error("error creating dependency from domainDependency", e);
} }
} }
return result; return result;
} }
public static <T> DomainDependency<T> createDependency(T source, public static <T> DomainDependency<T> createDependency(T source, T destination, DependencyType type) {
T destination, DependencyType type) {
return new DomainDependency<T>(source, destination, type); return new DomainDependency<T>(source, destination, type);
} }
@ -84,7 +84,6 @@ public class DomainDependency<T> implements IDependency<T> {
} }
public Dependency toDependency(IDomainAndBeansMapper<T> mapper) { public Dependency toDependency(IDomainAndBeansMapper<T> mapper) {
return new Dependency(mapper.findAssociatedBean(source), mapper return new Dependency(mapper.findAssociatedBean(source), mapper.findAssociatedBean(destination), type);
.findAssociatedBean(destination), type);
} }
} }

View file

@ -91,22 +91,23 @@ public class ConstraintTest {
return value != null && value > 5; return value != null && value > 5;
} }
}; };
assertThat(biggerThanFive.applyTo(5), equalTo(6)); assertThat(biggerThanFive.applyTo(5), equalTo(6));
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Test @Test
public void applyingSeveralConstraintsCallsApplyToOfEveryone() { public void applyingSeveralConstraintsCallsApplyToOfEveryone() {
List<Constraint<Object>> constraints = new ArrayList<Constraint<Object>>(); List<Constraint<Object>> constraints = new ArrayList<>();
final int numerOfConstraints = 5; final int numerOfConstraints = 5;
for (int i = 0; i < numerOfConstraints; i++) { for (int i = 0; i < numerOfConstraints; i++) {
Constraint constraint = createNiceMock(Constraint.class); Constraint constraint = createNiceMock(Constraint.class);
expect(constraint.applyConstraintTo(isA(Object.class))) expect(constraint.applyConstraintTo(isA(Object.class))).andReturn(2).atLeastOnce();
.andReturn(2).atLeastOnce(); expect(constraint.isSatisfiedBy(isA(Object.class))).andReturn(true).atLeastOnce();
expect(constraint.isSatisfiedBy(isA(Object.class))).andReturn(true)
.atLeastOnce();
constraints.add(constraint); constraints.add(constraint);
} }
replay(constraints.toArray()); replay(constraints.toArray());
Constraint.apply(2, constraints); Constraint.apply(2, constraints);
verify(constraints.toArray()); verify(constraints.toArray());
@ -115,8 +116,8 @@ public class ConstraintTest {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Test @Test
public void theLastConstraintHasPriority() { public void theLastConstraintHasPriority() {
Integer result = Constraint.apply(6, biggerThanFive, Integer result = Constraint.apply(6, biggerThanFive, lessThanFive);
lessThanFive);
assertThat(result, equalTo(4)); assertThat(result, equalTo(4));
} }
@ -124,21 +125,20 @@ public class ConstraintTest {
@Test @Test
public void theViolatedConstraintsNotifiesItsListeners() { public void theViolatedConstraintsNotifiesItsListeners() {
final Constraint<Integer>[] constraintViolated = new Constraint[1]; final Constraint<Integer>[] constraintViolated = new Constraint[1];
biggerThanFive
.addConstraintViolationListener(new IConstraintViolationListener<Integer>() {
@Override biggerThanFive.addConstraintViolationListener(new IConstraintViolationListener<Integer>() {
public void constraintViolated( @Override
Constraint<Integer> constraint, Integer value) { public void constraintViolated(Constraint<Integer> constraint, Integer value) {
constraintViolated[0] = constraint; constraintViolated[0] = constraint;
} }
@Override
public void constraintSatisfied(Constraint<Integer> constraint, Integer value) {
}
});
@Override
public void constraintSatisfied(
Constraint<Integer> constraint, Integer value) {
}
});
Constraint.apply(6, biggerThanFive, lessThanFive); Constraint.apply(6, biggerThanFive, lessThanFive);
assertThat(constraintViolated[0], equalTo(biggerThanFive)); assertThat(constraintViolated[0], equalTo(biggerThanFive));
} }
@ -146,31 +146,29 @@ public class ConstraintTest {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void theSatisfiedConstraintsNotifiesItsListeners() { public void theSatisfiedConstraintsNotifiesItsListeners() {
final Constraint<Integer>[] constraintSatisfied = new Constraint[1]; final Constraint<Integer>[] constraintSatisfied = new Constraint[1];
biggerThanFive
.addConstraintViolationListener(new IConstraintViolationListener<Integer>() {
@Override biggerThanFive.addConstraintViolationListener(new IConstraintViolationListener<Integer>() {
public void constraintViolated( @Override
Constraint<Integer> constraint, Integer value) { public void constraintViolated(
} Constraint<Integer> constraint, Integer value) {
}
@Override
public void constraintSatisfied(
Constraint<Integer> constraint, Integer value) {
constraintSatisfied[0] = constraint;
}
});
@Override
public void constraintSatisfied(
Constraint<Integer> constraint, Integer value) {
constraintSatisfied[0] = constraint;
}
});
Constraint.apply(6, biggerThanFive); Constraint.apply(6, biggerThanFive);
assertThat(constraintSatisfied[0], equalTo(biggerThanFive)); assertThat(constraintSatisfied[0], equalTo(biggerThanFive));
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Test @Test
public void theApplicationCanBeDoneUsingAFluentInterface() { public void theApplicationCanBeDoneUsingAFluentInterface() {
assertThat(Constraint.initialValue(3) assertThat(Constraint.initialValue(3).withConstraints(biggerThanFive).apply(), equalTo(6));
.withConstraints(biggerThanFive)
.apply(),
equalTo(6));
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View file

@ -207,6 +207,7 @@
</resource> </resource>
</resources> </resources>
<!-- TODO delete it? -->
<pluginManagement> <pluginManagement>
<plugins> <plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--> <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
@ -227,7 +228,7 @@
</goals> </goals>
</pluginExecutionFilter> </pluginExecutionFilter>
<action> <action>
<ignore></ignore> <ignore/>
</action> </action>
</pluginExecution> </pluginExecution>
</pluginExecutions> </pluginExecutions>

View file

@ -464,7 +464,7 @@
<!-- JAX-RS API --> <!-- JAX-RS API -->
<dependency> <dependency>
<groupId>javax.ws.rs</groupId> <groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId> <artifactId>javax.ws.rs-api</artifactId>
</dependency> </dependency>
<!-- CXF --> <!-- CXF -->

136
pom.xml
View file

@ -8,9 +8,7 @@
<version>1.6.0</version> <version>1.6.0</version>
<name>LibrePlan</name> <name>LibrePlan</name>
<!--
===================================================================
-->
<!-- Modules --> <!-- Modules -->
<modules> <modules>
<module>libreplan-business</module> <module>libreplan-business</module>
@ -18,9 +16,7 @@
<module>libreplan-webapp</module> <module>libreplan-webapp</module>
</modules> </modules>
<!--
===================================================================
-->
<!-- <!--
Default values for properties. These default values are expected Default values for properties. These default values are expected
to be valid for most profiles. Specific profiles can overwrite to be valid for most profiles. Specific profiles can overwrite
@ -42,34 +38,37 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<!-- <!--
=================================================================== * Profiles.
--> The build is always executed by selecting at least two non-exclusive profiles.
<!-- By default, such profiles are "dev" and "postgresql"
Profiles. * The build is always executed by selecting at least (meaning "use PostgreSQL assuming a development environment").
two non-exclusive profiles. By default, such profiles are "dev"
and "postgresql" (meaning "use PostgreSQL assuming a development * General profiles.
environment"). * General profiles. There are two general There are two general (database-independent) profiles: "dev" and "prod".
(database-independent) profiles: "dev" and "prod". The former is The former is used for development (including testing) and the latter is used for production
used for development (including testing) and the latter is used (including testing).
for production (including testing). As shown below, two As shown below, two dataSources (databases schemas) are used in both profiles:
dataSources (databases schemas) are used in both profiles: one one for running (dataSource) and another one for the Maven test case (testDataSource).
for running (dataSource) and another one for the Maven test fase Note the Maven test case is executed both with development and production profiles.
(testDataSource). Note the Maven test fase is executed both with
development and production profiles. * Database-specific * Database-specific profiles.
profiles. There is a profile for each supported database. * There is a profile for each supported database.
Specific profiles can be defined to better adapt to a particular Specific profiles can be defined to better adapt to a particular environment by
environment by overwriting/adding properties and/or including overwriting/adding properties and/or including other chunks of valid XML.
other chunks of valid XML. * Usage: + mvn <<goal>> => Execute
<<goal>> with default profiles. + mvn -Pdev,<<database>> <<goal> * Usage.
=> Execute <<goal>> with "dev" and <<database>> profiles. + mvn + mvn <<goal>> => Execute <<goal>> with default profiles.
-Pprod,<<database>> <<goal>> => Execute <<goal>> with "prod" and + mvn -Pdev,<<database>> <<goal> => Execute <<goal>> with "dev" and <<database>> profiles.
<<database>> profiles. + Note that when using -P option all + mvn -Pprod,<<database>> <<goal>> => Execute <<goal>> with "prod" and <<database>> profiles.
desired profiles must be specified (e.g. "-Pprod" with the + Note that when using -P option all desired profiles must be specified
intention to select "prod" and the default database profile is (e.g. "-Pprod" with the intention to select "prod" and the default database profile is not correct;
not correct; "-Pprod,<<database>>" must be used instead). * "-Pprod,<<database>>" must be used instead).
Examples: + mvn <<goal>> + mvn -Ppostgresql,prod <<goal>> + mvn
-Ppostgresql,dev <<goal>> * Examples.
+ mvn <<goal>> + mvn -Ppostgresql,prod <<goal>>
+ mvn -Ppostgresql,dev <<goal>>
--> -->
<profiles> <profiles>
@ -88,8 +87,8 @@
<hibernate.use_sql_comments>false</hibernate.use_sql_comments> <hibernate.use_sql_comments>false</hibernate.use_sql_comments>
<hibernate.hbm2ddl.auto>validate</hibernate.hbm2ddl.auto> <hibernate.hbm2ddl.auto>validate</hibernate.hbm2ddl.auto>
<!-- Enable example users (wsreader, wswriter, wssubcontracting, <!-- Enable example users
manager, hresources, outsourcing and reports) --> (wsreader, wswriter, wssubcontracting, manager, hresources, outsourcing and reports) -->
<default.exampleUsersDisabled>false</default.exampleUsersDisabled> <default.exampleUsersDisabled>false</default.exampleUsersDisabled>
</properties> </properties>
</profile> </profile>
@ -124,7 +123,7 @@
<dataSource.url>jdbc:postgresql://localhost/libreplan${libreplan.mode}</dataSource.url> <dataSource.url>jdbc:postgresql://localhost/libreplan${libreplan.mode}</dataSource.url>
<testDataSource.url>${dataSource.url}test</testDataSource.url> <testDataSource.url>${dataSource.url}test</testDataSource.url>
<!-- Hibernate properties --> <!-- Hibernate properties -->
<hibernate.dialect>org.hibernate.dialect.PostgreSQLDialect</hibernate.dialect> <hibernate.dialect>org.hibernate.dialect.PostgreSQL9Dialect</hibernate.dialect>
<databasetable.prefix>public.</databasetable.prefix> <databasetable.prefix>public.</databasetable.prefix>
</properties> </properties>
</profile> </profile>
@ -145,15 +144,12 @@
<testDataSource.url>${dataSource.url}test</testDataSource.url> <testDataSource.url>${dataSource.url}test</testDataSource.url>
<!-- Hibernate properties --> <!-- Hibernate properties -->
<hibernate.dialect>org.hibernate.dialect.MySQL5InnoDBDialect</hibernate.dialect> <hibernate.dialect>org.hibernate.dialect.MySQL5InnoDBDialect</hibernate.dialect>
<databasetable.prefix></databasetable.prefix> <databasetable.prefix/>
</properties> </properties>
</profile> </profile>
</profiles> </profiles>
<!--
===================================================================
-->
<repositories> <repositories>
<!-- Getttext commons --> <!-- Getttext commons -->
@ -170,18 +166,11 @@
</repositories> </repositories>
<pluginRepositories> <pluginRepositories>
<!-- Gettext commons plugin -->
<pluginRepository> <pluginRepository>
<id>gettext-commons-site</id> <id>gettext-commons-site</id>
<url>http://gettext-commons.googlecode.com/svn/maven-repository</url> <url>http://gettext-commons.googlecode.com/svn/maven-repository</url>
</pluginRepository> </pluginRepository>
<!--
<pluginRepository>
<id>codehaus-plugin-repository</id>
<name>Codehaus Plugin Repository</name>
<url>http://repository.codehaus.org</url>
</pluginRepository>
-->
</pluginRepositories> </pluginRepositories>
<!-- Dependency management --> <!-- Dependency management -->
@ -302,8 +291,7 @@
</dependency> </dependency>
<!-- <!--
Various Application Context utilities, including EhCache, JavaMail, Quartz, and Various Application Context utilities, including EhCache, JavaMail, Quartz, and Freemarker integration.
Freemarker integration
We use QuartzJobBean. We use QuartzJobBean.
--> -->
@ -523,8 +511,8 @@
<!-- JAX-RS API --> <!-- JAX-RS API -->
<dependency> <dependency>
<groupId>javax.ws.rs</groupId> <groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId> <artifactId>javax.ws.rs-api</artifactId>
<version>1.0</version> <version>2.0.1</version>
</dependency> </dependency>
<!-- CXF --> <!-- CXF -->
@ -590,7 +578,7 @@
</exclusions> </exclusions>
</dependency> </dependency>
<!-- jackson provider --> <!-- Jackson provider -->
<dependency> <dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId> <groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId> <artifactId>jackson-jaxrs-json-provider</artifactId>
@ -669,19 +657,16 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<build> <build>
<!-- =============================================================== -->
<!-- Filtering --> <!-- Filtering -->
<resources> <resources>
<!-- <!-- Apply filtering to files matching the following expressions in src/main/resources. -->
Apply filtering to files matching the following
expressions in src/main/resources.
-->
<resource> <resource>
<directory>src/main/resources</directory> <directory>src/main/resources</directory>
<filtering>true</filtering> <filtering>true</filtering>
@ -691,10 +676,7 @@
</includes> </includes>
</resource> </resource>
<!-- <!-- Continue considering resources the files in src/main/resources, but without applying filtering. -->
Continue considering resources the files in
src/main/resources, but without applying filtering.
-->
<resource> <resource>
<directory>src/main/resources</directory> <directory>src/main/resources</directory>
</resource> </resource>
@ -742,10 +724,7 @@
<testResources> <testResources>
<!-- <!-- Apply filtering to files matching the following expressions in src/test/resources. -->
Apply filtering to files matching the following
expressions in src/test/resources.
-->
<testResource> <testResource>
<directory>src/test/resources</directory> <directory>src/test/resources</directory>
<filtering>true</filtering> <filtering>true</filtering>
@ -756,10 +735,7 @@
</includes> </includes>
</testResource> </testResource>
<!-- <!-- Continue considering resources the files in src/test/resources, but without applying filtering. -->
Continue considering resources the files in
src/test/resources, but without applying filtering.
-->
<testResource> <testResource>
<directory>src/test/resources</directory> <directory>src/test/resources</directory>
</testResource> </testResource>
@ -768,7 +744,6 @@
<plugins> <plugins>
<!-- =========================================================== -->
<!-- Gettext configuration --> <!-- Gettext configuration -->
<plugin> <plugin>
<groupId>com.googlecode.gettext-commons</groupId> <groupId>com.googlecode.gettext-commons</groupId>
@ -779,7 +754,6 @@
</configuration> </configuration>
</plugin> </plugin>
<!-- =========================================================== -->
<!-- Compiler configuration --> <!-- Compiler configuration -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -793,7 +767,7 @@
</configuration> </configuration>
</plugin> </plugin>
<!-- =========================================================== -->
<!-- Assembly configuration --> <!-- Assembly configuration -->
<plugin> <plugin>
<artifactId>maven-assembly-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
@ -846,19 +820,12 @@
<!-- Log to the console. --> <!-- Log to the console. -->
<requestLog implementation="org.mortbay.jetty.NCSARequestLog"> <requestLog implementation="org.mortbay.jetty.NCSARequestLog">
<!-- <!--
This do anything for Jetty, but is a This do anything for Jetty,
workaround for a Maven bug that prevents the but is aworkaround for a Maven bug
requestLog from being set. that prevents the requestLog from being set.
--> -->
<append>true</append> <append>true</append>
</requestLog> </requestLog>
<!--
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>9090</port>
</connector>
</connectors>
-->
</configuration> </configuration>
<dependencies> <dependencies>
@ -894,7 +861,6 @@
</dependencies> </dependencies>
</plugin> </plugin>
<!-- =========================================================== -->
<!-- Tomcat configuration --> <!-- Tomcat configuration -->
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
@ -906,7 +872,6 @@
</configuration> </configuration>
</plugin> </plugin>
<!-- =========================================================== -->
<!-- Cobertura configuration --> <!-- Cobertura configuration -->
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
@ -922,7 +887,6 @@
</configuration> </configuration>
</plugin> </plugin>
<!-- =========================================================== -->
<!-- LiquiBase plugin --> <!-- LiquiBase plugin -->
<plugin> <plugin>
<groupId>org.liquibase</groupId> <groupId>org.liquibase</groupId>