Skip to content

Commit 2832b24

Browse files
committed
Spotless and compile issue
Signed-off-by: Peter Nied <peternied@hotmail.com>
1 parent d45fcb9 commit 2832b24

10 files changed

Lines changed: 121 additions & 133 deletions

File tree

server/src/internalClusterTest/java/org/opensearch/action/admin/indices/view/ViewIT.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,18 @@
88

99
package org.opensearch.action.admin.indices.view;
1010

11-
import static org.hamcrest.Matchers.is;
12-
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertHitCount;
13-
14-
import java.util.List;
15-
1611
import org.opensearch.action.search.SearchRequest;
1712
import org.opensearch.action.search.SearchResponse;
1813
import org.opensearch.index.IndexNotFoundException;
1914
import org.opensearch.test.BackgroundIndexer;
2015
import org.opensearch.test.OpenSearchIntegTestCase;
2116
import org.opensearch.test.OpenSearchIntegTestCase.ClusterScope;
2217
import org.opensearch.test.OpenSearchIntegTestCase.Scope;
23-
import org.opensearch.test.junit.annotations.TestLogging;
18+
19+
import java.util.List;
20+
21+
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertHitCount;
22+
import static org.hamcrest.Matchers.is;
2423

2524
@ClusterScope(scope = Scope.TEST, numDataNodes = 2)
2625
public class ViewIT extends OpenSearchIntegTestCase {
@@ -40,15 +39,19 @@ private int createIndexWithDocs(final String indexName) throws Exception {
4039
}
4140

4241
private CreateViewAction.Response createView(final String name, final String indexPattern) throws Exception {
43-
final CreateViewAction.Request request = new CreateViewAction.Request(name, null, List.of(new CreateViewAction.Request.Target(indexPattern)));
42+
final CreateViewAction.Request request = new CreateViewAction.Request(
43+
name,
44+
null,
45+
List.of(new CreateViewAction.Request.Target(indexPattern))
46+
);
4447
final CreateViewAction.Response response = client().admin().indices().createView(request).actionGet();
4548
performRemoteStoreTestAction();
4649
return response;
4750
}
4851

4952
private SearchResponse searchView(final String viewName) throws Exception {
5053
final SearchViewAction.Request request = SearchViewAction.createRequestWith(viewName, new SearchRequest());
51-
final SearchResponse response = client().searchView(request).actionGet();
54+
final SearchResponse response = client().admin().indices().searchView(request).actionGet();
5255
return response;
5356
}
5457

server/src/main/java/org/opensearch/action/admin/indices/view/CreateViewAction.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
package org.opensearch.action.admin.indices.view;
22

3-
import java.io.IOException;
4-
import java.util.ArrayList;
5-
import java.util.List;
6-
import java.util.Objects;
7-
83
import org.opensearch.action.ActionRequestValidationException;
94
import org.opensearch.action.ActionType;
105
import org.opensearch.action.ValidateActions;
@@ -34,6 +29,11 @@
3429
import org.opensearch.threadpool.ThreadPool;
3530
import org.opensearch.transport.TransportService;
3631

32+
import java.io.IOException;
33+
import java.util.ArrayList;
34+
import java.util.List;
35+
import java.util.Objects;
36+
3737
/** Action to create a view */
3838
public class CreateViewAction extends ActionType<CreateViewAction.Response> {
3939

@@ -83,11 +83,9 @@ public boolean equals(Object o) {
8383
if (this == o) return true;
8484
if (o == null || getClass() != o.getClass()) return false;
8585
Request that = (Request) o;
86-
return name.equals(that.name)
87-
&& description.equals(that.description)
88-
&& targets.equals(that.targets);
86+
return name.equals(that.name) && description.equals(that.description) && targets.equals(that.targets);
8987
}
90-
88+
9189
@Override
9290
public int hashCode() {
9391
return Objects.hash(name, description, targets);
@@ -142,7 +140,7 @@ public boolean equals(Object o) {
142140
Target that = (Target) o;
143141
return indexPattern.equals(that.indexPattern);
144142
}
145-
143+
146144
@Override
147145
public int hashCode() {
148146
return Objects.hash(indexPattern);
@@ -170,7 +168,7 @@ public ActionRequestValidationException validate() {
170168
static {
171169
PARSER.declareString(ConstructingObjectParser.constructorArg(), View.Target.INDEX_PATTERN_FIELD);
172170
}
173-
171+
174172
public static Target fromXContent(final XContentParser parser) throws IOException {
175173
return PARSER.parse(parser, null);
176174
}
@@ -187,7 +185,7 @@ public static Target fromXContent(final XContentParser parser) throws IOExceptio
187185
PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), View.DESCRIPTION_FIELD);
188186
PARSER.declareObjectArray(ConstructingObjectParser.constructorArg(), (p, c) -> Target.fromXContent(p), View.TARGETS_FIELD);
189187
}
190-
188+
191189
public static Request fromXContent(final XContentParser parser) throws IOException {
192190
return PARSER.parse(parser, null);
193191
}
@@ -197,7 +195,7 @@ public static Request fromXContent(final XContentParser parser) throws IOExcepti
197195
@ExperimentalApi
198196
public static class Response extends ActionResponse implements ToXContentObject {
199197

200-
private final View createdView;
198+
private final View createdView;
201199

202200
public Response(final View createdView) {
203201
this.createdView = createdView;
@@ -220,7 +218,7 @@ public XContentBuilder toXContent(final XContentBuilder builder, final Params pa
220218
builder.endObject();
221219
return builder;
222220
}
223-
221+
224222
private static final ConstructingObjectParser<Response, Void> PARSER = new ConstructingObjectParser<>(
225223
"create_view_response",
226224
args -> new Response((View) args[0])

server/src/main/java/org/opensearch/action/admin/indices/view/SearchViewAction.java

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
package org.opensearch.action.admin.indices.view;
22

3-
import java.io.IOException;
4-
import java.util.Objects;
5-
import java.util.function.Function;
6-
73
import org.opensearch.action.ActionRequestValidationException;
84
import org.opensearch.action.ActionType;
95
import org.opensearch.action.search.SearchRequest;
@@ -21,6 +17,10 @@
2117
import org.opensearch.tasks.Task;
2218
import org.opensearch.transport.TransportService;
2319

20+
import java.io.IOException;
21+
import java.util.Objects;
22+
import java.util.function.Function;
23+
2424
import static org.opensearch.action.ValidateActions.addValidationError;
2525

2626
/** Action to create a view */
@@ -34,15 +34,15 @@ private SearchViewAction() {
3434
}
3535

3636
/** Given a search request, creates a ViewSearchRequest */
37-
public static Request createRequestWith(final String view, final SearchRequest searchRequest)
38-
throws IOException {
37+
public static Request createRequestWith(final String view, final SearchRequest searchRequest) throws IOException {
3938
final BytesStreamOutput savedSearchRequest = new BytesStreamOutput();
4039
searchRequest.writeTo(savedSearchRequest);
4140
savedSearchRequest.writeString(view);
4241

4342
final BytesStreamInput input = new BytesStreamInput(savedSearchRequest.bytes().toBytesRef().bytes);
4443
return new Request(input);
4544
}
45+
4646
/**
4747
* Wraps the functionality of search requests and tailors for what is available
4848
* when searching through views
@@ -71,10 +71,9 @@ public boolean equals(Object o) {
7171
if (this == o) return true;
7272
if (o == null || getClass() != o.getClass()) return false;
7373
Request that = (Request) o;
74-
return view.equals(that.view)
75-
&& super.equals(that);
74+
return view.equals(that.view) && super.equals(that);
7675
}
77-
76+
7877
@Override
7978
public int hashCode() {
8079
return Objects.hash(view, super.hashCode());
@@ -118,10 +117,7 @@ public static class TransportAction extends HandledTransportAction<Request, Sear
118117
private final ViewService viewService;
119118

120119
@Inject
121-
public TransportAction(
122-
final TransportService transportService,
123-
final ActionFilters actionFilters,
124-
final ViewService viewService) {
120+
public TransportAction(final TransportService transportService, final ActionFilters actionFilters, final ViewService viewService) {
125121
super(NAME, transportService, actionFilters, Request::new);
126122
this.viewService = viewService;
127123
}

server/src/main/java/org/opensearch/action/admin/indices/view/ViewService.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
package org.opensearch.action.admin.indices.view;
22

3-
import java.util.List;
4-
import java.util.Optional;
5-
import java.util.stream.Collectors;
6-
73
import org.apache.logging.log4j.LogManager;
84
import org.apache.logging.log4j.Logger;
95
import org.opensearch.ResourceNotFoundException;
@@ -17,6 +13,10 @@
1713
import org.opensearch.cluster.service.ClusterService;
1814
import org.opensearch.core.action.ActionListener;
1915

16+
import java.util.List;
17+
import java.util.Optional;
18+
import java.util.stream.Collectors;
19+
2020
/** Service to interact with views, create, retrieve, update, and delete */
2121
public class ViewService {
2222

@@ -72,7 +72,8 @@ public void searchView(final SearchViewAction.Request request, final ActionListe
7272
}
7373
final View view = optView.get();
7474

75-
final String[] indices = view.getTargets().stream()
75+
final String[] indices = view.getTargets()
76+
.stream()
7677
.map(View.Target::getIndexPattern)
7778
.collect(Collectors.toList())
7879
.toArray(new String[0]);

server/src/main/java/org/opensearch/cluster/metadata/View.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public View(final StreamInput in) throws IOException {
4646
this(in.readString(), in.readOptionalString(), in.readVLong(), in.readVLong(), in.readList(Target::new));
4747
}
4848

49-
5049
public String getName() {
5150
return name;
5251
}
@@ -113,7 +112,7 @@ public boolean equals(Object o) {
113112
Target that = (Target) o;
114113
return indexPattern.equals(that.indexPattern);
115114
}
116-
115+
117116
@Override
118117
public int hashCode() {
119118
return Objects.hash(indexPattern);

server/src/main/java/org/opensearch/node/Node.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -861,10 +861,7 @@ protected Node(
861861
metadataCreateIndexService
862862
);
863863

864-
final ViewService viewService = new ViewService(
865-
clusterService,
866-
client
867-
);
864+
final ViewService viewService = new ViewService(clusterService, client);
868865

869866
Collection<Object> pluginComponents = pluginsService.filterPlugins(Plugin.class)
870867
.stream()

0 commit comments

Comments
 (0)