diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb2/org/eclipse/equinox/http/servlet/tests/tb2/.gitattributes b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb2/org/eclipse/equinox/http/servlet/tests/tb2/.gitattributes new file mode 100644 index 00000000000..c041c1e1255 --- /dev/null +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb2/org/eclipse/equinox/http/servlet/tests/tb2/.gitattributes @@ -0,0 +1,2 @@ +# Ensure the matching text-files are checked out with Unix-line endings (LF) on all platforms +rangerequest.mp4 text eol=lf diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/http.context.test/.gitattributes b/bundles/org.eclipse.equinox.http.servlet.tests/http.context.test/.gitattributes new file mode 100644 index 00000000000..83068a244f4 --- /dev/null +++ b/bundles/org.eclipse.equinox.http.servlet.tests/http.context.test/.gitattributes @@ -0,0 +1,2 @@ +# Ensure the matching text-files are checked out with Unix-line endings (LF) on all platforms +test text eol=lf diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java index aab5c3d68c2..769af9235df 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java @@ -43,7 +43,6 @@ import java.util.HashSet; import java.util.Hashtable; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; @@ -126,7 +125,6 @@ import org.osgi.util.tracker.ServiceTracker; public class ServletTest extends BaseTest { - public static final boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("win"); @Rule public TestName testName = new TestName(); @@ -1970,7 +1968,7 @@ public void test_ResourceAliasSlash() throws Exception { assertEquals("Wrong value.", "test\n", actual); } - private static final int MP4_CONTENT_LENGTH = (20_400 + 255 * System.lineSeparator().length()); + private static final int MP4_CONTENT_LENGTH = 81 * 255; private static final List EXPECTED_MP4_CONTENT_RANGE = List .of("bytes 0-" + (MP4_CONTENT_LENGTH - 1) + "/" + MP4_CONTENT_LENGTH); private static final List EXPECTED_MP4_CONTENT_LENGTH = List.of(String.valueOf(MP4_CONTENT_LENGTH)); @@ -2035,10 +2033,8 @@ public String getMimeType(String filename) { assertEquals("Content-Length", Collections.singletonList("9000"), actual.get("Content-Length")); assertEquals("Accept-Ranges", Collections.singletonList("bytes"), actual.get("Accept-Ranges")); assertEquals("Content-Range", List.of("bytes 1000-9999/" + MP4_CONTENT_LENGTH), actual.get("Content-Range")); - assertEquals("Response Body Prefix", IS_WINDOWS ? "789" : "901", - actual.get("responseBody").get(0).substring(0, 3)); - assertEquals("Response Body Suffix", IS_WINDOWS ? "678" : "567", - actual.get("responseBody").get(0).substring(8997, 9000)); + assertEquals("Response Body Prefix", "901", actual.get("responseBody").get(0).substring(0, 3)); + assertEquals("Response Body Suffix", "567", actual.get("responseBody").get(0).substring(8997, 9000)); } @Test @@ -2077,8 +2073,7 @@ public boolean rangeableContentType(String contentType, String userAgent) { assertEquals("Accept-Ranges", Collections.singletonList("bytes"), actual.get("Accept-Ranges")); assertEquals("Content-Range", EXPECTED_MP4_CONTENT_RANGE, actual.get("Content-Range")); assertEquals("Response Body Prefix", "123", actual.get("responseBody").get(0).substring(0, 3)); - assertEquals("Response Body Suffix", IS_WINDOWS ? "012" : "789", - actual.get("responseBody").get(0).substring(8997, 9000)); + assertEquals("Response Body Suffix", "789", actual.get("responseBody").get(0).substring(8997, 9000)); } @Test @@ -3116,9 +3111,9 @@ public void test_ServletContextHelper11() throws Exception { getHttpService().registerResources("/" + HTTP_CONTEXT_TEST_ROOT + "/1", "", ctx1); getHttpService().registerResources("/" + HTTP_CONTEXT_TEST_ROOT + "/2", "", ctx2); actual = requestAdvisor.request(HTTP_CONTEXT_TEST_ROOT + "/1/test"); - assertEquals("1" + System.lineSeparator(), actual); + assertEquals("1\n", actual); actual = requestAdvisor.request(HTTP_CONTEXT_TEST_ROOT + "/2/test"); - assertEquals("2" + System.lineSeparator(), actual); + assertEquals("2\n", actual); } finally { try { getHttpService().unregister("/" + HTTP_CONTEXT_TEST_ROOT + "/1");