@ActiveProfiles(profiles="h2") public abstract class AbstractDbTest extends AbstractTest
AbstractTest
and adds support for test with database.Modifier and Type | Class and Description |
---|---|
static interface |
AbstractDbTest.MessageCallback
Contract for defining callback handler that can adjust
Message before inserting into database. |
Modifier and Type | Field and Description |
---|---|
protected javax.persistence.EntityManager |
em |
protected org.springframework.transaction.PlatformTransactionManager |
transactionManager |
DEFAULT_LOCALE
Constructor and Description |
---|
AbstractDbTest() |
Modifier and Type | Method and Description |
---|---|
protected Message |
createAndSaveMessage(ExternalSystemExtEnum sourceSystem,
ServiceExtEnum service,
String operationName,
String payload)
Creates and saves new message.
|
protected Message[] |
createAndSaveMessages(int messageCount,
AbstractDbTest.MessageCallback messageCallback)
Creates and saves new messages.
|
protected Message[] |
createAndSaveMessages(int messageCount,
ExternalSystemExtEnum sourceSystem,
ServiceExtEnum service,
String operationName,
String payload)
Creates and saves new messages.
|
protected Message |
createMessage(ExternalSystemExtEnum sourceSystem,
ServiceExtEnum service,
String operationName,
String payload)
Creates new message (without saving into database).
|
protected org.springframework.jdbc.core.JdbcTemplate |
getJdbcTemplate()
Gets
JdbcTemplate for test DB. |
void |
printEntities()
Print current state of entities.
|
assertErrorCode, configureXmlUnit, getApplContext, getCamelContext, mockDirect, mockDirect, setDefaultLocale, setPrivateField, validateMockito
protected javax.persistence.EntityManager em
@Autowired protected org.springframework.transaction.PlatformTransactionManager transactionManager
protected org.springframework.jdbc.core.JdbcTemplate getJdbcTemplate()
JdbcTemplate
for test DB.public void printEntities()
protected Message createMessage(ExternalSystemExtEnum sourceSystem, ServiceExtEnum service, String operationName, String payload)
sourceSystem
- the source systemservice
- the serviceoperationName
- the operation namepayload
- the payloadprotected Message createAndSaveMessage(ExternalSystemExtEnum sourceSystem, ServiceExtEnum service, String operationName, String payload)
sourceSystem
- the source systemservice
- the serviceoperationName
- the operation namepayload
- the payloadprotected Message[] createAndSaveMessages(int messageCount, ExternalSystemExtEnum sourceSystem, ServiceExtEnum service, String operationName, String payload)
messageCount
- How many messages will be createdsourceSystem
- the source systemservice
- the serviceoperationName
- the operation namepayload
- the payloadprotected Message[] createAndSaveMessages(int messageCount, AbstractDbTest.MessageCallback messageCallback)
messageCount
- How many messages will be createdmessageCallback
- Callback handler that can adjust Message
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.