changeset 7442:7398ae52202d

RT-37832: [packager] Mac App Store Bundler fails to strip jfxmedia.dylib and strips Info.plist Summary: unit test for file verifications
author shemnon
date Mon, 07 Jul 2014 10:51:58 -0600
parents 3bc2557efaad
children 046c16800215
files modules/fxpackager/src/test/java/com/oracle/tools/packager/mac/MacAppStoreBundlerTest.java
diffstat 1 files changed, 23 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/modules/fxpackager/src/test/java/com/oracle/tools/packager/mac/MacAppStoreBundlerTest.java	Mon Jul 07 10:52:14 2014 -0700
+++ b/modules/fxpackager/src/test/java/com/oracle/tools/packager/mac/MacAppStoreBundlerTest.java	Mon Jul 07 10:51:58 2014 -0600
@@ -49,6 +49,8 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import static com.oracle.tools.packager.StandardBundlerParam.*;
 import static com.oracle.tools.packager.mac.MacAppBundler.*;
@@ -184,9 +186,28 @@
 
         File result = bundler.execute(bundleParams, new File(workDir, "smoke"));
         System.err.println("Bundle at - " + result);
+
+        checkFiles(result);
+    }
+
+    private void checkFiles(File result) throws IOException {
         assertNotNull(result);
         assertTrue(result.exists());
         assertTrue(result.length() > MIN_SIZE);
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        PrintStream printStream = new PrintStream(baos, true);
+        IOUtils.exec(
+                new ProcessBuilder("pkgutil", "--payload-files", result.getCanonicalPath()),
+                false, false, printStream);
+
+        String output = baos.toString();
+
+        Pattern jreInfoPListPattern = Pattern.compile("/PlugIns/[^/]+/Contents/Info\\.plist");
+        Matcher matcher = jreInfoPListPattern.matcher(output);
+        assertTrue("Insure that info.plist is packed in for embedded jre", matcher.find());
+
+        assertFalse("Insure JFX Media isn't packed in", output.contains("/libjfxmedia.dylib"));
     }
 
     @Test
@@ -251,8 +272,7 @@
 
         File result = bundler.execute(bundleParams, new File(workDir, "everything"));
         System.err.println("Bundle at - " + result);
-        assertNotNull(result);
-        assertTrue(result.exists());
-        assertTrue(result.length() > MIN_SIZE);
+
+        checkFiles(result);
     }
 }