Skip to content

Commit

Permalink
Applying spotless formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Garg <gkharsh@amazon.com>
  • Loading branch information
Harsh Garg committed Sep 25, 2024
1 parent aa9dc1d commit 0f48aea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

package org.opensearch.rest.action.cat;

import org.junit.Before;
import org.opensearch.Version;
import org.opensearch.action.admin.indices.stats.CommonStats;
import org.opensearch.action.admin.indices.stats.IndexStats;
Expand All @@ -52,13 +51,13 @@
import org.opensearch.rest.pagination.PageToken;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.test.rest.FakeRestRequest;
import org.junit.Before;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

import static org.hamcrest.Matchers.equalTo;
Expand Down Expand Up @@ -170,7 +169,7 @@ public void testBuildPaginatedTable() {
final RestIndicesListAction indicesListAction = new RestIndicesListAction();
List<String> indicesList = new ArrayList<>(indicesMetadatas.keySet());
// Using half of the indices from metadata list for a page
String[] indicesToBeQueried = indicesList.subList(0, indicesMetadatas.size()/2).toArray(new String[0]);
String[] indicesToBeQueried = indicesList.subList(0, indicesMetadatas.size() / 2).toArray(new String[0]);
PageToken pageToken = new PageToken("foo", "indices");
final Table table = action.buildTable(
new FakeRestRequest(),
Expand All @@ -190,7 +189,7 @@ public void testBuildPaginatedTable() {
assertEquals(pageToken.getPaginatedEntity(), table.getPageToken().getPaginatedEntity());

// Table should only contain the indices present in indicesToBeQueried
assertThat(table.getRows().size(), equalTo(indicesMetadatas.size()/2));
assertThat(table.getRows().size(), equalTo(indicesMetadatas.size() / 2));
assertTableRows(table);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_CREATION_DATE;
import static com.carrotsearch.randomizedtesting.RandomizedTest.getRandom;
import static org.opensearch.rest.pagination.PageParams.PARAM_ASC_SORT_VALUE;
import static org.opensearch.rest.pagination.PageParams.PARAM_DESC_SORT_VALUE;
import static com.carrotsearch.randomizedtesting.RandomizedTest.getRandom;

public class IndexPaginationStrategyTests extends OpenSearchTestCase {

Expand Down Expand Up @@ -65,7 +65,10 @@ public void testRetrieveAllIndicesWithVaryingPageSize() {
// Asserting all the indices received
int responseItr = 0;
if (PARAM_ASC_SORT_VALUE.equals(sortOrder)) {
for (int indexNumber = (pageNumber - 1) * pageSize; indexNumber < Math.min(100, pageNumber * pageSize); indexNumber++) {
for (int indexNumber = (pageNumber - 1) * pageSize; indexNumber < Math.min(
100,
pageNumber * pageSize
); indexNumber++) {
assertEquals("test-index-" + (indexNumber + 1), paginationStrategy.getRequestedEntities().get(responseItr));
responseItr++;
}
Expand Down Expand Up @@ -222,7 +225,6 @@ public void testRetrieveIndicesWithSizeOneAndCurrentIndexGetsDeletedAscOrder() {
assertPaginationResult(paginationStrategy, 1, true);
assertEquals("test-index-3", paginationStrategy.getRequestedEntities().get(0));


// Deleting test-index-4 which is not yet displayed which otherwise should have been displayed in the following query
// instead test-index-5 should now get displayed.
clusterState = deleteIndexFromClusterState(clusterState, 4);
Expand Down

0 comments on commit 0f48aea

Please sign in to comment.