Showing posts with label mock. Show all posts
Showing posts with label mock. Show all posts

Saturday, March 9, 2013

Batch operation with Apache Camel

This is a small post of how can we organize batching in apache camel 2.8.0.

Given

Apache camel version 2.8.0. Hot higher because it's production restriction so far.
A list of pojos as input
A csv file as output

Test


Camel allows to advise producer endpoints with mocks, look at setup method. Starting from camel 2.10 mocking can be done with annotations. MockEndpoint provides flexible expectation and assertion mechanism

Implementation 

Spring context


By default split output will be the same as input. Developer can change this behavior by adding AggregationStrategy like:
In camel AggregationStrategy always receives null in oldExchange for the first record in batch. All subsequent batch records will be accumulated in oldExchange by appending String with record from newExchange. Aggregation executed after all transformation in split closure body.

Definition body within split tells camel to drop input list of pojos into single elements and pass them in subsequent csvRowFormatter processor.

CsvFormatter

It's pretty simple. Extract pojo from camel exchange, format csv from it and push it back into exchange.

Conclusion

Camel provides flexible mechanism for building routing engines. It allows to build batching as well. For full version of example refer to github

This post was created mostly like a reminder.

Thursday, December 22, 2011

Разработка через тестирование. Организовываем Додзё



Сегодня в Luxoft UBS DC удалось организовать двухчасовую сессию посвященную TDD и coding dojo практикам.


Было минимум теории. Благодаря SmartBoard удалось достичь максимальной вовлеченности участников.


Всего было 8 человек, каждый успел побывать в роли pilot и copilot. 


Тренировались на кате Game Of Life


К сожалению мы не успели закончить полностью, закончили лишь на 80 - 90 % реализации.


Зато провели ретроспекцию, что очень важно в такого рода мероприятиях.


Среди недостатков отметили отсутвие дизайн сессии и работы у WiteBoard. Кроме того специфика Dojo привнесла некую сумбурность в процесс, потому как приходилось каждые 7 минут ротировать участников.


Однако, всем понравилось, и все изъявили желание продолжать проведения такого рода мероприятий, что скорее всего приведет к образованию KievGojo.


Для тех кому интересна эта тема предлагаю посмотреть пятиминутный ролик о том как организовать подобного рода мероприятие. А также добро пожаловать на сайт энтузиастов coding dojo.

В дальнейшем планируется провести ряд практических и теоретических сессий по методологиям, инструментам и подходам к написанию тестов.

Пока все.