Unit testing best practices

There are a lot of articles and blog posts written about unit testing best practices, patterns etc. Over the course of years after writing many varieties of unit test cases with and without mocking frameworks and reviewing many tests, there are few patterns that I have noticed many times again and again. For a change instead of writing about best practices I have compiled a list of testing bad practices to avoid.

Continue reading “Unit testing best practices”

Unit testing with Junit

How can a developer guarantee that the beautiful code they wrote would work as intended? By running unit tests on that code. This is the short answer. Unit tests should be well designed, easy to read and understand and more importantly easy to maintain. Unit tests should test all possible

Continue reading “Unit testing with Junit”

Using @ApiImplicitParams with Swagger 2

In the last post we saw how to use Swagger 2 with SpringFox and JAX-RS. Using annotations for methods usually pulls in all the parameters for that method. There may be certain instances where you may have to pass in extra header param for a method to work. Can we do that using Swagger 2 annotations?

Continue reading “Using @ApiImplicitParams with Swagger 2”

Using Swagger 2 with SpringFox and JAX-RS in a SpringBoot app

Swagger 2 is the defacto API documentation tool that is used in many Spring boot applications. Most of the examples for using swagger with spring boot are with springMVC. There are certain use cases where you would be using spring boot with JAX-RS. Is it possible to use Swagger 2 with SpringBoot and JAX-RS applications?

Continue reading “Using Swagger 2 with SpringFox and JAX-RS in a SpringBoot app”

ELK Stack Architecture 1

In this post we are going to look at an ELK stack architecture for a small scale implementation.  Keep in mind that this architecture is suitable for a small sized on-prem installation and the index capacity is determined by the hardware and disk space availability.

Continue reading “ELK Stack Architecture 1”

ELK Stack – Monitor elastic nodes using cerebro

One of the most often asked question about the ELK stack is how can i monitor the elastic nodes itself. Monitoring the nodes here includes all indexes, all the data nodes, index size, total index size, etc. One tool that i use for my implementations is Cerebro.

Continue reading “ELK Stack – Monitor elastic nodes using cerebro”

Block uploads of certain file type to sites and folders in Alfresco 5.x

By default Alfresco does not have any restrictions on file types that can be added to the repository. Alfresco accepts .exe, .dll, .sh, .js, .cs, .java etc. So if there is a business requirement to block certain file types from being uploaded to a site of folder in Alfresco, how can we go about implementing that in simple fashion?

 

Continue reading “Block uploads of certain file type to sites and folders in Alfresco 5.x”

ELK Stack – Elastic Search Zen Discovery

ElasticSearch recommends setting up master, data and ingest nodes for a production deployment. The typical structure would be few master nodes, some data nodes and some or no ingest nodes. There is also a client node that is recommended to be installed at the same box where kibana Continue reading “ELK Stack – Elastic Search Zen Discovery”

Create rolling monthly, weekly and daily Logstash indices

How often should a new log index be created? Once a day, Once a week, Once a month? A simple search in Google would return various responses each arguing the pros and cons of creating indexes daily or weekly. Lets look at how to do that with logstash.

Continue reading “Create rolling monthly, weekly and daily Logstash indices”

Introduction to ELK stack 5.x – Elasticsearch, Logstash and Kibana

The Elk stack is a serious competitor in the log analysis market. ELK Stands for Elastic, LogStash and Kibana, three individual products that work together to collect, index and display the information in various ways useful for the end user.

Continue reading “Introduction to ELK stack 5.x – Elasticsearch, Logstash and Kibana”