Skip to content

Commit a04cdab

Browse files
committed
add wait to async export call
1 parent 9a580f8 commit a04cdab

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/test/java/edu/harvard/iq/dataverse/api/UtilIT.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2167,22 +2167,17 @@ static Response exportDataset(String datasetPersistentId, String exporter, Strin
21672167
return exportDataset(datasetPersistentId, exporter, apiToken, false);
21682168
}
21692169
static Response exportDataset(String datasetPersistentId, String exporter, String apiToken, boolean wait) {
2170-
// http://localhost:8080/api/datasets/export?exporter=dataverse_json&persistentId=doi%3A10.5072/FK2/W6WIMQ
2170+
// Wait for the Async call to finish to get the updated data
2171+
if (wait) {
2172+
sleepForReexport(datasetPersistentId, apiToken, 10);
2173+
}
21712174
RequestSpecification requestSpecification = given();
21722175
if (apiToken != null) {
21732176
requestSpecification = given()
21742177
.header(UtilIT.API_TOKEN_HTTP_HEADER, apiToken);
21752178
}
2176-
Response resp = requestSpecification
2177-
// .header(API_TOKEN_HTTP_HEADER, apiToken)
2178-
// .get("/api/datasets/:persistentId/export" + "?persistentId=" + datasetPersistentId + "&exporter=" + exporter);
2179+
return requestSpecification
21792180
.get("/api/datasets/export" + "?persistentId=" + datasetPersistentId + "&exporter=" + exporter);
2180-
// Wait for the Async call to finish to get the updated data
2181-
if (wait) {
2182-
sleepForReexport(datasetPersistentId, apiToken, 10);
2183-
resp = requestSpecification.get("/api/datasets/export" + "?persistentId=" + datasetPersistentId + "&exporter=" + exporter);
2184-
}
2185-
return resp;
21862181
}
21872182

21882183
static Response reexportDatasetAllFormats(String idOrPersistentId) {

0 commit comments

Comments
 (0)