Commit 969ea6d7 authored by Administrator's avatar Administrator

Upgrades dependency versions

parent 0fbda179
...@@ -4,12 +4,10 @@ This repository contains the code base of a sample project that will be used in ...@@ -4,12 +4,10 @@ This repository contains the code base of a sample project that will be used in
the XCS subject inside the DGSS itinerary. the XCS subject inside the DGSS itinerary.
## 1. Deployment Environment ## 1. Deployment Environment
The environment is based on Java 8, Maven 3.3+, Git 1.9+, MySQL 8+, The environment is based on Java 8, Maven 3.3+, Git 1.9+, MySQL 8+, WildFly 10.1.0 and Eclipse IDE for Enterprise Java and Web Developers.
WildFly 10.1.0 and Eclipse for JavaEE.
### 1.1. Java JDK 8 ### 1.1. Java JDK 8
Download and install Java JDK 8, preferably the Oracle version (the commands Download and install Java JDK 8 (the commands `java` and `javac` must be available).
`java` and `javac` must be available).
You can test your Java installation with the commands: You can test your Java installation with the commands:
...@@ -19,9 +17,7 @@ javac -version ...@@ -19,9 +17,7 @@ javac -version
``` ```
### 1.2. Maven 3.3+ ### 1.2. Maven 3.3+
Install Maven 3 in your system, if it was not installed (the `mvn` command must Install Maven 3 in your system, if it was not installed (the `mvn` command must be available). If you are in a Debian-based OS, install the `maven` package (**don't install `maven2` package!!**):
be available). If you are in a Debian-based OS, install the `maven` package
(**don't install `maven2` package!!**):
``` ```
sudo apt-get install maven sudo apt-get install maven
...@@ -34,10 +30,7 @@ mvn --version ...@@ -34,10 +30,7 @@ mvn --version
``` ```
### 1.3. Git 1.9+ ### 1.3. Git 1.9+
Firstly, install Git in your system if it was not installed (the `git` command Firstly, install Git in your system if it was not installed (the `git` command must be available). We will work with Git to get updates of these sample. Concretely, we will work with a Git repository inside [our Gitlab server](https://www.sing-group.org/dt/gitlab).
must be available). We will work with Git to get updates of these sample.
Concretely, we will work with a Git repository inside
[our Gitlab server](https://www.sing-group.org/dt/gitlab).
You can tests your Git installation with the command: You can tests your Git installation with the command:
...@@ -52,17 +45,13 @@ git clone http://sing-group.org/dt/gitlab/dgss-2324/xcs-sample.git ...@@ -52,17 +45,13 @@ git clone http://sing-group.org/dt/gitlab/dgss-2324/xcs-sample.git
``` ```
### 1.4. MySQL 8+ ### 1.4. MySQL 8+
In order to run the tests with the `wildfly-embedded-mysql` profile (more about In order to run the tests with the `wildfly-embedded-mysql` profile (more about this in the **Sample 2** section) and to run the application, we need a MySQL server.
this in the **Sample 2** section) and to run the application, we need a MySQL
server.
The server can be installed as usual, but it must contain two databases: The server can be installed as usual, but it must contain two databases:
* The `xcs` database for running the application. * The `xcs` database for running the application.
* The `xcssampletest` database for testing the appliaction. * The `xcssampletest` database for testing the appliaction.
In both cases, the user `xcs` identified by `xcs` password should have all In both cases, the user `xcs` identified by `xcs` password should have all privileges on this database. You can do this by executing the following commands:
privileges on this database. You can do this by executing the following
commands:
```sql ```sql
CREATE DATABASE xcs; CREATE DATABASE xcs;
...@@ -75,9 +64,7 @@ GRANT ALL PRIVILEGES ON xcssampletest.* TO xcs@'%'; ...@@ -75,9 +64,7 @@ GRANT ALL PRIVILEGES ON xcssampletest.* TO xcs@'%';
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
``` ```
If you want to add some data to the `xcs` database to run the application (data If you want to add some data to the `xcs` database to run the application (data will be automatically inserted to the `xcssampletest` database during the tests) you can also execute:
will be automatically inserted to the `xcssampletest` database during the
tests) you can also execute:
```sql ```sql
DROP TABLE IF EXISTS `User`; DROP TABLE IF EXISTS `User`;
...@@ -117,49 +104,28 @@ VALUES ('CAT','2000-01-01 01:01:01','Pepecat','pepe'), ...@@ -117,49 +104,28 @@ VALUES ('CAT','2000-01-01 01:01:01','Pepecat','pepe'),
('BIRD','2000-01-01 01:01:01','Anabird','ana'); ('BIRD','2000-01-01 01:01:01','Anabird','ana');
``` ```
You can find the `xcs-sample-mysql.sql` and `xcs-sample-test-mysql.sql` scripts You can find the `xcs-sample-mysql.sql` and `xcs-sample-test-mysql.sql` scripts with these queries stored in the `additional-material/db` project folder.
with these queries stored in the `additional-material/db` project folder.
### 1.5. Eclipse for Java EE ### 1.5. Eclipse for Java EE
Open Eclipse for Java EE and import your Maven project with Open Eclipse for Java EE and import your Maven project with `File -> Import -> Maven -> Existing Maven Projects`. In the dialog opened you have to select as `Root directory` the directory of the project that you have just cloned (it should contain a `pom.xml` file).
`File -> Import -> Maven -> Existing Maven Projects`. In the dialog opened you
have to select as `Root directory` the directory of the project that you have Eclipse should then import a parent project (`xcs-sample`) and 6 child projects (`tests`, `domain`, `service`, `rest`, `jsf` and `ear`). If any project is disabled for import it is probably because you already have another project in your workspace with the same name. To avoid this problem you can open the advanced settings of the dialog and use a custom `Name template` (for example, `xcs-sample-[artifactId]`).
just cloned (it should contain a `pom.xml` file).
If you want, you can use any other IDE, such as IntelliJ IDEA or NetBeans, as long as they are compatible with Maven projects, but we recommend using Eclipse for Java EE.
Eclipse should then import a parent project (`xcs-sample`) and 6 child projects
(`tests`, `domain`, `service`, `rest`, `jsf` and `ear`). If any project is
disabled for import it is probably because you already have another project in
your workspace with the same name. To avoid this problem you can open the
advanced settings of the dialog and use a custom `Name template` (for example,
`xcs-sample-[artifactId]`).
If you want, you can use any other IDE, such as IntelliJ IDEA or NetBeans, as
long as they are compatible with Maven projects, but we recommend using Eclipse
for Java EE.
### 1.6 WildFly 10.1.0 ### 1.6 WildFly 10.1.0
If you want to run the project you need a Java EE server. In this section you If you want to run the project you need a Java EE server. In this section you can find how to configure a local WildFly server to execute the project. Basically, we need to configure the WildFly server to include the datasource and the security configuration needed by the application.
can find how to configure a local WildFly server to execute the project.
Basically, we need to configure the WildFly server to include the datasource and In the following sections you can find an explanation of how you can configure the WildFly server by editing the `standalone.xml`. However, the `additional-material/wildfly` directory of the project already includes a `standalone.xml` ready to be used with the 10.1.0 version, that you can just copy directly into your WildFly server (replacing the original
the security configuration needed by the application.
In the following sections you can find an explanation of how you can configure
the WildFly server by editing the `standalone.xml`. However, the
`additional-material/wildfly` directory of the project already includes a
`standalone.xml` ready to be used with the 10.1.0 version, that you can
just copy directly into your WildFly server (replacing the original
`standalone/configuration/standalone.xml` file). `standalone/configuration/standalone.xml` file).
#### 1.6.1. Datasource configuration #### 1.6.1. Datasource configuration
There are several ways to add a datasource to a WildFly server. We are going to There are several ways to add a datasource to a WildFly server. We are going to add it by editing the `standalone/configuration/standalone.xml` configuration file of the server. To do so, you have to edit this file and add the following content to the `<datasources>` element:
add it by editing the `standalone/configuration/standalone.xml` configuration
file of the server. To do so, you have to edit this file and add the following
content to the `<datasources>` element:
```xml ```xml
<datasource jta="true" jndi-name="java:jboss/datasources/xcs" pool-name="xcs-mysql" enabled="true" use-ccm="true"> <datasource jta="true" jndi-name="java:jboss/datasources/xcs" pool-name="xcs-mysql" enabled="true" use-ccm="true">
<connection-url>jdbc:mysql://localhost:3306/xcs?useJDBCCompliantTimezoneShift=true&amp;useLegacyDatetimeCode=false&amp;serverTimezone=Europe%2FMadrid</connection-url> <connection-url>jdbc:mysql://localhost:3306/xcs?useJDBCCompliantTimezoneShift=true&amp;useLegacyDatetimeCode=false&amp;serverTimezone=Europe%2FMadrid</connection-url>
<driver>mysql-connector-java-8.0.21.jar</driver> <driver>mysql-connector-java-8.1.0.jar</driver>
<security> <security>
<user-name>xcs</user-name> <user-name>xcs</user-name>
<password>xcs</password> <password>xcs</password>
...@@ -167,14 +133,11 @@ content to the `<datasources>` element: ...@@ -167,14 +133,11 @@ content to the `<datasources>` element:
</datasource> </datasource>
``` ```
In addition, you also have to add the MySQL driver to the deployments folder In addition, you also have to add the MySQL driver to the deployments folder (`standalone/deployments`). You can download it form [here] (https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/8.1.0/mysql-connector-j-8.1.0.jar) to the deployments (`standalone/deployments`) directory and WildFly will
(`standalone/deployments`). You can download it form [here](http://central.maven.org/maven2/mysql/mysql-connector-java/8.0.21/mysql-connector-java-8.0.21.jar)
to the deployments (`standalone/deployments`) directory and WildFly will
automatically deploy it on startup. automatically deploy it on startup.
#### 1.6.2. Security configuration #### 1.6.2. Security configuration
All the WildFly security configuration is done in the All the WildFly security configuration is done in the `standalone/configuration/standalone.xml` file of the server.
`standalone/configuration/standalone.xml` file of the server.
Inside the `<security-reamls>` element you have to add a new security realm: Inside the `<security-reamls>` element you have to add a new security realm:
...@@ -186,8 +149,7 @@ Inside the `<security-reamls>` element you have to add a new security realm: ...@@ -186,8 +149,7 @@ Inside the `<security-reamls>` element you have to add a new security realm:
</security-realm> </security-realm>
``` ```
Then, inside the `<security-domains>` element you have to add the following Then, inside the `<security-domains>` element you have to add the following security domains:
security domains:
```xml ```xml
<security-domain name="AppRealmLoopThrough" cache-type="default"> <security-domain name="AppRealmLoopThrough" cache-type="default">
...@@ -212,48 +174,30 @@ security domains: ...@@ -212,48 +174,30 @@ security domains:
``` ```
#### 1.6.3. Deploying the application manually #### 1.6.3. Deploying the application manually
When the `package` goal is run in the `xcs-sample` project, an EAR file is When the `package` goal is run in the `xcs-sample` project, an EAR file is generated inside the `target` folder of the `ear` project.
generated inside the `target` folder of the `ear` project.
The EAR file contains all the elements of the project (JARs and WARs) and, The EAR file contains all the elements of the project (JARs and WARs) and, therefore, you only have to deploy this file in the WildFly container to deploy the entire application. To do so, you can copy this file to the `standalone/deployments` folder of WidlFly.
therefore, you only have to deploy this file in the WildFly container to deploy
the entire application. To do so, you can copy this file to the
`standalone/deployments` folder of WidlFly.
Once this is done, you can run the WildFly server executing the Once this is done, you can run the WildFly server executing the `bin/standalone.sh` script. The application should be running in http://localhost:8080/xcs-sample. If you want to access through the web interface, you can open the http://localhost:8080/xcs-sample/jsf URL.
`bin/standalone.sh` script. The application should be running in
http://localhost:8080/xcs-sample. If you want to access through the web
interface, you can open the http://localhost:8080/xcs-sample/jsf URL.
#### 1.6.4 Deploying the application from Maven #### 1.6.4 Deploying the application from Maven
Maven configuration is prepared to deploy the generated EAR file to a running Maven configuration is prepared to deploy the generated EAR file to a running WildFly. Doing so is as easy as launching the `wildfly:deploy` goal:
WildFly. Doing so is as easy as launching the `wildfly:deploy` goal:
```bash ```bash
mvn wildfly:deploy mvn wildfly:deploy
``` ```
This will launch the construction of the project and, at the end, the EAR will This will launch the construction of the project and, at the end, the EAR will be deployed. Remember that, if you want a fast deployment, you can avoid the test execution with the parameter `-DskipTests=true`.
be deployed. Remember that, if you want a fast deployment, you can avoid the
test execution with the parameter `-DskipTests=true`.
#### 1.7. Running the application from Maven (Recommended) #### 1.7. Running the application from Maven (Recommended)
This project includes the Maven WildFly plugin, which allows the execution of This project includes the Maven WildFly plugin, which allows the execution of the application without needing an external WildFly server. To run the application with the running MySQL database (`xcs`) you just have execute the following command:
the application without needing an external WildFly server. To run the
application with the running MySQL database (`xcs`) you just have execute the
following command:
```bash ```bash
mvn install -P wildfly-mysql-run,-wildfly-embedded-h2 mvn install -P wildfly-mysql-run,-wildfly-embedded-h2
``` ```
This will launch the complete construction cycle without running the tests, This will launch the complete construction cycle without running the tests, start a WildFly server and deploy the application. Once the application is running you can access it in the URL http://localhost:8080/xcs-sample/jsf.
start a WildFly server and deploy the application. Once the application is
running you can access it in the URL http://localhost:8080/xcs-sample/jsf.
**Important**: You shouldn't have a local WildFly instance running or Maven will **Important**: You shouldn't have a local WildFly instance running or Maven will not be able to start its own WildFly and will try to deploy the application in the running instance. This will cause changes to the WildFly configuration that may leave it in an unstable state.
not be able to start its own WildFly and will try to deploy the application in
the running instance. This will cause changes to the WildFly configuration that
may leave it in an unstable state.
To stop the WildFly launched you can execute the following command: To stop the WildFly launched you can execute the following command:
...@@ -263,62 +207,38 @@ mvn wildfly:shutdown ...@@ -263,62 +207,38 @@ mvn wildfly:shutdown
## 2. Samples ## 2. Samples
## 2.1. Sample 1: Testing entities ## 2.1. Sample 1: Testing entities
Using JUnit and Hamcrest, we will see how to test JPA entities or any other Using JUnit and Hamcrest, we will see how to test JPA entities or any other Java class. This libraries are the base for every test done in the application.
Java class. This libraries are the base for every test done in the application.
## 2.2. Sample 2: Testing EJBs ## 2.2. Sample 2: Testing EJBs
Using Arquillian and Arquillian Persistence, the EJBs are tested. We wouldn't do Using Arquillian and Arquillian Persistence, the EJBs are tested. We wouldn't do unit testing in this layer, as we don't want to mock the `EntityManager`.
unit testing in this layer, as we don't want to mock the `EntityManager`.
In this layer we will use some workarounds to set the desired role and principal In this layer we will use some workarounds to set the desired role and principal in the tests.
in the tests.
### 2.2.1. How to run tests with Arquillian? ### 2.2.1. How to run tests with Arquillian?
This project is configured to use two Maven profiles: This project is configured to use two Maven profiles:
* `wildfly-embedded-h2`: this profile uses WildFly in embedded mode with a H2 * `wildfly-embedded-h2`: this profile uses WildFly in embedded mode with a H2 database, whose driver is included by default in WilFly.
database, whose driver is included by default in WilFly.
* `wildfly-embedded-mysql`: same as before, but it uses a MySQL database. * `wildfly-embedded-mysql`: same as before, but it uses a MySQL database.
In both profiles, the WildFly server is automatically downloaded using the In both profiles, the WildFly server is automatically downloaded using the `maven-dependency-plugin`, that extracts it in the `target/wildfly-<version>` folder (`target/wildfly-10.1.0.Final` currently). In the MySQL profile, the MySQL driver is also downloaded using this plugin and added to the `target/wildfly-<version>/standalone/deployments` folder, to make it available in the WildFly server.
`maven-dependency-plugin`, that extracts it in the `target/wildfly-<version>`
folder (`target/wildfly-10.1.0.Final` currently). In the MySQL profile, the
MySQL driver is also downloaded using this plugin and added to the
`target/wildfly-<version>/standalone/deployments` folder, to make it available
in the WildFly server.
For each profile, Maven is configured to use the files stored in For each profile, Maven is configured to use the files stored in `src/test/resources-<profile name>` as resources when running tests, in addition to the stored in the `src/test/resources` folder, as usual. Inside this folder, the projects using Arquillian must include a `standalone.xml` file, that will be replace the default `standalone.xml` file of the WildFly server. This is specially useful to configure the security constraints and datasources.
`src/test/resources-<profile name>` as resources when running tests, in addition
to the stored in the `src/test/resources` folder, as usual. Inside this folder,
the projects using Arquillian must include a `standalone.xml` file, that will be
replace the default `standalone.xml` file of the WildFly server. This is
specially useful to configure the security constraints and datasources.
In order to avoid port collising with other WildFly instances, the WildFly used In order to avoid port collising with other WildFly instances, the WildFly used by the test have a port offset of 10000. This means that the HTTP port is displaced from the default 8080 port to the 18080 port, and the management port is displaced from the default 9990 port to the 19990 port.
by the test have a port offset of 10000. This means that the HTTP port is
displaced from the default 8080 port to the 18080 port, and the management port
is displaced from the default 9990 port to the 19990 port.
Therefore, when running Maven tests (e.g. `mvn test`), they will run without any Therefore, when running Maven tests (e.g. `mvn test`), they will run without any external requirement.
external requirement.
#### 2.2.1.1 Arquillian tests in Eclipse #### 2.2.1.1 Arquillian tests in Eclipse
To run Arquillian tests in Eclipse (or in any non-Maven enviroment) a further To run Arquillian tests in Eclipse (or in any non-Maven enviroment) a further step is needed. You must configure the following system properties:
step is needed. You must configure the following system properties:
* `arquillian.launch`: the launch configuration that arquillian should use. * `arquillian.launch`: the launch configuration that arquillian should use.
* `wildfly.version`: the version of the WildFly server stored in `target`. * `wildfly.version`: the version of the WildFly server stored in `target`. The current version is `10.1.0.Final`.
The current version is `10.1.0.Final`.
* `wildfly.jbossHome`: the location of the WildFly server. * `wildfly.jbossHome`: the location of the WildFly server.
* `wildfly.modulePath`: the location of the module of the WildFly server. * `wildfly.modulePath`: the location of the module of the WildFly server.
* `java.util.logging.manager`: the logger to be used by the standard Java * `java.util.logging.manager`: the logger to be used by the standard Java logger. Commonly, the value `org.jboss.logmanager.LogManager` is used.
logger. Commonly, the value `org.jboss.logmanager.LogManager` is used. * `jboss.socket.binding.port-offset`: this is an optional parameter that can be used to move the WildFly default ports.
* `jboss.socket.binding.port-offset`: this is an optional parameter that
can be used to move the WildFly default ports.
* `wildfly.http.port`: HTTP of the WildFly server. * `wildfly.http.port`: HTTP of the WildFly server.
* `wildfly.management.port`: management port of the WildFly server. * `wildfly.management.port`: management port of the WildFly server.
In Eclipse, this system properties can be added to the run configuration in the In Eclipse, this system properties can be added to the run configuration in the `VM arguments` field of the `Arguments` tab. For example, the following configuration will work for the current configuration:
`VM arguments` field of the `Arguments` tab. For example, the following
configuration will work for the current configuration:
``` ```
-Darquillian.launch=wildfly-embedded -Darquillian.launch=wildfly-embedded
...@@ -331,17 +251,14 @@ configuration will work for the current configuration: ...@@ -331,17 +251,14 @@ configuration will work for the current configuration:
-Dwildfly.management.port=19990 -Dwildfly.management.port=19990
``` ```
This configuration will run with the **H2** database. If you wish to run the This configuration will run with the **H2** database. If you wish to run the tests with the **MySQL** database, you have to add to additional system configuration:
tests with the **MySQL** database, you have to add to additional system * `mysql.version`: The version of the MySQL driver (currently, `8.1.0`)
configuration:
* `mysql.version`: The version of the MySQL driver (currently, `8.0.21`).
Therefore, the `VM arguments` configuration for running the tests in Eclipse Therefore, the `VM arguments` configuration for running the tests in Eclipse using the MySQL database is:
using the MySQL database is:
``` ```
-Darquillian.launch=wildfly-embedded -Darquillian.launch=wildfly-embedded
-Dmysql.version=8.0.21 -Dmysql.version=8.1.0
-Dwildfly.version=10.1.0.Final -Dwildfly.version=10.1.0.Final
-Dwildfly.jbossHome=target/wildfly-10.1.0.Final -Dwildfly.jbossHome=target/wildfly-10.1.0.Final
-Dwildfly.modulePath=target/wildfly-10.1.0.Final/modules -Dwildfly.modulePath=target/wildfly-10.1.0.Final/modules
...@@ -352,12 +269,10 @@ using the MySQL database is: ...@@ -352,12 +269,10 @@ using the MySQL database is:
``` ```
## 2.3. Sample 3: Testing with test doubles ## 2.3. Sample 3: Testing with test doubles
Using EasyMock, we will mock the EJBs to test the REST classes isolated from the Using EasyMock, we will mock the EJBs to test the REST classes isolated from the underlying layer.
underlying layer.
## 2.4. Sample 4: Testing JAX-RS ## 2.4. Sample 4: Testing JAX-RS
Using Arquillian REST Client, we will test the REST API accessing it as real Using Arquillian REST Client, we will test the REST API accessing it as real HTTP clients.
HTTP clients.
Tests can be run using the same configuration as explained in *Sample 2*. Tests can be run using the same configuration as explained in *Sample 2*.
...@@ -366,20 +281,17 @@ When executed, the REST resources can be found in: ...@@ -366,20 +281,17 @@ When executed, the REST resources can be found in:
* Pets: http://localhost:8080/xcs-sample/rest/api/pet * Pets: http://localhost:8080/xcs-sample/rest/api/pet
## 2.5. Sample 5: Testing JSF ## 2.5. Sample 5: Testing JSF
Using Arquillian Drone, Arquillian Graphene and Selenium, we will test the JSF Using Arquillian Drone, Arquillian Graphene and Selenium, we will test the JSF web interface accessing it as real Web clients.
web interface accessing it as real Web clients.
Tests can be run using the same configuration as explained in *Sample 2*. Tests can be run using the same configuration as explained in *Sample 2*.
When executed, the REST resources can be found in When executed, the REST resources can be found in http://localhost:8080/xcs-sample/jsf/faces/index.html.
http://localhost:8080/xcs-sample/jsf/faces/index.html.
<span style="color:red">Warning: </span>JSF test have been disabled due to a [known connection issue](https://firefox-source-docs.mozilla.org/testing/geckodriver/Usage.html#Running-Firefox-in-an-container-based-package) between the Firefox driver and the Firefox installed by default in Ubuntu
22.04.
## 2.6. Sample 6: Additional Testing Tools ## 2.6. Sample 6: Additional Testing Tools
### Test coverage with JaCoCo ### Test coverage with JaCoCo
Test coverage is a very useful tool that shows the parts of the source code that Test coverage is a very useful tool that shows the parts of the source code that are covered by the tests. The coverage analysis is done during the tests execution, making it very precise.
are covered by the tests. The coverage analysis is done during the tests
execution, making it very precise.
The JaCoCo plugin is now part or the project, analyzing the test execution. This The JaCoCo plugin is now part or the project, analyzing the test execution. This plugin generates a HTML report in the `target/site/jacoco` folder. This report is very useful to check if some part of the code is missing some tests.
plugin generates a HTML report in the `target/site/jacoco` folder. This report
is very useful to check if some part of the code is missing some tests.
...@@ -32,11 +32,11 @@ ...@@ -32,11 +32,11 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hamcrest</groupId> <groupId>org.hamcrest</groupId>
<artifactId>java-hamcrest</artifactId> <artifactId>hamcrest</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
......
...@@ -8,7 +8,7 @@ import static org.hamcrest.CoreMatchers.nullValue; ...@@ -8,7 +8,7 @@ import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.collection.IsEmptyIterable.emptyIterable; import static org.hamcrest.collection.IsEmptyIterable.emptyIterable;
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder; import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
import static org.hamcrest.collection.IsIterableContainingInOrder.contains; import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Date; import java.util.Date;
......
...@@ -4,7 +4,7 @@ import static org.apache.commons.lang3.StringUtils.repeat; ...@@ -4,7 +4,7 @@ import static org.apache.commons.lang3.StringUtils.repeat;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Date; import java.util.Date;
......
...@@ -3,7 +3,7 @@ package es.uvigo.esei.xcs.domain.entities; ...@@ -3,7 +3,7 @@ package es.uvigo.esei.xcs.domain.entities;
import static org.apache.commons.lang3.StringUtils.repeat; import static org.apache.commons.lang3.StringUtils.repeat;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hamcrest</groupId> <groupId>org.hamcrest</groupId>
<artifactId>java-hamcrest</artifactId> <artifactId>hamcrest</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
...@@ -66,6 +66,11 @@ ...@@ -66,6 +66,11 @@
<type>pom</type> <type>pom</type>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
...@@ -100,12 +105,12 @@ ...@@ -100,12 +105,12 @@
<id>download-geckodriver</id> <id>download-geckodriver</id>
<phase>process-test-resources</phase> <phase>process-test-resources</phase>
<configuration> <configuration>
<tasks> <target>
<mkdir dir="${geckodriver.basepath}"/> <mkdir dir="${geckodriver.basepath}"/>
<get src="${geckodriver.url}" dest="${geckodriver.compressed.path}" skipexisting="true"/> <get src="${geckodriver.url}" dest="${geckodriver.compressed.path}" skipexisting="true"/>
<untar src="${geckodriver.compressed.path}" dest="${geckodriver.basepath}" compression="gzip"/> <untar src="${geckodriver.compressed.path}" dest="${geckodriver.basepath}" compression="gzip"/>
<chmod file="${geckodriver.uncompressed.path}" perm="a+x"/> <chmod file="${geckodriver.uncompressed.path}" perm="a+x"/>
</tasks> </target>
</configuration> </configuration>
<goals> <goals>
<goal>run</goal> <goal>run</goal>
...@@ -140,12 +145,12 @@ ...@@ -140,12 +145,12 @@
<id>download-geckodriver</id> <id>download-geckodriver</id>
<phase>process-test-resources</phase> <phase>process-test-resources</phase>
<configuration> <configuration>
<tasks> <target>
<mkdir dir="${geckodriver.basepath}"/> <mkdir dir="${geckodriver.basepath}"/>
<get src="${geckodriver.url}" dest="${geckodriver.compressed.path}" skipexisting="true"/> <get src="${geckodriver.url}" dest="${geckodriver.compressed.path}" skipexisting="true"/>
<unzip src="${geckodriver.compressed.path}" dest="${geckodriver.basepath}"/> <unzip src="${geckodriver.compressed.path}" dest="${geckodriver.basepath}"/>
<chmod file="${geckodriver.uncompressed.path}" perm="a+x"/> <chmod file="${geckodriver.uncompressed.path}" perm="a+x"/>
</tasks> </target>
</configuration> </configuration>
<goals> <goals>
<goal>run</goal> <goal>run</goal>
...@@ -248,12 +253,12 @@ ...@@ -248,12 +253,12 @@
<id>download-geckodriver</id> <id>download-geckodriver</id>
<phase>process-test-resources</phase> <phase>process-test-resources</phase>
<configuration> <configuration>
<tasks> <target>
<mkdir dir="${geckodriver.basepath}"/> <mkdir dir="${geckodriver.basepath}"/>
<get src="${geckodriver.url}" dest="${geckodriver.compressed.path}" skipexisting="true"/> <get src="${geckodriver.url}" dest="${geckodriver.compressed.path}" skipexisting="true"/>
<untar src="${geckodriver.compressed.path}" dest="${geckodriver.basepath}" compression="gzip"/> <untar src="${geckodriver.compressed.path}" dest="${geckodriver.basepath}" compression="gzip"/>
<chmod file="${geckodriver.uncompressed.path}" perm="a+x"/> <chmod file="${geckodriver.uncompressed.path}" perm="a+x"/>
</tasks> </target>
</configuration> </configuration>
<goals> <goals>
<goal>run</goal> <goal>run</goal>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<h:head> <h:head>
<title>Pet Store</title> <title>Pet Store</title>
<h:outputStylesheet name="webjars/bootstrap/3.3.7-1/css/bootstrap.min.css" /> <h:outputStylesheet name="webjars/bootstrap/3.4.1/css/bootstrap.min.css" />
</h:head> </h:head>
<h:body> <h:body>
<div class="container"> <div class="container">
...@@ -42,6 +42,6 @@ ...@@ -42,6 +42,6 @@
</div> </div>
<h:outputScript name="webjars/jquery/1.11.1/jquery.min.js" /> <h:outputScript name="webjars/jquery/1.11.1/jquery.min.js" />
<h:outputScript name="webjars/bootstrap/3.3.7-1/js/bootstrap.min.js" /> <h:outputScript name="webjars/bootstrap/3.4.1/js/bootstrap.min.js" />
</h:body> </h:body>
</html> </html>
\ No newline at end of file
...@@ -11,7 +11,7 @@ import static es.uvigo.esei.xcs.domain.entities.OwnersDataset.owners; ...@@ -11,7 +11,7 @@ import static es.uvigo.esei.xcs.domain.entities.OwnersDataset.owners;
import static es.uvigo.esei.xcs.domain.entities.OwnersDataset.ownersAnd; import static es.uvigo.esei.xcs.domain.entities.OwnersDataset.ownersAnd;
import static es.uvigo.esei.xcs.domain.entities.OwnersDataset.ownersWithout; import static es.uvigo.esei.xcs.domain.entities.OwnersDataset.ownersWithout;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
......
package es.uvigo.esei.xcs.jsf.pages; package es.uvigo.esei.xcs.jsf.pages;
import static org.hamcrest.core.StringContains.containsString; import static org.hamcrest.core.StringContains.containsString;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import org.jboss.arquillian.drone.api.annotation.Drone; import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.graphene.page.Location; import org.jboss.arquillian.graphene.page.Location;
......
...@@ -2,7 +2,7 @@ package es.uvigo.esei.xcs.jsf.pages; ...@@ -2,7 +2,7 @@ package es.uvigo.esei.xcs.jsf.pages;
import static java.util.Arrays.stream; import static java.util.Arrays.stream;
import static org.hamcrest.core.StringContains.containsString; import static org.hamcrest.core.StringContains.containsString;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import org.jboss.arquillian.drone.api.annotation.Drone; import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.graphene.GrapheneElement; import org.jboss.arquillian.graphene.GrapheneElement;
......
...@@ -38,42 +38,42 @@ ...@@ -38,42 +38,42 @@
<!-- BOM versions --> <!-- BOM versions -->
<javaee.api.version>7.0</javaee.api.version> <javaee.api.version>7.0</javaee.api.version>
<arquillian.version>1.1.13.Final</arquillian.version> <arquillian.version>1.7.1.Final</arquillian.version>
<arquillian.rest.version>1.0.0.Alpha4</arquillian.rest.version> <arquillian.rest.version>1.0.0.Alpha4</arquillian.rest.version>
<arquillian.selenium.version>3.4.0</arquillian.selenium.version> <arquillian.selenium.version>3.13.0</arquillian.selenium.version>
<shrinkwrap.resolver.bom.version>3.0.0-beta-2</shrinkwrap.resolver.bom.version> <shrinkwrap.resolver.bom.version>3.0.0-beta-2</shrinkwrap.resolver.bom.version>
<!-- Dependencies versions --> <!-- Dependencies versions -->
<wildfly.version>10.1.0.Final</wildfly.version> <wildfly.version>10.1.0.Final</wildfly.version>
<commons.lang3.version>3.4</commons.lang3.version> <commons.lang3.version>3.4</commons.lang3.version>
<bootstrap.version>3.3.7-1</bootstrap.version> <bootstrap.version>3.4.1</bootstrap.version>
<!-- Testing dependecies versions --> <!-- Testing dependecies versions -->
<arquillian.jacoco.version>1.0.0.Alpha9</arquillian.jacoco.version> <arquillian.jacoco.version>1.1.0</arquillian.jacoco.version>
<arquillian.persistence.dbunit.version>1.0.0.Alpha7</arquillian.persistence.dbunit.version> <arquillian.persistence.dbunit.version>1.0.0.Alpha7</arquillian.persistence.dbunit.version>
<arquillian.wildfly.embedded.version>3.0.3.Final</arquillian.wildfly.embedded.version> <arquillian.wildfly.embedded.version>3.0.3.Final</arquillian.wildfly.embedded.version>
<arquillian.wildfly.embedded.container.version>2.1.0.Final</arquillian.wildfly.embedded.container.version> <arquillian.wildfly.embedded.container.version>2.1.0.Final</arquillian.wildfly.embedded.container.version>
<easymock.version>3.4</easymock.version> <easymock.version>5.2.0</easymock.version>
<geckodriver.version>v0.33.0</geckodriver.version> <geckodriver.version>v0.33.0</geckodriver.version>
<graphene.webdrive.version>2.3.1</graphene.webdrive.version> <graphene.webdrive.version>2.5.4</graphene.webdrive.version>
<hamcrest.version>2.0.0.0</hamcrest.version> <hamcrest.version>2.2</hamcrest.version>
<jacoco.version>0.7.9</jacoco.version> <jacoco.version>0.8.10</jacoco.version>
<junit.version>4.12</junit.version> <junit.version>4.13.2</junit.version>
<mysql.connector.java.version>8.0.21</mysql.connector.java.version> <mysql.connector.java.version>8.1.0</mysql.connector.java.version>
<resteasy.version>3.0.24.Final</resteasy.version> <resteasy.version>3.15.6.Final</resteasy.version>
<slf4j.version>1.5.10</slf4j.version> <slf4j.version>1.5.10</slf4j.version>
<!-- Plugins versions --> <!-- Plugins versions -->
<maven.antrun.plugin.version>1.8</maven.antrun.plugin.version> <maven.antrun.plugin.version>3.1.0</maven.antrun.plugin.version>
<maven.compiler.plugin.version>3.6.1</maven.compiler.plugin.version> <maven.compiler.plugin.version>3.11.0</maven.compiler.plugin.version>
<maven.ear.plugin.version>2.10.1</maven.ear.plugin.version> <maven.ear.plugin.version>2.10.1</maven.ear.plugin.version>
<maven.javadoc.plugin.version>2.10.4</maven.javadoc.plugin.version> <maven.javadoc.plugin.version>3.6.0</maven.javadoc.plugin.version>
<maven.dependency.plugin.version>2.10</maven.dependency.plugin.version> <maven.dependency.plugin.version>3.6.0</maven.dependency.plugin.version>
<maven.deploy.plugin.version>2.8.2</maven.deploy.plugin.version> <maven.deploy.plugin.version>3.1.1</maven.deploy.plugin.version>
<maven.resources.plugin.version>3.0.2</maven.resources.plugin.version> <maven.resources.plugin.version>3.3.1</maven.resources.plugin.version>
<maven.source.plugin.version>3.0.1</maven.source.plugin.version> <maven.source.plugin.version>3.3.0</maven.source.plugin.version>
<maven.surefire.plugin.version>2.20</maven.surefire.plugin.version> <maven.surefire.plugin.version>3.1.2</maven.surefire.plugin.version>
<wildfly.maven.plugin.version>1.2.0.Final</wildfly.maven.plugin.version> <wildfly.maven.plugin.version>1.2.2.Final</wildfly.maven.plugin.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
...@@ -91,6 +91,13 @@ ...@@ -91,6 +91,13 @@
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-bom</artifactId>
<version>${shrinkwrap.resolver.bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency> <dependency>
<groupId>org.jboss.arquillian.selenium</groupId> <groupId>org.jboss.arquillian.selenium</groupId>
<artifactId>selenium-bom</artifactId> <artifactId>selenium-bom</artifactId>
...@@ -147,7 +154,7 @@ ...@@ -147,7 +154,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hamcrest</groupId> <groupId>org.hamcrest</groupId>
<artifactId>java-hamcrest</artifactId> <artifactId>hamcrest</artifactId>
<version>${hamcrest.version}</version> <version>${hamcrest.version}</version>
</dependency> </dependency>
<dependency> <dependency>
...@@ -188,8 +195,8 @@ ...@@ -188,8 +195,8 @@
<version>${jacoco.version}</version> <version>${jacoco.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>com.mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-j</artifactId>
<version>${mysql.connector.java.version}</version> <version>${mysql.connector.java.version}</version>
</dependency> </dependency>
<dependency> <dependency>
...@@ -589,8 +596,8 @@ ...@@ -589,8 +596,8 @@
<configuration> <configuration>
<artifactItems> <artifactItems>
<artifactItem> <artifactItem>
<groupId>mysql</groupId> <groupId>com.mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-j</artifactId>
<type>jar</type> <type>jar</type>
<overWrite>false</overWrite> <overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/wildfly-${wildfly.version}/standalone/deployments</outputDirectory> <outputDirectory>${project.build.directory}/wildfly-${wildfly.version}/standalone/deployments</outputDirectory>
...@@ -607,8 +614,8 @@ ...@@ -607,8 +614,8 @@
<configuration> <configuration>
<artifactItems> <artifactItems>
<artifactItem> <artifactItem>
<groupId>mysql</groupId> <groupId>com.mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-j</artifactId>
<type>jar</type> <type>jar</type>
<overWrite>false</overWrite> <overWrite>false</overWrite>
<outputDirectory>${project.build.directory}</outputDirectory> <outputDirectory>${project.build.directory}</outputDirectory>
...@@ -690,8 +697,8 @@ ...@@ -690,8 +697,8 @@
<configuration> <configuration>
<artifactItems> <artifactItems>
<artifactItem> <artifactItem>
<groupId>mysql</groupId> <groupId>com.mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-j</artifactId>
<type>jar</type> <type>jar</type>
<overWrite>false</overWrite> <overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/wildfly-${wildfly.version}/standalone/deployments</outputDirectory> <outputDirectory>${project.build.directory}/wildfly-${wildfly.version}/standalone/deployments</outputDirectory>
...@@ -708,8 +715,8 @@ ...@@ -708,8 +715,8 @@
<configuration> <configuration>
<artifactItems> <artifactItems>
<artifactItem> <artifactItem>
<groupId>mysql</groupId> <groupId>com.mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-j</artifactId>
<type>jar</type> <type>jar</type>
<overWrite>false</overWrite> <overWrite>false</overWrite>
<outputDirectory>${project.build.directory}</outputDirectory> <outputDirectory>${project.build.directory}</outputDirectory>
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hamcrest</groupId> <groupId>org.hamcrest</groupId>
<artifactId>java-hamcrest</artifactId> <artifactId>hamcrest</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
......
...@@ -18,7 +18,7 @@ import static es.uvigo.esei.xcs.http.util.HasHttpStatus.hasMethodNotAllowedStatu ...@@ -18,7 +18,7 @@ import static es.uvigo.esei.xcs.http.util.HasHttpStatus.hasMethodNotAllowedStatu
import static es.uvigo.esei.xcs.http.util.HasHttpStatus.hasOkStatus; import static es.uvigo.esei.xcs.http.util.HasHttpStatus.hasOkStatus;
import static javax.ws.rs.client.Entity.json; import static javax.ws.rs.client.Entity.json;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import java.util.List; import java.util.List;
......
...@@ -20,7 +20,7 @@ import static org.hamcrest.CoreMatchers.equalTo; ...@@ -20,7 +20,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.collection.IsEmptyCollection.empty; import static org.hamcrest.collection.IsEmptyCollection.empty;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import java.net.URI; import java.net.URI;
import java.util.List; import java.util.List;
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hamcrest</groupId> <groupId>org.hamcrest</groupId>
<artifactId>java-hamcrest</artifactId> <artifactId>hamcrest</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
......
...@@ -20,7 +20,7 @@ import static org.hamcrest.CoreMatchers.is; ...@@ -20,7 +20,7 @@ import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize; import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import static org.hamcrest.collection.IsEmptyCollection.empty; import static org.hamcrest.collection.IsEmptyCollection.empty;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
......
...@@ -14,7 +14,7 @@ import static es.uvigo.esei.xcs.domain.entities.OwnersDataset.petWithId; ...@@ -14,7 +14,7 @@ import static es.uvigo.esei.xcs.domain.entities.OwnersDataset.petWithId;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.collection.IsEmptyCollection.empty; import static org.hamcrest.collection.IsEmptyCollection.empty;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
......
...@@ -4,7 +4,7 @@ import static es.uvigo.esei.xcs.domain.entities.IsEqualToUser.equalToUser; ...@@ -4,7 +4,7 @@ import static es.uvigo.esei.xcs.domain.entities.IsEqualToUser.equalToUser;
import static es.uvigo.esei.xcs.domain.entities.OwnersDataset.existentOwner; import static es.uvigo.esei.xcs.domain.entities.OwnersDataset.existentOwner;
import static es.uvigo.esei.xcs.domain.entities.UsersDataset.existentAdmin; import static es.uvigo.esei.xcs.domain.entities.UsersDataset.existentAdmin;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.inject.Inject; import javax.inject.Inject;
...@@ -21,10 +21,8 @@ import org.junit.Test; ...@@ -21,10 +21,8 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import es.uvigo.esei.xcs.domain.entities.Owner; import es.uvigo.esei.xcs.domain.entities.Owner;
import es.uvigo.esei.xcs.domain.entities.OwnersDataset;
import es.uvigo.esei.xcs.domain.entities.Pet; import es.uvigo.esei.xcs.domain.entities.Pet;
import es.uvigo.esei.xcs.domain.entities.User; import es.uvigo.esei.xcs.domain.entities.User;
import es.uvigo.esei.xcs.domain.entities.UsersDataset;
import es.uvigo.esei.xcs.service.util.security.RoleCaller; import es.uvigo.esei.xcs.service.util.security.RoleCaller;
import es.uvigo.esei.xcs.service.util.security.TestPrincipal; import es.uvigo.esei.xcs.service.util.security.TestPrincipal;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hamcrest</groupId> <groupId>org.hamcrest</groupId>
<artifactId>java-hamcrest</artifactId> <artifactId>hamcrest</artifactId>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>
......
package es.uvigo.esei.xcs.domain.entities; package es.uvigo.esei.xcs.domain.entities;
import org.hamcrest.Factory;
import org.hamcrest.Matcher; import org.hamcrest.Matcher;
public class IsEqualToOwner extends IsEqualToEntity<Owner> { public class IsEqualToOwner extends IsEqualToEntity<Owner> {
...@@ -25,32 +24,26 @@ public class IsEqualToOwner extends IsEqualToEntity<Owner> { ...@@ -25,32 +24,26 @@ public class IsEqualToOwner extends IsEqualToEntity<Owner> {
} }
} }
@Factory
public static IsEqualToOwner equalToOwner(Owner owner) { public static IsEqualToOwner equalToOwner(Owner owner) {
return new IsEqualToOwner(owner, true); return new IsEqualToOwner(owner, true);
} }
@Factory
public static IsEqualToOwner equalToOwnerWithoutRelations(Owner owner) { public static IsEqualToOwner equalToOwnerWithoutRelations(Owner owner) {
return new IsEqualToOwner(owner, false); return new IsEqualToOwner(owner, false);
} }
@Factory
public static Matcher<Iterable<? extends Owner>> containsOwnersInAnyOrder(Owner ... owners) { public static Matcher<Iterable<? extends Owner>> containsOwnersInAnyOrder(Owner ... owners) {
return containsEntityInAnyOrder(IsEqualToOwner::equalToOwner, owners); return containsEntityInAnyOrder(IsEqualToOwner::equalToOwner, owners);
} }
@Factory
public static Matcher<Iterable<? extends Owner>> containsOwnersWithoutRelationsInAnyOrder(Owner ... owners) { public static Matcher<Iterable<? extends Owner>> containsOwnersWithoutRelationsInAnyOrder(Owner ... owners) {
return containsEntityInAnyOrder(IsEqualToOwner::equalToOwnerWithoutRelations, owners); return containsEntityInAnyOrder(IsEqualToOwner::equalToOwnerWithoutRelations, owners);
} }
@Factory
public static Matcher<Iterable<? extends Owner>> containsOwnersInAnyOrder(Iterable<Owner> owners) { public static Matcher<Iterable<? extends Owner>> containsOwnersInAnyOrder(Iterable<Owner> owners) {
return containsEntityInAnyOrder(IsEqualToOwner::equalToOwner, owners); return containsEntityInAnyOrder(IsEqualToOwner::equalToOwner, owners);
} }
@Factory
public static Matcher<Iterable<? extends Owner>> containsOwnersWithoutRelationsInAnyOrder(Iterable<Owner> owners) { public static Matcher<Iterable<? extends Owner>> containsOwnersWithoutRelationsInAnyOrder(Iterable<Owner> owners) {
return containsEntityInAnyOrder(IsEqualToOwner::equalToOwnerWithoutRelations, owners); return containsEntityInAnyOrder(IsEqualToOwner::equalToOwnerWithoutRelations, owners);
} }
......
package es.uvigo.esei.xcs.domain.entities; package es.uvigo.esei.xcs.domain.entities;
import org.hamcrest.Factory;
import org.hamcrest.Matcher; import org.hamcrest.Matcher;
public class IsEqualToPet extends IsEqualToEntity<Pet> { public class IsEqualToPet extends IsEqualToEntity<Pet> {
...@@ -26,32 +25,26 @@ public class IsEqualToPet extends IsEqualToEntity<Pet> { ...@@ -26,32 +25,26 @@ public class IsEqualToPet extends IsEqualToEntity<Pet> {
} }
} }
@Factory
public static IsEqualToPet equalToPet(Pet pet) { public static IsEqualToPet equalToPet(Pet pet) {
return new IsEqualToPet(pet, true); return new IsEqualToPet(pet, true);
} }
@Factory
public static IsEqualToPet equalToPetWithoutRelations(Pet pet) { public static IsEqualToPet equalToPetWithoutRelations(Pet pet) {
return new IsEqualToPet(pet, false); return new IsEqualToPet(pet, false);
} }
@Factory
public static Matcher<Iterable<? extends Pet>> containsPetsInAnyOrder(Pet ... pets) { public static Matcher<Iterable<? extends Pet>> containsPetsInAnyOrder(Pet ... pets) {
return containsEntityInAnyOrder(IsEqualToPet::equalToPet, pets); return containsEntityInAnyOrder(IsEqualToPet::equalToPet, pets);
} }
@Factory
public static Matcher<Iterable<? extends Pet>> containsPetsWithoutRelationsInAnyOrder(Pet ... pets) { public static Matcher<Iterable<? extends Pet>> containsPetsWithoutRelationsInAnyOrder(Pet ... pets) {
return containsEntityInAnyOrder(IsEqualToPet::equalToPetWithoutRelations, pets); return containsEntityInAnyOrder(IsEqualToPet::equalToPetWithoutRelations, pets);
} }
@Factory
public static Matcher<Iterable<? extends Pet>> containsPetsInAnyOrder(Iterable<Pet> pets) { public static Matcher<Iterable<? extends Pet>> containsPetsInAnyOrder(Iterable<Pet> pets) {
return containsEntityInAnyOrder(IsEqualToPet::equalToPet, pets); return containsEntityInAnyOrder(IsEqualToPet::equalToPet, pets);
} }
@Factory
public static Matcher<Iterable<? extends Pet>> containsPetsWithoutRelationsInAnyOrder(Iterable<Pet> pets) { public static Matcher<Iterable<? extends Pet>> containsPetsWithoutRelationsInAnyOrder(Iterable<Pet> pets) {
return containsEntityInAnyOrder(IsEqualToPet::equalToPetWithoutRelations, pets); return containsEntityInAnyOrder(IsEqualToPet::equalToPetWithoutRelations, pets);
} }
......
package es.uvigo.esei.xcs.domain.entities; package es.uvigo.esei.xcs.domain.entities;
import org.hamcrest.Factory;
import org.hamcrest.Matcher; import org.hamcrest.Matcher;
public class IsEqualToUser extends IsEqualToEntity<User> { public class IsEqualToUser extends IsEqualToEntity<User> {
...@@ -21,17 +20,14 @@ public class IsEqualToUser extends IsEqualToEntity<User> { ...@@ -21,17 +20,14 @@ public class IsEqualToUser extends IsEqualToEntity<User> {
} }
} }
@Factory
public static IsEqualToUser equalToUser(User user) { public static IsEqualToUser equalToUser(User user) {
return new IsEqualToUser(user); return new IsEqualToUser(user);
} }
@Factory
public static Matcher<Iterable<? extends User>> containsUsersInAnyOrder(User ... users) { public static Matcher<Iterable<? extends User>> containsUsersInAnyOrder(User ... users) {
return containsEntityInAnyOrder(IsEqualToUser::equalToUser, users); return containsEntityInAnyOrder(IsEqualToUser::equalToUser, users);
} }
@Factory
public static Matcher<Iterable<? extends User>> containsUsersInAnyOrder(Iterable<User> users) { public static Matcher<Iterable<? extends User>> containsUsersInAnyOrder(Iterable<User> users) {
return containsEntityInAnyOrder(IsEqualToUser::equalToUser, users); return containsEntityInAnyOrder(IsEqualToUser::equalToUser, users);
} }
......
...@@ -4,7 +4,6 @@ import javax.ws.rs.core.Response; ...@@ -4,7 +4,6 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.StatusType; import javax.ws.rs.core.Response.StatusType;
import org.hamcrest.Description; import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.TypeSafeMatcher; import org.hamcrest.TypeSafeMatcher;
import static javax.ws.rs.core.Response.Status.BAD_REQUEST; import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
...@@ -33,32 +32,26 @@ public class HasHttpStatus extends TypeSafeMatcher<Response> { ...@@ -33,32 +32,26 @@ public class HasHttpStatus extends TypeSafeMatcher<Response> {
return this.status.getStatusCode() == item.getStatus(); return this.status.getStatusCode() == item.getStatus();
} }
@Factory
public static HasHttpStatus hasHttpStatus(int statusCode) { public static HasHttpStatus hasHttpStatus(int statusCode) {
return new HasHttpStatus(statusCode); return new HasHttpStatus(statusCode);
} }
@Factory
public static HasHttpStatus hasHttpStatus(StatusType status) { public static HasHttpStatus hasHttpStatus(StatusType status) {
return new HasHttpStatus(status); return new HasHttpStatus(status);
} }
@Factory
public static HasHttpStatus hasOkStatus() { public static HasHttpStatus hasOkStatus() {
return new HasHttpStatus(OK); return new HasHttpStatus(OK);
} }
@Factory
public static HasHttpStatus hasCreatedStatus() { public static HasHttpStatus hasCreatedStatus() {
return new HasHttpStatus(CREATED); return new HasHttpStatus(CREATED);
} }
@Factory
public static HasHttpStatus hasMethodNotAllowedStatus() { public static HasHttpStatus hasMethodNotAllowedStatus() {
return new HasHttpStatus(METHOD_NOT_ALLOWED); return new HasHttpStatus(METHOD_NOT_ALLOWED);
} }
@Factory
public static HasHttpStatus hasBadRequestStatus() { public static HasHttpStatus hasBadRequestStatus() {
return new HasHttpStatus(BAD_REQUEST); return new HasHttpStatus(BAD_REQUEST);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment