This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sessionFactory | |
// ... | |
logHibernateStats(controller: '*', action: '*') { | |
before = { | |
Statistics stats = sessionFactory.statistics | |
log.info "\n### In action: $controllerName/$actionName ###" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final String START_TIME = 'Hibernate_Start_Time' | |
def filters = { | |
logHibernateStats(controller: '*', action: '*') { | |
before = { | |
request[START_TIME] = System.currentTimeMillis() | |
} | |
afterView = { | |
Long end = System.currentTimeMillis() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
logHibernateStats = 'NEVER' | |
// ... | |
development { | |
logHibernateStats = 'ALWAYS' // From ALWAYS, ALLOWED, NEVER | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final String START_TIME = 'Hibernate_Start_Time' | |
def sessionFactory | |
// ... | |
logHibernateStats(controller: '*', action: '*') { | |
before = { | |
String enabledString = grailsApplication.config.logHibernateStats | |
Statistics stats = sessionFactory.statistics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
usage(){ | |
echo "Usage: `basename $0` [-h] [-r] [-t testOptions] [<directory>...]\n" | |
echo ' -h Show this help message.' | |
echo ' -r Remove the default directories, and only use the ones provided. Without the flag, the provided directories will be appended to the default list.' | |
echo ' -t Options to pass to "grails test-app". Default: none.' | |
echo ' See: http://grails.org/doc/latest/ref/Command%20Line/test-app.html' | |
} | |
# Parse the arguments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usage: gitTestModified.sh [-h] [-r] [-t testOptions] [...]</code> | |
-h Show this help message. | |
-r Only check the directories provided. Otherwise, the provided directories will be appended to the directory list. | |
-t Options to pass to "grails test-app". Default: none. | |
See: http://grails.org/doc/latest/ref/Command%20Line/test-app.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def (foo, bar) = ['foo', 'bar']; | |
assert foo == 'foo' | |
assert bar == 'bar' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(p.firstname, p.lastname) = "My name".split() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Dog { | |
Integer age | |
String name | |
Color color | |
} | |
enum Color { | |
BLACK, | |
GOLD, | |
WHITE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dog dog = new Dog() | |
//... | |
dog.name = 'Rex' | |
dog.age = 2 | |
dog.color = Color.BLACK |
OlderNewer