public abstract class CamelBlueprintTestSupport
extends org.apache.camel.test.junit4.CamelTestSupport
Modifier and Type | Field and Description |
---|---|
static String |
SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT
Name of a system property that sets camel context creation timeout.
|
Constructor and Description |
---|
CamelBlueprintTestSupport() |
Modifier and Type | Method and Description |
---|---|
protected void |
addServicesOnStartup(List<org.apache.camel.util.KeyValueHolder<String,org.apache.camel.util.KeyValueHolder<Object,Dictionary>>> services)
Override this method to add services to be registered on startup.
|
protected void |
addServicesOnStartup(Map<String,org.apache.camel.util.KeyValueHolder<Object,Dictionary>> services)
Override this method to add services to be registered on startup.
|
protected org.apache.camel.util.KeyValueHolder<String,org.apache.camel.util.KeyValueHolder<Object,Dictionary>> |
asKeyValueService(String name,
Object service,
Dictionary dict)
Creates a holder for the given service, which make it easier to use
addServicesOnStartup(java.util.List) |
protected org.apache.camel.util.KeyValueHolder<Object,Dictionary> |
asService(Object service,
Dictionary dict)
Creates a holder for the given service, which make it easier to use
addServicesOnStartup(java.util.Map) |
protected org.apache.camel.util.KeyValueHolder<Object,Dictionary> |
asService(Object service,
String key,
String value)
Creates a holder for the given service, which make it easier to use
addServicesOnStartup(java.util.Map) |
protected org.osgi.framework.BundleContext |
createBundleContext() |
protected org.apache.camel.CamelContext |
createCamelContext() |
protected boolean |
expectBlueprintContainerReloadOnConfigAdminUpdate()
This method may be overriden to instruct BP test support that BP container will reloaded when
Config Admin configuration is updated.
|
protected String |
getBlueprintDescriptor()
Gets the bundle descriptor from the classpath.
|
protected org.osgi.framework.BundleContext |
getBundleContext()
Return the system bundle context
|
protected String |
getBundleDirectives()
Gets the bundle directives.
|
protected String |
getBundleFilter()
Gets filter expression of bundle descriptors.
|
protected String |
getBundleVersion()
Gets test bundle version.
|
protected Long |
getCamelContextCreationTimeout()
Returns how long to wait for Camel Context
to be created.
|
protected <T> T |
getOsgiService(Class<T> type) |
protected <T> T |
getOsgiService(Class<T> type,
long timeout) |
protected <T> T |
getOsgiService(Class<T> type,
String filter) |
protected <T> T |
getOsgiService(Class<T> type,
String filter,
long timeout) |
protected boolean |
includeTestBundle()
Override this method if you don't want CamelBlueprintTestSupport create the test bundle
|
protected String[] |
loadConfigAdminConfigurationFile()
Override this method and provide the name of the .cfg configuration file to use for
ConfigAdmin service.
|
protected String |
setConfigAdminInitialConfiguration(Properties props)
Override this method as an alternative to
loadConfigAdminConfigurationFile() if there's a need
to set initial ConfigAdmin configuration without using files. |
void |
setUp() |
void |
tearDown() |
static void |
tearDownAfterClass() |
protected boolean |
useAsynchronousBlueprintStartup()
Override this method if you want to start Blueprint containers asynchronously using the thread
that starts the bundles itself.
|
protected String |
useOverridePropertiesWithConfigAdmin(Dictionary<String,String> props)
Override this method to override config admin properties.
|
applyCamelPostProcessor, assertExpression, assertMockEndpointsSatisfied, assertMockEndpointsSatisfied, assertPredicate, assertResolveLanguage, assertValidContext, camelContextService, consumer, context, createExchangeWithBody, createJndiContext, createRegistry, createRouteBuilder, createRouteBuilders, debugAfter, debugBefore, disableJMX, doPostSetup, doPreSetup, enableJMX, getCamelContextService, getCamelTestWatcher, getMandatoryEndpoint, getMandatoryEndpoint, getMockEndpoint, getMockEndpoint, getShutdownTimeout, ignoreMissingLocationWithPropertiesComponent, isCreateCamelContextPerClass, isDumpRouteCoverage, isLazyLoadingTypeConverter, isMockEndpoints, isMockEndpointsAndSkip, isUseAdviceWith, isUseDebugger, isUseRouteBuilder, postProcessTest, replaceRouteFromWith, resetMocks, resolveMandatoryEndpoint, resolveMandatoryEndpoint, sendBodies, sendBody, sendBody, setCamelContextService, setUseRouteBuilder, startCamelContext, stopCamelContext, template, useJmx, useOverridePropertiesWithPropertiesComponent
assertCollectionSize, assertCollectionSize, assertDirectoryEquals, assertDirectoryEquals, assertEndpointUri, assertExpression, assertFileExists, assertFileNotExists, assertInMessageBodyEquals, assertInMessageHeader, assertIsInstanceOf, assertListSize, assertListSize, assertMessageHeader, assertOneElement, assertOutMessageBodyEquals, assertOutMessageHeader, assertPredicate, assertPredicateDoesNotMatch, assertPredicateMatches, assertStringContains, body, bodyAs, createDirectory, createExchangeWithBody, deleteDirectory, deleteDirectory, exchangeProperty, faultBody, faultBodyAs, getRouteList, getTestMethodName, getTestName, header, isJava15, isJava16, isJava17, isJava18, isJavaVendor, isPlatform, outBody, outBodyAs, property, resolveMandatoryEndpoint, resolveMandatoryEndpoint, systemProperty, systemProperty, unwrap, unwrapChannel
assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertTrue, assertTrue, fail, fail
public static final String SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT
protected boolean includeTestBundle()
protected boolean useAsynchronousBlueprintStartup()
Override this method if you want to start Blueprint containers asynchronously using the thread
that starts the bundles itself.
By default this method returns true
which means Blueprint Extender will use thread pool
(threads named "Blueprint Extender: N
") to startup Blueprint containers.
Karaf and Fuse OSGi containers use synchronous startup.
Asynchronous startup is more in the spirit of OSGi and usually means that if everything works fine asynchronously, it'll work synchronously as well. This isn't always true otherwise.
protected org.osgi.framework.BundleContext createBundleContext() throws Exception
Exception
public void setUp() throws Exception
setUp
in class org.apache.camel.test.junit4.CamelTestSupport
Exception
protected void addServicesOnStartup(Map<String,org.apache.camel.util.KeyValueHolder<Object,Dictionary>> services)
asService(Object, java.util.Dictionary)
, asService(Object, String, String)
to make it easy to add the services to the map.protected boolean expectBlueprintContainerReloadOnConfigAdminUpdate()
<cm:property-placeholder persistent-id="PID" update-strategy="reload">
protected void addServicesOnStartup(List<org.apache.camel.util.KeyValueHolder<String,org.apache.camel.util.KeyValueHolder<Object,Dictionary>>> services)
asKeyValueService(String, Object, Dictionary)
to make it easy to add the services to the List.protected org.apache.camel.util.KeyValueHolder<Object,Dictionary> asService(Object service, Dictionary dict)
addServicesOnStartup(java.util.Map)
protected org.apache.camel.util.KeyValueHolder<String,org.apache.camel.util.KeyValueHolder<Object,Dictionary>> asKeyValueService(String name, Object service, Dictionary dict)
addServicesOnStartup(java.util.List)
protected org.apache.camel.util.KeyValueHolder<Object,Dictionary> asService(Object service, String key, String value)
addServicesOnStartup(java.util.Map)
protected String useOverridePropertiesWithConfigAdmin(Dictionary<String,String> props) throws Exception
Override this method to override config admin properties. Overriden properties will be passed to
Configuration.update(Dictionary)
and may or may not lead to reload of Blueprint container - this
depends on update-strategy="reload|none"
in <cm:property-placeholder>
This method should be used to simulate configuration update after Blueprint container is already initialized and started. Don't use this method to initialized ConfigAdmin configuration.
props
- properties where you add the properties to overrideConfigurationAdmin
which are defined in the Blueprint XML file.Exception
protected String[] loadConfigAdminConfigurationFile()
protected String setConfigAdminInitialConfiguration(Properties props)
loadConfigAdminConfigurationFile()
if there's a need
to set initial ConfigAdmin configuration without using files.props
- always non-null. Tests may initialize ConfigAdmin configuration by returning PID.props
will be used as
initial ConfigAdmin configurationpublic void tearDown() throws Exception
tearDown
in class org.apache.camel.test.junit4.CamelTestSupport
Exception
protected org.osgi.framework.BundleContext getBundleContext()
protected String getBlueprintDescriptor()
protected String getBundleFilter()
protected String getBundleVersion()
protected String getBundleDirectives()
protected Long getCamelContextCreationTimeout()
protected org.apache.camel.CamelContext createCamelContext() throws Exception
createCamelContext
in class org.apache.camel.test.junit4.CamelTestSupport
Exception
protected <T> T getOsgiService(Class<T> type)
protected <T> T getOsgiService(Class<T> type, long timeout)
Apache Camel