@@ -0,0 +1,2128 @@
+/*%0A * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one%0A * or more contributor license agreements. Licensed under the Elastic License%0A * 2.0 and the Server Side Public License, v 1; you may not use this file except%0A * in compliance with, at your election, the Elastic License 2.0 or the Server%0A * Side Public License, v 1.%0A */%0Apackage org.elasticsearch.http.snapshots;%0A%0Aimport org.apache.http.client.methods.HttpGet;%0Aimport org.elasticsearch.client.Request;%0Aimport org.elasticsearch.client.Response;%0Aimport org.elasticsearch.common.io.Streams;%0Aimport org.elasticsearch.snapshots.AbstractSnapshotIntegTestCase;%0Aimport org.hamcrest.Matchers;%0A%0Aimport java.io.InputStream;%0Aimport java.net.HttpURLConnection;%0Aimport java.util.List;%0A%0Apublic class RestCatSnapshotsIT extends AbstractSnapshotRestTestCase %7B%0A%0A    public void testCatSnapshotsDefaultsToAllRepositories() throws Exception %7B%0A        final String repoName1 = %22test-repo-1%22;%0A        final String repoName2 = %22test-repo-2%22;%0A        AbstractSnapshotIntegTestCase.createRepository(logger, repoName1, %22fs%22);%0A        AbstractSnapshotIntegTestCase.createRepository(logger, repoName2, %22fs%22);%0A        final int snapshotsRepo1 = randomIntBetween(1, 20);%0A        AbstractSnapshotIntegTestCase.createNSnapshots(logger, repoName1, snapshotsRepo1);%0A        final int snapshotsRepo2 = randomIntBetween(1, 20);%0A        AbstractSnapshotIntegTestCase.createNSnapshots(logger, repoName2, snapshotsRepo2);%0A        final Response response = getRestClient().performRequest(new Request(HttpGet.METHOD_NAME, %22/_cat/snapshots%22));%0A        assertEquals(HttpURLConnection.HTTP_OK, response.getStatusLine().getStatusCode());%0A        final List%3CString%3E allLines;%0A        try (InputStream in = response.getEntity().getContent()) %7B%0A            allLines = Streams.readAllLines(in);%0A        %7D%0A        assertThat(allLines, Matchers.hasSize(snapshotsRepo1 + snapshotsRepo2));%0A        assertEquals(allLines.stream().filter(l -%3E l.contains(repoName1)).count(), snapshotsRepo1);%0A        assertEquals(allLines.stream().filter(l -%3E l.contains(repoName2)).count(), snapshotsRepo2);%0A    %7D%0A%7D%0A

Test Cat Snapshots API Defaults (#76161) (#76169)