-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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: Bharathwaj G <bharath78910@gmail.com>
- Loading branch information
1 parent
18c5be0
commit 57cc2cd
Showing
10 changed files
with
114 additions
and
36 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
19 changes: 19 additions & 0 deletions
19
rest-api-spec/src/main/resources/rest-api-spec/api/get_all_pits.json
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,19 @@ | ||
{ | ||
"get_all_pits":{ | ||
"documentation":{ | ||
"url":"https://opensearch.org/docs/latest/opensearch/rest-api/point_in_time/", | ||
"description":"Lists all active point in time searches." | ||
}, | ||
"stability":"stable", | ||
"url":{ | ||
"paths":[ | ||
{ | ||
"path":"/_search/point_in_time/_all", | ||
"methods":[ | ||
"GET" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} |
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
45 changes: 45 additions & 0 deletions
45
server/src/test/java/org/opensearch/search/pit/RestGetAllPitsActionTests.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,45 @@ | ||
/* | ||
* 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.search.pit; | ||
|
||
import org.apache.lucene.util.SetOnce; | ||
import org.opensearch.action.ActionListener; | ||
import org.opensearch.action.search.GetAllPitNodesRequest; | ||
import org.opensearch.action.search.GetAllPitNodesResponse; | ||
import org.opensearch.client.node.NodeClient; | ||
import org.opensearch.rest.RestRequest; | ||
import org.opensearch.rest.action.search.RestGetAllPitsAction; | ||
import org.opensearch.test.OpenSearchTestCase; | ||
import org.opensearch.test.client.NoOpNodeClient; | ||
import org.opensearch.test.rest.FakeRestChannel; | ||
import org.opensearch.test.rest.FakeRestRequest; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
/** | ||
* Tests for rest get all PITs action | ||
*/ | ||
public class RestGetAllPitsActionTests extends OpenSearchTestCase { | ||
|
||
public void testGetAllPits() throws Exception { | ||
SetOnce<Boolean> pitCalled = new SetOnce<>(); | ||
try (NodeClient nodeClient = new NoOpNodeClient(this.getTestName()) { | ||
@Override | ||
public void getAllPits(GetAllPitNodesRequest request, ActionListener<GetAllPitNodesResponse> listener) { | ||
pitCalled.set(true); | ||
} | ||
}) { | ||
RestGetAllPitsAction action = new RestGetAllPitsAction(); | ||
RestRequest request = new FakeRestRequest.Builder(xContentRegistry()).withPath("/_all").build(); | ||
FakeRestChannel channel = new FakeRestChannel(request, false, 0); | ||
action.handleRequest(request, channel, nodeClient); | ||
assertThat(pitCalled.get(), equalTo(true)); | ||
} | ||
} | ||
} |