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:

<dependency>
            <groupId>dumbster</groupId>
            <artifactId>dumbster</artifactId>
            <version>1.6</version>
            <scope>test</scope>
        </dependency>

And my test class is along the lines of:

@RunWith(AtlassianPluginsTestRunner.class)
public class MyTest {

    SimpleSmtpServer simpleSmtpServer;

    @Before
    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 vote

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... http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.com.dumbster.smtp&version=1.6.0

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 vote

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?

Thanks,

- Jonathan

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Tuesday in Uncategorized

Friday fun: how many celebrates Midsummer holiday or is this a Swedish tradition only?

Any other country that celebrates Midsummer holiday (this friday 22 June)?  

44 views 3 1
Join discussion

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