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.AutoCloseable
Deprecated.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
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. 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 class
JUnitFramework.BundleBuilder
Deprecated.
-
Field Summary
Fields Modifier and Type Field Description Jar
bin_test
Deprecated.org.osgi.framework.BundleContext
context
Deprecated.org.osgi.framework.launch.Framework
framework
Deprecated.Project
project
Deprecated.java.io.File
projectDir
Deprecated.java.util.List<org.osgi.util.tracker.ServiceTracker<?,?>>
trackers
Deprecated.Workspace
workspace
Deprecated.
-
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.void
addBundles(java.io.File bndrun)
Deprecated.void
addBundles(java.lang.String bndrun)
Deprecated.JUnitFramework.BundleBuilder
bundle()
Deprecated.void
close()
Deprecated.Close this frameworkorg.osgi.framework.BundleContext
getBundleContext()
Deprecated.Project
getProject()
Deprecated.<T> T
getService(java.lang.Class<T> class1)
Deprecated.<T> java.util.List<T>
getServices(java.lang.Class<T> class1)
Deprecated.Workspace
getWorkspace()
Deprecated.void
startAll(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
-
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.
-
-
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
-
close
public void close() throws java.lang.Exception
Deprecated.Close this framework- Specified by:
close
in 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.InvalidSyntaxException
Deprecated.- Throws:
org.osgi.framework.InvalidSyntaxException
-
getService
public <T> T getService(java.lang.Class<T> class1) throws java.lang.Exception
Deprecated.- Throws:
java.lang.Exception
-
waitForService
public <T> org.osgi.util.promise.Promise<T> waitForService(java.lang.Class<T> class1, long timeoutInMs) throws java.lang.Exception
Deprecated.- 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.Exception
Deprecated.- Throws:
java.lang.Exception
-
addBundles
public void addBundles(java.io.File bndrun) throws java.lang.Exception
Deprecated.- 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.BundleException
Deprecated.- Throws:
org.osgi.framework.BundleException
-
addBundle
public java.util.List<org.osgi.framework.Bundle> addBundle(java.lang.String spec) throws java.lang.Exception
Deprecated.- Throws:
java.lang.Exception
-
-