alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Groovy example source code file (Groovy2365Base.groovy)

This example Groovy source code file (Groovy2365Base.groovy) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Groovy tags/keywords

file, file, groovy2365base, groovytestcase, name, script1, script1, script2, string, string, util, util

The Groovy Groovy2365Base.groovy source code

/**
 * Created by IntelliJ IDEA.
 * User: applerestore
 * Date: Dec 11, 2007
 * Time: 3:29:40 PM
 * To change this template use File | Settings | File Templates.
 */
package groovy.bugs

class Groovy2365Base extends GroovyTestCase {

    protected String createData () {

        File dir = createTempDir("groovy-src-", "-src")
        assertNotNull dir

        def fileList =  [
          "Util.groovy" : """

          class Util {
            static String NAME = "Util accessed"
          }
    """,

         "Script1.groovy" : """
         import Util

         println "Script1 \${Util.NAME}"
    """,

    "Script2.groovy" : """
                import Util

                println "Script2 \${Util.NAME}"
           """
                ].collect {
            name, text ->
              File file = new File(dir, name)
              file.write text
              file
         }

         return dir.absolutePath
    }

    private File createTempDir (prefix, suffix) {
        File tempFile = File.createTempFile(prefix, suffix);
        tempFile.delete();
        tempFile.mkdirs();
        tempFile.deleteOnExit()
        return tempFile;
    }

}

Other Groovy examples (source code examples)

Here is a short list of links related to this Groovy Groovy2365Base.groovy source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.