forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Gagan Juneja <[email protected]>
- Loading branch information
Gagan Juneja
committed
Jan 5, 2024
1 parent
1d0e11c
commit 04867e8
Showing
3 changed files
with
117 additions
and
0 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
34 changes: 34 additions & 0 deletions
34
server/src/test/java/org/opensearch/tasks/TaskThreadContextStatePropagatorTests.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,34 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.tasks; | ||
|
||
import org.opensearch.test.OpenSearchTestCase; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import static org.opensearch.tasks.TaskResourceTrackingService.TASK_ID; | ||
|
||
public class TaskThreadContextStatePropagatorTests extends OpenSearchTestCase { | ||
private final TaskThreadContextStatePropagator taskThreadContextStatePropagator = new TaskThreadContextStatePropagator(); | ||
|
||
public void testTransient() { | ||
Map<String, Object> transientHeader = new HashMap<>(); | ||
transientHeader.put(TASK_ID, "t_1"); | ||
Map<String, Object> transientPropagatedHeader = taskThreadContextStatePropagator.transients(transientHeader, false); | ||
assertEquals("t_1", transientPropagatedHeader.get(TASK_ID)); | ||
} | ||
|
||
public void testTransientForSystemContext() { | ||
Map<String, Object> transientHeader = new HashMap<>(); | ||
transientHeader.put(TASK_ID, "t_1"); | ||
Map<String, Object> transientPropagatedHeader = taskThreadContextStatePropagator.transients(transientHeader, true); | ||
assertEquals("t_1", transientPropagatedHeader.get(TASK_ID)); | ||
} | ||
} |
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