public class ServiceStubber<T> extends Object
The service stubber gives you the possibility to install a service stub into your OSGi test-container. This is useful if your bundle has service dependencies but you don't want to add extra dependencies to your test project.
Internally, an artificial bundle which contains a special
BundleActivator will be generated and installed into the OSGi
container. The BundleActivator exports a stub-service as specified
with this stubber.
| Modifier and Type | Method and Description |
|---|---|
ServiceStubber<T> |
addClass(Class<?> pClass) |
ServiceStubber<T> |
addProperty(String pPropertyName,
String pValue) |
org.ops4j.pax.exam.Option |
build()
Builds the final stub-bundle which can be installed with the
Option instance returned. |
ServiceStubber<T> |
withFactory(Class<? extends StubServiceFactory<T>> pFactory)
Specifies the factory class to create the service stub.
|
ServiceStubber<T> |
withImpl(Class<? extends T> pImplementation)
Specifies the implementation class of the service stub.
|
public ServiceStubber<T> withImpl(Class<? extends T> pImplementation)
withFactory(Class) but not both.pImplementation - Implementation class, must not be nullpublic ServiceStubber<T> withFactory(Class<? extends StubServiceFactory<T>> pFactory)
withImpl(Class) but not both.pFactory - Factory class, must not be nullpublic ServiceStubber<T> addClass(Class<?> pClass)
public ServiceStubber<T> addProperty(String pPropertyName, String pValue)
Copyright © 2015–2018 SourcePond. All rights reserved.