ActiveMQ SSL exchanges and handshake error messages

Posted & filed under apache activemq, Testing.

I decided to implement SSL in MatrixClient to let messaging clients connect securely to an ActiveMQ broker and I got a bit lost in the various SSL errors that can happen so I thought I’d summarise the flow, which is shown in the diagram.

a

It all hangs on each end of the connection having its own keystore and truststore. The keystore is used for signing the request and the truststore is used for verifying the signed request. So for it all to work the client’s certificate must be in the broker’s truststore and the broker’s certificate must be in the client’s truststore. (more…)

Maven not finding a test

Posted & filed under apache activemq, Testing.

Sometimes it’s easy to get carried away with annotations and when something doesn’t work you endlessly scratch your head. I’ve just extended MatrixClient to talk SSL to an ActiveMQ broker that wants client authentication and added the appropriate test:

public class MQClientTestSSL extends ClientTest ... {
  @Test
  public void test() {

but Maven wasn’t running the test. I could run it manually:

mvn test -Dtest=uk.ac.uhi.it.matrix.client.MQClientTestSSL

but mvn clean install didn’t run the test. According to the surefire documentation it’s meant to run tests with a pattern ‘Test*.java’ but it clearly wasn’t. The only way to get the test to run was to rename it:

public class MQClientSSLTest extends ClientTest ... {

and Maven then picked it up and ran it.

Debugging NUnit tests in Visual Studio 2010

Posted & filed under c#, Testing.

If you’re trying to debug your NUnit tests in Visual Studio and getting the error:

The breakpoint will not currently be hit

this is how to sort it. First, change NUNIT_HOME\bin\nunit.exe.config to remove references to .NET2 and make sure .NET4 is enabled, e.g.

nunit1 (more…)

Running Selenium tests on a headless Bamboo

Posted & filed under howTo, Testing.

With Selenium requiring a browser to run the tests, if you don’t have one installed you’ll get the error:

sessionId should not be null; has this session been started yet?

You’ll also get this error if you have a valid browser configured in the test code but not installed on the system. However the problem with running Selenium tests on a headless Bamboo server is, there’s no display. So here’s how to sort that on Suse Linux.

Install Xvfb from yast2 and the xorg-x11-server package

Startup Xvfb in the background:

Xvfb :99 -ac &

and set the display to use the one you chose. I normally do this in / etc/profile.

export DISPLAY=:99

Then exit and go back into the shell or do:

source / etc/profile

start and stop Bamboo and the Selenium tests will run.

Say hello to Cucumber!

Posted & filed under CouchKit, ruby, Testing.

BDD is looking good!

fruit-patch
Rakefile
  +- features
       fruity.feature
    +- step_definitions
          fruity_steps.rb

and what do the fruity contents contain? (more…)

NUnit runaround

Posted & filed under active directory, ADSI, c#, GADfly, Testing.

I have a bit of a problem with “cross platform” development at the moment. I’m running Windows XP inside an ActiveDirectory forest using VMware Fusion from OSX. A nasty experience a while ago means writing code on a virtual machine’s hard disk is insanity itself. If something happens to the slice you lose everything. OK, you won’t if it’s in source control but using subversion or git from Windows is a pain. Also, why duplicate backup/vss options on a slice when I’m already using everything just fine from OSX? So instead, I develop via a shared folder. I write all the C# code via VisualStudio which points to the “network” share.

Matrix Client C# Test


(more…)

Getting started with Boost.Test on Windows XP

Posted & filed under active directory, ADSI, Agile, C++, GADfly, howTo, Testing.

I’ve been looking into unit testing for C++ and tried out cppunit, which blows up spectaculary when it runs and the errors are so bad I just can’t be bothered with it. It took and age to figure out how to build it with VisualStudio 9 and it still doesn’t run properly. So I had a look at Boost.Test. The blurb on the site proclaims “one of the most highly regarded and expertly designed C++ library projects in the world” and it is easier to use than cppunit. So how to get started with a simple test? (more…)

What’s the point of SOAP?

Posted & filed under integration, ruby, Testing, Web Services.

My poor head. The day before yesterday it was Java. Yesterday it was Java and C++. Today it’s C++, Java and Ruby! But today’s language soup is down to SOAP and its evil sidekick WSDL. It’s great when it works. You can just run Axis2 over the WSDL to generate your beans and off you go but today I have a major headache with the library system at $WORK. I’m looking into plumbing it in to the account creation system and it has a nice SOAP interface, which doesn’t conform to WS-I. It uses RPC/Encoded. That’s ok as Axis2 supports it now but the WSDL itself is “broken”:

[java] Caused by: org.apache.axis2.AxisFault: Part 'fault' of fault message
'{http://webapps.iii.com/wsclient/patronio}PatronIOFault'
must be defined with 'element=QName' and not 'type=QName' (more...)

A rest is as good as a test

Posted & filed under Testing.

There I was, a full day at the coal face implementing digital signature validation and certificate trusting for the Guanxi SP Engine and I needed to write a test to make sure it worked the way I thought it would work and also to document how to use the subsystem. So I created a small test hierarchy and plugged in the EngineTrustTest:

src
  test
    java
      org.guanxi.sp.engine.trust.EngineTrustTest
    ...

    String metadataURL = "file:///" + new File(EngineTrustTest.class.
getResource("/metadata.xml").getPath()).getCanonicalPath();

(more…)

JUnit4, IDEA and Maven

Posted & filed under Guanxi, Software Engineering, Testing.

I was adding some metadata unit tests to the Guanxi IdP and suddenly came across a very weird peculiarity. It’s perhaps a bit long winded but the following is similar to the test hierarchy I’ve been using. I start off with a base class that holds a lot of initialisation stuff:

public abstract class TestBase {
  protected static String testString = null;

  @BeforeClass
  public static void init() {
    testString = "TEST";
  }
}

(more…)