Remove test dependency on gvmVersion configuration.

This commit is contained in:
Marco Vermeulen
2013-05-29 08:24:39 +01:00
parent 01f888cbcc
commit ff4ddf668b
4 changed files with 19 additions and 13 deletions

View File

@@ -4,7 +4,7 @@ apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'eclipse'
defaultTasks 'clean', 'prepareScripts', 'prepareServer', 'prepareTemplates', 'assembleArchive', 'test'
defaultTasks 'clean', 'prepareTestScripts', 'prepareScripts', 'prepareServer', 'prepareTemplates', 'assembleArchive', 'test'
ext.installBinDir = "${System.getProperty('user.home')}/.gvm/bin"
ext.installSrcDir = "${System.getProperty('user.home')}/.gvm/src"
@@ -52,6 +52,13 @@ task prepareServer(type: Copy){
filter(ReplaceTokens, tokens: [GVM_VERSION:config.gvmVersion, VERTX_VERSION:config.vertxVersion])
}
task prepareTestScripts(type: Copy) {
from 'src/main/bash'
into 'build/testScripts'
include '**/*'
filter(ReplaceTokens, tokens: [GVM_VERSION:"x.y.z", GVM_SERVICE:config.gvmService])
}
task prepareScripts(type: Copy) {
from 'src/main/bash'
into 'build/scripts'

View File

@@ -5,7 +5,7 @@ Feature: Version
Scenario: Show the current version of gvm
When I enter "gvm version"
Then I see "Groovy enVironment Manager 1.0.5"
Then I see "Groovy enVironment Manager x.y.z"
Scenario: The local gvm is out of date
Given no prior Broadcast was received

View File

@@ -7,26 +7,23 @@ import org.vertx.groovy.core.Vertx
class VertxUtils {
static final LIVE_BROADCAST = "This is a LIVE Broadcast!"
static final GVM_VERSION = '1.0.5'
static final groovy = ['2.0.5']
static final grails = ['1.3.6','1.3.9','2.1.0']
static final candidates = [groovy:groovy,grails:grails]
static final defaults = [groovy:'2.0.5',grails:'2.1.0']
static templateEngine = new SimpleTemplateEngine()
static server
public static startServer(){
if(!server){
public static startServer(gvmVersion){
if(!server){
println "Starting stub webservice..."
server = createServer("localhost", 8080)
server = createServer("localhost", 8080, gvmVersion)
}
server
}
private static createServer(String host, int port){
private static createServer(String host, int port, String gvmVersion){
def rm = new RouteMatcher()
rm.get("/") { req ->
@@ -90,12 +87,12 @@ class VertxUtils {
def version = req.params['version']
def gtplFile, binding
def output
if(GVM_VERSION == version){
if(gvmVersion == version){
output = LIVE_BROADCAST
} else {
gtplFile = new File('build/templates/upgrade.gtpl')
binding = [version:version, gvmVersion:GVM_VERSION]
binding = [version:version, gvmVersion:gvmVersion]
def template = templateEngine.createTemplate(gtplFile).make(binding)
output = template.toString()
}

View File

@@ -5,12 +5,14 @@ import static gvm.VertxUtils.*
serviceUrlEnv = "http://localhost:8080"
forceOffline = false
buildScriptDir = new File("build/scripts")
buildScriptDir = new File("build/testScripts")
counter = "${(Math.random() * 10000).toInteger()}".padLeft(4, "0")
localGroovyCandidate = "/tmp/groovy-core" as File
gvmVersion = "x.y.z"
gvmBaseEnv = "/tmp/gvm-$counter"
gvmBaseDir = gvmBaseEnv as File
@@ -29,7 +31,7 @@ bash = null
Before(){
cleanUp()
server = startServer()
server = startServer(gvmVersion)
binDir.mkdirs()
srcDir.mkdirs()