From 26f6899106d6c87324e68fb1646dbd66438c194f Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 7 Sep 2021 17:22:06 -0500 Subject: [PATCH] Cleaning up jetty-start Usecase testing. + Changes are isolate to src/test/java + No changes to src/main/java + Each test is now self contained entirely within java code + Removed *.prepare.txt, *.cmdline.txt, and *.assert.txt files + Removed all src/test/resources/usecases content + Removed CollectionAsserts Signed-off-by: Joakim Erdfelt --- .../jetty/start/ConfigurationAssert.java | 272 ----------- .../jetty/start/IncludeJettyDirTest.java | 3 +- .../org/eclipse/jetty/start/MainTest.java | 130 ----- .../org/eclipse/jetty/start/ModulesTest.java | 5 +- .../eclipse/jetty/start/TestBadUseCases.java | 87 ---- .../org/eclipse/jetty/start/TestUseCases.java | 158 ------ .../jetty/start/config/ConfigSourcesTest.java | 42 +- .../jetty/start/usecases/AbstractUseCase.java | 265 ++++++++++ .../start/usecases/AgentPropertiesTest.java | 93 ++++ .../jetty/start/usecases/AlternatesTest.java | 452 ++++++++++++++++++ .../usecases/BarebonesAddToStartTest.java | 90 ++++ .../usecases/BarebonesAddToStartdTest.java | 92 ++++ .../usecases/BarebonesAddUnknownTest.java | 56 +++ .../usecases/BarebonesAlreadyEnabledTest.java | 90 ++++ .../jetty/start/usecases/BarebonesTest.java | 75 +++ .../start/usecases/BasehomeWithfilesTest.java | 97 ++++ .../start/usecases/BasicPropertiesTest.java | 108 +++++ .../jetty/start/usecases/BasicTest.java | 300 ++++++++++++ .../jetty/start/usecases/DatabaseTest.java | 102 ++++ .../start/usecases/DynamicDependTest.java | 165 +++++++ .../EmptyAddToStartCreateStartdTest.java | 95 ++++ .../start/usecases/EmptyAddToStartTest.java | 89 ++++ .../start/usecases/EmptyCreateStartdTest.java | 92 ++++ .../jetty/start/usecases/Files0Test.java | 73 +++ .../jetty/start/usecases/LoopTest.java | 173 +++++++ .../jetty/start/usecases/OrderedTest.java | 432 +++++++++++++++++ .../start/usecases/ParameterizedTest.java | 311 ++++++++++++ .../usecases/TransientIniTemplateTest.java | 184 +++++++ .../start/usecases/VersionedModulesTest.java | 95 ++++ .../test/resources/assert-home-with-jvm.txt | 24 - .../resources/assert-home-with-module.txt | 22 - .../resources/assert-home-with-spaces.txt | 15 - .../src/test/resources/assert-home.txt | 15 - .../usecases/agent-properties.assert.txt | 12 - .../usecases/agent-properties.cmdline.txt | 1 - .../agent-properties/lib/agent-jdk-1.5.jar | 0 .../agent-properties/lib/agent-jdk-1.6.jar | 0 .../agent-properties/lib/agent-jdk-1.7.jar | 0 .../agent-properties/lib/agent-jdk-1.8.jar | 0 .../agent-properties/modules/agent.mod | 6 - .../usecases/agent-properties/start.ini | 1 - .../resources/usecases/alternate.0.assert.txt | 12 - .../usecases/alternate.0.cmdline.txt | 2 - .../resources/usecases/alternate.1.assert.txt | 15 - .../usecases/alternate.1.cmdline.txt | 2 - .../resources/usecases/alternate.2.assert.txt | 14 - .../usecases/alternate.2.cmdline.txt | 2 - .../resources/usecases/alternate.3.assert.txt | 2 - .../usecases/alternate.3.cmdline.txt | 2 - .../resources/usecases/alternate.4.assert.txt | 14 - .../usecases/alternate.4.cmdline.txt | 1 - .../usecases/alternate.4.prepare.txt | 1 - .../resources/usecases/alternate/etc/d.xml | 0 .../resources/usecases/alternate/etc/ndb.xml | 0 .../usecases/alternate/modules/alternate.mod | 5 - .../usecases/alternate/modules/default.mod | 5 - .../alternate/modules/noDftOptionA.mod | 8 - .../alternate/modules/noDftOptionB.mod | 11 - .../resources/usecases/alternate/start.ini | 2 - .../usecases/barebones.addToStart.assert.txt | 18 - .../usecases/barebones.addToStart.prepare.txt | 1 - .../usecases/barebones.addToStartd.assert.txt | 19 - .../barebones.addToStartd.prepare.txt | 2 - .../usecases/barebones.addUnknown.assert.txt | 1 - .../usecases/barebones.addUnknown.prepare.txt | 2 - .../barebones.alreadyEnabled.assert.txt | 17 - .../barebones.alreadyEnabled.prepare.txt | 1 - .../resources/usecases/barebones.assert.txt | 11 - .../resources/usecases/barebones/start.ini | 1 - .../usecases/basehome.withfiles.assert.txt | 15 - .../usecases/basehome.withfiles.prepare.txt | 2 - .../usecases/basehome/modules/withfiles.mod | 12 - .../modules/withfiles/four/sub/dir/test.txt | 1 - .../basehome/modules/withfiles/four/test.txt | 1 - .../basehome/modules/withfiles/test.txt | 1 - .../usecases/basic-properties.assert.txt | 22 - .../usecases/basic-properties.cmdline.txt | 16 - .../usecases/basic-properties/start.ini | 2 - .../resources/usecases/database.assert.txt | 16 - .../resources/usecases/database/etc/db.xml | 1 - .../usecases/database/lib/db/bonecp.jar | 0 .../usecases/database/lib/db/mysql-driver.jar | 0 .../usecases/database/modules/db.mod | 5 - .../resources/usecases/database/start.ini | 3 - .../usecases/dynamic-loop.0.assert.txt | 2 - .../usecases/dynamic-loop.0.prepare.txt | 2 - .../usecases/dynamic-loop.1.assert.txt | 0 .../usecases/dynamic-loop.1.prepare.txt | 1 - .../usecases/dynamic-loop/modules/branch.mod | 3 - .../usecases/dynamic-loop/modules/dick.mod | 3 - .../dynamic-loop/modules/dynamic/harry.mod | 3 - .../usecases/dynamic-loop/modules/other.mod | 3 - .../usecases/dynamic-loop/modules/root.mod | 3 - .../usecases/dynamic-loop/modules/tom.mod | 3 - .../resources/usecases/dynamic-loop/start.ini | 1 - .../resources/usecases/dynamic.0.assert.txt | 12 - .../resources/usecases/dynamic.0.cmdline.txt | 2 - .../resources/usecases/dynamic.1.assert.txt | 12 - .../resources/usecases/dynamic.1.cmdline.txt | 2 - .../usecases/dynamic/modules/dynamic.mod | 3 - .../dynamic/modules/impl/dynamic-1.7.0_31.mod | 2 - .../dynamic/modules/impl/dynamic-1.8.0_05.mod | 2 - .../test/resources/usecases/dynamic/start.ini | 2 - .../usecases/empty.addToStart.assert.txt | 22 - .../usecases/empty.addToStart.prepare.txt | 1 - .../empty.addToStartCreateStartd.assert.txt | 26 - .../empty.addToStartCreateStartd.prepare.txt | 3 - .../usecases/empty.createStartd.assert.txt | 24 - .../usecases/empty.createStartd.prepare.txt | 2 - .../resources/usecases/empty/unrelated.txt | 0 .../resources/usecases/files.0.assert.txt | 2 - .../resources/usecases/files.0.prepare.txt | 2 - .../resources/usecases/files/modules/demo.mod | 3 - .../files/modules/demo/demo-config.xml | 0 .../test/resources/usecases/loop.assert.txt | 2 - .../test/resources/usecases/loop.prepare.txt | 2 - .../usecases/loop/modules/branch.mod | 3 - .../resources/usecases/loop/modules/dick.mod | 2 - .../resources/usecases/loop/modules/harry.mod | 3 - .../resources/usecases/loop/modules/other.mod | 3 - .../resources/usecases/loop/modules/root.mod | 3 - .../resources/usecases/loop/modules/tom.mod | 3 - .../test/resources/usecases/loop/start.ini | 1 - .../usecases/ordered-provided.0.assert.txt | 7 - .../usecases/ordered-provided.0.prepare.txt | 2 - .../usecases/ordered-provided/etc/implA.xml | 0 .../usecases/ordered-provided/etc/implB.xml | 0 .../ordered-provided/modules/abstractA.mod | 9 - .../ordered-provided/modules/abstractB.mod | 12 - .../modules/dynamic/implA.mod | 6 - .../modules/dynamic/implB.mod | 3 - .../resources/usecases/ordered.0.assert.txt | 3 - .../resources/usecases/ordered.0.cmdline.txt | 2 - .../resources/usecases/ordered.1.assert.txt | 3 - .../resources/usecases/ordered.1.cmdline.txt | 2 - .../resources/usecases/ordered.2.assert.txt | 1 - .../resources/usecases/ordered.2.cmdline.txt | 1 - .../usecases/ordered.default.assert.txt | 12 - .../usecases/ordered.default.cmdline.txt | 2 - .../usecases/ordered/etc/alternateA.xml | 0 .../usecases/ordered/etc/alternateB.xml | 0 .../usecases/ordered/etc/dependent.xml | 0 .../usecases/ordered/modules/alternateA.mod | 5 - .../usecases/ordered/modules/alternateB.mod | 5 - .../usecases/ordered/modules/convenience.mod | 4 - .../usecases/ordered/modules/dependent.mod | 5 - .../usecases/ordered/modules/original.mod | 4 - .../usecases/ordered/modules/replacement.mod | 7 - .../ordered/modules/something-else.mod | 3 - .../parameterized.addToStart.assert.txt | 20 - .../parameterized.addToStart.prepare.txt | 6 - .../parameterized.commands.assert.txt | 20 - .../parameterized.commands.prepare.txt | 4 - .../usecases/parameterized.update.assert.txt | 21 - .../usecases/parameterized.update.prepare.txt | 11 - .../usecases/parameterized/etc/commands.txt | 5 - .../parameterized/modules/parameterized.mod | 13 - .../parameterized/start.d/tobeupdated.ini | 7 - .../transientWithIniTemplate.assert.txt | 14 - .../transientWithIniTemplate.prepare.txt | 1 - .../transientWithIniTemplate/etc/d.xml | 0 .../transientWithIniTemplate/etc/t.xml | 0 .../modules/direct.mod | 8 - .../modules/transient.mod | 5 - .../transientWithIniTemplate/start.ini | 2 - .../transientWithoutIniTemplate.assert.txt | 15 - .../transientWithoutIniTemplate.prepare.txt | 1 - .../transientWithoutIniTemplate/etc/d.xml | 0 .../transientWithoutIniTemplate/etc/t.xml | 0 .../modules/direct.mod | 8 - .../modules/transient.mod | 11 - .../transientWithoutIniTemplate/start.ini | 2 - .../usecases/versioned-modules.assert.txt | 13 - .../versioned-modules/modules/new.mod | 7 - .../versioned-modules/modules/old.mod | 4 - .../usecases/versioned-modules/start.ini | 3 - 176 files changed, 3555 insertions(+), 1502 deletions(-) delete mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java delete mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/TestBadUseCases.java delete mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/TestUseCases.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/AbstractUseCase.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/AgentPropertiesTest.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/AlternatesTest.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesAddToStartTest.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesAddToStartdTest.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesAddUnknownTest.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesAlreadyEnabledTest.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesTest.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BasehomeWithfilesTest.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BasicPropertiesTest.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BasicTest.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/DatabaseTest.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/DynamicDependTest.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/EmptyAddToStartCreateStartdTest.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/EmptyAddToStartTest.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/EmptyCreateStartdTest.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/Files0Test.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/LoopTest.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/OrderedTest.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/ParameterizedTest.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/TransientIniTemplateTest.java create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/usecases/VersionedModulesTest.java delete mode 100644 jetty-start/src/test/resources/assert-home-with-jvm.txt delete mode 100644 jetty-start/src/test/resources/assert-home-with-module.txt delete mode 100644 jetty-start/src/test/resources/assert-home-with-spaces.txt delete mode 100644 jetty-start/src/test/resources/assert-home.txt delete mode 100644 jetty-start/src/test/resources/usecases/agent-properties.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/agent-properties.cmdline.txt delete mode 100644 jetty-start/src/test/resources/usecases/agent-properties/lib/agent-jdk-1.5.jar delete mode 100644 jetty-start/src/test/resources/usecases/agent-properties/lib/agent-jdk-1.6.jar delete mode 100644 jetty-start/src/test/resources/usecases/agent-properties/lib/agent-jdk-1.7.jar delete mode 100644 jetty-start/src/test/resources/usecases/agent-properties/lib/agent-jdk-1.8.jar delete mode 100644 jetty-start/src/test/resources/usecases/agent-properties/modules/agent.mod delete mode 100644 jetty-start/src/test/resources/usecases/agent-properties/start.ini delete mode 100644 jetty-start/src/test/resources/usecases/alternate.0.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/alternate.0.cmdline.txt delete mode 100644 jetty-start/src/test/resources/usecases/alternate.1.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/alternate.1.cmdline.txt delete mode 100644 jetty-start/src/test/resources/usecases/alternate.2.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/alternate.2.cmdline.txt delete mode 100644 jetty-start/src/test/resources/usecases/alternate.3.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/alternate.3.cmdline.txt delete mode 100644 jetty-start/src/test/resources/usecases/alternate.4.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/alternate.4.cmdline.txt delete mode 100644 jetty-start/src/test/resources/usecases/alternate.4.prepare.txt delete mode 100644 jetty-start/src/test/resources/usecases/alternate/etc/d.xml delete mode 100644 jetty-start/src/test/resources/usecases/alternate/etc/ndb.xml delete mode 100644 jetty-start/src/test/resources/usecases/alternate/modules/alternate.mod delete mode 100644 jetty-start/src/test/resources/usecases/alternate/modules/default.mod delete mode 100644 jetty-start/src/test/resources/usecases/alternate/modules/noDftOptionA.mod delete mode 100644 jetty-start/src/test/resources/usecases/alternate/modules/noDftOptionB.mod delete mode 100644 jetty-start/src/test/resources/usecases/alternate/start.ini delete mode 100644 jetty-start/src/test/resources/usecases/barebones.addToStart.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/barebones.addToStart.prepare.txt delete mode 100644 jetty-start/src/test/resources/usecases/barebones.addToStartd.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/barebones.addToStartd.prepare.txt delete mode 100644 jetty-start/src/test/resources/usecases/barebones.addUnknown.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/barebones.addUnknown.prepare.txt delete mode 100644 jetty-start/src/test/resources/usecases/barebones.alreadyEnabled.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/barebones.alreadyEnabled.prepare.txt delete mode 100644 jetty-start/src/test/resources/usecases/barebones.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/barebones/start.ini delete mode 100644 jetty-start/src/test/resources/usecases/basehome.withfiles.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/basehome.withfiles.prepare.txt delete mode 100644 jetty-start/src/test/resources/usecases/basehome/modules/withfiles.mod delete mode 100644 jetty-start/src/test/resources/usecases/basehome/modules/withfiles/four/sub/dir/test.txt delete mode 100644 jetty-start/src/test/resources/usecases/basehome/modules/withfiles/four/test.txt delete mode 100644 jetty-start/src/test/resources/usecases/basehome/modules/withfiles/test.txt delete mode 100644 jetty-start/src/test/resources/usecases/basic-properties.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/basic-properties.cmdline.txt delete mode 100644 jetty-start/src/test/resources/usecases/basic-properties/start.ini delete mode 100644 jetty-start/src/test/resources/usecases/database.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/database/etc/db.xml delete mode 100644 jetty-start/src/test/resources/usecases/database/lib/db/bonecp.jar delete mode 100644 jetty-start/src/test/resources/usecases/database/lib/db/mysql-driver.jar delete mode 100644 jetty-start/src/test/resources/usecases/database/modules/db.mod delete mode 100644 jetty-start/src/test/resources/usecases/database/start.ini delete mode 100644 jetty-start/src/test/resources/usecases/dynamic-loop.0.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/dynamic-loop.0.prepare.txt delete mode 100644 jetty-start/src/test/resources/usecases/dynamic-loop.1.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/dynamic-loop.1.prepare.txt delete mode 100644 jetty-start/src/test/resources/usecases/dynamic-loop/modules/branch.mod delete mode 100644 jetty-start/src/test/resources/usecases/dynamic-loop/modules/dick.mod delete mode 100644 jetty-start/src/test/resources/usecases/dynamic-loop/modules/dynamic/harry.mod delete mode 100644 jetty-start/src/test/resources/usecases/dynamic-loop/modules/other.mod delete mode 100644 jetty-start/src/test/resources/usecases/dynamic-loop/modules/root.mod delete mode 100644 jetty-start/src/test/resources/usecases/dynamic-loop/modules/tom.mod delete mode 100644 jetty-start/src/test/resources/usecases/dynamic-loop/start.ini delete mode 100644 jetty-start/src/test/resources/usecases/dynamic.0.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/dynamic.0.cmdline.txt delete mode 100644 jetty-start/src/test/resources/usecases/dynamic.1.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/dynamic.1.cmdline.txt delete mode 100644 jetty-start/src/test/resources/usecases/dynamic/modules/dynamic.mod delete mode 100644 jetty-start/src/test/resources/usecases/dynamic/modules/impl/dynamic-1.7.0_31.mod delete mode 100644 jetty-start/src/test/resources/usecases/dynamic/modules/impl/dynamic-1.8.0_05.mod delete mode 100644 jetty-start/src/test/resources/usecases/dynamic/start.ini delete mode 100644 jetty-start/src/test/resources/usecases/empty.addToStart.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/empty.addToStart.prepare.txt delete mode 100644 jetty-start/src/test/resources/usecases/empty.addToStartCreateStartd.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/empty.addToStartCreateStartd.prepare.txt delete mode 100644 jetty-start/src/test/resources/usecases/empty.createStartd.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/empty.createStartd.prepare.txt delete mode 100644 jetty-start/src/test/resources/usecases/empty/unrelated.txt delete mode 100644 jetty-start/src/test/resources/usecases/files.0.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/files.0.prepare.txt delete mode 100644 jetty-start/src/test/resources/usecases/files/modules/demo.mod delete mode 100644 jetty-start/src/test/resources/usecases/files/modules/demo/demo-config.xml delete mode 100644 jetty-start/src/test/resources/usecases/loop.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/loop.prepare.txt delete mode 100644 jetty-start/src/test/resources/usecases/loop/modules/branch.mod delete mode 100644 jetty-start/src/test/resources/usecases/loop/modules/dick.mod delete mode 100644 jetty-start/src/test/resources/usecases/loop/modules/harry.mod delete mode 100644 jetty-start/src/test/resources/usecases/loop/modules/other.mod delete mode 100644 jetty-start/src/test/resources/usecases/loop/modules/root.mod delete mode 100644 jetty-start/src/test/resources/usecases/loop/modules/tom.mod delete mode 100644 jetty-start/src/test/resources/usecases/loop/start.ini delete mode 100644 jetty-start/src/test/resources/usecases/ordered-provided.0.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/ordered-provided.0.prepare.txt delete mode 100644 jetty-start/src/test/resources/usecases/ordered-provided/etc/implA.xml delete mode 100644 jetty-start/src/test/resources/usecases/ordered-provided/etc/implB.xml delete mode 100644 jetty-start/src/test/resources/usecases/ordered-provided/modules/abstractA.mod delete mode 100644 jetty-start/src/test/resources/usecases/ordered-provided/modules/abstractB.mod delete mode 100644 jetty-start/src/test/resources/usecases/ordered-provided/modules/dynamic/implA.mod delete mode 100644 jetty-start/src/test/resources/usecases/ordered-provided/modules/dynamic/implB.mod delete mode 100644 jetty-start/src/test/resources/usecases/ordered.0.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/ordered.0.cmdline.txt delete mode 100644 jetty-start/src/test/resources/usecases/ordered.1.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/ordered.1.cmdline.txt delete mode 100644 jetty-start/src/test/resources/usecases/ordered.2.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/ordered.2.cmdline.txt delete mode 100644 jetty-start/src/test/resources/usecases/ordered.default.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/ordered.default.cmdline.txt delete mode 100644 jetty-start/src/test/resources/usecases/ordered/etc/alternateA.xml delete mode 100644 jetty-start/src/test/resources/usecases/ordered/etc/alternateB.xml delete mode 100644 jetty-start/src/test/resources/usecases/ordered/etc/dependent.xml delete mode 100644 jetty-start/src/test/resources/usecases/ordered/modules/alternateA.mod delete mode 100644 jetty-start/src/test/resources/usecases/ordered/modules/alternateB.mod delete mode 100644 jetty-start/src/test/resources/usecases/ordered/modules/convenience.mod delete mode 100644 jetty-start/src/test/resources/usecases/ordered/modules/dependent.mod delete mode 100644 jetty-start/src/test/resources/usecases/ordered/modules/original.mod delete mode 100644 jetty-start/src/test/resources/usecases/ordered/modules/replacement.mod delete mode 100644 jetty-start/src/test/resources/usecases/ordered/modules/something-else.mod delete mode 100644 jetty-start/src/test/resources/usecases/parameterized.addToStart.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/parameterized.addToStart.prepare.txt delete mode 100644 jetty-start/src/test/resources/usecases/parameterized.commands.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/parameterized.commands.prepare.txt delete mode 100644 jetty-start/src/test/resources/usecases/parameterized.update.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/parameterized.update.prepare.txt delete mode 100644 jetty-start/src/test/resources/usecases/parameterized/etc/commands.txt delete mode 100644 jetty-start/src/test/resources/usecases/parameterized/modules/parameterized.mod delete mode 100644 jetty-start/src/test/resources/usecases/parameterized/start.d/tobeupdated.ini delete mode 100644 jetty-start/src/test/resources/usecases/transientWithIniTemplate.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/transientWithIniTemplate.prepare.txt delete mode 100644 jetty-start/src/test/resources/usecases/transientWithIniTemplate/etc/d.xml delete mode 100644 jetty-start/src/test/resources/usecases/transientWithIniTemplate/etc/t.xml delete mode 100644 jetty-start/src/test/resources/usecases/transientWithIniTemplate/modules/direct.mod delete mode 100644 jetty-start/src/test/resources/usecases/transientWithIniTemplate/modules/transient.mod delete mode 100644 jetty-start/src/test/resources/usecases/transientWithIniTemplate/start.ini delete mode 100644 jetty-start/src/test/resources/usecases/transientWithoutIniTemplate.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/transientWithoutIniTemplate.prepare.txt delete mode 100644 jetty-start/src/test/resources/usecases/transientWithoutIniTemplate/etc/d.xml delete mode 100644 jetty-start/src/test/resources/usecases/transientWithoutIniTemplate/etc/t.xml delete mode 100644 jetty-start/src/test/resources/usecases/transientWithoutIniTemplate/modules/direct.mod delete mode 100644 jetty-start/src/test/resources/usecases/transientWithoutIniTemplate/modules/transient.mod delete mode 100644 jetty-start/src/test/resources/usecases/transientWithoutIniTemplate/start.ini delete mode 100644 jetty-start/src/test/resources/usecases/versioned-modules.assert.txt delete mode 100644 jetty-start/src/test/resources/usecases/versioned-modules/modules/new.mod delete mode 100644 jetty-start/src/test/resources/usecases/versioned-modules/modules/old.mod delete mode 100644 jetty-start/src/test/resources/usecases/versioned-modules/start.ini diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java b/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java deleted file mode 100644 index 25cad5adeb2..00000000000 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java +++ /dev/null @@ -1,272 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.start; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.eclipse.jetty.start.Props.Prop; -import org.eclipse.jetty.toolchain.test.MavenTestingUtils; -import org.eclipse.jetty.toolchain.test.PathAssert; -import org.hamcrest.Matchers; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.Matchers.greaterThanOrEqualTo; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - -public class ConfigurationAssert -{ - /** - * Given a provided StartArgs, assert that the configuration it has determined is valid based on values in a assert text file. - * - * @param baseHome the BaseHome used. Access it via {@link Main#getBaseHome()} - * @param args the StartArgs that has been processed via {@link Main#processCommandLine(String[])} - * @param filename the filename of the assertion values - * @throws FileNotFoundException if unable to find the configuration - * @throws IOException if unable to process the configuration - */ - public static void assertConfiguration(BaseHome baseHome, StartArgs args, String filename) throws FileNotFoundException, IOException - { - assertConfiguration(baseHome, args, null, MavenTestingUtils.getTestResourceFile(filename)); - } - - /** - * Given a provided StartArgs, assert that the configuration it has determined is valid based on values in a assert text file. - * - * @param baseHome the BaseHome used. Access it via {@link Main#getBaseHome()} - * @param args the StartArgs that has been processed via {@link Main#processCommandLine(String[])} - * @param output the captured output that you want to assert against - * @param filename the filename of the assertion values - * @throws FileNotFoundException if unable to find the configuration - * @throws IOException if unable to process the configuration - */ - public static void assertConfiguration(BaseHome baseHome, StartArgs args, String output, String filename) throws FileNotFoundException, IOException - { - assertConfiguration(baseHome, args, output, MavenTestingUtils.getTestResourceFile(filename)); - } - - /** - * Given a provided StartArgs, assert that the configuration it has determined is valid based on values in a assert text file. - * - * @param baseHome the BaseHome used. Access it via {@link Main#getBaseHome()} - * @param args the StartArgs that has been processed via {@link Main#processCommandLine(String[])} - * @param file the file of the assertion values - * @throws FileNotFoundException if unable to find the configuration - * @throws IOException if unable to process the configuration - */ - public static void assertConfiguration(BaseHome baseHome, StartArgs args, String output, File file) throws FileNotFoundException, IOException - { - if (output != null) - { - System.err.println(output); - } - Path testResourcesDir = MavenTestingUtils.getTestResourcesDir().toPath().toRealPath(); - TextFile textFile = new TextFile(file.toPath()); - - // Validate XMLs (order is important) - List expectedXmls = new ArrayList<>(); - for (String line : textFile) - { - if (line.startsWith("XML|")) - { - expectedXmls.add(FS.separators(getValue(line))); - } - } - List actualXmls = new ArrayList<>(); - for (Path xml : args.getXmlFiles()) - { - actualXmls.add(shorten(baseHome, xml, testResourcesDir)); - } - assertOrdered("XML Resolution Order", expectedXmls, actualXmls); - - // Validate LIBs (order is not important) - List expectedLibs = new ArrayList<>(); - for (String line : textFile) - { - if (line.startsWith("LIB|")) - { - expectedLibs.add(FS.separators(getValue(line))); - } - } - List actualLibs = new ArrayList<>(); - for (File path : args.getClasspath()) - { - actualLibs.add(shorten(baseHome, path.toPath(), testResourcesDir)); - } - assertContainsUnordered("Libs", expectedLibs, actualLibs); - - // Validate PROPERTIES (order is not important) - Set expectedProperties = new HashSet<>(); - for (String line : textFile) - { - if (line.startsWith("PROP|") || line.startsWith("SYS|")) - { - expectedProperties.add(getValue(line)); - } - } - List actualProperties = new ArrayList<>(); - for (Prop prop : args.getProperties()) - { - String name = prop.key; - if ("jetty.home".equals(name) || - "jetty.base".equals(name) || - "jetty.home.uri".equals(name) || - "jetty.base.uri".equals(name) || - "user.dir".equals(name) || - prop.source.equals(Props.ORIGIN_SYSPROP) || - name.startsWith("runtime.feature.") || - name.startsWith("java.")) - { - // strip these out from assertion, to make assertions easier. - continue; - } - actualProperties.add(prop.key + "=" + args.getProperties().expand(prop.value)); - } - assertContainsUnordered("Properties", expectedProperties, actualProperties); - - // Validate PROPERTIES (order is not important) - for (String line : textFile) - { - if (line.startsWith("SYS|")) - { - String[] expected = getValue(line).split("=", 2); - String actual = System.getProperty(expected[0]); - assertThat("System property " + expected[0], actual, Matchers.equalTo(expected[1])); - } - } - - // Validate Downloads - List expectedDownloads = new ArrayList<>(); - for (String line : textFile) - { - if (line.startsWith("DOWNLOAD|")) - { - expectedDownloads.add(getValue(line)); - } - } - List actualDownloads = new ArrayList<>(); - for (FileArg darg : args.getFiles()) - { - if (darg.uri != null) - { - actualDownloads.add(String.format("%s|%s", darg.uri, darg.location)); - } - } - assertContainsUnordered("Downloads", expectedDownloads, actualDownloads); - - // File / Path Existence Checks - streamOf(textFile, "EXISTS").forEach(f -> - { - Path path = baseHome.getPath(f); - if (f.endsWith("/")) - { - PathAssert.assertDirExists("Required Directory", path); - } - else - { - PathAssert.assertFileExists("Required File", path); - } - }); - - // Output Validation - streamOf(textFile, "OUTPUT").forEach(regex -> - { - Pattern pat = Pattern.compile(regex); - Matcher mat = pat.matcher(output); - assertTrue(mat.find(), "Output [\n" + output + "]\nContains Regex Match: " + pat.pattern()); - }); - } - - private static String shorten(BaseHome baseHome, Path path, Path testResourcesDir) - { - String value = baseHome.toShortForm(path); - if (value.startsWith("${")) - { - return value; - } - - if (path.startsWith(testResourcesDir)) - { - int len = testResourcesDir.toString().length(); - value = "${maven-test-resources}" + value.substring(len); - } - return value; - } - - public static void assertContainsUnordered(String msg, Collection expectedSet, Collection actualSet) - { - try - { - assertEquals(expectedSet.size(), actualSet.size(), msg); - if (!expectedSet.isEmpty()) - assertThat(msg, actualSet, Matchers.containsInAnyOrder(expectedSet.toArray())); - } - catch (AssertionError e) - { - System.err.println("Expected: " + expectedSet.stream().sorted().collect(Collectors.toList())); - System.err.println("Actual : " + actualSet.stream().sorted().collect(Collectors.toList())); - throw e; - } - } - - @SuppressWarnings("Duplicates") - public static void assertOrdered(String msg, List expectedList, List actualList) - { - try - { - assertEquals(expectedList.size(), actualList.size(), msg); - if (!expectedList.isEmpty()) - assertThat(msg, actualList, Matchers.contains(expectedList.toArray())); - } - catch (AssertionError e) - { - System.err.println("Expected: " + expectedList); - System.err.println("Actual : " + actualList); - throw e; - } - } - - private static Stream streamOf(TextFile textFile, String key) - { - return textFile.stream() - .filter(s -> s.startsWith(key + "|")).map(f -> getValue(f)); - } - - private static String getValue(String arg) - { - int idx = arg.indexOf('|'); - assertThat("Expecting '|' sign in [" + arg + "]", idx, greaterThanOrEqualTo(0)); - String value = arg.substring(idx + 1).trim(); - assertThat("Expecting Value after '|' in [" + arg + "]", value.length(), greaterThan(0)); - return value; - } -} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/IncludeJettyDirTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/IncludeJettyDirTest.java index 66287115c77..6b285635e8b 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/IncludeJettyDirTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/IncludeJettyDirTest.java @@ -34,6 +34,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; @@ -58,7 +59,7 @@ public class IncludeJettyDirTest actualOrder.add(source.getId()); } } - ConfigurationAssert.assertOrdered("Search Order", expectedSearchOrder, actualOrder); + assertThat("Search Order", actualOrder, contains(expectedSearchOrder.toArray())); } public void assertProperty(String key, String expectedValue) diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java index a52769b0a79..5cf95bbded4 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java @@ -19,12 +19,10 @@ package org.eclipse.jetty.start; import java.io.File; -import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.List; -import org.eclipse.jetty.toolchain.test.IO; import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; @@ -33,8 +31,6 @@ import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.not; -import static org.hamcrest.Matchers.startsWith; import static org.junit.jupiter.api.Assertions.assertEquals; public class MainTest @@ -46,42 +42,6 @@ public class MainTest System.setProperty("jetty.base", ""); } - @Test - public void testBasicProcessing() throws Exception - { - List cmdLineArgs = new ArrayList<>(); - Path testJettyHome = MavenTestingUtils.getTestResourceDir("dist-home").toPath().toRealPath(); - cmdLineArgs.add("user.dir=" + testJettyHome); - cmdLineArgs.add("jetty.home=" + testJettyHome); - // cmdLineArgs.add("jetty.http.port=9090"); - - Main main = new Main(); - StartArgs args = main.processCommandLine(cmdLineArgs.toArray(new String[0])); - BaseHome baseHome = main.getBaseHome(); - // System.err.println(args); - - ConfigurationAssert.assertConfiguration(baseHome, args, "assert-home.txt"); - - // System.err.println("StartArgs.props:"); - // args.getProperties().forEach(p->System.err.println(p)); - // System.err.println("BaseHome.props:"); - // baseHome.getConfigSources().getProps().forEach(p->System.err.println(p)); - - Props props = args.getProperties(); - - assertThat("Props(jetty.home)", props.getString("jetty.home"), is(baseHome.getHome())); - assertThat("Props(jetty.home)", props.getString("jetty.home"), is(not(startsWith("file:")))); - assertThat("Props(jetty.home.uri)", props.getString("jetty.home.uri") + "/", is(baseHome.getHomePath().toUri().toString())); - assertThat("Props(jetty.base)", props.getString("jetty.base"), is(baseHome.getBase())); - assertThat("Props(jetty.base)", props.getString("jetty.base"), is(not(startsWith("file:")))); - assertThat("Props(jetty.base.uri)", props.getString("jetty.base.uri") + "/", is(baseHome.getBasePath().toUri().toString())); - - assertThat("System.getProperty(jetty.home)", System.getProperty("jetty.home"), is(baseHome.getHome())); - assertThat("System.getProperty(jetty.home)", System.getProperty("jetty.home"), is(not(startsWith("file:")))); - assertThat("System.getProperty(jetty.base)", System.getProperty("jetty.base"), is(baseHome.getBase())); - assertThat("System.getProperty(jetty.base)", System.getProperty("jetty.base"), is(not(startsWith("file:")))); - } - @Test public void testStopProcessing() throws Exception { @@ -125,46 +85,6 @@ public class MainTest main.usage(false); } - @Test - public void testWithCommandLine() throws Exception - { - List cmdLineArgs = new ArrayList<>(); - - Path homePath = MavenTestingUtils.getTestResourceDir("dist-home").toPath().toRealPath(); - cmdLineArgs.add("jetty.home=" + homePath); - cmdLineArgs.add("user.dir=" + homePath); - - // JVM args - cmdLineArgs.add("--exec"); - cmdLineArgs.add("-Xms1024m"); - cmdLineArgs.add("-Xmx1024m"); - - // Arbitrary Libs - Path extraJar = MavenTestingUtils.getTestResourceFile("extra-libs/example.jar").toPath().toRealPath(); - Path extraDir = MavenTestingUtils.getTestResourceDir("extra-resources").toPath().toRealPath(); - - assertThat("Extra Jar exists: " + extraJar, Files.exists(extraJar), is(true)); - assertThat("Extra Dir exists: " + extraDir, Files.exists(extraDir), is(true)); - - String lib = "--lib=" + extraJar + File.pathSeparator + extraDir; - cmdLineArgs.add(lib); - - // Arbitrary XMLs - cmdLineArgs.add("config.xml"); - cmdLineArgs.add("config-foo.xml"); - cmdLineArgs.add("config-bar.xml"); - - Main main = new Main(); - - StartArgs args = main.processCommandLine(cmdLineArgs.toArray(new String[0])); - BaseHome baseHome = main.getBaseHome(); - - assertThat("jetty.home", baseHome.getHome(), is(homePath.toString())); - assertThat("jetty.base", baseHome.getBase(), is(homePath.toString())); - - ConfigurationAssert.assertConfiguration(baseHome, args, "assert-home-with-jvm.txt"); - } - @Test public void testJvmArgExpansion() throws Exception { @@ -195,54 +115,4 @@ public class MainTest ); assertThat(commandLine, containsString(expectedExpansion)); } - - @Test - public void testWithModules() throws Exception - { - List cmdLineArgs = new ArrayList<>(); - - Path homePath = MavenTestingUtils.getTestResourceDir("dist-home").toPath().toRealPath(); - cmdLineArgs.add("jetty.home=" + homePath); - cmdLineArgs.add("user.dir=" + homePath); - cmdLineArgs.add("java.version=1.8.0_31"); - - // Modules - cmdLineArgs.add("--module=optional,extra"); - - Main main = new Main(); - - StartArgs args = main.processCommandLine(cmdLineArgs.toArray(new String[0])); - BaseHome baseHome = main.getBaseHome(); - - assertThat("jetty.home", baseHome.getHome(), is(homePath.toString())); - assertThat("jetty.base", baseHome.getBase(), is(homePath.toString())); - - ConfigurationAssert.assertConfiguration(baseHome, args, "assert-home-with-module.txt"); - } - - @Test - public void testJettyHomeWithSpaces() throws Exception - { - Path distPath = MavenTestingUtils.getTestResourceDir("dist-home").toPath().toRealPath(); - Path homePath = MavenTestingUtils.getTargetTestingPath().resolve("dist home with spaces"); - if (!Files.exists(homePath)) - { - IO.copy(distPath.toFile(), homePath.toFile()); - Files.createFile(homePath.resolve("lib/a library.jar")); - } - - List cmdLineArgs = new ArrayList<>(); - cmdLineArgs.add("user.dir=" + homePath); - cmdLineArgs.add("jetty.home=" + homePath); - cmdLineArgs.add("--lib=lib/a library.jar"); - - Main main = new Main(); - StartArgs args = main.processCommandLine(cmdLineArgs.toArray(new String[0])); - BaseHome baseHome = main.getBaseHome(); - - assertThat("jetty.home", baseHome.getHome(), is(homePath.toString())); - assertThat("jetty.base", baseHome.getBase(), is(homePath.toString())); - - ConfigurationAssert.assertConfiguration(baseHome, args, "assert-home-with-spaces.txt"); - } } diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java index 8b15bb6e9a3..759c3114441 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java @@ -35,6 +35,7 @@ import org.junit.jupiter.api.extension.ExtendWith; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.nullValue; @@ -92,7 +93,7 @@ public class ModulesTest expected.add("main"); expected.add("optional"); - ConfigurationAssert.assertContainsUnordered("All Modules", expected, moduleNames); + assertThat("All Modules", moduleNames, containsInAnyOrder(expected.toArray())); } /** @@ -139,7 +140,7 @@ public class ModulesTest List expected = new ArrayList<>(); expected.add("base"); - ConfigurationAssert.assertContainsUnordered("All Modules", expected, moduleNames); + assertThat("All Modules", moduleNames, containsInAnyOrder(expected.toArray())); } @Test diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/TestBadUseCases.java b/jetty-start/src/test/java/org/eclipse/jetty/start/TestBadUseCases.java deleted file mode 100644 index 28c286e64c9..00000000000 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/TestBadUseCases.java +++ /dev/null @@ -1,87 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.start; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Stream; - -import org.eclipse.jetty.start.util.RebuildTestResources; -import org.eclipse.jetty.toolchain.test.MavenTestingUtils; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsString; -import static org.junit.jupiter.api.Assertions.assertThrows; - -/** - * Test bad configuration scenarios. - */ -public class TestBadUseCases -{ - public static Stream getCases() - { - List ret = new ArrayList<>(); - - ret.add(new Object[]{ - "http2", - "Invalid Java version", - new String[]{"java.version=0.0.0_0"} - }); - - ret.add(new Object[]{ - "versioned-modules-too-new", - "Module [http3] specifies jetty version [10.0] which is newer than this version of jetty [" + RebuildTestResources.JETTY_VERSION + "]", - null - }); - - return ret.stream().map(Arguments::of); - } - - // TODO unsure how this failure should be handled - @Disabled - @ParameterizedTest - @MethodSource("getCases") - public void testBadConfig(String caseName, String expectedErrorMessage, String[] commandLineArgs) throws Exception - { - File homeDir = MavenTestingUtils.getTestResourceDir("dist-home"); - File baseDir = MavenTestingUtils.getTestResourceDir("usecases/" + caseName); - - Main main = new Main(); - List cmdLine = new ArrayList<>(); - cmdLine.add("jetty.home=" + homeDir.getAbsolutePath()); - cmdLine.add("jetty.base=" + baseDir.getAbsolutePath()); - // cmdLine.add("--debug"); - - if (commandLineArgs != null) - { - for (String arg : commandLineArgs) - { - cmdLine.add(arg); - } - } - - UsageException x = assertThrows(UsageException.class, () -> main.processCommandLine(cmdLine)); - assertThat(x.getMessage(), containsString(expectedErrorMessage)); - } -} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/TestUseCases.java b/jetty-start/src/test/java/org/eclipse/jetty/start/TestUseCases.java deleted file mode 100644 index ed6d340bdc4..00000000000 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/TestUseCases.java +++ /dev/null @@ -1,158 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.start; - -import java.io.BufferedReader; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.io.PrintStream; -import java.nio.charset.StandardCharsets; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.stream.Stream; - -import org.eclipse.jetty.toolchain.test.MavenTestingUtils; -import org.hamcrest.Matchers; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; - -import static java.util.stream.Collectors.toList; -import static org.hamcrest.MatcherAssert.assertThat; - -/** - * Various Home + Base use cases - */ -public class TestUseCases -{ - public static Stream getCases() - { - File usecases = MavenTestingUtils.getTestResourceDir("usecases/"); - File[] cases = usecases.listFiles((dir, name) -> name.endsWith(".assert.txt")); - Arrays.sort(cases); - - List ret = new ArrayList<>(); - for (File assertTxt : cases) - { - String caseName = assertTxt.getName().replace(".assert.txt", ""); - ret.add(Arguments.of(caseName)); - } - - return ret.stream(); - } - - @ParameterizedTest - @MethodSource("getCases") - public void testUseCase(String caseName) throws Exception - { - String baseName = caseName.replaceFirst("\\..*$", ""); - File assertFile = MavenTestingUtils.getTestResourceFile("usecases/" + caseName + ".assert.txt"); - - Path homeDir = MavenTestingUtils.getTestResourceDir("dist-home").toPath().toRealPath(); - - Path baseSrcDir = MavenTestingUtils.getTestResourceDir("usecases/" + baseName).toPath().toRealPath(); - Path baseDir = MavenTestingUtils.getTargetTestingPath(caseName); - org.eclipse.jetty.toolchain.test.FS.ensureEmpty(baseDir); - org.eclipse.jetty.toolchain.test.IO.copyDir(baseSrcDir.toFile(), baseDir.toFile()); - - System.setProperty("jetty.home", homeDir.toString()); - System.setProperty("jetty.base", baseDir.toString()); - - ByteArrayOutputStream out = new ByteArrayOutputStream(); - PrintStream originalStream = StartLog.setStream(new PrintStream(out)); - try - { - // If there is a "{caseName}.prepare.txt" then use those - // lines as if you are calling start.jar once to setup - // the base directory. - List prepareArgs = lines(caseName + ".prepare.txt"); - if (!prepareArgs.isEmpty()) - { - Main main = new Main(); - List cmdLine = new ArrayList<>(); - cmdLine.add("--testing-mode"); - cmdLine.addAll(prepareArgs); - - main.start(main.processCommandLine(cmdLine)); - } - - Main main = new Main(); - List cmdLine = new ArrayList<>(); - // cmdLine.add("--debug"); - - // If there is a "{caseName}.cmdline.txt" then these - // entries are extra command line argument to use for - // the actual testcase - cmdLine.addAll(lines(caseName + ".cmdline.txt")); - StartArgs args = main.processCommandLine(cmdLine); - args.getAllModules().checkEnabledModules(); - BaseHome baseHome = main.getBaseHome(); - - StartLog.setStream(originalStream); - String output = out.toString(StandardCharsets.UTF_8.name()); - ConfigurationAssert.assertConfiguration(baseHome, args, output, assertFile); - } - catch (Exception e) - { - List exceptions = lines(assertFile).stream().filter(s -> s.startsWith("EX|")).collect(toList()); - if (exceptions.isEmpty()) - throw e; - for (String ex : exceptions) - { - ex = ex.substring(3); - assertThat(e.toString(), Matchers.containsString(ex)); - } - } - finally - { - StartLog.setStream(originalStream); - } - } - - private List lines(String filename) throws IOException - { - return lines(MavenTestingUtils.getTestResourcesPath().resolve("usecases" + File.separator + filename).toFile()); - } - - private List lines(File file) throws IOException - { - if (!file.exists() || !file.canRead()) - return Collections.emptyList(); - List ret = new ArrayList<>(); - try (FileReader reader = new FileReader(file); - BufferedReader buf = new BufferedReader(reader)) - { - String line; - while ((line = buf.readLine()) != null) - { - line = line.trim(); - if (line.length() > 0) - { - ret.add(line); - } - } - } - return ret; - } -} 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 d7ce6a692c8..2157b44b614 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 @@ -25,7 +25,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.eclipse.jetty.start.ConfigurationAssert; import org.eclipse.jetty.start.Props.Prop; import org.eclipse.jetty.start.TestEnv; import org.eclipse.jetty.start.UsageException; @@ -36,6 +35,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; @@ -54,7 +54,7 @@ public class ConfigSourcesTest actualList.add(source.getId()); } List expectedList = Arrays.asList(expectedOrder); - ConfigurationAssert.assertOrdered("ConfigSources.id order", expectedList, actualList); + assertThat("ConfigSources.id order", actualList, contains(expectedList.toArray())); } private void assertDirOrder(ConfigSources sources, Path... expectedDirOrder) throws IOException @@ -72,7 +72,7 @@ public class ConfigSourcesTest { expectedList.add(path.toRealPath().toString()); } - ConfigurationAssert.assertOrdered("ConfigSources.dir order", expectedList, actualList); + assertThat("ConfigSources.dir order", actualList, contains(expectedList.toArray())); } private void assertProperty(ConfigSources sources, String key, String expectedValue) @@ -124,7 +124,7 @@ public class ConfigSourcesTest FS.ensureEmpty(base); TestEnv.makeFile(base, "start.ini", "jetty.http.host=127.0.0.1", - "--include-jetty-dir=" + common.toString()); + "--include-jetty-dir=" + common); ConfigSources sources = new ConfigSources(); @@ -161,7 +161,7 @@ public class ConfigSourcesTest String[] cmdLine = new String[]{ // property - "my.common=" + common.toString(), + "my.common=" + common, // reference via property "--include-jetty-dir=${my.common}" }; @@ -208,7 +208,7 @@ public class ConfigSourcesTest // Simple command line reference to include-jetty-dir via property (also on command line) String[] cmdLine = new String[]{ // property to 'opt' dir - "my.opt=" + opt.toString(), + "my.opt=" + opt, // reference via property prefix "--include-jetty-dir=" + dirRef }; @@ -256,8 +256,8 @@ public class ConfigSourcesTest String[] cmdLine = new String[]{ // property to 'opt' dir - "my.opt=" + opt.toString(), - // property to commmon dir name + "my.opt=" + opt, + // property to common dir name "my.dir=common", // reference via property prefix "--include-jetty-dir=" + dirRef @@ -293,7 +293,7 @@ public class ConfigSourcesTest FS.ensureEmpty(base); TestEnv.makeFile(base, "start.ini", "jetty.http.host=127.0.0.1", - "--include-jetty-dir=" + common.toString()); + "--include-jetty-dir=" + common); ConfigSources sources = new ConfigSources(); @@ -332,7 +332,7 @@ public class ConfigSourcesTest FS.ensureEmpty(base); TestEnv.makeFile(base, "start.ini", "jetty.http.host=127.0.0.1", - "--include-jetty-dir=" + common.toString(), + "--include-jetty-dir=" + common, "--include-jetty-dir=" + corp.toString()); ConfigSources sources = new ConfigSources(); @@ -371,7 +371,7 @@ public class ConfigSourcesTest Path common = testdir.getPathFile("common"); FS.ensureEmpty(common); TestEnv.makeFile(common, "start.ini", - "--include-jetty-dir=" + corp.toString(), + "--include-jetty-dir=" + corp, "jetty.http.port=8080"); // Create base @@ -379,7 +379,7 @@ public class ConfigSourcesTest FS.ensureEmpty(base); TestEnv.makeFile(base, "start.ini", "jetty.http.host=127.0.0.1", - "--include-jetty-dir=" + common.toString()); + "--include-jetty-dir=" + common); ConfigSources sources = new ConfigSources(); @@ -417,7 +417,7 @@ public class ConfigSourcesTest Path common = testdir.getPathFile("common"); FS.ensureEmpty(common); TestEnv.makeFile(common, "start.ini", - "my.corp=" + corp.toString(), + "my.corp=" + corp, "--include-jetty-dir=${my.corp}", "jetty.http.port=8080"); @@ -426,7 +426,7 @@ public class ConfigSourcesTest FS.ensureEmpty(base); TestEnv.makeFile(base, "start.ini", "jetty.http.host=127.0.0.1", - "my.common=" + common.toString(), + "my.common=" + common, "--include-jetty-dir=${my.common}"); ConfigSources sources = new ConfigSources(); @@ -473,7 +473,7 @@ public class ConfigSourcesTest Path common = testdir.getPathFile("common"); FS.ensureEmpty(common); TestEnv.makeFile(common, "start.ini", - "--include-jetty-dir=" + corp.toString(), + "--include-jetty-dir=" + corp, "jetty.http.port=8080"); // Create base @@ -481,13 +481,13 @@ public class ConfigSourcesTest FS.ensureEmpty(base); TestEnv.makeFile(base, "start.ini", "jetty.http.host=127.0.0.1", - "--include-jetty-dir=" + common.toString()); + "--include-jetty-dir=" + common); ConfigSources sources = new ConfigSources(); String[] cmdLine = new String[]{ // command line provided include-jetty-dir ref - "--include-jetty-dir=" + devops.toString() + "--include-jetty-dir=" + devops }; sources.add(new CommandLineConfigSource(cmdLine)); sources.add(new JettyHomeConfigSource(home)); @@ -524,7 +524,7 @@ public class ConfigSourcesTest Path common = testdir.getPathFile("common"); FS.ensureEmpty(common); TestEnv.makeFile(common, "start.ini", - "--include-jetty-dir=" + corp.toString(), + "--include-jetty-dir=" + corp, "jetty.http.port=8080"); // Create base @@ -532,7 +532,7 @@ public class ConfigSourcesTest FS.ensureEmpty(base); TestEnv.makeFile(base, "start.ini", "jetty.http.host=127.0.0.1", - "--include-jetty-dir=" + common.toString()); + "--include-jetty-dir=" + common); ConfigSources sources = new ConfigSources(); @@ -581,14 +581,14 @@ public class ConfigSourcesTest // standard property "jetty.http.port=8080", // reference to corp - "--include-jetty-dir=" + corp.toString()); + "--include-jetty-dir=" + corp); // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); TestEnv.makeFile(base, "start.ini", "jetty.http.host=127.0.0.1", - "--include-jetty-dir=" + common.toString()); + "--include-jetty-dir=" + common); ConfigSources sources = new ConfigSources(); diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/AbstractUseCase.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/AbstractUseCase.java new file mode 100644 index 00000000000..edc51b559d3 --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/AbstractUseCase.java @@ -0,0 +1,265 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.Spliterator; +import java.util.Spliterators; +import java.util.function.Predicate; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.StreamSupport; + +import org.eclipse.jetty.start.BaseHome; +import org.eclipse.jetty.start.Main; +import org.eclipse.jetty.start.Props; +import org.eclipse.jetty.start.StartArgs; +import org.eclipse.jetty.start.StartLog; +import org.eclipse.jetty.toolchain.test.FS; +import org.eclipse.jetty.toolchain.test.jupiter.WorkDir; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public abstract class AbstractUseCase +{ + public WorkDir workDir; + + protected Path homeDir; + protected Path baseDir; + + @AfterEach + public void clearSystemProperties() + { + System.setProperty("jetty.home", ""); + System.setProperty("jetty.base", ""); + } + + @BeforeEach + public void setupTest() throws IOException + { + Path testdir = workDir.getEmptyPathDir(); + + // Create empty base directory for testcase to use + baseDir = testdir.resolve("test-base"); + FS.ensureDirExists(baseDir); + + // Create baseline jetty-home directory + homeDir = testdir.resolve("dist-home"); + FS.ensureDirExists(homeDir); + } + + protected void setupStandardHomeDir() throws IOException + { + Path etc = homeDir.resolve("etc"); + FS.ensureDirExists(etc); + FS.touch(etc.resolve("base.xml")); + FS.touch(etc.resolve("config.xml")); + FS.touch(etc.resolve("config-bar.xml")); + FS.touch(etc.resolve("config-foo.xml")); + FS.touch(etc.resolve("extra.xml")); + FS.touch(etc.resolve("main.xml")); + FS.touch(etc.resolve("optional.xml")); + + Path lib = homeDir.resolve("lib"); + FS.ensureDirExists(lib); + FS.touch(lib.resolve("base.jar")); + FS.touch(lib.resolve("main.jar")); + FS.touch(lib.resolve("optional.jar")); + FS.touch(lib.resolve("other.jar")); + Path libExtra = lib.resolve("extra"); + FS.ensureDirExists(libExtra); + FS.touch(libExtra.resolve("extra0.jar")); + FS.touch(libExtra.resolve("extra1.jar")); + + Path modules = homeDir.resolve("modules"); + FS.ensureDirExists(modules); + + Files.write(modules.resolve("base.mod"), + Arrays.asList( + "[optional]", + "optional", + "[lib]", + "lib/base.jar", + "[xml]", + "etc/base.xml"), + StandardCharsets.UTF_8); + Files.write(modules.resolve("extra.mod"), + Arrays.asList( + "[depend]", + "main", + "[lib]", + "lib/extra/*.jar", + "[xml]", + "etc/extra.xml", + "[ini]", + "extra.prop=value0"), + StandardCharsets.UTF_8); + Files.write(modules.resolve("main.mod"), + Arrays.asList( + "[depend]", + "base", + "[optional]", + "optional", + "[lib]", + "lib/main.jar", + "lib/other.jar", + "[xml]", + "etc/main.xml", + "[files]", + "maindir/", + "[ini]", + "main.prop=value0", + "[ini-template]", + "main.prop=valueT"), + StandardCharsets.UTF_8); + Files.write(modules.resolve("optional.mod"), + Arrays.asList( + "[lib]", + "lib/optional.jar", + "[xml]", + "etc/optional.xml", + "[ini]", + "optional.prop=value0"), + StandardCharsets.UTF_8); + } + + public static class ExecResults + { + public Exception exception; + public BaseHome baseHome; + public StartArgs startArgs; + public String output; + + public List getXmls() + { + return startArgs.getXmlFiles().stream() + .map(p -> baseHome.toShortForm(p)) + .collect(Collectors.toList()); + } + + public List getLibs() + { + return StreamSupport.stream( + Spliterators.spliteratorUnknownSize(startArgs.getClasspath().iterator(), Spliterator.ORDERED), false) + .map(f -> baseHome.toShortForm(f)) + .collect(Collectors.toList()); + } + + public List getProperties() + { + Props props = startArgs.getProperties(); + + Predicate propPredicate = (p) -> + { + String name = p.key; + return !("jetty.home".equals(name) || + "jetty.base".equals(name) || + "jetty.home.uri".equals(name) || + "jetty.base.uri".equals(name) || + "user.dir".equals(name) || + p.source.equals(Props.ORIGIN_SYSPROP) || + name.startsWith("runtime.feature.") || + name.startsWith("java.")); + }; + + return StreamSupport.stream( + Spliterators.spliteratorUnknownSize(props.iterator(), Spliterator.ORDERED), false) + .filter(propPredicate) + .map((prop) -> prop.key + "=" + props.expand(prop.value)) + .collect(Collectors.toList()); + } + + public List getDownloads() + { + return startArgs.getFiles().stream() + .filter(Objects::nonNull) + .filter(farg -> farg.uri != null) + .map(farg -> String.format("%s|%s", farg.uri, farg.location)) + .collect(Collectors.toList()); + } + } + + protected ExecResults exec(List cmdline, boolean start) + { + List execArgs = new ArrayList<>(); + + if (cmdline.stream().noneMatch((line -> line.startsWith("jetty.home=")))) + { + execArgs.add("jetty.home=" + homeDir.toString()); + } + + if (cmdline.stream().noneMatch((line -> line.startsWith("jetty.base=")))) + { + execArgs.add("jetty.base=" + baseDir.toString()); + } + execArgs.add("--testing-mode"); + // execArgs.add("--debug"); + execArgs.addAll(cmdline); + + ExecResults execResults = new ExecResults(); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PrintStream originalStream = StartLog.setStream(new PrintStream(out)); + try + { + Main main = new Main(); + + execResults.startArgs = main.processCommandLine(execArgs); + if (start) + { + main.start(execResults.startArgs); + } + else + { + execResults.startArgs.getAllModules().checkEnabledModules(); + } + execResults.baseHome = main.getBaseHome(); + + StartLog.setStream(originalStream); + execResults.output = out.toString(StandardCharsets.UTF_8.name()); + } + catch (Exception e) + { + execResults.exception = e; + } + finally + { + StartLog.setStream(originalStream); + } + return execResults; + } + + public static void assertOutputContainsRegex(String output, String regexPattern) + { + Pattern pat = Pattern.compile(regexPattern); + Matcher mat = pat.matcher(output); + assertTrue(mat.find(), "Output [\n" + output + "]\nContains Regex Match: " + pat.pattern()); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/AgentPropertiesTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/AgentPropertiesTest.java new file mode 100644 index 00000000000..976e9c783a5 --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/AgentPropertiesTest.java @@ -0,0 +1,93 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.jetty.toolchain.test.FS; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; + +public class AgentPropertiesTest extends AbstractUseCase +{ + @Test + public void testAgentPropertiesTest() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("lib")); + FS.ensureDirExists(baseDir.resolve("modules")); + FS.touch(baseDir.resolve("lib/agent-jdk-1.5.jar")); + FS.touch(baseDir.resolve("lib/agent-jdk-1.6.jar")); + FS.touch(baseDir.resolve("lib/agent-jdk-1.7.jar")); + FS.touch(baseDir.resolve("lib/agent-jdk-1.8.jar")); + Files.write(baseDir.resolve("modules/agent.mod"), + Arrays.asList( + "[depend]", + "main", + "[lib]", + "lib/agent-jdk-${java.vm.specification.version}.jar" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("start.ini"), + Collections.singletonList( + "--module=main,agent" + ), + StandardCharsets.UTF_8); + + // === Execute Main + List runArgs = Collections.singletonList( + "java.vm.specification.version=1.7" + ); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar", + "${jetty.base}/lib/agent-jdk-1.7.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/AlternatesTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/AlternatesTest.java new file mode 100644 index 00000000000..6d6f8ff594f --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/AlternatesTest.java @@ -0,0 +1,452 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.jetty.toolchain.test.FS; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.containsString; + +public class AlternatesTest extends AbstractUseCase +{ + @Test + public void testAlternate0Test() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("etc")); + FS.ensureDirExists(baseDir.resolve("modules")); + FS.touch(baseDir.resolve("etc/d.xml")); + FS.touch(baseDir.resolve("etc/ndb.xml")); + Files.write(baseDir.resolve("modules/alternate.mod"), + Arrays.asList( + "[provides]", + "default", + "[ini]", + "default.option=alternate" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/default.mod"), + Arrays.asList( + "[xml]", + "etc/d.xml", + "[ini]", + "default.option=default" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/noDftOptionA.mod"), + Arrays.asList( + "[provides]", + "noDft", + "[optional]", + "default", + "[ini]", + "noDft.option=A" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/noDftOptionB.mod"), + Arrays.asList( + "[provides]", + "noDft", + "[depend]", + "default", + "[xml]", + "etc/ndb.xml", + "[ini]", + "noDft.option=B" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("start.ini"), + Collections.singletonList( + "--module=main" + ), + StandardCharsets.UTF_8); + + // === Execute Main + List runArgs = Collections.singletonList( + "--module=noDftOptionA" + ); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("noDft.option=A"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + } + + @Test + public void testAlternate1Test() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("etc")); + FS.ensureDirExists(baseDir.resolve("modules")); + FS.touch(baseDir.resolve("etc/d.xml")); + FS.touch(baseDir.resolve("etc/ndb.xml")); + Files.write(baseDir.resolve("modules/alternate.mod"), + Arrays.asList( + "[provides]", + "default", + "[ini]", + "default.option=alternate" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/default.mod"), + Arrays.asList( + "[xml]", + "etc/d.xml", + "[ini]", + "default.option=default" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/noDftOptionA.mod"), + Arrays.asList( + "[provides]", + "noDft", + "[optional]", + "default", + "[ini]", + "noDft.option=A" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/noDftOptionB.mod"), + Arrays.asList( + "[provides]", + "noDft", + "[depend]", + "default", + "[xml]", + "etc/ndb.xml", + "[ini]", + "noDft.option=B" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("start.ini"), + Collections.singletonList( + "--module=main" + ), + StandardCharsets.UTF_8); + + // === Execute Main + List runArgs = Collections.singletonList( + "--module=noDftOptionB" + ); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml", + "${jetty.base}/etc/d.xml", + "${jetty.base}/etc/ndb.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("default.option=default"); + expectedProperties.add("noDft.option=B"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + } + + @Test + public void testAlternate2Test() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("etc")); + FS.ensureDirExists(baseDir.resolve("modules")); + FS.touch(baseDir.resolve("etc/d.xml")); + FS.touch(baseDir.resolve("etc/ndb.xml")); + Files.write(baseDir.resolve("modules/alternate.mod"), + Arrays.asList( + "[provides]", + "default", + "[ini]", + "default.option=alternate" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/default.mod"), + Arrays.asList( + "[xml]", + "etc/d.xml", + "[ini]", + "default.option=default" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/noDftOptionA.mod"), + Arrays.asList( + "[provides]", + "noDft", + "[optional]", + "default", + "[ini]", + "noDft.option=A" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/noDftOptionB.mod"), + Arrays.asList( + "[provides]", + "noDft", + "[depend]", + "default", + "[xml]", + "etc/ndb.xml", + "[ini]", + "noDft.option=B" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("start.ini"), + Collections.singletonList( + "--module=main" + ), + StandardCharsets.UTF_8); + + // === Execute Main + List runArgs = Collections.singletonList( + "--module=alternate,noDftOptionB" + ); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml", + "${jetty.base}/etc/ndb.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("default.option=alternate"); + expectedProperties.add("noDft.option=B"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + } + + @Test + public void testAlternate3Test() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("etc")); + FS.ensureDirExists(baseDir.resolve("modules")); + FS.touch(baseDir.resolve("etc/d.xml")); + FS.touch(baseDir.resolve("etc/ndb.xml")); + Files.write(baseDir.resolve("modules/alternate.mod"), + Arrays.asList( + "[provides]", + "default", + "[ini]", + "default.option=alternate" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/default.mod"), + Arrays.asList( + "[xml]", + "etc/d.xml", + "[ini]", + "default.option=default" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/noDftOptionA.mod"), + Arrays.asList( + "[provides]", + "noDft", + "[optional]", + "default", + "[ini]", + "noDft.option=A" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/noDftOptionB.mod"), + Arrays.asList( + "[provides]", + "noDft", + "[depend]", + "default", + "[xml]", + "etc/ndb.xml", + "[ini]", + "noDft.option=B" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("start.ini"), + Collections.singletonList( + "--module=main" + ), + StandardCharsets.UTF_8); + + // === Execute Main + List runArgs = Collections.singletonList( + "--module=alternate,default" + ); + ExecResults results = exec(runArgs, false); + + // === Check Exceptions + assertThat(results.exception.toString(), containsString("UsageException")); + assertThat(results.exception.toString(), containsString("default, which is already provided by alternate")); + } + + @Test + public void testAlternate4Test() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("etc")); + FS.ensureDirExists(baseDir.resolve("modules")); + FS.touch(baseDir.resolve("etc/d.xml")); + FS.touch(baseDir.resolve("etc/ndb.xml")); + Files.write(baseDir.resolve("modules/alternate.mod"), + Arrays.asList( + "[provides]", + "default", + "[ini]", + "default.option=alternate" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/default.mod"), + Arrays.asList( + "[xml]", + "etc/d.xml", + "[ini]", + "default.option=default" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/noDftOptionA.mod"), + Arrays.asList( + "[provides]", + "noDft", + "[optional]", + "default", + "[ini]", + "noDft.option=A" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/noDftOptionB.mod"), + Arrays.asList( + "[provides]", + "noDft", + "[depend]", + "default", + "[xml]", + "etc/ndb.xml", + "[ini]", + "noDft.option=B" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("start.ini"), + Collections.singletonList( + "--module=main" + ), + StandardCharsets.UTF_8); + + // === Prepare Jetty Base using Main + List prepareArgs = Arrays.asList( + "--testing-mode", + "--add-to-start=noDftOptionB" + ); + exec(prepareArgs, true); + + // === Execute Main + List runArgs = Collections.singletonList( + "--module=alternate" + ); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml", + "${jetty.base}/etc/ndb.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("default.option=alternate"); + expectedProperties.add("noDft.option=B"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesAddToStartTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesAddToStartTest.java new file mode 100644 index 00000000000..7d72460e406 --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesAddToStartTest.java @@ -0,0 +1,90 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.jetty.toolchain.test.PathAssert; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; + +public class BarebonesAddToStartTest extends AbstractUseCase +{ + @Test + public void testBarebonesAddToStartTest() throws Exception + { + setupStandardHomeDir(); + + Files.write(baseDir.resolve("start.ini"), + Collections.singletonList( + "--module=main" + ), + StandardCharsets.UTF_8); + + // === Prepare Jetty Base using Main + List prepareArgs = Arrays.asList( + "--testing-mode", + "--add-to-start=optional" + ); + exec(prepareArgs, true); + + // === Execute Main + List runArgs = Collections.emptyList(); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/optional.xml", + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar", + "${jetty.home}/lib/optional.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("optional.prop=value0"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + + // === Validate Specific Jetty Base Files/Dirs Exist + PathAssert.assertDirExists("Required Directory: maindir/", results.baseHome.getPath("maindir/")); + PathAssert.assertFileExists("Required File: start.ini", results.baseHome.getPath("start.ini")); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesAddToStartdTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesAddToStartdTest.java new file mode 100644 index 00000000000..17c3c623ee1 --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesAddToStartdTest.java @@ -0,0 +1,92 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.jetty.toolchain.test.PathAssert; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; + +public class BarebonesAddToStartdTest extends AbstractUseCase +{ + @Test + public void testBarebonesAddToStartdTest() throws Exception + { + setupStandardHomeDir(); + + Files.write(baseDir.resolve("start.ini"), + Collections.singletonList( + "--module=main" + ), + StandardCharsets.UTF_8); + + // === Prepare Jetty Base using Main + List prepareArgs = Arrays.asList( + "--testing-mode", + "--create-startd", + "--add-to-start=optional" + ); + exec(prepareArgs, true); + + // === Execute Main + List runArgs = Collections.emptyList(); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/optional.xml", + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar", + "${jetty.home}/lib/optional.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("optional.prop=value0"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + + // === Validate Specific Jetty Base Files/Dirs Exist + PathAssert.assertDirExists("Required Directory: maindir/", results.baseHome.getPath("maindir/")); + PathAssert.assertFileExists("Required File: start.d/start.ini", results.baseHome.getPath("start.d/start.ini")); + PathAssert.assertFileExists("Required File: start.d/optional.ini", results.baseHome.getPath("start.d/optional.ini")); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesAddUnknownTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesAddUnknownTest.java new file mode 100644 index 00000000000..760bd1d6317 --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesAddUnknownTest.java @@ -0,0 +1,56 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsString; + +public class BarebonesAddUnknownTest extends AbstractUseCase +{ + @Test + public void testBarebonesAddUnknownTest() throws Exception + { + setupStandardHomeDir(); + + Files.write(baseDir.resolve("start.ini"), + Collections.singletonList( + "--module=main" + ), + StandardCharsets.UTF_8); + + // === Prepare Jetty Base using Main + List prepareArgs = Arrays.asList( + "--testing-mode", + "--create-startd", + "--add-to-start=unknown" + ); + ExecResults prepareResults = exec(prepareArgs, true); + + // === Check Exceptions + assertThat(prepareResults.exception.toString(), containsString("UsageException")); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesAlreadyEnabledTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesAlreadyEnabledTest.java new file mode 100644 index 00000000000..31a4c3fd4fb --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesAlreadyEnabledTest.java @@ -0,0 +1,90 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.jetty.toolchain.test.PathAssert; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; + +public class BarebonesAlreadyEnabledTest extends AbstractUseCase +{ + @Test + public void testBarebonesAlreadyEnabledTest() throws Exception + { + setupStandardHomeDir(); + + Files.write(baseDir.resolve("start.ini"), + Collections.singletonList( + "--module=main" + ), + StandardCharsets.UTF_8); + + // === Prepare Jetty Base using Main + List prepareArgs = Arrays.asList( + "--testing-mode", + "--add-to-start=main" + ); + ExecResults prepareResults = exec(prepareArgs, true); + + // === Execute Main + List runArgs = Collections.emptyList(); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + + // === Validate Specific Jetty Base Files/Dirs Exist + PathAssert.assertDirExists("Required Directory: maindir/", results.baseHome.getPath("maindir/")); + PathAssert.assertFileExists("Required File: start.ini", results.baseHome.getPath("start.ini")); + + // === Validate Specific Lines Exist in Output + assertOutputContainsRegex(prepareResults.output, "INFO : main already enabled by \\[\\$\\{jetty.base}[\\\\/]start.ini\\]"); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesTest.java new file mode 100644 index 00000000000..8684b60fd6f --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BarebonesTest.java @@ -0,0 +1,75 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; + +public class BarebonesTest extends AbstractUseCase +{ + @Test + public void testBarebonesTest() throws Exception + { + setupStandardHomeDir(); + + Files.write(baseDir.resolve("start.ini"), + Arrays.asList( + "--module=main" + ), + StandardCharsets.UTF_8); + + // === Execute Main + List runArgs = Collections.emptyList(); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BasehomeWithfilesTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BasehomeWithfilesTest.java new file mode 100644 index 00000000000..e525d7eacdc --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BasehomeWithfilesTest.java @@ -0,0 +1,97 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.jetty.toolchain.test.FS; +import org.eclipse.jetty.toolchain.test.PathAssert; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsInAnyOrder; + +public class BasehomeWithfilesTest extends AbstractUseCase +{ + @Test + public void testBasehomeWithfilesTest() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("modules")); + FS.ensureDirExists(baseDir.resolve("modules/withfiles")); + FS.ensureDirExists(baseDir.resolve("modules/withfiles/four")); + FS.ensureDirExists(baseDir.resolve("modules/withfiles/four/sub")); + FS.ensureDirExists(baseDir.resolve("modules/withfiles/four/sub/dir")); + + Files.write(baseDir.resolve("modules/withfiles.mod"), + Arrays.asList( + "[files]", + "basehome:modules/withfiles/test.txt|one/renamed.txt", + "basehome:modules/withfiles/test.txt|two/", + "three/", + "basehome:modules/withfiles/test.txt|three", + "basehome:modules/withfiles", + "basehome:modules/withfiles/four/|five/", + "six/", + "basehome:modules/withfiles/four/sub|six" + ), + StandardCharsets.UTF_8); + FS.touch(baseDir.resolve("modules/withfiles/four/sub/dir/test.txt")); + FS.touch(baseDir.resolve("modules/withfiles/four/test.txt")); + FS.touch(baseDir.resolve("modules/withfiles/test.txt")); + + // === Prepare Jetty Base using Main + List prepareArgs = Arrays.asList( + "--testing-mode", + "--create-startd", + "--add-to-start=withfiles" + ); + exec(prepareArgs, true); + + // === Execute Main + List runArgs = Collections.emptyList(); + ExecResults results = exec(runArgs, false); + + // === Validate Downloaded Files + List expectedDownloads = Arrays.asList( + "basehome:modules/withfiles/test.txt|one/renamed.txt", + "basehome:modules/withfiles/test.txt|two/", + "basehome:modules/withfiles/test.txt|three", + "basehome:modules/withfiles|null", + "basehome:modules/withfiles/four/|five/", + "basehome:modules/withfiles/four/sub|six" + ); + List actualDownloads = results.getDownloads(); + assertThat("Downloads", actualDownloads, containsInAnyOrder(expectedDownloads.toArray())); + + // === Validate Specific Jetty Base Files/Dirs Exist + PathAssert.assertFileExists("Required File: test.txt", results.baseHome.getPath("test.txt")); + PathAssert.assertFileExists("Required File: one/renamed.txt", results.baseHome.getPath("one/renamed.txt")); + PathAssert.assertFileExists("Required File: two/test.txt", results.baseHome.getPath("two/test.txt")); + PathAssert.assertFileExists("Required File: three/test.txt", results.baseHome.getPath("three/test.txt")); + PathAssert.assertFileExists("Required File: four/sub/dir/test.txt", results.baseHome.getPath("four/sub/dir/test.txt")); + PathAssert.assertFileExists("Required File: five/sub/dir/test.txt", results.baseHome.getPath("five/sub/dir/test.txt")); + PathAssert.assertFileExists("Required File: six/sub/dir/test.txt", results.baseHome.getPath("six/sub/dir/test.txt")); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BasicPropertiesTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BasicPropertiesTest.java new file mode 100644 index 00000000000..3066714dec6 --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BasicPropertiesTest.java @@ -0,0 +1,108 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.equalTo; + +public class BasicPropertiesTest extends AbstractUseCase +{ + @Test + public void testBasicPropertiesTest() throws Exception + { + setupStandardHomeDir(); + + Files.write(baseDir.resolve("start.ini"), + Arrays.asList( + "--module=main", + "jetty.http.port=${port}" + ), + StandardCharsets.UTF_8); + + // === Execute Main + List runArgs = Arrays.asList( + "other=value", + "port=9090", + "add+=beginning", + "add+=middle", + "add+=end", + "list+=,one", + "list+=,two", + "list+=,three", + "name?=value", + "name?=enoughAlready", + "name0=/", + "name1=${name0}foo", + "name2=${name1}/bar", + "-DSYSTEM=${name}", + "-DSYSTEM?=IGNORED", + "-DPRESET?=${SYSTEM}" + ); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("port=9090"); + expectedProperties.add("other=value"); + expectedProperties.add("jetty.http.port=9090"); + expectedProperties.add("add=beginningmiddleend"); + expectedProperties.add("list=one,two,three"); + expectedProperties.add("name=value"); + expectedProperties.add("name0=/"); + expectedProperties.add("name1=/foo"); + expectedProperties.add("name2=/foo/bar"); + expectedProperties.add("SYSTEM=value"); + expectedProperties.add("PRESET=value"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + + // === Validate System Properties + assertThat("System Property [SYSTEM]", System.getProperty("SYSTEM"), equalTo("value")); + assertThat("System Property [PRESET]", System.getProperty("PRESET"), equalTo("value")); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BasicTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BasicTest.java new file mode 100644 index 00000000000..c23b1501d8d --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/BasicTest.java @@ -0,0 +1,300 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.jetty.start.Props; +import org.eclipse.jetty.toolchain.test.FS; +import org.eclipse.jetty.toolchain.test.MavenTestingUtils; +import org.eclipse.jetty.toolchain.test.PathAssert; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.startsWith; + +public class BasicTest extends AbstractUseCase +{ + private void setupDistHome() throws IOException + { + setupStandardHomeDir(); + + Files.write(homeDir.resolve("start.ini"), + Collections.singletonList( + "--module=main" + ), + StandardCharsets.UTF_8); + } + + @Test + public void testBasicProcessing() throws Exception + { + setupDistHome(); + + Files.write(baseDir.resolve("start.ini"), + Collections.singletonList( + "--module=main" + ), + StandardCharsets.UTF_8); + + // === Execute Main + List runArgs = new ArrayList<>(); + runArgs.add("--create-files"); + ExecResults results = exec(runArgs, true); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + + // === Validate Specific Jetty Base Files/Dirs Exist + PathAssert.assertDirExists("Required Directory: maindir/", results.baseHome.getPath("maindir/")); + + // === Validate home/base property uri values + Props props = results.startArgs.getProperties(); + + assertThat("Props(jetty.home)", props.getString("jetty.home"), is(results.baseHome.getHome())); + assertThat("Props(jetty.home)", props.getString("jetty.home"), is(not(startsWith("file:")))); + assertThat("Props(jetty.home.uri)", props.getString("jetty.home.uri") + "/", is(results.baseHome.getHomePath().toUri().toString())); + assertThat("Props(jetty.base)", props.getString("jetty.base"), is(results.baseHome.getBase())); + assertThat("Props(jetty.base)", props.getString("jetty.base"), is(not(startsWith("file:")))); + assertThat("Props(jetty.base.uri)", props.getString("jetty.base.uri") + "/", is(results.baseHome.getBasePath().toUri().toString())); + + assertThat("System.getProperty(jetty.home)", System.getProperty("jetty.home"), is(results.baseHome.getHome())); + assertThat("System.getProperty(jetty.home)", System.getProperty("jetty.home"), is(not(startsWith("file:")))); + assertThat("System.getProperty(jetty.base)", System.getProperty("jetty.base"), is(results.baseHome.getBase())); + assertThat("System.getProperty(jetty.base)", System.getProperty("jetty.base"), is(not(startsWith("file:")))); + } + + @Test + public void testWithCommandLine() throws Exception + { + setupDistHome(); + + Files.write(baseDir.resolve("start.ini"), + Collections.singletonList( + "--module=main" + ), + StandardCharsets.UTF_8); + + // === Execute Main + List runArgs = new ArrayList<>(); + runArgs.add("--create-files"); + + // JVM args + runArgs.add("--exec"); + runArgs.add("-Xms1g"); + runArgs.add("-Xmx1g"); + + // Arbitrary Libs + Path extraJar = MavenTestingUtils.getTestResourceFile("extra-libs/example.jar").toPath().toRealPath(); + Path extraDir = MavenTestingUtils.getTestResourceDir("extra-resources").toPath().toRealPath(); + + assertThat("Extra Jar exists: " + extraJar, Files.exists(extraJar), is(true)); + assertThat("Extra Dir exists: " + extraDir, Files.exists(extraDir), is(true)); + + String lib = "--lib=" + extraJar + File.pathSeparator + extraDir; + runArgs.add(lib); + + // Arbitrary XMLs + runArgs.add("config.xml"); + runArgs.add("config-foo.xml"); + runArgs.add("config-bar.xml"); + + ExecResults results = exec(runArgs, true); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml", + "${jetty.home}/etc/config.xml", + "${jetty.home}/etc/config-foo.xml", + "${jetty.home}/etc/config-bar.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + extraJar.toString(), + extraDir.toString(), + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + + // === Validate Specific Jetty Base Files/Dirs Exist + PathAssert.assertDirExists("Required Directory: maindir/", results.baseHome.getPath("maindir/")); + + // === Validate JVM args + List expectedJvmArgs = Arrays.asList( + "-Xms1g", + "-Xmx1g" + ); + List actualJvmArgs = results.startArgs.getJvmArgs(); + assertThat("JVM Args", actualJvmArgs, contains(expectedJvmArgs.toArray())); + } + + @Test + public void testWithModulesFromCommandLine() throws Exception + { + setupDistHome(); + + Files.write(baseDir.resolve("start.ini"), + Collections.singletonList( + "--module=main" + ), + StandardCharsets.UTF_8); + + // === Execute Main + List runArgs = new ArrayList<>(); + runArgs.add("--create-files"); + runArgs.add("java.version=1.8.0_31"); + + // Modules + runArgs.add("--module=optional,extra"); + + ExecResults results = exec(runArgs, true); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/optional.xml", + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml", + "${jetty.home}/etc/extra.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/optional.jar", + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar", + "${jetty.home}/lib/extra/extra0.jar", + "${jetty.home}/lib/extra/extra1.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("extra.prop=value0"); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("optional.prop=value0"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + + // === Validate Specific Jetty Base Files/Dirs Exist + PathAssert.assertDirExists("Required Directory: maindir/", results.baseHome.getPath("maindir/")); + } + + @Test + public void testHomeWithSpaces() throws Exception + { + homeDir = workDir.getPath().resolve("jetty home with spaces"); + FS.ensureDirExists(homeDir); + + setupDistHome(); + + // === Execute Main + List runArgs = new ArrayList<>(); + runArgs.add("--module=main"); + ExecResults results = exec(runArgs, true); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + + // === Validate home/base property uri values + Props props = results.startArgs.getProperties(); + + assertThat("Props(jetty.home)", props.getString("jetty.home"), is(results.baseHome.getHome())); + assertThat("Props(jetty.home)", props.getString("jetty.home"), is(not(startsWith("file:")))); + assertThat("Props(jetty.home.uri)", props.getString("jetty.home.uri") + "/", is(results.baseHome.getHomePath().toUri().toString())); + assertThat("Props(jetty.base)", props.getString("jetty.base"), is(results.baseHome.getBase())); + assertThat("Props(jetty.base)", props.getString("jetty.base"), is(not(startsWith("file:")))); + assertThat("Props(jetty.base.uri)", props.getString("jetty.base.uri") + "/", is(results.baseHome.getBasePath().toUri().toString())); + + assertThat("System.getProperty(jetty.home)", System.getProperty("jetty.home"), is(results.baseHome.getHome())); + assertThat("System.getProperty(jetty.home)", System.getProperty("jetty.home"), is(not(startsWith("file:")))); + assertThat("System.getProperty(jetty.base)", System.getProperty("jetty.base"), is(results.baseHome.getBase())); + assertThat("System.getProperty(jetty.base)", System.getProperty("jetty.base"), is(not(startsWith("file:")))); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/DatabaseTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/DatabaseTest.java new file mode 100644 index 00000000000..c21b1f14cef --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/DatabaseTest.java @@ -0,0 +1,102 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.jetty.toolchain.test.FS; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; + +public class DatabaseTest extends AbstractUseCase +{ + @Test + public void testDatabaseTest() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("etc")); + FS.ensureDirExists(baseDir.resolve("modules")); + FS.ensureDirExists(baseDir.resolve("lib")); + FS.ensureDirExists(baseDir.resolve("lib/db")); + Files.write(baseDir.resolve("etc/db.xml"), + Collections.singletonList( + "" + ), + StandardCharsets.UTF_8); + FS.touch(baseDir.resolve("lib/db/bonecp.jar")); + FS.touch(baseDir.resolve("lib/db/mysql-driver.jar")); + Files.write(baseDir.resolve("modules/db.mod"), + Arrays.asList( + "[lib]", + "lib/db/*.jar", + "[xml]", + "etc/db.xml" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("start.ini"), + Arrays.asList( + "--module=main,db", + "mysql.user=frank", + "mysql.pass=secret" + ), + StandardCharsets.UTF_8); + + // === Execute Main + List runArgs = Collections.emptyList(); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml", + "${jetty.base}/etc/db.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar", + "${jetty.base}/lib/db/bonecp.jar", + "${jetty.base}/lib/db/mysql-driver.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("mysql.user=frank"); + expectedProperties.add("mysql.pass=secret"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/DynamicDependTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/DynamicDependTest.java new file mode 100644 index 00000000000..6bb69331cb8 --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/DynamicDependTest.java @@ -0,0 +1,165 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.jetty.toolchain.test.FS; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; + +public class DynamicDependTest extends AbstractUseCase +{ + @Test + public void testDynamic0Test() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("modules/impl")); + FS.ensureDirExists(baseDir.resolve("modules")); + Files.write(baseDir.resolve("modules/dynamic.mod"), + Arrays.asList( + "[depend]", + "main", + "impl/dynamic-${java.version}" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/impl/dynamic-1.7.0_31.mod"), + Arrays.asList( + "[ini]", + "dynamic=1.7.0_31-from-mod" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/impl/dynamic-1.8.0_05.mod"), + Arrays.asList( + "[ini]", + "dynamic=1.8.0_05_from_mod" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("start.ini"), + Collections.singletonList( + "--module=main" + ), + StandardCharsets.UTF_8); + + // === Execute Main + List runArgs = Arrays.asList( + "java.version=1.7.0_31", + "--module=dynamic" + ); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("dynamic=1.7.0_31-from-mod"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + } + + @Test + public void testDynamic1Test() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("modules/impl")); + FS.ensureDirExists(baseDir.resolve("modules")); + Files.write(baseDir.resolve("modules/dynamic.mod"), + Arrays.asList( + "[depend]", + "main", + "impl/dynamic-${java.version}" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/impl/dynamic-1.7.0_31.mod"), + Arrays.asList( + "[ini]", + "dynamic=1.7.0_31-from-mod" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/impl/dynamic-1.8.0_05.mod"), + Arrays.asList( + "[ini]", + "dynamic=1.8.0_05_from_mod" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("start.ini"), + Collections.singletonList( + "--module=main" + ), + StandardCharsets.UTF_8); + + // === Execute Main + List runArgs = Arrays.asList( + "java.version=1.8.0_05", + "--module=dynamic" + ); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("dynamic=1.8.0_05_from_mod"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/EmptyAddToStartCreateStartdTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/EmptyAddToStartCreateStartdTest.java new file mode 100644 index 00000000000..9b3370a2260 --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/EmptyAddToStartCreateStartdTest.java @@ -0,0 +1,95 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.jetty.toolchain.test.FS; +import org.eclipse.jetty.toolchain.test.PathAssert; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; + +public class EmptyAddToStartCreateStartdTest extends AbstractUseCase +{ + @Test + public void testEmptyAddToStartCreateStartdTest() throws Exception + { + setupStandardHomeDir(); + + FS.touch(baseDir.resolve("unrelated.txt")); + + // === Prepare Jetty Base using Main + List prepareArgs = Arrays.asList( + "--testing-mode", + "--add-to-start=extra", + "--create-startd", + "--add-to-start=optional" + ); + ExecResults prepareResults = exec(prepareArgs, true); + + // === Execute Main + List runArgs = Collections.emptyList(); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/optional.xml", + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml", + "${jetty.home}/etc/extra.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/optional.jar", + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar", + "${jetty.home}/lib/extra/extra0.jar", + "${jetty.home}/lib/extra/extra1.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("extra.prop=value0"); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("optional.prop=value0"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + + // === Validate Specific Jetty Base Files/Dirs Exist + PathAssert.assertDirExists("Required Directory: maindir/", results.baseHome.getPath("maindir/")); + PathAssert.assertFileExists("Required File: start.d/extra.ini", results.baseHome.getPath("start.d/extra.ini")); + PathAssert.assertFileExists("Required File: start.d/optional.ini", results.baseHome.getPath("start.d/optional.ini")); + + // === Validate Specific Lines Exist in Output + assertOutputContainsRegex(prepareResults.output, "MKDIR : \\$\\{jetty.base\\}[\\\\/]maindir"); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/EmptyAddToStartTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/EmptyAddToStartTest.java new file mode 100644 index 00000000000..e207b6be880 --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/EmptyAddToStartTest.java @@ -0,0 +1,89 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.jetty.toolchain.test.FS; +import org.eclipse.jetty.toolchain.test.PathAssert; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; + +public class EmptyAddToStartTest extends AbstractUseCase +{ + @Test + public void testEmptyAddToStartTest() throws Exception + { + setupStandardHomeDir(); + + FS.touch(baseDir.resolve("unrelated.txt")); + + // === Prepare Jetty Base using Main + List prepareArgs = Arrays.asList( + "--testing-mode", + "--add-to-start=extra,optional" + ); + exec(prepareArgs, true); + + // === Execute Main + List runArgs = Collections.emptyList(); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/optional.xml", + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml", + "${jetty.home}/etc/extra.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/optional.jar", + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar", + "${jetty.home}/lib/extra/extra0.jar", + "${jetty.home}/lib/extra/extra1.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("extra.prop=value0"); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("optional.prop=value0"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + + // === Validate Specific Jetty Base Files/Dirs Exist + PathAssert.assertDirExists("Required Directory: maindir/", results.baseHome.getPath("maindir/")); + PathAssert.assertFileExists("Required File: start.ini", results.baseHome.getPath("start.ini")); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/EmptyCreateStartdTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/EmptyCreateStartdTest.java new file mode 100644 index 00000000000..d08f252eefc --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/EmptyCreateStartdTest.java @@ -0,0 +1,92 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.jetty.toolchain.test.FS; +import org.eclipse.jetty.toolchain.test.PathAssert; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; + +public class EmptyCreateStartdTest extends AbstractUseCase +{ + @Test + public void testEmptyCreateStartdTest() throws Exception + { + setupStandardHomeDir(); + + FS.touch(baseDir.resolve("unrelated.txt")); + + // === Prepare Jetty Base using Main + List prepareArgs = Arrays.asList( + "--testing-mode", + "--create-startd", + "--add-to-start=extra,optional" + ); + exec(prepareArgs, true); + + // === Execute Main + List runArgs = Collections.emptyList(); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/optional.xml", + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml", + "${jetty.home}/etc/extra.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/optional.jar", + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar", + "${jetty.home}/lib/extra/extra0.jar", + "${jetty.home}/lib/extra/extra1.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("extra.prop=value0"); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("optional.prop=value0"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + + // === Validate Specific Jetty Base Files/Dirs Exist + PathAssert.assertDirExists("Required Directory: maindir/", results.baseHome.getPath("maindir/")); + PathAssert.assertDirExists("Required Directory: start.d/", results.baseHome.getPath("start.d/")); + PathAssert.assertFileExists("Required File: start.d/extra.ini", results.baseHome.getPath("start.d/extra.ini")); + PathAssert.assertFileExists("Required File: start.d/optional.ini", results.baseHome.getPath("start.d/optional.ini")); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/Files0Test.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/Files0Test.java new file mode 100644 index 00000000000..32a83629f20 --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/Files0Test.java @@ -0,0 +1,73 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.jetty.toolchain.test.FS; +import org.eclipse.jetty.toolchain.test.PathAssert; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsInAnyOrder; + +public class Files0Test extends AbstractUseCase +{ + @Test + public void testFiles0Test() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("modules")); + FS.ensureDirExists(baseDir.resolve("modules/demo")); + Files.write(baseDir.resolve("modules/demo.mod"), + Arrays.asList( + "[files]", + "basehome:modules/demo/demo-config.xml|etc/demo-config.xml" + ), + StandardCharsets.UTF_8); + FS.touch(baseDir.resolve("modules/demo/demo-config.xml")); + + // === Prepare Jetty Base using Main + List prepareArgs = Arrays.asList( + "--testing-mode", + "--create-startd", + "--add-to-start=demo" + ); + ExecResults prepareResults = exec(prepareArgs, true); + + // === Execute Main + List runArgs = Collections.emptyList(); + ExecResults results = exec(runArgs, false); + + // === Validate Downloaded Files + List expectedDownloads = Arrays.asList( + "basehome:modules/demo/demo-config.xml|etc/demo-config.xml" + ); + List actualDownloads = results.getDownloads(); + assertThat("Downloads", actualDownloads, containsInAnyOrder(expectedDownloads.toArray())); + + // === Validate Specific Jetty Base Files/Dirs Exist + PathAssert.assertFileExists("Required File: etc/demo-config.xml", results.baseHome.getPath("etc/demo-config.xml")); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/LoopTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/LoopTest.java new file mode 100644 index 00000000000..c77ea66bd3b --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/LoopTest.java @@ -0,0 +1,173 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.jetty.toolchain.test.FS; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsString; + +public class LoopTest extends AbstractUseCase +{ + @Test + public void testLoopTest() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("modules")); + + // Create loop + // richard -> harry -> tom -> richard + + Files.write(baseDir.resolve("modules/branch.mod"), + Arrays.asList( + "[provides]", + "branch" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/richard.mod"), + Arrays.asList( + "[depends]", + "harry" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/harry.mod"), + Arrays.asList( + "[depends]", + "tom" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/other.mod"), + Arrays.asList( + "[provides]", + "branch" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/root.mod"), + Arrays.asList( + "[depends]", + "branch" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/tom.mod"), + Arrays.asList( + "[depends]", + "richard" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("start.ini"), + Collections.singletonList( + "--module=root" + ), + StandardCharsets.UTF_8); + + // === Prepare Jetty Base using Main + List prepareArgs = Arrays.asList( + "--testing-mode", + "--create-startd", + "--add-to-start=tom" + ); + exec(prepareArgs, true); + + // === Execute Main + List runArgs = Collections.emptyList(); + ExecResults results = exec(runArgs, false); + + // === Check Exceptions + assertThat(results.exception.toString(), containsString("CyclicException")); + assertThat(results.exception.toString(), containsString("cyclic")); + } + + @Test + public void testDynamicLoopTest() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("modules/dynamic")); + FS.ensureDirExists(baseDir.resolve("modules")); + + // Create loop + // richard -> dynamic/harry -> tom -> richard + + Files.write(baseDir.resolve("modules/branch.mod"), + Arrays.asList( + "[provides]", + "branch" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/richard.mod"), + Arrays.asList( + "[depends]", + "dynamic/harry" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/dynamic/harry.mod"), + Arrays.asList( + "[depends]", + "tom" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/other.mod"), + Arrays.asList( + "[provides]", + "branch" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/root.mod"), + Arrays.asList( + "[depends]", + "branch" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/tom.mod"), + Arrays.asList( + "[depends]", + "richard" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("start.ini"), + Collections.singletonList( + "--module=root" + ), + StandardCharsets.UTF_8); + + // === Prepare Jetty Base using Main + List prepareArgs = Arrays.asList( + "--testing-mode", + "--create-startd", + "--add-to-start=tom" + ); + exec(prepareArgs, true); + + // === Execute Main + List runArgs = Collections.emptyList(); + ExecResults results = exec(runArgs, false); + + // === Check Exceptions + assertThat(results.exception.toString(), containsString("CyclicException")); + assertThat(results.exception.toString(), containsString("cyclic")); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/OrderedTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/OrderedTest.java new file mode 100644 index 00000000000..4c48b89da4a --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/OrderedTest.java @@ -0,0 +1,432 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.jetty.toolchain.test.FS; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.containsString; + +public class OrderedTest extends AbstractUseCase +{ + @Test + public void testOrdered0Test() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("modules")); + FS.ensureDirExists(baseDir.resolve("etc")); + FS.touch(baseDir.resolve("etc/alternateA.xml")); + FS.touch(baseDir.resolve("etc/alternateB.xml")); + FS.touch(baseDir.resolve("etc/dependent.xml")); + Files.write(baseDir.resolve("modules/alternateA.mod"), + Arrays.asList( + "[provides]", + "alternate", + "[xml]", + "etc/alternateA.xml" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/alternateB.mod"), + Arrays.asList( + "[provides]", + "alternate", + "[xml]", + "etc/alternateB.xml" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/convenience.mod"), + Arrays.asList( + "[depends]", + "replacement", + "something-else" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/dependent.mod"), + Arrays.asList( + "[depends]", + "alternate", + "[xml]", + "etc/dependent.xml" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/original.mod"), + Arrays.asList( + "[ini]", + "impl=original" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/replacement.mod"), + Arrays.asList( + "[provides]", + "original", + "[ini]", + "impl=replacement" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/something-else.mod"), + Arrays.asList( + "[depends]", + "original" + ), + StandardCharsets.UTF_8); + + // === Execute Main + List runArgs = Collections.singletonList( + "--module=alternateA,dependent" + ); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.base}/etc/alternateA.xml", + "${jetty.base}/etc/dependent.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + } + + @Test + public void testOrdered1Test() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("modules")); + FS.ensureDirExists(baseDir.resolve("etc")); + FS.touch(baseDir.resolve("etc/alternateA.xml")); + FS.touch(baseDir.resolve("etc/alternateB.xml")); + FS.touch(baseDir.resolve("etc/dependent.xml")); + Files.write(baseDir.resolve("modules/alternateA.mod"), + Arrays.asList( + "[provides]", + "alternate", + "[xml]", + "etc/alternateA.xml" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/alternateB.mod"), + Arrays.asList( + "[provides]", + "alternate", + "[xml]", + "etc/alternateB.xml" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/convenience.mod"), + Arrays.asList( + "[depends]", + "replacement", + "something-else" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/dependent.mod"), + Arrays.asList( + "[depends]", + "alternate", + "[xml]", + "etc/dependent.xml" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/original.mod"), + Arrays.asList( + "[ini]", + "impl=original" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/replacement.mod"), + Arrays.asList( + "[provides]", + "original", + "[ini]", + "impl=replacement" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/something-else.mod"), + Arrays.asList( + "[depends]", + "original" + ), + StandardCharsets.UTF_8); + + // === Execute Main + List runArgs = Collections.singletonList( + "--module=dependent,alternateA" + ); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.base}/etc/alternateA.xml", + "${jetty.base}/etc/dependent.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + } + + @Test + public void testOrdered2Test() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("modules")); + FS.ensureDirExists(baseDir.resolve("etc")); + FS.touch(baseDir.resolve("etc/alternateA.xml")); + FS.touch(baseDir.resolve("etc/alternateB.xml")); + FS.touch(baseDir.resolve("etc/dependent.xml")); + Files.write(baseDir.resolve("modules/alternateA.mod"), + Arrays.asList( + "[provides]", + "alternate", + "[xml]", + "etc/alternateA.xml" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/alternateB.mod"), + Arrays.asList( + "[provides]", + "alternate", + "[xml]", + "etc/alternateB.xml" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/convenience.mod"), + Arrays.asList( + "[depends]", + "replacement", + "something-else" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/dependent.mod"), + Arrays.asList( + "[depends]", + "alternate", + "[xml]", + "etc/dependent.xml" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/original.mod"), + Arrays.asList( + "[ini]", + "impl=original" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/replacement.mod"), + Arrays.asList( + "[provides]", + "original", + "[ini]", + "impl=replacement" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/something-else.mod"), + Arrays.asList( + "[depends]", + "original" + ), + StandardCharsets.UTF_8); + + // === Execute Main + List runArgs = Collections.singletonList( + "--module=dependent" + ); + ExecResults results = exec(runArgs, false); + + // === Check Exceptions + assertThat(results.exception.toString(), containsString("UsageException: Unsatisfied module dependencies")); + } + + @Test + public void testOrderedDefaultTest() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("modules")); + FS.ensureDirExists(baseDir.resolve("etc")); + FS.touch(baseDir.resolve("etc/alternateA.xml")); + FS.touch(baseDir.resolve("etc/alternateB.xml")); + FS.touch(baseDir.resolve("etc/dependent.xml")); + Files.write(baseDir.resolve("modules/alternateA.mod"), + Arrays.asList( + "[provides]", + "alternate", + "[xml]", + "etc/alternateA.xml" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/alternateB.mod"), + Arrays.asList( + "[provides]", + "alternate", + "[xml]", + "etc/alternateB.xml" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/convenience.mod"), + Arrays.asList( + "[depends]", + "replacement", + "something-else" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/dependent.mod"), + Arrays.asList( + "[depends]", + "alternate", + "[xml]", + "etc/dependent.xml" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/original.mod"), + Arrays.asList( + "[ini]", + "impl=original" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/replacement.mod"), + Arrays.asList( + "[provides]", + "original", + "[ini]", + "impl=replacement" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/something-else.mod"), + Arrays.asList( + "[depends]", + "original" + ), + StandardCharsets.UTF_8); + + // === Execute Main + List runArgs = Collections.singletonList( + "--module=main,convenience" + ); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("impl=replacement"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + } + + @Test + public void testOrderedProvided0Test() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("modules")); + FS.ensureDirExists(baseDir.resolve("modules/dynamic")); + FS.ensureDirExists(baseDir.resolve("etc")); + FS.touch(baseDir.resolve("etc/implA.xml")); + FS.touch(baseDir.resolve("etc/implB.xml")); + Files.write(baseDir.resolve("modules/abstractA.mod"), + Arrays.asList( + "[depend]", + "dynamic/${implA}", + "[ini]", + "implA=implA", + "[ini-template]", + "implA=implA" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/abstractB.mod"), + Arrays.asList( + "[depend]", + "dynamic/${implB}", + "[provide]", + "provided", + "[ini]", + "implB=implB", + "[ini-template]", + "implB=implB" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/dynamic/implA.mod"), + Arrays.asList( + "[depend]", + "provided", + "[xml]", + "etc/implA.xml" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/dynamic/implB.mod"), + Arrays.asList( + "[xml]", + "etc/implB.xml" + ), + StandardCharsets.UTF_8); + + // === Prepare Jetty Base using Main + List prepareArgs = Arrays.asList( + "--testing-mode", + "--create-startd", + "--add-to-start=abstractB,abstractA" + ); + exec(prepareArgs, true); + + // === Execute Main + List runArgs = Collections.emptyList(); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.base}/etc/implB.xml", + "${jetty.base}/etc/implA.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("implA=implA"); + expectedProperties.add("implB=implB"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/ParameterizedTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/ParameterizedTest.java new file mode 100644 index 00000000000..82931a43c82 --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/ParameterizedTest.java @@ -0,0 +1,311 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.jetty.toolchain.test.FS; +import org.eclipse.jetty.toolchain.test.PathAssert; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; + +public class ParameterizedTest extends AbstractUseCase +{ + @Test + public void testParameterizedAddToStartTest() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("etc")); + FS.ensureDirExists(baseDir.resolve("start.d")); + FS.ensureDirExists(baseDir.resolve("modules")); + Files.write(baseDir.resolve("etc/commands.txt"), + Arrays.asList( + "name0=changed0", + "name1=changed1", + "--add-to-start=parameterized", + "# ignore this" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/parameterized.mod"), + Arrays.asList( + "[depend]", + "main", + "[ini]", + "name=value", + "name0?=default", + "name2?=two", + "[ini-template]", + "name0=value0", + "# name1=value1", + "# name2=too" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("start.d/tobeupdated.ini"), + Arrays.asList( + "#p=v", + "property=value", + "#comment", + "property0=value0", + "#comment", + "#property1=value1" + ), + StandardCharsets.UTF_8); + + // === Prepare Jetty Base using Main + List prepareArgs = Arrays.asList( + "--testing-mode", + "--create-startd", + "other=value", + "name=changed", + "name0=changed0", + "name1=changed1", + "--add-to-start=parameterized" + ); + exec(prepareArgs, true); + + // === Execute Main + List runArgs = Collections.emptyList(); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("name=value"); + expectedProperties.add("name0=changed0"); + expectedProperties.add("name1=changed1"); + expectedProperties.add("name2=two"); + expectedProperties.add("property=value"); + expectedProperties.add("property0=value0"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + + // === Validate Specific Jetty Base Files/Dirs Exist + PathAssert.assertFileExists("Required File: start.d/parameterized.ini", results.baseHome.getPath("start.d/parameterized.ini")); + } + + @Test + public void testParameterizedCommandsTest() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("etc")); + FS.ensureDirExists(baseDir.resolve("start.d")); + FS.ensureDirExists(baseDir.resolve("modules")); + Files.write(baseDir.resolve("etc/commands.txt"), + Arrays.asList( + "name0=changed0", + "name1=changed1", + "--add-to-start=parameterized", + "# ignore this" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/parameterized.mod"), + Arrays.asList( + "[depend]", + "main", + "[ini]", + "name=value", + "name0?=default", + "name2?=two", + "[ini-template]", + "name0=value0", + "# name1=value1", + "# name2=too" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("start.d/tobeupdated.ini"), + Arrays.asList( + "#p=v", + "property=value", + "#comment", + "property0=value0", + "#comment", + "#property1=value1" + ), + StandardCharsets.UTF_8); + + // === Prepare Jetty Base using Main + List prepareArgs = Arrays.asList( + "--testing-mode", + "--create-startd", + "other=value", + "name=changed", + "--commands=etc/commands.txt" + ); + exec(prepareArgs, true); + + // === Execute Main + List runArgs = Collections.emptyList(); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("name=value"); + expectedProperties.add("name0=changed0"); + expectedProperties.add("name1=changed1"); + expectedProperties.add("name2=two"); + expectedProperties.add("property=value"); + expectedProperties.add("property0=value0"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + + // === Validate Specific Jetty Base Files/Dirs Exist + PathAssert.assertFileExists("Required File: start.d/parameterized.ini", results.baseHome.getPath("start.d/parameterized.ini")); + } + + @Test + public void testParameterizedUpdateTest() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("etc")); + FS.ensureDirExists(baseDir.resolve("start.d")); + FS.ensureDirExists(baseDir.resolve("modules")); + Files.write(baseDir.resolve("etc/commands.txt"), + Arrays.asList( + "name0=changed0", + "name1=changed1", + "--add-to-start=parameterized", + "# ignore this" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/parameterized.mod"), + Arrays.asList( + "[depend]", + "main", + "[ini]", + "name=value", + "name0?=default", + "name2?=two", + "[ini-template]", + "name0=value0", + "# name1=value1", + "# name2=too" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("start.d/tobeupdated.ini"), + Arrays.asList( + "#p=v", + "property=value", + "#comment", + "property0=value0", + "#comment", + "#property1=value1" + ), + StandardCharsets.UTF_8); + + // === Prepare Jetty Base using Main + List prepareArgs = Arrays.asList( + "--testing-mode", + "--create-startd", + "other=value", + "name=changed", + "name0=changed0", + "name1=changed1", + "--add-to-start=parameterized", + "--update-ini", + "property0=changed0", + "property1=changed1", + "name0=updated0" + ); + exec(prepareArgs, true); + + // === Execute Main + List runArgs = Collections.emptyList(); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("name=value"); + expectedProperties.add("name0=updated0"); + expectedProperties.add("name1=changed1"); + expectedProperties.add("name2=two"); + expectedProperties.add("property=value"); + expectedProperties.add("property0=changed0"); + expectedProperties.add("property1=changed1"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + + // === Validate Specific Jetty Base Files/Dirs Exist + PathAssert.assertFileExists("Required File: start.d/parameterized.ini", results.baseHome.getPath("start.d/parameterized.ini")); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/TransientIniTemplateTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/TransientIniTemplateTest.java new file mode 100644 index 00000000000..d3375177d13 --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/TransientIniTemplateTest.java @@ -0,0 +1,184 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.jetty.toolchain.test.FS; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; + +public class TransientIniTemplateTest extends AbstractUseCase +{ + @Test + public void testTransientWithoutIniTemplateTest() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("etc")); + FS.ensureDirExists(baseDir.resolve("modules")); + FS.touch(baseDir.resolve("etc/d.xml")); + FS.touch(baseDir.resolve("etc/t.xml")); + Files.write(baseDir.resolve("modules/direct.mod"), + Arrays.asList( + "[xml]", + "etc/d.xml", + "[depend]", + "transient", + "[ini-template]", + "direct.option=direct" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/transient.mod"), + Arrays.asList( + "[xml]", + "etc/t.xml", + "[optional]", + "main" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("start.ini"), + Collections.singletonList( + "--module=main" + ), + StandardCharsets.UTF_8); + + // === Prepare Jetty Base using Main + List prepareArgs = Arrays.asList( + "--testing-mode", + "--add-to-start=direct" + ); + exec(prepareArgs, true); + + // === Execute Main + List runArgs = Collections.emptyList(); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml", + "${jetty.base}/etc/t.xml", + "${jetty.base}/etc/d.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("direct.option=direct"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + } + + @Test + public void testTransientWithIniTemplateTest() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("modules")); + FS.ensureDirExists(baseDir.resolve("etc")); + FS.touch(baseDir.resolve("etc/d.xml")); + FS.touch(baseDir.resolve("etc/t.xml")); + Files.write(baseDir.resolve("modules/direct.mod"), + Arrays.asList( + "[xml]", + "etc/d.xml", + "[depend]", + "transient", + "[ini-template]", + "direct.option=direct" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/transient.mod"), + Arrays.asList( + "[xml]", + "etc/t.xml", + "[optional]", + "main", + "[ini]", + "transient.option=transient", + "[ini-template]", + "transient.option=transient" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("start.ini"), + Collections.singletonList( + "--module=main" + ), + StandardCharsets.UTF_8); + + // === Prepare Jetty Base using Main + List prepareArgs = Arrays.asList( + "--testing-mode", + "--add-to-start=direct" + ); + exec(prepareArgs, true); + + // === Execute Main + List runArgs = Collections.emptyList(); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml", + "${jetty.base}/etc/t.xml", + "${jetty.base}/etc/d.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("transient.option=transient"); + expectedProperties.add("direct.option=direct"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/VersionedModulesTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/VersionedModulesTest.java new file mode 100644 index 00000000000..a3621cea5f2 --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/usecases/VersionedModulesTest.java @@ -0,0 +1,95 @@ +// +// ======================================================================== +// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start.usecases; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.jetty.toolchain.test.FS; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; + +public class VersionedModulesTest extends AbstractUseCase +{ + @Test + public void testVersionedModulesTest() throws Exception + { + setupStandardHomeDir(); + + FS.ensureDirExists(baseDir.resolve("modules")); + Files.write(baseDir.resolve("modules/new.mod"), + Arrays.asList( + "[version]", + "9.3", + "[ini]", + "the-future=is-new" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("modules/old.mod"), + Arrays.asList( + "[defaults]", + "from-module=old" + ), + StandardCharsets.UTF_8); + Files.write(baseDir.resolve("start.ini"), + Arrays.asList( + "--module=main", + "--module=old", + "--module=new" + ), + StandardCharsets.UTF_8); + + // === Execute Main + List runArgs = Collections.emptyList(); + ExecResults results = exec(runArgs, false); + + // === Validate Resulting XMLs + List expectedXmls = Arrays.asList( + "${jetty.home}/etc/base.xml", + "${jetty.home}/etc/main.xml" + ); + List actualXmls = results.getXmls(); + assertThat("XML Resolution Order", actualXmls, contains(expectedXmls.toArray())); + + // === Validate Resulting LIBs + List expectedLibs = Arrays.asList( + "${jetty.home}/lib/base.jar", + "${jetty.home}/lib/main.jar", + "${jetty.home}/lib/other.jar" + ); + List actualLibs = results.getLibs(); + assertThat("Libs", actualLibs, containsInAnyOrder(expectedLibs.toArray())); + + // === Validate Resulting Properties + Set expectedProperties = new HashSet<>(); + expectedProperties.add("main.prop=value0"); + expectedProperties.add("the-future=is-new"); + expectedProperties.add("from-module=old"); + List actualProperties = results.getProperties(); + assertThat("Properties", actualProperties, containsInAnyOrder(expectedProperties.toArray())); + } +} diff --git a/jetty-start/src/test/resources/assert-home-with-jvm.txt b/jetty-start/src/test/resources/assert-home-with-jvm.txt deleted file mode 100644 index ad6e4b0f061..00000000000 --- a/jetty-start/src/test/resources/assert-home-with-jvm.txt +++ /dev/null @@ -1,24 +0,0 @@ -# The XMLs we expect (order is important) -XML|${jetty.base}/etc/base.xml -XML|${jetty.base}/etc/main.xml -XML|${jetty.base}/etc/config.xml -XML|${jetty.base}/etc/config-foo.xml -XML|${jetty.base}/etc/config-bar.xml - -# The LIBs we expect (order is irrelevant) -LIB|${maven-test-resources}/extra-resources -LIB|${maven-test-resources}/extra-libs/example.jar -LIB|${jetty.base}/lib/base.jar -LIB|${jetty.base}/lib/main.jar -LIB|${jetty.base}/lib/other.jar -jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 - -# JVM Args -JVM|-Xms1024m -JVM|-Xmx1024m - -# Files / Directories to create -FILE|maindir/ diff --git a/jetty-start/src/test/resources/assert-home-with-module.txt b/jetty-start/src/test/resources/assert-home-with-module.txt deleted file mode 100644 index 3da821d9521..00000000000 --- a/jetty-start/src/test/resources/assert-home-with-module.txt +++ /dev/null @@ -1,22 +0,0 @@ -# The XMLs we expect (order is important) -XML|${jetty.base}/etc/optional.xml -XML|${jetty.base}/etc/base.xml -XML|${jetty.base}/etc/main.xml -XML|${jetty.base}/etc/extra.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.base}/lib/optional.jar -LIB|${jetty.base}/lib/base.jar -LIB|${jetty.base}/lib/main.jar -LIB|${jetty.base}/lib/other.jar -LIB|${jetty.base}/lib/extra/extra0.jar -LIB|${jetty.base}/lib/extra/extra1.jar -jar - -# The Properties we expect (order is irrelevant) -PROP|extra.prop=value0 -PROP|main.prop=value0 -PROP|optional.prop=value0 - -# Files / Directories to create -FILE|maindir/ diff --git a/jetty-start/src/test/resources/assert-home-with-spaces.txt b/jetty-start/src/test/resources/assert-home-with-spaces.txt deleted file mode 100644 index 1f2e3ae7c30..00000000000 --- a/jetty-start/src/test/resources/assert-home-with-spaces.txt +++ /dev/null @@ -1,15 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.base}/etc/base.xml -XML|${jetty.base}/etc/main.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.base}/lib/a library.jar -LIB|${jetty.base}/lib/base.jar -LIB|${jetty.base}/lib/main.jar -LIB|${jetty.base}/lib/other.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 - -# Files / Directories to create -FILE|maindir/ diff --git a/jetty-start/src/test/resources/assert-home.txt b/jetty-start/src/test/resources/assert-home.txt deleted file mode 100644 index f5bdd21a2de..00000000000 --- a/jetty-start/src/test/resources/assert-home.txt +++ /dev/null @@ -1,15 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.base}/etc/base.xml -XML|${jetty.base}/etc/main.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.base}/lib/base.jar -LIB|${jetty.base}/lib/main.jar -LIB|${jetty.base}/lib/other.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 - -# Files / Directories to create -FILE|maindir/ - diff --git a/jetty-start/src/test/resources/usecases/agent-properties.assert.txt b/jetty-start/src/test/resources/usecases/agent-properties.assert.txt deleted file mode 100644 index 322c19c7249..00000000000 --- a/jetty-start/src/test/resources/usecases/agent-properties.assert.txt +++ /dev/null @@ -1,12 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar -LIB|${jetty.base}/lib/agent-jdk-1.7.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 diff --git a/jetty-start/src/test/resources/usecases/agent-properties.cmdline.txt b/jetty-start/src/test/resources/usecases/agent-properties.cmdline.txt deleted file mode 100644 index 0d9718a5ff6..00000000000 --- a/jetty-start/src/test/resources/usecases/agent-properties.cmdline.txt +++ /dev/null @@ -1 +0,0 @@ -java.vm.specification.version=1.7 diff --git a/jetty-start/src/test/resources/usecases/agent-properties/lib/agent-jdk-1.5.jar b/jetty-start/src/test/resources/usecases/agent-properties/lib/agent-jdk-1.5.jar deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/agent-properties/lib/agent-jdk-1.6.jar b/jetty-start/src/test/resources/usecases/agent-properties/lib/agent-jdk-1.6.jar deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/agent-properties/lib/agent-jdk-1.7.jar b/jetty-start/src/test/resources/usecases/agent-properties/lib/agent-jdk-1.7.jar deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/agent-properties/lib/agent-jdk-1.8.jar b/jetty-start/src/test/resources/usecases/agent-properties/lib/agent-jdk-1.8.jar deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/agent-properties/modules/agent.mod b/jetty-start/src/test/resources/usecases/agent-properties/modules/agent.mod deleted file mode 100644 index a11e74bfc57..00000000000 --- a/jetty-start/src/test/resources/usecases/agent-properties/modules/agent.mod +++ /dev/null @@ -1,6 +0,0 @@ -[depend] -main - -[lib] -lib/agent-jdk-${java.vm.specification.version}.jar - diff --git a/jetty-start/src/test/resources/usecases/agent-properties/start.ini b/jetty-start/src/test/resources/usecases/agent-properties/start.ini deleted file mode 100644 index c1de123baf1..00000000000 --- a/jetty-start/src/test/resources/usecases/agent-properties/start.ini +++ /dev/null @@ -1 +0,0 @@ ---module=main,agent diff --git a/jetty-start/src/test/resources/usecases/alternate.0.assert.txt b/jetty-start/src/test/resources/usecases/alternate.0.assert.txt deleted file mode 100644 index 7ece67ea7d4..00000000000 --- a/jetty-start/src/test/resources/usecases/alternate.0.assert.txt +++ /dev/null @@ -1,12 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 -PROP|noDft.option=A diff --git a/jetty-start/src/test/resources/usecases/alternate.0.cmdline.txt b/jetty-start/src/test/resources/usecases/alternate.0.cmdline.txt deleted file mode 100644 index 638a719585d..00000000000 --- a/jetty-start/src/test/resources/usecases/alternate.0.cmdline.txt +++ /dev/null @@ -1,2 +0,0 @@ ---module=noDftOptionA - diff --git a/jetty-start/src/test/resources/usecases/alternate.1.assert.txt b/jetty-start/src/test/resources/usecases/alternate.1.assert.txt deleted file mode 100644 index 39e964034ee..00000000000 --- a/jetty-start/src/test/resources/usecases/alternate.1.assert.txt +++ /dev/null @@ -1,15 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml -XML|${jetty.base}/etc/d.xml -XML|${jetty.base}/etc/ndb.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 -PROP|default.option=default -PROP|noDft.option=B diff --git a/jetty-start/src/test/resources/usecases/alternate.1.cmdline.txt b/jetty-start/src/test/resources/usecases/alternate.1.cmdline.txt deleted file mode 100644 index 1c22e5eebe9..00000000000 --- a/jetty-start/src/test/resources/usecases/alternate.1.cmdline.txt +++ /dev/null @@ -1,2 +0,0 @@ ---module=noDftOptionB - diff --git a/jetty-start/src/test/resources/usecases/alternate.2.assert.txt b/jetty-start/src/test/resources/usecases/alternate.2.assert.txt deleted file mode 100644 index b03d1e08ed6..00000000000 --- a/jetty-start/src/test/resources/usecases/alternate.2.assert.txt +++ /dev/null @@ -1,14 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml -XML|${jetty.base}/etc/ndb.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 -PROP|default.option=alternate -PROP|noDft.option=B diff --git a/jetty-start/src/test/resources/usecases/alternate.2.cmdline.txt b/jetty-start/src/test/resources/usecases/alternate.2.cmdline.txt deleted file mode 100644 index 3203ce1a1f6..00000000000 --- a/jetty-start/src/test/resources/usecases/alternate.2.cmdline.txt +++ /dev/null @@ -1,2 +0,0 @@ ---module=alternate,noDftOptionB - diff --git a/jetty-start/src/test/resources/usecases/alternate.3.assert.txt b/jetty-start/src/test/resources/usecases/alternate.3.assert.txt deleted file mode 100644 index 7d35fe73cdc..00000000000 --- a/jetty-start/src/test/resources/usecases/alternate.3.assert.txt +++ /dev/null @@ -1,2 +0,0 @@ -EX|UsageException -EX|default, which is already provided by alternate diff --git a/jetty-start/src/test/resources/usecases/alternate.3.cmdline.txt b/jetty-start/src/test/resources/usecases/alternate.3.cmdline.txt deleted file mode 100644 index a131acb6370..00000000000 --- a/jetty-start/src/test/resources/usecases/alternate.3.cmdline.txt +++ /dev/null @@ -1,2 +0,0 @@ ---module=alternate,default - diff --git a/jetty-start/src/test/resources/usecases/alternate.4.assert.txt b/jetty-start/src/test/resources/usecases/alternate.4.assert.txt deleted file mode 100644 index b03d1e08ed6..00000000000 --- a/jetty-start/src/test/resources/usecases/alternate.4.assert.txt +++ /dev/null @@ -1,14 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml -XML|${jetty.base}/etc/ndb.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 -PROP|default.option=alternate -PROP|noDft.option=B diff --git a/jetty-start/src/test/resources/usecases/alternate.4.cmdline.txt b/jetty-start/src/test/resources/usecases/alternate.4.cmdline.txt deleted file mode 100644 index 03a751cf791..00000000000 --- a/jetty-start/src/test/resources/usecases/alternate.4.cmdline.txt +++ /dev/null @@ -1 +0,0 @@ ---module=alternate diff --git a/jetty-start/src/test/resources/usecases/alternate.4.prepare.txt b/jetty-start/src/test/resources/usecases/alternate.4.prepare.txt deleted file mode 100644 index 256ad3f6314..00000000000 --- a/jetty-start/src/test/resources/usecases/alternate.4.prepare.txt +++ /dev/null @@ -1 +0,0 @@ ---add-to-start=noDftOptionB diff --git a/jetty-start/src/test/resources/usecases/alternate/etc/d.xml b/jetty-start/src/test/resources/usecases/alternate/etc/d.xml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/alternate/etc/ndb.xml b/jetty-start/src/test/resources/usecases/alternate/etc/ndb.xml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/alternate/modules/alternate.mod b/jetty-start/src/test/resources/usecases/alternate/modules/alternate.mod deleted file mode 100644 index 19d9953f8af..00000000000 --- a/jetty-start/src/test/resources/usecases/alternate/modules/alternate.mod +++ /dev/null @@ -1,5 +0,0 @@ -[provides] -default - -[ini] -default.option=alternate diff --git a/jetty-start/src/test/resources/usecases/alternate/modules/default.mod b/jetty-start/src/test/resources/usecases/alternate/modules/default.mod deleted file mode 100644 index 19c9362d42d..00000000000 --- a/jetty-start/src/test/resources/usecases/alternate/modules/default.mod +++ /dev/null @@ -1,5 +0,0 @@ -[xml] -etc/d.xml - -[ini] -default.option=default diff --git a/jetty-start/src/test/resources/usecases/alternate/modules/noDftOptionA.mod b/jetty-start/src/test/resources/usecases/alternate/modules/noDftOptionA.mod deleted file mode 100644 index cfa7551c253..00000000000 --- a/jetty-start/src/test/resources/usecases/alternate/modules/noDftOptionA.mod +++ /dev/null @@ -1,8 +0,0 @@ -[provides] -noDft - -[optional] -default - -[ini] -noDft.option=A diff --git a/jetty-start/src/test/resources/usecases/alternate/modules/noDftOptionB.mod b/jetty-start/src/test/resources/usecases/alternate/modules/noDftOptionB.mod deleted file mode 100644 index f852a551e1a..00000000000 --- a/jetty-start/src/test/resources/usecases/alternate/modules/noDftOptionB.mod +++ /dev/null @@ -1,11 +0,0 @@ -[provides] -noDft - -[depend] -default - -[xml] -etc/ndb.xml - -[ini] -noDft.option=B diff --git a/jetty-start/src/test/resources/usecases/alternate/start.ini b/jetty-start/src/test/resources/usecases/alternate/start.ini deleted file mode 100644 index dbfd730d55d..00000000000 --- a/jetty-start/src/test/resources/usecases/alternate/start.ini +++ /dev/null @@ -1,2 +0,0 @@ ---module=main - diff --git a/jetty-start/src/test/resources/usecases/barebones.addToStart.assert.txt b/jetty-start/src/test/resources/usecases/barebones.addToStart.assert.txt deleted file mode 100644 index f899840be22..00000000000 --- a/jetty-start/src/test/resources/usecases/barebones.addToStart.assert.txt +++ /dev/null @@ -1,18 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/optional.xml -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar -LIB|${jetty.home}/lib/optional.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 -PROP|optional.prop=value0 - -# Files / Directories to create -EXISTS|maindir/ -EXISTS|start.ini diff --git a/jetty-start/src/test/resources/usecases/barebones.addToStart.prepare.txt b/jetty-start/src/test/resources/usecases/barebones.addToStart.prepare.txt deleted file mode 100644 index 4690e3f5e0e..00000000000 --- a/jetty-start/src/test/resources/usecases/barebones.addToStart.prepare.txt +++ /dev/null @@ -1 +0,0 @@ ---add-to-start=optional diff --git a/jetty-start/src/test/resources/usecases/barebones.addToStartd.assert.txt b/jetty-start/src/test/resources/usecases/barebones.addToStartd.assert.txt deleted file mode 100644 index 138901f6951..00000000000 --- a/jetty-start/src/test/resources/usecases/barebones.addToStartd.assert.txt +++ /dev/null @@ -1,19 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/optional.xml -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar -LIB|${jetty.home}/lib/optional.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 -PROP|optional.prop=value0 - -# Files / Directories to create -EXISTS|maindir/ -EXISTS|start.d/start.ini -EXISTS|start.d/optional.ini diff --git a/jetty-start/src/test/resources/usecases/barebones.addToStartd.prepare.txt b/jetty-start/src/test/resources/usecases/barebones.addToStartd.prepare.txt deleted file mode 100644 index 683f7131d26..00000000000 --- a/jetty-start/src/test/resources/usecases/barebones.addToStartd.prepare.txt +++ /dev/null @@ -1,2 +0,0 @@ ---create-startd ---add-to-start=optional diff --git a/jetty-start/src/test/resources/usecases/barebones.addUnknown.assert.txt b/jetty-start/src/test/resources/usecases/barebones.addUnknown.assert.txt deleted file mode 100644 index 273cda74390..00000000000 --- a/jetty-start/src/test/resources/usecases/barebones.addUnknown.assert.txt +++ /dev/null @@ -1 +0,0 @@ -EX|UsageException diff --git a/jetty-start/src/test/resources/usecases/barebones.addUnknown.prepare.txt b/jetty-start/src/test/resources/usecases/barebones.addUnknown.prepare.txt deleted file mode 100644 index e47d043e0d9..00000000000 --- a/jetty-start/src/test/resources/usecases/barebones.addUnknown.prepare.txt +++ /dev/null @@ -1,2 +0,0 @@ ---create-startd ---add-to-start=unknown diff --git a/jetty-start/src/test/resources/usecases/barebones.alreadyEnabled.assert.txt b/jetty-start/src/test/resources/usecases/barebones.alreadyEnabled.assert.txt deleted file mode 100644 index 450ae4f3cef..00000000000 --- a/jetty-start/src/test/resources/usecases/barebones.alreadyEnabled.assert.txt +++ /dev/null @@ -1,17 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 - -# Files / Directories to create -EXISTS|maindir/ -EXISTS|start.ini - -OUTPUT|INFO : main already enabled by \[\$\{jetty.base}[\\/]start.ini\] diff --git a/jetty-start/src/test/resources/usecases/barebones.alreadyEnabled.prepare.txt b/jetty-start/src/test/resources/usecases/barebones.alreadyEnabled.prepare.txt deleted file mode 100644 index b780ce19332..00000000000 --- a/jetty-start/src/test/resources/usecases/barebones.alreadyEnabled.prepare.txt +++ /dev/null @@ -1 +0,0 @@ ---add-to-start=main diff --git a/jetty-start/src/test/resources/usecases/barebones.assert.txt b/jetty-start/src/test/resources/usecases/barebones.assert.txt deleted file mode 100644 index 312011d73ca..00000000000 --- a/jetty-start/src/test/resources/usecases/barebones.assert.txt +++ /dev/null @@ -1,11 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 diff --git a/jetty-start/src/test/resources/usecases/barebones/start.ini b/jetty-start/src/test/resources/usecases/barebones/start.ini deleted file mode 100644 index 4cae2dd2f88..00000000000 --- a/jetty-start/src/test/resources/usecases/barebones/start.ini +++ /dev/null @@ -1 +0,0 @@ ---module=main diff --git a/jetty-start/src/test/resources/usecases/basehome.withfiles.assert.txt b/jetty-start/src/test/resources/usecases/basehome.withfiles.assert.txt deleted file mode 100644 index 54f679f6208..00000000000 --- a/jetty-start/src/test/resources/usecases/basehome.withfiles.assert.txt +++ /dev/null @@ -1,15 +0,0 @@ - -DOWNLOAD|basehome:modules/withfiles/test.txt|one/renamed.txt -DOWNLOAD|basehome:modules/withfiles/test.txt|two/ -DOWNLOAD|basehome:modules/withfiles/test.txt|three -DOWNLOAD|basehome:modules/withfiles|null -DOWNLOAD|basehome:modules/withfiles/four/|five/ -DOWNLOAD|basehome:modules/withfiles/four/sub|six - -EXISTS|test.txt -EXISTS|one/renamed.txt -EXISTS|two/test.txt -EXISTS|three/test.txt -EXISTS|four/sub/dir/test.txt -EXISTS|five/sub/dir/test.txt -EXISTS|six/sub/dir/test.txt \ No newline at end of file diff --git a/jetty-start/src/test/resources/usecases/basehome.withfiles.prepare.txt b/jetty-start/src/test/resources/usecases/basehome.withfiles.prepare.txt deleted file mode 100644 index e6527ad8759..00000000000 --- a/jetty-start/src/test/resources/usecases/basehome.withfiles.prepare.txt +++ /dev/null @@ -1,2 +0,0 @@ ---create-startd ---add-to-start=withfiles \ No newline at end of file diff --git a/jetty-start/src/test/resources/usecases/basehome/modules/withfiles.mod b/jetty-start/src/test/resources/usecases/basehome/modules/withfiles.mod deleted file mode 100644 index 0dc7d6eed54..00000000000 --- a/jetty-start/src/test/resources/usecases/basehome/modules/withfiles.mod +++ /dev/null @@ -1,12 +0,0 @@ - -[files] - -basehome:modules/withfiles/test.txt|one/renamed.txt -basehome:modules/withfiles/test.txt|two/ -three/ -basehome:modules/withfiles/test.txt|three - -basehome:modules/withfiles -basehome:modules/withfiles/four/|five/ -six/ -basehome:modules/withfiles/four/sub|six diff --git a/jetty-start/src/test/resources/usecases/basehome/modules/withfiles/four/sub/dir/test.txt b/jetty-start/src/test/resources/usecases/basehome/modules/withfiles/four/sub/dir/test.txt deleted file mode 100644 index 6f8178886be..00000000000 --- a/jetty-start/src/test/resources/usecases/basehome/modules/withfiles/four/sub/dir/test.txt +++ /dev/null @@ -1 +0,0 @@ -sub/dir/test.txt diff --git a/jetty-start/src/test/resources/usecases/basehome/modules/withfiles/four/test.txt b/jetty-start/src/test/resources/usecases/basehome/modules/withfiles/four/test.txt deleted file mode 100644 index 4871fd52755..00000000000 --- a/jetty-start/src/test/resources/usecases/basehome/modules/withfiles/four/test.txt +++ /dev/null @@ -1 +0,0 @@ -test.txt diff --git a/jetty-start/src/test/resources/usecases/basehome/modules/withfiles/test.txt b/jetty-start/src/test/resources/usecases/basehome/modules/withfiles/test.txt deleted file mode 100644 index 541cb64f9b8..00000000000 --- a/jetty-start/src/test/resources/usecases/basehome/modules/withfiles/test.txt +++ /dev/null @@ -1 +0,0 @@ -test.txt \ No newline at end of file diff --git a/jetty-start/src/test/resources/usecases/basic-properties.assert.txt b/jetty-start/src/test/resources/usecases/basic-properties.assert.txt deleted file mode 100644 index 4029d09ffb7..00000000000 --- a/jetty-start/src/test/resources/usecases/basic-properties.assert.txt +++ /dev/null @@ -1,22 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 -PROP|port=9090 -PROP|other=value -PROP|jetty.http.port=9090 -PROP|add=beginningmiddleend -PROP|list=one,two,three -PROP|name=value -PROP|name0=/ -PROP|name1=/foo -PROP|name2=/foo/bar -SYS|SYSTEM=value -SYS|PRESET=value \ No newline at end of file diff --git a/jetty-start/src/test/resources/usecases/basic-properties.cmdline.txt b/jetty-start/src/test/resources/usecases/basic-properties.cmdline.txt deleted file mode 100644 index 7dd3bdfacc0..00000000000 --- a/jetty-start/src/test/resources/usecases/basic-properties.cmdline.txt +++ /dev/null @@ -1,16 +0,0 @@ -other=value -port=9090 -add+=beginning -add+=middle -add+=end -list+=,one -list+=,two -list+=,three -name?=value -name?=enoughAlready -name0=/ -name1=${name0}foo -name2=${name1}/bar --DSYSTEM=${name} --DSYSTEM?=IGNORED --DPRESET?=${SYSTEM} \ No newline at end of file diff --git a/jetty-start/src/test/resources/usecases/basic-properties/start.ini b/jetty-start/src/test/resources/usecases/basic-properties/start.ini deleted file mode 100644 index bba0a842966..00000000000 --- a/jetty-start/src/test/resources/usecases/basic-properties/start.ini +++ /dev/null @@ -1,2 +0,0 @@ ---module=main -jetty.http.port=${port} diff --git a/jetty-start/src/test/resources/usecases/database.assert.txt b/jetty-start/src/test/resources/usecases/database.assert.txt deleted file mode 100644 index 9900e1bf186..00000000000 --- a/jetty-start/src/test/resources/usecases/database.assert.txt +++ /dev/null @@ -1,16 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml -XML|${jetty.base}/etc/db.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar -LIB|${jetty.base}/lib/db/bonecp.jar -LIB|${jetty.base}/lib/db/mysql-driver.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 -PROP|mysql.user=frank -PROP|mysql.pass=secret diff --git a/jetty-start/src/test/resources/usecases/database/etc/db.xml b/jetty-start/src/test/resources/usecases/database/etc/db.xml deleted file mode 100644 index 7dd6100e9d5..00000000000 --- a/jetty-start/src/test/resources/usecases/database/etc/db.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/jetty-start/src/test/resources/usecases/database/lib/db/bonecp.jar b/jetty-start/src/test/resources/usecases/database/lib/db/bonecp.jar deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/database/lib/db/mysql-driver.jar b/jetty-start/src/test/resources/usecases/database/lib/db/mysql-driver.jar deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/database/modules/db.mod b/jetty-start/src/test/resources/usecases/database/modules/db.mod deleted file mode 100644 index 5c18f16c6ef..00000000000 --- a/jetty-start/src/test/resources/usecases/database/modules/db.mod +++ /dev/null @@ -1,5 +0,0 @@ -[lib] -lib/db/*.jar - -[xml] -etc/db.xml diff --git a/jetty-start/src/test/resources/usecases/database/start.ini b/jetty-start/src/test/resources/usecases/database/start.ini deleted file mode 100644 index 88fcd097473..00000000000 --- a/jetty-start/src/test/resources/usecases/database/start.ini +++ /dev/null @@ -1,3 +0,0 @@ ---module=main,db -mysql.user=frank -mysql.pass=secret diff --git a/jetty-start/src/test/resources/usecases/dynamic-loop.0.assert.txt b/jetty-start/src/test/resources/usecases/dynamic-loop.0.assert.txt deleted file mode 100644 index 2f38bc2e1b0..00000000000 --- a/jetty-start/src/test/resources/usecases/dynamic-loop.0.assert.txt +++ /dev/null @@ -1,2 +0,0 @@ -EX|CyclicException -EX|cyclic diff --git a/jetty-start/src/test/resources/usecases/dynamic-loop.0.prepare.txt b/jetty-start/src/test/resources/usecases/dynamic-loop.0.prepare.txt deleted file mode 100644 index 535d63e02ec..00000000000 --- a/jetty-start/src/test/resources/usecases/dynamic-loop.0.prepare.txt +++ /dev/null @@ -1,2 +0,0 @@ ---create-startd ---add-to-start=tom diff --git a/jetty-start/src/test/resources/usecases/dynamic-loop.1.assert.txt b/jetty-start/src/test/resources/usecases/dynamic-loop.1.assert.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/dynamic-loop.1.prepare.txt b/jetty-start/src/test/resources/usecases/dynamic-loop.1.prepare.txt deleted file mode 100644 index 3272a6170a8..00000000000 --- a/jetty-start/src/test/resources/usecases/dynamic-loop.1.prepare.txt +++ /dev/null @@ -1 +0,0 @@ ---add-to-start=other diff --git a/jetty-start/src/test/resources/usecases/dynamic-loop/modules/branch.mod b/jetty-start/src/test/resources/usecases/dynamic-loop/modules/branch.mod deleted file mode 100644 index 25d5440a2e7..00000000000 --- a/jetty-start/src/test/resources/usecases/dynamic-loop/modules/branch.mod +++ /dev/null @@ -1,3 +0,0 @@ - -[provides] -branch diff --git a/jetty-start/src/test/resources/usecases/dynamic-loop/modules/dick.mod b/jetty-start/src/test/resources/usecases/dynamic-loop/modules/dick.mod deleted file mode 100644 index 10f9841f6a3..00000000000 --- a/jetty-start/src/test/resources/usecases/dynamic-loop/modules/dick.mod +++ /dev/null @@ -1,3 +0,0 @@ - -[depends] -dynamic/harry diff --git a/jetty-start/src/test/resources/usecases/dynamic-loop/modules/dynamic/harry.mod b/jetty-start/src/test/resources/usecases/dynamic-loop/modules/dynamic/harry.mod deleted file mode 100644 index bf43583356f..00000000000 --- a/jetty-start/src/test/resources/usecases/dynamic-loop/modules/dynamic/harry.mod +++ /dev/null @@ -1,3 +0,0 @@ - -[depends] -tom diff --git a/jetty-start/src/test/resources/usecases/dynamic-loop/modules/other.mod b/jetty-start/src/test/resources/usecases/dynamic-loop/modules/other.mod deleted file mode 100644 index 25d5440a2e7..00000000000 --- a/jetty-start/src/test/resources/usecases/dynamic-loop/modules/other.mod +++ /dev/null @@ -1,3 +0,0 @@ - -[provides] -branch diff --git a/jetty-start/src/test/resources/usecases/dynamic-loop/modules/root.mod b/jetty-start/src/test/resources/usecases/dynamic-loop/modules/root.mod deleted file mode 100644 index 534dffff06b..00000000000 --- a/jetty-start/src/test/resources/usecases/dynamic-loop/modules/root.mod +++ /dev/null @@ -1,3 +0,0 @@ -[depends] -branch - diff --git a/jetty-start/src/test/resources/usecases/dynamic-loop/modules/tom.mod b/jetty-start/src/test/resources/usecases/dynamic-loop/modules/tom.mod deleted file mode 100644 index b1a7e5411d2..00000000000 --- a/jetty-start/src/test/resources/usecases/dynamic-loop/modules/tom.mod +++ /dev/null @@ -1,3 +0,0 @@ - -[depends] -dick diff --git a/jetty-start/src/test/resources/usecases/dynamic-loop/start.ini b/jetty-start/src/test/resources/usecases/dynamic-loop/start.ini deleted file mode 100644 index 9d2989cbe56..00000000000 --- a/jetty-start/src/test/resources/usecases/dynamic-loop/start.ini +++ /dev/null @@ -1 +0,0 @@ ---module=root diff --git a/jetty-start/src/test/resources/usecases/dynamic.0.assert.txt b/jetty-start/src/test/resources/usecases/dynamic.0.assert.txt deleted file mode 100644 index 60fa60adedc..00000000000 --- a/jetty-start/src/test/resources/usecases/dynamic.0.assert.txt +++ /dev/null @@ -1,12 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 -PROP|dynamic=1.7.0_31-from-mod diff --git a/jetty-start/src/test/resources/usecases/dynamic.0.cmdline.txt b/jetty-start/src/test/resources/usecases/dynamic.0.cmdline.txt deleted file mode 100644 index 701e6f82ea1..00000000000 --- a/jetty-start/src/test/resources/usecases/dynamic.0.cmdline.txt +++ /dev/null @@ -1,2 +0,0 @@ -java.version=1.7.0_31 ---module=dynamic diff --git a/jetty-start/src/test/resources/usecases/dynamic.1.assert.txt b/jetty-start/src/test/resources/usecases/dynamic.1.assert.txt deleted file mode 100644 index 8c9fe9a06b3..00000000000 --- a/jetty-start/src/test/resources/usecases/dynamic.1.assert.txt +++ /dev/null @@ -1,12 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 -PROP|dynamic=1.8.0_05_from_mod diff --git a/jetty-start/src/test/resources/usecases/dynamic.1.cmdline.txt b/jetty-start/src/test/resources/usecases/dynamic.1.cmdline.txt deleted file mode 100644 index 31f04b82c77..00000000000 --- a/jetty-start/src/test/resources/usecases/dynamic.1.cmdline.txt +++ /dev/null @@ -1,2 +0,0 @@ -java.version=1.8.0_05 ---module=dynamic diff --git a/jetty-start/src/test/resources/usecases/dynamic/modules/dynamic.mod b/jetty-start/src/test/resources/usecases/dynamic/modules/dynamic.mod deleted file mode 100644 index e20b0780dd6..00000000000 --- a/jetty-start/src/test/resources/usecases/dynamic/modules/dynamic.mod +++ /dev/null @@ -1,3 +0,0 @@ -[depend] -main -impl/dynamic-${java.version} diff --git a/jetty-start/src/test/resources/usecases/dynamic/modules/impl/dynamic-1.7.0_31.mod b/jetty-start/src/test/resources/usecases/dynamic/modules/impl/dynamic-1.7.0_31.mod deleted file mode 100644 index d9d7095e61d..00000000000 --- a/jetty-start/src/test/resources/usecases/dynamic/modules/impl/dynamic-1.7.0_31.mod +++ /dev/null @@ -1,2 +0,0 @@ -[ini] -dynamic=1.7.0_31-from-mod diff --git a/jetty-start/src/test/resources/usecases/dynamic/modules/impl/dynamic-1.8.0_05.mod b/jetty-start/src/test/resources/usecases/dynamic/modules/impl/dynamic-1.8.0_05.mod deleted file mode 100644 index 528e053820a..00000000000 --- a/jetty-start/src/test/resources/usecases/dynamic/modules/impl/dynamic-1.8.0_05.mod +++ /dev/null @@ -1,2 +0,0 @@ -[ini] -dynamic=1.8.0_05_from_mod diff --git a/jetty-start/src/test/resources/usecases/dynamic/start.ini b/jetty-start/src/test/resources/usecases/dynamic/start.ini deleted file mode 100644 index dbfd730d55d..00000000000 --- a/jetty-start/src/test/resources/usecases/dynamic/start.ini +++ /dev/null @@ -1,2 +0,0 @@ ---module=main - diff --git a/jetty-start/src/test/resources/usecases/empty.addToStart.assert.txt b/jetty-start/src/test/resources/usecases/empty.addToStart.assert.txt deleted file mode 100644 index 9b2e1bbaa03..00000000000 --- a/jetty-start/src/test/resources/usecases/empty.addToStart.assert.txt +++ /dev/null @@ -1,22 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/optional.xml -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml -XML|${jetty.home}/etc/extra.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/optional.jar -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar -LIB|${jetty.home}/lib/extra/extra0.jar -LIB|${jetty.home}/lib/extra/extra1.jar - -# The Properties we expect (order is irrelevant) -PROP|extra.prop=value0 -PROP|main.prop=value0 -PROP|optional.prop=value0 - -# Files / Directories to create -EXISTS|maindir/ -EXISTS|start.ini diff --git a/jetty-start/src/test/resources/usecases/empty.addToStart.prepare.txt b/jetty-start/src/test/resources/usecases/empty.addToStart.prepare.txt deleted file mode 100644 index 9edcc1d9225..00000000000 --- a/jetty-start/src/test/resources/usecases/empty.addToStart.prepare.txt +++ /dev/null @@ -1 +0,0 @@ ---add-to-start=extra,optional diff --git a/jetty-start/src/test/resources/usecases/empty.addToStartCreateStartd.assert.txt b/jetty-start/src/test/resources/usecases/empty.addToStartCreateStartd.assert.txt deleted file mode 100644 index 1919711ff0d..00000000000 --- a/jetty-start/src/test/resources/usecases/empty.addToStartCreateStartd.assert.txt +++ /dev/null @@ -1,26 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/optional.xml -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml -XML|${jetty.home}/etc/extra.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/optional.jar -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar -LIB|${jetty.home}/lib/extra/extra0.jar -LIB|${jetty.home}/lib/extra/extra1.jar - -# The Properties we expect (order is irrelevant) -PROP|extra.prop=value0 -PROP|main.prop=value0 -PROP|optional.prop=value0 - -# Files / Directories to create -EXISTS|maindir/ -EXISTS|start.d/extra.ini -EXISTS|start.d/optional.ini - -# Output Assertions [regex!] (order is irrelevant) -OUTPUT|MKDIR : \$\{jetty.base\}[\\/]maindir diff --git a/jetty-start/src/test/resources/usecases/empty.addToStartCreateStartd.prepare.txt b/jetty-start/src/test/resources/usecases/empty.addToStartCreateStartd.prepare.txt deleted file mode 100644 index 082a6aab888..00000000000 --- a/jetty-start/src/test/resources/usecases/empty.addToStartCreateStartd.prepare.txt +++ /dev/null @@ -1,3 +0,0 @@ ---add-to-start=extra ---create-startd ---add-to-start=optional diff --git a/jetty-start/src/test/resources/usecases/empty.createStartd.assert.txt b/jetty-start/src/test/resources/usecases/empty.createStartd.assert.txt deleted file mode 100644 index 91c169d0621..00000000000 --- a/jetty-start/src/test/resources/usecases/empty.createStartd.assert.txt +++ /dev/null @@ -1,24 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/optional.xml -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml -XML|${jetty.home}/etc/extra.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/optional.jar -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar -LIB|${jetty.home}/lib/extra/extra0.jar -LIB|${jetty.home}/lib/extra/extra1.jar - -# The Properties we expect (order is irrelevant) -PROP|extra.prop=value0 -PROP|main.prop=value0 -PROP|optional.prop=value0 - -# Files / Directories to create -EXISTS|maindir/ -EXISTS|start.d/ -EXISTS|start.d/extra.ini -EXISTS|start.d/optional.ini diff --git a/jetty-start/src/test/resources/usecases/empty.createStartd.prepare.txt b/jetty-start/src/test/resources/usecases/empty.createStartd.prepare.txt deleted file mode 100644 index ed259b5c4f3..00000000000 --- a/jetty-start/src/test/resources/usecases/empty.createStartd.prepare.txt +++ /dev/null @@ -1,2 +0,0 @@ ---create-startd ---add-to-start=extra,optional diff --git a/jetty-start/src/test/resources/usecases/empty/unrelated.txt b/jetty-start/src/test/resources/usecases/empty/unrelated.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/files.0.assert.txt b/jetty-start/src/test/resources/usecases/files.0.assert.txt deleted file mode 100644 index e557ff88854..00000000000 --- a/jetty-start/src/test/resources/usecases/files.0.assert.txt +++ /dev/null @@ -1,2 +0,0 @@ -DOWNLOAD|basehome:modules/demo/demo-config.xml|etc/demo-config.xml -EXISTS|etc/demo-config.xml diff --git a/jetty-start/src/test/resources/usecases/files.0.prepare.txt b/jetty-start/src/test/resources/usecases/files.0.prepare.txt deleted file mode 100644 index aee9122e2d0..00000000000 --- a/jetty-start/src/test/resources/usecases/files.0.prepare.txt +++ /dev/null @@ -1,2 +0,0 @@ ---create-startd ---add-to-start=demo diff --git a/jetty-start/src/test/resources/usecases/files/modules/demo.mod b/jetty-start/src/test/resources/usecases/files/modules/demo.mod deleted file mode 100644 index 20ad673c9fc..00000000000 --- a/jetty-start/src/test/resources/usecases/files/modules/demo.mod +++ /dev/null @@ -1,3 +0,0 @@ - -[files] -basehome:modules/demo/demo-config.xml|etc/demo-config.xml diff --git a/jetty-start/src/test/resources/usecases/files/modules/demo/demo-config.xml b/jetty-start/src/test/resources/usecases/files/modules/demo/demo-config.xml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/loop.assert.txt b/jetty-start/src/test/resources/usecases/loop.assert.txt deleted file mode 100644 index 2f38bc2e1b0..00000000000 --- a/jetty-start/src/test/resources/usecases/loop.assert.txt +++ /dev/null @@ -1,2 +0,0 @@ -EX|CyclicException -EX|cyclic diff --git a/jetty-start/src/test/resources/usecases/loop.prepare.txt b/jetty-start/src/test/resources/usecases/loop.prepare.txt deleted file mode 100644 index 535d63e02ec..00000000000 --- a/jetty-start/src/test/resources/usecases/loop.prepare.txt +++ /dev/null @@ -1,2 +0,0 @@ ---create-startd ---add-to-start=tom diff --git a/jetty-start/src/test/resources/usecases/loop/modules/branch.mod b/jetty-start/src/test/resources/usecases/loop/modules/branch.mod deleted file mode 100644 index 25d5440a2e7..00000000000 --- a/jetty-start/src/test/resources/usecases/loop/modules/branch.mod +++ /dev/null @@ -1,3 +0,0 @@ - -[provides] -branch diff --git a/jetty-start/src/test/resources/usecases/loop/modules/dick.mod b/jetty-start/src/test/resources/usecases/loop/modules/dick.mod deleted file mode 100644 index 01b257934f6..00000000000 --- a/jetty-start/src/test/resources/usecases/loop/modules/dick.mod +++ /dev/null @@ -1,2 +0,0 @@ -[depends] -harry diff --git a/jetty-start/src/test/resources/usecases/loop/modules/harry.mod b/jetty-start/src/test/resources/usecases/loop/modules/harry.mod deleted file mode 100644 index bf43583356f..00000000000 --- a/jetty-start/src/test/resources/usecases/loop/modules/harry.mod +++ /dev/null @@ -1,3 +0,0 @@ - -[depends] -tom diff --git a/jetty-start/src/test/resources/usecases/loop/modules/other.mod b/jetty-start/src/test/resources/usecases/loop/modules/other.mod deleted file mode 100644 index 25d5440a2e7..00000000000 --- a/jetty-start/src/test/resources/usecases/loop/modules/other.mod +++ /dev/null @@ -1,3 +0,0 @@ - -[provides] -branch diff --git a/jetty-start/src/test/resources/usecases/loop/modules/root.mod b/jetty-start/src/test/resources/usecases/loop/modules/root.mod deleted file mode 100644 index 534dffff06b..00000000000 --- a/jetty-start/src/test/resources/usecases/loop/modules/root.mod +++ /dev/null @@ -1,3 +0,0 @@ -[depends] -branch - diff --git a/jetty-start/src/test/resources/usecases/loop/modules/tom.mod b/jetty-start/src/test/resources/usecases/loop/modules/tom.mod deleted file mode 100644 index b1a7e5411d2..00000000000 --- a/jetty-start/src/test/resources/usecases/loop/modules/tom.mod +++ /dev/null @@ -1,3 +0,0 @@ - -[depends] -dick diff --git a/jetty-start/src/test/resources/usecases/loop/start.ini b/jetty-start/src/test/resources/usecases/loop/start.ini deleted file mode 100644 index 9d2989cbe56..00000000000 --- a/jetty-start/src/test/resources/usecases/loop/start.ini +++ /dev/null @@ -1 +0,0 @@ ---module=root diff --git a/jetty-start/src/test/resources/usecases/ordered-provided.0.assert.txt b/jetty-start/src/test/resources/usecases/ordered-provided.0.assert.txt deleted file mode 100644 index d56b1b3c87b..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered-provided.0.assert.txt +++ /dev/null @@ -1,7 +0,0 @@ - -PROP|implA=implA -PROP|implB=implB - -## The XMLs we expect (order is important) -XML|${jetty.base}/etc/implB.xml -XML|${jetty.base}/etc/implA.xml diff --git a/jetty-start/src/test/resources/usecases/ordered-provided.0.prepare.txt b/jetty-start/src/test/resources/usecases/ordered-provided.0.prepare.txt deleted file mode 100644 index 9e5a1ad839e..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered-provided.0.prepare.txt +++ /dev/null @@ -1,2 +0,0 @@ ---create-startd ---add-to-start=abstractB,abstractA diff --git a/jetty-start/src/test/resources/usecases/ordered-provided/etc/implA.xml b/jetty-start/src/test/resources/usecases/ordered-provided/etc/implA.xml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/ordered-provided/etc/implB.xml b/jetty-start/src/test/resources/usecases/ordered-provided/etc/implB.xml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/ordered-provided/modules/abstractA.mod b/jetty-start/src/test/resources/usecases/ordered-provided/modules/abstractA.mod deleted file mode 100644 index 9c5870750db..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered-provided/modules/abstractA.mod +++ /dev/null @@ -1,9 +0,0 @@ - -[depend] -dynamic/${implA} - -[ini] -implA=implA - -[ini-template] -implA=implA diff --git a/jetty-start/src/test/resources/usecases/ordered-provided/modules/abstractB.mod b/jetty-start/src/test/resources/usecases/ordered-provided/modules/abstractB.mod deleted file mode 100644 index 65a07296272..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered-provided/modules/abstractB.mod +++ /dev/null @@ -1,12 +0,0 @@ - -[depend] -dynamic/${implB} - -[provide] -provided - -[ini] -implB=implB - -[ini-template] -implB=implB diff --git a/jetty-start/src/test/resources/usecases/ordered-provided/modules/dynamic/implA.mod b/jetty-start/src/test/resources/usecases/ordered-provided/modules/dynamic/implA.mod deleted file mode 100644 index 7665d845a96..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered-provided/modules/dynamic/implA.mod +++ /dev/null @@ -1,6 +0,0 @@ - -[depend] -provided - -[xml] -etc/implA.xml diff --git a/jetty-start/src/test/resources/usecases/ordered-provided/modules/dynamic/implB.mod b/jetty-start/src/test/resources/usecases/ordered-provided/modules/dynamic/implB.mod deleted file mode 100644 index 58740f4bde2..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered-provided/modules/dynamic/implB.mod +++ /dev/null @@ -1,3 +0,0 @@ - -[xml] -etc/implB.xml diff --git a/jetty-start/src/test/resources/usecases/ordered.0.assert.txt b/jetty-start/src/test/resources/usecases/ordered.0.assert.txt deleted file mode 100644 index 985deb25075..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered.0.assert.txt +++ /dev/null @@ -1,3 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.base}/etc/alternateA.xml -XML|${jetty.base}/etc/dependent.xml diff --git a/jetty-start/src/test/resources/usecases/ordered.0.cmdline.txt b/jetty-start/src/test/resources/usecases/ordered.0.cmdline.txt deleted file mode 100644 index e1055d04891..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered.0.cmdline.txt +++ /dev/null @@ -1,2 +0,0 @@ ---module=alternateA,dependent - diff --git a/jetty-start/src/test/resources/usecases/ordered.1.assert.txt b/jetty-start/src/test/resources/usecases/ordered.1.assert.txt deleted file mode 100644 index 985deb25075..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered.1.assert.txt +++ /dev/null @@ -1,3 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.base}/etc/alternateA.xml -XML|${jetty.base}/etc/dependent.xml diff --git a/jetty-start/src/test/resources/usecases/ordered.1.cmdline.txt b/jetty-start/src/test/resources/usecases/ordered.1.cmdline.txt deleted file mode 100644 index f738f97b255..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered.1.cmdline.txt +++ /dev/null @@ -1,2 +0,0 @@ ---module=dependent,alternateA - diff --git a/jetty-start/src/test/resources/usecases/ordered.2.assert.txt b/jetty-start/src/test/resources/usecases/ordered.2.assert.txt deleted file mode 100644 index 4dce98fbdd0..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered.2.assert.txt +++ /dev/null @@ -1 +0,0 @@ -EX|UsageException: Unsatisfied module dependencies diff --git a/jetty-start/src/test/resources/usecases/ordered.2.cmdline.txt b/jetty-start/src/test/resources/usecases/ordered.2.cmdline.txt deleted file mode 100644 index d4ea47f677c..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered.2.cmdline.txt +++ /dev/null @@ -1 +0,0 @@ ---module=dependent diff --git a/jetty-start/src/test/resources/usecases/ordered.default.assert.txt b/jetty-start/src/test/resources/usecases/ordered.default.assert.txt deleted file mode 100644 index 80ab7490ced..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered.default.assert.txt +++ /dev/null @@ -1,12 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 -PROP|impl=replacement diff --git a/jetty-start/src/test/resources/usecases/ordered.default.cmdline.txt b/jetty-start/src/test/resources/usecases/ordered.default.cmdline.txt deleted file mode 100644 index 7224543a10f..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered.default.cmdline.txt +++ /dev/null @@ -1,2 +0,0 @@ ---module=main,convenience - diff --git a/jetty-start/src/test/resources/usecases/ordered/etc/alternateA.xml b/jetty-start/src/test/resources/usecases/ordered/etc/alternateA.xml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/ordered/etc/alternateB.xml b/jetty-start/src/test/resources/usecases/ordered/etc/alternateB.xml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/ordered/etc/dependent.xml b/jetty-start/src/test/resources/usecases/ordered/etc/dependent.xml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/ordered/modules/alternateA.mod b/jetty-start/src/test/resources/usecases/ordered/modules/alternateA.mod deleted file mode 100644 index e54d5bafffd..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered/modules/alternateA.mod +++ /dev/null @@ -1,5 +0,0 @@ -[provides] -alternate - -[xml] -etc/alternateA.xml diff --git a/jetty-start/src/test/resources/usecases/ordered/modules/alternateB.mod b/jetty-start/src/test/resources/usecases/ordered/modules/alternateB.mod deleted file mode 100644 index 2b358aecd25..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered/modules/alternateB.mod +++ /dev/null @@ -1,5 +0,0 @@ -[provides] -alternate - -[xml] -etc/alternateB.xml diff --git a/jetty-start/src/test/resources/usecases/ordered/modules/convenience.mod b/jetty-start/src/test/resources/usecases/ordered/modules/convenience.mod deleted file mode 100644 index 98189f32d57..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered/modules/convenience.mod +++ /dev/null @@ -1,4 +0,0 @@ - -[depends] -replacement -something-else diff --git a/jetty-start/src/test/resources/usecases/ordered/modules/dependent.mod b/jetty-start/src/test/resources/usecases/ordered/modules/dependent.mod deleted file mode 100644 index 7254e99dc08..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered/modules/dependent.mod +++ /dev/null @@ -1,5 +0,0 @@ -[depends] -alternate - -[xml] -etc/dependent.xml diff --git a/jetty-start/src/test/resources/usecases/ordered/modules/original.mod b/jetty-start/src/test/resources/usecases/ordered/modules/original.mod deleted file mode 100644 index a8f0ed9a779..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered/modules/original.mod +++ /dev/null @@ -1,4 +0,0 @@ - - -[ini] -impl=original diff --git a/jetty-start/src/test/resources/usecases/ordered/modules/replacement.mod b/jetty-start/src/test/resources/usecases/ordered/modules/replacement.mod deleted file mode 100644 index aea4b1365d3..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered/modules/replacement.mod +++ /dev/null @@ -1,7 +0,0 @@ - - -[provides] -original - -[ini] -impl=replacement diff --git a/jetty-start/src/test/resources/usecases/ordered/modules/something-else.mod b/jetty-start/src/test/resources/usecases/ordered/modules/something-else.mod deleted file mode 100644 index 506f5be7313..00000000000 --- a/jetty-start/src/test/resources/usecases/ordered/modules/something-else.mod +++ /dev/null @@ -1,3 +0,0 @@ - -[depends] -original diff --git a/jetty-start/src/test/resources/usecases/parameterized.addToStart.assert.txt b/jetty-start/src/test/resources/usecases/parameterized.addToStart.assert.txt deleted file mode 100644 index 46344a3d993..00000000000 --- a/jetty-start/src/test/resources/usecases/parameterized.addToStart.assert.txt +++ /dev/null @@ -1,20 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 -PROP|name=value -PROP|name0=changed0 -PROP|name1=changed1 -PROP|name2=two -PROP|property=value -PROP|property0=value0 - -# Files / Directories to create -EXISTS|start.d/parameterized.ini diff --git a/jetty-start/src/test/resources/usecases/parameterized.addToStart.prepare.txt b/jetty-start/src/test/resources/usecases/parameterized.addToStart.prepare.txt deleted file mode 100644 index 21c57a43d84..00000000000 --- a/jetty-start/src/test/resources/usecases/parameterized.addToStart.prepare.txt +++ /dev/null @@ -1,6 +0,0 @@ ---create-startd -other=value -name=changed -name0=changed0 -name1=changed1 ---add-to-start=parameterized diff --git a/jetty-start/src/test/resources/usecases/parameterized.commands.assert.txt b/jetty-start/src/test/resources/usecases/parameterized.commands.assert.txt deleted file mode 100644 index 46344a3d993..00000000000 --- a/jetty-start/src/test/resources/usecases/parameterized.commands.assert.txt +++ /dev/null @@ -1,20 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 -PROP|name=value -PROP|name0=changed0 -PROP|name1=changed1 -PROP|name2=two -PROP|property=value -PROP|property0=value0 - -# Files / Directories to create -EXISTS|start.d/parameterized.ini diff --git a/jetty-start/src/test/resources/usecases/parameterized.commands.prepare.txt b/jetty-start/src/test/resources/usecases/parameterized.commands.prepare.txt deleted file mode 100644 index 62d85fc6724..00000000000 --- a/jetty-start/src/test/resources/usecases/parameterized.commands.prepare.txt +++ /dev/null @@ -1,4 +0,0 @@ ---create-startd -other=value -name=changed ---commands=etc/commands.txt diff --git a/jetty-start/src/test/resources/usecases/parameterized.update.assert.txt b/jetty-start/src/test/resources/usecases/parameterized.update.assert.txt deleted file mode 100644 index a581efdad66..00000000000 --- a/jetty-start/src/test/resources/usecases/parameterized.update.assert.txt +++ /dev/null @@ -1,21 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 -PROP|name=value -PROP|name0=updated0 -PROP|name1=changed1 -PROP|name2=two -PROP|property=value -PROP|property0=changed0 -PROP|property1=changed1 - -# Files / Directories to create -EXISTS|start.d/parameterized.ini diff --git a/jetty-start/src/test/resources/usecases/parameterized.update.prepare.txt b/jetty-start/src/test/resources/usecases/parameterized.update.prepare.txt deleted file mode 100644 index 86a278a1792..00000000000 --- a/jetty-start/src/test/resources/usecases/parameterized.update.prepare.txt +++ /dev/null @@ -1,11 +0,0 @@ ---create-startd -other=value -name=changed -name0=changed0 -name1=changed1 ---add-to-start=parameterized - ---update-ini -property0=changed0 -property1=changed1 -name0=updated0 \ No newline at end of file diff --git a/jetty-start/src/test/resources/usecases/parameterized/etc/commands.txt b/jetty-start/src/test/resources/usecases/parameterized/etc/commands.txt deleted file mode 100644 index aa292749197..00000000000 --- a/jetty-start/src/test/resources/usecases/parameterized/etc/commands.txt +++ /dev/null @@ -1,5 +0,0 @@ -name0=changed0 -name1=changed1 ---add-to-start=parameterized - -# ignore this \ No newline at end of file diff --git a/jetty-start/src/test/resources/usecases/parameterized/modules/parameterized.mod b/jetty-start/src/test/resources/usecases/parameterized/modules/parameterized.mod deleted file mode 100644 index 7d09c7e9fe9..00000000000 --- a/jetty-start/src/test/resources/usecases/parameterized/modules/parameterized.mod +++ /dev/null @@ -1,13 +0,0 @@ - -[depend] -main - -[ini] -name=value -name0?=default -name2?=two - -[ini-template] -name0=value0 -# name1=value1 -# name2=too diff --git a/jetty-start/src/test/resources/usecases/parameterized/start.d/tobeupdated.ini b/jetty-start/src/test/resources/usecases/parameterized/start.d/tobeupdated.ini deleted file mode 100644 index b2f0d878754..00000000000 --- a/jetty-start/src/test/resources/usecases/parameterized/start.d/tobeupdated.ini +++ /dev/null @@ -1,7 +0,0 @@ - -#p=v -property=value -#comment -property0=value0 -#comment -#property1=value1 diff --git a/jetty-start/src/test/resources/usecases/transientWithIniTemplate.assert.txt b/jetty-start/src/test/resources/usecases/transientWithIniTemplate.assert.txt deleted file mode 100644 index 75c1f6f93f0..00000000000 --- a/jetty-start/src/test/resources/usecases/transientWithIniTemplate.assert.txt +++ /dev/null @@ -1,14 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml -XML|${jetty.base}/etc/t.xml -XML|${jetty.base}/etc/d.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 -PROP|direct.option=direct diff --git a/jetty-start/src/test/resources/usecases/transientWithIniTemplate.prepare.txt b/jetty-start/src/test/resources/usecases/transientWithIniTemplate.prepare.txt deleted file mode 100644 index 7f35c5fd872..00000000000 --- a/jetty-start/src/test/resources/usecases/transientWithIniTemplate.prepare.txt +++ /dev/null @@ -1 +0,0 @@ ---add-to-start=direct diff --git a/jetty-start/src/test/resources/usecases/transientWithIniTemplate/etc/d.xml b/jetty-start/src/test/resources/usecases/transientWithIniTemplate/etc/d.xml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/transientWithIniTemplate/etc/t.xml b/jetty-start/src/test/resources/usecases/transientWithIniTemplate/etc/t.xml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/transientWithIniTemplate/modules/direct.mod b/jetty-start/src/test/resources/usecases/transientWithIniTemplate/modules/direct.mod deleted file mode 100644 index 7bd97a0bde2..00000000000 --- a/jetty-start/src/test/resources/usecases/transientWithIniTemplate/modules/direct.mod +++ /dev/null @@ -1,8 +0,0 @@ -[xml] -etc/d.xml - -[depend] -transient - -[ini-template] -direct.option=direct diff --git a/jetty-start/src/test/resources/usecases/transientWithIniTemplate/modules/transient.mod b/jetty-start/src/test/resources/usecases/transientWithIniTemplate/modules/transient.mod deleted file mode 100644 index 05fb78407ea..00000000000 --- a/jetty-start/src/test/resources/usecases/transientWithIniTemplate/modules/transient.mod +++ /dev/null @@ -1,5 +0,0 @@ -[xml] -etc/t.xml - -[optional] -main diff --git a/jetty-start/src/test/resources/usecases/transientWithIniTemplate/start.ini b/jetty-start/src/test/resources/usecases/transientWithIniTemplate/start.ini deleted file mode 100644 index dbfd730d55d..00000000000 --- a/jetty-start/src/test/resources/usecases/transientWithIniTemplate/start.ini +++ /dev/null @@ -1,2 +0,0 @@ ---module=main - diff --git a/jetty-start/src/test/resources/usecases/transientWithoutIniTemplate.assert.txt b/jetty-start/src/test/resources/usecases/transientWithoutIniTemplate.assert.txt deleted file mode 100644 index 01e9c2e6340..00000000000 --- a/jetty-start/src/test/resources/usecases/transientWithoutIniTemplate.assert.txt +++ /dev/null @@ -1,15 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml -XML|${jetty.base}/etc/t.xml -XML|${jetty.base}/etc/d.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 -PROP|transient.option=transient -PROP|direct.option=direct diff --git a/jetty-start/src/test/resources/usecases/transientWithoutIniTemplate.prepare.txt b/jetty-start/src/test/resources/usecases/transientWithoutIniTemplate.prepare.txt deleted file mode 100644 index 7f35c5fd872..00000000000 --- a/jetty-start/src/test/resources/usecases/transientWithoutIniTemplate.prepare.txt +++ /dev/null @@ -1 +0,0 @@ ---add-to-start=direct diff --git a/jetty-start/src/test/resources/usecases/transientWithoutIniTemplate/etc/d.xml b/jetty-start/src/test/resources/usecases/transientWithoutIniTemplate/etc/d.xml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/transientWithoutIniTemplate/etc/t.xml b/jetty-start/src/test/resources/usecases/transientWithoutIniTemplate/etc/t.xml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/jetty-start/src/test/resources/usecases/transientWithoutIniTemplate/modules/direct.mod b/jetty-start/src/test/resources/usecases/transientWithoutIniTemplate/modules/direct.mod deleted file mode 100644 index 7bd97a0bde2..00000000000 --- a/jetty-start/src/test/resources/usecases/transientWithoutIniTemplate/modules/direct.mod +++ /dev/null @@ -1,8 +0,0 @@ -[xml] -etc/d.xml - -[depend] -transient - -[ini-template] -direct.option=direct diff --git a/jetty-start/src/test/resources/usecases/transientWithoutIniTemplate/modules/transient.mod b/jetty-start/src/test/resources/usecases/transientWithoutIniTemplate/modules/transient.mod deleted file mode 100644 index 57a3e004817..00000000000 --- a/jetty-start/src/test/resources/usecases/transientWithoutIniTemplate/modules/transient.mod +++ /dev/null @@ -1,11 +0,0 @@ -[xml] -etc/t.xml - -[optional] -main - -[ini] -transient.option=transient - -[ini-template] -transient.option=transient diff --git a/jetty-start/src/test/resources/usecases/transientWithoutIniTemplate/start.ini b/jetty-start/src/test/resources/usecases/transientWithoutIniTemplate/start.ini deleted file mode 100644 index dbfd730d55d..00000000000 --- a/jetty-start/src/test/resources/usecases/transientWithoutIniTemplate/start.ini +++ /dev/null @@ -1,2 +0,0 @@ ---module=main - diff --git a/jetty-start/src/test/resources/usecases/versioned-modules.assert.txt b/jetty-start/src/test/resources/usecases/versioned-modules.assert.txt deleted file mode 100644 index fd338cf84d2..00000000000 --- a/jetty-start/src/test/resources/usecases/versioned-modules.assert.txt +++ /dev/null @@ -1,13 +0,0 @@ -## The XMLs we expect (order is important) -XML|${jetty.home}/etc/base.xml -XML|${jetty.home}/etc/main.xml - -# The LIBs we expect (order is irrelevant) -LIB|${jetty.home}/lib/base.jar -LIB|${jetty.home}/lib/main.jar -LIB|${jetty.home}/lib/other.jar - -# The Properties we expect (order is irrelevant) -PROP|main.prop=value0 -PROP|the-future=is-new -PROP|from-module=old diff --git a/jetty-start/src/test/resources/usecases/versioned-modules/modules/new.mod b/jetty-start/src/test/resources/usecases/versioned-modules/modules/new.mod deleted file mode 100644 index 5d64f09365c..00000000000 --- a/jetty-start/src/test/resources/usecases/versioned-modules/modules/new.mod +++ /dev/null @@ -1,7 +0,0 @@ - -[version] -9.3 - -[ini] -the-future=is-new - diff --git a/jetty-start/src/test/resources/usecases/versioned-modules/modules/old.mod b/jetty-start/src/test/resources/usecases/versioned-modules/modules/old.mod deleted file mode 100644 index 2307ce0631c..00000000000 --- a/jetty-start/src/test/resources/usecases/versioned-modules/modules/old.mod +++ /dev/null @@ -1,4 +0,0 @@ - -[defaults] -from-module=old - diff --git a/jetty-start/src/test/resources/usecases/versioned-modules/start.ini b/jetty-start/src/test/resources/usecases/versioned-modules/start.ini deleted file mode 100644 index 2487e21eb6c..00000000000 --- a/jetty-start/src/test/resources/usecases/versioned-modules/start.ini +++ /dev/null @@ -1,3 +0,0 @@ ---module=main ---module=old ---module=new