Skip to content

Commit aba3a41

Browse files
committed
More fixes for Windows build
1 parent c366c6b commit aba3a41

File tree

5 files changed

+31
-7
lines changed

5 files changed

+31
-7
lines changed

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*.sh eol=lf
22
*.bat eol=crlf
3-
*.txt eol=lf
3+
*.txt eol=lf
4+
*.js eol=lf

jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import static java.nio.file.StandardOpenOption.CREATE;
2222

23+
import java.io.File;
2324
import java.io.IOException;
2425
import java.io.OutputStream;
2526
import java.net.HttpCookie;
@@ -63,15 +64,21 @@
6364
import org.eclipse.jetty.http.HttpHeader;
6465
import org.eclipse.jetty.http.HttpMethod;
6566
import org.eclipse.jetty.server.handler.AbstractHandler;
67+
import org.eclipse.jetty.toolchain.test.FS;
6668
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
69+
import org.eclipse.jetty.toolchain.test.TestingDir;
6770
import org.eclipse.jetty.toolchain.test.annotation.Slow;
6871
import org.eclipse.jetty.util.IO;
6972
import org.eclipse.jetty.util.ssl.SslContextFactory;
7073
import org.junit.Assert;
74+
import org.junit.Rule;
7175
import org.junit.Test;
7276

7377
public class HttpClientTest extends AbstractHttpClientServerTest
7478
{
79+
@Rule
80+
public TestingDir testdir = new TestingDir();
81+
7582
public HttpClientTest(SslContextFactory sslContextFactory)
7683
{
7784
super(sslContextFactory);
@@ -508,7 +515,7 @@ public void test_ExchangeIsComplete_OnlyWhenBothRequestAndResponseAreComplete()
508515
start(new EmptyServerHandler());
509516

510517
// Prepare a big file to upload
511-
Path targetTestsDir = MavenTestingUtils.getTargetTestingDir().toPath();
518+
Path targetTestsDir = testdir.getEmptyDir().toPath();
512519
Files.createDirectories(targetTestsDir);
513520
Path file = Paths.get(targetTestsDir.toString(), "http_client_conversation.big");
514521
try (OutputStream output = Files.newOutputStream(file, CREATE))

jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslBytesServerTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,10 @@ public Object call() throws Exception
11091109
@Test
11101110
public void testRequestWithBigContentReadBlockedThenReset() throws Exception
11111111
{
1112-
final SSLSocket client = newClient();
1112+
// Don't run on Windows (buggy JVM)
1113+
Assume.assumeTrue(!OS.IS_WINDOWS);
1114+
1115+
final SSLSocket client = newClient();
11131116

11141117
SimpleProxy.AutomaticFlow automaticProxyFlow = proxy.startAutomaticFlow();
11151118
client.startHandshake();

jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/ClientConnectTest.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@
2525

2626
import java.io.IOException;
2727
import java.net.ConnectException;
28+
import java.net.SocketTimeoutException;
2829
import java.net.URI;
2930
import java.util.List;
3031
import java.util.concurrent.ExecutionException;
3132
import java.util.concurrent.Future;
3233
import java.util.concurrent.TimeUnit;
3334
import java.util.concurrent.TimeoutException;
3435

36+
import org.eclipse.jetty.toolchain.test.OS;
3537
import org.eclipse.jetty.toolchain.test.TestTracker;
3638
import org.eclipse.jetty.websocket.api.Session;
3739
import org.eclipse.jetty.websocket.api.UpgradeException;
@@ -62,7 +64,11 @@ private <E extends Throwable> E assertExpectedError(ExecutionException e, JettyT
6264
{
6365
// Validate thrown cause
6466
Throwable cause = e.getCause();
65-
Assert.assertThat("ExecutionException.cause",cause,instanceOf(errorClass));
67+
if(!errorClass.isInstance(cause))
68+
{
69+
cause.printStackTrace(System.err);
70+
Assert.assertThat("ExecutionException.cause",cause,instanceOf(errorClass));
71+
}
6672

6773
// Validate websocket captured cause
6874
Assert.assertThat("Error Queue Length",wsocket.errorQueue.size(),greaterThanOrEqualTo(1));
@@ -354,8 +360,15 @@ public void testConnectionRefused() throws Exception
354360
}
355361
catch (ExecutionException e)
356362
{
357-
// Expected path - java.net.ConnectException
358-
assertExpectedError(e,wsocket,ConnectException.class);
363+
if(OS.IS_WINDOWS)
364+
{
365+
// On windows, this is a SocketTimeoutException
366+
assertExpectedError(e, wsocket, SocketTimeoutException.class);
367+
} else
368+
{
369+
// Expected path - java.net.ConnectException
370+
assertExpectedError(e,wsocket,ConnectException.class);
371+
}
359372
}
360373
}
361374

jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/AnnotatedMaxMessageSizeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public void testEchoGood() throws IOException, Exception
108108
}
109109
}
110110

111-
@Test
111+
@Test(timeout=4000)
112112
public void testEchoTooBig() throws IOException, Exception
113113
{
114114
BlockheadClient client = new BlockheadClient(serverUri);

0 commit comments

Comments
 (0)