AWS, Grails

AWS Elastic Beanstalk ( Grails Application )

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...

by Ranvijay Jamwal
Tag: Grails
03-Jun-2015

Grails

Run multiple app instances with diff config files on same tomcat server

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...

by Amit Jain
Tag: Grails
28-May-2015

Grails

Adding field to hasMany, got MySql error ??

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...

by Ankit Agrawal
Tag: Grails
25-May-2015

Grails

Compile GroovyScript at Runtime and allow caching of compiled source to avoid recompilation at Runtime using GroovyClassLoader

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...

by Tarun Pareek
Tag: Grails
01-May-2015

Grails

Log SQL Query with Data Bindings in grails for a piece of code

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...

by Sandeep Poonia
Tag: Grails
23-Apr-2015

Grails

Making a domain non-persistent

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...

by Vinay Prajapati
Tag: Grails
17-Apr-2015

Grails

Parsing URL Mappings in Grails

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...

by Sandeep Poonia
Tag: Grails
17-Apr-2015

Grails

Reusing grails Criteria for multiple domains using Closure.delegate

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:...

by Aseem Bansal
Tag: Grails
12-Apr-2015

Technology

Unit test a method returning an object of protected class

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...

by Neha Gupta
Tag: Grails
22-Mar-2015

Grails

Track my traffic -Implementing Traffic Analytics

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...

by kartikey
Tag: Grails
24-Feb-2015

AngularJS, Front End Development

Minification safe Angular.js

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...

by Brij Kishor
Tag: Grails
17-Feb-2015

Grails

SonarQube – All in one code quality manager

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...

by Prakriti Sharma
Tag: Grails
16-Feb-2015