Package org.apache.camel.test.spring
Class CamelSpringTestSupport
- java.lang.Object
-
- org.junit.Assert
-
- org.apache.camel.test.junit4.TestSupport
-
- org.apache.camel.test.junit4.CamelTestSupport
-
- org.apache.camel.test.spring.CamelSpringTestSupport
-
@Deprecated public abstract class CamelSpringTestSupport extends org.apache.camel.test.junit4.CamelTestSupport
Deprecated.Base test-class for classic Spring application such as standalone, web applications. Do not use this class for Spring Boot testing, instead use@RunWith(CamelSpringBootRunner.class)
.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.springframework.context.support.AbstractApplicationContext
applicationContext
Deprecated.protected static Object
lock
Deprecated.protected static ThreadLocal<org.springframework.context.support.AbstractApplicationContext>
threadAppContext
Deprecated.
-
Constructor Summary
Constructors Constructor Description CamelSpringTestSupport()
Deprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected String[]
activeProfiles()
Deprecated.Which active profiles should be used.protected abstract org.springframework.context.support.AbstractApplicationContext
createApplicationContext()
Deprecated.protected org.apache.camel.CamelContext
createCamelContext()
Deprecated.void
doPostTearDown()
Deprecated.void
doPreSetup()
Deprecated.protected Class<?>
excludeRoute()
Deprecated.Template method used to exclude aRoute
from the test camel contextprotected Class<?>[]
excludeRoutes()
Deprecated.Template method used to excludeRoute
from the test time context route scanning<T> T
getMandatoryBean(Class<T> type, String name)
Deprecated.Looks up the mandatory spring bean of the given name and type, failing if it is not present or the correct typeprotected org.springframework.context.ApplicationContext
getRouteExcludingApplicationContext()
Deprecated.Create a parent context that initializes aPackageScanClassResolver
to exclude a set of given classes from being resolved.void
postProcessTest()
Deprecated.void
tearDown()
Deprecated.-
Methods inherited from class org.apache.camel.test.junit4.CamelTestSupport
applyCamelPostProcessor, assertExpression, assertMockEndpointsSatisfied, assertMockEndpointsSatisfied, assertPredicate, assertResolveLanguage, assertValidContext, bindToRegistry, camelContextService, cleanupResources, consumer, context, createCamelRegistry, createExchangeWithBody, createRouteBuilder, createRouteBuilders, debugAfter, debugBefore, disableJMX, doPostSetup, doSpringBootCheck, enableJMX, fluentTemplate, getCamelContextService, getCamelTestWatcher, getMandatoryEndpoint, getMandatoryEndpoint, getMockEndpoint, getMockEndpoint, getRouteFilterExcludePattern, getRouteFilterIncludePattern, getShutdownTimeout, hasClassAnnotation, ignoreMissingLocationWithPropertiesComponent, isCreateCamelContextPerClass, isDumpRouteCoverage, isLazyLoadingTypeConverter, isMockEndpoints, isMockEndpointsAndSkip, isUseAdviceWith, isUseDebugger, isUseRouteBuilder, replaceRouteFromWith, resetMocks, resolveMandatoryEndpoint, resolveMandatoryEndpoint, sendBodies, sendBody, sendBody, setCamelContextService, setUp, setupResources, setUseRouteBuilder, startCamelContext, stopCamelContext, template, useJmx, useOverridePropertiesWithPropertiesComponent
-
Methods inherited from class org.apache.camel.test.junit4.TestSupport
assertCollectionSize, assertCollectionSize, assertDirectoryEquals, assertDirectoryEquals, assertDirectoryExists, assertEndpointUri, assertExpression, assertFileExists, assertFileNotExists, assertInMessageBodyEquals, assertInMessageHeader, assertIsInstanceOf, assertListSize, assertListSize, assertMessageHeader, assertOneElement, assertOutMessageBodyEquals, assertOutMessageHeader, assertPredicate, assertPredicateDoesNotMatch, assertPredicateMatches, assertStringContains, body, bodyAs, createDirectory, createExchangeWithBody, deleteDirectory, deleteDirectory, exchangeProperty, getJavaMajorVersion, getRouteList, getTestMethodName, getTestName, header, isJava15, isJava16, isJava17, isJava18, isJava19, isJavaVendor, isPlatform, property, resolveMandatoryEndpoint, resolveMandatoryEndpoint, systemProperty, systemProperty
-
Methods inherited from class org.junit.Assert
assertArrayEquals, assertArrayEquals, 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, assertNotEquals, assertNotEquals, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertThrows, assertThrows, assertTrue, assertTrue, fail, fail
-
-
-
-
Field Detail
-
threadAppContext
protected static ThreadLocal<org.springframework.context.support.AbstractApplicationContext> threadAppContext
Deprecated.
-
lock
protected static Object lock
Deprecated.
-
applicationContext
protected org.springframework.context.support.AbstractApplicationContext applicationContext
Deprecated.
-
-
Method Detail
-
createApplicationContext
protected abstract org.springframework.context.support.AbstractApplicationContext createApplicationContext()
Deprecated.
-
postProcessTest
public void postProcessTest() throws Exception
Deprecated.- Overrides:
postProcessTest
in classorg.apache.camel.test.junit4.CamelTestSupport
- Throws:
Exception
-
doPreSetup
public void doPreSetup() throws Exception
Deprecated.- Overrides:
doPreSetup
in classorg.apache.camel.test.junit4.CamelTestSupport
- Throws:
Exception
-
tearDown
public void tearDown() throws Exception
Deprecated.- Overrides:
tearDown
in classorg.apache.camel.test.junit4.CamelTestSupport
- Throws:
Exception
-
doPostTearDown
public void doPostTearDown() throws Exception
Deprecated.- Overrides:
doPostTearDown
in classorg.apache.camel.test.junit4.CamelTestSupport
- Throws:
Exception
-
getRouteExcludingApplicationContext
protected org.springframework.context.ApplicationContext getRouteExcludingApplicationContext()
Deprecated.Create a parent context that initializes aPackageScanClassResolver
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 theApplicationContext
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 methodsexcludedRoutes
andexcludedRoute
to determine the classes to be excluded from scanning.- Returns:
- ApplicationContext a parent
ApplicationContext
configured to exclude certain classes from package scanning
-
excludeRoutes
protected Class<?>[] excludeRoutes()
Deprecated.Template method used to excludeRoute
from the test time context route scanning- Returns:
- Class[] the classes to be excluded from test time context route scanning
-
excludeRoute
protected Class<?> excludeRoute()
Deprecated.Template method used to exclude aRoute
from the test camel context
-
getMandatoryBean
public <T> T getMandatoryBean(Class<T> type, String name)
Deprecated.Looks up the mandatory spring bean of the given name and type, failing if it is not present or the correct type
-
activeProfiles
protected String[] activeProfiles()
Deprecated.Which active profiles should be used. Important: When using active profiles, then the code increateApplicationContext()
should create the SpringAbstractApplicationContext
without refreshing. For example creating anClassPathXmlApplicationContext
you would need to pass in false in the refresh parameter, in the constructor. Camel will thrown anIllegalStateException
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.- Returns:
- an array of active profiles to use, use null to not use any active profiles.
-
-