Another crowdfunding project, by Ensimag's students. The code is available here.
Have a look to our quick reminder!
You will need a mysql database. An easy way to get one is to use docker.
First, install docker and mysql-client
. Running these should be enough
sudo apt-get install docker.io mysql-client
If needed, run the docker deamon.
Create and run the container named mysql-dac containing a mysql server with user dac and password coucou and database dac:
sudo docker run --name mysql-dac -e MYSQL_ROOT_PASSWORD=coucou -e MYSQL_USER=dac -e MYSQL_PASSWORD=coucou -e MYSQL_DATABASE=dac --net=host -d mysql
To stop the mysql server container:
sudo docker stop mysql-dac
To resume the mysql server container:
sudo docker start mysql-dac
The database keeps its state when the container is stopped (No need to recreate the table).
Run:
brew install mysql
mysql.server start
mysql -uroot
Then in the mysql
prompt:
CREATE USER 'dac'@'localhost' IDENTIFIED BY 'coucou';
GRANT ALL PRIVILEGES ON * . * TO 'dac'@'localhost';
FLUSH PRIVILEGES;
To create the tables, do:
mysql -udac -pcoucou -h127.0.0.1 -Ddac < sql/create.sql
To populate the database, do:
mysql -udac -pcoucou -h127.0.0.1 -Ddac < sql/populate.sql
Download and unpack Glassfish, or use Netbeans to install it.
Set $GLASSFISH_HOME
in your .bashrc
:
export GLASSFISH_HOME=...
Download the JDBC driver for MySQL from
http://dev.mysql.com/downloads/connector/j/3.1.html
Extract it and put the mysql-connector-java-3.1.14-bin.jar
in
$GLASSFISH_HOME/glassfish/lib
To setup the ressource jdbc/dac
and the connection pool dac
, copy
domain.xml
, which can be found at the root of the project, to
$GLASSFISH_HOME/glassfish/domains/domain1/config
You need to set $GLASSFISH_HOME
for Netbeans.
- Go to your
<netbeans intallation folder>/etc
- Add the following line at the end of
netbeans.conf
export GLASSFISH_HOME
- Right click on the maven project
ear
- Build with dependencies
- Right click on the maven project
ear
- Run
$GLASSFISH_HOME/glassfish/bin/asadmin start-domain
mvn clean
mvn install
cd ear
mvn glassfish:deploy
The web site is available at http://localhost:8080/web
mvn test -DskipEjbTests=false
mvn test -DskipSeleniumTests=false
Clean database after execution of Selenium tests
mysql -udac -pcoucou -h127.0.0.1 -Ddac < sql/create.sql
mysql -udac -pcoucou -h127.0.0.1 -Ddac < sql/populate.sql
cd ejb
mvn clean compile exec:exec cobertura:cobertura -DskipEjbTests=false
The report website index can be found at ejb/target/site/cobertura/index.html
If you followed our instructions, these lines should be valid...
- MySQL dac:coucou root:dac
- Glassfish admin: (no password)
- VM equipe2:dac root:dac
- Application admin account admin@dac.com:dac
- The ejb's coverage
ejb/target/site/cobertura/index.html
- Start MySQL
sudo docker start mysql-dac
- Stop MySQL
sudo docker stop mysql-dac
- Create tables
mysql -udac -pcoucou -h127.0.0.1 -Ddac < sql/create.sql
- Populate tables
mysql -udac -pcoucou -h127.0.0.1 -Ddac < sql/populate.sql
- Log into MySQL
mysql -udac -pcoucou -h127.0.0.1 -Ddac
- Start Glassfish
$GLASSFISH_HOME/glassfish/bin/asadmin start-domain
- Stop Glassfish
$GLASSFISH_HOME/glassfish/bin/asadmin stop-domain
- Clean
mvn clean
- Build
mvn install
- Deploy from command-line
mvn glassfish:deploy
(in ear/) - Undeploy
$GLASSFISH_HOME/glassfish/bin/asadmin undeploy ear
- Run Ejb tests
mvn test -DskipEjbTests=false
- Run Selenium tests
mvn test -DskipSeleniumTests=false
(clean the database before running selenium tests. See above) - Generate ejb's coverage report
mvn clean compile exec:exec cobertura:cobertura -DskipEjbTests=false
(in ejb/)