use of org.wildfly.swarm.container.config.ConfigViewImpl in project wildfly-swarm by wildfly-swarm.
the class ContextPathArchivePreparerTest method testExternalMount.
@SuppressWarnings("unchecked")
@Test
public void testExternalMount() throws Exception {
WARArchive archive = DefaultWarDeploymentFactory.archiveFromCurrentApp();
assertThat(archive.getContextRoot()).isNull();
URL url = getClass().getClassLoader().getResource("mounts.yml");
ConfigViewFactory factory = new ConfigViewFactory(new Properties());
factory.load("test", url);
factory.withProfile("test");
ConfigViewImpl view = factory.get(true);
List<String> mounts = view.resolve("swarm.context.mounts").as(List.class).getValue();
ContextPathArchivePreparer preparer = new ContextPathArchivePreparer(archive);
preparer.mounts = mounts;
preparer.process();
Node externalMount = archive.get(WARArchive.EXTERNAL_MOUNT_PATH);
assertThat(externalMount).isNotNull();
assertThat(externalMount.getAsset()).isInstanceOf(UndertowExternalMountsAsset.class);
UndertowExternalMountsAsset externalMountAsset = (UndertowExternalMountsAsset) externalMount.getAsset();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(externalMountAsset.openStream()))) {
assertThat(reader.readLine()).endsWith("external1");
assertThat(reader.readLine()).endsWith("external2");
}
}
Aggregations