This repo will be serving the base having multiple modules where concepts will be practise.
Required Interfaces concept forwarded by 'Martin Fowler'. Explanation can be followed @ https://martinfowler.com/bliki/RequiredInterface.html
client : required-interface-client-layer
service : required-interface-service-layer
client need to use PrintService
from service layer, client is already dependency of Service layer, so normally if we
want to access PrintService class we need to add service as dependency and as result it would introduce cyclic dependency
and will not be able to compile.
In order to make it working, we define client base interface and we implement them in service and use what we want from service.
RequiredInterface
in client module and its implementation in service layer tells the whole story that how to enable client
to use services from parent layer.
MapStruct is a code generator that greatly simplifies the implementation of mappings between Java bean types based on a convention over configuration approach.
The generated mapping code uses plain method invocations and thus is fast, type-safe and easy to understand.
Credential(username, password)
-----mapping to ---->>> CredentialDto
using interface CredentialMapper
for more examples explore https://github.com/mapstruct/mapstruct-examples
Log4j has ability to distinguish between logs and funnel out into dedicated files, this all can be achieved by using
Marker filter.
Module logging has implementation of Maker concepts, where various logs are funnel out to their dedicated log files.
log42.xml
has implementation of seperation logic.
<MarkerFilter marker="SPECIFIC" onMatch="ACCEPT" onMismatch="DENY"></MarkerFilter>
Module customannotation
will contain code to create custom annotation and then process with two approaches
Normal Annotation processor
Aspect Oriented Annotation Having @Identifier annotation on method, based on age it will be executed and when the age is below the limit it will throw exception and will not provide required data for that person.
Awaitility is a small Java DSL for synchronizing asynchronous operations
A simple asynchronous service which increments a counter and sleep for some time before get initialized. The example is proof of concept that awaitility make the test wait until a condition is meet and then assert the output.
Here, i will try to provide examples for
- Extension
- Tried three extension like Parameter resolver, Exceptionhandler and postprocessor exception
- LoggingExtensionTest is describing the test usge of all above extensions.
- Parameterized Tests
Run a basic hello world Jmeter testing scenario in dockerized environment with master-slave
configuration.
docker-compose.yml
will spawn Master docker and its slaved to run a basic jmeter scenario prepared
in jmeter i.e scenario.jmx
.
Grafana : http://localhost:3000
Prometheus: http://localhost:9090
Master-Slave0-Slave1 ---(sendData)---> Prometheus
docker-compose --profile monitor up --build
- add prometheus datasource to Grafana (http://localhost:9090 - Access 'Browser')
docker-compose --profile jmeter up --build -d
Note: Ideally no profile is required but to till the writing of this note i was not able to correctly configure datasource
A docker vault in development mode spins up and basic credentials added
via http://localhost:8200
and could be read with help of VaultTemplate class.
http://localhost:8200
docker-compose up -d
Application can be run with env variable i.e VAULT_TOKEN=vault;VAULT_SERVER=http://localhost:8200 in run configuration