Author: veithen Date: Sat May 10 12:04:58 2014 New Revision: 1593690 URL: http://svn.apache.org/r1593690 Log: AXIS2-5646: Added some infrastructure to OSGiTest to test that the Axis2 bundle stops cleanly.
Modified: axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java Modified: axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java?rev=1593690&r1=1593689&r2=1593690&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java (original) +++ axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java Sat May 10 12:04:58 2014 @@ -41,6 +41,7 @@ import org.junit.Test; import org.ops4j.pax.exam.ExamSystem; import org.ops4j.pax.exam.nat.internal.NativeTestContainer; import org.ops4j.pax.exam.spi.DefaultExamSystem; +import org.osgi.framework.Bundle; import org.osgi.framework.Constants; public class OSGiTest { @@ -105,8 +106,20 @@ public class OSGiTest { serviceClient.setOptions(options); OMElement result = serviceClient.sendReceive(payload); assertEquals("getVersionResponse", result.getLocalName()); + // Stop the Axis2 bundle explicitly here so that we can test that it cleanly shuts down + // TODO: doesn't work yet; see AXIS2-5646 +// getAxis2Bundle(container).stop(); } finally { container.stop(); } } + + private static Bundle getAxis2Bundle(NativeTestContainer container) { + for (Bundle bundle : container.getSystemBundle().getBundleContext().getBundles()) { + if (bundle.getSymbolicName().equals("org.apache.axis2.osgi")) { + return bundle; + } + } + throw new Error("Axis2 bundle not found"); + } }