spec/osgi/packaging_spec.rb in buildr4osgi-0.9.0 vs spec/osgi/packaging_spec.rb in buildr4osgi-0.9.2
- old
+ new
@@ -39,11 +39,10 @@
marker=Hello marker
PLUGIN_PROPERTIES
Buildr::write "src/main/java/Main.java", "public class Main { public static void main(String[] args) {}}"
@plugin = define("plugin", :version => "1.0.0.001")
@path = @plugin.package(:plugin).to_s
-
end
it "should package a project as a normal Java project" do
define_project
@plugin.package(:plugin).invoke
@@ -61,10 +60,20 @@
zip.find_entry("plugin.xml").should_not be_nil
zip.find_entry("plugin.properties").should_not be_nil
end
end
+ it "should package a project as a plugin with its internal properties files" do
+ define_project
+ Buildr::write "src/main/java/somefolder/hello.properties", "# Empty properties file"
+ @plugin.package(:plugin).invoke
+ File.exists?(@path).should be_true
+ Zip::ZipFile.open(@path) do |zip|
+ zip.find_entry("somefolder/hello.properties").should_not be_nil
+ end
+ end
+
it "should work with subprojects" do
Buildr::write "bar/plugin.xml", <<-PLUGIN_XML
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
@@ -83,9 +92,10 @@
Buildr::write "bar/src/main/java/Main.java", "public class Main { public static void main(String[] args) {}}"
define("plugin", :version => "1.0.0.001") do
define("bar", :version => "2.0")
end
project("plugin:bar").package(:plugin).invoke
+ File.basename(project("plugin:bar").package(:plugin).to_s).should == "bar-2.0.jar"
Zip::ZipFile.open(project("plugin:bar").package(:plugin).to_s) do |zip|
zip.find_entry("plugin.xml").should_not be_nil
zip.find_entry("plugin.properties").should_not be_nil
zip.find_entry("Main.class").should_not be_nil
end
\ No newline at end of file