Update JAX-RS-API.

Update PostgreSQL dialect.
Pom files refactoring.
Code refactoring.
This commit is contained in:
Vova Perebykivskyi 2016-05-10 15:44:54 +03:00 committed by Dgray16
parent e80ef60667
commit 9edba323c2
7 changed files with 100 additions and 135 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -207,6 +207,7 @@
</resource>
</resources>
<!-- TODO delete it? -->
<pluginManagement>
<plugins>
<!--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>
</pluginExecutionFilter>
<action>
<ignore></ignore>
<ignore/>
</action>
</pluginExecution>
</pluginExecutions>

View file

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

136
pom.xml
View file

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