use of org.eclipse.jetty.start.config.JettyBaseConfigSource in project jetty.project by eclipse.
the class ModulesTest method testLoadAllModules.
@Test
public void testLoadAllModules() throws IOException {
// Test Env
File homeDir = MavenTestingUtils.getTestResourceDir("dist-home");
File baseDir = testdir.getEmptyPathDir().toFile();
String[] cmdLine = new String[] { "jetty.version=TEST" };
// Configuration
CommandLineConfigSource cmdLineSource = new CommandLineConfigSource(cmdLine);
ConfigSources config = new ConfigSources();
config.add(cmdLineSource);
config.add(new JettyHomeConfigSource(homeDir.toPath()));
config.add(new JettyBaseConfigSource(baseDir.toPath()));
// Initialize
BaseHome basehome = new BaseHome(config);
StartArgs args = new StartArgs(basehome);
args.parse(config);
// Test Modules
Modules modules = new Modules(basehome, args);
modules.registerAll();
// Check versions
assertThat("java.version.platform", args.getProperties().getString("java.version.platform"), anyOf(equalTo("8"), equalTo("9")));
List<String> moduleNames = new ArrayList<>();
for (Module mod : modules) {
// skip alpn-boot in this test (as its behavior is jdk specific)
if (mod.getName().equals("alpn-boot")) {
continue;
}
moduleNames.add(mod.getName());
}
List<String> expected = new ArrayList<>();
expected.add("base");
expected.add("extra");
expected.add("main");
expected.add("optional");
ConfigurationAssert.assertContainsUnordered("All Modules", expected, moduleNames);
}
use of org.eclipse.jetty.start.config.JettyBaseConfigSource in project jetty.project by eclipse.
the class BaseHomeTest method testGetPaths_Both.
@Test
public void testGetPaths_Both() throws IOException {
File homeDir = MavenTestingUtils.getTestResourceDir("hb.1/home");
File baseDir = MavenTestingUtils.getTestResourceDir("hb.1/base");
ConfigSources config = new ConfigSources();
config.add(new JettyBaseConfigSource(baseDir.toPath()));
config.add(new JettyHomeConfigSource(homeDir.toPath()));
BaseHome hb = new BaseHome(config);
List<Path> paths = hb.getPaths("start.d/*.ini");
List<String> expected = new ArrayList<>();
expected.add("${jetty.base}/start.d/jmx.ini");
expected.add("${jetty.home}/start.d/jndi.ini");
expected.add("${jetty.home}/start.d/jsp.ini");
expected.add("${jetty.base}/start.d/logging.ini");
expected.add("${jetty.home}/start.d/ssl.ini");
expected.add("${jetty.base}/start.d/myapp.ini");
FSTest.toOsSeparators(expected);
assertPathList(hb, "Paths found", expected, paths);
}
use of org.eclipse.jetty.start.config.JettyBaseConfigSource in project jetty.project by eclipse.
the class MavenLocalRepoFileInitializerTest method setupBaseHome.
@Before
public void setupBaseHome() throws IOException {
Path homeDir = testdir.getEmptyPathDir();
ConfigSources config = new ConfigSources();
config.add(new JettyHomeConfigSource(homeDir));
config.add(new JettyBaseConfigSource(homeDir));
this.baseHome = new BaseHome(config);
}
use of org.eclipse.jetty.start.config.JettyBaseConfigSource in project jetty.project by eclipse.
the class ModuleGraphWriterTest method testGenerate_NothingEnabled.
@Test
public void testGenerate_NothingEnabled() throws IOException {
// Test Env
Path homeDir = MavenTestingUtils.getTestResourcePathDir("dist-home");
Path baseDir = testdir.getEmptyPathDir();
String[] cmdLine = new String[] { "jetty.version=TEST" };
// Configuration
CommandLineConfigSource cmdLineSource = new CommandLineConfigSource(cmdLine);
ConfigSources config = new ConfigSources();
config.add(cmdLineSource);
config.add(new JettyHomeConfigSource(homeDir));
config.add(new JettyBaseConfigSource(baseDir));
// Initialize
BaseHome basehome = new BaseHome(config);
StartArgs args = new StartArgs(basehome);
args.parse(config);
Modules modules = new Modules(basehome, args);
modules.registerAll();
Path outputFile = basehome.getBasePath("graph.dot");
ModuleGraphWriter writer = new ModuleGraphWriter();
writer.write(modules, outputFile);
Assert.assertThat("Output File Exists", FS.exists(outputFile), is(true));
}
use of org.eclipse.jetty.start.config.JettyBaseConfigSource in project jetty.project by eclipse.
the class ModuleTest method testLoadMain.
@Test
public void testLoadMain() throws IOException {
// Test Env
Path homeDir = MavenTestingUtils.getTestResourcePathDir("dist-home");
Path baseDir = testdir.getEmptyPathDir();
String[] cmdLine = new String[] { "jetty.version=TEST" };
// Configuration
CommandLineConfigSource cmdLineSource = new CommandLineConfigSource(cmdLine);
ConfigSources config = new ConfigSources();
config.add(cmdLineSource);
config.add(new JettyHomeConfigSource(homeDir));
config.add(new JettyBaseConfigSource(baseDir));
// Initialize
BaseHome basehome = new BaseHome(config);
File file = MavenTestingUtils.getTestResourceFile("dist-home/modules/main.mod");
Module module = new Module(basehome, file.toPath());
Assert.assertThat("Module Name", module.getName(), is("main"));
Assert.assertThat("Module Depends Size", module.getDepends().size(), is(1));
Assert.assertThat("Module Depends", module.getDepends(), containsInAnyOrder("base"));
Assert.assertThat("Module Xmls Size", module.getXmls().size(), is(1));
Assert.assertThat("Module Lib Size", module.getLibs().size(), is(2));
Assert.assertThat("Module Lib", module.getLibs(), contains("lib/main.jar", "lib/other.jar"));
}
Aggregations