Skip to content

Commit 4a61265

Browse files
committed
minor test clean up
1 parent b36966d commit 4a61265

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+153
-187
lines changed

client/src/test/java/org/asynchttpclient/AsyncHttpClientDefaultsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import java.lang.reflect.Method;
1111

12-
@Test
12+
@Test(groups = "standalone")
1313
public class AsyncHttpClientDefaultsTest {
1414

1515
public void testDefaultMaxTotalConnections() {

client/src/test/java/org/asynchttpclient/AsyncStreamLifecycleTest.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,8 @@ public void run() {
9393
};
9494
}
9595

96-
// TODO Netty only.
97-
9896
@Test(groups = "standalone")
99-
public void testStream() throws IOException {
97+
public void testStream() throws Exception {
10098
try (AsyncHttpClient ahc = asyncHttpClient()) {
10199
final AtomicBoolean err = new AtomicBoolean(false);
102100
final LinkedBlockingQueue<String> queue = new LinkedBlockingQueue<>();
@@ -135,11 +133,7 @@ public Object onCompleted() throws Exception {
135133
return null;
136134
}
137135
});
138-
try {
139-
assertTrue(latch.await(1, TimeUnit.SECONDS), "Latch failed.");
140-
} catch (InterruptedException e) {
141-
fail("Interrupted.", e);
142-
}
136+
assertTrue(latch.await(1, TimeUnit.SECONDS), "Latch failed.");
143137
assertFalse(err.get());
144138
assertEquals(queue.size(), 2);
145139
assertTrue(queue.contains("part1"));

client/src/test/java/org/asynchttpclient/BasicHttpTest.java

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
public class BasicHttpTest extends AbstractBasicTest {
5757

58-
@Test(groups = { "standalone", "async" })
58+
@Test(groups = "standalone")
5959
public void asyncProviderEncodingTest() throws Exception {
6060
try (AsyncHttpClient client = asyncHttpClient()) {
6161
Request request = get(getTargetUrl() + "?q=+%20x").build();
@@ -78,7 +78,7 @@ public void onThrowable(Throwable t) {
7878
}
7979
}
8080

81-
@Test(groups = { "standalone", "async" })
81+
@Test(groups = "standalone")
8282
public void asyncProviderEncodingTest2() throws Exception {
8383
try (AsyncHttpClient client = asyncHttpClient()) {
8484
Request request = get(getTargetUrl() + "").addQueryParam("q", "a b").build();
@@ -100,7 +100,7 @@ public void onThrowable(Throwable t) {
100100
}
101101
}
102102

103-
@Test(groups = { "standalone", "async" })
103+
@Test(groups = "standalone")
104104
public void emptyRequestURI() throws Exception {
105105
try (AsyncHttpClient client = asyncHttpClient()) {
106106
Request request = get(getTargetUrl()).build();
@@ -122,7 +122,7 @@ public void onThrowable(Throwable t) {
122122
}
123123
}
124124

125-
@Test(groups = { "standalone", "async" })
125+
@Test(groups = "standalone")
126126
public void asyncProviderContentLenghtGETTest() throws Exception {
127127
final HttpURLConnection connection = (HttpURLConnection) new URL(getTargetUrl()).openConnection();
128128
connection.connect();
@@ -166,7 +166,7 @@ public void onThrowable(Throwable t) {
166166
}
167167
}
168168

169-
@Test(groups = { "standalone", "async" })
169+
@Test(groups = "standalone")
170170
public void asyncContentTypeGETTest() throws Exception {
171171
try (AsyncHttpClient client = asyncHttpClient()) {
172172
final CountDownLatch l = new CountDownLatch(1);
@@ -190,7 +190,7 @@ public Response onCompleted(Response response) throws Exception {
190190
}
191191
}
192192

193-
@Test(groups = { "standalone", "async" })
193+
@Test(groups = "standalone")
194194
public void asyncHeaderGETTest() throws Exception {
195195
try (AsyncHttpClient client = asyncHttpClient()) {
196196
final CountDownLatch l = new CountDownLatch(1);
@@ -215,7 +215,7 @@ public Response onCompleted(Response response) throws Exception {
215215
}
216216
}
217217

218-
@Test(groups = { "standalone", "async" })
218+
@Test(groups = "standalone")
219219
public void asyncHeaderPOSTTest() throws Exception {
220220
try (AsyncHttpClient client = asyncHttpClient()) {
221221
final CountDownLatch l = new CountDownLatch(1);
@@ -249,7 +249,7 @@ public Response onCompleted(Response response) throws Exception {
249249
}
250250
}
251251

252-
@Test(groups = { "standalone", "async" })
252+
@Test(groups = "standalone")
253253
public void asyncParamPOSTTest() throws Exception {
254254
try (AsyncHttpClient client = asyncHttpClient()) {
255255
final CountDownLatch l = new CountDownLatch(1);
@@ -283,7 +283,7 @@ public Response onCompleted(Response response) throws Exception {
283283
}
284284
}
285285

286-
@Test(groups = { "standalone", "async" })
286+
@Test(groups = "standalone")
287287
public void asyncStatusHEADTest() throws Exception {
288288
try (AsyncHttpClient client = asyncHttpClient()) {
289289
final CountDownLatch l = new CountDownLatch(1);
@@ -315,7 +315,7 @@ public Response onCompleted(Response response) throws Exception {
315315
}
316316

317317
// TODO: fix test
318-
@Test(groups = { "standalone", "async" }, enabled = false)
318+
@Test(groups = "standalone", enabled = false)
319319
public void asyncStatusHEADContentLenghtTest() throws Exception {
320320
try (AsyncHttpClient client = asyncHttpClient(config().setRequestTimeout(120 * 1000))) {
321321
final CountDownLatch l = new CountDownLatch(1);
@@ -353,7 +353,7 @@ public void asyncNullSchemeTest() throws Exception {
353353
}
354354
}
355355

356-
@Test(groups = { "standalone", "async" })
356+
@Test(groups = "standalone")
357357
public void asyncDoGetTransferEncodingTest() throws Exception {
358358
try (AsyncHttpClient client = asyncHttpClient()) {
359359
final CountDownLatch l = new CountDownLatch(1);
@@ -378,7 +378,7 @@ public Response onCompleted(Response response) throws Exception {
378378
}
379379
}
380380

381-
@Test(groups = { "standalone", "async" })
381+
@Test(groups = "standalone")
382382
public void asyncDoGetHeadersTest() throws Exception {
383383
try (AsyncHttpClient client = asyncHttpClient()) {
384384
final CountDownLatch l = new CountDownLatch(1);
@@ -409,7 +409,7 @@ public Response onCompleted(Response response) throws Exception {
409409
}
410410
}
411411

412-
@Test(groups = { "standalone", "async" })
412+
@Test(groups = "standalone")
413413
public void asyncDoGetCookieTest() throws Exception {
414414
try (AsyncHttpClient client = asyncHttpClient()) {
415415
final CountDownLatch l = new CountDownLatch(1);
@@ -443,7 +443,7 @@ public Response onCompleted(Response response) throws Exception {
443443
}
444444
}
445445

446-
@Test(groups = { "standalone", "async" })
446+
@Test(groups = "standalone")
447447
public void asyncDoPostDefaultContentType() throws Exception {
448448
try (AsyncHttpClient client = asyncHttpClient()) {
449449
final CountDownLatch l = new CountDownLatch(1);
@@ -468,15 +468,15 @@ public Response onCompleted(Response response) throws Exception {
468468
}
469469
}
470470

471-
@Test(groups = { "standalone", "async" })
471+
@Test(groups = "standalone")
472472
public void asyncDoPostBodyIsoTest() throws Exception {
473473
try (AsyncHttpClient client = asyncHttpClient()) {
474474
Response response = client.preparePost(getTargetUrl()).addHeader("X-ISO", "true").setBody("\u017D\u017D\u017D\u017D\u017D\u017D").execute().get();
475475
assertEquals(response.getResponseBody().getBytes("ISO-8859-1"), "\u017D\u017D\u017D\u017D\u017D\u017D".getBytes("ISO-8859-1"));
476476
}
477477
}
478478

479-
@Test(groups = { "standalone", "async" })
479+
@Test(groups = "standalone")
480480
public void asyncDoPostBytesTest() throws Exception {
481481
try (AsyncHttpClient client = asyncHttpClient()) {
482482
final CountDownLatch l = new CountDownLatch(1);
@@ -512,7 +512,7 @@ public Response onCompleted(Response response) throws Exception {
512512
}
513513
}
514514

515-
@Test(groups = { "standalone", "async" })
515+
@Test(groups = "standalone")
516516
public void asyncDoPostInputStreamTest() throws Exception {
517517
try (AsyncHttpClient client = asyncHttpClient()) {
518518
final CountDownLatch l = new CountDownLatch(1);
@@ -548,7 +548,7 @@ public Response onCompleted(Response response) throws Exception {
548548
}
549549
}
550550

551-
@Test(groups = { "standalone", "async" })
551+
@Test(groups = "standalone")
552552
public void asyncDoPutInputStreamTest() throws Exception {
553553
try (AsyncHttpClient client = asyncHttpClient()) {
554554
final CountDownLatch l = new CountDownLatch(1);
@@ -582,7 +582,7 @@ public Response onCompleted(Response response) throws Exception {
582582
}
583583
}
584584

585-
@Test(groups = { "standalone", "async" })
585+
@Test(groups = "standalone")
586586
public void asyncDoPostMultiPartTest() throws Exception {
587587
try (AsyncHttpClient client = asyncHttpClient()) {
588588
final CountDownLatch l = new CountDownLatch(1);
@@ -610,7 +610,7 @@ public Response onCompleted(Response response) throws Exception {
610610
}
611611
}
612612

613-
@Test(groups = { "standalone", "async" })
613+
@Test(groups = "standalone")
614614
public void asyncDoPostBasicGZIPTest() throws Exception {
615615
try (AsyncHttpClient client = asyncHttpClient(config().setCompressionEnforced(true))) {
616616
final CountDownLatch l = new CountDownLatch(1);
@@ -642,7 +642,7 @@ public Response onCompleted(Response response) throws Exception {
642642
}
643643
}
644644

645-
@Test(groups = { "standalone", "async" })
645+
@Test(groups = "standalone")
646646
public void asyncDoPostProxyTest() throws Exception {
647647
try (AsyncHttpClient client = asyncHttpClient(config().setProxyServer(proxyServer("127.0.0.1", port2).build()))) {
648648
HttpHeaders h = new DefaultHttpHeaders();
@@ -669,7 +669,7 @@ public void onThrowable(Throwable t) {
669669
}
670670
}
671671

672-
@Test(groups = { "standalone", "async" })
672+
@Test(groups = "standalone")
673673
public void asyncRequestVirtualServerPOSTTest() throws Exception {
674674
try (AsyncHttpClient client = asyncHttpClient()) {
675675
HttpHeaders h = new DefaultHttpHeaders();
@@ -692,7 +692,7 @@ public void asyncRequestVirtualServerPOSTTest() throws Exception {
692692
}
693693
}
694694

695-
@Test(groups = { "standalone", "async" })
695+
@Test(groups = "standalone")
696696
public void asyncDoPutTest() throws Exception {
697697
try (AsyncHttpClient client = asyncHttpClient()) {
698698
HttpHeaders h = new DefaultHttpHeaders();
@@ -709,7 +709,7 @@ public void asyncDoPutTest() throws Exception {
709709
}
710710
}
711711

712-
@Test(groups = { "standalone", "async" })
712+
@Test(groups = "standalone")
713713
public void asyncDoPostLatchBytesTest() throws Exception {
714714
try (AsyncHttpClient c = asyncHttpClient()) {
715715
final CountDownLatch l = new CountDownLatch(1);
@@ -743,7 +743,7 @@ public Response onCompleted(Response response) throws Exception {
743743
}
744744
}
745745

746-
@Test(groups = { "standalone", "async" }, expectedExceptions = { CancellationException.class })
746+
@Test(groups = "standalone", expectedExceptions = { CancellationException.class })
747747
public void asyncDoPostDelayCancelTest() throws Exception {
748748
try (AsyncHttpClient client = asyncHttpClient()) {
749749
HttpHeaders h = new DefaultHttpHeaders();
@@ -762,7 +762,7 @@ public void onThrowable(Throwable t) {
762762
}
763763
}
764764

765-
@Test(groups = { "standalone", "async" })
765+
@Test(groups = "standalone")
766766
public void asyncDoPostDelayBytesTest() throws Exception {
767767
try (AsyncHttpClient client = asyncHttpClient()) {
768768
HttpHeaders h = new DefaultHttpHeaders();
@@ -792,7 +792,7 @@ public void onThrowable(Throwable t) {
792792
}
793793
}
794794

795-
@Test(groups = { "standalone", "async" })
795+
@Test(groups = "standalone")
796796
public void asyncDoPostNullBytesTest() throws Exception {
797797
try (AsyncHttpClient client = asyncHttpClient()) {
798798
HttpHeaders h = new DefaultHttpHeaders();
@@ -811,7 +811,7 @@ public void asyncDoPostNullBytesTest() throws Exception {
811811
}
812812
}
813813

814-
@Test(groups = { "standalone", "async" })
814+
@Test(groups = "standalone")
815815
public void asyncDoPostListenerBytesTest() throws Exception {
816816
try (AsyncHttpClient client = asyncHttpClient()) {
817817
HttpHeaders h = new DefaultHttpHeaders();
@@ -842,7 +842,7 @@ public Response onCompleted(Response response) throws Exception {
842842
}
843843
}
844844

845-
@Test(groups = { "standalone", "async" })
845+
@Test(groups = "standalone")
846846
public void asyncConnectInvalidFuture() throws Exception {
847847
try (AsyncHttpClient client = asyncHttpClient()) {
848848
int dummyPort = findFreePort();
@@ -867,7 +867,7 @@ public void onThrowable(Throwable t) {
867867
}
868868
}
869869

870-
@Test(groups = { "standalone", "async" })
870+
@Test(groups = "standalone")
871871
public void asyncConnectInvalidPortFuture() throws Exception {
872872
try (AsyncHttpClient client = asyncHttpClient()) {
873873
int dummyPort = findFreePort();
@@ -888,7 +888,7 @@ public void onThrowable(Throwable t) {
888888
}
889889
}
890890

891-
@Test(groups = { "standalone", "async" })
891+
@Test(groups = "standalone")
892892
public void asyncConnectInvalidPort() throws Exception {
893893
try (AsyncHttpClient client = asyncHttpClient()) {
894894
// pick a random unused local port
@@ -908,7 +908,7 @@ public void onThrowable(Throwable t) {
908908
}
909909
}
910910

911-
@Test(groups = { "standalone", "async" })
911+
@Test(groups = "standalone")
912912
public void asyncConnectInvalidHandlerPort() throws Exception {
913913
try (AsyncHttpClient client = asyncHttpClient()) {
914914
final CountDownLatch l = new CountDownLatch(1);
@@ -955,7 +955,7 @@ public void onThrowable(Throwable t) {
955955
}
956956
}
957957

958-
@Test(groups = { "standalone", "async" })
958+
@Test(groups = "standalone")
959959
public void asyncConnectInvalidFuturePort() throws Exception {
960960
try (AsyncHttpClient client = asyncHttpClient()) {
961961
final AtomicBoolean called = new AtomicBoolean(false);
@@ -982,7 +982,7 @@ public void onThrowable(Throwable t) {
982982
}
983983
}
984984

985-
@Test(groups = { "standalone", "async" })
985+
@Test(groups = "standalone")
986986
public void asyncContentLenghtGETTest() throws Exception {
987987
try (AsyncHttpClient client = asyncHttpClient()) {
988988
Response response = client.prepareGet(getTargetUrl()).execute(new AsyncCompletionHandlerAdapter() {
@@ -998,7 +998,7 @@ public void onThrowable(Throwable t) {
998998
}
999999
}
10001000

1001-
@Test(groups = { "standalone", "async" })
1001+
@Test(groups = "standalone")
10021002
public void asyncResponseEmptyBody() throws Exception {
10031003
try (AsyncHttpClient client = asyncHttpClient()) {
10041004
Response response = client.prepareGet(getTargetUrl()).execute(new AsyncCompletionHandlerAdapter() {
@@ -1072,7 +1072,7 @@ public void onThrowable(Throwable t) {
10721072
}
10731073
}
10741074

1075-
@Test(groups = { "standalone", "async" })
1075+
@Test(groups = "standalone")
10761076
public void asyncDoGetDelayHandlerTest() throws Exception {
10771077
try (AsyncHttpClient client = asyncHttpClient(config().setRequestTimeout(5 * 1000))) {
10781078
HttpHeaders h = new DefaultHttpHeaders();
@@ -1113,7 +1113,7 @@ public void onThrowable(Throwable t) {
11131113
}
11141114
}
11151115

1116-
@Test(groups = { "standalone", "async" })
1116+
@Test(groups = "standalone")
11171117
public void asyncDoGetQueryStringTest() throws Exception {
11181118
try (AsyncHttpClient client = asyncHttpClient()) {
11191119
// Use a l in case the assert fail
@@ -1143,7 +1143,7 @@ public Response onCompleted(Response response) throws Exception {
11431143
}
11441144
}
11451145

1146-
@Test(groups = { "standalone", "async" })
1146+
@Test(groups = "standalone")
11471147
public void asyncDoGetKeepAliveHandlerTest() throws Exception {
11481148
try (AsyncHttpClient client = asyncHttpClient()) {
11491149
// Use a l in case the assert fail
@@ -1322,7 +1322,7 @@ public void idleRequestTimeoutTest() throws Exception {
13221322
}
13231323
}
13241324

1325-
@Test(groups = { "standalone", "async" })
1325+
@Test(groups = "standalone")
13261326
public void asyncDoPostCancelTest() throws Exception {
13271327
try (AsyncHttpClient client = asyncHttpClient()) {
13281328
HttpHeaders h = new DefaultHttpHeaders();
@@ -1386,7 +1386,7 @@ public void mirrorByteTest() throws Exception {
13861386
}
13871387
}
13881388

1389-
@Test(groups = { "standalone", "async" })
1389+
@Test(groups = "standalone")
13901390
public void testNewConnectionEventsFired() throws Exception {
13911391
Request request = get("http://127.0.0.1:" + port1 + "/Test").build();
13921392

0 commit comments

Comments
 (0)