2. Confidential 1
Agenda
• About presentation
• ESB
• Camel
• JBehave
• Integration REST and SOAP services
• Camels benefits
• Mocking and stubbing
• Development recommendations
• Demonstration of integration tests
3. Confidential 2
About presentation
We won’t talk about:
• Camel as integration platform
We will talk about:
• Development process, where Camel can be used
• How to get well granulated and tested application
• A few possible ways of stubbing external services
4. Confidential 3
Enterprise Service Bus
An enterprise service bus (ESB) operates in a distributed, heterogeneous
environment to facilitate the requirements of a highly scalable, fault-
tolerant, service-messaging framework.
Messages based framework:
• Transforms messages
• Routes messages to registered services
• Notifies registered message listeners about specific message requests
• Secures delivery of messages by enforcing authentication,
authorization, nonrepudiation, confidentiality, etc.
9. Confidential 8
Camels benefits
Modularity
• Messaging based application allow transfer information to any service
throw queue
• Each service can be developed, tested and stubbed independently
from other subsystems
13. Confidential 12
Development recommendations
• Use JBehave for integration testing
• Introduce domain objects with correct Jaxb annotation
• Add required routers and test their one by one
• Implement common integration tests
• Create own queue for each request and response to have assumption
only for one serialized type
Сервисная шина предприятия (англ. enterprise service bus, ESB) — связующее программное обеспечение, обеспечивающее централизованный и унифицированный событийно-ориентированный обмен сообщениями между различными информационными системами на принципах сервис-ориентированной архитектуры
ESB as architecture component for integration distributed components
Transform messages
Routes messages between entry points
Adding extra information into message
Notification subscribers about messages
Secure and cofidentially
Camel as implementation ESB
Camel is an integration framework that aims to make your integration projects productive and fun. The Camel project was started in early 2007.
Colored different Java VM
Integration tests call external services, exposed business services and Camel routes throw messaging queue
Batch load data by Camel routes
BDD is an evolution of test-driven development (TDD) and acceptance-test driven design, and is intended to make these practices more accessible and intuitive to newcomers and experts alike. It shifts the vocabulary from being test-based to behavior-based, and positions itself as a design philosophy.
SOAP:Embedded CXF component
Java client is generated by WSDL 10 kB jar file plus a couple lines to call it
Camel client 1-5 lines
Messaging: Embedded JMS component
Converters are required
BATCH: No efforts on file reading operations in simplest case
JMS as one protocol for communication between all services and layers without extra injected services
Good places for stubbing external services
Good places for stubbing external services
Good places for stubbing external services
Jbehave story as common language BA/QA/Development team
Domain objects should be serializable plus Jaxb annotations
TDD for business logic
Test routes one by one
Jbehave story
How it’s translated into Junit
Run tests
How to stub by listener
How to stub by a Router
Route unit testing