You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "epugh (via GitHub)" <gi...@apache.org> on 2026/03/03 12:27:22 UTC
[PR] Migrate CancelTaskAPI to JAX-RS and use generated SolrJ client in tests [solr]
epugh opened a new pull request, #4180:
URL: https://github.com/apache/solr/pull/4180
Migrates `CancelTaskAPI` from the homegrown `@EndPoint` annotation to standard JAX-RS, and replaces the manual `GenericSolrRequest` usage in the integration test with the code-generated `TasksApi.CancelTask` SolrJ client.
## API interface (`solr/api`)
- New `CancelTaskApi` interface with `@Path`, `@GET`, `@QueryParam` JAX-RS annotations using `@StoreApiParameters` for core/collection path support
- Returns `FlexibleSolrJerseyResponse` (instead of `SolrJerseyResponse`) so the dynamic `cancellationResult` field is captured via `@JsonAnySetter` when deserializing
## Server implementation (`solr/core`)
- `CancelTaskAPI` extends `JerseyResource`, implements `CancelTaskApi`, uses `@Inject` for `SolrCore`/`SolrQueryRequest`/`SolrQueryResponse`
- Delegates to `QueryCancellationHandler.handleRequestBody()` (logic stays in V1 handler), then copies non-header entries from `solrQueryResponse` into the returned jersey response — required because Jersey's JSON path serializes the returned object directly, not `solrQueryResponse`
- `QueryCancellationHandler` now uses `getJerseyResources()` / empty `getApis()` instead of `AnnotatedApi`
## Test
Uses the generated `TasksApi.CancelTask` with `SolrJettyTestRule`. The generated class handles V2 URL routing (`/api/…` vs `/solr/…`) automatically via `getApiVersion() == V2`, eliminating the need to construct a separate V2 `HttpSolrClient`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Migrate CancelTaskAPI to JAX-RS [solr]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #4180:
URL: https://github.com/apache/solr/pull/4180#issuecomment-5210783039
This PR is now closed due to 60 days of inactivity after being marked as stale. Re-opening this PR is still possible, in which case it will be marked as active again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Migrate CancelTaskAPI to JAX-RS [solr]
Posted by "gerlowskija (via GitHub)" <gi...@apache.org>.
gerlowskija commented on code in PR #4180:
URL: https://github.com/apache/solr/pull/4180#discussion_r3046185031
##########
solr/core/src/test/org/apache/solr/handler/admin/api/CancelTaskAPITest.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.handler.admin.api;
+
+import static org.apache.solr.core.CoreContainer.ALLOW_PATHS_SYSPROP;
+import static org.apache.solr.security.AllowListUrlChecker.ENABLE_URL_ALLOW_LIST;
+
+import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.client.api.model.FlexibleSolrJerseyResponse;
+import org.apache.solr.client.api.model.IndexType;
+import org.apache.solr.client.solrj.request.TasksApi;
+import org.apache.solr.common.util.EnvUtils;
+import org.apache.solr.util.ExternalPaths;
+import org.apache.solr.util.SolrJettyTestRule;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+/** Integration tests for the {@link CancelTaskAPI} V2 endpoint. */
+public class CancelTaskAPITest extends SolrTestCaseJ4 {
Review Comment:
[0] Looks like a good bit of duplication between this and the existing `TestTaskManagement`. Maybe it makes sense to drop this new test class, and instead modify TestTaskManagement to sometimes use the v2 version of the API?
##########
changelog/unreleased/migrate-cancel-task-api.yml:
##########
@@ -0,0 +1,7 @@
+title: Migrate CancelTasksAPI to JAX-RS. Cancel Task API now has OpenAPI and SolrJ support.
+type: changed
Review Comment:
[0] We've added a whole new SolrRequest/SolrResponse to SolrJ - this would probably be better as "added" IMO.
##########
changelog/unreleased/migrate-cancel-task-api.yml:
##########
@@ -0,0 +1,7 @@
+title: Migrate CancelTasksAPI to JAX-RS. Cancel Task API now has OpenAPI and SolrJ support.
Review Comment:
[0] As in other PRs, users are unlikely to care about the implementing framework. What they're more likely to care about is the SolrJ binding and where they can find it.
##########
solr/core/src/java/org/apache/solr/handler/admin/api/CancelTaskAPI.java:
##########
@@ -17,32 +17,56 @@
package org.apache.solr.handler.admin.api;
-import static org.apache.solr.client.solrj.SolrRequest.METHOD.GET;
+import static org.apache.solr.response.SolrQueryResponse.RESPONSE_HEADER_KEY;
+import static org.apache.solr.security.PermissionNameProvider.Name.READ_PERM;
-import org.apache.solr.api.EndPoint;
+import jakarta.inject.Inject;
+import org.apache.solr.api.JerseyResource;
+import org.apache.solr.client.api.endpoint.CancelTaskApi;
+import org.apache.solr.client.api.model.FlexibleSolrJerseyResponse;
+import org.apache.solr.core.SolrCore;
import org.apache.solr.handler.component.QueryCancellationHandler;
+import org.apache.solr.jersey.PermissionName;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.SolrQueryResponse;
-import org.apache.solr.security.PermissionNameProvider;
/**
* V2 API for cancelling a currently running "task".
*
- * <p>This API (GET /v2/collections/collectionName/tasks/cancel) is analogous to the v1
- * /solr/collectionName/tasks/cancel API.
+ * <p>This API (GET /v2/collections/{collectionName}/tasks/cancel and GET
+ * /v2/cores/{coreName}/tasks/cancel) is analogous to the v1
+ * /solr/{collectionName|coreName}/tasks/cancel API.
*/
-public class CancelTaskAPI {
- private final QueryCancellationHandler cancellationHandler;
+public class CancelTaskAPI extends JerseyResource implements CancelTaskApi {
+ private final SolrCore solrCore;
+ private final SolrQueryRequest solrQueryRequest;
+ private final SolrQueryResponse solrQueryResponse;
- public CancelTaskAPI(QueryCancellationHandler cancellationHandler) {
- this.cancellationHandler = cancellationHandler;
+ @Inject
+ public CancelTaskAPI(SolrCore solrCore, SolrQueryRequest req, SolrQueryResponse rsp) {
+ this.solrCore = solrCore;
+ this.solrQueryRequest = req;
+ this.solrQueryResponse = rsp;
}
- @EndPoint(
- path = {"/tasks/cancel"},
- method = GET,
- permission = PermissionNameProvider.Name.READ_PERM)
- public void cancelActiveTask(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
- cancellationHandler.handleRequestBody(req, rsp);
+ @Override
+ @PermissionName(READ_PERM)
+ public FlexibleSolrJerseyResponse cancelTask(String queryUUID) throws Exception {
+ final FlexibleSolrJerseyResponse response =
+ instantiateJerseyResponse(FlexibleSolrJerseyResponse.class);
+ ensureRequiredParameterProvided("queryUUID", queryUUID);
+ final QueryCancellationHandler cancellationHandler =
+ (QueryCancellationHandler) solrCore.getRequestHandler("/tasks/cancel");
Review Comment:
[-1] The way we've been handling the v1/v2 split is to have the actual logic/functionality live in v2, and have the v1 code (i.e. QueryCancellationHandler) call into those methods. This serves a few purposes:
1. Makes it easier to delete the v1 code down the road.
2. Prevents v2 code from "falling behind" or being forgotten when query-params or API functionality changes
3. Ensures better test coverage - Most of our test code is for v1 APIs, so having the v1 code call v2 gives us at least some confidence that the v2 endpoints work despite their lack of test coverage.
That's all to say - the actual logic in QueryCancellationHandler needs moved over here in order to get all those benefits.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Migrate CancelTaskAPI to JAX-RS [solr]
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #4180:
URL: https://github.com/apache/solr/pull/4180#issuecomment-5216701220
We have a seperate effort led by @jaykay12 that is half way done that is a much better effort!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Migrate CancelTaskAPI to JAX-RS [solr]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #4180:
URL: https://github.com/apache/solr/pull/4180#discussion_r2878014201
##########
solr/core/src/java/org/apache/solr/handler/admin/api/CancelTaskAPI.java:
##########
@@ -17,32 +17,54 @@
package org.apache.solr.handler.admin.api;
-import static org.apache.solr.client.solrj.SolrRequest.METHOD.GET;
+import static org.apache.solr.response.SolrQueryResponse.RESPONSE_HEADER_KEY;
+import static org.apache.solr.security.PermissionNameProvider.Name.READ_PERM;
-import org.apache.solr.api.EndPoint;
+import jakarta.inject.Inject;
+import org.apache.solr.api.JerseyResource;
+import org.apache.solr.client.api.endpoint.CancelTaskApi;
+import org.apache.solr.client.api.model.FlexibleSolrJerseyResponse;
+import org.apache.solr.core.SolrCore;
import org.apache.solr.handler.component.QueryCancellationHandler;
+import org.apache.solr.jersey.PermissionName;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.SolrQueryResponse;
-import org.apache.solr.security.PermissionNameProvider;
/**
* V2 API for cancelling a currently running "task".
*
* <p>This API (GET /v2/collections/collectionName/tasks/cancel) is analogous to the v1
* /solr/collectionName/tasks/cancel API.
Review Comment:
The Javadoc claims this endpoint is only `GET /v2/collections/{collectionName}/tasks/cancel`, but the API is actually registered under `INDEX_PATH_PREFIX` which supports both `cores` and `collections`. Updating the Javadoc to reflect both forms will prevent misleading docs/clients.
```suggestion
* <p>This API (GET /v2/collections/{collectionName}/tasks/cancel and
* GET /v2/cores/{coreName}/tasks/cancel) is analogous to the v1
* /solr/{collectionName|coreName}/tasks/cancel API.
```
##########
solr/api/src/java/org/apache/solr/client/api/endpoint/CancelTaskApi.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.solr.client.api.endpoint;
+
+import static org.apache.solr.client.api.util.Constants.INDEX_PATH_PREFIX;
+
+import io.swagger.v3.oas.annotations.Operation;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.QueryParam;
+import org.apache.solr.client.api.model.FlexibleSolrJerseyResponse;
+import org.apache.solr.client.api.util.StoreApiParameters;
+
+/**
+ * V2 API definition for cancelling a currently-running task.
+ *
+ * <p>This API (GET /v2/collections/collectionName/tasks/cancel) is analogous to the v1
Review Comment:
The Javadoc states the endpoint is `GET /v2/collections/{collectionName}/tasks/cancel`, but `INDEX_PATH_PREFIX` expands to both `/cores/{indexName}` and `/collections/{indexName}`. Please update the comment to match the actual path(s) exposed by `@Path(INDEX_PATH_PREFIX + "/tasks/cancel")`.
```suggestion
* <p>This API (GET /v2/collections/{collectionName}/tasks/cancel and
* GET /v2/cores/{coreName}/tasks/cancel) is analogous to the v1
```
##########
solr/core/src/java/org/apache/solr/handler/admin/api/CancelTaskAPI.java:
##########
@@ -17,32 +17,54 @@
package org.apache.solr.handler.admin.api;
-import static org.apache.solr.client.solrj.SolrRequest.METHOD.GET;
+import static org.apache.solr.response.SolrQueryResponse.RESPONSE_HEADER_KEY;
+import static org.apache.solr.security.PermissionNameProvider.Name.READ_PERM;
-import org.apache.solr.api.EndPoint;
+import jakarta.inject.Inject;
+import org.apache.solr.api.JerseyResource;
+import org.apache.solr.client.api.endpoint.CancelTaskApi;
+import org.apache.solr.client.api.model.FlexibleSolrJerseyResponse;
+import org.apache.solr.core.SolrCore;
import org.apache.solr.handler.component.QueryCancellationHandler;
+import org.apache.solr.jersey.PermissionName;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.SolrQueryResponse;
-import org.apache.solr.security.PermissionNameProvider;
/**
* V2 API for cancelling a currently running "task".
*
* <p>This API (GET /v2/collections/collectionName/tasks/cancel) is analogous to the v1
* /solr/collectionName/tasks/cancel API.
*/
-public class CancelTaskAPI {
- private final QueryCancellationHandler cancellationHandler;
+public class CancelTaskAPI extends JerseyResource implements CancelTaskApi {
+ private final SolrCore solrCore;
+ private final SolrQueryRequest solrQueryRequest;
+ private final SolrQueryResponse solrQueryResponse;
- public CancelTaskAPI(QueryCancellationHandler cancellationHandler) {
- this.cancellationHandler = cancellationHandler;
+ @Inject
+ public CancelTaskAPI(SolrCore solrCore, SolrQueryRequest req, SolrQueryResponse rsp) {
+ this.solrCore = solrCore;
+ this.solrQueryRequest = req;
+ this.solrQueryResponse = rsp;
}
- @EndPoint(
- path = {"/tasks/cancel"},
- method = GET,
- permission = PermissionNameProvider.Name.READ_PERM)
- public void cancelActiveTask(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
- cancellationHandler.handleRequestBody(req, rsp);
+ @Override
+ @PermissionName(READ_PERM)
+ public FlexibleSolrJerseyResponse cancelTask(String queryUUID) throws Exception {
+ final FlexibleSolrJerseyResponse response =
+ instantiateJerseyResponse(FlexibleSolrJerseyResponse.class);
Review Comment:
`queryUUID` is accepted as a method argument but never validated/used before delegating to `QueryCancellationHandler`. If the query param is missing, the handler throws `IllegalArgumentException`, which v2 exception handling will treat as a 500 (since only `SolrException` sets a non-500 code). Consider calling `ensureRequiredParameterProvided("queryUUID", queryUUID)` (or throwing a `SolrException(BAD_REQUEST, ...)`) up front so the API returns a 400 for missing required input.
```suggestion
instantiateJerseyResponse(FlexibleSolrJerseyResponse.class);
ensureRequiredParameterProvided("queryUUID", queryUUID);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Migrate CancelTaskAPI to JAX-RS [solr]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #4180: Migrate CancelTaskAPI to JAX-RS
URL: https://github.com/apache/solr/pull/4180
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Migrate CancelTaskAPI to JAX-RS [solr]
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #4180:
URL: https://github.com/apache/solr/pull/4180#discussion_r2877993968
##########
solr/core/src/java/org/apache/solr/handler/admin/api/CancelTaskAPI.java:
##########
@@ -17,32 +17,54 @@
package org.apache.solr.handler.admin.api;
-import static org.apache.solr.client.solrj.SolrRequest.METHOD.GET;
+import static org.apache.solr.response.SolrQueryResponse.RESPONSE_HEADER_KEY;
+import static org.apache.solr.security.PermissionNameProvider.Name.READ_PERM;
-import org.apache.solr.api.EndPoint;
+import jakarta.inject.Inject;
+import org.apache.solr.api.JerseyResource;
+import org.apache.solr.client.api.endpoint.CancelTaskApi;
+import org.apache.solr.client.api.model.FlexibleSolrJerseyResponse;
+import org.apache.solr.core.SolrCore;
import org.apache.solr.handler.component.QueryCancellationHandler;
+import org.apache.solr.jersey.PermissionName;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.SolrQueryResponse;
-import org.apache.solr.security.PermissionNameProvider;
/**
* V2 API for cancelling a currently running "task".
*
* <p>This API (GET /v2/collections/collectionName/tasks/cancel) is analogous to the v1
* /solr/collectionName/tasks/cancel API.
*/
-public class CancelTaskAPI {
- private final QueryCancellationHandler cancellationHandler;
+public class CancelTaskAPI extends JerseyResource implements CancelTaskApi {
+ private final SolrCore solrCore;
+ private final SolrQueryRequest solrQueryRequest;
+ private final SolrQueryResponse solrQueryResponse;
- public CancelTaskAPI(QueryCancellationHandler cancellationHandler) {
- this.cancellationHandler = cancellationHandler;
+ @Inject
+ public CancelTaskAPI(SolrCore solrCore, SolrQueryRequest req, SolrQueryResponse rsp) {
+ this.solrCore = solrCore;
+ this.solrQueryRequest = req;
+ this.solrQueryResponse = rsp;
}
- @EndPoint(
- path = {"/tasks/cancel"},
- method = GET,
- permission = PermissionNameProvider.Name.READ_PERM)
- public void cancelActiveTask(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
- cancellationHandler.handleRequestBody(req, rsp);
+ @Override
+ @PermissionName(READ_PERM)
+ public FlexibleSolrJerseyResponse cancelTask(String queryUUID) throws Exception {
+ final FlexibleSolrJerseyResponse response =
+ instantiateJerseyResponse(FlexibleSolrJerseyResponse.class);
+ final QueryCancellationHandler cancellationHandler =
+ (QueryCancellationHandler) solrCore.getRequestHandler("/tasks/cancel");
+ cancellationHandler.handleRequestBody(solrQueryRequest, solrQueryResponse);
+ // Copy response data added by the handler into the jersey response object
+ solrQueryResponse
Review Comment:
Not one hundread percent sure on this, but it was indicated as being needed after `cancellationHandler` did it's thing.
##########
solr/api/src/java/org/apache/solr/client/api/endpoint/CancelTaskApi.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.solr.client.api.endpoint;
+
+import static org.apache.solr.client.api.util.Constants.INDEX_PATH_PREFIX;
+
+import io.swagger.v3.oas.annotations.Operation;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.QueryParam;
+import org.apache.solr.client.api.model.FlexibleSolrJerseyResponse;
+import org.apache.solr.client.api.util.StoreApiParameters;
+
+/**
+ * V2 API definition for cancelling a currently-running task.
+ *
+ * <p>This API (GET /v2/collections/collectionName/tasks/cancel) is analogous to the v1
+ * /solr/collectionName/tasks/cancel API.
+ */
+@Path(INDEX_PATH_PREFIX + "/tasks/cancel")
+public interface CancelTaskApi {
+
+ @GET
+ @StoreApiParameters
+ @Operation(
+ summary = "Cancel a currently-running task",
+ tags = {"tasks"})
+ FlexibleSolrJerseyResponse cancelTask(@QueryParam("queryUUID") String queryUUID) throws Exception;
Review Comment:
In the Ref Guide https://solr.apache.org/guide/solr/latest/deployment-guide/task-management.html#taskuuid-parameter we refer when listing tasks to `taskUUID` but here we have `queryUUID`, which we also refer to in https://solr.apache.org/guide/solr/latest/deployment-guide/task-management.html#cancelling-an-active-cancellable-task, but then also call it a `taskUUID`! I don't know that we want to get into fixing the APIS as part of the migration, but this one does seem werid. If someone else confirms it, at a minimum we should open a JIRA. But maybe this is targeted enough to fix here? Seems like it should be `taskUUID` and honestly, maybe just `taskID`?
##########
solr/core/src/test/org/apache/solr/handler/admin/api/CancelTaskAPITest.java:
##########
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.handler.admin.api;
+
+import static org.apache.solr.core.CoreContainer.ALLOW_PATHS_SYSPROP;
+import static org.apache.solr.security.AllowListUrlChecker.ENABLE_URL_ALLOW_LIST;
+
+import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.client.api.model.FlexibleSolrJerseyResponse;
+import org.apache.solr.client.api.model.IndexType;
+import org.apache.solr.client.solrj.request.TasksApi;
+import org.apache.solr.common.util.EnvUtils;
+import org.apache.solr.util.ExternalPaths;
+import org.apache.solr.util.SolrJettyTestRule;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+/** Integration tests for the {@link CancelTaskAPI} V2 endpoint. */
+public class CancelTaskAPITest extends SolrTestCaseJ4 {
+
+ @ClassRule public static SolrJettyTestRule solrTestRule = new SolrJettyTestRule();
+
+ @BeforeClass
+ public static void beforeTest() throws Exception {
+ EnvUtils.setProperty(
+ ALLOW_PATHS_SYSPROP, ExternalPaths.SERVER_HOME.toAbsolutePath().toString());
+ // Disable URL allow-list checks to allow standalone shard dispatch in non-cloud mode
+ EnvUtils.setProperty(ENABLE_URL_ALLOW_LIST, "false");
+ solrTestRule.startSolr(createTempDir());
+ solrTestRule
+ .newCollection(DEFAULT_TEST_COLLECTION_NAME)
+ .withConfigSet(ExternalPaths.DEFAULT_CONFIGSET)
+ .create();
+ }
+
+ @Test
+ public void testCancelNonExistentTask() throws Exception {
+ final TasksApi.CancelTask request = new TasksApi.CancelTask(IndexType.CORE, DEFAULT_TEST_COLLECTION_NAME);
+ request.setQueryUUID("nonexistent-uuid");
+
+ final FlexibleSolrJerseyResponse response =
+ request.process(solrTestRule.getSolrClient(DEFAULT_TEST_COLLECTION_NAME));
+ assertNotNull(response);
+ assertEquals("not found", response.unknownProperties().get("cancellationResult"));
Review Comment:
I think the `unknownProperties` is an aspect of hte `FlexibleSolrJerseyResponse`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Migrate CancelTaskAPI to JAX-RS [solr]
Posted by "gerlowskija (via GitHub)" <gi...@apache.org>.
gerlowskija commented on PR #4180:
URL: https://github.com/apache/solr/pull/4180#issuecomment-4200242371
Is this attached to a particular JIRA ticket? Should it be?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Migrate CancelTaskAPI to JAX-RS [solr]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #4180:
URL: https://github.com/apache/solr/pull/4180#issuecomment-4640921799
This PR has had no activity for 60 days and is now labeled as stale. Any new activity will remove the stale label. To attract more reviewers, please tag people who might be familiar with the code area and/or notify the dev@solr.apache.org mailing list. To exempt this PR from being marked as stale, make it a draft PR or add the label "exempt-stale". If left unattended, this PR will be closed after another 60 days of inactivity. Thank you for your contribution!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Migrate CancelTaskAPI to JAX-RS [solr]
Posted by "jaykay12 (via GitHub)" <gi...@apache.org>.
jaykay12 commented on PR #4180:
URL: https://github.com/apache/solr/pull/4180#issuecomment-5470571061
> We have a seperate effort led by @jaykay12 that is half way done that is a much better effort!
yess, 🎆 https://github.com/apache/solr/pull/4828 is finally here!
we will be done with V2 migrations of all Task APIs then.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org