forked from pinpoint-apm/pinpoint
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pinpoint-apm#11481] Fix DirectByteBuffer leak in ActiveThreadCount
- Loading branch information
Showing
6 changed files
with
107 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...ava/com/navercorp/pinpoint/profiler/receiver/grpc/PinpointClientResponseObserverTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.navercorp.pinpoint.profiler.receiver.grpc; | ||
|
||
import com.google.protobuf.Empty; | ||
import io.grpc.stub.ClientCallStreamObserver; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
class PinpointClientResponseObserverTest { | ||
|
||
@Test | ||
void isReady_true() { | ||
GrpcProfilerStreamSocket<String, Empty> socket = mock(GrpcProfilerStreamSocket.class); | ||
PinpointClientResponseObserver<String, Empty> responseObserver = new PinpointClientResponseObserver<>(socket); | ||
|
||
ClientCallStreamObserver<String> requestStream = mock(ClientCallStreamObserver.class); | ||
when(requestStream.isReady()).thenReturn(true); | ||
responseObserver.beforeStart(requestStream); | ||
|
||
Assertions.assertTrue(responseObserver.isReady()); | ||
} | ||
|
||
@Test | ||
void isReady_false() { | ||
GrpcProfilerStreamSocket<String, Empty> socket = mock(GrpcProfilerStreamSocket.class); | ||
PinpointClientResponseObserver<String, Empty> responseObserver = new PinpointClientResponseObserver<>(socket); | ||
|
||
Assertions.assertFalse(responseObserver.isReady()); | ||
|
||
ClientCallStreamObserver<String> requestStream = mock(ClientCallStreamObserver.class); | ||
responseObserver.beforeStart(requestStream); | ||
Assertions.assertFalse(responseObserver.isReady()); | ||
} | ||
} |