Skip to content

Commit

Permalink
remove v7 testing from RestActionTestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
jakelandis committed Sep 23, 2024
1 parent db33cdf commit 80d97cd
Show file tree
Hide file tree
Showing 17 changed files with 16 additions and 865 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.index.get.GetResult;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse;
Expand All @@ -26,12 +25,6 @@
import org.junit.Before;
import org.mockito.Mockito;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static java.util.Collections.emptyMap;
import static org.elasticsearch.index.seqno.SequenceNumbers.UNASSIGNED_SEQ_NO;
import static org.elasticsearch.rest.RestStatus.OK;
Expand All @@ -43,7 +36,6 @@ public final class RestGetSourceActionTests extends RestActionTestCase {
private static RestRequest request = new FakeRestRequest();
private static FakeRestChannel channel = new FakeRestChannel(request, true, 0);
private static RestGetSourceResponseListener listener = new RestGetSourceResponseListener(channel, request);
private final List<String> compatibleMediaType = Collections.singletonList(randomCompatibleMediaType(RestApiVersion.V_7));

@Before
public void setUpAction() {
Expand Down Expand Up @@ -89,36 +81,4 @@ public void testRestGetSourceActionWithMissingDocumentSource() {

assertThat(exception.getMessage(), equalTo("Source not found [index1]/[1]"));
}

/**
* test deprecation is logged if type is used in path
*/
public void testTypeInPath() {
for (RestRequest.Method method : Arrays.asList(RestRequest.Method.GET, RestRequest.Method.HEAD)) {
RestRequest request = new FakeRestRequest.Builder(xContentRegistry()).withHeaders(Map.of("Accept", compatibleMediaType))
.withMethod(method)
.withPath("/some_index/some_type/id/_source")
.build();
dispatchRequest(request);
assertCriticalWarnings(RestGetSourceAction.TYPES_DEPRECATION_MESSAGE);
}
}

/**
* test deprecation is logged if type is used as parameter
*/
public void testTypeParameter() {
Map<String, String> params = new HashMap<>();
params.put("type", "some_type");
for (RestRequest.Method method : Arrays.asList(RestRequest.Method.GET, RestRequest.Method.HEAD)) {
RestRequest request = new FakeRestRequest.Builder(xContentRegistry()).withHeaders(Map.of("Accept", compatibleMediaType))
.withMethod(method)
.withPath("/some_index/_source/id")
.withParams(params)
.build();
dispatchRequest(request);
assertCriticalWarnings(RestGetSourceAction.TYPES_DEPRECATION_MESSAGE);
}
}

}
Loading

0 comments on commit 80d97cd

Please sign in to comment.