public class JUnitFramework
extends java.lang.Object
implements java.lang.AutoCloseable
Builder is provided to create a bundle and
install it. This makes it possible to add classes from the src or test
directories or resources. See bundle().
addBundle(String) et.
al.
addBundles(File) et. al.
getService(Class)
et. al. Notice that this framework starts in the same process as that the
JUnit code runs. This is normally a separately started VM.| Modifier and Type | Class and Description |
|---|---|
class |
JUnitFramework.BundleBuilder |
| Modifier and Type | Field and Description |
|---|---|
Jar |
bin_test |
org.osgi.framework.BundleContext |
context |
(package private) java.util.concurrent.ExecutorService |
executor |
org.osgi.framework.launch.Framework |
framework |
(package private) static java.util.concurrent.atomic.AtomicInteger |
n |
Project |
project |
java.io.File |
projectDir |
java.util.List<org.osgi.util.tracker.ServiceTracker<?,?>> |
trackers |
Workspace |
workspace |
| Constructor and Description |
|---|
JUnitFramework()
Start a framework assuming the current working directory is the project
directory.
|
JUnitFramework(java.io.File projectDir)
Start a framework while providing a project directory.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<org.osgi.framework.Bundle> |
addBundle(java.lang.String spec) |
void |
addBundles(java.io.File bndrun) |
void |
addBundles(java.lang.String bndrun) |
JUnitFramework.BundleBuilder |
bundle() |
void |
close()
Close this framework
|
org.osgi.framework.BundleContext |
getBundleContext() |
private java.lang.String |
getExtra() |
private org.osgi.framework.launch.FrameworkFactory |
getFactory() |
Project |
getProject() |
<T> T |
getService(java.lang.Class<T> class1) |
<T> java.util.List<T> |
getServices(java.lang.Class<T> class1) |
Workspace |
getWorkspace() |
void |
startAll(java.util.List<org.osgi.framework.Bundle> bundles) |
<T> org.osgi.util.promise.Promise<T> |
waitForService(java.lang.Class<T> class1,
long timeoutInMs) |
java.util.concurrent.ExecutorService executor
public final java.util.List<org.osgi.util.tracker.ServiceTracker<?,?>> trackers
public final Jar bin_test
public final org.osgi.framework.launch.Framework framework
public final org.osgi.framework.BundleContext context
public final java.io.File projectDir
public Workspace workspace
public Project project
static java.util.concurrent.atomic.AtomicInteger n
public JUnitFramework()
public JUnitFramework(java.io.File projectDir)
projectDir - private java.lang.String getExtra()
throws java.lang.Exception
java.lang.Exceptionpublic void close()
throws java.lang.Exception
close in interface java.lang.AutoCloseablejava.lang.Exceptionpublic org.osgi.framework.BundleContext getBundleContext()
public <T> java.util.List<T> getServices(java.lang.Class<T> class1)
throws org.osgi.framework.InvalidSyntaxException
org.osgi.framework.InvalidSyntaxExceptionpublic <T> T getService(java.lang.Class<T> class1)
throws java.lang.Exception
java.lang.Exceptionpublic <T> org.osgi.util.promise.Promise<T> waitForService(java.lang.Class<T> class1,
long timeoutInMs)
throws java.lang.Exception
java.lang.Exceptionpublic JUnitFramework.BundleBuilder bundle() throws java.io.IOException
java.io.IOExceptionpublic void addBundles(java.lang.String bndrun)
throws java.lang.Exception
java.lang.Exceptionpublic void addBundles(java.io.File bndrun)
throws java.lang.Exception
java.lang.Exceptionpublic Workspace getWorkspace() throws java.lang.Exception
java.lang.Exceptionpublic Project getProject() throws java.lang.Exception
java.lang.Exceptionpublic void startAll(java.util.List<org.osgi.framework.Bundle> bundles)
throws org.osgi.framework.BundleException
org.osgi.framework.BundleExceptionpublic java.util.List<org.osgi.framework.Bundle> addBundle(java.lang.String spec)
throws java.lang.Exception
java.lang.Exceptionprivate org.osgi.framework.launch.FrameworkFactory getFactory()
throws java.lang.Exception
java.lang.Exception