How to use additional libraries in wired tests

I'm trying to use a library inside a wired integration test. In this case Dumbster to setup a simple SMTP server.

I have this dep in my pom.xml:


And my test class is along the lines of:

public class MyTest {

    SimpleSmtpServer simpleSmtpServer;

    public void setUp() throws Exception {
        simpleSmtpServer = SimpleSmtpServer.start();

But i'm getting: a ClassNotFoundException when I try to run the test from the test console.

I've tried various fiddles with OSGi Export/Import-Package instructions in both the test atlassian-plugin.xml and the <testInstructions> of the maven amps plugin config with no luck.

My colleagues have also had similiar problems with other libs.

Any ideas?

4 answers

0 votes

Hey Mark,

Can you tell me if the dumbster jar is in your test plugin jar inside META-INF/lib ?

Also, is dumbster an OSGi bundle? If not, you'll need to either make it an OSGi bundle, or package it exploded in your test plugin jar so that the maven-bundle plugin creates the proper manifest.

So, at some point during my fiddling the dumbster jar was included in the META-INF/lib along with all other test dependencies - but now they aren't, not sure exactly what I did. ANYWAY - it wasn't an OSGi bundle, but I have found it bundled as OSGi here...

So, I've included that as a pluginArtifact and test dependency, and it's looking good so far - now just need to fix my test ;)

Although having to turn these things into bundles, or manually exploding them seems a bit of a pain - is there someway we could list dependencies that need to be exploded?

I appear to have found another problem following on from this. My test plugin works fine when initially built from an 'atlas-debug'.

When I make a simple change in the test class and hit 'Scan for Tests', the test plugin is rebuilt (via the fastdev cli/tpi call). It's now almost 2Mb in size and contains lots of deps in the META-INF/lib. The original size was approx 8k and didn't contain these! The test plugin then fails to install correctly listing lots of spring wiring exceptions.

0 votes

I don't think your deps have to be OSGi bundles if they are in META-INF/lib.

However, atlas-debug and cli/tpi should be building the same artifact.

Would it be possible for you to send me your project source so i can test locally and figure out what's going on?


- Jonathan

Suggest an answer

Log in or Sign up to answer
Community showcase
Published yesterday in Feedback & Announcements

How do you analyze GC logs, thread dumps and head dumps?

Hi awesome community!  In this article, I would like to describe the one of the toolset (service) for the analyze some problems on different Java-based instances, of course, as Atlassian admini...

97 views 0 7
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you