More fixes for Windows build

This commit is contained in:
Joakim Erdfelt 2013-11-04 16:50:18 -07:00
parent c366c6b356
commit aba3a41a34
5 changed files with 31 additions and 7 deletions

1
.gitattributes vendored
View File

@ -1,3 +1,4 @@
*.sh eol=lf *.sh eol=lf
*.bat eol=crlf *.bat eol=crlf
*.txt eol=lf *.txt eol=lf
*.js eol=lf

View File

@ -20,6 +20,7 @@ package org.eclipse.jetty.client;
import static java.nio.file.StandardOpenOption.CREATE; import static java.nio.file.StandardOpenOption.CREATE;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.HttpCookie; import java.net.HttpCookie;
@ -63,15 +64,21 @@ import org.eclipse.jetty.http.HttpField;
import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpMethod;
import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.toolchain.test.FS;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.toolchain.test.TestingDir;
import org.eclipse.jetty.toolchain.test.annotation.Slow; import org.eclipse.jetty.toolchain.test.annotation.Slow;
import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
public class HttpClientTest extends AbstractHttpClientServerTest public class HttpClientTest extends AbstractHttpClientServerTest
{ {
@Rule
public TestingDir testdir = new TestingDir();
public HttpClientTest(SslContextFactory sslContextFactory) public HttpClientTest(SslContextFactory sslContextFactory)
{ {
super(sslContextFactory); super(sslContextFactory);
@ -508,7 +515,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
start(new EmptyServerHandler()); start(new EmptyServerHandler());
// Prepare a big file to upload // Prepare a big file to upload
Path targetTestsDir = MavenTestingUtils.getTargetTestingDir().toPath(); Path targetTestsDir = testdir.getEmptyDir().toPath();
Files.createDirectories(targetTestsDir); Files.createDirectories(targetTestsDir);
Path file = Paths.get(targetTestsDir.toString(), "http_client_conversation.big"); Path file = Paths.get(targetTestsDir.toString(), "http_client_conversation.big");
try (OutputStream output = Files.newOutputStream(file, CREATE)) try (OutputStream output = Files.newOutputStream(file, CREATE))

View File

@ -1109,6 +1109,9 @@ public class SslBytesServerTest extends SslBytesTest
@Test @Test
public void testRequestWithBigContentReadBlockedThenReset() throws Exception public void testRequestWithBigContentReadBlockedThenReset() throws Exception
{ {
// Don't run on Windows (buggy JVM)
Assume.assumeTrue(!OS.IS_WINDOWS);
final SSLSocket client = newClient(); final SSLSocket client = newClient();
SimpleProxy.AutomaticFlow automaticProxyFlow = proxy.startAutomaticFlow(); SimpleProxy.AutomaticFlow automaticProxyFlow = proxy.startAutomaticFlow();

View File

@ -25,6 +25,7 @@ import static org.hamcrest.Matchers.notNullValue;
import java.io.IOException; import java.io.IOException;
import java.net.ConnectException; import java.net.ConnectException;
import java.net.SocketTimeoutException;
import java.net.URI; import java.net.URI;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@ -32,6 +33,7 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import org.eclipse.jetty.toolchain.test.OS;
import org.eclipse.jetty.toolchain.test.TestTracker; import org.eclipse.jetty.toolchain.test.TestTracker;
import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.UpgradeException; import org.eclipse.jetty.websocket.api.UpgradeException;
@ -62,7 +64,11 @@ public class ClientConnectTest
{ {
// Validate thrown cause // Validate thrown cause
Throwable cause = e.getCause(); Throwable cause = e.getCause();
if(!errorClass.isInstance(cause))
{
cause.printStackTrace(System.err);
Assert.assertThat("ExecutionException.cause",cause,instanceOf(errorClass)); Assert.assertThat("ExecutionException.cause",cause,instanceOf(errorClass));
}
// Validate websocket captured cause // Validate websocket captured cause
Assert.assertThat("Error Queue Length",wsocket.errorQueue.size(),greaterThanOrEqualTo(1)); Assert.assertThat("Error Queue Length",wsocket.errorQueue.size(),greaterThanOrEqualTo(1));
@ -353,11 +359,18 @@ public class ClientConnectTest
wsocket.assertNotOpened(); wsocket.assertNotOpened();
} }
catch (ExecutionException e) catch (ExecutionException e)
{
if(OS.IS_WINDOWS)
{
// On windows, this is a SocketTimeoutException
assertExpectedError(e, wsocket, SocketTimeoutException.class);
} else
{ {
// Expected path - java.net.ConnectException // Expected path - java.net.ConnectException
assertExpectedError(e,wsocket,ConnectException.class); assertExpectedError(e,wsocket,ConnectException.class);
} }
} }
}
@Test(expected = TimeoutException.class) @Test(expected = TimeoutException.class)
public void testConnectionTimeout_Concurrent() throws Exception public void testConnectionTimeout_Concurrent() throws Exception

View File

@ -108,7 +108,7 @@ public class AnnotatedMaxMessageSizeTest
} }
} }
@Test @Test(timeout=4000)
public void testEchoTooBig() throws IOException, Exception public void testEchoTooBig() throws IOException, Exception
{ {
BlockheadClient client = new BlockheadClient(serverUri); BlockheadClient client = new BlockheadClient(serverUri);