-
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.
Signed-off-by: David Zane <[email protected]>
- Loading branch information
Showing
5 changed files
with
74 additions
and
49 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
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
35 changes: 35 additions & 0 deletions
35
...t/java/org/opensearch/action/search/SearchRequestOperationsListenerAssertingListener.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,35 @@ | ||
/* | ||
* 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.action.search; | ||
|
||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.CoreMatchers.nullValue; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
public class SearchRequestOperationsListenerAssertingListener extends SearchRequestOperationsListener { | ||
private volatile SearchPhase phase; | ||
|
||
@Override | ||
protected void onPhaseStart(SearchPhaseContext context) { | ||
assertThat(phase, is(nullValue())); | ||
phase = context.getCurrentPhase(); | ||
} | ||
|
||
@Override | ||
protected void onPhaseEnd(SearchPhaseContext context, SearchRequestContext searchRequestContext) { | ||
assertThat(phase, is(context.getCurrentPhase())); | ||
phase = null; | ||
} | ||
|
||
@Override | ||
protected void onPhaseFailure(SearchPhaseContext context, Throwable cause) { | ||
assertThat(phase, is(context.getCurrentPhase())); | ||
phase = null; | ||
} | ||
} |