Skip to content
This repository was archived by the owner on May 28, 2018. It is now read-only.

Commit 8d79183

Browse files
committed
Removed TimeoutTest#testUnknownHost.
- does not test what it should (google.com is not unknown) - introduces intermittent build failures (different exceptions are thrown from on various platforms) - we don't want to have dependency on external service during mvn clean install Change-Id: Ida425e587fb0049589f3cb64145e6e68b152faa4
1 parent 7863684 commit 8d79183

File tree

4 files changed

+7
-22
lines changed
  • connectors
    • apache-connector/src/test/java/org/glassfish/jersey/apache/connector
    • grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector
    • jetty-connector/src/test/java/org/glassfish/jersey/jetty/connector
  • tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/client

4 files changed

+7
-22
lines changed

connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/TimeoutTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import static org.hamcrest.CoreMatchers.instanceOf;
6060
import static org.junit.Assert.assertEquals;
6161
import static org.junit.Assert.assertThat;
62+
import static org.junit.Assert.fail;
6263

6364
/**
6465
* @author Martin Matula
@@ -110,6 +111,7 @@ public void testFast() {
110111
public void testSlow() {
111112
try {
112113
target("test/timeout").request().get();
114+
fail("Timeout expected.");
113115
} catch (final ProcessingException e) {
114116
assertThat("Unexpected processing exception cause",
115117
e.getCause(), instanceOf(SocketTimeoutException.class));

connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/TimeoutTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import static org.hamcrest.CoreMatchers.instanceOf;
5858
import static org.junit.Assert.assertEquals;
5959
import static org.junit.Assert.assertThat;
60+
import static org.junit.Assert.fail;
6061

6162
/**
6263
* @author Martin Matula
@@ -103,6 +104,7 @@ public void testFast() {
103104
public void testSlow() {
104105
try {
105106
target("test/timeout").request().get();
107+
fail("Timeout expected.");
106108
} catch (ProcessingException e) {
107109
assertThat("Unexpected processing exception cause",
108110
e.getCause(), instanceOf(TimeoutException.class));

connectors/jetty-connector/src/test/java/org/glassfish/jersey/jetty/connector/TimeoutTest.java

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@
4040

4141
package org.glassfish.jersey.jetty.connector;
4242

43-
import java.net.NoRouteToHostException;
44-
import java.net.SocketTimeoutException;
4543
import java.net.URI;
46-
import java.net.URISyntaxException;
4744
import java.util.concurrent.TimeoutException;
4845
import java.util.logging.Logger;
4946

@@ -63,10 +60,10 @@
6360
import org.glassfish.jersey.test.JerseyTest;
6461

6562
import org.junit.Test;
66-
import static org.hamcrest.CoreMatchers.anyOf;
6763
import static org.hamcrest.CoreMatchers.instanceOf;
6864
import static org.junit.Assert.assertEquals;
6965
import static org.junit.Assert.assertThat;
66+
import static org.junit.Assert.fail;
7067

7168
/**
7269
* @author Martin Matula
@@ -122,29 +119,12 @@ public void testSlow() {
122119
WebTarget t = c.target(u);
123120
try {
124121
t.path("test/timeout").request().get();
122+
fail("Timeout expected.");
125123
} catch (ProcessingException e) {
126124
assertThat("Unexpected processing exception cause",
127125
e.getCause(), instanceOf(TimeoutException.class));
128126
} finally {
129127
c.close();
130128
}
131129
}
132-
133-
@Test
134-
public void testUnknownHost() throws URISyntaxException {
135-
ClientConfig config = new ClientConfig().property(ClientProperties.CONNECT_TIMEOUT, 1000);
136-
config.connectorProvider(new JettyConnectorProvider());
137-
Client c = ClientBuilder.newClient(config);
138-
final URI u = new URI("http://google.com:81");
139-
WebTarget target = c.target(u);
140-
try {
141-
target.request().get();
142-
} catch (ProcessingException e) {
143-
assertThat("Unexpected processing exception cause",
144-
e.getCause().getCause(),
145-
anyOf(instanceOf(SocketTimeoutException.class), instanceOf(NoRouteToHostException.class)));
146-
} finally {
147-
c.close();
148-
}
149-
}
150130
}

tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/client/TimeoutTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ public void testFast() {
101101
public void testSlow() {
102102
try {
103103
target("test/timeout").request().get();
104+
fail("Timeout expected.");
104105
} catch (ProcessingException e) {
105106
if (!(e.getCause() instanceof SocketTimeoutException)) {
106107
e.printStackTrace();

0 commit comments

Comments
 (0)