Skip to content

Commit 73e0938

Browse files
committed
fix: jsp instrumentation needlessly requiring jetty http status
1 parent 9deb715 commit 73e0938

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationBasicTests.groovy

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import okhttp3.Request
66
import okhttp3.RequestBody
77
import okhttp3.Response
88
import org.apache.jasper.JasperException
9-
import org.eclipse.jetty.http.HttpStatus
109

1110
class JSPInstrumentationBasicTests extends JSPTestBase {
1211
def "non-erroneous GET #test test"() {
@@ -72,7 +71,7 @@ class JSPInstrumentationBasicTests extends JSPTestBase {
7271
}
7372
}
7473
}
75-
res.code() == HttpStatus.OK_200
74+
res.code() == HTTP_OK
7675

7776
cleanup:
7877
res.close()
@@ -149,7 +148,7 @@ class JSPInstrumentationBasicTests extends JSPTestBase {
149148
}
150149
}
151150
}
152-
res.code() == HttpStatus.OK_200
151+
res.code() == HTTP_OK
153152

154153
cleanup:
155154
res.close()
@@ -222,7 +221,7 @@ class JSPInstrumentationBasicTests extends JSPTestBase {
222221
}
223222
}
224223
}
225-
res.code() == HttpStatus.OK_200
224+
res.code() == HTTP_OK
226225

227226
cleanup:
228227
res.close()
@@ -305,7 +304,7 @@ class JSPInstrumentationBasicTests extends JSPTestBase {
305304
}
306305
}
307306
}
308-
res.code() == HttpStatus.INTERNAL_SERVER_ERROR_500
307+
res.code() == HTTP_INTERNAL_ERROR
309308

310309
cleanup:
311310
res.close()
@@ -380,7 +379,7 @@ class JSPInstrumentationBasicTests extends JSPTestBase {
380379
}
381380
}
382381
}
383-
res.code() == HttpStatus.OK_200
382+
res.code() == HTTP_OK
384383

385384
cleanup:
386385
res.close()
@@ -503,7 +502,7 @@ class JSPInstrumentationBasicTests extends JSPTestBase {
503502
}
504503
}
505504
}
506-
res.code() == HttpStatus.OK_200
505+
res.code() == HTTP_OK
507506

508507
cleanup:
509508
res.close()
@@ -561,7 +560,7 @@ class JSPInstrumentationBasicTests extends JSPTestBase {
561560
}
562561
}
563562
}
564-
res.code() == HttpStatus.INTERNAL_SERVER_ERROR_500
563+
res.code() == HTTP_INTERNAL_ERROR
565564

566565
cleanup:
567566
res.close()
@@ -581,7 +580,7 @@ class JSPInstrumentationBasicTests extends JSPTestBase {
581580
Response res = client.newCall(req).execute()
582581

583582
then:
584-
res.code() == HttpStatus.OK_200
583+
res.code() == HTTP_OK
585584
assertTraces(1) {
586585
trace(1) {
587586
span {

dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationForwardTests.groovy

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import datadog.trace.bootstrap.instrumentation.api.Tags
33
import okhttp3.Request
44
import okhttp3.Response
55
import org.apache.jasper.JasperException
6-
import org.eclipse.jetty.http.HttpStatus
76

87
class JSPInstrumentationForwardTests extends JSPTestBase {
98
def "non-erroneous GET forward to #forwardTo"() {
@@ -97,7 +96,7 @@ class JSPInstrumentationForwardTests extends JSPTestBase {
9796
}
9897
}
9998
}
100-
res.code() == HttpStatus.OK_200
99+
res.code() == HTTP_OK
101100

102101
cleanup:
103102
res.close()
@@ -171,7 +170,7 @@ class JSPInstrumentationForwardTests extends JSPTestBase {
171170
}
172171
}
173172
}
174-
res.code() == HttpStatus.OK_200
173+
res.code() == HTTP_OK
175174

176175
cleanup:
177176
res.close()
@@ -324,7 +323,7 @@ class JSPInstrumentationForwardTests extends JSPTestBase {
324323
}
325324
}
326325
}
327-
res.code() == HttpStatus.OK_200
326+
res.code() == HTTP_OK
328327

329328
cleanup:
330329
res.close()
@@ -449,7 +448,7 @@ class JSPInstrumentationForwardTests extends JSPTestBase {
449448
}
450449
}
451450
}
452-
res.code() == HttpStatus.OK_200
451+
res.code() == HTTP_OK
453452

454453
cleanup:
455454
res.close()
@@ -535,7 +534,7 @@ class JSPInstrumentationForwardTests extends JSPTestBase {
535534
}
536535
}
537536
}
538-
res.code() == HttpStatus.INTERNAL_SERVER_ERROR_500
537+
res.code() == HTTP_INTERNAL_ERROR
539538

540539
cleanup:
541540
res.close()
@@ -604,7 +603,7 @@ class JSPInstrumentationForwardTests extends JSPTestBase {
604603
}
605604
}
606605
}
607-
res.code() == HttpStatus.NOT_FOUND_404
606+
res.code() == HTTP_NOT_FOUND
608607

609608
cleanup:
610609
res.close()

dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPTestBase.groovy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ abstract class JSPTestBase extends InstrumentationSpecification {
2626

2727
OkHttpClient client = OkHttpUtils.client()
2828

29+
// HTTP status code constants
30+
static final int HTTP_OK = 200
31+
static final int HTTP_NOT_FOUND = 404
32+
static final int HTTP_INTERNAL_ERROR = 500
33+
2934
@Override
3035
void configurePreAgent() {
3136
super.configurePreAgent()

0 commit comments

Comments
 (0)