-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move TestCapturingListener to test/framework
Signed-off-by: Shivansh Arora <[email protected]>
- Loading branch information
Showing
3 changed files
with
80 additions
and
71 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
28 changes: 0 additions & 28 deletions
28
server/src/test/java/org/opensearch/gateway/remote/RemoteStateTestUtil.java
This file was deleted.
Oops, something went wrong.
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; | ||
} | ||
} |