-
Notifications
You must be signed in to change notification settings - Fork 69
feat: add support for revalidate qa checks #359
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
Merged
andrii-bodnar
merged 3 commits into
crowdin:master
from
andreichirila0712:feature/355-revalidate-qa-checks
Mar 2, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/com/crowdin/client/translationstatus/model/QaCheckRevalidation.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package com.crowdin.client.translationstatus.model; | ||
|
|
||
| import lombok.Data; | ||
|
|
||
| import java.util.Date; | ||
| import java.util.List; | ||
|
|
||
| @Data | ||
| public class QaCheckRevalidation { | ||
| private String identifier; | ||
| private String status; | ||
| private Long progress; | ||
| private Attributes attributes; | ||
| private Date createdAt; | ||
| private Date updatedAt; | ||
| private Date startedAt; | ||
| private Date finishedAt; | ||
|
|
||
| @Data | ||
| public static class Attributes { | ||
| private List<String> languageIds; | ||
| private List<String> qaCheckCategories; | ||
| private Boolean failedOnly; | ||
| } | ||
| } |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/crowdin/client/translationstatus/model/QaCheckRevalidationRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package com.crowdin.client.translationstatus.model; | ||
|
|
||
| import lombok.Data; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Data | ||
| public class QaCheckRevalidationRequest { | ||
|
|
||
| private List<String> qaCheckCategories; | ||
| private List<String> languageIds; | ||
| private Boolean failedOnly; | ||
| } |
9 changes: 9 additions & 0 deletions
9
...in/java/com/crowdin/client/translationstatus/model/QaCheckRevalidationResponseObject.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.crowdin.client.translationstatus.model; | ||
|
|
||
| import lombok.Data; | ||
|
|
||
| @Data | ||
| public class QaCheckRevalidationResponseObject { | ||
|
|
||
| private QaCheckRevalidation data; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,31 @@ | ||
| package com.crowdin.client.translationstatus; | ||
|
|
||
| import com.crowdin.client.core.model.ResponseList; | ||
| import com.crowdin.client.core.model.ResponseObject; | ||
| import com.crowdin.client.framework.RequestMock; | ||
| import com.crowdin.client.framework.TestClient; | ||
| import com.crowdin.client.translationstatus.model.FileBranchProgress; | ||
| import com.crowdin.client.translationstatus.model.LanguageProgress; | ||
| import com.crowdin.client.translationstatus.model.QaCheck; | ||
| import com.crowdin.client.translationstatus.model.QaCheckRevalidation; | ||
| import com.crowdin.client.translationstatus.model.QaCheckRevalidationRequest; | ||
| import org.apache.http.client.methods.HttpDelete; | ||
| import org.apache.http.client.methods.HttpGet; | ||
| import org.apache.http.client.methods.HttpPost; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import java.util.Arrays; | ||
| import java.util.Calendar; | ||
| import java.util.Collections; | ||
| import java.util.Date; | ||
| import java.util.List; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
|
||
| public class TranslationStatusApiTest extends TestClient { | ||
|
|
||
| private final Long projectId = 2L; | ||
| private final String revalidationId = "b5215a34-1305-4b21-8054-fc2eb252842f"; | ||
| private final Long branchId = 3L; | ||
| private final Long directoryId = 4L; | ||
| private final Long fileId = 5L; | ||
|
|
@@ -30,7 +39,10 @@ public List<RequestMock> getMocks() { | |
| RequestMock.build(this.url + "/projects/" + projectId + "/files/" + fileId + "/languages/progress", HttpGet.METHOD_NAME, "api/translationstatus/fileProgress.json"), | ||
| RequestMock.build(this.url + "/projects/" + projectId + "/languages/" + languageId + "/progress", HttpGet.METHOD_NAME, "api/translationstatus/languageProgress.json"), | ||
| RequestMock.build(this.url + "/projects/" + projectId + "/languages/progress", HttpGet.METHOD_NAME, "api/translationstatus/projectProgress.json"), | ||
| RequestMock.build(this.url + "/projects/" + projectId + "/qa-checks", HttpGet.METHOD_NAME, "api/translationstatus/listQaChecks.json") | ||
| RequestMock.build(this.url + "/projects/" + projectId + "/qa-checks", HttpGet.METHOD_NAME, "api/translationstatus/listQaChecks.json"), | ||
| RequestMock.build(this.url + "/projects/" + projectId + "/qa-checks/revalidate/" + revalidationId, HttpGet.METHOD_NAME, "api/translationstatus/qaChecksRevalidation.json"), | ||
| RequestMock.build(this.url + "/projects/" + projectId + "/qa-checks/revalidate", HttpPost.METHOD_NAME, "api/translationstatus/qaChecksRevalidationRequest.json","api/translationstatus/qaChecksRevalidation.json"), | ||
| RequestMock.build(this.url + "/projects/" + projectId + "/qa-checks/revalidate/" + revalidationId, HttpDelete.METHOD_NAME) | ||
| ); | ||
| } | ||
|
|
||
|
|
@@ -80,4 +92,37 @@ public void listQaCheckIssuesTest() { | |
| assertEquals(qaCheckResponseList.getData().size(), 1); | ||
| assertEquals(qaCheckResponseList.getData().get(0).getData().getLanguageId(), languageId); | ||
| } | ||
|
|
||
| @Test | ||
| public void getQaChecksRevalidationStatusTest() { | ||
| ResponseObject<QaCheckRevalidation> qaCheckRevalidationResponseObject = this.getTranslationStatusApi().getQaChecksRevalidationStatus(projectId, revalidationId); | ||
| assertEquals(qaCheckRevalidationResponseObject.getData().getStatus(), "created"); | ||
| assertEquals(qaCheckRevalidationResponseObject.getData().getProgress(), 0L); | ||
| assertEquals(qaCheckRevalidationResponseObject.getData().getAttributes().getLanguageIds(), Arrays.asList("uk", "fr")); | ||
| assertEquals(qaCheckRevalidationResponseObject.getData().getAttributes().getFailedOnly(), false); | ||
| Date createdDate = new Date(2025 - 1900, Calendar.SEPTEMBER, 23, 11, 51, 8); | ||
| assertEquals(qaCheckRevalidationResponseObject.getData().getCreatedAt(), createdDate); | ||
| } | ||
|
|
||
| @Test | ||
| public void revalidateQaChecksTest() { | ||
| QaCheckRevalidationRequest request = new QaCheckRevalidationRequest(); | ||
| request.setLanguageIds(Arrays.asList("uk", "fr")); | ||
| request.setQaCheckCategories(Collections.singletonList("ai")); | ||
| request.setFailedOnly(true); | ||
| ResponseObject<QaCheckRevalidation> qaCheckRevalidationResponseObject = this.getTranslationStatusApi().revalidateQaChecks(projectId, request); | ||
| assertEquals(qaCheckRevalidationResponseObject.getData().getIdentifier(), revalidationId); | ||
| assertEquals(qaCheckRevalidationResponseObject.getData().getStatus(), "created"); | ||
| assertEquals(qaCheckRevalidationResponseObject.getData().getProgress(), 0L); | ||
| assertEquals(qaCheckRevalidationResponseObject.getData().getAttributes().getLanguageIds(), Arrays.asList("uk", "fr")); | ||
| assertEquals(qaCheckRevalidationResponseObject.getData().getAttributes().getQaCheckCategories(), Collections.singletonList("ai")); | ||
| assertEquals(qaCheckRevalidationResponseObject.getData().getAttributes().getFailedOnly(), false); | ||
| Date createdDate = new Date(2025 - 1900, Calendar.SEPTEMBER, 23, 11, 51, 8); | ||
| assertEquals(qaCheckRevalidationResponseObject.getData().getCreatedAt(), createdDate); | ||
|
Comment on lines
+120
to
+121
|
||
| } | ||
|
|
||
| @Test | ||
| public void cancelQaChecksRevalidationTest() { | ||
| this.getTranslationStatusApi().cancelQaChecksRevalidation(projectId, revalidationId); | ||
| } | ||
| } | ||
21 changes: 21 additions & 0 deletions
21
src/test/resources/api/translationstatus/qaChecksRevalidation.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| "data": { | ||
| "identifier": "b5215a34-1305-4b21-8054-fc2eb252842f", | ||
| "status": "created", | ||
| "progress": 0, | ||
| "attributes": { | ||
| "languageIds": [ | ||
| "uk", | ||
| "fr" | ||
| ], | ||
| "qaCheckCategories": [ | ||
| "ai" | ||
| ], | ||
| "failedOnly": false | ||
| }, | ||
| "createdAt": "2025-09-23T11:51:08+00:00", | ||
| "updatedAt": "2025-09-23T11:51:08+00:00", | ||
| "startedAt": "2025-09-23T11:51:08+00:00", | ||
| "finishedAt": null | ||
| } | ||
| } |
10 changes: 10 additions & 0 deletions
10
src/test/resources/api/translationstatus/qaChecksRevalidationRequest.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "qaCheckCategories": [ | ||
| "ai" | ||
| ], | ||
| "languageIds": [ | ||
| "uk", | ||
| "fr" | ||
| ], | ||
| "failedOnly": true | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
These tests build the expected timestamp using the deprecated
Date(int,int,...)constructor, which uses the JVM default time zone. Since the JSON timestamps are+00:00, this assertion will be flaky on non-UTC environments. Prefer asserting viaInstant.parse(...)/OffsetDateTime.parse(...)(or comparegetCreatedAt().toInstant()to anInstant) to make the test time-zone independent.