This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push: new 44a3b5cde4 Reduce duplication 44a3b5cde4 is described below commit 44a3b5cde4d621c5169ee1e0bed8d53c5a767da2 Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu Dec 12 11:22:44 2024 +0000 Reduce duplication --- ...efaultServletRfc9110Section13Parameterized.java | 68 ++++++++-------------- 1 file changed, 25 insertions(+), 43 deletions(-) diff --git a/test/org/apache/catalina/servlets/TestDefaultServletRfc9110Section13Parameterized.java b/test/org/apache/catalina/servlets/TestDefaultServletRfc9110Section13Parameterized.java index 88a0d46d96..3347be5fbe 100644 --- a/test/org/apache/catalina/servlets/TestDefaultServletRfc9110Section13Parameterized.java +++ b/test/org/apache/catalina/servlets/TestDefaultServletRfc9110Section13Parameterized.java @@ -68,49 +68,31 @@ public class TestDefaultServletRfc9110Section13Parameterized extends TomcatBaseT @Parameterized.Parameters(name = "{index} resource-strong [{0}], matchHeader [{1}]") public static Collection<Object[]> parameters() { List<Object[]> parameterSets = new ArrayList<>(); - // testPreconditions_rfc9110_13_2_2_1_head0 - parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, EtagPrecondition.ALL, null, null, null, - null, Boolean.FALSE, SC_200 }); - parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, EtagPrecondition.EXACTLY, null, null, null, - null, Boolean.FALSE, SC_200 }); - parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, EtagPrecondition.IN, null, null, null, - null, Boolean.FALSE, SC_200 }); - parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, EtagPrecondition.NOT_IN, null, null, null, - null, Boolean.FALSE, SC_412 }); - parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, EtagPrecondition.INVALID_ALL_PLUS_OTHER, - null, null, null, null, Boolean.FALSE, SC_400 }); - - parameterSets.add(new Object[] { Boolean.FALSE, Task.HEAD_INDEX_HTML, EtagPrecondition.ALL, null, null, null, - null, Boolean.FALSE, SC_200 }); - parameterSets.add(new Object[] { Boolean.FALSE, Task.HEAD_INDEX_HTML, EtagPrecondition.EXACTLY, null, null, - null, null, Boolean.FALSE, SC_412 }); - parameterSets.add(new Object[] { Boolean.FALSE, Task.HEAD_INDEX_HTML, EtagPrecondition.IN, null, null, null, - null, Boolean.FALSE, SC_412 }); - parameterSets.add(new Object[] { Boolean.FALSE, Task.HEAD_INDEX_HTML, EtagPrecondition.NOT_IN, null, null, null, - null, Boolean.FALSE, SC_412 }); - parameterSets.add(new Object[] { Boolean.FALSE, Task.HEAD_INDEX_HTML, EtagPrecondition.INVALID_ALL_PLUS_OTHER, - null, null, null, null, Boolean.FALSE, SC_400 }); - - parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, null, DatePrecondition.EQ, null, null, - null, Boolean.FALSE, SC_200 }); - parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, null, DatePrecondition.LT, null, null, - null, Boolean.FALSE, SC_412 }); - parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, null, DatePrecondition.GT, null, null, - null, Boolean.FALSE, SC_200 }); - parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, null, DatePrecondition.MULTI_IN, null, - null, null, Boolean.FALSE, SC_200 }); - parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, null, DatePrecondition.LT, null, - DatePrecondition.GT, null, Boolean.FALSE, SC_412 }); - - parameterSets.add(new Object[] { Boolean.FALSE, Task.HEAD_INDEX_HTML, null, DatePrecondition.EQ, null, null, - null, Boolean.FALSE, SC_200 }); - parameterSets.add(new Object[] { Boolean.FALSE, Task.HEAD_INDEX_HTML, null, DatePrecondition.LT, null, null, - null, Boolean.FALSE, SC_412 }); - parameterSets.add(new Object[] { Boolean.FALSE, Task.HEAD_INDEX_HTML, null, DatePrecondition.GT, null, null, - null, Boolean.FALSE, SC_200 }); - parameterSets.add(new Object[] { Boolean.FALSE, Task.HEAD_INDEX_HTML, null, DatePrecondition.MULTI_IN, null, - null, null, Boolean.FALSE, SC_200 }); - + for (Boolean useStrongEtag : booleans) { + // RFC 9110, Section 13.2.2, Step 1, HEAD + parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.ALL, null, null, null, + null, Boolean.FALSE, SC_200 }); + parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.EXACTLY, null, null, null, + null, Boolean.FALSE, useStrongEtag.booleanValue() ? SC_200 : SC_412}); + parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.IN, null, null, null, + null, Boolean.FALSE, useStrongEtag.booleanValue() ? SC_200 : SC_412 }); + parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.NOT_IN, null, null, null, + null, Boolean.FALSE, SC_412 }); + parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.INVALID_ALL_PLUS_OTHER, + null, null, null, null, Boolean.FALSE, SC_400 }); + + // RFC 9110, Section 13.2.2, Step 2, HEAD + parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, null, DatePrecondition.EQ, null, null, + null, Boolean.FALSE, SC_200 }); + parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, null, DatePrecondition.LT, null, null, + null, Boolean.FALSE, SC_412 }); + parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, null, DatePrecondition.GT, null, null, + null, Boolean.FALSE, SC_200 }); + parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, null, DatePrecondition.MULTI_IN, null, + null, null, Boolean.FALSE, SC_200 }); + parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, null, DatePrecondition.LT, null, + DatePrecondition.GT, null, Boolean.FALSE, SC_412 }); + } return parameterSets; } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org