Permalink
Browse files

First release

  • Loading branch information...
Björn Wilmsmann
Björn Wilmsmann committed Mar 16, 2010
0 parents commit 575bdca965b9d22040f22ddd25e9702df90965ff
Showing with 11,594 additions and 0 deletions.
  1. +50 −0 AutoTestGrailsPlugin.groovy
  2. +13 −0 LICENSE.txt
  3. +6 −0 application.properties
  4. 0 grails-app/i18n/messages.properties
  5. BIN grails-auto-test-0.1.zip
  6. +19 −0 plugin.xml
  7. +166 −0 scripts/AutoTest.groovy
  8. +10 −0 scripts/_Install.groovy
  9. +5 −0 scripts/_Uninstall.groovy
  10. +10 −0 scripts/_Upgrade.groovy
  11. +267 −0 web-app/css/main.css
  12. BIN web-app/images/favicon.ico
  13. BIN web-app/images/grails_logo.jpg
  14. BIN web-app/images/grails_logo.png
  15. BIN web-app/images/leftnav_btm.png
  16. BIN web-app/images/leftnav_midstretch.png
  17. BIN web-app/images/leftnav_top.png
  18. BIN web-app/images/skin/database_add.png
  19. BIN web-app/images/skin/database_delete.png
  20. BIN web-app/images/skin/database_edit.png
  21. BIN web-app/images/skin/database_save.png
  22. BIN web-app/images/skin/database_table.png
  23. BIN web-app/images/skin/exclamation.png
  24. BIN web-app/images/skin/house.png
  25. BIN web-app/images/skin/information.png
  26. BIN web-app/images/skin/shadow.jpg
  27. BIN web-app/images/skin/sorted_asc.gif
  28. BIN web-app/images/skin/sorted_desc.gif
  29. BIN web-app/images/spinner.gif
  30. BIN web-app/images/springsource.png
  31. +13 −0 web-app/js/application.js
  32. +7 −0 web-app/js/prototype/animation.js
  33. +136 −0 web-app/js/prototype/builder.js
  34. +965 −0 web-app/js/prototype/controls.js
  35. +974 −0 web-app/js/prototype/dragdrop.js
  36. +1,122 −0 web-app/js/prototype/effects.js
  37. +4,184 −0 web-app/js/prototype/prototype.js
  38. +2,691 −0 web-app/js/prototype/rico.js
  39. +58 −0 web-app/js/prototype/scriptaculous.js
  40. +275 −0 web-app/js/prototype/slider.js
  41. +55 −0 web-app/js/prototype/sound.js
  42. +568 −0 web-app/js/prototype/unittest.js
@@ -0,0 +1,50 @@
+class AutoTestGrailsPlugin {
+ // the plugin version
+ def version = "0.1"
+ // the version or versions of Grails the plugin is designed for
+ def grailsVersion = "1.2.1 > *"
+ // the other plugins this plugin depends on
+ def dependsOn = [:]
+ // resources that are excluded from plugin packaging
+ def pluginExcludes = [
+ "grails-app/views/error.gsp"
+ ]
+
+ // TODO Fill in these fields
+ def author = "Bjoern Wilmsmann"
+ def authorEmail = "bjoern@metasieve.com"
+ def title = "Auto test plugin"
+ def description = '''\\
+Auto test plugin.
+'''
+
+ // URL to the plugin's documentation
+ def documentation = "http://grails.org/plugin/auto-test"
+
+ def doWithSpring = {
+ // TODO Implement runtime spring config (optional)
+ }
+
+ def doWithApplicationContext = { applicationContext ->
+ // TODO Implement post initialization spring config (optional)
+ }
+
+ def doWithWebDescriptor = { xml ->
+ // TODO Implement additions to web.xml (optional)
+ }
+
+ def doWithDynamicMethods = { ctx ->
+ // TODO Implement registering dynamic methods to classes (optional)
+ }
+
+ def onChange = { event ->
+ // TODO Implement code that is executed when any artefact that this plugin is
+ // watching is modified and reloaded. The event contains: event.source,
+ // event.application, event.manager, event.ctx, and event.plugin.
+ }
+
+ def onConfigChange = { event ->
+ // TODO Implement code that is executed when the project configuration changes.
+ // The event is the same as for 'onChange'.
+ }
+}
@@ -0,0 +1,13 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
@@ -0,0 +1,6 @@
+#Grails Metadata file
+#Sun Mar 14 18:30:35 CET 2010
+app.grails.version=1.2.1
+app.name=AutoTest
+plugins.hibernate=1.2.1
+plugins.tomcat=1.2.1
No changes.
Binary file not shown.
@@ -0,0 +1,19 @@
+<plugin name='auto-test' version='0.1' grailsVersion='1.2.1 &gt; *'>
+ <author>Bjoern Wilmsmann</author>
+ <authorEmail>bjoern@metasieve.com</authorEmail>
+ <title>Auto test plugin</title>
+ <description>\
+Auto test plugin.
+</description>
+ <documentation>http://grails.org/plugin/auto-test</documentation>
+ <resources>
+ <resource>DataSource</resource>
+ <resource>UrlMappings</resource>
+ </resources>
+ <dependencies>
+ <resolvers>
+ <resolver type='grailsPlugins' name='grailsPlugins' />
+ </resolvers>
+ </dependencies>
+ <behavior />
+</plugin>
@@ -0,0 +1,166 @@
+import org.codehaus.groovy.grails.plugins.PluginManagerHolder
+
+scriptEnv = 'test'
+
+includeTargets << grailsScript("_GrailsArgParsing")
+includeTargets << grailsScript("_GrailsClean")
+includeTargets << grailsScript("_GrailsCompile")
+includeTargets << grailsScript("_GrailsInit")
+includeTargets << grailsScript("_GrailsPackage")
+includeTargets << grailsScript("_GrailsTest")
+
+TEST_PHASE_AND_TYPE_SEPARATOR = ':'
+
+recompileFrequency = System.getProperty("recompile.frequency")
+recompileFrequency = recompileFrequency ? recompileFrequency.toInteger() : 3
+
+target(main: "Auto test") {
+ depends(checkVersion,
+ configureProxy,
+ parseArguments,
+ cleanTestReports,
+ packageApp)
+
+ // The test targeting patterns
+ def testTargeters = []
+
+ // The params that target a phase and/or type
+ def phaseAndTypeTargeters = []
+
+ // Separate the type/phase targeters from the test targeters
+ argsMap["params"].each {
+ def destination = it.contains(TEST_PHASE_AND_TYPE_SEPARATOR) ? phaseAndTypeTargeters : testTargeters
+ destination << it
+ }
+
+ // If we are targeting tests, set testNames (from _GrailsTest)
+ if (testTargeters) testNames = testTargeters
+
+ // treat pre 1.2 phase targeting args as '«phase»:' for backwards compatibility
+ ["unit", "integration", "functional", "other"].each {
+ if (argsMap[it]) {
+ phaseAndTypeTargeters << "${it}${TEST_PHASE_AND_TYPE_SEPARATOR}"
+ argsMap.remove(it) // these are not test "options"
+ }
+ }
+
+ // process the phaseAndTypeTargeters, populating the targetPhasesAndTypes map from _GrailsTest
+ phaseAndTypeTargeters.each {
+ def parts = it.split(TEST_PHASE_AND_TYPE_SEPARATOR, 2)
+ def targetPhase = parts[0] ?: TEST_PHASE_WILDCARD
+ def targetType = parts[1] ?: TEST_TYPE_WILDCARD
+
+ if (!targetPhasesAndTypes.containsKey(targetPhase)) targetPhasesAndTypes[targetPhase] = []
+ targetPhasesAndTypes[targetPhase] << targetType
+ }
+
+ // Any switch style args are "test options" (from _GrailsTest)
+ argsMap.each {
+ if (it.key != 'params') {
+ testOptions[it.key] = it.value
+ }
+ }
+
+ if (argsMap["xml"]) {
+ reportFormats = [ "xml" ]
+ createTestReports = false
+ }
+ else {
+ createTestReports = !argsMap["no-reports"]
+ }
+
+ reRunTests = argsMap["rerun"]
+
+ // run tests
+ allTests()
+
+ println '---------------------'
+ println 'Auto Test is running.'
+ println '---------------------'
+
+ Long lastModified = new Date().time
+ Boolean autoRecompile = true
+ Boolean keepRunning = true
+
+ while (keepRunning) {
+ if (autoRecompile) {
+ lastModified = checkModificationTime(lastModified) {
+ try {
+ cleanTestReports()
+ compile()
+
+ Thread currentThread = Thread.currentThread()
+ classLoader = new URLClassLoader([classesDir.toURI().toURL()] as URL[], rootLoader)
+ currentThread.setContextClassLoader classLoader
+ PluginManagerHolder.pluginManager = null
+
+ // reload plugins
+ loadPlugins()
+
+ // run tests
+ allTests()
+
+ println '--------------------------------'
+ println 'Tests run. Auto Test is running.'
+ println '--------------------------------'
+ } catch (Throwable e) {
+ logError("Error running tests", e)
+ exit(1)
+ }
+ }
+ }
+ sleep(recompileFrequency * 1000)
+ }
+}
+
+setDefaultTarget(main)
+
+private checkModificationTime(def lastModified, def callback) {
+ def foldersToCheck = [ "${basedir}/grails-app",
+ "${basedir}/test",
+ "${basedir}/src"]
+
+ def tmp = lastModified
+ foldersToCheck.each { folderName ->
+ def folder = new File(folderName)
+ folder.eachDir { file ->
+ def fileModificationTime = checkFileModificationTime(file, tmp)
+
+ if (fileModificationTime > tmp) {
+ tmp = fileModificationTime
+ }
+ }
+ }
+
+ if(lastModified < tmp) {
+ try {
+ callback()
+ }
+ catch(Exception e) {
+ logError("Error automatically running tests", e)
+ }
+ }
+ lastModified = tmp
+
+ return lastModified
+}
+
+private checkFileModificationTime(def file, def tmp) {
+ def fileModificationTime
+
+ if (file.isDirectory()) {
+ for (nestedFile in file.listFiles()) {
+ fileModificationTime = checkFileModificationTime(nestedFile, tmp)
+ if (fileModificationTime > tmp) {
+ return fileModificationTime
+ }
+ }
+ }
+
+ fileModificationTime = file.lastModified()
+ if (fileModificationTime > tmp) {
+ tmp = fileModificationTime
+ }
+
+ return tmp
+}
@@ -0,0 +1,10 @@
+//
+// This script is executed by Grails after plugin was installed to project.
+// This script is a Gant script so you can use all special variables provided
+// by Gant (such as 'baseDir' which points on project base dir). You can
+// use 'ant' to access a global instance of AntBuilder
+//
+// For example you can create directory under project tree:
+//
+// ant.mkdir(dir:"${basedir}/grails-app/jobs")
+//
@@ -0,0 +1,5 @@
+//
+// This script is executed by Grails when the plugin is uninstalled from project.
+// Use this script if you intend to do any additional clean-up on uninstall, but
+// beware of messing up SVN directories!
+//
@@ -0,0 +1,10 @@
+//
+// This script is executed by Grails during application upgrade ('grails upgrade'
+// command). This script is a Gant script so you can use all special variables
+// provided by Gant (such as 'baseDir' which points on project base dir). You can
+// use 'ant' to access a global instance of AntBuilder
+//
+// For example you can create directory under project tree:
+//
+// ant.mkdir(dir:"${basedir}/grails-app/jobs")
+//
Oops, something went wrong.

0 comments on commit 575bdca

Please sign in to comment.