More changes to teh way ExplodedArchive works in non-recursive mode
It is sufficient for most purposes (e.g. the ones PropertieLauncher needs) to only read the META-INF directory (not the whole file tree). So a quick fix is to make META-INF a special case when initializing non-recursive entries. Fixes gh-520
This commit is contained in:
@@ -22,7 +22,9 @@ import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
/**
|
||||
@@ -37,6 +39,23 @@ public class SpecialArchiveTests {
|
||||
assertThat(entries.size(), greaterThan(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getManifest() throws Exception {
|
||||
ExplodedArchive archive = new ExplodedArchive(new File("src/test/resources/root"));
|
||||
assertNotNull(archive.getManifest());
|
||||
Map<String, Archive.Entry> entries = getEntriesMap(archive);
|
||||
assertThat(entries.size(), equalTo(4));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getManifestEvenIfNonRecursive() throws Exception {
|
||||
ExplodedArchive archive = new ExplodedArchive(
|
||||
new File("src/test/resources/root"), false);
|
||||
assertNotNull(archive.getManifest());
|
||||
Map<String, Archive.Entry> entries = getEntriesMap(archive);
|
||||
assertThat(entries.size(), equalTo(3));
|
||||
}
|
||||
|
||||
private Map<String, Archive.Entry> getEntriesMap(Archive archive) {
|
||||
Map<String, Archive.Entry> entries = new HashMap<String, Archive.Entry>();
|
||||
for (Archive.Entry entry : archive.getEntries()) {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user