@@ -6612,12 +6612,21 @@ public void testSummaryDatasetVersionsDifferencesAPI() throws InterruptedExcepti
66126612 .add ("Data" )
66136613 );
66146614 JsonObject jsonObj = json .build ();
6615+
66156616 String pathToFile = "src/main/webapp/resources/images/dataverse-icon-1200.png" ;
66166617 Response uploadResponse = UtilIT .uploadFileViaNative (String .valueOf (datasetId ), pathToFile , jsonObj , apiToken );
66176618 uploadResponse .prettyPrint ();
66186619 uploadResponse .then ().assertThat ()
66196620 .statusCode (OK .getStatusCode ());
6620- Integer modifyFileId = UtilIT .getDataFileIdFromResponse (uploadResponse );
6621+ Integer firstFileToModify = UtilIT .getDataFileIdFromResponse (uploadResponse );
6622+
6623+ pathToFile = "src/test/resources/images/coffeeshop.png" ;
6624+ uploadResponse = UtilIT .uploadFileViaNative (String .valueOf (datasetId ), pathToFile , jsonObj , apiToken );
6625+ uploadResponse .prettyPrint ();
6626+ uploadResponse .then ().assertThat ()
6627+ .statusCode (OK .getStatusCode ());
6628+ Integer secondFileToModify = UtilIT .getDataFileIdFromResponse (uploadResponse );
6629+
66216630 pathToFile = "src/main/webapp/resources/images/dataverseproject_logo.jpg" ;
66226631 uploadResponse = UtilIT .uploadFileViaNative (String .valueOf (datasetId ), pathToFile , jsonObj , apiToken );
66236632 uploadResponse .then ().assertThat ()
@@ -6670,9 +6679,18 @@ public void testSummaryDatasetVersionsDifferencesAPI() throws InterruptedExcepti
66706679 replaceResponse .then ().assertThat ()
66716680 .statusCode (OK .getStatusCode ());
66726681
6673- // Test modify by restricting the file
6674- Response restrictResponse = UtilIT .restrictFile (modifyFileId .toString (), true , apiToken );
6675- restrictResponse .prettyPrint ();
6682+ // Test modify first file by adding a new category
6683+ Response setFileCategoriesResponse = UtilIT .setFileCategories (firstFileToModify .toString (), apiToken , List .of ("Category" ));
6684+ setFileCategoriesResponse .then ().assertThat ()
6685+ .statusCode (OK .getStatusCode ());
6686+
6687+ // Test modify first file by restricting it
6688+ Response restrictResponse = UtilIT .restrictFile (firstFileToModify .toString (), true , apiToken );
6689+ restrictResponse .then ().assertThat ()
6690+ .statusCode (OK .getStatusCode ());
6691+
6692+ // Test modify second file by restricting it
6693+ restrictResponse = UtilIT .restrictFile (secondFileToModify .toString (), true , apiToken );
66766694 restrictResponse .then ().assertThat ()
66776695 .statusCode (OK .getStatusCode ());
66786696
@@ -6682,7 +6700,6 @@ public void testSummaryDatasetVersionsDifferencesAPI() throws InterruptedExcepti
66826700 updateTerms .then ().assertThat ()
66836701 .statusCode (OK .getStatusCode ());
66846702
6685-
66866703 Response compareResponse = UtilIT .summaryDatasetVersionDifferences (datasetPersistentId , apiToken );
66876704 compareResponse .prettyPrint ();
66886705
@@ -6701,7 +6718,8 @@ public void testSummaryDatasetVersionsDifferencesAPI() throws InterruptedExcepti
67016718 .body ("data[0].summary.'Life Sciences Metadata'.added" , equalTo (2 ))
67026719 .body ("data[0].summary.'Life Sciences Metadata'.deleted" , equalTo (0 ))
67036720 .body ("data[0].summary.files.added" , equalTo (1 ))
6704- .body ("data[0].summary.files.changedFileMetaData" , equalTo (2 ))
6721+ // Expected total file metadata field changes: 3 (File 1 has 2 modifications + File 2 has 1 modification)
6722+ .body ("data[0].summary.files.changedFileMetaData" , equalTo (3 ))
67056723 .statusCode (OK .getStatusCode ());
67066724
67076725 //user with no privileges will only see the published version
0 commit comments