Author: toulmean
Date: Thu Jun 23 07:53:11 2011
New Revision: 1138755
URL: http://svn.apache.org/viewvc?rev=1138755&view=rev
Log:
contributing a few more integration tests that can also be used for
documentation. Also, cleaning up the integration tests, to make them easier to
write hopefully
Added:
buildr/trunk/tests/include_as/
buildr/trunk/tests/include_as/Buildfile
buildr/trunk/tests/include_as/doc/
buildr/trunk/tests/include_as/doc/index.html
buildr/trunk/tests/include_path/
buildr/trunk/tests/include_path/Buildfile
buildr/trunk/tests/include_path/doc/
buildr/trunk/tests/include_path/doc/index.html
Modified:
buildr/trunk/tests/JavaSystemProperty/Buildfile
buildr/trunk/tests/integration_testing.rb
Modified: buildr/trunk/tests/JavaSystemProperty/Buildfile
URL:
http://svn.apache.org/viewvc/buildr/trunk/tests/JavaSystemProperty/Buildfile?rev=1138755&r1=1138754&r2=1138755&view=diff
==============================================================================
--- buildr/trunk/tests/JavaSystemProperty/Buildfile (original)
+++ buildr/trunk/tests/JavaSystemProperty/Buildfile Thu Jun 23 07:53:11 2011
@@ -14,5 +14,5 @@
# the License.
define "proj" do
- Java.java.lang.System.setProperty("foo", "bar")
+ ::Java.java.lang.System.setProperty("foo", "bar")
end
\ No newline at end of file
Added: buildr/trunk/tests/include_as/Buildfile
URL:
http://svn.apache.org/viewvc/buildr/trunk/tests/include_as/Buildfile?rev=1138755&view=auto
==============================================================================
--- buildr/trunk/tests/include_as/Buildfile (added)
+++ buildr/trunk/tests/include_as/Buildfile Thu Jun 23 07:53:11 2011
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you 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.
+
+repositories.remote = ["http://repo1.maven.org/maven2"]
+SLF4J_API = "org.slf4j:slf4j-api:jar:1.6.1"
+
+define "proj" do
+ project.version = "1.0"
+ project.group = "org.example"
+ package(:zip).include(_("doc"), :as => "docu")
+ package(:zip).include(artifact(SLF4J_API), :as => "lib/logging.jar")
+end
\ No newline at end of file
Added: buildr/trunk/tests/include_as/doc/index.html
URL:
http://svn.apache.org/viewvc/buildr/trunk/tests/include_as/doc/index.html?rev=1138755&view=auto
==============================================================================
--- buildr/trunk/tests/include_as/doc/index.html (added)
+++ buildr/trunk/tests/include_as/doc/index.html Thu Jun 23 07:53:11 2011
@@ -0,0 +1,8 @@
+<html>
+ <head>
+ <title>Index</title>
+ </head>
+ <body>
+ Hello world
+ </body>
+</html>
\ No newline at end of file
Added: buildr/trunk/tests/include_path/Buildfile
URL:
http://svn.apache.org/viewvc/buildr/trunk/tests/include_path/Buildfile?rev=1138755&view=auto
==============================================================================
--- buildr/trunk/tests/include_path/Buildfile (added)
+++ buildr/trunk/tests/include_path/Buildfile Thu Jun 23 07:53:11 2011
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you 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.
+
+repositories.remote = ["http://repo1.maven.org/maven2"]
+SLF4J_API = "org.slf4j:slf4j-api:jar:1.6.1"
+
+define "proj" do
+ project.version = "1.0"
+ project.group = "org.example"
+ package(:zip).include(_("doc"), :path => "distrib")
+ package(:zip).include(artifact(SLF4J_API), :path => "distrib/lib")
+end
\ No newline at end of file
Added: buildr/trunk/tests/include_path/doc/index.html
URL:
http://svn.apache.org/viewvc/buildr/trunk/tests/include_path/doc/index.html?rev=1138755&view=auto
==============================================================================
--- buildr/trunk/tests/include_path/doc/index.html (added)
+++ buildr/trunk/tests/include_path/doc/index.html Thu Jun 23 07:53:11 2011
@@ -0,0 +1,8 @@
+<html>
+ <head>
+ <title>Index</title>
+ </head>
+ <body>
+ Hello world
+ </body>
+</html>
\ No newline at end of file
Modified: buildr/trunk/tests/integration_testing.rb
URL:
http://svn.apache.org/viewvc/buildr/trunk/tests/integration_testing.rb?rev=1138755&r1=1138754&r2=1138755&view=diff
==============================================================================
--- buildr/trunk/tests/integration_testing.rb (original)
+++ buildr/trunk/tests/integration_testing.rb Thu Jun 23 07:53:11 2011
@@ -13,44 +13,69 @@
# License for the specific language governing permissions and limitations under
# the License.
-BUILDR = ENV['BUILDR'] || File.join(File.expand_path(File.dirname(__FILE__)),
"..", "_buildr")
+BUILDR = ENV['BUILDR'] || File.expand_path("../_buildr",
File.dirname(__FILE__))
require 'test/unit'
+require 'zip/zip'
-def test(folder, cmd)
- eval <<-TEST
-class #{folder.sub("-", "").capitalize} < Test::Unit::TestCase
-
- def test_#{folder.sub("-", "")}
- result = %x[cd #{File.join(File.expand_path(File.dirname(__FILE__)),
"#{folder}")} ; #{cmd} ; #{BUILDR} clean]
+module Buildr
+ module IntegrationTests
+
+ def self.test(folder, cmd, after_block = nil)
+
+ eval <<-TEST
+ class #{folder.sub("-", "").capitalize} < Test::Unit::TestCase
+
+ def test_#{folder.sub("-", "")}
+ begin
+ result = %x[cd #{File.expand_path("#{folder}",
File.dirname(__FILE__))} ; #{BUILDR} #{cmd}]
+ assert($?.success?)
+ #{ after_block || "" }
+ ensure
+ %x[cd #{File.expand_path("#{folder}", File.dirname(__FILE__))} ;
#{BUILDR} clean]
+ end
+
+ end
+
+ end
+ TEST
+
+ end
+
+ #BUILDR-320 still not resolved.
+ #test "BUILDR-320", "--trace -P"
+
+ test "JavaSystemProperty", "test"
+
+ test "helloWorld", "package"
+
+ test "compile_with_parent", "compile"
+
+ test "junit3", "test"
+
+ test "include_path", "package", <<-CHECK
+path = File.expand_path("include_path/target/proj-1.0.zip",
File.dirname(__FILE__))
+assert(File.exist? path)
+Zip::ZipFile.open(path) {|zip|
+assert(!zip.get_entry("distrib/doc/index.html").nil?)
+assert(!zip.get_entry("distrib/lib/slf4j-api-1.6.1.jar").nil?)
+}
+ CHECK
+
+ test "include_as", "package", <<-CHECK
+path = File.expand_path("include_as/target/proj-1.0.zip",
File.dirname(__FILE__))
+assert(File.exist? path)
+Zip::ZipFile.open(path) {|zip|
+assert(!zip.get_entry("docu/index.html").nil?)
+assert(!zip.get_entry("lib/logging.jar").nil?)
+}
+ CHECK
+
+ test "package_war_as_jar", "package", <<-CHECK
+ assert(File.exist? File.join(File.expand_path(File.dirname(__FILE__)),
"package_war_as_jar", "target", "webapp-1.0.jar"))
+ %x[cd #{File.expand_path("package_war_as_jar", File.dirname(__FILE__))} ;
#{BUILDR} clean]
assert($?.success?)
- end
+ CHECK
-end
-TEST
-
-end
-
-class Buildr320 < Test::Unit::TestCase
-
- def test_circular_dependency
- result = %x[cd #{File.join(File.expand_path(File.dirname(__FILE__)),
"BUILDR-320")} ; #{BUILDR} --trace -P]
- assert($?.success?)
- end
-end
-
-test("JavaSystemProperty", "#{BUILDR} test")
-test("helloWorld", "#{BUILDR} package")
-test("compile_with_parent", "#{BUILDR} compile")
-test("junit3", "#{BUILDR} test")
-
-class Package_war_as_jar < Test::Unit::TestCase
-
- def test_war_extension_is_jar
- result = %x[cd #{File.join(File.expand_path(File.dirname(__FILE__)),
"package_war_as_jar")} ; #{BUILDR} package]
- assert($?.success?)
- assert(File.exist? File.join(File.expand_path(File.dirname(__FILE__)),
"package_war_as_jar", "target", "webapp-1.0.jar"))
- %x[cd #{File.join(File.expand_path(File.dirname(__FILE__)),
"package_war_as_jar")} ; #{BUILDR} clean]
- assert($?.success?)
end
end
\ No newline at end of file