1
Presentation will begin momentarily…
2
Service Stub and Transparent Proxy: Wilma
INNOVATION WE MUST DO
AUGUST 24, 2015
3
AGENDA
Test Situation1
Requirements to address the issues2
Tool: Wilma3
How it works?4
Capabilities / Features5
Future6
4
THE TEST SITUATION – COMPONENT/SERVICE
Request TESTEDCOMPONENTResponse
5
THE TEST SITUATION – COMPONENT/SERVICE
3rd partyComponent
TESTEDCOMPONENT
6
THE TEST SITUATION – COMPONENT/SERVICE
TESTEDCOMPONENT
Request 3rd partyComponentResponse
7
THE TEST SITUATION – COMPONENT/SERVICE
TESTEDCOMPONENT
Request 3rd partyComponentResponse
?
?
8
3rd partyComponent
THE TEST SITUATION – COMPONENT/SERVICE
TESTEDCOMPONENT
Request
Response? missing new feature
9
3rd partyComponent
THE TEST SITUATION – COMPONENT/SERVICE
TESTEDCOMPONENT
Request
Response
10
THE TEST SITUATION – COMPONENT/SERVICE
TESTEDCOMPONENT
Request
Response
- No answer- Malformed answer
- invalid content-length
- invalid content-type- Errors in response
- E50x, E404, etc- Delayed answer,
Timeout
11
3rd partyComponent
THE TEST SITUATION – COMPONENT/SERVICE
TESTEDCOMPONENT
Request
Response
3rd partyComponent
3rd partyComponent
3rd partyComponent
12
THE TEST SITUATION – COMPONENT/SERVICE
TESTEDCOMPONENT
Request
Response
3rd partyComponent
3rd partyComponent
3rd partyComponent
3rd partyComponent
13
THE TEST SITUATION – COMPONENT/SERVICE
TESTEDCOMPONENT
Request
Response
3rd partyComponent
3rd partyComponent
3rd partyComponent
3rd partyComponent
14
THE TEST SITUATION – @ MICROSERVICES
TESTEDCOMPONENT
Request
Response
3rd partyComponent
3rd partyComponent
3rd partyComponent
3rd partyComponent
15
16
REQUIREMENTS
• We must monitor the messages between the components/services• so we need a Transparent Proxy that captures the messages
• We must generate component/service responses • so we need a highly configurable Service Stub
• That means static and dynamic response contents• Any message types and contents: HTML, XML, SOAP, JSON, REST, etc
• We must handle HTTP, HTTPS requests, even 2-way SSL• We need intelligent selection between Proxying the request or generate Stub response• We need easy integration with CI environments, test-automation friendly configuration• The solution should be robust and very stable• Shall offer extensibility
17
THE SOLUTIONTHE SOLUTION: WILMA
18
HOW WILMA WORKS?
TESTEDCOMPONENT
Request
Response
3rd partyComponent
3rd partyComponent
3rd partyComponent
3rd partyComponent
19
WILMA
HOW WILMA WORKS?
20
HOW WILMA WORKS? – Information-flow Diagram
HTTP/HTTPSRequest
Wilma Marker Switch proxy
Route Engine
PROXY / STUB
WilmaWebApp
WilmaWebAppReq
UI Config / Status
Message Template Set
Message Logging Queue
HTTP/HTTPS Response
STUB Response
-FIS, -gzip
STUB Response Request Response Generator
Response
Response Queue
-FIS, -gzip +FIS, +gzip
HTTP/HTTPS Response
HTTP/HTTPSRequest
21
HOW WILMA WORKS? – Transparent Proxy
HTTP/HTTPSRequest
Wilma Marker Switch proxy
Route Engine
PROXY / STUB
WilmaWebApp
WilmaWebAppReq
UI Config / Status
Message Template Set
Message Logging Queue
HTTP/HTTPS Response
STUB Response
-FIS, -gzip
STUB Response Request Response Generator
Response
Response Queue
-FIS, -gzip +FIS, +gzip
HTTP/HTTPS Response
HTTP/HTTPSRequest
22
HOW WILMA WORKS? – Message Logging
HTTP/HTTPSRequest
Wilma Marker Switch proxy
Route Engine
PROXY / STUB
WilmaWebApp
WilmaWebAppReq
UI Config / Status
Message Template Set
Message Logging Queue
HTTP/HTTPS Response
STUB Response
-FIS, -gzip
STUB Response Request Response Generator
Response
Response Queue
-FIS, -gzip +FIS, +gzip
HTTP/HTTPS Response
HTTP/HTTPSRequest
23
HOW WILMA WORKS? – Handling a Request as Proxy
HTTP/HTTPSRequest
Wilma Marker Switch proxy
Route Engine
PROXY / STUB
WilmaWebApp
WilmaWebAppReq
UI Config / Status
Message Template Set
Message Logging Queue
HTTP/HTTPS Response
STUB Response
-FIS, -gzip
STUB Response Request Response Generator
Response
Response Queue
-FIS, -gzip +FIS, +gzip
HTTP/HTTPS Response
HTTP/HTTPSRequest
24
HOW WILMA WORKS? – Handling a Request as Stub
HTTP/HTTPSRequest
Wilma Marker Switch proxy
Route Engine
PROXY / STUB
WilmaWebApp
WilmaWebAppReq
UI Config / Status
Message Template Set
Message Logging Queue
HTTP/HTTPS Response
STUB Response
-FIS, -gzip
STUB Response Request Response Generator
Response
Response Queue
-FIS, -gzip +FIS, +gzip
HTTP/HTTPS Response
HTTP/HTTPSRequest
25
HOW WILMA WORKS? – Configuring the Stub Service
• Configuration file: XML files• Request/Response pairs are defined as
• Condition Descriptors and Response Descriptors• Request – Condition Descriptors• Built-in Conditions (check header / body content)• Several conditions can be combined (and/or) and negated• External conditions can be used
• Response – Response Generation• Template files can be used (static answer)• Built-in Template Formatters can be used to alter the templates• Response can be generated (dynamic answer)• External Template Generators and Template Formatters can be used
• And so on (delay the response, malformed responses, Exxx responses…)
26
HOW WILMA WORKS? – Configuring the Stub Service
27
HOW WILMA WORKS? – Configuring the Stub Service
28
WHERE WILMA CAN BE USED?
• Local development environment – analyse messages, stub services• CI environment – can stub surrounding services of the tested service• Integration test environment – analyse messages, stub services
29
HOW WILMA CAN BE USED?
• As proxy (even if STUB mode is used only):
30
HOW WILMA CAN BE USED?
• Single Wilma instance can serve many services in parallel
TESTEDCOMPONENT
Request
Response
3rd partyComponent
3rd partyComponent
3rd partyComponent
3rd partyComponent
31
HOW WILMA CAN BE USED?
• Even can be used with microservices
Service A
Service BService D
Service EService H
Service C
Service I
Service G
Service F
32
SHOW WILMA IN ACTION!
• Config1 + https://info.epam.com/en/news.html• Config2 + https://info.epam.com/register
33
WHAT WILMA OFFERS IN ADDITION?
34
OPERATION MODES
Wilma1
Exclusive PROXY2
Exclusive STUB3
35
OPERATION MODE – Exclusive PROXY Mode
HTTP/HTTPSRequest
Wilma Marker Switch proxy
Route Engine
PROXY / STUB
WilmaWebApp
WilmaWebAppReq
UI Config / Status
Message Template Set
Message Logging Queue
HTTP/HTTPS Response
STUB Response
-FIS, -gzip
STUB Response Request Response Generator
Response
Response Queue
-FIS, -gzip +FIS, +gzip
HTTP/HTTPS Response
HTTP/HTTPSRequest
36
OPERATION MODE – Exclusive STUB Mode
HTTP/HTTPSRequest
Wilma Marker Switch proxy
Route Engine
PROXY / STUB
WilmaWebApp
WilmaWebAppReq
UI Config / Status
Message Template Set
Message Logging Queue
HTTP/HTTPS Response
STUB Response
-FIS, -gzip
STUB Response Request Response Generator
Response
Response Queue
-FIS, -gzip +FIS, +gzip
HTTP/HTTPS Response
HTTP/HTTPSRequest
37
WHAT WILMA OFFERS IN ADDITION?
• INTERCEPTORS• Both Request and Response can be intercepted• Any operation on the intercepted message can be performed• External Interceptor classes can be used
38
Service A Service B
INTERCEPTOR EXAMPLE – A CIRCUIT BREAKER
• Need stub configuration – to provide response instead of B, in case B is in bad shape
• An interceptor evaluates the responses• If Service B gave bad response:
– turns on STUB for Service B– After a defined timout turns off STUB for Service B
39
WHAT WILMA OFFERS IN ADDITION?
• RUN-TIME CONFIGURATION• Stub configuration• Upload and download templates, classes, jars, messages
40
RUN-TIME CONFIGURATION OF WILMA VIA UI
41
RUN-TIME CONFIGURATION OF WILMA VIA UI
42
WHAT WILMA OFFERS IN ADDITION?
• BROWSE/SEARCH ON LOGGED MESSAGES• Via Wilma UI itself• Via Wilma Message Search Application
43
MESSAGE BROWSING VIA WILMA UI
44
MESSAGE BROWSING VIA WILMA MESSAGE SEARCH
• Wilma Message Search application• high performance search engine, • offers searching of the request-response pairs those were logged by Wilma• Correlation ID
45
WHAT WILMA OFFERS IN ADDITION?
• API• Stub configuration• Upload and download templates, classes, jars, messages• Load information
46
WILMA HTTP API
47
WILMA-SERVICE-API LIBRARY
48
WILMA-SERVICE-API LIBRARY
49
WHAT WILMA OFFERS IN ADDITION?
• Built-in Safeguards• Maintains amount of messages saved onto disk – no run out of disk space
50
WHAT WILMA OFFERS IN ADDITION?
• Built-in Safeguards• Self protecting machanisms against overload• Load information is available
51
WHAT WILMA OFFERS IN ADDITION?
52
WHAT WILMA OFFERS IN ADDITION?
•Open Sourced under license GNU GPL v3.0
•Available via GitHub, including documentation
•Feedbacks are welcome and as well as contribution
53
FUTURE OF WILMA
• .NET API
•Service API lib enhancements
•Promotion within EPAM and
for Customers
•Depends on the OS community
54
Any Questions?
Wilma is @ https://github.com/epam/Wilma
AUGUST 24, 2015