Skip to content

Commit

Permalink
Checkstyle fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-ivanov-es committed Dec 4, 2024
1 parent 7e16865 commit 75691c2
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 27 deletions.
16 changes: 8 additions & 8 deletions server/src/main/java/org/elasticsearch/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,14 @@ public class Version implements VersionId<Version>, ToXContentFragment {
}

private static void assertRestApiVersion() {
assert RestApiVersion.current().major == CURRENT.major && RestApiVersion.previous().major == CURRENT.major - 1
: "RestApiVersion must be upgraded "
+ "to reflect major from Version.CURRENT ["
+ CURRENT.major
+ "]"
+ " but is still set to ["
+ RestApiVersion.current().major
+ "]";
assert RestApiVersion.current().major == CURRENT.major && RestApiVersion.previous().major == CURRENT.major - 1
: "RestApiVersion must be upgraded "
+ "to reflect major from Version.CURRENT ["
+ CURRENT.major
+ "]"
+ " but is still set to ["
+ RestApiVersion.current().major
+ "]";
}

public static Version readVersion(StreamInput in) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import org.elasticsearch.common.xcontent.ChunkedToXContentHelper;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.core.SuppressForbidden;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.index.shard.IndexLongFieldRange;
import org.elasticsearch.indices.SystemIndexDescriptor;
import org.elasticsearch.xcontent.ToXContent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
package org.elasticsearch.env;

import org.elasticsearch.Build;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.gateway.MetadataStateFormat;
import org.elasticsearch.index.IndexVersion;
import org.elasticsearch.index.IndexVersions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ public void testFailsToReadFormatWithoutVersion() throws IOException {
assertThat(resource, notNullValue());
Files.copy(resource, stateDir.resolve(NodeMetadata.FORMAT.getStateFileName(between(0, Integer.MAX_VALUE))));

ElasticsearchException ex = assertThrows(ElasticsearchException.class,
() -> NodeMetadata.FORMAT.loadLatestState(logger, xContentRegistry(), tempDir));
ElasticsearchException ex = assertThrows(
ElasticsearchException.class,
() -> NodeMetadata.FORMAT.loadLatestState(logger, xContentRegistry(), tempDir)
);
Throwable rootCause = ex.getRootCause();
assertTrue(rootCause instanceof IllegalStateException);
assertEquals("Node version is required in node metadata", rootCause.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,15 @@
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.xcontent.support.XContentMapValues;
import org.elasticsearch.core.IOUtils;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.test.ClasspathUtils;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.elasticsearch.test.rest.TestFeatureService;
import org.elasticsearch.test.rest.yaml.restspec.ClientYamlSuiteRestApi;
import org.elasticsearch.test.rest.yaml.restspec.ClientYamlSuiteRestSpec;
import org.elasticsearch.test.rest.yaml.section.ClientYamlTestSection;
import org.elasticsearch.test.rest.yaml.section.ClientYamlTestSuite;
import org.elasticsearch.test.rest.yaml.section.DoSection;
import org.elasticsearch.test.rest.yaml.section.ExecutableSection;
import org.elasticsearch.xcontent.NamedXContentRegistry;
import org.elasticsearch.xcontent.ParseField;
import org.junit.AfterClass;
import org.junit.Before;

Expand All @@ -58,7 +55,6 @@
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
* Runs a suite of yaml tests shared with all the official Elasticsearch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,7 @@ private String formatStatusCodeMessage(ClientYamlTestResponse restTestResponse,
)
);

private static NodeSelector buildNodeSelector(String name, XContentParser parser)
throws IOException {
private static NodeSelector buildNodeSelector(String name, XContentParser parser) throws IOException {
return switch (name) {
case "attribute" -> parseAttributeValuesSelector(parser);
case "version" -> parseVersionSelector(parser);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.util.set.Sets;
import org.elasticsearch.core.CheckedFunction;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.test.rest.yaml.ClientYamlTestExecutionContext;
import org.elasticsearch.test.rest.yaml.Features;
import org.elasticsearch.xcontent.XContentLocation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.logging.HeaderWarning;
import org.elasticsearch.core.Strings;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.test.rest.yaml.ClientYamlTestExecutionContext;
import org.elasticsearch.test.rest.yaml.ClientYamlTestResponse;
import org.elasticsearch.xcontent.XContentLocation;
import org.elasticsearch.xcontent.XContentParseException;
import org.elasticsearch.xcontent.XContentParser;
Expand All @@ -31,21 +28,16 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;

import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;
import static java.util.Collections.singletonList;
import static java.util.Collections.singletonMap;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.endsWith;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

public class DoSectionTests extends AbstractClientYamlTestFragmentParserTestCase {

Expand Down

0 comments on commit 75691c2

Please sign in to comment.