Package org.apache.sling.testing.mock.osgi.junit

# Class OsgiContext

java.lang.Object
org.apache.sling.testing.mock.osgi.context.OsgiContextImpl
org.apache.sling.testing.mock.osgi.junit.OsgiContext

All Implemented Interfaces:
  `org.junit.rules.TestRule`

@ProviderType public final class OsgiContext extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl implements org.junit.rules.TestRule
JUnit rule for setting up and tearing down OSGi context for unit tests.

## Field Summary

### Fields inherited from class org.apache.sling.testing.mock.osgi.context.OsgiContextImpl

`componentContext`

## Constructor Summary

Constructors
Constructor
Description
`OsgiContext()`
Initialize OSGi context.
`OsgiContext(@NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<T> afterSetUpCallback)`
Initialize OSGi context.
`OsgiContext(@NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<U> afterSetUpCallback, @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<V> beforeTearDownCallback)`
Initialize OSGi context.

## Method Summary

Modifier and Type
Method
Description
`org.junit.runners.model.Statement`
`apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)`

### Methods inherited from class org.apache.sling.testing.mock.osgi.context.OsgiContextImpl

`bundleContext, componentContext, getService, getServices, registerInjectActivateService, registerInjectActivateService, registerInjectActivateService, registerInjectActivateService, registerInjectActivateService, registerInjectActivateService, registerService, registerService, registerService, registerService, setUp, tearDown`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### OsgiContext

public OsgiContext()
Initialize OSGi context.

### OsgiContext

public OsgiContext(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<T> afterSetUpCallback)
Initialize OSGi context.

Type Parameters:
  `T` - context type
Parameters:
  `afterSetUpCallback` - Allows the application to register an own callback function that is called after the built-in setup rules are executed.

### OsgiContext

public OsgiContext(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<U> afterSetUpCallback, @NotNull @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<V> beforeTearDownCallback)
Initialize OSGi context.

Type Parameters:
  `U` - context type
  `V` - context type
Parameters:
  `afterSetUpCallback` - Allows the application to register an own callback function that is called after the built-in setup rules are executed.
  `beforeTearDownCallback` - Allows the application to register an own callback function that is called before the built-in teardown rules are executed.

## Method Details

### apply

public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)

Specified by:
  `apply` in interface `org.junit.rules.TestRule`