Merge remote-tracking branch 'origin/jetty-9.4.x'
This commit is contained in:
commit
a098b587bc
|
@ -197,6 +197,10 @@ public class Modules implements Iterable<Module>
|
|||
Module dependency = _names.get(name);
|
||||
if (dependency!=null)
|
||||
sort.addDependency(module,dependency);
|
||||
|
||||
Set<Module> provided = _provided.get(name);
|
||||
if (provided!=null)
|
||||
provided.forEach(p->sort.addDependency(module,p));
|
||||
};
|
||||
module.getDepends().forEach(add);
|
||||
module.getOptional().forEach(add);
|
||||
|
|
|
@ -35,6 +35,7 @@ import java.util.Set;
|
|||
|
||||
import org.eclipse.jetty.start.Props.Prop;
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Assert;
|
||||
|
||||
public class ConfigurationAssert
|
||||
|
@ -191,113 +192,34 @@ public class ConfigurationAssert
|
|||
|
||||
public static void assertContainsUnordered(String msg, Collection<String> expectedSet, Collection<String> actualSet)
|
||||
{
|
||||
// same size?
|
||||
boolean mismatch = expectedSet.size() != actualSet.size();
|
||||
|
||||
// test content
|
||||
Set<String> missing = new HashSet<>();
|
||||
for (String expected : expectedSet)
|
||||
try
|
||||
{
|
||||
if (!actualSet.contains(expected))
|
||||
{
|
||||
missing.add(expected);
|
||||
}
|
||||
Assert.assertEquals(msg,expectedSet.size(),actualSet.size());
|
||||
if (!expectedSet.isEmpty())
|
||||
Assert.assertThat(msg,actualSet,Matchers.containsInAnyOrder(expectedSet.toArray()));
|
||||
}
|
||||
catch(AssertionError e)
|
||||
{
|
||||
System.err.println("Expected: "+expectedSet);
|
||||
System.err.println("Actual : "+actualSet);
|
||||
throw e;
|
||||
}
|
||||
|
||||
if (mismatch || missing.size() > 0)
|
||||
{
|
||||
// build up detailed error message
|
||||
StringWriter message = new StringWriter();
|
||||
PrintWriter err = new PrintWriter(message);
|
||||
|
||||
err.printf("%s: Assert Contains (Unordered)",msg);
|
||||
if (mismatch)
|
||||
{
|
||||
err.print(" [size mismatch]");
|
||||
}
|
||||
if (missing.size() >= 0)
|
||||
{
|
||||
err.printf(" [%d entries missing]",missing.size());
|
||||
}
|
||||
err.println();
|
||||
err.printf("Actual Entries (size: %d)%n",actualSet.size());
|
||||
for (String actual : actualSet)
|
||||
{
|
||||
char indicator = expectedSet.contains(actual)?' ':'>';
|
||||
err.printf("%s| %s%n",indicator,actual);
|
||||
}
|
||||
err.printf("Expected Entries (size: %d)%n",expectedSet.size());
|
||||
for (String expected : expectedSet)
|
||||
{
|
||||
char indicator = actualSet.contains(expected)?' ':'>';
|
||||
err.printf("%s| %s%n",indicator,expected);
|
||||
}
|
||||
err.flush();
|
||||
Assert.fail(message.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public static void assertOrdered(String msg, List<String> expectedList, List<String> actualList)
|
||||
{
|
||||
// same size?
|
||||
boolean size_mismatch = expectedList.size() != actualList.size();
|
||||
boolean mismatch=size_mismatch;
|
||||
|
||||
// test content
|
||||
List<Integer> badEntries = new ArrayList<>();
|
||||
int min = Math.min(expectedList.size(),actualList.size());
|
||||
int max = Math.max(expectedList.size(),actualList.size());
|
||||
for (int i = 0; i < min; i++)
|
||||
try
|
||||
{
|
||||
if (!expectedList.get(i).equals(actualList.get(i)))
|
||||
{
|
||||
badEntries.add(i);
|
||||
}
|
||||
Assert.assertEquals(msg,expectedList.size(),actualList.size());
|
||||
if (!expectedList.isEmpty())
|
||||
Assert.assertThat(msg,actualList,Matchers.contains(expectedList.toArray()));
|
||||
}
|
||||
for (int i = min; i < max; i++)
|
||||
catch(AssertionError e)
|
||||
{
|
||||
badEntries.add(i);
|
||||
}
|
||||
|
||||
if (mismatch || badEntries.size() > 0)
|
||||
{
|
||||
// build up detailed error message
|
||||
StringWriter message = new StringWriter();
|
||||
PrintWriter err = new PrintWriter(message);
|
||||
|
||||
if (!size_mismatch)
|
||||
err.println("WARNING ONLY: Ordering tests need review!");
|
||||
|
||||
err.printf("%s: Assert Contains (Unordered)",msg);
|
||||
if (mismatch)
|
||||
{
|
||||
err.print(" [size mismatch]");
|
||||
}
|
||||
if (badEntries.size() >= 0)
|
||||
{
|
||||
err.printf(" [%d entries not matched]",badEntries.size());
|
||||
}
|
||||
err.println();
|
||||
err.printf("Actual Entries (size: %d)%n",actualList.size());
|
||||
for (int i = 0; i < actualList.size(); i++)
|
||||
{
|
||||
String actual = actualList.get(i);
|
||||
char indicator = badEntries.contains(i)?'>':' ';
|
||||
err.printf("%s[%d] %s%n",indicator,i,actual);
|
||||
}
|
||||
|
||||
err.printf("Expected Entries (size: %d)%n",expectedList.size());
|
||||
for (int i = 0; i < expectedList.size(); i++)
|
||||
{
|
||||
String expected = expectedList.get(i);
|
||||
char indicator = badEntries.contains(i)?'>':' ';
|
||||
err.printf("%s[%d] %s%n",indicator,i,expected);
|
||||
}
|
||||
err.flush();
|
||||
|
||||
// TODO fix the order checking to allow alternate orders that comply with graph
|
||||
if (size_mismatch)
|
||||
Assert.fail(message.toString());
|
||||
System.err.println("Expected: "+expectedList);
|
||||
System.err.println("Actual : "+actualList);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## 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|etc/optional.xml
|
||||
|
||||
# The LIBs we expect (order is irrelevant)
|
||||
LIB|${jetty.home}/lib/base.jar
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
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
|
|
@ -0,0 +1 @@
|
|||
--add-to-startd=abstractB,abstractA
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
[depend]
|
||||
dynamic/${implA}
|
||||
|
||||
[ini]
|
||||
implA=implA
|
||||
|
||||
[ini-template]
|
||||
implA=implA
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
[depend]
|
||||
dynamic/${implB}
|
||||
|
||||
[provide]
|
||||
provided
|
||||
|
||||
[ini]
|
||||
implB=implB
|
||||
|
||||
[ini-template]
|
||||
implB=implB
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
[depend]
|
||||
provided
|
||||
|
||||
[xml]
|
||||
etc/implA.xml
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
[xml]
|
||||
etc/implB.xml
|
|
@ -1,3 +1,3 @@
|
|||
## The XMLs we expect (order is important)
|
||||
XML|${jetty.base}/etc/dependent.xml
|
||||
XML|${jetty.base}/etc/alternateA.xml
|
||||
XML|${jetty.base}/etc/dependent.xml
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
## The XMLs we expect (order is important)
|
||||
XML|${jetty.base}/etc/dependent.xml
|
||||
XML|${jetty.base}/etc/alternateA.xml
|
||||
XML|${jetty.base}/etc/dependent.xml
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
## The XMLs we expect (order is important)
|
||||
XML|${jetty.home}/etc/base.xml
|
||||
XML|${jetty.home}/etc/main.xml
|
||||
XML|etc/t.xml
|
||||
XML|etc/d.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
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
## The XMLs we expect (order is important)
|
||||
XML|${jetty.home}/etc/base.xml
|
||||
XML|${jetty.home}/etc/main.xml
|
||||
XML|etc/t.xml
|
||||
XML|etc/d.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
|
||||
|
|
Loading…
Reference in New Issue