First install the pre-reqs
- Install VirtualBox
- Install Vagrant
- gem install librarian-chef
- librarian-chef install
- vagrant plugin install vagrant-vbguest
- vagrant plugin install vagrant-omnibus
This little extension to DbUnit allows you to write the test data using Groovy lists and maps rather than XML or Excel. That way you can keep your test data in the same file as your db integration test, which will be easier to grok and maintain.
GroovyDataset
is the DbUnit extension that you need to put in your project. GroovyDatasetTest
is the unit test for it. UserIntegrationTest
is an example, where the "data" attribute is the test data that is inserted into the database. (In real life, you'd create a superclass and move the SessionFactory, the definition of the data field, the setup() method, etc. there).
This was all described in a blog post: http://www.jroller.com/kenwdelong/entry/groovy_based_dbdeploy_tests
For how to use it, see the UserIntegrationTest below. You can specify the data for the test in a List of Maps
FROM jenkins:1.596 | |
# Adapted from https://github.com/ansible/ansible-docker-base/blob/master/devel-ubuntu14.04/Dockerfile | |
USER root | |
RUN apt-get -y update && \ | |
apt-get install -y python-yaml python-jinja2 python-httplib2 python-keyczar python-paramiko python-setuptools python-pkg-resources git python-pip | |
RUN pip install boto | |
RUN mkdir /etc/ansible/ | |
RUN echo '[local]\nlocalhost\n' > /etc/ansible/hosts | |
RUN mkdir /opt/ansible/ | |
RUN git clone http://github.com/ansible/ansible.git /opt/ansible/ansible |
Configuring a Hibernate second-level cache in AWS is something of a challenge, as the EhCache multicast discovery mechanism doesn't work there. JGroups is another option, but can be difficult to configure. Here's how I got it working.
I'm using the very nice JGroups-AWS project https://github.com/meltmedia/jgroups-aws. In my configuration, you can see that I use "tags=Env,Role". This means that any given server will query EC2 to find out the values of those tags for itself. For example, suppose the server wakes up and finds that it has Env=Production and Role=API_Server. It will look for other servers with the same tag values (using the AWS webservice endpoints) and form a cluster with them. It checks back periodically so that if servers enter or leave the group it will adjust periodically. Very nice.
The 1.3.0 jgroups-aws uses JGroups 3.1.0, which is a bit out of date. I have not tried forcing a later version in the POM yet. I also cannot completely vouch for all the protocols set up in the ehcache.
A short Groovy script that you can use to filter out the noise from a stack trace to see what order the servlet filters are actually configured with.
A simple way to do this is throw a RuntimeException from a controller, hit that URL, and copy and paste the stack trace into the script below.
StringBuilder dump = new StringBuilder(); | |
ThreadMXBean threadMxBean = ManagementFactory.getThreadMXBean(); | |
ThreadInfo[] threadInfos = threadMxBean.getThreadInfo(threadMxBean.getAllThreadIds(), 150); | |
for(ThreadInfo info : threadInfos) | |
{ | |
dump.append('"').append(info.getThreadName()).append('"').append("\n"); | |
Thread.State state = info.getThreadState(); | |
dump.append(state); | |
StackTraceElement[] stes = info.getStackTrace(); | |
for(StackTraceElement ste : stes) |