Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
parent
66d3165a8c
commit
3791f38684
|
@ -417,14 +417,14 @@ public class Module implements Comparable<Module>
|
|||
case "DEFAULTS": // old name introduced in 9.2.x
|
||||
case "INI": // new name for 9.3+
|
||||
{
|
||||
// All default properties are to be treated as `<k>?=<v>` by the configuration system
|
||||
// even if they are present as `<k>=<v>`
|
||||
// If a property is specified as `<k>=<v>` it is to be treated as `<k>?=<v>`.
|
||||
// All other property usages are left as-is (eg: `<k>+=<v>`)
|
||||
int idx = line.indexOf('=');
|
||||
if (idx > 0)
|
||||
{
|
||||
String key = line.substring(0, idx);
|
||||
String value = line.substring(idx + 1);
|
||||
if (key.endsWith("?"))
|
||||
if (key.endsWith("?") || key.endsWith("+"))
|
||||
{
|
||||
// already the correct way
|
||||
_defaultConfig.add(line);
|
||||
|
|
|
@ -15,8 +15,8 @@ package org.eclipse.jetty.tests.distribution;
|
|||
|
||||
import java.net.URI;
|
||||
import java.nio.file.Path;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.eclipse.jetty.client.api.ContentResponse;
|
||||
import org.eclipse.jetty.client.util.FormRequestContent;
|
||||
|
@ -27,6 +27,7 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
@ -34,6 +35,49 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
|
||||
public class DemoModulesTests extends AbstractJettyHomeTest
|
||||
{
|
||||
@Test
|
||||
public void testDemoAddServerClasses() throws Exception
|
||||
{
|
||||
Path jettyBase = newTestJettyBaseDirectory();
|
||||
String jettyVersion = System.getProperty("jettyVersion");
|
||||
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
|
||||
.jettyVersion(jettyVersion)
|
||||
.jettyBase(jettyBase)
|
||||
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
|
||||
.build();
|
||||
|
||||
int httpPort = distribution.freePort();
|
||||
int httpsPort = distribution.freePort();
|
||||
assertThat("httpPort != httpsPort", httpPort, is(not(httpsPort)));
|
||||
|
||||
String[] argsConfig = {
|
||||
"--add-modules=demo"
|
||||
};
|
||||
|
||||
try (JettyHomeTester.Run runConfig = distribution.start(argsConfig))
|
||||
{
|
||||
assertTrue(runConfig.awaitFor(5, TimeUnit.SECONDS));
|
||||
assertEquals(0, runConfig.getExitValue());
|
||||
|
||||
try (JettyHomeTester.Run runListConfig = distribution.start("--list-config"))
|
||||
{
|
||||
assertTrue(runListConfig.awaitFor(5, TimeUnit.SECONDS));
|
||||
assertEquals(0, runListConfig.getExitValue());
|
||||
// Example of what we expect
|
||||
// jetty.webapp.addServerClasses = org.eclipse.jetty.logging.,${jetty.home.uri}/lib/logging/,org.slf4j.,${jetty.base.uri}/lib/bouncycastle/
|
||||
String addServerKey = " jetty.webapp.addServerClasses = ";
|
||||
String addServerClasses = runListConfig.getLogs().stream()
|
||||
.filter(s -> s.startsWith(addServerKey))
|
||||
.findFirst()
|
||||
.orElseThrow(() ->
|
||||
new NoSuchElementException("Unable to find [" + addServerKey + "]"));
|
||||
assertThat("'jetty.webapp.addServerClasses' entry count",
|
||||
addServerClasses.split(",").length,
|
||||
greaterThan(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJspDump() throws Exception
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue