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.
Add tests for RemoteGlobalMetadataManager (opensearch-project#14394) (o…
…pensearch-project#14458) * Add tests for RemoteGlobalMetadataManager * Add TestCapturingListener * Move TestCapturingListener to test/framework * Added javadoc --------- (cherry picked from commit 8e32ed7) Signed-off-by: Shivansh Arora <hishiv@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Signed-off-by: kkewwei <kkewwei@163.com>
- Loading branch information
Showing
8 changed files
with
573 additions
and
10 deletions.
There are no files selected for viewing
532 changes: 528 additions & 4 deletions
532
server/src/test/java/org/opensearch/gateway/remote/RemoteGlobalMetadataManagerTests.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
39 changes: 39 additions & 0 deletions
39
test/framework/src/main/java/org/opensearch/common/util/TestCapturingListener.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,39 @@ | ||
/* | ||
* 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.common.util; | ||
|
||
import org.opensearch.core.action.ActionListener; | ||
|
||
/** | ||
* A simple implementation of {@link ActionListener} that captures the response and failures used for testing purposes. | ||
* | ||
* @param <T> the result type | ||
*/ | ||
public class TestCapturingListener<T> implements ActionListener<T> { | ||
private T result; | ||
private Exception failure; | ||
|
||
@Override | ||
public void onResponse(T result) { | ||
this.result = result; | ||
} | ||
|
||
@Override | ||
public void onFailure(Exception e) { | ||
this.failure = e; | ||
} | ||
|
||
public T getResult() { | ||
return result; | ||
} | ||
|
||
public Exception getFailure() { | ||
return failure; | ||
} | ||
} |