From 667186e446b048355718bc91fab654803ba14de7 Mon Sep 17 00:00:00 2001 From: Miguel Reboiro-Jato Date: Wed, 19 Oct 2016 17:10:48 +0200 Subject: [PATCH] Improves the management and configuration of the project The project configuration has been simplified by unifying some part of the mysql and h2 configurations. In addition, the project has been configured to allow the execution of the application with the Maven WildFly plugin. --- README.md | 91 ++-- additional-material/db/xcs-sample-mysql.sql | 56 +++ .../db/xcs-sample-test-mysql.sql | 35 ++ additional-material/wildfly/standalone.xml | 424 ++++++++++++++++++ ear/pom.xml | 1 - .../esei/xcs/jsf/JsfIntegrationTestSuite.java | 12 + .../standalone.xml | 12 +- .../test-persistence.xml | 17 - .../standalone.xml | 2 +- jsf/src/test/resources/arquillian.xml | 11 +- .../beans.xml | 0 .../src/test/resources}/test-persistence.xml | 2 +- pom.xml | 118 ++++- .../rest/ResourceIntegrationTestSuite.java | 12 + .../esei/xcs/rest/ResourceUnitTestSuite.java | 12 + .../standalone.xml | 12 +- .../test-persistence.xml | 17 - .../beans.xml | 11 - .../standalone.xml | 2 +- rest/src/test/resources/arquillian.xml | 9 +- .../beans.xml | 1 - .../test-persistence.xml | 4 +- .../resources-wildfly-embedded-h2/beans.xml | 11 - .../standalone.xml | 12 +- .../test-persistence.xml | 17 - .../beans.xml | 11 - .../standalone.xml | 2 +- service/src/test/resources/arquillian.xml | 9 +- .../src/test/resources}/beans.xml | 0 .../src/test/resources}/test-persistence.xml | 0 30 files changed, 744 insertions(+), 179 deletions(-) create mode 100644 additional-material/db/xcs-sample-mysql.sql create mode 100644 additional-material/db/xcs-sample-test-mysql.sql create mode 100644 additional-material/wildfly/standalone.xml create mode 100644 jsf/src/test/java/es/uvigo/esei/xcs/jsf/JsfIntegrationTestSuite.java delete mode 100644 jsf/src/test/resources-wildfly-embedded-h2/test-persistence.xml rename jsf/src/test/{resources-wildfly-embedded-h2 => resources}/beans.xml (100%) rename {service/src/test/resources-wildfly-embedded-mysql => jsf/src/test/resources}/test-persistence.xml (97%) create mode 100644 rest/src/test/java/es/uvigo/esei/xcs/rest/ResourceIntegrationTestSuite.java create mode 100644 rest/src/test/java/es/uvigo/esei/xcs/rest/ResourceUnitTestSuite.java delete mode 100644 rest/src/test/resources-wildfly-embedded-h2/test-persistence.xml delete mode 100644 rest/src/test/resources-wildfly-embedded-mysql/beans.xml rename rest/src/test/{resources-wildfly-embedded-h2 => resources}/beans.xml (99%) rename rest/src/test/{resources-wildfly-embedded-mysql => resources}/test-persistence.xml (87%) delete mode 100644 service/src/test/resources-wildfly-embedded-h2/beans.xml delete mode 100644 service/src/test/resources-wildfly-embedded-h2/test-persistence.xml delete mode 100644 service/src/test/resources-wildfly-embedded-mysql/beans.xml rename {jsf/src/test/resources-wildfly-embedded-mysql => service/src/test/resources}/beans.xml (100%) rename {jsf/src/test/resources-wildfly-embedded-mysql => service/src/test/resources}/test-persistence.xml (100%) diff --git a/README.md b/README.md index 6da98da..90c1aa1 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ the XCS subject inside the DGSS itinerary. ## Deployment Environment The environment is based on Maven 3, MySQL 5.5, WildFly 8.2.1 and Eclipse Neon -for JEE. +for JavaEE. ### Java JDK 8 Download and install Java JDK 8, preferably the Oracle version (the commands @@ -14,7 +14,8 @@ Download and install Java JDK 8, preferably the Oracle version (the commands ### Maven 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!!**). ### Git First, install Git in your system if it was not installed (the `git` command @@ -24,9 +25,7 @@ Concretely, we will work with a Git repository inside 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 - ``` ### Eclipse @@ -39,34 +38,45 @@ Select your source code folder (where the `pom.xml` should be placed). Eclipse should then import a parent project (`xcs-sample`) and 6 child projects (`tests`, `domain`, `service`, `rest`, `jsf` and `ear`). -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. +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. ### MySQL 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. -The server can be installed as usual, but it must contain the `xcs` database and -the user `xcs` identified by `xcs` should have all privileges on this database. -You can do this by executing the following commands: +The server can be installed as usual, but it must contain two databases: + * The `xcs` database for running the application. + * The `xcssampletest` database for testing the appliaction. + +In both cases, the user `xcs` identified by `xcs` should have all privileges on +this database. You can do this by executing the following commands: + ```sql CREATE DATABASE xcs; GRANT ALL PRIVILEGES ON xcs TO xcs@localhost IDENTIFIED BY 'xcs'; FLUSH PRIVILEGES; + +CREATE DATABASE xcssampletest; +GRANT ALL PRIVILEGES ON xcssampletest TO xcs@localhost IDENTIFIED BY 'xcs'; +FLUSH PRIVILEGES; ``` -If you want to add some data to this database to run the application, you can -also execute: -```sql +If you want to add some data to the `xcs` database to run the application (data +will be automatically inseted to the `xcssampletest` database during the tests), + you can also execute: - DROP TABLE IF EXISTS `User`; +```sql + DROP TABLE IF EXISTS `User`; CREATE TABLE `User` ( `role` varchar(5) NOT NULL, `login` varchar(100) NOT NULL, `password` varchar(32) NOT NULL, PRIMARY KEY (`login`) ); - + DROP TABLE IF EXISTS `Pet`; CREATE TABLE `Pet` ( `id` int(11) NOT NULL AUTO_INCREMENT, @@ -78,7 +88,7 @@ also execute: KEY `FK_6mfctqh1tpytabbk1u4bk1pym` (`owner`), CONSTRAINT `FK_6mfctqh1tpytabbk1u4bk1pym` FOREIGN KEY (`owner`) REFERENCES `User` (`login`) ); - + -- All the passwords are "pass". INSERT INTO `User` VALUES ('ADMIN','jose','A3F6F4B40B24E2FD61F08923ED452F34'), @@ -86,7 +96,7 @@ also execute: ('OWNER','juan','B4FBB95580592697DC71488A1F19277E'), ('OWNER','ana','22BEEAE33E9B2657F9610621502CD7A4'), ('OWNER','lorena','05009E420932C21E5A68F5EF1AADD530'); - + INSERT INTO `Pet` (animal, birth, name, owner) VALUES ('CAT','2000-01-01 01:01:01','Pepecat','pepe'), ('CAT','2000-01-01 01:01:01','Max','juan'), @@ -94,20 +104,28 @@ also execute: ('CAT','2000-01-01 01:01:01','Anacat','ana'), ('DOG','2000-01-01 01:01:01','Max','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 +with these queries stored in the `additional-material/db` project folder. + ### Wildfly 8 Before we can run the project, we need to configure a WildFly server to include the datasource used by the application and the security configuration. +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` folder 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). + #### Datasource There are several ways to add a datasource to a WildFly server. We are going to add a new datasource to 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 mysql-connector-java-5.1.21.jar @@ -119,7 +137,6 @@ the following content to the `` element: xcs - ``` In addition, you also have to add the MySQL driver to the deployments folder @@ -132,18 +149,15 @@ All the WildFly security configuration is done in the Inside the `` element you have to add: ```xml - - ``` And inside the `` element you have to add: ```xml - @@ -163,7 +177,6 @@ And inside the `` element you have to add: - ``` #### Deploying the application @@ -177,7 +190,25 @@ the entire application. To do so, you can copy this file to 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/` +`http://localhost:8080/`. + +#### Running the application +This project includes the Maven WildFly plugin, which allows the execution of +the project without needing an external WildFly server. To run the application +with the running MySQL database (`xcs`) you just have to go to the `ear` module +and execute the following command: + +```bash + mvn wildfly:start wildfly:deploy -P wildfly-embedded-mysql,-wildfly-embedded-h2 +``` + +Once the application is running you can access it in the URL `http://localhost:8080/xcs-sample/jsf`. + +To stop the WildFly lauched you can execute the following command: + +```bash + mvn wildfly:shutdown +``` ## Sample 1: Testing entities Using JUnit and Hamcrest, we will see how to test JPA entities or any other @@ -281,17 +312,3 @@ execution, making it very precise. 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. - -## Wildfly Deployment -The Wildfly Maven plugin is now part of the project. This plugin allows the -automatic deployment of the project in a Wildfly server running with a port -offset of 1000 (this means that the Wildfly uses the 9080 port as the HTTP port -and the 10990 as the management port). - -The offset of a Wildfly server can be changed using the system property `jboss.socket.binding.port-offset`. For example, starting Wildfly with the -command: -```bash - - $WILDFLY_HOME/bin/standalone.sh -Djboss.socket.binding.port-offset=1000 - -``` diff --git a/additional-material/db/xcs-sample-mysql.sql b/additional-material/db/xcs-sample-mysql.sql new file mode 100644 index 0000000..5a3e468 --- /dev/null +++ b/additional-material/db/xcs-sample-mysql.sql @@ -0,0 +1,56 @@ +CREATE DATABASE IF NOT EXISTS `xcs`; +USE `xcs`; + +DROP TABLE IF EXISTS `Pet`; +DROP TABLE IF EXISTS `User`; + +-- +-- Table structure for table `User` +-- +CREATE TABLE `User` ( + `role` varchar(5) NOT NULL, + `login` varchar(100) NOT NULL, + `password` varchar(32) NOT NULL, + PRIMARY KEY (`login`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Table structure for table `Pet` +-- +CREATE TABLE `Pet` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `animal` varchar(4) NOT NULL, + `birth` datetime NOT NULL, + `name` varchar(100) NOT NULL, + `owner` varchar(100) NOT NULL, + PRIMARY KEY (`id`), + KEY `FK_Pet_Owner` (`owner`), + CONSTRAINT `FK_Pet_Owner_login` FOREIGN KEY (`owner`) REFERENCES `User` (`login`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- User creation +-- +GRANT ALL PRIVILEGES ON xcs.* TO xcs@localhost IDENTIFIED BY 'xcs'; +FLUSH PRIVILEGES; + +-- +-- Data for table `User` +-- +INSERT INTO `User` (role, login, password) VALUES + ('ADMIN','jose','a3f6f4b40b24e2fd61f08923ed452f34'), + ('OWNER','ana','22beeae33e9b2657f9610621502cd7a4'), + ('OWNER','juan','b4fbb95580592697dc71488a1f19277e'), + ('OWNER','lorena','05009e420932c21e5a68f5ef1aadd530'), + ('OWNER','pepe','b43b4d046860b2bd945bca2597bf9f07'); + +-- +-- Data for table `Pet` +-- +INSERT INTO `Pet` (animal, birth, name, owner) VALUES + ('CAT','2000-01-01 01:01:01','Pepecat','pepe'), + ('CAT','2000-01-01 01:01:01','Max','juan'), + ('DOG','2000-01-01 01:01:01','Juandog','juan'), + ('CAT','2000-01-01 01:01:01','Anacat','ana'), + ('DOG','2000-01-01 01:01:01','Max','ana'), + ('BIRD','2000-01-01 01:01:01','Anabird','ana'); diff --git a/additional-material/db/xcs-sample-test-mysql.sql b/additional-material/db/xcs-sample-test-mysql.sql new file mode 100644 index 0000000..ad6b19a --- /dev/null +++ b/additional-material/db/xcs-sample-test-mysql.sql @@ -0,0 +1,35 @@ +CREATE DATABASE IF NOT EXISTS `xcssampletest`; +USE `xcssampletest`; + +DROP TABLE IF EXISTS `Pet`; +DROP TABLE IF EXISTS `User`; + +-- +-- Table structure for table `User` +-- +CREATE TABLE `User` ( + `role` varchar(5) NOT NULL, + `login` varchar(100) NOT NULL, + `password` varchar(32) NOT NULL, + PRIMARY KEY (`login`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Table structure for table `Pet` +-- +CREATE TABLE `Pet` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `animal` varchar(4) NOT NULL, + `birth` datetime NOT NULL, + `name` varchar(100) NOT NULL, + `owner` varchar(100) NOT NULL, + PRIMARY KEY (`id`), + KEY `FK_Pet_Owner` (`owner`), + CONSTRAINT `FK_Pet_Owner_login` FOREIGN KEY (`owner`) REFERENCES `User` (`login`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- User creation +-- +GRANT ALL PRIVILEGES ON xcssampletest.* TO xcs@localhost IDENTIFIED BY 'xcs'; +FLUSH PRIVILEGES; \ No newline at end of file diff --git a/additional-material/wildfly/standalone.xml b/additional-material/wildfly/standalone.xml new file mode 100644 index 0000000..048d22f --- /dev/null +++ b/additional-material/wildfly/standalone.xml @@ -0,0 +1,424 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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-${mysql.version}.jar + + xcs + xcs + + + + + org.h2.jdbcx.JdbcDataSource + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${jboss.bind.address:127.0.0.1} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ear/pom.xml b/ear/pom.xml index 6cea06b..e9b71ac 100644 --- a/ear/pom.xml +++ b/ear/pom.xml @@ -68,7 +68,6 @@ wildfly-maven-plugin false - 10990 ${project.parent.artifactId}-${project.version}.${project.packaging} diff --git a/jsf/src/test/java/es/uvigo/esei/xcs/jsf/JsfIntegrationTestSuite.java b/jsf/src/test/java/es/uvigo/esei/xcs/jsf/JsfIntegrationTestSuite.java new file mode 100644 index 0000000..6640ef7 --- /dev/null +++ b/jsf/src/test/java/es/uvigo/esei/xcs/jsf/JsfIntegrationTestSuite.java @@ -0,0 +1,12 @@ +package es.uvigo.esei.xcs.jsf; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@SuiteClasses({ + OwnerJsfTest.class +}) +@RunWith(Suite.class) +public class JsfIntegrationTestSuite { +} diff --git a/jsf/src/test/resources-wildfly-embedded-h2/standalone.xml b/jsf/src/test/resources-wildfly-embedded-h2/standalone.xml index fd979b9..beb04e7 100644 --- a/jsf/src/test/resources-wildfly-embedded-h2/standalone.xml +++ b/jsf/src/test/resources-wildfly-embedded-h2/standalone.xml @@ -144,12 +144,12 @@ - - jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + + jdbc:h2:mem:xcssampletest;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE h2 - sa - sa + xcs + xcs @@ -178,7 +178,7 @@ - + @@ -331,7 +331,7 @@ - + - - - java:jboss/datasources/ExampleDS - - false - - - - - - - \ No newline at end of file diff --git a/jsf/src/test/resources-wildfly-embedded-mysql/standalone.xml b/jsf/src/test/resources-wildfly-embedded-mysql/standalone.xml index 048d22f..8cbb9af 100644 --- a/jsf/src/test/resources-wildfly-embedded-mysql/standalone.xml +++ b/jsf/src/test/resources-wildfly-embedded-mysql/standalone.xml @@ -153,7 +153,7 @@ - jdbc:mysql://localhost:3306/xcs + jdbc:mysql://localhost:3306/xcssampletest com.mysql.jdbc.Driver mysql-connector-java-${mysql.version}.jar diff --git a/jsf/src/test/resources/arquillian.xml b/jsf/src/test/resources/arquillian.xml index 964f078..0e0f3e6 100644 --- a/jsf/src/test/resources/arquillian.xml +++ b/jsf/src/test/resources/arquillian.xml @@ -8,19 +8,12 @@ CLEAN_INSERT - + firefox - - - - target/wildfly-${wildfly.version} - target/wildfly-${wildfly.version}/modules - - - + target/wildfly-${wildfly.version} target/wildfly-${wildfly.version}/modules diff --git a/jsf/src/test/resources-wildfly-embedded-h2/beans.xml b/jsf/src/test/resources/beans.xml similarity index 100% rename from jsf/src/test/resources-wildfly-embedded-h2/beans.xml rename to jsf/src/test/resources/beans.xml diff --git a/service/src/test/resources-wildfly-embedded-mysql/test-persistence.xml b/jsf/src/test/resources/test-persistence.xml similarity index 97% rename from service/src/test/resources-wildfly-embedded-mysql/test-persistence.xml rename to jsf/src/test/resources/test-persistence.xml index 1d6b2be..ca6c15c 100644 --- a/service/src/test/resources-wildfly-embedded-mysql/test-persistence.xml +++ b/jsf/src/test/resources/test-persistence.xml @@ -8,7 +8,7 @@ java:jboss/datasources/xcs false - + diff --git a/pom.xml b/pom.xml index 50cbb0e..80616e8 100644 --- a/pom.xml +++ b/pom.xml @@ -181,7 +181,7 @@ mysql mysql-connector-java - ${mysql.connector.java} + ${mysql.connector.java.version} org.slf4j @@ -276,6 +276,10 @@ org.apache.maven.plugins maven-surefire-plugin ${maven.surefire.plugin.version} + + + **/*TestSuite.java + org.apache.maven.plugins @@ -416,7 +420,7 @@ org.jboss.logmanager.LogManager ${wildfly.version} - wildfly-embedded-h2 + wildfly-embedded false @@ -470,6 +474,52 @@ + + + org.wildfly.plugins + wildfly-maven-plugin + + + + + data-source add --jndi-name=java:jboss/datasources/xcs --name=xcs-sample --jta=true --use-ccm=true --connection-url=jdbc:h2:mem:xcs;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE --driver-name=h2 --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=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")]}]) + + + + + :reload + + + + + + wildfly-admin + xcsadmin + false + + + admin + adminpass + true + ADMIN + + + owner + ownerpass + true + OWNER + + + + + @@ -517,7 +567,7 @@ org.jboss.logmanager.LogManager ${mysql.connector.java.version} ${wildfly.version} - wildfly-embedded-mysql + wildfly-embedded false @@ -546,7 +596,7 @@ - copy-dependencies + copy-mysql process-test-classes copy @@ -556,14 +606,33 @@ mysql mysql-connector-java - ${mysql.connector.java.version} jar false - target/wildfly-${wildfly.version}/standalone/deployments + ${project.build.directory}/wildfly-${wildfly.version}/standalone/deployments + + copy-mysql-for-execution + process-test-classes + + copy + + + + + mysql + mysql-connector-java + jar + false + ${project.build.directory} + mysql-connector-java-${mysql.connector.java.version}.jar + + + + + @@ -578,7 +647,7 @@ copy-resources - target/wildfly-${wildfly.version}/standalone/configuration + ${project.build.directory}/wildfly-${wildfly.version}/standalone/configuration src/test/resources-wildfly-embedded-mysql @@ -589,6 +658,41 @@ + + + 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 + /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=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")]}]) + + + + + :reload + + + + + + wildfly-admin + xcsadmin + false + + + + + diff --git a/rest/src/test/java/es/uvigo/esei/xcs/rest/ResourceIntegrationTestSuite.java b/rest/src/test/java/es/uvigo/esei/xcs/rest/ResourceIntegrationTestSuite.java new file mode 100644 index 0000000..bf9224e --- /dev/null +++ b/rest/src/test/java/es/uvigo/esei/xcs/rest/ResourceIntegrationTestSuite.java @@ -0,0 +1,12 @@ +package es.uvigo.esei.xcs.rest; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@SuiteClasses({ + OwnerResourceRestTest.class +}) +@RunWith(Suite.class) +public class ResourceIntegrationTestSuite { +} diff --git a/rest/src/test/java/es/uvigo/esei/xcs/rest/ResourceUnitTestSuite.java b/rest/src/test/java/es/uvigo/esei/xcs/rest/ResourceUnitTestSuite.java new file mode 100644 index 0000000..fd95529 --- /dev/null +++ b/rest/src/test/java/es/uvigo/esei/xcs/rest/ResourceUnitTestSuite.java @@ -0,0 +1,12 @@ +package es.uvigo.esei.xcs.rest; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@SuiteClasses({ + OwnerResourceUnitTest.class +}) +@RunWith(Suite.class) +public class ResourceUnitTestSuite { +} diff --git a/rest/src/test/resources-wildfly-embedded-h2/standalone.xml b/rest/src/test/resources-wildfly-embedded-h2/standalone.xml index fd979b9..beb04e7 100644 --- a/rest/src/test/resources-wildfly-embedded-h2/standalone.xml +++ b/rest/src/test/resources-wildfly-embedded-h2/standalone.xml @@ -144,12 +144,12 @@ - - jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + + jdbc:h2:mem:xcssampletest;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE h2 - sa - sa + xcs + xcs @@ -178,7 +178,7 @@ - + @@ -331,7 +331,7 @@ - + - - - java:jboss/datasources/ExampleDS - - false - - - - - - - \ No newline at end of file diff --git a/rest/src/test/resources-wildfly-embedded-mysql/beans.xml b/rest/src/test/resources-wildfly-embedded-mysql/beans.xml deleted file mode 100644 index 01d52d1..0000000 --- a/rest/src/test/resources-wildfly-embedded-mysql/beans.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - es.uvigo.esei.xcs.service.util.security.TestPrincipal - - - diff --git a/rest/src/test/resources-wildfly-embedded-mysql/standalone.xml b/rest/src/test/resources-wildfly-embedded-mysql/standalone.xml index 048d22f..8cbb9af 100644 --- a/rest/src/test/resources-wildfly-embedded-mysql/standalone.xml +++ b/rest/src/test/resources-wildfly-embedded-mysql/standalone.xml @@ -153,7 +153,7 @@ - jdbc:mysql://localhost:3306/xcs + jdbc:mysql://localhost:3306/xcssampletest com.mysql.jdbc.Driver mysql-connector-java-${mysql.version}.jar diff --git a/rest/src/test/resources/arquillian.xml b/rest/src/test/resources/arquillian.xml index dd1edb8..3c8578c 100644 --- a/rest/src/test/resources/arquillian.xml +++ b/rest/src/test/resources/arquillian.xml @@ -8,15 +8,8 @@ CLEAN_INSERT - - - - target/wildfly-${wildfly.version} - target/wildfly-${wildfly.version}/modules - - - + target/wildfly-${wildfly.version} target/wildfly-${wildfly.version}/modules diff --git a/rest/src/test/resources-wildfly-embedded-h2/beans.xml b/rest/src/test/resources/beans.xml similarity index 99% rename from rest/src/test/resources-wildfly-embedded-h2/beans.xml rename to rest/src/test/resources/beans.xml index 01d52d1..bc2f9c3 100644 --- a/rest/src/test/resources-wildfly-embedded-h2/beans.xml +++ b/rest/src/test/resources/beans.xml @@ -8,4 +8,3 @@ es.uvigo.esei.xcs.service.util.security.TestPrincipal - diff --git a/rest/src/test/resources-wildfly-embedded-mysql/test-persistence.xml b/rest/src/test/resources/test-persistence.xml similarity index 87% rename from rest/src/test/resources-wildfly-embedded-mysql/test-persistence.xml rename to rest/src/test/resources/test-persistence.xml index 1d6b2be..3911dc7 100644 --- a/rest/src/test/resources-wildfly-embedded-mysql/test-persistence.xml +++ b/rest/src/test/resources/test-persistence.xml @@ -5,10 +5,10 @@ http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd" version="2.1"> - java:jboss/datasources/xcs + java:jboss/datasources/xcs false - + diff --git a/service/src/test/resources-wildfly-embedded-h2/beans.xml b/service/src/test/resources-wildfly-embedded-h2/beans.xml deleted file mode 100644 index 01d52d1..0000000 --- a/service/src/test/resources-wildfly-embedded-h2/beans.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - es.uvigo.esei.xcs.service.util.security.TestPrincipal - - - diff --git a/service/src/test/resources-wildfly-embedded-h2/standalone.xml b/service/src/test/resources-wildfly-embedded-h2/standalone.xml index fd979b9..beb04e7 100644 --- a/service/src/test/resources-wildfly-embedded-h2/standalone.xml +++ b/service/src/test/resources-wildfly-embedded-h2/standalone.xml @@ -144,12 +144,12 @@ - - jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + + jdbc:h2:mem:xcssampletest;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE h2 - sa - sa + xcs + xcs @@ -178,7 +178,7 @@ - + @@ -331,7 +331,7 @@ - + - - - java:jboss/datasources/ExampleDS - - false - - - - - - - \ No newline at end of file diff --git a/service/src/test/resources-wildfly-embedded-mysql/beans.xml b/service/src/test/resources-wildfly-embedded-mysql/beans.xml deleted file mode 100644 index 01d52d1..0000000 --- a/service/src/test/resources-wildfly-embedded-mysql/beans.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - es.uvigo.esei.xcs.service.util.security.TestPrincipal - - - diff --git a/service/src/test/resources-wildfly-embedded-mysql/standalone.xml b/service/src/test/resources-wildfly-embedded-mysql/standalone.xml index 048d22f..8cbb9af 100644 --- a/service/src/test/resources-wildfly-embedded-mysql/standalone.xml +++ b/service/src/test/resources-wildfly-embedded-mysql/standalone.xml @@ -153,7 +153,7 @@ - jdbc:mysql://localhost:3306/xcs + jdbc:mysql://localhost:3306/xcssampletest com.mysql.jdbc.Driver mysql-connector-java-${mysql.version}.jar diff --git a/service/src/test/resources/arquillian.xml b/service/src/test/resources/arquillian.xml index 281724d..3c8578c 100644 --- a/service/src/test/resources/arquillian.xml +++ b/service/src/test/resources/arquillian.xml @@ -8,15 +8,8 @@ CLEAN_INSERT - - - - target/wildfly-${wildfly.version} - target/wildfly-${wildfly.version}/modules - - - + target/wildfly-${wildfly.version} target/wildfly-${wildfly.version}/modules diff --git a/jsf/src/test/resources-wildfly-embedded-mysql/beans.xml b/service/src/test/resources/beans.xml similarity index 100% rename from jsf/src/test/resources-wildfly-embedded-mysql/beans.xml rename to service/src/test/resources/beans.xml diff --git a/jsf/src/test/resources-wildfly-embedded-mysql/test-persistence.xml b/service/src/test/resources/test-persistence.xml similarity index 100% rename from jsf/src/test/resources-wildfly-embedded-mysql/test-persistence.xml rename to service/src/test/resources/test-persistence.xml -- 2.18.1