I was wondering whether it is possible to use Maven2 to automatically configure a Glassfish 2.1 with JNDI Resources, Datasources and Mail-Sessions for my integration tests.
Also I wonder whether it is possible to create some sort of benchmarks that might then be tracked using continuum or Hudson.
I was wondering whether it is possible to use Maven2 to automatically configure a Glassfish 2.1 with JNDI Resources, Datasources and Mail-Sessions for my integration tests.
I'm not sure Cargo does provide anything to configure Mail-Sessions. And anyway, from what I can see in DataSource+and+Resource+Support, there is no support at all for GlassFish. I'd simply configure the installed container against which you run your integration tests.
Also I wonder whether it is possible to create some sort of benchmarks that might then be tracked using continuum or Hudson.
You could run JMeter performance tests. Hudson has a Performance Plugin allowing to generate a trend graphic report from the results. Also maybe have a look at JChav (seems dormant though).
Related
I have a quite big set of Selenium driven UI tests, that are very cumbersome to maintain. I've read about Arquillian Graphene and its benefits, making life with Selenium less painfull.
I wonder if it's possible to use Arquillian Graphene (2) without using the Arquillian framework underneath it, i.e. simply drive Selenium tests against a running application.
Do you have any experiences or are there any showstoppers from making this setup work?
Cheers, Chris
Yes, using the 'standalone' version will remove the Container/Deployment support.
The only problem is you'll also miss all the Container/Deployment metadata that Arquillian automatically fetch and use to e.g. construct the URL injection.
As of Graphene 2.1.0.Alpha2 there was added support to configure a URL in arquillian.xml if one was not provided automatically. Using that feature should allow you to use Graphene against an already deployed application as if it was deployed by Arquillian.
Essentially put this in your arquillian.xml file:
<arquillian>
<extension name="graphene">
<property name="url">http://localhost:8080/app/</property>
</extension>
</arquillian>
See https://issues.jboss.org/browse/ARQGRA-374 for more details.
Ok, I found the answer myself: yes, it is possible. But I'll have to reword the question a little bit: Is it possible to use Arquillian Graphene without using Arquillian container management.
What I do now is have a already deployed application inside its container, i.e. I do not use Arquillian to deploy all or part of the application, and I use Graphene 2 and Drone to drive my Selenium tests on that application.
The only documentation I found regarding this setup is https://docs.jboss.org/author/display/ARQGRA2/Framework+Integration+Options
Arquillian Mode Options
You can choose between following Arquillian modes
Standalone
runs tests without container integration, only lifecycle of extensions is managed
allows to use Graphene independently of Arquillian containers and deployment management
Yes, I have been using it for the past 18 months in a standalone mode.
Please check here for more info.
http://www.testautomationguru.com/selenium-webdriver-automation-using-arquillian-framework/
I am currently investigating how best to test our OSGi application intended to run on Apache Karaf. The obvious option is Pax Exam with labs-paxexam-karaf (see http://iocanel.blogspot.com/2012/01/advanced-integration-testing-with-pax.html for a tutorial). However, I am concerned about performance (since Pax Exam apparently starts a new framework for every test method). I've also found that Arquillian has some OSGi support, though that isn't its main focus. JUnit4osgi isn't an option, as it only supports JUnit 3.
For someone unfamiliar with either framework, which is better to start with? What are the tradeoffs?
Why use Arquillian if you're after proper OSGi support? =)
When looking at PaxExam make sure the docs refer to PaxExam 2 - there are substantial differences between v 1 and 2.
PaxExam will take a while to get to grips with, but you'll learn heaps about OSGi in the process (definitely a good thing, but can still hurt).
In parallel to #Dmytro's answer, the Test Containers include a Native container which is run with the same VM as the junit test - meaning you can launch with debug in Eclipse. This works especially well with the org.eclipse.m2e:lifecycle-mapping maven eclipse plugin and the org.ops4j.pax.exam:maven-paxexam-plugin. This method is fantastic, complete IDE integration.
PaxExam documentation is a bit sparse, but there are some good examples (see the Native launcher with main method that provides interactive shell) and wiki doc. If you get stuck the mailing list people (general#lists.ops4j.org) are very helpful.
Another alternative is to look at Karaf's paxexam, very slick and easy to get a Karaf instance up and running (features.xml etc).
Personally, I just use PaxExam2 as I'd prefer to have no explicit dependencies on the framework provider (nothing against Karaf at all, it rocks).
Based on Reactor Strategies Pax-Exam can run all test methods in the same OSGi container.
The EagerSingleStagedReactorFactory of Pax Exam 2.x (aliased to PerClass in Pax 3.0) lets you run all test methods of a given class in the same OSGi container.
With the PerSuite strategy introduced in Pax Exam 3.0.0.M1, all test classes of your suite run in the same container.
By the way, Pax Exam 3.0 supports Java EE and CDI containers in addition to OSGi, so there is even more functional similarity with Arquillian, only Pax Exam is coming from the opposite end.
With Pax Exam, there is no need to assemble deployments in ShrinkWrap style, they are built automatically from the classpath. Moreover, you can run suites of test classes with a shared configuration.
We wish to introduce Selenium testing to our maven build process. Happily, there is a ton of information available on how to do this, but I'm having trouble figuring out how to handle one of our requirements.
In an effort to separate our testing layers, we want to use mock service objects for the ui tests. All of these objects are already defined in Spring configuration files that we use in unit tests. Wiring these services is easy in a unit test (we're using #ContextConfiguration), but I don't know how to handle this configuration swap when we're deploying the war to Jetty for Selenium tests.
We're using:
Spring MVC 3.0
Maven
Hudson
Worst: introduce special user/interface parameter/checkbox/role. In an application remember to use mocks for this special case everywhere in the code. Horrible in maintenance, error-prone and, let's face it, pretty lame. Most common thou...
Easiest solution: develop conditional includes in your Spring application context:
<import resource="services-${env}.xml"/>
where ${env} comes from pom.xml:
<properties>
<env>prd</env> <!-- or test depending on build profile -->
</properties>
Remember to turn on resources filtering and use build profiles.
when doing Selenium tests. Switching can be done during Maven build or by some other filtering tool. Both files (services-prd.xml and services-test.xml) define same beans (same interfaces and/or ids), but of course the latter one uses mock implementations.
Best (IMHO): if you need to change the implementation at runtime, AOP + JMX will be great. Just wrap your real services with aspects and depending on some flag (accessible via JMX), use real services or mocks. Very clean and noninvasive.
I would like to know what yours Hadoop development environment looks like?
Do you deploy jars to test cluster, or run jars in local mode?
What IDE do you use and what plugins do you use?
How do you deploy completed projects to be run on servers?
What are you other recommendations about setting my own Hadoop development/test environment?
It's extremely common to see people writing java MR jobs in an IDE like Eclipse or IJ. Some even use plugins like Karamasphere's dev tools which are handy. As for testing, the normal process is to unit test business logic as you normally would. You can unit test some of the MR surrounding infrastructure using the MRUnit classes (see Hadoop's contrib). The next step is usually testing in the local job runner, but note there a number of caveats here: the distributed cache doesn't work in local mode, and you're singly threaded (so static variables are accessible in ways they won't be in production). The next step (and most common test environment) is pseudo-distributed mode - all daemons running, but on a single box. This is going to run code in different JVMs with multiple tasks in parallel and will reveal most developer errors.
MR job jars are distributed to the client machine in different ways. Usually custom deployment processes are seen here. Some folks use tools like Capistrano or config management tools like Chef or Puppet to automate this.
My personal development is usually done in Eclipse with Maven. I build jars using Maven's Assembly plugin (packages all dependencies in a single jar for easier deployment, but fatter jars). I regularly test using MRUnit and then pseudo-distributed mode. The local job runner isn't very useful in my experience. Deployment is almost always via a configuration management system. Testing can be automated with a CI server like Hudson.
Hope this helps.
I am an Eclipse user.
I am going to be using Glassfish on a project.
Is the Glassfish IDE integration substantially better in NetBeans (or some other), or is the integration the same as Eclipse?
I can't compare it to eclipse because I never tried it in eclipse but I can cast my vote for Netbeans integration. I've been using it for a while with Netbeans and I am very satisfied with the result.
with the full set of JavaEE plugins in Eclipse, it's trivial to control/deploy to glassfish. Grab the JavaEE version of Eclipse and follow the wizard for creating a new enterprise application.
Generally speaking, unless you're debugging the only intergration you really need is: start, stop, deploy. You can make almost any IDE/script/buildfile do that. Stick with the IDE you're most productive in.
I stuck with Eclipse.
Glassfish IDE integration is better with NetBeans.
The plugin for Eclipse isn't quite ready for primetime.
https://glassfishplugins.dev.java.net/eclipse34/
My personal experience is that Eclipse with the Java EE extensions are more than sufficient for development, and deployment of JAX-WS apps are faster in Eclipse than with Netbeans.
The Glassfish plugin has forms for editing configuration for things as nuanced as WSIT WS-Security and WS-AtomicTransaction. This speeds configuration. However, I've found that deploying a JAX-WS app performs ws-import more times than necessary, which doubles deployment time.