...
A simple class can contain multiple test. Tests are no more than methods annotated with the @Test annotation. After configurint configuring and starting the OSGI container, Pax-Exam will scan the class looking for all the annotated functions and will run them according to the reactor strategy we have set.
...
Bassicaly, this function opens a debug socket in port 5005. You can connect your Eclipse (or another IDE) configuring the address and the port of the remove java application.
Maven
...
dependencies
Integration tests in OpenNaaS are located under /itests/ folder. Therefore they inherit from it all the necessary dependencies for starting and configuring the OSGI container.
...
So, the only dependencies we have to define in our pom are the ones containing the componentes components we want to check. OSGF integration tests require OpenNaaS core , due it contains ResourceManager and ResourceRepository; the Router Repository to add and remove routers, the Router Model to make assertions over it, and also the capabilities and actionset to test the OSPF developed funcionality.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<dependencies> <dependency> <groupId>org.opennaas</groupId> <artifactId>org.opennaas.core.resources</artifactId> </dependency> <dependency> <groupId>org.opennaas</groupId> <artifactId>org.opennaas.extensions.router.repository</artifactId> </dependency> <dependency> <groupId>org.opennaas</groupId> <artifactId>org.opennaas.extensions.router.model</artifactId> </dependency> <dependency> <groupId>org.opennaas</groupId> <artifactId>org.opennaas.extensions.queuemanager</artifactId> </dependency> <dependency> <groupId>org.opennaas</groupId> <artifactId>org.opennaas.extensions.router.capability</artifactId> </dependency> <dependency> <groupId>org.opennaas</groupId> <artifactId>org.opennaas.extensions.router.actionsets.junos</artifactId> </dependency> <dependency> <groupId>org.opennaas.itests</groupId> <artifactId>org.opennaas.itests.helpers</artifactId> </dependency> <dependency> <groupId>net.i2cat.netconf</groupId> <artifactId>netconf4j</artifactId> </dependency> </dependencies> |
Pax-Exam Containers
Even thought though in OpenNaaS we deploy our platform to run the tests, Pax-Exam 2.x provides three different OSGI containers in which you can launch an OSGI framework and install bundles. Native Container is launched in the same JVM as the driver, and Forked Container launch the framework in an isolated JVM. The third option is the Pax Runner Container. As the forked container, the framework is launched in a separrate VM, but it uses Pax Runner as the main tool to configure and run the tests. The list of maven dependencies you must include in your pom file is defined in the Pax-Exam wiki.
...
Sometimes, one of our bundles needs to import a package no not exported by default by the JVM. Pax-Exam lets you configure a list of additional packages you want the system bundle to export.
...