I am in the process of trying to get AndroMDA 3.3 running agains the new JBoss Microcontainer and using the latest TestNG version.
Before doing that, I decided to create a new AndroMDA model with a really simple service (one method) one entity with one String attribute and an accompanying ValueObject (again, one String method).
Generated the source using AndroMDA. This is an EJB3 project, btw.
Right off the bat some things were broken... the generated test class was broken due to changes in the AndroMDA generated 'ServiceLocator'... several method signatures, etc.
Also, testng.jar does not import by default after doing the mvn eclipse:eclipse... I changed the main pom.xml for testng to tell it to include the .jar on compile and I upped testng to the latest verson:
I am also using a fresh Eclipse install, so had to install the testNG eclipse plugin to get the tests to run from inside of Eclipse... you can find the plugin install information at: http://testng.org/doc/eclipse.html
Upon first trying to run the TestNG in debug mode, it did not work.... a little reading on the TestNG site revealed that you need to set up a debug configuration within Eclipse. To do this, select run--Debug Configurations...
Select TestNG from the list and create a new configuration... in that configuration , under the 'Suite' section, click the browse button and select testng.xml file. This will inject any classes defined in this xml file whenever TestNG is run... you need the EJB3Container to be injected on each test run.
At this point you can click 'Debug' to attempt to debug your test class. This will likely fail for you with a runtime exception stating "java.lang.NoSuchMethodError: org.jboss.ejb3.KernelAbstractionFactory.setKernel(Lorg/jboss/kernel/Kernel;)"... a quick search of the Andromda forums revealed that there appears to be conflicting JBoss .jars.
http://forum.andromda.org/viewtopic.php?t=4410&highlight=testng+eclipse
Removal of the duplicate .jars should do the trick...
M2_REPO/org/jboss/jboss-ejb3-client/4.0.5-GA/jboss-ejb3-client-4.0.5-GA.jar
M2_REPO/org/jboss/jboss-aop-jdk50-client/4.0.5-GA/jboss-aop-jdk50-client-4.0.5-GA.jar
(I removed them from the /core/pom.xml so that I would not have to keep going back in and removing these...)
Note, right now I am just trying to get the JBoss Microcontainer alpha 9 version to run... later I am going to attemp to get the latest version going...
Note: One other things... make sure you add /core/src/test/resources as a Source folder under Java Build Path -- Source Tab for your project. Otherwise you will get the runtime exception: Cannot find embedded-jboss-beans.xml
Note 2: OK... so the next problem I ran into was the exception:
java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/ReflectionManager
I broke open the hibernate annotations .jar and noted that the above class is not in it... after a bit of searching on the Andromda forum, I found someone mention changing the main pom.xml hibernate sections as follows:
The change is to set both version to 3.2.0.ga versions... the versions in the one created for me were different and incompatible... you may be able to bring these up to the latest hibernate versions too... I have not tried that yet, but will be in the next couple of days.
run:
mvn install -Dmaven.test.skip
to bring down these new jars... note the -Dmaven.test.skip command which will tell it not to try to run the unit tests... without this, the build will fail ....following this run:
mvn eclipse:eclipse
Refresh your Eclipse environment... (remember you will have to remove the .jars from the previous step again. This step should be done first really, but I am just documenting the order I am running into these issues.)
One last step... I needed to modify the file core/src/test/resources/embedded-jboss-beans.xml to set the database username and password...
Find the section for the database you are using (mysql in this case)... add/or modify the username and/or password to match your local installation.