This repository has been archived by the owner on Jan 26, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving test assets (the apps used by the tests) of 'vmc' to new repo.
Change-Id: Ibfde0908cd5e0456258dd7b2c75228dfbb42830c
- Loading branch information
AB Srinivasan
committed
Sep 15, 2011
0 parents
commit d81aed4
Showing
231 changed files
with
21,111 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
target | ||
.classpath | ||
.metadata | ||
.project | ||
.settings | ||
*~ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
plugins |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
This app was originally created using the 'grails' shell. Subsequently, it was | ||
'maven-ised' so as to result in a canonical way to build / clean the app. The | ||
'pom.xml' was generated by invoking "mvn org.grails:grails-maven-plugin:1.3.7:create-pom -DgroupId=org.cloudfoundry" | ||
To build the Grails guestbook application: | ||
1. cd into the root directory of the app (the directory where this README is). | ||
2. Invoke the grails shell command "grails clean" followed by "grails war" | ||
2'. Alternately you can invoked "mvn clean package" | ||
3. The resulting war should be in the target directory. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
desc "Build the application war" | ||
task :build => [:clean] do | ||
puts "Building '#{File.basename(Dir.pwd)}'" | ||
exit_code = nil | ||
build_cmd = "grails war" | ||
`#{build_cmd}` | ||
exit_code = $?.dup | ||
if exit_code == 0 | ||
puts "Successfully built '#{File.basename(Dir.pwd)}'" | ||
else | ||
puts "Failed to build '#{File.basename(Dir.pwd)}'" | ||
end | ||
end | ||
|
||
desc "Clean out build artifacts" | ||
task :clean do | ||
puts "Cleaning '#{File.basename(Dir.pwd)}'" | ||
exit_code = nil | ||
clean_cmd = "grails clean" | ||
`#{clean_cmd}` | ||
exit_code = $?.exitstatus | ||
if exit_code == 0 | ||
puts "Successfully cleaned '#{File.basename(Dir.pwd)}'" | ||
else | ||
puts "Failed to clean '#{File.basename(Dir.pwd)}'" | ||
end | ||
end | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#Grails Metadata file | ||
#Tue Apr 05 12:05:47 PDT 2011 | ||
app.grails.version=1.3.7 | ||
app.name=guestbook | ||
app.servlet.version=2.4 | ||
app.version=0.1 | ||
plugins.hibernate=1.3.7 | ||
plugins.tomcat=1.3.7 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class BootStrap { | ||
|
||
def init = { servletContext -> | ||
} | ||
def destroy = { | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
grails.project.class.dir = "target/classes" | ||
grails.project.test.class.dir = "target/test-classes" | ||
grails.project.test.reports.dir = "target/test-reports" | ||
//grails.project.war.file = "target/${appName}-${appVersion}.war" | ||
grails.project.dependency.resolution = { | ||
// inherit Grails' default dependencies | ||
inherits("global") { | ||
// uncomment to disable ehcache | ||
// excludes 'ehcache' | ||
} | ||
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose' | ||
repositories { | ||
grailsPlugins() | ||
grailsHome() | ||
grailsCentral() | ||
|
||
// uncomment the below to enable remote dependency resolution | ||
// from public Maven repositories | ||
//mavenLocal() | ||
//mavenCentral() | ||
//mavenRepo "http://snapshots.repository.codehaus.org" | ||
//mavenRepo "http://repository.codehaus.org" | ||
//mavenRepo "http://download.java.net/maven/2/" | ||
//mavenRepo "http://repository.jboss.com/maven2/" | ||
} | ||
dependencies { | ||
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg. | ||
|
||
// runtime 'mysql:mysql-connector-java:5.1.13' | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// locations to search for config files that get merged into the main config | ||
// config files can either be Java properties files or ConfigSlurper scripts | ||
|
||
// grails.config.locations = [ "classpath:${appName}-config.properties", | ||
// "classpath:${appName}-config.groovy", | ||
// "file:${userHome}/.grails/${appName}-config.properties", | ||
// "file:${userHome}/.grails/${appName}-config.groovy"] | ||
|
||
// if(System.properties["${appName}.config.location"]) { | ||
// grails.config.locations << "file:" + System.properties["${appName}.config.location"] | ||
// } | ||
|
||
grails.project.groupId = appName // change this to alter the default package name and Maven publishing destination | ||
grails.mime.file.extensions = true // enables the parsing of file extensions from URLs into the request format | ||
grails.mime.use.accept.header = false | ||
grails.mime.types = [ html: ['text/html','application/xhtml+xml'], | ||
xml: ['text/xml', 'application/xml'], | ||
text: 'text/plain', | ||
js: 'text/javascript', | ||
rss: 'application/rss+xml', | ||
atom: 'application/atom+xml', | ||
css: 'text/css', | ||
csv: 'text/csv', | ||
all: '*/*', | ||
json: ['application/json','text/json'], | ||
form: 'application/x-www-form-urlencoded', | ||
multipartForm: 'multipart/form-data' | ||
] | ||
|
||
// URL Mapping Cache Max Size, defaults to 5000 | ||
//grails.urlmapping.cache.maxsize = 1000 | ||
|
||
// The default codec used to encode data with ${} | ||
grails.views.default.codec = "none" // none, html, base64 | ||
grails.views.gsp.encoding = "UTF-8" | ||
grails.converters.encoding = "UTF-8" | ||
// enable Sitemesh preprocessing of GSP pages | ||
grails.views.gsp.sitemesh.preprocess = true | ||
// scaffolding templates configuration | ||
grails.scaffolding.templates.domainSuffix = 'Instance' | ||
|
||
// Set to false to use the new Grails 1.2 JSONBuilder in the render method | ||
grails.json.legacy.builder = false | ||
// enabled native2ascii conversion of i18n properties files | ||
grails.enable.native2ascii = true | ||
// whether to install the java.util.logging bridge for sl4j. Disable for AppEngine! | ||
grails.logging.jul.usebridge = true | ||
// packages to include in Spring bean scanning | ||
grails.spring.bean.packages = [] | ||
|
||
// request parameters to mask when logging exceptions | ||
grails.exceptionresolver.params.exclude = ['password'] | ||
|
||
// set per-environment serverURL stem for creating absolute links | ||
environments { | ||
production { | ||
grails.serverURL = "http://www.changeme.com" | ||
} | ||
development { | ||
grails.serverURL = "http://localhost:8080/${appName}" | ||
} | ||
test { | ||
grails.serverURL = "http://localhost:8080/${appName}" | ||
} | ||
|
||
} | ||
|
||
// log4j configuration | ||
log4j = { | ||
// Example of changing the log pattern for the default console | ||
// appender: | ||
// | ||
//appenders { | ||
// console name:'stdout', layout:pattern(conversionPattern: '%c{2} %m%n') | ||
//} | ||
|
||
error 'org.codehaus.groovy.grails.web.servlet', // controllers | ||
'org.codehaus.groovy.grails.web.pages', // GSP | ||
'org.codehaus.groovy.grails.web.sitemesh', // layouts | ||
'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping | ||
'org.codehaus.groovy.grails.web.mapping', // URL mapping | ||
'org.codehaus.groovy.grails.commons', // core / classloading | ||
'org.codehaus.groovy.grails.plugins', // plugins | ||
'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration | ||
'org.springframework', | ||
'org.hibernate', | ||
'net.sf.ehcache.hibernate' | ||
|
||
warn 'org.mortbay.log' | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
dataSource { | ||
pooled = true | ||
driverClassName = "org.hsqldb.jdbcDriver" | ||
username = "sa" | ||
password = "" | ||
} | ||
hibernate { | ||
cache.use_second_level_cache = true | ||
cache.use_query_cache = true | ||
cache.provider_class = 'net.sf.ehcache.hibernate.EhCacheProvider' | ||
} | ||
// environment specific settings | ||
environments { | ||
development { | ||
dataSource { | ||
dbCreate = "create-drop" // one of 'create', 'create-drop','update' | ||
url = "jdbc:hsqldb:mem:devDB" | ||
} | ||
} | ||
test { | ||
dataSource { | ||
dbCreate = "update" | ||
url = "jdbc:hsqldb:mem:testDb" | ||
} | ||
} | ||
production { | ||
dataSource { | ||
dbCreate = "update" | ||
url = "jdbc:hsqldb:file:prodDb;shutdown=true" | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class UrlMappings { | ||
|
||
static mappings = { | ||
"/$controller/$action?/$id?"{ | ||
constraints { | ||
// apply constraints here | ||
} | ||
} | ||
|
||
"/"(view:"/index") | ||
"500"(view:'/error') | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place your Spring DSL code here | ||
beans = { | ||
} |
100 changes: 100 additions & 0 deletions
100
...ails-app/controllers/com/vmware/appcloud/testapps/grails/guestbook/GuestController.groovy
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package com.vmware.appcloud.testapps.grails.guestbook | ||
|
||
class GuestController { | ||
|
||
static allowedMethods = [save: "POST", update: "POST", delete: "POST"] | ||
|
||
def index = { | ||
redirect(action: "list", params: params) | ||
} | ||
|
||
def list = { | ||
params.max = Math.min(params.max ? params.int('max') : 10, 100) | ||
[guestInstanceList: Guest.list(params), guestInstanceTotal: Guest.count()] | ||
} | ||
|
||
def create = { | ||
def guestInstance = new Guest() | ||
guestInstance.properties = params | ||
return [guestInstance: guestInstance] | ||
} | ||
|
||
def save = { | ||
def guestInstance = new Guest(params) | ||
if (guestInstance.save(flush: true)) { | ||
flash.message = "${message(code: 'default.created.message', args: [message(code: 'guest.label', default: 'Guest'), guestInstance.id])}" | ||
redirect(action: "show", id: guestInstance.id) | ||
} | ||
else { | ||
render(view: "create", model: [guestInstance: guestInstance]) | ||
} | ||
} | ||
|
||
def show = { | ||
def guestInstance = Guest.get(params.id) | ||
if (!guestInstance) { | ||
flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'guest.label', default: 'Guest'), params.id])}" | ||
redirect(action: "list") | ||
} | ||
else { | ||
[guestInstance: guestInstance] | ||
} | ||
} | ||
|
||
def edit = { | ||
def guestInstance = Guest.get(params.id) | ||
if (!guestInstance) { | ||
flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'guest.label', default: 'Guest'), params.id])}" | ||
redirect(action: "list") | ||
} | ||
else { | ||
return [guestInstance: guestInstance] | ||
} | ||
} | ||
|
||
def update = { | ||
def guestInstance = Guest.get(params.id) | ||
if (guestInstance) { | ||
if (params.version) { | ||
def version = params.version.toLong() | ||
if (guestInstance.version > version) { | ||
|
||
guestInstance.errors.rejectValue("version", "default.optimistic.locking.failure", [message(code: 'guest.label', default: 'Guest')] as Object[], "Another user has updated this Guest while you were editing") | ||
render(view: "edit", model: [guestInstance: guestInstance]) | ||
return | ||
} | ||
} | ||
guestInstance.properties = params | ||
if (!guestInstance.hasErrors() && guestInstance.save(flush: true)) { | ||
flash.message = "${message(code: 'default.updated.message', args: [message(code: 'guest.label', default: 'Guest'), guestInstance.id])}" | ||
redirect(action: "show", id: guestInstance.id) | ||
} | ||
else { | ||
render(view: "edit", model: [guestInstance: guestInstance]) | ||
} | ||
} | ||
else { | ||
flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'guest.label', default: 'Guest'), params.id])}" | ||
redirect(action: "list") | ||
} | ||
} | ||
|
||
def delete = { | ||
def guestInstance = Guest.get(params.id) | ||
if (guestInstance) { | ||
try { | ||
guestInstance.delete(flush: true) | ||
flash.message = "${message(code: 'default.deleted.message', args: [message(code: 'guest.label', default: 'Guest'), params.id])}" | ||
redirect(action: "list") | ||
} | ||
catch (org.springframework.dao.DataIntegrityViolationException e) { | ||
flash.message = "${message(code: 'default.not.deleted.message', args: [message(code: 'guest.label', default: 'Guest'), params.id])}" | ||
redirect(action: "show", id: params.id) | ||
} | ||
} | ||
else { | ||
flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'guest.label', default: 'Guest'), params.id])}" | ||
redirect(action: "list") | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...ls/guestbook/grails-app/domain/com/vmware/appcloud/testapps/grails/guestbook/Guest.groovy
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.vmware.appcloud.testapps.grails.guestbook | ||
|
||
class Guest { | ||
String name | ||
Date dateCreated // Predefined names by Grails will be auto-filled | ||
} |
Oops, something went wrong.