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 2013/10/03 13:47:26 UTC

svn commit: r1528817 - in /buildr/trunk: lib/buildr/ide/idea.rb spec/ide/idea_spec.rb

Author: donaldp
Date: Thu Oct  3 11:47:26 2013
New Revision: 1528817

URL: http://svn.apache.org/r1528817
Log:
Add some more tests around adding exploded ejb artifacts

Modified:
    buildr/trunk/lib/buildr/ide/idea.rb
    buildr/trunk/spec/ide/idea_spec.rb

Modified: buildr/trunk/lib/buildr/ide/idea.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/ide/idea.rb?rev=1528817&r1=1528816&r2=1528817&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/ide/idea.rb (original)
+++ buildr/trunk/lib/buildr/ide/idea.rb Thu Oct  3 11:47:26 2013
@@ -788,8 +788,9 @@ module Buildr #:nodoc:
         artifact_name = to_artifact_name(project, options)
 
         add_artifact(artifact_name, "exploded-ejb", build_on_make(options)) do |xml|
-          dependencies = (options[:dependencies] || ([project] + project.compile.dependencies)).flatten
+          dependencies = (options[:dependencies] || [project]).flatten
           libraries, projects = partition_dependencies(dependencies)
+          raise "Unable to add non-project dependencies (#{libraries.inspect}) to ejb artifact" if libraries.size > 0
 
           emit_output_path(xml, artifact_name, options)
           xml.root :id => "root" do

Modified: buildr/trunk/spec/ide/idea_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/ide/idea_spec.rb?rev=1528817&r1=1528816&r2=1528817&view=diff
==============================================================================
--- buildr/trunk/spec/ide/idea_spec.rb (original)
+++ buildr/trunk/spec/ide/idea_spec.rb Thu Oct  3 11:47:26 2013
@@ -897,6 +897,64 @@ describe Buildr::IntellijIdea do
       end
     end
 
+    describe "that uses add_exploded_ejb_artifact with overrides" do
+      before do
+        write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
+        artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
+
+        @foo = define "foo" do
+          project.version = '1.0'
+          define "bar" do
+            compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
+            package :jar
+          end
+          ipr.add_exploded_ejb_artifact(project("bar"),
+                                        :ejb_module_names => ['x'],
+                                        :jpa_module_names => ['p'])
+        end
+        invoke_generate_task
+      end
+
+      it "generates an IPR with an ejb artifact" do
+        doc = xml_document(@foo._("foo.ipr"))
+        base_xpath = "/project/component[@name='ArtifactManager']/artifact"
+        facet_xpath = "#{base_xpath}[@type='exploded-ejb' and @name='bar' and @build-on-make='false']"
+        doc.should have_xpath(facet_xpath)
+        doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/artifacts/bar")
+        doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='module-output' and @name='bar']")
+        doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='jpa-descriptors' and @facet='p/jpa/JPA']")
+        doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='javaee-facet-resources' and @facet='x/ejb/EJB']")
+      end
+    end
+
+    describe "that uses add_exploded_ejb_artifact with no overrides" do
+      before do
+        write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
+        artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
+
+        @foo = define "foo" do
+          project.version = '1.0'
+          define "bar" do
+            compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
+            package :war
+          end
+          ipr.add_exploded_ejb_artifact(project("bar"))
+        end
+        invoke_generate_task
+      end
+
+      it "generates an IPR with an ejb artifact" do
+        doc = xml_document(@foo._("foo.ipr"))
+        base_xpath = "/project/component[@name='ArtifactManager']/artifact"
+        facet_xpath = "#{base_xpath}[@type='exploded-ejb' and @name='bar' and @build-on-make='false']"
+        doc.should have_xpath(facet_xpath)
+
+        doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/artifacts/bar")
+        doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='module-output' and @name='bar']")
+      end
+    end
+
+
     describe "that uses add_exploded_war_artifact with no overrides" do
       before do
         write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project