Skip to content

Migrate RenameCoreAPI from homegrown @EndPoint/@Command to JAX-RS#4172

Merged
epugh merged 9 commits intoapache:mainfrom
epugh:copilot/migrate-rename-core-api
Mar 3, 2026
Merged

Migrate RenameCoreAPI from homegrown @EndPoint/@Command to JAX-RS#4172
epugh merged 9 commits intoapache:mainfrom
epugh:copilot/migrate-rename-core-api

Conversation

@epugh
Copy link
Contributor

@epugh epugh commented Feb 28, 2026

RenameCoreAPI.java was the last remnant of the old @EndPoint/@Command V2 API style for core renaming. The JAX-RS implementation (RenameCore.java, RenameCoreApi.java, RenameCoreRequestBody.java) already existed and was fully wired into CoreAdminHandler.getJerseyResources() and CoreAdminOperation.RENAME_OP — the old class was dead production code only referenced in a mock-based test.

Changes

  • Deleted RenameCoreAPI.java — superseded by RenameCore.java
  • Updated V2CoreAPIMappingTest — removed RenameCoreAPI registration and its mock-based testRenameCoreAllParams test
  • Added RenameCoreAPITest — unit tests for RenameCore using SolrJettyTestRule (no mocks, no initCore), following the pattern of ShowFileRequestHandlerTest

Tests cover: same-name early return, missing request body, and missing to parameter.

Copilot AI and others added 4 commits February 28, 2026 13:34
…ate tests

Co-authored-by: epugh <22395+epugh@users.noreply.github.com>
Co-authored-by: epugh <22395+epugh@users.noreply.github.com>
@epugh
Copy link
Contributor Author

epugh commented Feb 28, 2026

I've done a bit of work in my own epugh/solr branch with copilot on this before opening here. Tests pass.

solrTestRule.startSolr(createTempDir());
solrTestRule.newCollection(DEFAULT_TEST_CORENAME).withConfigSet(ExternalPaths.DEFAULT_CONFIGSET).create();
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code above seems fine... but the setup and tests below are low-level, reaching directly into Solr instead of using SolrClient. Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

humm... Good question.... a part of me likes the "Hey, look, we are testing the exact API" instead of a integration style test...

I am going to make another test that usese just SolrClient...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after digging around a bit more, you are right that we want to do a more integration test to cover the generated code....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dsmiley I rewrote the tests to be integration style. Also, there is a todo about v2 generated not raising exceptions, so we'll fix it when that is sorted. Can I get another reivew?

@epugh epugh changed the title Migrate RenameCoreAPI from homegrown @EndPoint/@Command to JAX-RS; use SolrJettyTestRule in tests Migrate RenameCoreAPI from homegrown @EndPoint/@Command to JAX-RS Mar 2, 2026
@epugh
Copy link
Contributor Author

epugh commented Mar 2, 2026

@dsmiley thoguths on if this needs a changelog? It's "internal"...

// Sending JSON "null" as the body causes Jersey to deserialize it to a null requestBody,
// triggering the handler's "Required request-body is missing" guard.
GenericV2SolrRequest renameRequest =
new GenericV2SolrRequest(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this PR supposed to introduced a nice typed V2 request we can use instead of this generic one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does, but the typed one doesn't raise the nice error.. I also thought maybe having both ways tested was of some value? 🤷

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see that's above test but this and lower ones are triggering erroneous cases that maybe can't be done with the nice API.
So Nevermind.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect, when we get the error thing sorted that all these tests will need another looksee...

@dsmiley
Copy link
Contributor

dsmiley commented Mar 2, 2026

IMO Each V2 API addition is worth a changelog.

@epugh
Copy link
Contributor Author

epugh commented Mar 2, 2026

I still need to fix one javadoc reference...

@epugh epugh merged commit bf7a15a into apache:main Mar 3, 2026
4 of 5 checks passed
epugh added a commit that referenced this pull request Mar 3, 2026
)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: epugh <22395+epugh@users.noreply.github.com>
@gerlowskija
Copy link
Contributor

thoguths on if this needs a changelog? It's "internal"...

At a minimum each of these JAX-RS migrations creates a new SolrRequest/SolrResponse object to SolrJ that folks can now use, and that's usually worth a changelog in its own right!

@gerlowskija
Copy link
Contributor

Hey @epugh - the PR name and commit message here are really misleading and don't reflect that this is largely dead-code deletion.

Friendly reminder to keep an eye on that stuff for the next one.

@epugh
Copy link
Contributor Author

epugh commented Mar 3, 2026

Hey @epugh - the PR name and commit message here are really misleading and don't reflect that this is largely dead-code deletion.

Friendly reminder to keep an eye on that stuff for the next one.

Thanks, you are quite right! This was so far at least an outlier, in that it wasn't a migration, though we added a test.

@epugh
Copy link
Contributor Author

epugh commented Mar 3, 2026

thoguths on if this needs a changelog? It's "internal"...

At a minimum each of these JAX-RS migrations creates a new SolrRequest/SolrResponse object to SolrJ that folks can now use, and that's usually worth a changelog in its own right!

I hadn't really thoguht about that! I guess this shows up in our JavaDocs right? We don't have special documentation around htis in the Ref Guide beyond the rather shallow https://solr.apache.org/guide/solr/latest/deployment-guide/solrj.html#solrj-overview page? Which I think doesnt' even link to javadocs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants