Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jetty-start/src/test/java/org/eclipse/jetty/start/config/ConfigSourcesTest.java')
-rw-r--r--jetty-start/src/test/java/org/eclipse/jetty/start/config/ConfigSourcesTest.java138
1 files changed, 71 insertions, 67 deletions
diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/config/ConfigSourcesTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/config/ConfigSourcesTest.java
index 7aad9a9892..19a0c3c7ad 100644
--- a/jetty-start/src/test/java/org/eclipse/jetty/start/config/ConfigSourcesTest.java
+++ b/jetty-start/src/test/java/org/eclipse/jetty/start/config/ConfigSourcesTest.java
@@ -18,10 +18,9 @@
package org.eclipse.jetty.start.config;
-import static org.hamcrest.Matchers.*;
-
import java.io.File;
import java.io.IOException;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -36,6 +35,10 @@ import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+
public class ConfigSourcesTest
{
@Rule
@@ -83,13 +86,13 @@ public class ConfigSourcesTest
// Create home
File home = testdir.getFile("home");
FS.ensureEmpty(home);
- TestEnv.copyTestDir("usecases/home",home);
+ TestEnv.copyTestDir("dist-home",home);
// Create base
File base = testdir.getFile("base");
FS.ensureEmpty(base);
TestEnv.makeFile(base,"start.ini", //
- "jetty.host=127.0.0.1");
+ "jetty.http.host=127.0.0.1");
ConfigSources sources = new ConfigSources();
@@ -107,27 +110,28 @@ public class ConfigSourcesTest
// Create home
File home = testdir.getFile("home");
FS.ensureEmpty(home);
- TestEnv.copyTestDir("usecases/home",home);
+ TestEnv.copyTestDir("dist-home",home);
// Create common
- File common = testdir.getFile("common");
- FS.ensureEmpty(common);
+ Path common = testdir.getFile("common").toPath();
+ FS.ensureEmpty(common.toFile());
+ common = common.toRealPath();
// Create base
File base = testdir.getFile("base");
FS.ensureEmpty(base);
TestEnv.makeFile(base,"start.ini", //
- "jetty.host=127.0.0.1",//
- "--include-jetty-dir=" + common.getAbsolutePath());
+ "jetty.http.host=127.0.0.1",//
+ "--include-jetty-dir=" + common.toString());
ConfigSources sources = new ConfigSources();
String[] cmdLine = new String[0];
sources.add(new CommandLineConfigSource(cmdLine));
- sources.add(new JettyHomeConfigSource(home.toPath()));
- sources.add(new JettyBaseConfigSource(base.toPath()));
+ sources.add(new JettyHomeConfigSource(home.toPath().toRealPath()));
+ sources.add(new JettyBaseConfigSource(base.toPath().toRealPath()));
- assertIdOrder(sources,"<command-line>","${jetty.base}",common.getAbsolutePath(),"${jetty.home}");
+ assertIdOrder(sources,"<command-line>","${jetty.base}",common.toString(),"${jetty.home}");
}
@Test
@@ -136,18 +140,18 @@ public class ConfigSourcesTest
// Create home
File home = testdir.getFile("home");
FS.ensureEmpty(home);
- TestEnv.copyTestDir("usecases/home",home);
+ TestEnv.copyTestDir("dist-home",home);
// Create common
File common = testdir.getFile("common");
FS.ensureEmpty(common);
- TestEnv.makeFile(common,"start.ini","jetty.port=8080");
+ TestEnv.makeFile(common,"start.ini","jetty.http.port=8080");
// Create base
File base = testdir.getFile("base");
FS.ensureEmpty(base);
TestEnv.makeFile(base,"start.ini", //
- "jetty.host=127.0.0.1");
+ "jetty.http.host=127.0.0.1");
ConfigSources sources = new ConfigSources();
@@ -167,8 +171,8 @@ public class ConfigSourcesTest
assertDirOrder(sources,base,common,home);
- assertProperty(sources,"jetty.host","127.0.0.1");
- assertProperty(sources,"jetty.port","8080"); // from 'common'
+ assertProperty(sources,"jetty.http.host","127.0.0.1");
+ assertProperty(sources,"jetty.http.port","8080"); // from 'common'
}
@Test
@@ -177,7 +181,7 @@ public class ConfigSourcesTest
// Create home
File home = testdir.getFile("home");
FS.ensureEmpty(home);
- TestEnv.copyTestDir("usecases/home",home);
+ TestEnv.copyTestDir("dist-home",home);
// Create opt
File opt = testdir.getFile("opt");
@@ -186,13 +190,13 @@ public class ConfigSourcesTest
// Create common
File common = new File(opt,"common");
FS.ensureEmpty(common);
- TestEnv.makeFile(common,"start.ini","jetty.port=8080");
+ TestEnv.makeFile(common,"start.ini","jetty.http.port=8080");
// Create base
File base = testdir.getFile("base");
FS.ensureEmpty(base);
TestEnv.makeFile(base,"start.ini", //
- "jetty.host=127.0.0.1");
+ "jetty.http.host=127.0.0.1");
String dirRef = "${my.opt}" + File.separator + "common";
@@ -213,8 +217,8 @@ public class ConfigSourcesTest
assertDirOrder(sources,base,common,home);
- assertProperty(sources,"jetty.host","127.0.0.1");
- assertProperty(sources,"jetty.port","8080"); // from 'common'
+ assertProperty(sources,"jetty.http.host","127.0.0.1");
+ assertProperty(sources,"jetty.http.port","8080"); // from 'common'
}
@Test
@@ -223,7 +227,7 @@ public class ConfigSourcesTest
// Create home
File home = testdir.getFile("home");
FS.ensureEmpty(home);
- TestEnv.copyTestDir("usecases/home",home);
+ TestEnv.copyTestDir("dist-home",home);
// Create opt
File opt = testdir.getFile("opt");
@@ -232,13 +236,13 @@ public class ConfigSourcesTest
// Create common
File common = new File(opt,"common");
FS.ensureEmpty(common);
- TestEnv.makeFile(common,"start.ini","jetty.port=8080");
+ TestEnv.makeFile(common,"start.ini","jetty.http.port=8080");
// Create base
File base = testdir.getFile("base");
FS.ensureEmpty(base);
TestEnv.makeFile(base,"start.ini", //
- "jetty.host=127.0.0.1");
+ "jetty.http.host=127.0.0.1");
String dirRef = "${my.opt}" + File.separator + "${my.dir}";
@@ -262,8 +266,8 @@ public class ConfigSourcesTest
assertDirOrder(sources,base,common,home);
- assertProperty(sources,"jetty.host","127.0.0.1");
- assertProperty(sources,"jetty.port","8080"); // from 'common'
+ assertProperty(sources,"jetty.http.host","127.0.0.1");
+ assertProperty(sources,"jetty.http.port","8080"); // from 'common'
}
@Test
@@ -272,18 +276,18 @@ public class ConfigSourcesTest
// Create home
File home = testdir.getFile("home");
FS.ensureEmpty(home);
- TestEnv.copyTestDir("usecases/home",home);
+ TestEnv.copyTestDir("dist-home",home);
// Create common
File common = testdir.getFile("common");
FS.ensureEmpty(common);
- TestEnv.makeFile(common,"start.ini","jetty.port=8080");
+ TestEnv.makeFile(common,"start.ini","jetty.http.port=8080");
// Create base
File base = testdir.getFile("base");
FS.ensureEmpty(base);
TestEnv.makeFile(base,"start.ini", //
- "jetty.host=127.0.0.1",//
+ "jetty.http.host=127.0.0.1",//
"--include-jetty-dir=" + common.getAbsolutePath());
ConfigSources sources = new ConfigSources();
@@ -297,8 +301,8 @@ public class ConfigSourcesTest
assertDirOrder(sources,base,common,home);
- assertProperty(sources,"jetty.host","127.0.0.1");
- assertProperty(sources,"jetty.port","8080"); // from 'common'
+ assertProperty(sources,"jetty.http.host","127.0.0.1");
+ assertProperty(sources,"jetty.http.port","8080"); // from 'common'
}
@Test
@@ -307,12 +311,12 @@ public class ConfigSourcesTest
// Create home
File home = testdir.getFile("home");
FS.ensureEmpty(home);
- TestEnv.copyTestDir("usecases/home",home);
+ TestEnv.copyTestDir("dist-home",home);
// Create common
File common = testdir.getFile("common");
FS.ensureEmpty(common);
- TestEnv.makeFile(common,"start.ini","jetty.port=8080");
+ TestEnv.makeFile(common,"start.ini","jetty.http.port=8080");
// Create corp
File corp = testdir.getFile("corp");
@@ -322,7 +326,7 @@ public class ConfigSourcesTest
File base = testdir.getFile("base");
FS.ensureEmpty(base);
TestEnv.makeFile(base,"start.ini", //
- "jetty.host=127.0.0.1",//
+ "jetty.http.host=127.0.0.1",//
"--include-jetty-dir=" + common.getAbsolutePath(), //
"--include-jetty-dir=" + corp.getAbsolutePath());
@@ -340,8 +344,8 @@ public class ConfigSourcesTest
assertDirOrder(sources,base,common,corp,home);
- assertProperty(sources,"jetty.host","127.0.0.1");
- assertProperty(sources,"jetty.port","8080"); // from 'common'
+ assertProperty(sources,"jetty.http.host","127.0.0.1");
+ assertProperty(sources,"jetty.http.port","8080"); // from 'common'
}
@Test
@@ -350,26 +354,26 @@ public class ConfigSourcesTest
// Create home
File home = testdir.getFile("home");
FS.ensureEmpty(home);
- TestEnv.copyTestDir("usecases/home",home);
+ TestEnv.copyTestDir("dist-home",home);
// Create corp
File corp = testdir.getFile("corp");
FS.ensureEmpty(corp);
TestEnv.makeFile(corp,"start.ini", //
- "jetty.port=9090");
+ "jetty.http.port=9090");
// Create common
File common = testdir.getFile("common");
FS.ensureEmpty(common);
TestEnv.makeFile(common,"start.ini", //
"--include-jetty-dir=" + corp.getAbsolutePath(), //
- "jetty.port=8080");
+ "jetty.http.port=8080");
// Create base
File base = testdir.getFile("base");
FS.ensureEmpty(base);
TestEnv.makeFile(base,"start.ini", //
- "jetty.host=127.0.0.1",//
+ "jetty.http.host=127.0.0.1",//
"--include-jetty-dir=" + common.getAbsolutePath());
ConfigSources sources = new ConfigSources();
@@ -386,8 +390,8 @@ public class ConfigSourcesTest
assertDirOrder(sources,base,common,corp,home);
- assertProperty(sources,"jetty.host","127.0.0.1");
- assertProperty(sources,"jetty.port","8080"); // from 'common'
+ assertProperty(sources,"jetty.http.host","127.0.0.1");
+ assertProperty(sources,"jetty.http.port","8080"); // from 'common'
}
@Test
@@ -396,13 +400,13 @@ public class ConfigSourcesTest
// Create home
File home = testdir.getFile("home");
FS.ensureEmpty(home);
- TestEnv.copyTestDir("usecases/home",home);
+ TestEnv.copyTestDir("dist-home",home);
// Create corp
File corp = testdir.getFile("corp");
FS.ensureEmpty(corp);
TestEnv.makeFile(corp,"start.ini", //
- "jetty.port=9090");
+ "jetty.http.port=9090");
// Create common
File common = testdir.getFile("common");
@@ -410,13 +414,13 @@ public class ConfigSourcesTest
TestEnv.makeFile(common,"start.ini", //
"my.corp=" + corp.getAbsolutePath(), //
"--include-jetty-dir=${my.corp}", //
- "jetty.port=8080");
+ "jetty.http.port=8080");
// Create base
File base = testdir.getFile("base");
FS.ensureEmpty(base);
TestEnv.makeFile(base,"start.ini", //
- "jetty.host=127.0.0.1",//
+ "jetty.http.host=127.0.0.1",//
"my.common="+common.getAbsolutePath(), //
"--include-jetty-dir=${my.common}");
@@ -435,8 +439,8 @@ public class ConfigSourcesTest
assertDirOrder(sources,base,common,corp,home);
- assertProperty(sources,"jetty.host","127.0.0.1");
- assertProperty(sources,"jetty.port","8080"); // from 'common'
+ assertProperty(sources,"jetty.http.host","127.0.0.1");
+ assertProperty(sources,"jetty.http.port","8080"); // from 'common'
}
@Test
@@ -445,33 +449,33 @@ public class ConfigSourcesTest
// Create home
File home = testdir.getFile("home");
FS.ensureEmpty(home);
- TestEnv.copyTestDir("usecases/home",home);
+ TestEnv.copyTestDir("dist-home",home);
// Create devops
File devops = testdir.getFile("devops");
FS.ensureEmpty(devops);
TestEnv.makeFile(devops,"start.ini", //
"--module=logging", //
- "jetty.port=2222");
+ "jetty.http.port=2222");
// Create corp
File corp = testdir.getFile("corp");
FS.ensureEmpty(corp);
TestEnv.makeFile(corp,"start.ini", //
- "jetty.port=9090");
+ "jetty.http.port=9090");
// Create common
File common = testdir.getFile("common");
FS.ensureEmpty(common);
TestEnv.makeFile(common,"start.ini", //
"--include-jetty-dir=" + corp.getAbsolutePath(), //
- "jetty.port=8080");
+ "jetty.http.port=8080");
// Create base
File base = testdir.getFile("base");
FS.ensureEmpty(base);
TestEnv.makeFile(base,"start.ini", //
- "jetty.host=127.0.0.1",//
+ "jetty.http.host=127.0.0.1",//
"--include-jetty-dir=" + common.getAbsolutePath());
ConfigSources sources = new ConfigSources();
@@ -492,8 +496,8 @@ public class ConfigSourcesTest
assertDirOrder(sources,base,devops,common,corp,home);
- assertProperty(sources,"jetty.host","127.0.0.1");
- assertProperty(sources,"jetty.port","2222"); // from 'common'
+ assertProperty(sources,"jetty.http.host","127.0.0.1");
+ assertProperty(sources,"jetty.http.port","2222"); // from 'common'
}
@Test
@@ -502,33 +506,33 @@ public class ConfigSourcesTest
// Create home
File home = testdir.getFile("home");
FS.ensureEmpty(home);
- TestEnv.copyTestDir("usecases/home",home);
+ TestEnv.copyTestDir("dist-home",home);
// Create corp
File corp = testdir.getFile("corp");
FS.ensureEmpty(corp);
TestEnv.makeFile(corp,"start.ini", //
- "jetty.port=9090");
+ "jetty.http.port=9090");
// Create common
File common = testdir.getFile("common");
FS.ensureEmpty(common);
TestEnv.makeFile(common,"start.ini", //
"--include-jetty-dir=" + corp.getAbsolutePath(), //
- "jetty.port=8080");
+ "jetty.http.port=8080");
// Create base
File base = testdir.getFile("base");
FS.ensureEmpty(base);
TestEnv.makeFile(base,"start.ini", //
- "jetty.host=127.0.0.1",//
+ "jetty.http.host=127.0.0.1",//
"--include-jetty-dir=" + common.getAbsolutePath());
ConfigSources sources = new ConfigSources();
String cmdLine[] = new String[]{
// command line property should override all others
- "jetty.port=7070"
+ "jetty.http.port=7070"
};
sources.add(new CommandLineConfigSource(cmdLine));
sources.add(new JettyHomeConfigSource(home.toPath()));
@@ -541,8 +545,8 @@ public class ConfigSourcesTest
assertDirOrder(sources,base,common,corp,home);
- assertProperty(sources,"jetty.host","127.0.0.1");
- assertProperty(sources,"jetty.port","7070"); // from <command-line>
+ assertProperty(sources,"jetty.http.host","127.0.0.1");
+ assertProperty(sources,"jetty.http.port","7070"); // from <command-line>
}
@Test
@@ -551,7 +555,7 @@ public class ConfigSourcesTest
// Create home
File home = testdir.getFile("home");
FS.ensureEmpty(home);
- TestEnv.copyTestDir("usecases/home",home);
+ TestEnv.copyTestDir("dist-home",home);
// Create common
File common = testdir.getFile("common");
@@ -562,14 +566,14 @@ public class ConfigSourcesTest
FS.ensureEmpty(corp);
TestEnv.makeFile(corp,"start.ini",
// standard property
- "jetty.port=9090",
+ "jetty.http.port=9090",
// INTENTIONAL BAD Reference (duplicate)
"--include-jetty-dir=" + common.getAbsolutePath());
// Populate common
TestEnv.makeFile(common,"start.ini",
// standard property
- "jetty.port=8080",
+ "jetty.http.port=8080",
// reference to corp
"--include-jetty-dir=" + corp.getAbsolutePath());
@@ -577,7 +581,7 @@ public class ConfigSourcesTest
File base = testdir.getFile("base");
FS.ensureEmpty(base);
TestEnv.makeFile(base,"start.ini", //
- "jetty.host=127.0.0.1",//
+ "jetty.http.host=127.0.0.1",//
"--include-jetty-dir=" + common.getAbsolutePath());
ConfigSources sources = new ConfigSources();

Back to the top