From 98a7160b223026f3d8a060d2a6d78f070c919871 Mon Sep 17 00:00:00 2001 From: Miguel Reboiro-Jato Date: Wed, 27 Sep 2017 22:22:19 +0200 Subject: [PATCH] Updates the project for the 17/18 course The project dependencies have been updated, including a change from WildFly 8.2.1 to 10.1.0. This change affects the project configuration in several ways, specially in tests configuration. The README.md file has been updated to reflect the configuration changes. --- .gitignore | 1 + README.md | 80 +++- .../wildfly/v10.1.0/standalone.xml | 446 ++++++++++++++++++ .../wildfly/{ => v8.2.1}/standalone.xml | 44 +- jsf/pom.xml | 4 +- .../main/resources/META-INF/persistence.xml | 32 +- .../es/uvigo/esei/xcs/jsf/OwnerJsfTest.java | 4 + ...an.extension.persistence.dbunit.properties | 1 + ...an.extension.persistence.dbunit.properties | 1 + ...rquillian.extension.persistence.properties | 3 + jsf/src/test/resources/arquillian.xml | 45 +- jsf/src/test/resources/test-persistence.xml | 27 +- pom.xml | 259 +++++----- .../main/resources/META-INF/persistence.xml | 32 +- .../esei/xcs/rest/OwnerResourceRestTest.java | 2 + ...an.extension.persistence.dbunit.properties | 1 + ...an.extension.persistence.dbunit.properties | 1 + ...rquillian.extension.persistence.properties | 3 + rest/src/test/resources/arquillian.xml | 36 +- rest/src/test/resources/test-persistence.xml | 27 +- ...erServiceIllegalAccessIntegrationTest.java | 2 + .../service/OwnerServiceIntegrationTest.java | 2 + ...etServiceIllegalAccessIntegrationTest.java | 2 + .../service/PetServiceIntegrationTest.java | 2 + ...an.extension.persistence.dbunit.properties | 1 + ...an.extension.persistence.dbunit.properties | 1 + ...rquillian.extension.persistence.properties | 3 + service/src/test/resources/arquillian.xml | 32 +- .../src/test/resources/test-persistence.xml | 29 +- tests/src/main/resources/logging.properties | 56 +++ 30 files changed, 859 insertions(+), 320 deletions(-) create mode 100644 additional-material/wildfly/v10.1.0/standalone.xml rename additional-material/wildfly/{ => v8.2.1}/standalone.xml (93%) create mode 100644 jsf/src/test/resources-wildfly-embedded-h2/arquillian.extension.persistence.dbunit.properties create mode 100644 jsf/src/test/resources-wildfly-embedded-mysql/arquillian.extension.persistence.dbunit.properties create mode 100644 jsf/src/test/resources/arquillian.extension.persistence.properties create mode 100644 rest/src/test/resources-wildfly-embedded-h2/arquillian.extension.persistence.dbunit.properties create mode 100644 rest/src/test/resources-wildfly-embedded-mysql/arquillian.extension.persistence.dbunit.properties create mode 100644 rest/src/test/resources/arquillian.extension.persistence.properties create mode 100644 service/src/test/resources-wildfly-embedded-h2/arquillian.extension.persistence.dbunit.properties create mode 100644 service/src/test/resources-wildfly-embedded-mysql/arquillian.extension.persistence.dbunit.properties create mode 100644 service/src/test/resources/arquillian.extension.persistence.properties create mode 100644 tests/src/main/resources/logging.properties diff --git a/.gitignore b/.gitignore index ea8f3fb..98d5583 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ target #General bak +angularjs #Firefox C:\\nppdf32Log\\debuglog.txt diff --git a/README.md b/README.md index bab30ad..4b6b678 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,14 @@ the XCS subject inside the DGSS itinerary. ## 1. Deployment Environment The environment is based on Java 8, Maven 3.3+, Git 1.9+, MySQL 5.5+, -WildFly 8.2.1 and Eclipse Neon for JavaEE. +WildFly 10.1.0 and Eclipse Oxygen for JavaEE. ### 1.1. Java JDK 8 Download and install Java JDK 8, preferably the Oracle version (the commands `java` and `javac` must be available). You can test your Java installation with the commands: + ```bash java -version javac -version @@ -20,27 +21,34 @@ javac -version ### 1.2. Maven 3.3+ 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!!**). +(**don't install `maven2` package!!**): + +``` +sudo apt-get install maven +``` You can test your Maven installation with the command: + ```bash mvn --version ``` ### 1.3. Git 1.9+ -First, 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](http://sing.ei.uvigo.es/dt/gitlab). +[our Gitlab server](https://www.sing-group.org/dt/gitlab). You can tests your Git installation with the command: + ```bash git --version ``` Once Git is installed in your system, clone the project: + ```bash -git clone http://sing.ei.uvigo.es/dt/gitlab/dgss-1617/xcs-sample.git +git clone http://sing-group.org/dt/gitlab/dgss-1718/xcs-sample.git ``` ### 1.4. MySQL 5.5+ @@ -111,8 +119,8 @@ VALUES ('CAT','2000-01-01 01:01:01','Pepecat','pepe'), 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. -### 1.5. Eclipse Neon for Java EE -Open Eclipse Neon for Java EE and import your Maven project with +### 1.5. Eclipse Oxygen for Java EE +Open Eclipse Oxygen 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). @@ -126,9 +134,9 @@ advanced settings of the dialog and use a custom `Name template` (for example, 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 -Neon for Java EE. +Oxygen for Java EE. -### 1.6 WildFly 8.2.1 +### 1.6 WildFly 10.1.0 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 @@ -137,14 +145,16 @@ 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 includes a -`standalone.xml` ready to be used that you can just copy to your WildFly server -(replacing the original `standalone/configuration/standalone.xml` file). +`standalone.xml` ready to be used for the 10.1.0 and 10.1.0 versions that you can +just copy to your WildFly server (replacing the original + `standalone/configuration/standalone.xml` file). #### 1.6.1. Datasource configuration 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 `` element: + ```xml jdbc:mysql://localhost:3306/xcs @@ -169,6 +179,7 @@ All the WildFly security configuration is done in the `standalone/configuration/standalone.xml` file of the server. Inside the `` element you have to add a new security realm: + ```xml @@ -179,6 +190,7 @@ Inside the `` element you have to add a new security realm: Then, inside the `` element you have to add the following security domains: + ```xml @@ -236,17 +248,16 @@ following command: ```bash mvn install -P wildfly-mysql-run,-wildfly-embedded-h2 ``` -This will launch the complete construction cycle (remember that you can skip -test execution adding the `-DskipTests=true` parameter), 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. +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. **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. -To stop the WildFly lauched you can execute the following command: +To stop the WildFly launched you can execute the following command: ```bash mvn wildfly:shutdown @@ -272,8 +283,8 @@ database, whose driver is included by default in WilFly. In both profiles, the WildFly server is automatically downloaded using the `maven-dependency-plugin`, that extracts it in the `target/wildfly-` -folder (`target/wildfly-8.2.1.Final` currently). In the MySQL profile, the MySQL -driver is also downloaded using this plugin and added to the +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-/standalone/deployments` folder, to make it available in the WildFly server. @@ -295,25 +306,37 @@ external requirement. #### 2.2.1.1 Arquillian tests in Eclipse To run Arquillian tests in Eclipse (or in any non-Maven enviroment) a further step is needed. You must configure the following system properties: +* `arquillian.launch`: the launch configuration that arquillian should use. +* `wildfly.version`: the version of the WildFly server stored in `target`. +The current version is `10.1.0.Final`. +* `wildfly.jbossHome`: the location 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 logger. Commonly, the value `org.jboss.logmanager.LogManager` is used. -* `wildfly.version`: the version of the WildFly server stored in `target`. -The current version is `8.2.1.Final`. +* `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.management.port`: management port of the WildFly server. 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: ``` --Dwildfly.version=8.2.1.Final +-Darquillian.launch=wildfly-embedded +-Dwildfly.version=10.1.0.Final +-Dwildfly.jbossHome=target/wildfly-10.1.0.Final +-Dwildfly.modulePath=target/wildfly-10.1.0.Final/modules -Djava.util.logging.manager=org.jboss.logmanager.LogManager +-Djboss.socket.binding.port-offset=10000 +-Dwildfly.http.port=18080 +-Dwildfly.management.port=19990 ``` 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: -* `mysql.version`: The version of the MySQL driver (currently, `5.1.21`). This -version is used by the `mysql-ds.xml` configuration files. +* `mysql.version`: The version of the MySQL driver (currently, `5.1.21`). * `arquillian.launch`: This system property is used to change the profile used by Arquillian. It should be `wildfly-embedded-mysql` to use the MySQL profile. @@ -321,10 +344,15 @@ Therefore, the `VM arguments` configuration for running the tests in Eclipse using the MySQL database is: ``` --Dwildfly.version=8.2.1.Final --Djava.util.logging.manager=org.jboss.logmanager.LogManager --Dmysql.version=5.1.21 -Darquillian.launch=wildfly-embedded-mysql +-Dmysql.version=5.1.21 +-Dwildfly.version=10.1.0.Final +-Dwildfly.jbossHome=target/wildfly-10.1.0.Final +-Dwildfly.modulePath=target/wildfly-10.1.0.Final/modules +-Djava.util.logging.manager=org.jboss.logmanager.LogManager +-Djboss.socket.binding.port-offset=10000 +-Dwildfly.http.port=18080 +-Dwildfly.management.port=19990 ``` ## 2.3. Sample 3: Testing with test doubles diff --git a/additional-material/wildfly/v10.1.0/standalone.xml b/additional-material/wildfly/v10.1.0/standalone.xml new file mode 100644 index 0000000..82b6cd3 --- /dev/null +++ b/additional-material/wildfly/v10.1.0/standalone.xml @@ -0,0 +1,446 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + h2 + + sa + sa + + + + jdbc:mysql://localhost:3306/xcs + com.mysql.jdbc.Driver + mysql-connector-java-5.1.21.jar + + xcs + xcs + + + + + org.h2.jdbcx.JdbcDataSource + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${jboss.bind.address:127.0.0.1} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/additional-material/wildfly/standalone.xml b/additional-material/wildfly/v8.2.1/standalone.xml similarity index 93% rename from additional-material/wildfly/standalone.xml rename to additional-material/wildfly/v8.2.1/standalone.xml index 048d22f..27d702a 100644 --- a/additional-material/wildfly/standalone.xml +++ b/additional-material/wildfly/v8.2.1/standalone.xml @@ -155,7 +155,7 @@ jdbc:mysql://localhost:3306/xcs com.mysql.jdbc.Driver - mysql-connector-java-${mysql.version}.jar + mysql-connector-java-5.1.21.jar xcs xcs @@ -329,28 +329,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/jsf/pom.xml b/jsf/pom.xml index 23108fd..fb010e5 100644 --- a/jsf/pom.xml +++ b/jsf/pom.xml @@ -77,9 +77,9 @@ org.apache.maven.plugins maven-surefire-plugin - + diff --git a/jsf/src/main/resources/META-INF/persistence.xml b/jsf/src/main/resources/META-INF/persistence.xml index 6f685f2..6795438 100644 --- a/jsf/src/main/resources/META-INF/persistence.xml +++ b/jsf/src/main/resources/META-INF/persistence.xml @@ -1,20 +1,20 @@ - - java:jboss/datasources/xcs - - es.uvigo.esei.xcs.domain.entities.Owner - es.uvigo.esei.xcs.domain.entities.Pet - es.uvigo.esei.xcs.domain.entities.Administrator - false - - - - - - + version="2.1"> + + java:jboss/datasources/xcs + + es.uvigo.esei.xcs.domain.entities.Owner + es.uvigo.esei.xcs.domain.entities.Pet + es.uvigo.esei.xcs.domain.entities.Administrator + false + + + + + + \ No newline at end of file diff --git a/jsf/src/test/java/es/uvigo/esei/xcs/jsf/OwnerJsfTest.java b/jsf/src/test/java/es/uvigo/esei/xcs/jsf/OwnerJsfTest.java index 4c1614f..5561b60 100644 --- a/jsf/src/test/java/es/uvigo/esei/xcs/jsf/OwnerJsfTest.java +++ b/jsf/src/test/java/es/uvigo/esei/xcs/jsf/OwnerJsfTest.java @@ -13,6 +13,7 @@ import static es.uvigo.esei.xcs.domain.entities.OwnersDataset.ownersWithout; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; +import java.io.File; import java.nio.file.Path; import java.nio.file.Paths; @@ -32,6 +33,7 @@ import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.jboss.shrinkwrap.resolver.api.maven.Maven; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -66,6 +68,8 @@ public class OwnerJsfTest { .addAsWebInfResource(WEBAPP.resolve("WEB-INF/template.xhtml").toFile()) .addAsWebInfResource(WEBAPP.resolve("WEB-INF/web.xml").toFile()) .addAsWebInfResource(WEBAPP.resolve("WEB-INF/jboss-web.xml").toFile()) + .addAsResource("arquillian.extension.persistence.properties") + .addAsResource("arquillian.extension.persistence.dbunit.properties") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); } diff --git a/jsf/src/test/resources-wildfly-embedded-h2/arquillian.extension.persistence.dbunit.properties b/jsf/src/test/resources-wildfly-embedded-h2/arquillian.extension.persistence.dbunit.properties new file mode 100644 index 0000000..2c5132e --- /dev/null +++ b/jsf/src/test/resources-wildfly-embedded-h2/arquillian.extension.persistence.dbunit.properties @@ -0,0 +1 @@ +datatypeFactory = org.dbunit.ext.h2.H2DataTypeFactory \ No newline at end of file diff --git a/jsf/src/test/resources-wildfly-embedded-mysql/arquillian.extension.persistence.dbunit.properties b/jsf/src/test/resources-wildfly-embedded-mysql/arquillian.extension.persistence.dbunit.properties new file mode 100644 index 0000000..2c5132e --- /dev/null +++ b/jsf/src/test/resources-wildfly-embedded-mysql/arquillian.extension.persistence.dbunit.properties @@ -0,0 +1 @@ +datatypeFactory = org.dbunit.ext.h2.H2DataTypeFactory \ No newline at end of file diff --git a/jsf/src/test/resources/arquillian.extension.persistence.properties b/jsf/src/test/resources/arquillian.extension.persistence.properties new file mode 100644 index 0000000..a7941bc --- /dev/null +++ b/jsf/src/test/resources/arquillian.extension.persistence.properties @@ -0,0 +1,3 @@ +defaultDataSeedStrategy = CLEAN_INSERT +defaultCleanupPhase = BEFORE +defaultDataSource = java:jboss/datasources/xcs diff --git a/jsf/src/test/resources/arquillian.xml b/jsf/src/test/resources/arquillian.xml index 07ce5ea..88ccdb6 100644 --- a/jsf/src/test/resources/arquillian.xml +++ b/jsf/src/test/resources/arquillian.xml @@ -1,26 +1,27 @@ - - - - CLEAN_INSERT - - - - firefox - - - - - target/wildfly-${wildfly.version} - target/wildfly-${wildfly.version}/modules - 19990 - - - 18080 - - + + CLEAN_INSERT + BEFORE + java:jboss/datasources/xcs + + + + firefox + + + + + target/wildfly-${wildfly.version} + target/wildfly-${wildfly.version}/modules + ${wildfly.management.port} + + + + ${wildfly.http.port} + + \ No newline at end of file diff --git a/jsf/src/test/resources/test-persistence.xml b/jsf/src/test/resources/test-persistence.xml index ca6c15c..7b52583 100644 --- a/jsf/src/test/resources/test-persistence.xml +++ b/jsf/src/test/resources/test-persistence.xml @@ -1,17 +1,20 @@ - - java:jboss/datasources/xcs - - false + version="2.1"> + + java:jboss/datasources/xcs - - - - - + es.uvigo.esei.xcs.domain.entities.Owner + es.uvigo.esei.xcs.domain.entities.Pet + es.uvigo.esei.xcs.domain.entities.Administrator + false + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 67e6f4b..290048b 100644 --- a/pom.xml +++ b/pom.xml @@ -1,23 +1,21 @@ - + 4.0.0 es.uvigo.esei.xcs sample 0.0.1-SNAPSHOT pom - Sample deployment Internal Releases - http://sing.ei.uvigo.es/dt/nexus/content/repositories/releases/ + https://www.sing-group.org/dt/nexus/content/repositories/releases/ deployment Internal SNAPSHOT Releases - http://sing.ei.uvigo.es/dt/nexus/content/repositories/snapshots/ + https://www.sing-group.org/dt/nexus/content/repositories/snapshots/ @@ -40,39 +38,42 @@ 7.0 - 1.1.11.Final + 1.1.13.Final 1.0.0.Alpha4 - 3.0.0 + 3.4.0 + 3.0.0-beta-2 - 8.2.1.Final + 10.1.0.Final 3.4 3.3.7-1 - 4.12 - 2.0.0.0 - 3.4 - 0.7.7.201606060606 - 1.0.0.Alpha8 + 1.0.0.Alpha9 1.0.0.Alpha7 - 1.5.10 + 3.0.3.Final + 2.1.0.Final + 3.4 + v0.19.0 + 2.3.1 + 2.0.0.0 + 0.7.9 + 4.12 5.1.21 - 3.0.19.Final - 2.1.0.Final - v0.11.1 + 3.0.24.Final + 1.5.10 - 1.1.0.Alpha11 - 3.5.1 - 3.0.1 + 1.8 + 3.6.1 + 2.10.1 2.10.4 - 2.8.2 2.10 - 2.19.1 - 3.0.1 - 2.10.1 - 1.8 + 2.8.2 + 3.0.2 + 3.0.1 + 2.20 + 1.2.0.Final @@ -97,7 +98,7 @@ pom import - + ${project.groupId} @@ -133,9 +134,9 @@ ${commons.lang3.version} - org.webjars - bootstrap - ${bootstrap.version} + org.webjars + bootstrap + ${bootstrap.version} @@ -207,18 +208,18 @@ ${wildfly.version} - org.wildfly + org.wildfly.core wildfly-embedded - ${wildfly.version} + ${arquillian.wildfly.embedded.version} - org.wildfly + org.wildfly.arquillian wildfly-arquillian-container-embedded - ${wildfly.version} + ${arquillian.wildfly.embedded.container.version} - + @@ -253,6 +254,7 @@ + @@ -304,8 +306,7 @@ wildfly-maven-plugin ${wildfly.maven.plugin.version} - + true @@ -351,8 +352,7 @@ - + org.eclipse.m2e lifecycle-mapping @@ -362,15 +362,9 @@ - - org.apache.maven.plugins - - - maven-dependency-plugin - - - [2.10,) - + org.apache.maven.plugins + maven-dependency-plugin + [2.10,) unpack @@ -381,15 +375,9 @@ - - org.apache.maven.plugins - - - maven-antrun-plugin - - - [1.8,) - + org.apache.maven.plugins + maven-antrun-plugin + [1.8,) run @@ -414,13 +402,13 @@ - org.wildfly - wildfly-arquillian-container-embedded + org.wildfly.core + wildfly-embedded test - org.wildfly - wildfly-embedded + org.wildfly.arquillian + wildfly-arquillian-container-embedded test @@ -450,14 +438,18 @@ 1 - org.jboss.logmanager.LogManager - ${wildfly.version} - wildfly-embedded + wildfly-embedded + org.jboss.logmanager.LogManager + 10000 + ${wildfly.version} + 18080 + 19990 + target/wildfly-${wildfly.version} + target/wildfly-${wildfly.version}/modules false - org.apache.maven.plugins maven-dependency-plugin @@ -483,7 +475,6 @@ - org.apache.maven.plugins maven-resources-plugin @@ -517,13 +508,13 @@ - org.wildfly - wildfly-arquillian-container-embedded + org.wildfly.core + wildfly-embedded test - org.wildfly - wildfly-embedded + org.wildfly.arquillian + wildfly-arquillian-container-embedded test @@ -553,10 +544,15 @@ 1 - org.jboss.logmanager.LogManager ${mysql.connector.java.version} - ${wildfly.version} - wildfly-embedded + wildfly-embedded + org.jboss.logmanager.LogManager + 10000 + ${wildfly.version} + 18080 + 19990 + target/wildfly-${wildfly.version} + target/wildfly-${wildfly.version}/modules false @@ -624,7 +620,6 @@ - org.apache.maven.plugins maven-resources-plugin @@ -653,50 +648,14 @@ wildfly-mysql-run - - - org.wildfly - wildfly-arquillian-container-embedded - test - - - org.wildfly - wildfly-embedded - test - - - org.slf4j - slf4j-api - test - - - org.slf4j - slf4j-simple - test - - - - - src/test/resources - - - src/test/resources-wildfly-embedded-mysql - - org.apache.maven.plugins maven-surefire-plugin - 1 - - org.jboss.logmanager.LogManager - ${mysql.connector.java.version} - ${wildfly.version} - wildfly-embedded - - false + + true @@ -762,7 +721,6 @@ - org.apache.maven.plugins maven-resources-plugin @@ -785,51 +743,56 @@ - - org.wildfly.plugins - wildfly-maven-plugin - - - + org.wildfly.plugins + wildfly-maven-plugin + + + deploy ${project.build.directory}/mysql-connector-java-${mysql.connector.java.version}.jar - data-source add --jndi-name=java:jboss/datasources/xcs --name=xcs-sample --jta=true --use-ccm=true --connection-url=jdbc:mysql://localhost:3306/xcs --driver-name=mysql-connector-java-${mysql.connector.java.version}.jar --driver-class=com.mysql.jdbc.Driver --user-name=xcs --password=xcs + data-source add --jndi-name=java:jboss/datasources/xcs --name=xcs-sample --jta=true --use-ccm=true + --connection-url=jdbc:mysql://localhost:3306/xcs --driver-name=mysql-connector-java-${mysql.connector.java.version}.jar + --driver-class=com.mysql.jdbc.Driver --user-name=xcs --password=xcs /core-service=management/security-realm=RemotingRealm:add /core-service=management/security-realm=RemotingRealm/authentication=jaas:add(name="AppRealmLoopThrough") /subsystem=remoting/http-connector=http-remoting-connector:write-attribute(name="security-realm", value="RemotingRealm") /subsystem=security/security-domain=AppRealmLoopThrough:add(cache-type=default) - /subsystem=security/security-domain=AppRealmLoopThrough/authentication=classic:add(login-modules=[{"code"=>"Client", "flag" => "required", "module-options" => [("multi-threaded" => "true")]}]) + /subsystem=security/security-domain=AppRealmLoopThrough/authentication=classic:add(login-modules=[{"code"=>"Client", "flag" => + "required", "module-options" => [("multi-threaded" => "true")]}]) /subsystem=security/security-domain=xcs-sample-security-domain:add - /subsystem=security/security-domain=xcs-sample-security-domain/authentication=classic:add(login-modules=[{"code"=>"Database", "flag" => "required", "module-options" => [("dsJndiName" => "java:jboss/datasources/xcs"),("principalsQuery" => "SELECT password FROM User WHERE login=?"),("rolesQuery" => "SELECT role, 'Roles' FROM User WHERE login=?"),("hashAlgorithm" => "MD5"),("hashEncoding" => "hex"),("ignorePasswordCase" => "true")]}]) + /subsystem=security/security-domain=xcs-sample-security-domain/authentication=classic:add(login-modules=[{"code"=>"Database", "flag" + => "required", "module-options" => [("dsJndiName" => "java:jboss/datasources/xcs"),("principalsQuery" => "SELECT password FROM User WHERE + login=?"),("rolesQuery" => "SELECT role, 'Roles' FROM User WHERE login=?"),("hashAlgorithm" => "MD5"),("hashEncoding" => + "hex"),("ignorePasswordCase" => "true")]}]) - - - - :reload - - - - - - wildfly-admin - xcsadmin - false - - - - - - - start-wildfly - install - - start - deploy-only - - - - + + + + :reload + + + + + + wildfly-admin + xcsadmin + false + + + + + + + start-wildfly + install + + start + deploy-only + + + + diff --git a/rest/src/main/resources/META-INF/persistence.xml b/rest/src/main/resources/META-INF/persistence.xml index 6f685f2..6795438 100644 --- a/rest/src/main/resources/META-INF/persistence.xml +++ b/rest/src/main/resources/META-INF/persistence.xml @@ -1,20 +1,20 @@ - - java:jboss/datasources/xcs - - es.uvigo.esei.xcs.domain.entities.Owner - es.uvigo.esei.xcs.domain.entities.Pet - es.uvigo.esei.xcs.domain.entities.Administrator - false - - - - - - + version="2.1"> + + java:jboss/datasources/xcs + + es.uvigo.esei.xcs.domain.entities.Owner + es.uvigo.esei.xcs.domain.entities.Pet + es.uvigo.esei.xcs.domain.entities.Administrator + false + + + + + + \ No newline at end of file diff --git a/rest/src/test/java/es/uvigo/esei/xcs/rest/OwnerResourceRestTest.java b/rest/src/test/java/es/uvigo/esei/xcs/rest/OwnerResourceRestTest.java index 587a679..dbc2dee 100644 --- a/rest/src/test/java/es/uvigo/esei/xcs/rest/OwnerResourceRestTest.java +++ b/rest/src/test/java/es/uvigo/esei/xcs/rest/OwnerResourceRestTest.java @@ -65,6 +65,8 @@ public class OwnerResourceRestTest { .addAsResource("test-persistence.xml", "META-INF/persistence.xml") .addAsWebInfResource("jboss-web.xml") .addAsWebInfResource("web.xml") + .addAsResource("arquillian.extension.persistence.properties") + .addAsResource("arquillian.extension.persistence.dbunit.properties") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); } diff --git a/rest/src/test/resources-wildfly-embedded-h2/arquillian.extension.persistence.dbunit.properties b/rest/src/test/resources-wildfly-embedded-h2/arquillian.extension.persistence.dbunit.properties new file mode 100644 index 0000000..2c5132e --- /dev/null +++ b/rest/src/test/resources-wildfly-embedded-h2/arquillian.extension.persistence.dbunit.properties @@ -0,0 +1 @@ +datatypeFactory = org.dbunit.ext.h2.H2DataTypeFactory \ No newline at end of file diff --git a/rest/src/test/resources-wildfly-embedded-mysql/arquillian.extension.persistence.dbunit.properties b/rest/src/test/resources-wildfly-embedded-mysql/arquillian.extension.persistence.dbunit.properties new file mode 100644 index 0000000..2c5132e --- /dev/null +++ b/rest/src/test/resources-wildfly-embedded-mysql/arquillian.extension.persistence.dbunit.properties @@ -0,0 +1 @@ +datatypeFactory = org.dbunit.ext.h2.H2DataTypeFactory \ No newline at end of file diff --git a/rest/src/test/resources/arquillian.extension.persistence.properties b/rest/src/test/resources/arquillian.extension.persistence.properties new file mode 100644 index 0000000..a7941bc --- /dev/null +++ b/rest/src/test/resources/arquillian.extension.persistence.properties @@ -0,0 +1,3 @@ +defaultDataSeedStrategy = CLEAN_INSERT +defaultCleanupPhase = BEFORE +defaultDataSource = java:jboss/datasources/xcs diff --git a/rest/src/test/resources/arquillian.xml b/rest/src/test/resources/arquillian.xml index 148298c..64f740d 100644 --- a/rest/src/test/resources/arquillian.xml +++ b/rest/src/test/resources/arquillian.xml @@ -4,19 +4,25 @@ xsi:schemaLocation=" http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> - - - CLEAN_INSERT - - - - - target/wildfly-${wildfly.version} - target/wildfly-${wildfly.version}/modules - 19990 - - - 18080 - - + + CLEAN_INSERT + BEFORE + java:jboss/datasources/xcs + + + + firefox + + + + + target/wildfly-${wildfly.version} + target/wildfly-${wildfly.version}/modules + ${wildfly.management.port} + + + + ${wildfly.http.port} + + \ No newline at end of file diff --git a/rest/src/test/resources/test-persistence.xml b/rest/src/test/resources/test-persistence.xml index 3911dc7..7b52583 100644 --- a/rest/src/test/resources/test-persistence.xml +++ b/rest/src/test/resources/test-persistence.xml @@ -1,17 +1,20 @@ - - java:jboss/datasources/xcs - - false + version="2.1"> + + java:jboss/datasources/xcs - - - - - + es.uvigo.esei.xcs.domain.entities.Owner + es.uvigo.esei.xcs.domain.entities.Pet + es.uvigo.esei.xcs.domain.entities.Administrator + false + + + + + + \ No newline at end of file diff --git a/service/src/test/java/es/uvigo/esei/xcs/service/OwnerServiceIllegalAccessIntegrationTest.java b/service/src/test/java/es/uvigo/esei/xcs/service/OwnerServiceIllegalAccessIntegrationTest.java index a7e8c9e..2bb24f3 100644 --- a/service/src/test/java/es/uvigo/esei/xcs/service/OwnerServiceIllegalAccessIntegrationTest.java +++ b/service/src/test/java/es/uvigo/esei/xcs/service/OwnerServiceIllegalAccessIntegrationTest.java @@ -46,6 +46,8 @@ public class OwnerServiceIllegalAccessIntegrationTest { .addPackage(Owner.class.getPackage()) .addAsResource("test-persistence.xml", "META-INF/persistence.xml") .addAsWebInfResource("jboss-web.xml") + .addAsResource("arquillian.extension.persistence.properties") + .addAsResource("arquillian.extension.persistence.dbunit.properties") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); return archive; diff --git a/service/src/test/java/es/uvigo/esei/xcs/service/OwnerServiceIntegrationTest.java b/service/src/test/java/es/uvigo/esei/xcs/service/OwnerServiceIntegrationTest.java index 0a7e3bd..d13da1e 100644 --- a/service/src/test/java/es/uvigo/esei/xcs/service/OwnerServiceIntegrationTest.java +++ b/service/src/test/java/es/uvigo/esei/xcs/service/OwnerServiceIntegrationTest.java @@ -64,6 +64,8 @@ public class OwnerServiceIntegrationTest { .addPackage(Owner.class.getPackage()) .addAsResource("test-persistence.xml", "META-INF/persistence.xml") .addAsWebInfResource("jboss-web.xml") + .addAsResource("arquillian.extension.persistence.properties") + .addAsResource("arquillian.extension.persistence.dbunit.properties") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); } diff --git a/service/src/test/java/es/uvigo/esei/xcs/service/PetServiceIllegalAccessIntegrationTest.java b/service/src/test/java/es/uvigo/esei/xcs/service/PetServiceIllegalAccessIntegrationTest.java index 67b7ee4..c4b7d46 100644 --- a/service/src/test/java/es/uvigo/esei/xcs/service/PetServiceIllegalAccessIntegrationTest.java +++ b/service/src/test/java/es/uvigo/esei/xcs/service/PetServiceIllegalAccessIntegrationTest.java @@ -54,6 +54,8 @@ public class PetServiceIllegalAccessIntegrationTest { .addPackage(Pet.class.getPackage()) .addAsResource("test-persistence.xml", "META-INF/persistence.xml") .addAsWebInfResource("jboss-web.xml") + .addAsResource("arquillian.extension.persistence.properties") + .addAsResource("arquillian.extension.persistence.dbunit.properties") .addAsWebInfResource("beans.xml", "beans.xml"); return archive; diff --git a/service/src/test/java/es/uvigo/esei/xcs/service/PetServiceIntegrationTest.java b/service/src/test/java/es/uvigo/esei/xcs/service/PetServiceIntegrationTest.java index fb55283..d1ba538 100644 --- a/service/src/test/java/es/uvigo/esei/xcs/service/PetServiceIntegrationTest.java +++ b/service/src/test/java/es/uvigo/esei/xcs/service/PetServiceIntegrationTest.java @@ -63,6 +63,8 @@ public class PetServiceIntegrationTest { .addPackage(Pet.class.getPackage()) .addAsResource("test-persistence.xml", "META-INF/persistence.xml") .addAsWebInfResource("jboss-web.xml") + .addAsResource("arquillian.extension.persistence.properties") + .addAsResource("arquillian.extension.persistence.dbunit.properties") .addAsWebInfResource("beans.xml", "beans.xml"); } diff --git a/service/src/test/resources-wildfly-embedded-h2/arquillian.extension.persistence.dbunit.properties b/service/src/test/resources-wildfly-embedded-h2/arquillian.extension.persistence.dbunit.properties new file mode 100644 index 0000000..2c5132e --- /dev/null +++ b/service/src/test/resources-wildfly-embedded-h2/arquillian.extension.persistence.dbunit.properties @@ -0,0 +1 @@ +datatypeFactory = org.dbunit.ext.h2.H2DataTypeFactory \ No newline at end of file diff --git a/service/src/test/resources-wildfly-embedded-mysql/arquillian.extension.persistence.dbunit.properties b/service/src/test/resources-wildfly-embedded-mysql/arquillian.extension.persistence.dbunit.properties new file mode 100644 index 0000000..2c5132e --- /dev/null +++ b/service/src/test/resources-wildfly-embedded-mysql/arquillian.extension.persistence.dbunit.properties @@ -0,0 +1 @@ +datatypeFactory = org.dbunit.ext.h2.H2DataTypeFactory \ No newline at end of file diff --git a/service/src/test/resources/arquillian.extension.persistence.properties b/service/src/test/resources/arquillian.extension.persistence.properties new file mode 100644 index 0000000..a7941bc --- /dev/null +++ b/service/src/test/resources/arquillian.extension.persistence.properties @@ -0,0 +1,3 @@ +defaultDataSeedStrategy = CLEAN_INSERT +defaultCleanupPhase = BEFORE +defaultDataSource = java:jboss/datasources/xcs diff --git a/service/src/test/resources/arquillian.xml b/service/src/test/resources/arquillian.xml index 148298c..f1f3f35 100644 --- a/service/src/test/resources/arquillian.xml +++ b/service/src/test/resources/arquillian.xml @@ -4,19 +4,21 @@ xsi:schemaLocation=" http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> - - - CLEAN_INSERT - - - - - target/wildfly-${wildfly.version} - target/wildfly-${wildfly.version}/modules - 19990 - - - 18080 - - + + CLEAN_INSERT + BEFORE + java:jboss/datasources/xcs + + + + + target/wildfly-${wildfly.version} + target/wildfly-${wildfly.version}/modules + ${wildfly.management.port} + + + + ${wildfly.http.port} + + \ No newline at end of file diff --git a/service/src/test/resources/test-persistence.xml b/service/src/test/resources/test-persistence.xml index 1d6b2be..7b52583 100644 --- a/service/src/test/resources/test-persistence.xml +++ b/service/src/test/resources/test-persistence.xml @@ -1,17 +1,20 @@ - - java:jboss/datasources/xcs - - false - - - - - - + version="2.1"> + + java:jboss/datasources/xcs + + es.uvigo.esei.xcs.domain.entities.Owner + es.uvigo.esei.xcs.domain.entities.Pet + es.uvigo.esei.xcs.domain.entities.Administrator + false + + + + + + \ No newline at end of file diff --git a/tests/src/main/resources/logging.properties b/tests/src/main/resources/logging.properties new file mode 100644 index 0000000..803eadb --- /dev/null +++ b/tests/src/main/resources/logging.properties @@ -0,0 +1,56 @@ +# +# JBoss, Home of Professional Open Source. +# Copyright 2013, Red Hat, Inc., and individual contributors +# as indicated by the @author tags. See the copyright.txt file in the +# distribution for a full listing of individual contributors. +# +# This is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of +# the License, or (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this software; if not, write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +# 02110-1301 USA, or see the FSF site: http://www.fsf.org. +# + +# Additional loggers to configure (the root logger is always configured) +loggers=com.arjuna,jacorb,org.jboss.as.config,org.apache.tomcat.util.modeler,sun.rmi,jacorb.config + +logger.level=INFO +logger.handlers=CONSOLE + +logger.com.arjuna.level=WARN +logger.com.arjuna.useParentHandlers=true + +logger.jacorb.level=WARN +logger.jacorb.useParentHandlers=true + +logger.org.jboss.as.config.level=DEBUG +logger.org.jboss.as.config.useParentHandlers=true + +logger.org.apache.tomcat.util.modeler.level=WARN +logger.org.apache.tomcat.util.modeler.useParentHandlers=true + +logger.sun.rmi.level=WARN +logger.sun.rmi.useParentHandlers=true + +logger.jacorb.config.level=ERROR +logger.jacorb.config.useParentHandlers=true + +handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler +handler.CONSOLE.level=INFO +handler.CONSOLE.formatter=COLOR-PATTERN +handler.CONSOLE.properties=autoFlush,target +handler.CONSOLE.autoFlush=true +handler.CONSOLE.target=SYSTEM_OUT + +formatter.COLOR-PATTERN=org.jboss.logmanager.formatters.PatternFormatter +formatter.COLOR-PATTERN.properties=pattern +formatter.COLOR-PATTERN.pattern=%K{level}%d{HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%E%n -- 2.18.1