You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2014/05/25 09:31:44 UTC
[8/8] git commit: Add the add_default_testng_configuration method to
help IDEA project creation.
Add the add_default_testng_configuration method to help IDEA project creation.
Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/a80ece18
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/a80ece18
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/a80ece18
Branch: refs/heads/master
Commit: a80ece18dae20a4ecb460d5e26c63863b8a09391
Parents: ee6471a
Author: Peter Donald <pe...@realityforge.org>
Authored: Sun May 25 17:31:03 2014 +1000
Committer: Peter Donald <pe...@realityforge.org>
Committed: Sun May 25 17:31:03 2014 +1000
----------------------------------------------------------------------
CHANGELOG | 3 +++
lib/buildr/ide/idea.rb | 34 ++++++++++++++++++++++++++++++++++
spec/ide/idea_spec.rb | 38 ++++++++++++++++++++++++++++++++++++++
3 files changed, 75 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/buildr/blob/a80ece18/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 7763e0c..2a7ac26 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,7 @@
1.4.17 (2014-05-25)
+* Added: Add the add_default_testng_configuration method to help IDEA
+ project creation. Improves test coverage across 'default'
+ configurations.
* Fixed: Fix a bug where 'default' configurations in IDEA projects
were being incorrectly created.
* Fixed: Fix the vcs detection in IDEA addon for 1.8.6 (!) versions
http://git-wip-us.apache.org/repos/asf/buildr/blob/a80ece18/lib/buildr/ide/idea.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/ide/idea.rb b/lib/buildr/ide/idea.rb
index ee363bb..760ffe1 100644
--- a/lib/buildr/ide/idea.rb
+++ b/lib/buildr/ide/idea.rb
@@ -839,6 +839,40 @@ module Buildr #:nodoc:
end
end
+ def add_default_testng_configuration(options = {})
+ jvm_args = options[:jvm_args] || '-ea'
+ dir = options[:dir] || '$PROJECT_DIR$'
+
+ add_default_configuration('TestNG', 'TestNG') do |xml|
+ xml.extension(:name => 'coverage', :enabled => 'false', :merge => 'false', :sample_coverage => 'true', :runner => 'idea')
+ xml.module(:name => '')
+ xml.option(:name => 'ALTERNATIVE_JRE_PATH_ENABLED', :value => 'false')
+ xml.option(:name => 'ALTERNATIVE_JRE_PATH')
+ xml.option(:name => 'SUITE_NAME')
+ xml.option(:name => 'PACKAGE_NAME')
+ xml.option(:name => 'MAIN_CLASS_NAME')
+ xml.option(:name => 'METHOD_NAME')
+ xml.option(:name => 'GROUP_NAME')
+ xml.option(:name => 'TEST_OBJECT', :value => 'CLASS')
+ xml.option(:name => 'VM_PARAMETERS', :value => jvm_args)
+ xml.option(:name => 'PARAMETERS')
+ xml.option(:name => 'WORKING_DIRECTORY', :value => dir)
+ xml.option(:name => 'OUTPUT_DIRECTORY')
+ xml.option(:name => 'ANNOTATION_TYPE')
+ xml.option(:name => 'ENV_VARIABLES')
+ xml.option(:name => 'PASS_PARENT_ENVS', :value => 'true')
+ xml.option(:name => 'TEST_SEARCH_SCOPE') do |opt|
+ opt.value(:defaultName => 'moduleWithDependencies')
+ end
+ xml.option(:name => 'USE_DEFAULT_REPORTERS', :value => 'false')
+ xml.option(:name => 'PROPERTIES_FILE')
+ xml.envs
+ xml.properties
+ xml.listeners
+ xml.method
+ end
+ end
+
protected
def artifact_content(xml, project, projects, options)
http://git-wip-us.apache.org/repos/asf/buildr/blob/a80ece18/spec/ide/idea_spec.rb
----------------------------------------------------------------------
diff --git a/spec/ide/idea_spec.rb b/spec/ide/idea_spec.rb
index 15f7781..a60c29a 100644
--- a/spec/ide/idea_spec.rb
+++ b/spec/ide/idea_spec.rb
@@ -1101,6 +1101,44 @@ describe Buildr::IntellijIdea do
end
end
+ describe "with add_default_testng_configuration using defaults" do
+ before do
+ @foo = define "foo" do
+ ipr.add_default_testng_configuration
+ end
+ invoke_generate_task
+ end
+
+ it "generates an IPR with default configuration" do
+ doc = xml_document(@foo._("foo.ipr"))
+ configurations_xpath = "/project/component[@name='ProjectRunConfigurationManager']/configuration"
+ doc.should have_nodes(configurations_xpath, 1)
+ configuration_xpath = "#{configurations_xpath}[@type='TestNG' and @factoryName='TestNG' and @default='true']"
+ doc.should have_xpath(configuration_xpath)
+ doc.should have_xpath("#{configuration_xpath}/option[@name='VM_PARAMETERS' and @value='-ea']")
+ doc.should have_xpath("#{configuration_xpath}/option[@name='WORKING_DIRECTORY' and @value='$PROJECT_DIR$']")
+ end
+ end
+
+ describe "with add_default_testng_configuration specifying values" do
+ before do
+ @foo = define "foo" do
+ ipr.add_default_testng_configuration(:dir => 'C:/blah', :jvm_args => '-ea -Dtest.db.url=xxxx')
+ end
+ invoke_generate_task
+ end
+
+ it "generates an IPR with default configuration" do
+ doc = xml_document(@foo._("foo.ipr"))
+ configurations_xpath = "/project/component[@name='ProjectRunConfigurationManager']/configuration"
+ doc.should have_nodes(configurations_xpath, 1)
+ configuration_xpath = "#{configurations_xpath}[@type='TestNG' and @factoryName='TestNG' and @default='true']"
+ doc.should have_xpath(configuration_xpath)
+ doc.should have_xpath("#{configuration_xpath}/option[@name='VM_PARAMETERS' and @value='-ea -Dtest.db.url=xxxx']")
+ doc.should have_xpath("#{configuration_xpath}/option[@name='WORKING_DIRECTORY' and @value='C:/blah']")
+ end
+ end
+
describe "with iml.group specified" do
before do
@foo = define "foo" do