use of org.openarchives.oai._2.VerbType in project mod-oai-pmh by folio-org.
the class OaiPmhImplTest method makeResumptionTokenRequestsAndVerifyCount.
private ResumptionTokenType makeResumptionTokenRequestsAndVerifyCount(List<HeaderType> totalRecords, ResumptionTokenType resumptionToken, VerbType verb, int desiredCount, int expectedCursor) {
RequestSpecification request = createBaseRequest().with().param(VERB_PARAM, verb.value()).param(RESUMPTION_TOKEN_PARAM, resumptionToken.getValue());
OAIPMH oaipmh;
List<HeaderType> records;
oaipmh = verify200WithXml(request, verb);
verifyListResponse(oaipmh, verb, desiredCount);
resumptionToken = getResumptionToken(oaipmh, verb);
assertThat(resumptionToken, is(notNullValue()));
assertEquals(expectedCursor, resumptionToken.getCursor().intValue());
records = getHeadersListDependOnVerbType(verb, oaipmh);
totalRecords.addAll(records);
return resumptionToken;
}
use of org.openarchives.oai._2.VerbType in project mod-oai-pmh by folio-org.
the class OaiPmhImplTest method checkSupportDeletedRecordsWhenDeletedConfigIsNoAndSuppressedConfigTrue.
@ParameterizedTest
@MethodSource("metadataPrefixAndVerbProviderExceptMarc21withHoldings")
void checkSupportDeletedRecordsWhenDeletedConfigIsNoAndSuppressedConfigTrue(MetadataPrefix prefix, VerbType verb) {
String repositorySuppressDiscovery = System.getProperty(REPOSITORY_SUPPRESSED_RECORDS_PROCESSING);
String repositoryDeletedRecords = System.getProperty(REPOSITORY_DELETED_RECORDS);
System.setProperty(REPOSITORY_DELETED_RECORDS, "no");
System.setProperty(REPOSITORY_SUPPRESSED_RECORDS_PROCESSING, "true");
RequestSpecification request = createBaseRequest().with().param(VERB_PARAM, verb.value()).param(FROM_PARAM, THREE_INSTANCES_DATE).param(METADATA_PREFIX_PARAM, prefix.getName());
OAIPMH oaipmh = verify200WithXml(request, verb);
verifyListResponse(oaipmh, verb, 3);
System.setProperty(REPOSITORY_SUPPRESSED_RECORDS_PROCESSING, repositorySuppressDiscovery);
System.setProperty(REPOSITORY_DELETED_RECORDS, repositoryDeletedRecords);
}
use of org.openarchives.oai._2.VerbType in project mod-oai-pmh by folio-org.
the class OaiPmhImplTest method checkSupportDeletedRecordsWhenDeletedConfigTransientAndSuppressedConfigTrueAndRecordMarkAsDeleted.
@ParameterizedTest
@MethodSource("metadataPrefixAndVerbProviderExceptMarc21withHoldings")
void checkSupportDeletedRecordsWhenDeletedConfigTransientAndSuppressedConfigTrueAndRecordMarkAsDeleted(MetadataPrefix prefix, VerbType verb) {
String repositorySuppressDiscovery = System.getProperty(REPOSITORY_SUPPRESSED_RECORDS_PROCESSING);
String repositoryDeletedRecords = System.getProperty(REPOSITORY_DELETED_RECORDS);
System.setProperty(REPOSITORY_DELETED_RECORDS, "transient");
System.setProperty(REPOSITORY_SUPPRESSED_RECORDS_PROCESSING, "true");
RequestSpecification request = createBaseRequest().with().param(VERB_PARAM, verb.value()).param(FROM_PARAM, THREE_INSTANCES_DATE_WITH_ONE_MARK_DELETED_RECORD).param(METADATA_PREFIX_PARAM, prefix.getName());
OAIPMH oaipmh = verify200WithXml(request, verb);
verifyListResponse(oaipmh, verb, 3);
if (verb.equals(LIST_RECORDS)) {
assertThat(oaipmh.getListRecords().getRecords().get(2).getHeader().getStatus(), is(StatusType.DELETED));
} else {
assertThat(oaipmh.getListIdentifiers().getHeaders().get(2).getStatus(), is(StatusType.DELETED));
}
System.setProperty(REPOSITORY_SUPPRESSED_RECORDS_PROCESSING, repositorySuppressDiscovery);
System.setProperty(REPOSITORY_DELETED_RECORDS, repositoryDeletedRecords);
}
use of org.openarchives.oai._2.VerbType in project mod-oai-pmh by folio-org.
the class OaiPmhImplTest method getOaiListVerbResumptionFlowStarted.
@ParameterizedTest
@MethodSource("metadataPrefixAndVerbProviderExceptMarc21withHoldings")
void getOaiListVerbResumptionFlowStarted(MetadataPrefix metadataPrefix, VerbType verb) {
RequestSpecification request = createBaseRequest().with().param(VERB_PARAM, verb.value()).param(FROM_PARAM, PARTITIONABLE_RECORDS_DATE_TIME).param(METADATA_PREFIX_PARAM, metadataPrefix.getName()).param(SET_PARAM, "all");
OAIPMH oaipmh = verify200WithXml(request, verb);
verifyListResponse(oaipmh, verb, 10);
ResumptionTokenType resumptionToken = getResumptionToken(oaipmh, verb);
assertThat(resumptionToken, is(notNullValue()));
assertThat(resumptionToken.getCompleteListSize(), is(equalTo(BigInteger.valueOf(100))));
assertThat(resumptionToken.getCursor(), is(equalTo(BigInteger.ZERO)));
assertThat(resumptionToken.getExpirationDate(), is(notNullValue()));
String resumptionTokenValue = new String(Base64.getUrlDecoder().decode(resumptionToken.getValue()), StandardCharsets.UTF_8);
List<NameValuePair> params = URLEncodedUtils.parse(resumptionTokenValue, StandardCharsets.UTF_8);
assertThat(params, is(hasSize(8)));
assertThat(getParamValue(params, METADATA_PREFIX_PARAM), is(equalTo(metadataPrefix.getName())));
assertThat(getParamValue(params, FROM_PARAM), is(equalTo(PARTITIONABLE_RECORDS_DATE_TIME)));
assertThat(getParamValue(params, UNTIL_PARAM), is((notNullValue())));
assertThat(getParamValue(params, SET_PARAM), is(equalTo("all")));
assertThat(getParamValue(params, OFFSET_PARAM), is(equalTo("10")));
assertThat(getParamValue(params, TOTAL_RECORDS_PARAM), is(equalTo("100")));
assertThat(getParamValue(params, NEXT_RECORD_ID_PARAM), is(equalTo("6506b79b-7702-48b2-9774-a1c538fdd34e")));
}
use of org.openarchives.oai._2.VerbType in project mod-oai-pmh by folio-org.
the class OaiPmhImplTest method verify200WithXml.
private OAIPMH verify200WithXml(RequestSpecification request, VerbType verb) {
String response = verifyWithCodeWithXml(request, 200);
// Unmarshal string to OAIPMH and verify required data presents
OAIPMH oaipmh = ResponseConverter.getInstance().stringToOaiPmh(response);
verifyBaseResponse(oaipmh, verb);
return oaipmh;
}
Aggregations