I am trying to write sample test cases for OSGI services by following the documentation here; http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-junit4osgi/apache-felix-ipojo-junit4osgi-tutorial.html
And test case class and MANIFEST.MF
are below;
package com.rajkishan.osgidemo;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
import org.osgi.framework.ServiceReference;
import com.rajkishan.osgidemo.locationtracker.ILocationTracker;
/**
* Unit test for simple Location Service.
*/
public class ServiceTest extends OSGiTestCase {
// Test Location Tracker Service Availability
public void testLocationTrackerServiceAvailability() {
ServiceReference reference = context
.getServiceReference(ILocationTracker.class.getName());
assertNotNull("Assert Availability", reference);
}
public void testLocationMessage() {
ServiceReference reference = context
.getServiceReference(ILocationTracker.class.getName());
assertNotNull("Assert Availability", reference);
ILocationTracker service = (ILocationTracker) context
.getService(reference);
String message = service.getLocation();
assertNotNull("Check Message Existance", message);
assertEquals("Check The Message", "Got location as MyCity", message);
}
}
MANIFEST.MF
Manifest-Version: 1.0
Bnd-LastModified: 1446545137113
Build-Jdk: 1.8.0_60
Built-By: Rajkishan_2
Bundle-Activator: com.rajkishan.osgidemo.TestServiceActivator
Bundle-Description: Service To Test How to Run Tests in OSGI Services
Bundle-ManifestVersion: 2
Bundle-Name: osgi-test
Bundle-SymbolicName: com.rajkishan.osgidemo.osgi-test
Bundle-Version: 1.0.0.qualifier
Created-By: Apache Maven Bundle Plugin
Export-Package: com.rajkishan.osgidemo;uses:="org.apache.felix.ipojo.jun
it4osgi,org.osgi.framework";version="1.0.0"
Import-Package: com.rajkishan.osgidemo.locationtracker;version="[1.0,2)"
,org.apache.felix.ipojo.junit4osgi,org.osgi.framework;version="[1.3,2)"
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Test-Suite: com.rajkishan.osgidemo.ServiceTest
Tool: Bnd-3.0.0.201509101326
But whenever i try the command, junit {Bundle ID}
it says,
shell: CommandNotFoundException: Command not found: junit
See the Screenshot below;
What i am missing here?
NOTE: It works fine if i try from Swing-GUI. But not from command prompt.