This post explains how to externalize cache configuration to a file instead of configuring them programmatically. For our example, I will be using ehcache tool. Below is the ehcache file which describe the configuration information required to create a cache named “ready-cache”. The key and value data type is String and the entries will be…… Continue reading Configuring cache non-programmatically
Month: March 2017
Stubbing private methods
This post explains how to stub private methods of a class using PowerMock. Lets consider a class named “Class1” with the structure as shown below Classes to be tested package package3; public class Class1 { private int method1(int value1) { return value1 + 2; } public int method2(int value2) { return this.method1(value2); } } We…… Continue reading Stubbing private methods
Quartz Simple Example
Quartz schedular framework can be used to schedule jobs. This post explains how we can use it with a simple example. We need the below jars 1) c3p0-0.9.1.1.jar 2) log4j-1.2.16.jar 3) quartz-2.2.3.jar 4) quartz-jobs-2.2.3.jar 5) slf4j-api-1.7.7.jar 6) slf4j-log4j12-1.7.7.jar log4j.xml file in the classpath with the below configurations log4j.xml <?xml version=”1.0″ encoding=”UTF-8″?> <!DOCTYPE log4j:configuration SYSTEM “log4j.dtd”>…… Continue reading Quartz Simple Example
Achieving data binding with object model
This post explains how to achieve mapping of json data represented by an object model to particular java object. Here object model is tree like data structure which reads and stores the entire json content in memory. The difference between this post and other posts in Binding section is that latter posts explains marshalling and…… Continue reading Achieving data binding with object model