|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.junit.Assert
org.apache.camel.test.junit4.TestSupport
org.apache.camel.test.junit4.CamelTestSupport
org.apache.camel.test.spring.CamelSpringTestSupport
public abstract class CamelSpringTestSupport
Field Summary | |
---|---|
protected org.springframework.context.support.AbstractApplicationContext |
applicationContext
|
protected static Object |
lock
|
protected static ThreadLocal<org.springframework.context.support.AbstractApplicationContext> |
threadAppContext
|
Fields inherited from class org.apache.camel.test.junit4.CamelTestSupport |
---|
camelContextService, consumer, context, template |
Fields inherited from class org.apache.camel.test.junit4.TestSupport |
---|
log, LS, testName |
Constructor Summary | |
---|---|
CamelSpringTestSupport()
|
Method Summary | ||
---|---|---|
protected String[] |
activeProfiles()
Which active profiles should be used. |
|
protected abstract org.springframework.context.support.AbstractApplicationContext |
createApplicationContext()
|
|
protected org.apache.camel.CamelContext |
createCamelContext()
|
|
void |
doPreSetup()
|
|
protected Class<?> |
excludeRoute()
Template method used to exclude a Route from the test camel context |
|
protected Class<?>[] |
excludeRoutes()
Template method used to exclude Route from the test time context
route scanning |
|
|
getMandatoryBean(Class<T> type,
String name)
Looks up the mandatory spring bean of the given name and type, failing if it is not present or the correct type |
|
protected org.springframework.context.ApplicationContext |
getRouteExcludingApplicationContext()
Create a parent context that initializes a PackageScanClassResolver to exclude a set of given classes from
being resolved. |
|
void |
postProcessTest()
Lets post process this test instance to process any Camel annotations. |
|
void |
tearDown()
|
|
static void |
tearSpringDownAfterClass()
|
Methods inherited from class org.apache.camel.test.junit4.CamelTestSupport |
---|
applyCamelPostProcessor, assertExpression, assertMockEndpointsSatisfied, assertMockEndpointsSatisfied, assertPredicate, assertResolveLanguage, assertValidContext, camelContextService, consumer, context, createExchangeWithBody, createJndiContext, createRegistry, createRouteBuilder, createRouteBuilders, debugAfter, debugBefore, disableJMX, doPostSetup, enableJMX, getCamelContextService, getMandatoryEndpoint, getMandatoryEndpoint, getMockEndpoint, getMockEndpoint, getShutdownTimeout, ignoreMissingLocationWithPropertiesComponent, isCreateCamelContextPerClass, isLazyLoadingTypeConverter, isMockEndpoints, isMockEndpointsAndSkip, isUseAdviceWith, isUseDebugger, isUseRouteBuilder, resetMocks, resolveMandatoryEndpoint, resolveMandatoryEndpoint, sendBodies, sendBody, sendBody, setCamelContextService, setUp, setUseRouteBuilder, startCamelContext, stopCamelContext, tearDownAfterClass, template, useJmx, useOverridePropertiesWithPropertiesComponent |
Methods inherited from class org.apache.camel.test.junit4.TestSupport |
---|
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, faultBody, faultBodyAs, getRouteList, getTestMethodName, header, isJava15, isJava16, isJava17, isJavaVendor, isPlatform, outBody, outBodyAs, property, resolveMandatoryEndpoint, resolveMandatoryEndpoint, systemProperty, systemProperty, unwrap, unwrapChannel |
Methods inherited from class org.junit.Assert |
---|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static ThreadLocal<org.springframework.context.support.AbstractApplicationContext> threadAppContext
protected static Object lock
protected org.springframework.context.support.AbstractApplicationContext applicationContext
Constructor Detail |
---|
public CamelSpringTestSupport()
Method Detail |
---|
protected abstract org.springframework.context.support.AbstractApplicationContext createApplicationContext()
public void postProcessTest() throws Exception
postProcessTest
in class org.apache.camel.test.junit4.CamelTestSupport
Exception
public void doPreSetup() throws Exception
doPreSetup
in class org.apache.camel.test.junit4.CamelTestSupport
Exception
public void tearDown() throws Exception
tearDown
in class org.apache.camel.test.junit4.CamelTestSupport
Exception
public static void tearSpringDownAfterClass() throws Exception
Exception
protected org.springframework.context.ApplicationContext getRouteExcludingApplicationContext()
PackageScanClassResolver
to exclude a set of given classes from
being resolved. Typically this is used at test time to exclude certain routes,
which might otherwise be just noisy, from being discovered and initialized.
To use this filtering mechanism it is necessary to provide the
ApplicationContext
returned from here as the parent context to
your test context e.g.
protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext(new String[] {"test-context.xml"}, getRouteExcludingApplicationContext()); }This will, in turn, call the template methods
excludedRoutes
and excludedRoute
to determine the classes to be excluded from scanning.
ApplicationContext
configured
to exclude certain classes from package scanningprotected Class<?>[] excludeRoutes()
Route
from the test time context
route scanning
protected Class<?> excludeRoute()
Route
from the test camel context
public <T> T getMandatoryBean(Class<T> type, String name)
protected String[] activeProfiles()
createApplicationContext()
should create
the Spring AbstractApplicationContext
without refreshing. For example creating an
ClassPathXmlApplicationContext
you would need to pass in
false in the refresh parameter, in the constructor.
Camel will thrown an IllegalStateException
if this is not correct stating this problem.
The reason is that we cannot active profiles after a Spring application context has already
been refreshed, and is active.
protected org.apache.camel.CamelContext createCamelContext() throws Exception
createCamelContext
in class org.apache.camel.test.junit4.CamelTestSupport
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |