-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow idempotent change to artifact state #3637
Conversation
2b51d95
to
0280d6c
Compare
@@ -44,6 +44,7 @@ | |||
import io.apicurio.registry.utils.ArtifactIdValidator; | |||
import io.apicurio.registry.utils.IoUtil; | |||
import io.apicurio.registry.utils.JAXRSClientUtil; | |||
import io.apicurio.tenantmanager.api.datamodel.SortBy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have imported the wrong bean here. This bean must be coming from Registry, not from the tenant-manager.
@@ -61,14 +61,17 @@ | |||
|
|||
import io.apicurio.registry.AbstractResourceTestBase; | |||
import io.apicurio.registry.rest.client.exception.RuleViolationException; | |||
import io.apicurio.registry.rest.v1.beans.UpdateState; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The UpdateState from v1 is likely not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have made a couple comments.
@@ -659,8 +664,12 @@ public void updateArtifactVersionState(String groupId, String artifactId, String | |||
requireParameter("groupId", groupId); | |||
requireParameter("artifactId", artifactId); | |||
requireParameter("version", version); | |||
|
|||
ArtifactMetaDataDto metaData = storage.getArtifactMetaData(defaultGroupIdToNull(groupId), artifactId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct. If we are going to take the approach of looking up the current state from the storage, in this instance we need to get the artifact version state, not the artifact state. The reason is that this particular update is for a specific artifact version (notice that the method signature includes a version
param).
So this needs to change to look up the metaData of a single version of the artifact from the storage.
373d677
to
e073fa7
Compare
c306309
to
14c1f87
Compare
* Add null checks on role mapping (#3800) * Add null checks on role mapping * Add check for Role and Unit Test * Fixed a regression in the Settings page search box (#3798) * modified state change checks in ArtifactStateExt and AbstractSqlRegistryStorage (#3637) * Incorrect default value avro serialization (#3633) * Fix default value converter * Add test for default byte type value in converter test * Correct comment * added unit tests (#3593) * Bugfix: prase decimal's default --------- Co-authored-by: Amoncy <138134862+Amoncy@users.noreply.github.com> Co-authored-by: Eric Wittmann <eric.wittmann@gmail.com> Co-authored-by: Jean Xiao <118199750+renjingxiao@users.noreply.github.com> Co-authored-by: Anshu Anna Moncy <amoncy@redhat.com> Co-authored-by: j2gg0s <j2gg0s@gmail.com>
* Add null checks on role mapping (Apicurio#3800) * Add null checks on role mapping * Add check for Role and Unit Test * Fixed a regression in the Settings page search box (Apicurio#3798) * modified state change checks in ArtifactStateExt and AbstractSqlRegistryStorage (Apicurio#3637) * Incorrect default value avro serialization (Apicurio#3633) * Fix default value converter * Add test for default byte type value in converter test * Correct comment * added unit tests (Apicurio#3593) * Bugfix: prase decimal's default --------- Co-authored-by: Amoncy <138134862+Amoncy@users.noreply.github.com> Co-authored-by: Eric Wittmann <eric.wittmann@gmail.com> Co-authored-by: Jean Xiao <118199750+renjingxiao@users.noreply.github.com> Co-authored-by: Anshu Anna Moncy <amoncy@redhat.com> Co-authored-by: j2gg0s <j2gg0s@gmail.com>
* Add null checks on role mapping (#3800) * Add null checks on role mapping * Add check for Role and Unit Test * Fixed a regression in the Settings page search box (#3798) * modified state change checks in ArtifactStateExt and AbstractSqlRegistryStorage (#3637) * Incorrect default value avro serialization (#3633) * Fix default value converter * Add test for default byte type value in converter test * Correct comment * added unit tests (#3593) * Bugfix: prase decimal's default --------- Co-authored-by: Amoncy <138134862+Amoncy@users.noreply.github.com> Co-authored-by: Eric Wittmann <eric.wittmann@gmail.com> Co-authored-by: Jean Xiao <118199750+renjingxiao@users.noreply.github.com> Co-authored-by: Anshu Anna Moncy <amoncy@redhat.com> Co-authored-by: j2gg0s <j2gg0s@gmail.com>
Hi @EricWittmann and @carlesarnal ,
In this PR, I have added checks to ensure that the state can be changed to the same value multiple times. It works for both
/groups/{groupId}/artifacts/{artifactId}/state
and/groups/{groupId}/artifacts/{artifactId}/versions/{versionId}/state
endpoints. It may close #3475 .Thank you for reviewing it.