From 3ec97df2498b98e259d744ebd46ed900b028cd07 Mon Sep 17 00:00:00 2001 From: Leonid Andreev Date: Wed, 12 Apr 2023 14:59:45 -0400 Subject: [PATCH 1/2] quick sleeps added. #9240 --- .../edu/harvard/iq/dataverse/api/HarvestingClientsIT.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/java/edu/harvard/iq/dataverse/api/HarvestingClientsIT.java b/src/test/java/edu/harvard/iq/dataverse/api/HarvestingClientsIT.java index 4699e741094..dc37b0f3a05 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/HarvestingClientsIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/HarvestingClientsIT.java @@ -75,7 +75,7 @@ private static void setupCollection() { } @Test - public void testCreateEditDeleteClient() { + public void testCreateEditDeleteClient() throws InterruptedException { // This method focuses on testing the native Dataverse harvesting client // API. @@ -100,6 +100,7 @@ public void testCreateEditDeleteClient() { assertEquals(UNAUTHORIZED.getStatusCode(), rCreate.getStatusCode()); + Thread.sleep(1000L); // Try to create the same as admin user, should succeed: rCreate = given() @@ -176,7 +177,8 @@ public void testHarvestingClientRun() throws InterruptedException { + "\"set\":\"%s\"," + "\"metadataFormat\":\"%s\"}", harvestCollectionAlias, HARVEST_URL, ARCHIVE_URL, CONTROL_OAI_SET, HARVEST_METADATA_FORMAT); - + + Thread.sleep(1000L); Response createResponse = given() .header(UtilIT.API_TOKEN_HTTP_HEADER, adminUserAPIKey) .body(clientJson) From a5c6aca5e93bc5dfbc40135ddac5c770562f70e2 Mon Sep 17 00:00:00 2001 From: Leonid Andreev Date: Wed, 12 Apr 2023 16:33:43 -0400 Subject: [PATCH 2/2] the real fix. #9240 --- .../edu/harvard/iq/dataverse/api/HarvestingClientsIT.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/test/java/edu/harvard/iq/dataverse/api/HarvestingClientsIT.java b/src/test/java/edu/harvard/iq/dataverse/api/HarvestingClientsIT.java index dc37b0f3a05..a470bd8fb27 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/HarvestingClientsIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/HarvestingClientsIT.java @@ -79,7 +79,7 @@ public void testCreateEditDeleteClient() throws InterruptedException { // This method focuses on testing the native Dataverse harvesting client // API. - String nickName = UtilIT.getRandomString(6); + String nickName = "h" + UtilIT.getRandomString(6); String clientApiPath = String.format(HARVEST_CLIENTS_API+"%s", nickName); @@ -100,7 +100,6 @@ public void testCreateEditDeleteClient() throws InterruptedException { assertEquals(UNAUTHORIZED.getStatusCode(), rCreate.getStatusCode()); - Thread.sleep(1000L); // Try to create the same as admin user, should succeed: rCreate = given() @@ -167,7 +166,7 @@ public void testHarvestingClientRun() throws InterruptedException { // method, we don't need to pay too much attention to this method, aside // from confirming the expected HTTP status code. - String nickName = UtilIT.getRandomString(6); + String nickName = "h" + UtilIT.getRandomString(6); String clientApiPath = String.format(HARVEST_CLIENTS_API+"%s", nickName); String clientJson = String.format("{\"dataverseAlias\":\"%s\"," @@ -178,7 +177,6 @@ public void testHarvestingClientRun() throws InterruptedException { + "\"metadataFormat\":\"%s\"}", harvestCollectionAlias, HARVEST_URL, ARCHIVE_URL, CONTROL_OAI_SET, HARVEST_METADATA_FORMAT); - Thread.sleep(1000L); Response createResponse = given() .header(UtilIT.API_TOKEN_HTTP_HEADER, adminUserAPIKey) .body(clientJson)