Return-Path: X-Original-To: apmail-buildr-commits-archive@www.apache.org Delivered-To: apmail-buildr-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1023A115DC for ; Sun, 25 May 2014 07:31:39 +0000 (UTC) Received: (qmail 64563 invoked by uid 500); 25 May 2014 07:31:38 -0000 Delivered-To: apmail-buildr-commits-archive@buildr.apache.org Received: (qmail 64504 invoked by uid 500); 25 May 2014 07:31:38 -0000 Mailing-List: contact commits-help@buildr.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@buildr.apache.org Delivered-To: mailing list commits@buildr.apache.org Received: (qmail 64456 invoked by uid 99); 25 May 2014 07:31:38 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 May 2014 07:31:38 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B1A1E9A43B3; Sun, 25 May 2014 07:31:37 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: donaldp@apache.org To: commits@buildr.apache.org Date: Sun, 25 May 2014 07:31:44 -0000 Message-Id: <067e2811c7f84ff4bdd10b085fe0f6a5@git.apache.org> In-Reply-To: <0d2b420c189e4a34a6d90a81671c4279@git.apache.org> References: <0d2b420c189e4a34a6d90a81671c4279@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [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 Authored: Sun May 25 17:31:03 2014 +1000 Committer: Peter Donald 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