-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support modifying inlineBinaryBody in request transform
Signed-off-by: Andre Kurait <[email protected]>
- Loading branch information
1 parent
e072e95
commit 9a5d323
Showing
5 changed files
with
96 additions
and
6 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
30 changes: 30 additions & 0 deletions
30
...rafficReplayer/src/test/java/org/opensearch/migrations/replay/util/RefSafeHolderTest.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,30 @@ | ||
package org.opensearch.migrations.replay.util; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.netty.util.ReferenceCountUtil; | ||
import org.mockito.MockedStatic; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
import static org.mockito.Mockito.*; | ||
|
||
public class RefSafeHolderTest { | ||
@Test | ||
void testCloseWithNonNullResource() { | ||
try (MockedStatic<ReferenceCountUtil> mockedStatic = mockStatic(ReferenceCountUtil.class)) { | ||
Object resource = new Object(); | ||
try (var ignored = RefSafeHolder.create(resource)) { | ||
mockedStatic.verify(() -> ReferenceCountUtil.release(resource), times(0)); | ||
} | ||
mockedStatic.verify(() -> ReferenceCountUtil.release(resource), times(1)); | ||
} | ||
} | ||
|
||
@Test | ||
void testCloseWithNullResource() { | ||
var holder = RefSafeHolder.create(null); | ||
assertNull(holder.get()); | ||
assertEquals("RefSafeHolder{null}", holder.toString()); | ||
holder.close(); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
TrafficCapture/trafficReplayer/src/test/resources/requests/raw/post_withPlainText.txt
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,7 @@ | ||
POST /test HTTP/1.1 | ||
Host: foo.example | ||
Authorization: Basic YWRtaW46YWRtaW4= | ||
Content-Type: text/plain | ||
Content-Length: 15 | ||
|
||
This is a test |