How to use additional libraries in wired tests

Mark Gibson January 30, 2013

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 votes
brainicorn
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 31, 2013

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

0 votes
Mark Gibson January 31, 2013

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
Mark Gibson January 31, 2013

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?

0 votes
brainicorn
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 30, 2013

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events