воскресенье, 6 декабря 2015 г.

Arquillian testing

Wanted to learn more about testing with Arquillian and how to use ShrinkWrap API to create deployment artifacts?

Actually, a lot of useful information can be found in the book Continuous Enterprise Development in Java. Although all the information can be found on the Internet this book has consistency in how this information present. So, you shouldn't strive to find any more information regarding the API.

пятница, 4 декабря 2015 г.

Arquillian integration testing with DB2 and Wildlfy 8.2.1

Hi!

You have decided that you need integration tests in addition to your unit tests. How can we automate integration testing of J2EE code?

Arquillian to rescue! Arquillian is integration testing framework for Java EE. To get started you need an Arquillian library, adapter container, container and test :-).

Is sounds a lot like to configure. Well no so many by hand. For the integration test I have chosen Wildfly 8.2.1. Also I want that Arquillian itself managed starting and stopping of wildfly.

For those who are impatient look into github: https://github.com/chernykhalexander/arquillian_db2_J2EE.git.

The easiest way to add the arquillian in pom.xml is to you jBoss forge tool. Forge is a special utility to manage java projects. Or you can look into pom.xml on github.

This pom also:
1) downloads the wildfly 8.2.1 distribution and expand it into the target directory.
2) copy the IBM DB2 driver into the expanded wildfly
3) uses maven-failsafe-plugin to run integration-tests. It's execution is bounded to integration-test and verify goals. If you need to execute integration test make sure integration test files end with "IT".

How to define the JNDI datasource? This is what wildfly-ds.xml responsible for.

Other interesting part is integration test itself. Again, you can ease the creation of test with forge tool.
When creating the test pay attention to the @deployment method. You need to specify all classes and files your test uses.

After all have been done mvn integration-test and that is all! Happy testing.

вторник, 1 декабря 2015 г.

Vagrant. Install on CentOS 7.1

Here is a small tutorial on how to install Vagrant on CentOS 7.1:
  1. Download Vagrant: 
    wget -q https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.4_x86_64.rpm
     
  2. Setup Vagrant: 
    yum localinstall vagrant_1.7.4_x86_64.rpm
     
  3. Check Vagrant version: 
    [root@localhost ~]# vagrant --version
    Vagrant 1.7.4
     
  4. Download VirtaulBox:


  5. Setup VirtualBox:
    sh VirtualBox-5.0.6-103037-Linux_amd64.run
     
  6. Setup dependencies: 
    yum install binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-PAE-devel dkms kernel-devel
     
  7. Setup kernel module: 
    KERN_DIR=/usr/src/kernels/3.10.0-229.14.1.el7.x86_64
    export KERN_DIR
    /sbin/rcvboxdrv setup
    Stopping VirtualBox kernel modules [ OK ]
    Recompiling VirtualBox kernel modules [ OK ]
    Starting VirtualBox kernel modules [ OK ]
That is all.Now you have a working Vagrant environment.