0

I'm new to bndtools. I'd like to use testcontainers (https://www.testcontainers.org/) to test a osgi bundle which is supposed to connect to a MQTT broker. So I can test connect, connectionlost etc. strategies. I dont't understand how maven and bnd repositories work together, so until I understand, I don't use maven. Then I've tried to "import" testcontainers by adding it to build.bnd :

-plugin.6.junit: \
    aQute.bnd.repository.maven.pom.provider.BndPomRepository; \
        releaseUrl=https://repo.maven.apache.org/maven2/; \
        readOnly=true; \
        name="Maven Central JUNIT";\
        revision="org.osgi:org.osgi.test.junit5:0.10.0,\
        org.osgi:org.osgi.test.junit4:0.10.0", \
        org.testcontainers:testcontainers:1.15.2

But bnd says "Cannot load the plugin org.testcontainers:testcontainers:1.15.2." I'm lost...

Lbro
  • 309
  • 2
  • 16
  • You might want to look at https://github.com/aQute-os/biz.aQute.osgi.util/tree/master/biz.aQute.mqtt.test if you're testing MQTT. It uses Launchpad, which means you need to strictly follow API & implementation separation, which has huge benefits anyway. – Peter Kriens Apr 06 '21 at 08:18

1 Answers1

0

The syntax you use is wrong ... The 'revision' parameter is taking a quoted string. That string ends with junit4:0.10.0", \. You add the test containers parameter after the quoted string is closed. So the following should work:

-plugin.6.junit: \
    aQute.bnd.repository.maven.pom.provider.BndPomRepository; \
        releaseUrl=https://repo.maven.apache.org/maven2/; \
        readOnly=true; \
        name="Maven Central JUNIT";\
        revision="org.osgi:org.osgi.test.junit5:0.10.0,\
            org.osgi:org.osgi.test.junit4:0.10.0, \
            org.testcontainers:testcontainers:1.15.2"

The Maven Bnd Repository is easier to use since it allows you to specify the GAVs in text file, one per line.

Peter Kriens
  • 15,196
  • 1
  • 37
  • 55