I recently had a chance to investigate how to increase flexibility of my integration test, written on gatling and scala. I have already written around 50 test cases, and I need couple of improvements: Be able to change url of my web service. By default, it should run on localhost, but as soon as I will configure continuous delivery, I will need to change web service url to some remote ip. For that needs I am planning to use maven preferences. More precise configuration of my setup function. By this time, I had no assertion strategies and I was confused that my tests go green even if some test case failed. Dynamic web service url I was hoping that gatling has something like Spring has - placeholders, but it occurs that the only way I can get property from maven is by system property val host = System.getProperty(“integration.host”) You also need to add additional configuration on your gatling plugin in maven <jvmArgs> <jvmArg>-Dintegration.host=${integration.url}</jvmArg> </jvmArgs> Where ${integration.url} is taken from maven module properties Here is full pom.xml After this modification, You will be able to change your basicUrl mvn test -Dintegration.url=http:${REMOTE_IP}:8080/…. and my test scenarios will run on dedicated server. Such...
Today I experienced issue with Jenkins - After some system modifitcation I received failed build with message
Caused by: java.lang.UnsatisfiedLinkError: > /home/${user}/tools/jdk1.7.0_71/jre/lib/i386/xawt/libmawt.so: libXrender.so.1: cannot open shared object file: No such file or directory
So I search in the internet and found the solution
sudo apt-get install libxrender-dev
sudo apt-get install libxtst-dev
I’m really not sure what it was, I guess it could be because I accidentally installed openjdk instead of oracle jdk.
In fact, It helped me.
Sometimes it’s hard for me to deploy your application each time when you chang something in your code. Truly, if it is important for you to deploy your application at least twice per day, and the process of deployment will take up to 10 minutes, then it will result to +- 200 minutes per month and 2400 minutes per year!!! That’s almost 2 days. So, instead of doing deployment each time manually, I propose you to do that with your Continuous Integration tool. The process of continuous deploy is called continuous delivery, which includes Build -> Deploy -> Test -> Release. Required tools In this article you will need a couple of tools to succed Continuous Integration tool. It is important to trigger every change you made in your code. For that needs you can use Jenkins continuous integration server. Build tool. It is a common knowledge that nowadays we don’t need to build our apps manually, now we build them by ready tools, that simplifies our development process. I will be using maven for that.It helps me to manage my dependencies, split my application into several modules, has many plugins, can check the quality of my code. Application server....
If you are using XML configuration in your Spring application, you should know about gorgeous feature, that spring has: bean inheritance. What does this mean ? This mean, that you can create an abstract bean with some predefined properties, and later, you will be able to make an inheritance from this bean.
Here is an example
Here you have DefaultDao implementation, which has three fields - persistenceManager, which is the same in every Dao class, queryBuilder for building dynamic queries, which are dynamic field, and entityClass, which is the name of Class, that will be mapped to result from database.
And here we have xml context, that we use without bean inheritance.
After some modification and refactoring we will receive
As you can see, we reduce number of lines in context and now we are instantiating persistenceManager from one place and if we will want to change it, we will do that very quickly.
Recently I experienced a problem, when I had CharacterEncodingFilter filter in my web.xml, but no encoding were done at all. I started to investigate this problem and find out, that few weeks ago I added additional filters on top of my web.xml, and , as a result, my CharacterEncodingFilter was placed on second or third position.Good news for me, I added integration test with ukrainian words, and my web service returned some incorrect characters.
After few minutes, I discovered, that If you want to have correct unicode data, then you need to place encoding filter at the top of all your filters. Thereafter, your filter will the first chain and you will be sure, that all other filters will work with correct unicode.