415830 - jetty-start / add more TestUseCases for home + base + modules configurations
+ Adding more complexity to module persistence mechanism test case to demonstrate how it works.
This commit is contained in:
parent
d53e9e4ada
commit
c61cbaec2b
|
@ -410,13 +410,12 @@ public class Main
|
|||
modules.registerAll(baseHome);
|
||||
|
||||
// 6) Active Module Resolution
|
||||
modules.enable(loadModulePersistence());
|
||||
for (String enabledModule : args.getEnabledModules())
|
||||
{
|
||||
List<String> sources = args.getSources(enabledModule);
|
||||
StartLog.debug("Enabling module: %s (from %s)",enabledModule,join(sources,", "));
|
||||
modules.enable(enabledModule,sources);
|
||||
}
|
||||
modules.enable(loadModulePersistence());
|
||||
|
||||
StartLog.debug("Building Module Graph");
|
||||
modules.buildGraph();
|
||||
|
|
|
@ -288,6 +288,11 @@ public class Module extends TextFile
|
|||
this.sources.addAll(sources);
|
||||
}
|
||||
|
||||
public void clearSources()
|
||||
{
|
||||
this.sources.clear();
|
||||
}
|
||||
|
||||
public Set<String> getSources()
|
||||
{
|
||||
return Collections.unmodifiableSet(sources);
|
||||
|
|
|
@ -204,9 +204,63 @@ public class Modules implements Iterable<Module>
|
|||
{
|
||||
List<String> source = new ArrayList<>();
|
||||
source.add("<module-persistence>");
|
||||
for (String module : persistence.getEnabled())
|
||||
|
||||
if (persistence.getEnabled().size() > 0)
|
||||
{
|
||||
enable(module,source);
|
||||
// show user warning about module enablement + module persistence
|
||||
List<String> enabled = new ArrayList<>();
|
||||
for (Module module : modules.values())
|
||||
{
|
||||
if (module.isEnabled())
|
||||
{
|
||||
if (!persistence.getEnabled().contains(module.getName()))
|
||||
{
|
||||
// only add if not already covered by module persistence
|
||||
enabled.add(module.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (enabled.size() > 0)
|
||||
{
|
||||
StringBuilder err = new StringBuilder();
|
||||
err.append("WARNING: Module Persistence Mode is being used.\n");
|
||||
err.append("The following ");
|
||||
if (enabled.size() > 1)
|
||||
{
|
||||
err.append(enabled.size()).append(" modules");
|
||||
}
|
||||
else
|
||||
{
|
||||
err.append(" module");
|
||||
}
|
||||
err.append(", defined outside of the module persistence mechanism, ");
|
||||
if (enabled.size() > 1)
|
||||
{
|
||||
err.append("are ");
|
||||
}
|
||||
else
|
||||
{
|
||||
err.append("is ");
|
||||
}
|
||||
err.append("being ignored.");
|
||||
System.err.println(err);
|
||||
|
||||
for (int i = 0; i < enabled.size(); i++)
|
||||
{
|
||||
String name = enabled.get(i);
|
||||
Module module = modules.get(name);
|
||||
System.err.printf(" [%d] \"%s\" - defined in [%s]%n",i + 1,name,Main.join(module.getSources(),", "));
|
||||
module.setEnabled(false);
|
||||
module.clearSources();
|
||||
}
|
||||
}
|
||||
|
||||
// use module persistence mode
|
||||
for (String module : persistence.getEnabled())
|
||||
{
|
||||
enable(module,source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,6 +272,7 @@ public class Modules implements Iterable<Module>
|
|||
System.err.printf("WARNING: Cannot enable requested module [%s]: not a valid module name.%n",name);
|
||||
return;
|
||||
}
|
||||
StartLog.debug("Enabling module: %s (via %s)",name,Main.join(sources,", "));
|
||||
module.setEnabled(true);
|
||||
if (sources != null)
|
||||
{
|
||||
|
|
|
@ -39,8 +39,7 @@ public class TestUseCases
|
|||
List<String> cmdLine = new ArrayList<>();
|
||||
cmdLine.add("jetty.home=" + homeDir.getAbsolutePath());
|
||||
cmdLine.add("jetty.base=" + baseDir.getAbsolutePath());
|
||||
int len = cmdLine.size();
|
||||
StartArgs args = main.processCommandLine(cmdLine.toArray(new String[len]));
|
||||
StartArgs args = main.processCommandLine(cmdLine);
|
||||
BaseHome baseHome = main.getBaseHome();
|
||||
ConfigurationAssert.assertConfiguration(baseHome,args,"usecases/" + assertName);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
--module=requestlog
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
--module=websocket
|
|
@ -1,4 +1,9 @@
|
|||
|
||||
# this should not be picked up as there is a module persistence layer present
|
||||
--module=debug
|
||||
--module=ipaccess
|
||||
--module=rewrite
|
||||
|
||||
jetty.port=12345
|
||||
|
||||
jetty.keystore=etc/keystore
|
||||
|
|
Loading…
Reference in New Issue