Skip to content

CLARIN-DSpace v9/Add ITs for create-administrator -o and the bundle licence PUT - #1491

Open
milanmajchrak wants to merge 3 commits into
dtq-dev-93from
ufal/it-create-administrator-org-bundle-license-9-base
Open

milanmajchrak wants to merge 3 commits into
dtq-dev-93from
ufal/it-create-administrator-org-bundle-license-9-base

Conversation

@milanmajchrak

@milanmajchrak milanmajchrak commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

References

No dtq-dev source: tests only. The code under test (CreateAdministrator -o, ItemAddBundleController.updateLicenseForBundle) came from 7.x in the v9 sync and had no test on either branch.

Description

Integration tests for two fork features that had none: dspace create-administrator -o <org> and PUT /api/core/items/{uuid}/bundles?licenseID=<id>. No production code changes.

Instructions for Reviewers

List of changes in this PR:

  • CreateAdministratorIT (dspace-api): runs CreateAdministrator.main with -o MyOrg. The new eperson is in the Administrator group and has one confirmed user registration with organization = MyOrg.
  • A second run without -o stores UNKNOWN_USER_REGISTRATION and still takes the language from -c cs. The created eperson is deleted after each test.
  • ClarinLicenseRestRepositoryIT.updateLicenseForBundleAttachesAndDetachesLicense: an item with two files. A PUT with one licence and then a PUT with another one leaves only the second on both bitstreams. The PUT returns an item, and a GET of the item then shows dc.rights, dc.rights.uri and dc.rights.label. A PUT with licenseID=-1 removes the mappings and the metadata.
  • updateLicenseForBundleNeedsAddRightsOnItem: 403 for a user with only WRITE on the item, 401 without a token. With the check changed to WRITE, this test fails with expected:<403> but was:<200>.

How to test:

mvn verify -pl dspace-server-webapp,dspace -am -DskipUnitTests=true -DskipIntegrationTests=false -Dit.test=CreateAdministratorIT,ClarinLicenseRestRepositoryIT -Dfailsafe.failIfNoSpecifiedTests=false

CreateAdministratorIT runs 2 tests and ClarinLicenseRestRepositoryIT 16, all pass.

Codex review (gpt-6.2-sol, high), 3 rounds: 6 findings fixed (check -c without -o, read the metadata with a GET, use two files, a WRITE-only user, replace an existing licence, check the response type). Not changed: running the command through the launcher and the literal Unknown instead of the constant. The last round only asked for more coverage (a non-admin with ADD, the state between the two PUTs, a file in another bundle).

Checklist

  • My PR is created against the main branch of code (unless it is a backport or is fixing an issue specific to an older branch).
  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & integration tests). Exceptions may be made if previously agreed upon.
  • My PR passes Checkstyle validation based on the Code Style Guide.
  • My PR includes Javadoc for all new (or modified) public methods and classes. It also includes Javadoc for large or complex private methods.
  • My PR passes all tests and includes new/updated Unit or Integration Tests based on the Code Testing Guide.
  • My PR includes details on how to test it. I've provided clear instructions to reviewers on how to successfully test this fix or feature.
  • If my PR includes new libraries/dependencies (in any pom.xml), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR modifies REST API endpoints, I've opened a separate REST Contract PR related to this change.
  • If my PR includes new configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

🤖 Generated with Claude Code

@milanmajchrak
milanmajchrak changed the base branch from dtq-dev-9-base to dtq-dev-93 November 17, 2026 15:57
milanmajchrak and others added 2 commits November 26, 2026 23:16
The test without -o now checks the language from -c. The licence PUT test uses two files and reads the item metadata with a GET after each PUT.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A user with only WRITE now gets 403, and a valid licence must replace the one already on the files. The PUT response is checked to be an item.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant