#1173 - Ebean server should read ebean.mf entity-packages to locate entity beans

This commit is contained in:
rob bygrave
2017-10-18 23:58:22 +13:00
parent a54c4157e6
commit 00fdb632d7
7 changed files with 68 additions and 15 deletions
@@ -22,9 +22,32 @@ public class ManifestReaderTest {
assertThat(packageSet).contains("com.foo.domain", "com.bar.domain");
}
@Test
public void readEntityPackages() throws Exception {
Set<String> packageSet = readMf("META-INF/test/test-entity-packages.mf");
assertThat(packageSet).contains("com.baz", "org.bax.domain");
}
@Test
public void readCombined() throws Exception {
Set<String> packageSet = readMf("META-INF/test/test-combined.mf");
assertThat(packageSet).contains("com.foo.domain", "com.bar.domain", "com.baz.domain");
}
@Test
public void readAgentOnlyUse() throws Exception {
Set<String> packageSet = readMf("META-INF/test/test-agent-only-use.mf");
assertThat(packageSet).isEmpty();
}
private Set<String> readMf(String path) {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
return ManifestReader.readManifests(classLoader, path);
return ManifestReader.create(classLoader)
.read(path)
.entityPackages();
}
}