Package aQute.bnd.junit
Class JUnitFramework
- java.lang.Object
-
- aQute.bnd.junit.JUnitFramework
-
- All Implemented Interfaces:
java.lang.AutoCloseable
@Deprecated public class JUnitFramework extends java.lang.Object implements java.lang.AutoCloseableDeprecated.This class provides an OSGi framework that is configured with the current bnd workspace. A project directory is used to find the workspace. This makes all repositories in the workspace available to the framework. To be able to test JUnit code against/in this framework it is necessary that all packages on the buildpath and testpath are actually exported in the framework. This class will ensure that. Once the framework is up and running it will be possible to add bundles to it. There are a number of ways that this can be achieved:- Build a bundle – A bnd
Builderis provided to create a bundle and install it. This makes it possible to add classes from the src or test directories or resources. Seebundle(). - Add a bundle using a bnd spec – Using the bnd specs (e.g.
'org.apache.felix.configadmin;version=3'). See
addBundle(String)et. al. - Add a bndrun file – A file bndrun file can be added. All properties in
this file that can be applied after a framework is started will be applied.
See
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classJUnitFramework.BundleBuilderDeprecated.
-
Field Summary
Fields Modifier and Type Field Description Jarbin_testDeprecated.org.osgi.framework.BundleContextcontextDeprecated.(package private) java.util.concurrent.ExecutorServiceexecutorDeprecated.org.osgi.framework.launch.FrameworkframeworkDeprecated.(package private) static java.util.concurrent.atomic.AtomicIntegernDeprecated.ProjectprojectDeprecated.java.io.FileprojectDirDeprecated.(package private) org.osgi.util.promise.PromiseFactorypromiseFactoryDeprecated.java.util.List<org.osgi.util.tracker.ServiceTracker<?,?>>trackersDeprecated.WorkspaceworkspaceDeprecated.
-
Constructor Summary
Constructors Constructor Description JUnitFramework()Deprecated.Start a framework assuming the current working directory is the project directory.JUnitFramework(java.io.File projectDir)Deprecated.Start a framework while providing a project directory.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.util.List<org.osgi.framework.Bundle>addBundle(java.lang.String spec)Deprecated.voidaddBundles(java.io.File bndrun)Deprecated.voidaddBundles(java.lang.String bndrun)Deprecated.JUnitFramework.BundleBuilderbundle()Deprecated.voidclose()Deprecated.Close this frameworkorg.osgi.framework.BundleContextgetBundleContext()Deprecated.private java.lang.StringgetExtra()Deprecated.private org.osgi.framework.launch.FrameworkFactorygetFactory()Deprecated.ProjectgetProject()Deprecated.<T> TgetService(java.lang.Class<T> class1)Deprecated.<T> java.util.List<T>getServices(java.lang.Class<T> class1)Deprecated.WorkspacegetWorkspace()Deprecated.voidstartAll(java.util.List<org.osgi.framework.Bundle> bundles)Deprecated.<T> org.osgi.util.promise.Promise<T>waitForService(java.lang.Class<T> class1, long timeoutInMs)Deprecated.
-
-
-
Field Detail
-
executor
final java.util.concurrent.ExecutorService executor
Deprecated.
-
promiseFactory
final org.osgi.util.promise.PromiseFactory promiseFactory
Deprecated.
-
trackers
public final java.util.List<org.osgi.util.tracker.ServiceTracker<?,?>> trackers
Deprecated.
-
bin_test
public final Jar bin_test
Deprecated.
-
framework
public final org.osgi.framework.launch.Framework framework
Deprecated.
-
context
public final org.osgi.framework.BundleContext context
Deprecated.
-
projectDir
public final java.io.File projectDir
Deprecated.
-
workspace
public Workspace workspace
Deprecated.
-
project
public Project project
Deprecated.
-
n
static java.util.concurrent.atomic.AtomicInteger n
Deprecated.
-
-
Constructor Detail
-
JUnitFramework
public JUnitFramework()
Deprecated.Start a framework assuming the current working directory is the project directory.
-
JUnitFramework
public JUnitFramework(java.io.File projectDir)
Deprecated.Start a framework while providing a project directory.- Parameters:
projectDir-
-
-
Method Detail
-
getExtra
private java.lang.String getExtra() throws java.lang.ExceptionDeprecated.- Throws:
java.lang.Exception
-
close
public void close() throws java.lang.ExceptionDeprecated.Close this framework- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.lang.Exception
-
getBundleContext
public org.osgi.framework.BundleContext getBundleContext()
Deprecated.
-
getServices
public <T> java.util.List<T> getServices(java.lang.Class<T> class1) throws org.osgi.framework.InvalidSyntaxExceptionDeprecated.- Throws:
org.osgi.framework.InvalidSyntaxException
-
getService
public <T> T getService(java.lang.Class<T> class1) throws java.lang.ExceptionDeprecated.- Throws:
java.lang.Exception
-
waitForService
public <T> org.osgi.util.promise.Promise<T> waitForService(java.lang.Class<T> class1, long timeoutInMs) throws java.lang.ExceptionDeprecated.- Throws:
java.lang.Exception
-
bundle
public JUnitFramework.BundleBuilder bundle() throws java.io.IOException
Deprecated.- Throws:
java.io.IOException
-
addBundles
public void addBundles(java.lang.String bndrun) throws java.lang.ExceptionDeprecated.- Throws:
java.lang.Exception
-
addBundles
public void addBundles(java.io.File bndrun) throws java.lang.ExceptionDeprecated.- Throws:
java.lang.Exception
-
getWorkspace
public Workspace getWorkspace() throws java.lang.Exception
Deprecated.- Throws:
java.lang.Exception
-
getProject
public Project getProject() throws java.lang.Exception
Deprecated.- Throws:
java.lang.Exception
-
startAll
public void startAll(java.util.List<org.osgi.framework.Bundle> bundles) throws org.osgi.framework.BundleExceptionDeprecated.- Throws:
org.osgi.framework.BundleException
-
addBundle
public java.util.List<org.osgi.framework.Bundle> addBundle(java.lang.String spec) throws java.lang.ExceptionDeprecated.- Throws:
java.lang.Exception
-
getFactory
private org.osgi.framework.launch.FrameworkFactory getFactory() throws java.lang.ExceptionDeprecated.- Throws:
java.lang.Exception
-
-