Class OsgiConfigParametersExtension
- java.lang.Object
-
- org.apache.sling.testing.mock.osgi.junit5.OsgiConfigParametersExtension
-
- All Implemented Interfaces:
org.junit.jupiter.api.extension.BeforeEachCallback,org.junit.jupiter.api.extension.Extension,org.junit.jupiter.api.extension.ParameterResolver
public class OsgiConfigParametersExtension extends Object implements org.junit.jupiter.api.extension.ParameterResolver, org.junit.jupiter.api.extension.BeforeEachCallback
AnExtensionwhich uses JUnit5 context reflection to discover OSGi Config Type Annotations present on test methods and classes, and then injects them as test parameters. For this to work for your config type annotation, you must specify@Retention(RetentionPolicy.RUNTIME)on the desired config type annotation class, or useConfigTypeto declare that your config type is supported as a test parameter. This extension is also responsible for discoveringSetConfigannotations and installing them into theOsgiContextImpl's ConfigurationAdmin service.
-
-
Constructor Summary
Constructors Constructor Description OsgiConfigParametersExtension()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeforeEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext)ObjectresolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)booleansupportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
-
-
-
Method Detail
-
beforeEach
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Exception- Specified by:
beforeEachin interfaceorg.junit.jupiter.api.extension.BeforeEachCallback- Throws:
Exception
-
supportsParameter
public boolean supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException- Specified by:
supportsParameterin interfaceorg.junit.jupiter.api.extension.ParameterResolver- Throws:
org.junit.jupiter.api.extension.ParameterResolutionException
-
resolveParameter
public Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException
- Specified by:
resolveParameterin interfaceorg.junit.jupiter.api.extension.ParameterResolver- Throws:
org.junit.jupiter.api.extension.ParameterResolutionException
-
-