Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #6021 - PoC for resolvePath within XmlConfiguration #6022

Merged
merged 10 commits into from
Mar 3, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -1622,15 +1622,23 @@ public void testCallResolvePath(String configValue, String expectedPath) throws
" </Set>" +
"</Configure>");

configuration.setJettyStandardIdsAndProperties(null, Resource.newResource(war));
configuration.getProperties().put("jetty.base", "/var/lib/jetty-base");
if (configValue != null)
configuration.getProperties().put("jetty.sslContext.keyStorePath", configValue);
try
{
configuration.setJettyStandardIdsAndProperties(null, Resource.newResource(war));
configuration.getProperties().put("jetty.base", "/var/lib/jetty-base");
if (configValue != null)
configuration.getProperties().put("jetty.sslContext.keyStorePath", configValue);

TestConfiguration tc = new TestConfiguration();
configuration.configure(tc);
TestConfiguration tc = new TestConfiguration();
configuration.configure(tc);

assertThat(tc.getTestString(), is(expectedPath));
assertThat(tc.getTestString(), is(expectedPath));
gregw marked this conversation as resolved.
Show resolved Hide resolved
}
finally
{
// cleanup after myself
configuration.getProperties().remove("jetty.base");
}
}

@Test
Expand Down Expand Up @@ -1658,7 +1666,7 @@ public void testResolvePathInvalidBase()
FS.ensureDeleted(testPath);
Path baseDir = testPath.resolve("bogus");
String resolved = XmlConfiguration.resolvePath(baseDir.toString(), "etc/keystore");
assertNull(resolved, "Should be null as baseDir does not exist");
assertEquals(baseDir.resolve("etc/keystore").toString(), resolved);
}

private ByteArrayOutputStream captureLoggingBytes(ThrowableAction action) throws Exception
Expand Down