Ever wondered what to do if you have to make a very quick deployment of an application on the AWS Cloud ? You would launch servers, make an infrastructure and then Install applications which is somewhat a tedious process. How would it sound if the deployments are made in seconds ? Here is an AWS service for all the developers and the...
The application I am working on, requires different configurations for the each client. For internal QA environment, we wanted to deploy multiple instances of this app with different configuration setup so that it can be tested easily and without creating tomcat instance for each deployment. So the challenge was to use different...
It's a common practice to add fields to Grails domain's hasMany block while in database a foreign key relationship is maintained for every such entry. In other words, for each foreign key, we have a column in parent table (or domain) and a reference column in other table. I was adding a field into hasMany block recently when I got this...
In some cases we need mechanism to provide compilation of groovy script at runtime. But at the same time we need to make sure it doesn't consume the JVM to perform compilation every time when we try to access that script. Hence to perform this we need to do the following task : Compile Groovy Script at Runtime. Cache the compiled...
Although in grails, we can use the logSql property in the DataSource file to log SQL queries or enable loggers "org.hibernate.SQL" for logging queries and "org.hibernate.type.descriptor.sql.BasicBinder" for logging bindings. But this solution wouldn't be that much helpful if we just want the logging for a particular piece of code rather...
In grails app, there might come scenarios where one need to create a non-persistent domain rather than creating a command obejct or POJO / POGO. GORM comes with a handy static property mapWith which has default value GORM (which associates any domain with gorm persistence layer). To make a domain non persistent set mapWith="none". For...
There are times when we need to parse the URL mappings in our grails app. In my case we have a REST API. In which we have implemented a generic query method for all controllers but it is available to only a few using custom URL mappings. We wanted to create test cases in such a way for query action that each time a test case runs it...
I recently had a situation where I had the exact same criteria in multiple domains. I found a way to DRY them using Closure.delegate. I wanted to share that in this post. Just including the relevant details the domains that I had were like the following. [code language="groovy"]class Subscription { static belongsTo = [topic:...
Following is an example of testing a method which returns an object of protect class: In the previous blog we talked about fetching the list of message codes from message.properties file. While writing the test case for CustomisedPluginAwareResourceBundleMessageSource, I was not able to test the message properties that are available...
This one is for a particular use case, so lets come straight out to the point. We start with the obvious first: Problem Statement: To track the traffic of a public page from your application. User Story: The current system needs to add a feature that would enable the end user to use your product to track the traffic on his...
AngularJS, Front End Development
Recently, I wanted to upgrade my Grails application to 2.4.3 and also switched from resource plugin to assets-pipeline plugin. As everything was going good in the development, so I pushed it to QA after which I was bombarded with JavaScript errors and missing providers. What has happened?? So here, Angular.js internal dependency...
Introduction to SonarQube: We all are well aware of the importance of codebase quality, unhampered of "deadly programming skills" which can wreck our code. But isn't it quite cumbersome to implement different tools to look upon its different aspects. What if in one place, we can have detailed insight of all the development sins. This...