Skip to content

Commit fc63a05

Browse files
authored
Fix test issues (#5137)
Signed-off-by: Jorge Bescos Gascon <[email protected]>
1 parent 53b0fd2 commit fc63a05

File tree

2 files changed

+10
-95
lines changed

2 files changed

+10
-95
lines changed

connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/StressTest.java

Lines changed: 0 additions & 87 deletions
This file was deleted.

tests/integration/jersey-4697/src/test/java/org/glassfish/jersey/tests/integration/jersey4697/MonitoringEventListenerTest.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -52,7 +52,7 @@
5252

5353
public class MonitoringEventListenerTest extends JerseyTest {
5454

55-
private static final long TIMEOUT = 500;
55+
private static final long TIMEOUT = 1000;
5656
private static final String MBEAN_EXCEPTION =
5757
"org.glassfish.jersey:type=MonitoringEventListenerTest,subType=Global,exceptions=ExceptionMapper";
5858

@@ -116,6 +116,7 @@ protected Application configure() {
116116
resourceConfig.property(ServerProperties.MONITORING_ENABLED, true);
117117
resourceConfig.property(ServerProperties.MONITORING_STATISTICS_ENABLED, true);
118118
resourceConfig.property(ServerProperties.MONITORING_STATISTICS_MBEANS_ENABLED, true);
119+
// Scheduler will process 1000 events per second
119120
resourceConfig.property(ServerProperties.MONITORING_STATISTICS_REFRESH_INTERVAL, 1);
120121
resourceConfig.setApplicationName("MonitoringEventListenerTest");
121122
return resourceConfig;
@@ -126,17 +127,18 @@ public void exceptionInScheduler() throws Exception {
126127
final Long ERRORS_BEFORE_FAIL = 10L;
127128
// Send some requests to process some statistics.
128129
request(ERRORS_BEFORE_FAIL);
129-
// Give some time to the scheduler to collect data.
130+
// Give some time to process events
130131
Thread.sleep(TIMEOUT);
131-
// All events were consumed by scheduler
132+
// Verify the exceptionMapperEvents is empty, because no event of this type was sent yet
132133
queueIsEmpty();
133-
// Make the scheduler to fail. No more statistics are collected.
134+
// Sending one event that will make an internal error in the scheduler.
135+
// No new events will be pushed in the queues after this.
134136
makeFailure();
135-
// Sending again requests
137+
// Sending again requests. These events will not be processed, so they will not be counted for statistics.
136138
request(20);
139+
// The expectation is that the scheduler is not going to process previous events because there was a failure before.
140+
// We give some time before checking that no new errors are registered.
137141
Thread.sleep(TIMEOUT);
138-
// No new events should be accepted because scheduler is not working.
139-
queueIsEmpty();
140142
Long monitoredErrors = mappedErrorsFromJMX(MBEAN_EXCEPTION);
141143
assertEquals(ERRORS_BEFORE_FAIL, monitoredErrors);
142144
}

0 commit comments

Comments
 (0)