You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2017/03/01 08:34:21 UTC

[2/5] brooklyn-server git commit: BundleMaker: add tests, and fix

BundleMaker: add tests, and fix


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/7d1d47b6
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/7d1d47b6
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/7d1d47b6

Branch: refs/heads/master
Commit: 7d1d47b6e8c3ef919d1d52be3d23a5dc036a2d5c
Parents: 33f7940
Author: Aled Sage <al...@gmail.com>
Authored: Tue Feb 28 22:04:35 2017 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Tue Feb 28 22:34:46 2017 +0000

----------------------------------------------------------------------
 core/pom.xml                                    |  10 +
 .../brooklyn/util/core/osgi/BundleMaker.java    |  36 ++-
 .../util/core/osgi/BundleMakerTest.java         | 270 +++++++++++++++++++
 .../osgi/test/bundlemaker/nomanifest/myfile.txt |   1 +
 .../bundlemaker/nomanifest/subdir/myfile2.txt   |   1 +
 .../withmanifest/META-INF/MANIFEST.MF           |   2 +
 .../test/bundlemaker/withmanifest/myfile.txt    |   1 +
 .../bundlemaker/withmanifest/subdir/myfile2.txt |   1 +
 8 files changed, 310 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/7d1d47b6/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index 71f911e..c4c3d9b 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -307,6 +307,16 @@
                     </instructions>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <configuration>
+                    <excludes combine.children="append">
+                        <exclude>**/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/nomanifest/**</exclude>
+                        <exclude>**/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/withmanifest/**</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
         </plugins>
         <pluginManagement>
             <plugins>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/7d1d47b6/core/src/main/java/org/apache/brooklyn/util/core/osgi/BundleMaker.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/osgi/BundleMaker.java b/core/src/main/java/org/apache/brooklyn/util/core/osgi/BundleMaker.java
index 55ed7aa..b36e138 100644
--- a/core/src/main/java/org/apache/brooklyn/util/core/osgi/BundleMaker.java
+++ b/core/src/main/java/org/apache/brooklyn/util/core/osgi/BundleMaker.java
@@ -90,9 +90,21 @@ public class BundleMaker {
                 path = "classpath:"+path;
             }
             
-            InputStream min = resources.getResourceFromUrl(Urls.mergePaths(path, MANIFEST_PATH));
+            InputStream min;
+            try {
+                min = resources.getResourceFromUrl(Urls.mergePaths(path, MANIFEST_PATH));
+            } catch (RuntimeException e) {
+                Exceptions.propagateIfFatal(e);
+                IOException ioe = Exceptions.getFirstThrowableOfType(e, IOException.class);
+                if (ioe != null && ioe.toString().contains("not found on classpath")) {
+                    min = null;
+                } else {
+                    throw e;
+                }
+            }
             if (min==null) {
-                addUrlItemRecursively(zout, path, path, Predicates.<String>alwaysTrue());
+                zout = new JarOutputStream(new FileOutputStream(f));
+                addUrlItemRecursively(zout, path, path, Predicates.alwaysTrue());
             } else {
                 zout = new JarOutputStream(new FileOutputStream(f), new Manifest(min));
                 addUrlItemRecursively(zout, path, path, Predicates.not(Predicates.equalTo(MANIFEST_PATH)));
@@ -158,12 +170,12 @@ public class BundleMaker {
     }
     
     /** create a copy of the given ZIP as a JAR with the given entries added at the end (removing any duplicates), returning the new temp file */
-    public File copyAdding(File f, Map<ZipEntry,InputStream> entries) {
+    public File copyAdding(File f, Map<ZipEntry, ? extends InputStream> entries) {
         return copyAdding(f, entries, Predicates.<String>alwaysTrue(), false);
     }
     
     /** create a copy of the given ZIP as a JAR with the given entries added at the end, returning the new temp file */
-    public File copyAddingAtEnd(File f, Map<ZipEntry,InputStream> entries) {
+    public File copyAddingAtEnd(File f, Map<ZipEntry, ? extends InputStream> entries) {
         return copyAdding(f, entries, Predicates.<String>alwaysTrue(), true);
     }
 
@@ -178,11 +190,11 @@ public class BundleMaker {
     }
     
     /** create a copy of the given ZIP as a JAR with the given entries removed, returning the new temp file */
-    public File copyRemoving(File f, Predicate<String> filter) {
+    public File copyRemoving(File f, Predicate<? super String> filter) {
         return copyAdding(f, MutableMap.<ZipEntry,InputStream>of(), filter, true);
     }
     
-    private File copyAdding(File f, Map<ZipEntry,InputStream> entries, final Predicate<String> filter, boolean addAtStart) {
+    private File copyAdding(File f, Map<ZipEntry, ? extends InputStream> entries, final Predicate<? super String> filter, boolean addAtStart) {
         final Set<String> entryNames = MutableSet.of();
         for (ZipEntry ze: entries.keySet()) {
             entryNames.add(ze.getName());
@@ -218,8 +230,8 @@ public class BundleMaker {
         }
     }
 
-    private void writeZipEntries(ZipOutputStream zout, Map<ZipEntry, InputStream> entries) throws IOException {
-        for (Map.Entry<ZipEntry,InputStream> ze: entries.entrySet()) {
+    private void writeZipEntries(ZipOutputStream zout, Map<ZipEntry, ? extends InputStream> entries) throws IOException {
+        for (Map.Entry<ZipEntry,? extends InputStream> ze: entries.entrySet()) {
             zout.putNextEntry(ze.getKey());
             InputStream zin = ze.getValue();
             Streams.copy(zin, zout);
@@ -228,7 +240,7 @@ public class BundleMaker {
         }
     }
 
-    private void writeZipEntriesFromFile(ZipOutputStream zout, File existingZip, Predicate<String> filter) throws IOException {
+    private void writeZipEntriesFromFile(ZipOutputStream zout, File existingZip, Predicate<? super String> filter) throws IOException {
         ZipFile zf = new ZipFile(existingZip);
         try {
             Enumeration<? extends ZipEntry> zfe = zf.entries();
@@ -271,7 +283,7 @@ public class BundleMaker {
         }
     }
     
-    private boolean addUrlItemRecursively(ZipOutputStream zout, String root, String item, Predicate<String> filter) throws IOException {
+    private boolean addUrlItemRecursively(ZipOutputStream zout, String root, String item, Predicate<? super String> filter) throws IOException {
         InputStream itemFound = null;
         try {
             itemFound = resources.getResourceFromUrl(item);
@@ -290,7 +302,7 @@ public class BundleMaker {
         return true;
     }
 
-    private boolean addUrlDirToZipRecursively(ZipOutputStream zout, String root, String item, InputStream itemFound, Predicate<String> filter) throws IOException {
+    private boolean addUrlDirToZipRecursively(ZipOutputStream zout, String root, String item, InputStream itemFound, Predicate<? super String> filter) throws IOException {
         LineReader lr = new LineReader(new InputStreamReader(itemFound));
         boolean readSubdirFile = false;
         while (true) {
@@ -314,7 +326,7 @@ public class BundleMaker {
         }
     }
     
-    private void addUrlFileToZip(ZipOutputStream zout, String root, String item, Predicate<String> filter) throws IOException {
+    private void addUrlFileToZip(ZipOutputStream zout, String root, String item, Predicate<? super String> filter) throws IOException {
         InputStream itemFound = null;
         try {
             itemFound = resources.getResourceFromUrl(item);

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/7d1d47b6/core/src/test/java/org/apache/brooklyn/util/core/osgi/BundleMakerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/util/core/osgi/BundleMakerTest.java b/core/src/test/java/org/apache/brooklyn/util/core/osgi/BundleMakerTest.java
new file mode 100644
index 0000000..599531d
--- /dev/null
+++ b/core/src/test/java/org/apache/brooklyn/util/core/osgi/BundleMakerTest.java
@@ -0,0 +1,270 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.util.core.osgi;
+
+import static org.apache.brooklyn.test.Asserts.assertEquals;
+import static org.apache.brooklyn.test.Asserts.assertFalse;
+import static org.apache.brooklyn.test.Asserts.assertNotNull;
+import static org.apache.brooklyn.test.Asserts.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Map;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipOutputStream;
+
+import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
+import org.apache.brooklyn.core.test.BrooklynMgmtUnitTestSupport;
+import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
+import org.apache.brooklyn.util.core.ResourceUtils;
+import org.apache.brooklyn.util.os.Os;
+import org.apache.brooklyn.util.stream.Streams;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Version;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+
+public class BundleMakerTest extends BrooklynMgmtUnitTestSupport {
+
+    private BundleMaker bundleMaker;
+    private File emptyJar;
+    private File tempJar;
+    private File generatedJar;
+    
+    @BeforeMethod(alwaysRun=true)
+    @Override
+    public void setUp() throws Exception {
+        mgmt = LocalManagementContextForTests.builder(true).disableOsgi(false).build();
+        super.setUp();
+        
+        bundleMaker = new BundleMaker(mgmt);
+        emptyJar = createEmptyJarFile();
+    }
+    
+    @AfterMethod(alwaysRun=true)
+    @Override
+    public void tearDown() throws Exception {
+        super.tearDown();
+        if (emptyJar != null) emptyJar.delete();
+        if (tempJar != null) tempJar.delete();
+        if (generatedJar != null) generatedJar.delete();
+    }
+    
+    @Test
+    public void testCopyAdding() throws Exception {
+        generatedJar = bundleMaker.copyAdding(emptyJar, ImmutableMap.of(new ZipEntry("myfile.txt"), new ByteArrayInputStream("mytext".getBytes())));
+        assertJarContents(generatedJar, ImmutableMap.of("myfile.txt", "mytext"));
+    }
+    
+    @Test
+    public void testCopyAddingToNonEmpty() throws Exception {
+        tempJar = bundleMaker.copyAdding(emptyJar, ImmutableMap.of(new ZipEntry("preExisting.txt"), new ByteArrayInputStream("myPreExisting".getBytes())));
+        generatedJar = bundleMaker.copyAdding(tempJar, ImmutableMap.of(new ZipEntry("myfile.txt"), new ByteArrayInputStream("mytext".getBytes())));
+        assertJarContents(generatedJar, ImmutableMap.of("preExisting.txt", "myPreExisting", "myfile.txt", "mytext"));
+    }
+    
+    @Test
+    public void testCopyAddingOverwritesEntry() throws Exception {
+        tempJar = bundleMaker.copyAdding(emptyJar, ImmutableMap.of(new ZipEntry("myfile.txt"), new ByteArrayInputStream("myPreExisting".getBytes())));
+        generatedJar = bundleMaker.copyAdding(tempJar, ImmutableMap.of(new ZipEntry("myfile.txt"), new ByteArrayInputStream("mytext".getBytes())));
+        assertJarContents(generatedJar, ImmutableMap.of("myfile.txt", "mytext"));
+    }
+    
+    @Test
+    public void testCopyAddingManifest() throws Exception {
+        Manifest manifest = new Manifest();
+        manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.2.3"); // needs version, or nothing added to manifest!
+        manifest.getMainAttributes().putValue("mykey", "myval");
+        generatedJar = bundleMaker.copyAddingManifest(emptyJar, manifest);
+        
+        String expectedManifest = 
+                "Manifest-Version: 1.2.3\r\n" + 
+                "mykey: myval\r\n" +
+                "\r\n";
+        assertJarContents(generatedJar, ImmutableMap.of(JarFile.MANIFEST_NAME, expectedManifest));
+    }
+    
+    @Test
+    public void testCopyAddingManifestByMap() throws Exception {
+        Map<String, String> manifest = ImmutableMap.of(Attributes.Name.MANIFEST_VERSION.toString(), "1.2.3", "mykey", "myval");
+        generatedJar = bundleMaker.copyAddingManifest(emptyJar, manifest);
+        
+        String expectedManifest = 
+                "Manifest-Version: 1.2.3\r\n" + 
+                "mykey: myval\r\n" +
+                "\r\n";
+        assertJarContents(generatedJar, ImmutableMap.of(JarFile.MANIFEST_NAME, expectedManifest));
+    }
+    
+    @Test
+    public void testCopyAddingManifestOverwritesExisting() throws Exception {
+        Map<String, String> origManifest = ImmutableMap.of(Attributes.Name.MANIFEST_VERSION.toString(), "4.5.6", "preExistingKey", "preExistingVal");
+        tempJar = bundleMaker.copyAddingManifest(emptyJar, origManifest);
+        
+        Manifest manifest = new Manifest();
+        manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.2.3");
+        manifest.getMainAttributes().putValue("mykey", "myval");
+        generatedJar = bundleMaker.copyAddingManifest(tempJar, manifest);
+        
+        String expectedManifest = 
+                "Manifest-Version: 1.2.3\r\n" + 
+                "mykey: myval\r\n" +
+                "\r\n";
+        assertJarContents(generatedJar, ImmutableMap.of(JarFile.MANIFEST_NAME, expectedManifest));
+    }
+    
+    @Test
+    public void testCopyRemovingPredicate() throws Exception {
+        tempJar = bundleMaker.copyAdding(emptyJar, ImmutableMap.of(
+                new ZipEntry("myfile.txt"), new ByteArrayInputStream("mytext".getBytes()),
+                new ZipEntry("myfile2.txt"), new ByteArrayInputStream("mytext2".getBytes())));
+        generatedJar = bundleMaker.copyRemoving(tempJar, Predicates.equalTo("myfile.txt"));
+        assertJarContents(generatedJar, ImmutableMap.of("myfile.txt", "mytext"));
+    }
+    
+    @Test
+    public void testCopyRemovingItems() throws Exception {
+        tempJar = bundleMaker.copyAdding(emptyJar, ImmutableMap.of(
+                new ZipEntry("myfile.txt"), new ByteArrayInputStream("mytext".getBytes()),
+                new ZipEntry("myfile2.txt"), new ByteArrayInputStream("mytext2".getBytes())));
+        generatedJar = bundleMaker.copyRemoving(tempJar, ImmutableSet.of("myfile.txt"));
+        assertJarContents(generatedJar, ImmutableMap.of("myfile2.txt", "mytext2"));
+    }
+    
+    // TODO Not supported - can't remove an entire directory like this
+    @Test(enabled=false)
+    public void testCopyRemovingItemDir() throws Exception {
+        tempJar = bundleMaker.copyAdding(emptyJar, ImmutableMap.of(
+                new ZipEntry("mydir/myfile.txt"), new ByteArrayInputStream("mytext".getBytes()),
+                new ZipEntry("mydir2/myfile2.txt"), new ByteArrayInputStream("mytext2".getBytes())));
+        generatedJar = bundleMaker.copyRemoving(tempJar, ImmutableSet.of("mydir"));
+        assertJarContents(generatedJar, ImmutableMap.of("mydir2/myfile2.txt", "mytext2"));
+    }
+    
+    @Test
+    public void testCopyRemovingItemsUnmatched() throws Exception {
+        tempJar = bundleMaker.copyAdding(emptyJar, ImmutableMap.of(new ZipEntry("myfile.txt"), new ByteArrayInputStream("mytext".getBytes())));
+        generatedJar = bundleMaker.copyRemoving(tempJar, ImmutableSet.of("wrong.txt"));
+        assertJarContents(generatedJar, ImmutableMap.of("myfile.txt", "mytext"));
+    }
+    
+    @Test
+    public void testHasOsgiManifestWhenNoManifest() throws Exception {
+        assertFalse(bundleMaker.hasOsgiManifest(emptyJar));
+    }
+    
+    @Test
+    public void testHasOsgiManifestWhenInvalidManifest() throws Exception {
+        Map<String, String> manifest = ImmutableMap.of(Attributes.Name.MANIFEST_VERSION.toString(), "1.2.3", "mykey", "myval");
+        generatedJar = bundleMaker.copyAddingManifest(emptyJar, manifest);
+        assertFalse(bundleMaker.hasOsgiManifest(generatedJar));
+    }
+    
+    @Test
+    public void testHasOsgiManifestWhenValidManifest() throws Exception {
+        Map<String, String> manifest = ImmutableMap.of(Attributes.Name.MANIFEST_VERSION.toString(), "1.2.3", Constants.BUNDLE_SYMBOLICNAME, "myname");
+        generatedJar = bundleMaker.copyAddingManifest(emptyJar, manifest);
+        assertTrue(bundleMaker.hasOsgiManifest(generatedJar));
+    }
+    
+    @Test
+    public void testCreateJarFromClasspathDirNoManifest() throws Exception {
+        generatedJar = bundleMaker.createJarFromClasspathDir("/org/apache/brooklyn/util/core/osgi/test/bundlemaker/nomanifest");
+        assertJarContents(generatedJar, ImmutableMap.of("myfile.txt", "mytext", "subdir/myfile2.txt", "mytext2"));
+    }
+    
+    @Test
+    public void testCreateJarFromClasspathDirWithManifest() throws Exception {
+        generatedJar = bundleMaker.createJarFromClasspathDir("/org/apache/brooklyn/util/core/osgi/test/bundlemaker/withmanifest");
+        
+        String expectedManifest = 
+                "Manifest-Version: 1.2.3\r\n" + 
+                "mykey: myval\r\n" +
+                "\r\n";
+        assertJarContents(generatedJar, ImmutableMap.of(JarFile.MANIFEST_NAME, expectedManifest, "myfile.txt", "mytext", "subdir/myfile2.txt", "mytext2"));
+    }
+    
+    @Test
+    public void testInstallBundle() throws Exception {
+        Map<String, String> manifest = ImmutableMap.of(
+                Attributes.Name.MANIFEST_VERSION.toString(), "1.2.3", 
+                Constants.BUNDLE_VERSION, "4.5.6",
+                Constants.BUNDLE_SYMBOLICNAME, "myname");
+        generatedJar = bundleMaker.copyAddingManifest(emptyJar, manifest);
+        
+        Bundle bundle = bundleMaker.installBundle(generatedJar, false);
+        assertEquals(bundle.getSymbolicName(), "myname");
+        assertEquals(bundle.getVersion(), new Version("4.5.6"));
+        
+        // Confirm it really is installed in the management context's OSGi framework
+        Bundle bundle2 = Osgis.bundleFinder(mgmt.getOsgiManager().get().getFramework())
+                .symbolicName("myname")
+                .version("4.5.6")
+                .findUnique()
+                .get();
+        assertEquals(bundle2, bundle);
+    }
+
+    private File createEmptyJarFile() throws Exception {
+        File result = Os.newTempFile("base", "jar");
+        ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(result));
+        zos.close();
+        return result;
+    }
+    
+    private void assertJarContents(File f, Map<String, String> expectedContents) throws Exception {
+        ZipFile zipFile = new ZipFile(f);
+        String zipEntriesMsg = "entries="+enumerationToList(zipFile.entries());
+        try {
+            for (Map.Entry<String, String> entry : expectedContents.entrySet()) {
+                ZipEntry zipEntry = zipFile.getEntry(entry.getKey());
+                assertNotNull(zipEntry, "No entry for "+entry.getKey()+"; "+zipEntriesMsg);
+                String entryContents = Streams.readFullyString(zipFile.getInputStream(zipEntry));
+                assertEquals(entryContents, entry.getValue());
+            }
+            assertEquals(zipFile.size(), expectedContents.size(), zipEntriesMsg);
+            
+        } finally {
+            zipFile.close();
+        }
+    }
+    
+    private <T> List<T> enumerationToList(Enumeration<T> e) {
+        List<T> result = Lists.newArrayList();
+        while (e.hasMoreElements()) {
+            result.add(e.nextElement());
+        }
+        return result;
+        
+    }
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/7d1d47b6/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/nomanifest/myfile.txt
----------------------------------------------------------------------
diff --git a/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/nomanifest/myfile.txt b/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/nomanifest/myfile.txt
new file mode 100644
index 0000000..9170657
--- /dev/null
+++ b/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/nomanifest/myfile.txt
@@ -0,0 +1 @@
+mytext
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/7d1d47b6/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/nomanifest/subdir/myfile2.txt
----------------------------------------------------------------------
diff --git a/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/nomanifest/subdir/myfile2.txt b/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/nomanifest/subdir/myfile2.txt
new file mode 100644
index 0000000..f61890b
--- /dev/null
+++ b/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/nomanifest/subdir/myfile2.txt
@@ -0,0 +1 @@
+mytext2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/7d1d47b6/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/withmanifest/META-INF/MANIFEST.MF
----------------------------------------------------------------------
diff --git a/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/withmanifest/META-INF/MANIFEST.MF b/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/withmanifest/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..bc5306a
--- /dev/null
+++ b/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/withmanifest/META-INF/MANIFEST.MF
@@ -0,0 +1,2 @@
+Manifest-Version: 1.2.3
+mykey: myval

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/7d1d47b6/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/withmanifest/myfile.txt
----------------------------------------------------------------------
diff --git a/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/withmanifest/myfile.txt b/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/withmanifest/myfile.txt
new file mode 100644
index 0000000..9170657
--- /dev/null
+++ b/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/withmanifest/myfile.txt
@@ -0,0 +1 @@
+mytext
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/7d1d47b6/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/withmanifest/subdir/myfile2.txt
----------------------------------------------------------------------
diff --git a/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/withmanifest/subdir/myfile2.txt b/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/withmanifest/subdir/myfile2.txt
new file mode 100644
index 0000000..f61890b
--- /dev/null
+++ b/core/src/test/resources/org/apache/brooklyn/util/core/osgi/test/bundlemaker/withmanifest/subdir/myfile2.txt
@@ -0,0 +1 @@
+mytext2
\ No newline at end of file