Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Erdfelt2009-07-11 00:56:03 +0000
committerJoakim Erdfelt2009-07-11 00:56:03 +0000
commit0e10f592d85dfa11bd45a1c8115ceed279327c7c (patch)
treedf41f4c519454eee9e4bcfad3292667c4ec502b3
parent15f4e6eb4726cb34e92c7e6f1085b8b3279a6604 (diff)
downloadorg.eclipse.jetty.project-0e10f592d85dfa11bd45a1c8115ceed279327c7c.tar.gz
org.eclipse.jetty.project-0e10f592d85dfa11bd45a1c8115ceed279327c7c.tar.xz
org.eclipse.jetty.project-0e10f592d85dfa11bd45a1c8115ceed279327c7c.zip
[BUG 283172] fix build on windows
* Undoing misplaced .toSystemLN() hack in favor of using Subversion svn:eol-style property correctly. git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@552 7e9141cc-0065-0410-87d8-b60c137991c4
-rw-r--r--tests/test-integration/src/test/java/org/eclipse/jetty/test/AbstractJettyTestCase.java30
-rw-r--r--tests/test-integration/src/test/java/org/eclipse/jetty/test/DefaultHandlerTest.java3
-rw-r--r--tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java15
-rw-r--r--tests/test-integration/src/test/java/org/eclipse/jetty/test/support/StringUtil.java36
-rw-r--r--tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpResponseTester.java38
-rw-r--r--tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpResponseTesterTest.java4
6 files changed, 53 insertions, 73 deletions
diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/AbstractJettyTestCase.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/AbstractJettyTestCase.java
index b6246ce912..900aa7cf54 100644
--- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/AbstractJettyTestCase.java
+++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/AbstractJettyTestCase.java
@@ -95,34 +95,4 @@ public abstract class AbstractJettyTestCase extends TestCase
throw new AssertionFailedError("No valid connector port found.");
}
-
- /**
- * Utility method to convert "\n" found to "\r\n" if running on windows.
- *
- * @param str
- * input string.
- * @return
- */
- public String toSystemLN(String str)
- {
- if (!IS_ON_WINDOWS)
- {
- return str;
- }
-
- StringBuffer ret = new StringBuffer();
- for (char c : str.toCharArray())
- {
- switch (c)
- {
- case '\n':
- ret.append("\r\n");
- break;
- default:
- ret.append(c);
- }
- }
-
- return ret.toString();
- }
}
diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/DefaultHandlerTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/DefaultHandlerTest.java
index 88012c45fb..0906e7835f 100644
--- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/DefaultHandlerTest.java
+++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/DefaultHandlerTest.java
@@ -78,8 +78,9 @@ public class DefaultHandlerTest extends AbstractJettyTestCase
InputStream in = conn.getInputStream();
String response = IO.toString(in);
+ String expected = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n";
- assertEquals("Response",toSystemLN("ABCDEFGHIJKLMNOPQRSTUVWXYZ\n"),response);
+ assertEquals("Response",expected,response);
}
@Test
diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java
index c8787a784c..5d65fe87cc 100644
--- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java
+++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java
@@ -47,6 +47,7 @@ import org.junit.Test;
*/
public abstract class RFC2616BaseTest extends AbstractJettyTestCase
{
+ private static final String ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n";
/** STRICT RFC TESTS */
private static final boolean STRICT = false;
private List<HttpResponseTester> responses;
@@ -1135,7 +1136,7 @@ public abstract class RFC2616BaseTest extends AbstractJettyTestCase
response = http.request(req1);
response.assertStatusOK();
- response.assertBody("ABCDEFGHIJKLMNOPQRSTUVWXYZ\n");
+ response.assertBody(ALPHA);
}
private void assertBadContentRange(String rangedef) throws IOException
@@ -1251,7 +1252,7 @@ public abstract class RFC2616BaseTest extends AbstractJettyTestCase
@Test
public void test14_16_PartialRange() throws Exception
{
- String alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n";
+ String alpha = ALPHA;
// server should not return a 416 if at least one syntactically valid ranges
// are is satisfiable
@@ -1271,7 +1272,7 @@ public abstract class RFC2616BaseTest extends AbstractJettyTestCase
@Test
public void test14_16_PartialRange_MixedRanges() throws Exception
{
- String alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n";
+ String alpha = ALPHA;
// server should not return a 416 if at least one syntactically valid ranges
// are is satisfiable
@@ -1313,7 +1314,7 @@ public abstract class RFC2616BaseTest extends AbstractJettyTestCase
@Test
public void test14_16_PartialRange_MixedBytes() throws Exception
{
- String alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n";
+ String alpha = ALPHA;
// server should not return a 416 if at least one syntactically valid ranges
// are is satisfiable
@@ -1352,7 +1353,7 @@ public abstract class RFC2616BaseTest extends AbstractJettyTestCase
@Test
public void test14_16_PartialRange_MixedMultiple() throws Exception
{
- String alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n";
+ String alpha = ALPHA;
// server should not return a 416 if at least one syntactically valid ranges
// are is satisfiable
@@ -1506,7 +1507,7 @@ public abstract class RFC2616BaseTest extends AbstractJettyTestCase
// tested yet
//
- String alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n";
+ String alpha = ALPHA;
// First 3 bytes
assertByteRange("bytes=0-2","0-2/27",alpha.substring(0,2 + 1));
@@ -1661,7 +1662,7 @@ public abstract class RFC2616BaseTest extends AbstractJettyTestCase
// tested yet
//
- String alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n";
+ String alpha = ALPHA;
// server should not return a 416 if at least one syntactically valid ranges
// are is satisfiable
diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/StringUtil.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/StringUtil.java
index 55f0eaa7ed..6c34557e08 100644
--- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/StringUtil.java
+++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/StringUtil.java
@@ -18,6 +18,8 @@ package org.eclipse.jetty.test.support;
public class StringUtil
{
+ public static final String LN = System.getProperty("line.separator");
+
public static boolean isBlank(String str)
{
if (str == null)
@@ -101,4 +103,38 @@ public class StringUtil
return ret;
}
+
+ /**
+ * Utility method to convert "\n" found to "\r\n" if running on windows.
+ *
+ * @param str
+ * input string.
+ * @return
+ */
+ public static String toSystemLN(String str)
+ {
+ boolean linesep = false;
+ StringBuffer ret = new StringBuffer();
+ for (char c : str.toCharArray())
+ {
+ switch (c)
+ {
+ case '\r':
+ linesep = true;
+ break;
+ case '\n':
+ linesep = true;
+ break;
+ default:
+ if (linesep)
+ {
+ ret.append(LN);
+ linesep = false;
+ }
+ ret.append(c);
+ }
+ }
+
+ return ret.toString();
+ }
}
diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpResponseTester.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpResponseTester.java
index a7b97d030e..07deaf0028 100644
--- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpResponseTester.java
+++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpResponseTester.java
@@ -41,8 +41,6 @@ import org.eclipse.jetty.util.ByteArrayOutputStream2;
*/
public class HttpResponseTester
{
- private static final boolean IS_ON_WINDOWS = System.getProperty("os.name").startsWith("Windows");
-
private class PH extends HttpParser.EventHandler
{
@Override
@@ -344,45 +342,17 @@ public class HttpResponseTester
public void assertBody(String expected)
{
Assert.assertNotNull("Response.content should not be null",this.content);
- Assert.assertEquals("Response.content",toSystemLN(expected),this.content.toString());
+ String actual = this.content.toString();
+ Assert.assertEquals("Response.content",expected,actual);
}
public void assertBody(String msg, String expected)
{
Assert.assertNotNull(msg + ": Response.content should not be null",this.content);
- Assert.assertEquals(msg + ": Response.content",toSystemLN(expected),this.content.toString());
+ String actual = this.content.toString();
+ Assert.assertEquals(msg + ": Response.content",expected,actual);
}
- /**
- * Utility method to convert "\n" found to "\r\n" if running on windows.
- *
- * @param str
- * input string.
- * @return
- */
- public String toSystemLN(String str)
- {
- if (!IS_ON_WINDOWS)
- {
- return str;
- }
-
- StringBuffer ret = new StringBuffer();
- for (char c : str.toCharArray())
- {
- switch (c)
- {
- case '\n':
- ret.append("\r\n");
- break;
- default:
- ret.append(c);
- }
- }
-
- return ret.toString();
- }
-
public void assertNoBody(String msg)
{
Assert.assertNull(msg + ": Response.content should be null",this.content);
diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpResponseTesterTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpResponseTesterTest.java
index 91018005b9..f06bd70ca8 100644
--- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpResponseTesterTest.java
+++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpResponseTesterTest.java
@@ -52,7 +52,9 @@ public class HttpResponseTesterTest extends AbstractJettyTestCase
assertEquals("Response[Content-Length]",28,response.getLongHeader("Content-Length"));
assertEquals("Response[Connection]","close",response.getHeader("Connection"));
- assertEquals("Response.content",toSystemLN("ABCDEFGHIJKLMNOPQRSTTUVWXYZ\n"),response.getContent().toString());
+ String expected = "ABCDEFGHIJKLMNOPQRSTTUVWXYZ\n";
+
+ assertEquals("Response.content",expected,response.getContent().toString());
}
@Test

Back to the top