Database Adapter
Service Layer
Domain
External Service
External Database
HTTP Adapter
REST Adapter
* martinfowler.com/articles/microservice-testing
Database Adapter
Service Layer
Domain
External Service
External Database
HTTP Adapter
REST Adapter
Database Adapter
Service Layer
Domain
External Service
External Database
HTTP Adapter
REST Adapter
Database Adapter
Service Layer
Domain
External Service
External Database
HTTP Adapter
REST Adapter
Database Adapter
Service Layer
Domain
External Service
External Database
HTTP Adapter
REST Adapter
Unit
Integration
Component
Manual
e2e
Unit
public class EventHandler
implements RequestHandler<Input, Output> {
...
public EventHandler() {
final StorageService storageService = new StorageService(...);
final ImageService imageService = new ImageService(...);
this.eventHandlingService =
new EventHandlingService(storageService, imageService);
}
@Override
public Output
handleRequest(final Input input, final Context context) {
return eventHandlingService.handleEvent(input);
}
public class Input {
private String bucket;
private String key;
...
}
public class Output {
private String bucket;
private String key;
...
}
public class EventHandlingService {
private final StorageService storageService;
private final ImageService imageService;
public EventHandlingService(...) {
...
}
public Output handleEvent(final Input input) {
final InputStream inputStream = storageService.getObject(...);
...
final BufferedImage newImage = imageService.resize(...);
...
storageService.uploadFile(...);
return new Output(...);
}
}
jens@openvalue.de
@OpenValue
openvalue.eu