stable

Clone or download

Read-only

refactor: replace ArtifactUpdateHandler

How to test: - No functional change in the REST API PUT /artifacts/{id}. You can still add, change or remove both forward and reverse links. You can still set a parent through the "parent" key and set forward links through the "links" key. Notes: - ArtifactUpdateHandler is replaced by ArtifactReverseLinksUpdater. It has only one method, and it detects by itself what to do. If there is an artifact link value and there are submitted reverse links, it will build the diff (by building the ChangeReverseLinksCommand) and build a new changeset for each reverse link. It will then add the new changeset for the current artifact itself, and try to save all new changesets. - There is no interface in front of ArtifactReverseLinksUpdater because it does not deal with DB directly, it is a "middle man". This lets us write a "sociable" test for PUTHandler: we input Representation objects, we stub only the DB Accesses (for fields and artifacts) and assert that we created the expected changesets. Our tests use as many "real" objects as possible. part of request #34374 Be able to explicitly add, change or remove forward and reverse links Change-Id: I6aba1ce6aeda2e966a0b51f1f1a0f494a03ca0b4

Modified Files

Name
M plugins/tracker/include/REST/Artifact/PUTHandler.php +45 −52 Go to diff View file
M plugins/tracker/include/REST/v1/ArtifactsResource.class.php +11 −11 Go to diff View file
M plugins/tracker/include/Tracker/Artifact/ChangesetValue/ArtifactLink/ReverseLinksToNewChangesetsConverter.php +80 −0 Go to diff View file
A plugins/tracker/include/Tracker/Artifact/Link/ArtifactReverseLinksUpdater.php +125 −0 Go to diff View file
D plugins/tracker/include/Tracker/Artifact/Link/ArtifactUpdateHandler.php +0 −267 Go to diff View file
D plugins/tracker/include/Tracker/Artifact/Link/HandleUpdateArtifact.php +0 −75 Go to diff View file
M plugins/tracker/tests/unit/REST/Artifact/PUTHandlerTest.php +90 −98 Go to diff View file
D plugins/tracker/tests/unit/Stub/HandleUpdateArtifactStub.php +0 −99 Go to diff View file
M plugins/tracker/tests/unit/Stub/RetrieveReverseLinksStub.php +5 −0 Go to diff View file
M plugins/tracker/tests/unit/Tracker/Artifact/ChangesetValue/ArtifactLink/ReverseLinksToNewChangesetsConverterTest.php +142 −22 Go to diff View file
A plugins/tracker/tests/unit/Tracker/Artifact/Link/ArtifactReverseLinksUpdaterTest.php +199 −0 Go to diff View file
D plugins/tracker/tests/unit/Tracker/Artifact/Link/ArtifactUpdateHandlerTest.php +0 −199 Go to diff View file