forked from opensearch-project/OpenSearch
-
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.
Add tests for RemoteGlobalMetadataManager (opensearch-project#14394)
* Add tests for RemoteGlobalMetadataManager Signed-off-by: Shivansh Arora <[email protected]> * Add TestCapturingListener Signed-off-by: Shivansh Arora <[email protected]> * Move TestCapturingListener to test/framework Signed-off-by: Shivansh Arora <[email protected]> * Added javadoc Signed-off-by: Shivansh Arora <[email protected]> --------- Signed-off-by: Shivansh Arora <[email protected]>
- 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; | ||
} | ||
} |