From 1db3a9ef724e5bc745b4657f88228ab2927b4438 Mon Sep 17 00:00:00 2001 From: valentinogiardino Date: Mon, 9 Dec 2024 16:49:17 -0300 Subject: [PATCH] #30874 update it --- .../ContentImportResourceIntegrationTest.java | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/dotcms-integration/src/test/java/com/dotcms/rest/api/v1/content/dotimport/ContentImportResourceIntegrationTest.java b/dotcms-integration/src/test/java/com/dotcms/rest/api/v1/content/dotimport/ContentImportResourceIntegrationTest.java index b82b4aae4d30..55317373cc2f 100644 --- a/dotcms-integration/src/test/java/com/dotcms/rest/api/v1/content/dotimport/ContentImportResourceIntegrationTest.java +++ b/dotcms-integration/src/test/java/com/dotcms/rest/api/v1/content/dotimport/ContentImportResourceIntegrationTest.java @@ -11,7 +11,6 @@ import com.dotcms.datagen.TestUserUtils; import com.dotcms.jobs.business.job.Job; import com.dotcms.jobs.business.job.JobPaginatedResult; -import com.dotcms.jobs.business.job.JobState; import com.dotcms.jobs.business.util.JobUtil; import com.dotcms.mock.response.MockHttpResponse; import com.dotcms.rest.ResponseEntityView; @@ -110,7 +109,7 @@ static void cleanup() { */ @Test @Order(1) - void testCancelNonExistingJob(){ + void test_import_content_cancel_non_existing_job(){ assertThrows(DoesNotExistException.class, () -> importResource.cancelJob(request, response, "nonExisting" )); } @@ -120,15 +119,26 @@ void testCancelNonExistingJob(){ */ @Test @Order(2) - void testGetActiveJobs() { + void test_import_content_get_active_jobs() { // Call the activeJobs endpoint ResponseEntityView result = importResource.activeJobs(request, response, 1, 20); validateJobPaginatedResult(result, 0); } + /** + * Scenario: Create a valid content import job and then list active jobs. + *

+ * This test creates a content import job using valid parameters and then calls the + * activeJobs endpoint to verify that the job is listed as active. The expected result + * is that the active jobs count should be 1. + *

+ * + * @throws DotDataException if there is an error with dotCMS data operations + * @throws IOException if there is an error with file operations + */ @Test @Order(3) - void testCreateAndListActiveJobs() throws DotDataException, IOException { + void test_import_content_and_list_active_jobs() throws DotDataException, IOException { //Create valid import job ContentImportForm form = createContentImportForm(contentType.name(), String.valueOf(defaultLanguage.getId()), WORKFLOW_PUBLISH_ACTION_ID, List.of(fieldId)); ContentImportParams params = createContentImportParams(csvFile, form); @@ -141,17 +151,36 @@ void testCreateAndListActiveJobs() throws DotDataException, IOException { validateJobPaginatedResult(result, 1); } + /** + * Scenario: Retrieve the list of canceled jobs. + *

+ * This test calls the canceledJobs endpoint to verify that there are no canceled jobs + * initially. The expected result is that the count of canceled jobs should be 0. + *

+ */ @Test @Order(4) - void testGetCancelJobs() { + void test_content_import_get_cancel_jobs() { // Call the activeJobs endpoint ResponseEntityView result = importResource.canceledJobs(request, response, 1, 20); validateJobPaginatedResult(result, 0); } + /** + * Scenario: Create a valid content import job, cancel it, and then list canceled jobs. + *

+ * This test creates a content import job using valid parameters, retrieves the job ID + * from the response, cancels the job, and then calls the canceledJobs endpoint to verify + * that the canceled job is listed. The expected result is that the count of canceled jobs + * should be 1. + *

+ * + * @throws DotDataException if there is an error with dotCMS data operations + * @throws IOException if there is an error with file operations + */ @Test @Order(5) - void testCreateThenCancelThenListCanceledJobs() throws DotDataException, IOException { + void test_import_content_then_cancel_then_list_canceled_jobs() throws DotDataException, IOException { //Create valid import job ContentImportForm form = createContentImportForm(contentType.name(), String.valueOf(defaultLanguage.getId()), WORKFLOW_PUBLISH_ACTION_ID, List.of(fieldId)); ContentImportParams params = createContentImportParams(csvFile, form);