Permalink
Browse files

Merge branch 'master' into services-r6

Change-Id: I819dc8dc9358c387ad894265aca73093601e8911
  • Loading branch information...
2 parents ac21236 + 31ef9cc commit 57a11e624ad913239af1d88a75663e18cf2cc966 @kushmerick kushmerick committed Nov 16, 2011
Showing 770 changed files with 1,052 additions and 83,797 deletions.
View
@@ -13,3 +13,4 @@ ci-working-dir
.rvmrc
*.pyc
.DS_Store
+.build
View
@@ -1,3 +1,3 @@
-[submodule "lib/client"]
- path = lib/client
- url = ssh://cloudfoundry-codereview.qa.mozycloud.com:29418/vmc
+[submodule "assets"]
+ path = assets
+ url = git@github.com:vmware-ac/vcap-test-assets
View
@@ -13,4 +13,4 @@ gem "rest-client"
gem "rubyzip2"
gem "terminal-table"
gem "highline"
-gem "vmc", ">= 0.3.13.beta.2"
+gem "vmc", ">= 0.3.13.beta.4"
View
@@ -10,7 +10,7 @@ GEM
term-ansicolor (~> 1.0.5)
curb (0.7.15)
daemons (1.1.2)
- diff-lcs (1.1.2)
+ diff-lcs (1.1.3)
eventmachine (0.12.10)
gherkin (2.2.4)
json (~> 1.4.6)
@@ -19,25 +19,26 @@ GEM
highline (1.6.2)
httpclient (2.1.7.2)
json (1.4.6)
- json_pure (1.5.3)
+ json_pure (1.5.4)
+ spruz (~> 0.2.8)
mime-types (1.16)
nats (0.4.8)
daemons (>= 1.1.0)
eventmachine (>= 0.12.10)
json_pure (>= 1.5.1)
nokogiri (1.4.4)
rake (0.8.7)
- rest-client (1.6.6)
+ rest-client (1.6.7)
mime-types (>= 1.16)
rspec (1.3.0)
rubyzip2 (2.0.1)
+ spruz (0.2.13)
term-ansicolor (1.0.5)
- terminal-table (1.4.2)
+ terminal-table (1.4.3)
trollop (1.16.2)
- vmc (0.3.13.beta.2)
- highline (~> 1.6.1)
+ vmc (0.3.13.beta.4)
json_pure (~> 1.5.1)
- rest-client (< 1.7.0, >= 1.6.1)
+ rest-client (>= 1.6.1, < 1.7.0)
rubyzip2 (~> 2.0.1)
terminal-table (~> 1.4.2)
@@ -58,4 +59,4 @@ DEPENDENCIES
rspec (= 1.3.0)
rubyzip2
terminal-table
- vmc (>= 0.3.13.beta.2)
+ vmc (>= 0.3.13.beta.4)
View
167 Rakefile
@@ -1,13 +1,23 @@
require File.expand_path('../lib/build_config.rb', __FILE__)
ENV['BUNDLE_PATH'] = BuildConfig.bundle_path
-import "../rakelib/core_components.rake"
-import "../rakelib/bundler.rake"
+# Relies on having the ENV['VCAP'] environment variable set to the root of
+# of the VCAP source. If the environemnt variable is not set, the default
+# value of "..", enables this script when 'vcap-tests' is a submodule reference
+# under 'vcap'.
+vcap = ENV['VCAP'] || ".."
+import "#{vcap}/rakelib/core_components.rake"
+import "#{vcap}/rakelib/bundler.rake"
+
desc "Run the Basic Viability Tests"
-task :tests => 'bvt:run'
+task :tests => ['build','bvt:run']
+
+desc "Run a faster subset of Basic Viability Tests"
+task :smoke_tests => ['build','bvt:run_smoke']
ci_steps = ['ci:version_check',
+ 'build',
'bundler:install:production',
'bundler:check',
'ci:hacky_startup_delay',
@@ -21,3 +31,154 @@ desc "Set up a test cloud, run the BVT tests, and then tear it down"
task 'ci-tests' => ci_steps
task 'ci-java-tests' => 'java_client:ci_tests'
+
+def tests_path
+ if @tests_path == nil
+ @tests_path = File.join(Dir.pwd, "assets")
+ end
+ @tests_path
+end
+TESTS_PATH = tests_path
+
+BUILD_ARTIFACT = File.join(Dir.pwd, ".build")
+
+TESTS_TO_BUILD = ["#{TESTS_PATH}/spring/auto-reconfig-test-app",
+ "#{TESTS_PATH}/spring/auto-reconfig-missing-deps-test-app",
+ "#{TESTS_PATH}/spring/app_spring_service",
+ "#{TESTS_PATH}/java_web/app_with_startup_delay",
+ "#{TESTS_PATH}/java_web/tomcat-version-check-app",
+ "#{TESTS_PATH}/spring/roo-guestbook",
+ "#{TESTS_PATH}/spring/jpa-guestbook",
+ "#{TESTS_PATH}/spring/hibernate-guestbook",
+ "#{TESTS_PATH}/spring/spring-env",
+ "#{TESTS_PATH}/grails/guestbook",
+ "#{TESTS_PATH}/java_web/java_tiny_app",
+ "#{TESTS_PATH}/lift/hello_lift",
+ "#{TESTS_PATH}/lift/lift-db-app"
+]
+
+desc "Build the tests. If the git hash associated with the test assets has not changed, nothing is built. To force a build, invoke 'rake build[--force]'"
+task :build, [:force] do |t, args|
+ puts "\nBuilding tests"
+ sh('git submodule update --init')
+ if build_required? args.force
+ ENV['MAVEN_OPTS']="-XX:MaxPermSize=256M"
+ is_grailsdep_installed = false
+ TESTS_TO_BUILD.each do |test|
+ puts "\tBuilding '#{test}'"
+ Dir.chdir test do
+ unless is_grailsdep_installed
+ is_grailsdep_installed = install_grailsdep test
+ end
+ sh('mvn package -DskipTests') do |success, exit_code|
+ unless success
+ clear_build_artifact
+ do_mvn_clean('-q')
+ fail "\tFailed to build #{test} - aborting build"
+ end
+ end
+ end
+ puts "\tCompleted building '#{test}'"
+ end
+ save_git_hash
+ else
+ puts "Built artifacts in sync with test assets - no build required"
+ end
+end
+
+desc "Clean the build artifacts"
+task :clean do
+ puts "\nCleaning tests"
+ clear_build_artifact
+ TESTS_TO_BUILD.each do |test|
+ puts "\tCleaning '#{test}'"
+ Dir.chdir test do
+ do_mvn_clean
+ end
+ puts "\tCompleted cleaning '#{test}'"
+ end
+end
+
+def build_required? (force_build=nil)
+ if File.exists?(BUILD_ARTIFACT) == false or (force_build and force_build == "--force")
+ return true
+ end
+ Dir.chdir(tests_path) do
+ saved_git_hash = IO.readlines(BUILD_ARTIFACT)[0].split[0]
+ git_hash = `git rev-parse --short=8 --verify HEAD`
+ saved_git_hash.to_s.strip != git_hash.to_s.strip
+ end
+end
+
+def install_grails
+ puts "\tOne-time install of grails modules to enable build/run of grails apps"
+ sh('sudo apt-get install python-software-properties') do |success, exit_code|
+ unless success
+ puts "\tUnable to install python-software-properties"
+ end
+ end
+ sh('sudo add-apt-repository ppa:groovy-dev/grails') do |success, exit_code|
+ unless success
+ puts "\tUnable to add grails repository"
+ end
+ end
+ sh('sudo apt-get update') do |success, exit_code|
+ unless success
+ puts "\tUnable to execute apt-get update"
+ end
+ end
+ sh('sudo apt-get install grails') do |success, exit_code|
+ unless success
+ puts "\tUnable to install grails. BVT may fail to build."
+ end
+ end
+end
+
+def install_grailsdep test
+ is_grailsdep_installed = false
+ is_grails_installed = false
+ if (test =~ /\/grails\//)
+ sh('grails create-app tmp') do |success, exit_code|
+ if success
+ is_grailsdep_installed = true
+ is_grails_installed = true
+ puts "\tInstall grails dependencies in ivy cache successfully"
+ sh('rm -rf tmp') do |success, exit_code|
+ end
+ else
+ install_grails
+ end
+ end
+ unless is_grailsdep_installed
+ sh('grails create-app tmp') do |success, exit_code|
+ if success
+ is_grailsdep_installed = true
+ puts "\tInstall grails dependencies in ivy cache successfully"
+ else
+ is_grailsdep_installed = false
+ puts "\tUnable to populate require dependencies in ivy cache using 'grails create-app'"
+ end
+ sh('rm -rf tmp') do |success, exit_code|
+ end
+ end
+ end
+ end
+ is_grailsdep_installed
+end
+
+def save_git_hash
+ Dir.chdir(tests_path) do
+ git_hash = `git rev-parse --short=8 --verify HEAD`
+ File.open(BUILD_ARTIFACT, 'w') {|f| f.puts("#{git_hash}")}
+ end
+end
+
+def clear_build_artifact
+ puts "\tClearing build artifact #{BUILD_ARTIFACT}"
+ File.unlink BUILD_ARTIFACT if File.exists? BUILD_ARTIFACT
+end
+
+def do_mvn_clean options=nil
+ sh("mvn clean #{options}")
+end
+
@@ -1,17 +0,0 @@
-# Acknowledgements
-
-Thanks to:
-
-Ryan Dahl for building node.js, my favorite new plaything.
-
-Gianni Chiappetta and Noah Sloan, for encouraging me to write good code
-instead of cute code.
-
-Micheil Smith, for the examples of cookies and sessions with node.js, and for
-being patient with my mangling of his name.
-
-Chad Etzel, for writing the example that shows off Nerve with
-[template.node.js](http://github.com/jazzychad/template.node.js).
-
-Everyone else involved in the creation of node.js and the many other projects
-that have sprung up around it.
@@ -1,20 +0,0 @@
-# License
-Copyright (c) 2009 Codespin Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
@@ -1,78 +0,0 @@
-# Nerve
-
-A microframework for [node.js](http://nodejs.org).
-
-## Features
-
-* Simple array-based DSL for request routing
-* Regular expression route matching, including passing of captured groups to route handler
-* Simple cookie and session support
-
-## Examples
-
-### Hello World
-
-This Hello World app listens for http requests on port 8000:
-
- var nerve = require('./nerve');
-
- var hello = [
- ["/", function(req, res) {
- res.respond("Hello, World!");
- }]
- ];
-
- nerve.create(hello).listen(8000);
-
-### Nodewiki
-
-[Nodewiki](http://github.com/gjritter/nodewiki) is a tiny wiki built using Nerve and the redis-node-client.
-
-### Templates
-
-The [template.node.js](http://github.com/jazzychad/template.node.js) project includes a sample application that shows how Nerve can be used to build a web application with templates.
-
-### Sample Application
-
-This sample application makes use of Nerve's regular-expression URI path matching to pass a "name" parameter from the URI into a handler function. This can be extended to any number of named arguments in the handler function.
-
-It also makes use of request method matching. The first matcher will only match get requests; the second will match any request method.
-
-The application stores the user's name in the session, so that it can be used in subsequent responses.
-
- var posix = require("./posix");
- var nerve = require("./nerve"),
- get = nerve.get;
-
- // define an application using request matcher/handler pairs
- var app = [
-
- // this handler will only respond to GET requests
- [get(/^\/hello\/(\w+)$/), function(req, res, name) {
-
- // the session is available on every request; it currently
- // lasts for the browser session, but will soon be configurable.
- req.session["name"] = name;
-
- // respond takes a string and provides sensible defaults:
- // Content-Type: text/html, Content-Length: string length
- res.respond("Hello, " + name + "!");
-
- }],
-
- // this handler will respond to any request method
- [/^\/goodbye$/, function(req, res) {
-
- var name = req.session["name"];
- var message = "Goodbye, " + (name || "I hardly knew thee") + "!";
-
- // respond takes an object specifying content and headers,
- // and uses sensible defaults if not supplied
- res.respond({content: message, headers: {"Content-Type": "text/plain"}});
-
- }]
-
- ];
-
- // create and serve the application with 10 second session duration
- nerve.create(app, {session_duration: 10000}).listen(8000);
@@ -1,6 +0,0 @@
-# To Do List
-
-* emit events where appropriate (new session, session expiration, ...)
-* create a test suite
-* break up the example in the README into digestible chunks
-* run jslint and clean up code where appropriate
Oops, something went wrong.

0 comments on commit 57a11e6

Please sign in to comment.