Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlyn Normington2012-08-14 06:22:44 -0400
committerGlyn Normington2012-08-14 06:50:01 -0400
commit3b6c9cbdffc0ed23aefd28d9eca806940ecfd59b (patch)
tree9a04f9649daf7eb8c2e0191e18bef7f5b05aa2b4 /org.eclipse.virgo.kernel.artifact
parent36fda21a3de3830e4bbe4bbb072dcf989db2cc45 (diff)
downloadorg.eclipse.virgo.kernel-3b6c9cbdffc0ed23aefd28d9eca806940ecfd59b.tar.gz
org.eclipse.virgo.kernel-3b6c9cbdffc0ed23aefd28d9eca806940ecfd59b.tar.xz
org.eclipse.virgo.kernel-3b6c9cbdffc0ed23aefd28d9eca806940ecfd59b.zip
385574: add failing test and remove compiler warning
Diffstat (limited to 'org.eclipse.virgo.kernel.artifact')
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/fs/internal/JarFileArtifactFSEntry.java1
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/fs/internal/JarFileArtifactFSTests.java29
2 files changed, 29 insertions, 1 deletions
diff --git a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/fs/internal/JarFileArtifactFSEntry.java b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/fs/internal/JarFileArtifactFSEntry.java
index 916757fb..594f3b7b 100644
--- a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/fs/internal/JarFileArtifactFSEntry.java
+++ b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/fs/internal/JarFileArtifactFSEntry.java
@@ -114,7 +114,6 @@ final class JarFileArtifactFSEntry implements ArtifactFSEntry {
/**
* {@inheritDoc}
*/
- @SuppressWarnings("resource")
public InputStream getInputStream() {
JarFileScanner scanner = new JarFileScanner();
ZipEntry entry = scanner.getNextEntry();
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/fs/internal/JarFileArtifactFSTests.java b/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/fs/internal/JarFileArtifactFSTests.java
index 6bc33e84..b33bf482 100644
--- a/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/fs/internal/JarFileArtifactFSTests.java
+++ b/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/fs/internal/JarFileArtifactFSTests.java
@@ -28,6 +28,8 @@ public class JarFileArtifactFSTests {
private final FileArtifactFS artifactFS = new JarFileArtifactFS(new File("src/test/resources/artifacts/simple.jar"));
+ private final FileArtifactFS artifactFSWithMissingEntries = new JarFileArtifactFS(new File("src/test/resources/artifacts/bundle-with-missing-entries.jar"));
+
@Test(expected = IllegalArgumentException.class)
public void constructorDirectory() {
new JarFileArtifactFS(new File("target"));
@@ -221,5 +223,32 @@ public class JarFileArtifactFSTests {
String contents = new Scanner(inputStream).useDelimiter("\\A").next();
assertTrue(contents.startsWith("<beans xmlns=\"http://www.springframework.org/schema/beans\""));
}
+
+ @Test
+ public void getMissingDirectoryEntry() {
+ ArtifactFSEntry entry = this.artifactFSWithMissingEntries.getEntry("META-INF/spring/");
+ assertTrue(entry.exists());
+ assertTrue(entry.isDirectory());
+ }
+
+ @Test
+ public void getMissingDirectoryEntryName() {
+ ArtifactFSEntry entry = this.artifactFSWithMissingEntries.getEntry("META-INF/spring/");
+ assertEquals("spring", entry.getName());
+ }
+
+ @Test
+ public void getMissingDirectoryEntryChildren() {
+ ArtifactFSEntry entry = this.artifactFSWithMissingEntries.getEntry("META-INF/spring/");
+ ArtifactFSEntry[] children = entry.getChildren();
+ assertEquals(1, children.length);
+ }
+
+ @Test
+ public void getChildrenIncludingMissingEntry() {
+ ArtifactFSEntry entry = this.artifactFSWithMissingEntries.getEntry("META-INF/");
+ ArtifactFSEntry[] children = entry.getChildren();
+ assertEquals(3, children.length);
+ }
}

Back to the top