-
1. Re: getting started unit testing - embedded JBoss AS 7?
matthewcornell Jun 7, 2012 11:12 AM (in response to matthewcornell)No one?
-
2. Re: getting started unit testing - embedded JBoss AS 7?
jaikiran Jun 7, 2012 11:15 AM (in response to matthewcornell)Matthew, take a look at the Arquillian guides here http://arquillian.org/
-
3. Re: getting started unit testing - embedded JBoss AS 7?
matthewcornell Jun 7, 2012 7:25 PM (in response to jaikiran)Thanks for the pointer, jaikiran. I did some research and it looks like Arquillian does not support the embedded container for JBoss 7.1 - https://community.jboss.org/message/717500 . That makes me wonder whether the project is active...
-
4. Re: getting started unit testing - embedded JBoss AS 7?
jaikiran Jun 7, 2012 9:43 PM (in response to matthewcornell)Matthew Cornell wrote:
Thanks for the pointer, jaikiran. I did some research and it looks like Arquillian does not support the embedded container for JBoss 7.1 - https://community.jboss.org/message/717500 . That makes me wonder whether the project is active...
Is there a reason why you want that "embedded" project? Arquillian has the ability to start/stop the server on it's own when you run your JUnit tests. You don't have to write a single line of code (except for adding a Maven dependency in your pom.xml) for managing the server. This is known as the "managed" server mode in Arquillian. There's also a "remote" server mode where Arquillian will auto connect to an already running server instance (which you might have started in whatever way you want) and run the JUnit tests for you. And this isn't specific to JBoss AS server, Arquillian can do the same with any other server too.
-
5. Re: getting started unit testing - embedded JBoss AS 7?
matthewcornell Jun 8, 2012 8:27 AM (in response to jaikiran)Thank you - I'm still working on the terminology. I'm using "embedded" to mean starting a Java EE server in the same JVM as the tests then shutting it down when they're through. I understand I don't need a full blown container for unit testing (which I can do with mocks, and with properly-designed code), but I do need it for integration testing. In my case I use JAX-RS to expose my app as a REST service (it's also an EJB), and JPA to store the underlying data. My app is currently very simple, which is why I'm surprised that the tools haven't satisfied so far. Clearly my approach is talking to me, and I need to take a different tack.
I've also heard the terms "in-container" and "out-of-container" testing, "managed" from you, and "remote", so I'm still a bit confused. If Arquillian can very quickly deploy my app to a container that is not in my JVM, but is local, then I think that would satisfy my needs. If this is true, then my looking for an Arquillian container adapter for JBoss AS 7 embedded is the wrong query. However, I looked for version 7 support at http://mvnrepository.com/artifact/org.jboss.arquillian.container , but I didn't find it. Is Arquillian JBoss support still active? The ones I did find were:
http://mvnrepository.com/artifact/org.jboss.arquillian.container/arquillian-jbossas-embedded-6
http://mvnrepository.com/artifact/org.jboss.arquillian.container/arquillian-jbossas-managed-6
http://mvnrepository.com/artifact/org.jboss.arquillian.container/arquillian-jbossas-embedded-60
http://mvnrepository.com/artifact/org.jboss.arquillian.container/arquillian-jbossas-local-60
Maybe my confusion is understandable! Any clarity you can provide would really help.
-
6. Re: getting started unit testing - embedded JBoss AS 7?
jaikiran Jun 10, 2012 8:56 AM (in response to matthewcornell)1 of 1 people found this helpfulMatthew Cornell wrote:
Thank you - I'm still working on the terminology. I'm using "embedded" to mean starting a Java EE server in the same JVM as the tests then shutting it down when they're through. I understand I don't need a full blown container for unit testing (which I can do with mocks, and with properly-designed code), but I do need it for integration testing.
Okay. That's what typically "embedded" means. Arquillian has 3 server integration types, "managed" (start/stop server as a JVM process), "embedded" (start/stop server within the same process that triggers the JUnit test), "remote" (join a running instance of server). AS7 integration for Arquillian does not have the "embedded" mode. But the use case you mention - running the tests in the same JVM as the server can still be achieved via the others 2 modes too. In fact, when you run an Arquillian test, the Arquillian infrastructure deploys the deployment to the server and depending on the "run mode" the test is either run in the same JVM process as the server or in a separate JVM as the client. By default, the tests are run on the server JVM (from your description that's what you want). If the test uses a @RunAsClient annotation for the test (the arquillian guides have more info about this) then the test is run as a remote client and does not run on the server JVM. I believe, that should make this a bit clear. If you still have more questions, feel free to ask.
-
7. Re: getting started unit testing - embedded JBoss AS 7?
matthewcornell Jun 11, 2012 9:07 AM (in response to jaikiran)That helps, thank you. I'm starting to undrestand. What's still confusing is how my tests would do something like creating users and roles/groups programmatically. With GlassFish I was using their embedded API to do this (their interface to a command-line utility), so how I would do this in the non-embedded modes you describe? Sorry if I'm not clear, I'm still wrapping my head around all this.
-
8. Re: getting started unit testing - embedded JBoss AS 7?
ben.maisano Jan 24, 2013 9:13 AM (in response to matthewcornell)Hi,
I'm using arquillian jboss managed setup, so I would expect it runs the tests in the server's jvm. I cannot get a debug breakpoint to hit. Details about debugging are here, but no answer yet on this thread:
I would assume an embedded is just like normal junit, debug just works. With managed or remote it seems they both involve another JVM that must be launched in debug mode and then you remotely attach to the debugging jvm with your IDE. I'm not sure if how maven kicks it off is playing a role, but I cannot get it to work. I have got jvm to hault, and I connect to it, however my breakpoints do not hit. I have breakpoints in the junit/arquillian test class as well as within an ejb method the test class is calling. Any ideas?