From 0f6933fca1ab3d2921fc0d5839615e59048108a5 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Sat, 16 Apr 2016 23:04:14 +1000 Subject: [PATCH] Issue #515 Alternate start modules Allow enable when provided capability from transient sort usecases --- .../src/main/java/org/eclipse/jetty/start/Modules.java | 4 ++-- .../src/test/java/org/eclipse/jetty/start/TestUseCases.java | 3 ++- .../src/test/resources/usecases/alternate.3.assert.txt | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java index c77f730b85b..2200e28d8b5 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java @@ -234,8 +234,8 @@ public class Modules implements Iterable { providers.forEach(p-> { - if (p!=module && p.isEnabled()) - throw new UsageException("Module %s capability %s already provided by %s",module.getName(),name,p.getName()); + if (p!=module && p.isEnabled() && !p.isTransitive()) + throw new UsageException("Capability %s already enabled by %s for %s",name,p.getName(),module.getName()); }); } } 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 index 2bb04812adc..e050113f118 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/TestUseCases.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/TestUseCases.java @@ -27,7 +27,6 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.stream.Collectors; import org.eclipse.jetty.toolchain.test.IO; import org.eclipse.jetty.toolchain.test.MavenTestingUtils; @@ -58,6 +57,8 @@ public class TestUseCases } }); + Arrays.sort(cases); + List ret = new ArrayList<>(); for(File assertTxt:cases) { diff --git a/jetty-start/src/test/resources/usecases/alternate.3.assert.txt b/jetty-start/src/test/resources/usecases/alternate.3.assert.txt index 8400499c6c2..6a83f84eb75 100644 --- a/jetty-start/src/test/resources/usecases/alternate.3.assert.txt +++ b/jetty-start/src/test/resources/usecases/alternate.3.assert.txt @@ -1,2 +1,2 @@ EX|UsageException -EX|default already provided by alternate +EX|default already enabled by alternate