|
18 | 18 | import static com.jayway.restassured.RestAssured.given;
|
19 | 19 | import java.util.List;
|
20 | 20 | import static junit.framework.Assert.assertEquals;
|
| 21 | +import static org.junit.Assert.assertFalse; |
21 | 22 | import static org.junit.Assert.assertNotNull;
|
22 | 23 |
|
23 | 24 | /**
|
@@ -163,6 +164,20 @@ public void testOaiFunctionality() throws InterruptedException {
|
163 | 164 | // And the record should be the dataset we have just created:
|
164 | 165 | assertEquals(datasetPersistentId, listIdentifiersResponse.getBody().xmlPath().getString("OAI-PMH.ListIdentifiers.header.identifier"));
|
165 | 166 |
|
| 167 | + Response listRecordsResponse = UtilIT.getOaiListRecords(setName, "oai_dc"); |
| 168 | + assertEquals(OK.getStatusCode(), listRecordsResponse.getStatusCode()); |
| 169 | + List listRecords = listRecordsResponse.getBody().xmlPath().getList("OAI-PMH.ListRecords.record"); |
| 170 | + |
| 171 | + assertNotNull(listRecords); |
| 172 | + assertEquals(1, listRecords.size()); |
| 173 | + assertEquals(datasetPersistentId, listRecordsResponse.getBody().xmlPath().getString("OAI-PMH.ListRecords.record[0].header.identifier")); |
| 174 | + |
| 175 | + // assert that Datacite format does not contain the XML prolog |
| 176 | + Response listRecordsResponseDatacite = UtilIT.getOaiListRecords(setName, "Datacite"); |
| 177 | + assertEquals(OK.getStatusCode(), listRecordsResponseDatacite.getStatusCode()); |
| 178 | + String body = listRecordsResponseDatacite.getBody().asString(); |
| 179 | + assertFalse(body.contains("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")); |
| 180 | + |
166 | 181 | // And now run GetRecord on the OAI record for the dataset:
|
167 | 182 | Response getRecordResponse = UtilIT.getOaiRecord(datasetPersistentId, "oai_dc");
|
168 | 183 |
|
|
0 commit comments