Monday, 1 June 2020

Intellij Idea can't resolve generated class

It was really annoying issue, we had some maven plugin that generates classes from some schema, and for some reason Intellij Idea cant resolve this class. It just marks it with red. The reason was too big file size i've increased it like this:

# Maximum file size (kilobytes) IDE should provide code assistance for.
idea.max.intellisense.filesize=6000

# Maximum file size (kilobytes) IDE is able to open.
idea.max.content.load.filesize=6000

in Help > Edit Custom Properties

and then File > Restart & invalidate

Tuesday, 28 April 2020

End-to-end tests with Spring and Test Containers

I've heard previously about test-containers but didn't have chance to read about it. Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.

So basically it simplify you process of creating and maintaining end-to-end tests. You no need external containers you simple can run in on jenkins during your usual testing life cycle.

Two articles illustrate this approach with  Selenium and one more with WireMock

Sunday, 26 April 2020

Micrometer - SLF4J but for metrics

Nice tool to try, Micrometer is - facade over the instrumentation clients for a number of popular monitoring systems. Currently, it supports the following monitoring systems: Atlas, Datadog, Graphite, Ganglia, Influx, JMX and Prometheus. More in tutorial

Syntaxis is simple and straightforward:

 Metrics.counter("objects.instance").increment();

Sunday, 27 October 2019

Useful Java tools to try

java mission control - to monitor jvm

lincheck testing concurrent data structures

jmh - it is tool for microbenchmarking your code

debezium - tool to capture database changes (mongo, oracle...)

Spring Cloud Contract

Cool tool to test interaction between you apps without running all of them. Need just describe contract of you service and inject in via wiremock were it is needed.  Here is a tutorial

Spring reactive

Spring introduced reactive support with WebFlux it implements basic Reactive concepts. It works with Netty, non blocking server.

Also Spring added support of the RSocket protocol it is not based on HTTP and provides nice features as back-pressure. You can establish direct connection from the web-browser to rsocket server. Spring provides API to implement listeners, smth similar like rest controllers.