use of org.openarchives.oai._2.VerbType.LIST_METADATA_FORMATS in project mod-oai-pmh by folio-org.
the class OaiPmhImplTest method getOaiMetadataFormatsWithExistingIdentifier.
@Test
void getOaiMetadataFormatsWithExistingIdentifier(VertxTestContext testContext) {
logger.info("=== Test Metadata Formats with existing identifier ===");
String identifier = IDENTIFIER_PREFIX + OkapiMockServer.EXISTING_IDENTIFIER;
RequestSpecification request = createBaseRequest().with().param(VERB_PARAM, LIST_METADATA_FORMATS.value()).param(IDENTIFIER_PARAM, identifier);
OAIPMH oaiPmhResponseWithExistingIdentifier = verify200WithXml(request, LIST_METADATA_FORMATS);
assertThat(oaiPmhResponseWithExistingIdentifier.getListMetadataFormats(), is(notNullValue()));
assertThat(oaiPmhResponseWithExistingIdentifier.getErrors(), is(empty()));
testContext.completeNow();
}
use of org.openarchives.oai._2.VerbType.LIST_METADATA_FORMATS in project mod-oai-pmh by folio-org.
the class OaiPmhImplTest method getOaiMetadataFormatsAndCheckMarc21WithHoldingsMetadataPrefixIsPresent.
@Test
void getOaiMetadataFormatsAndCheckMarc21WithHoldingsMetadataPrefixIsPresent() {
RequestSpecification request = createBaseRequest().with().param(VERB_PARAM, LIST_METADATA_FORMATS.value());
OAIPMH oaiPmhResponse = verify200WithXml(request, LIST_METADATA_FORMATS);
boolean isMarc21WithHoldingsPrefixPresent = oaiPmhResponse.getListMetadataFormats().getMetadataFormats().stream().anyMatch(metadataFormatType -> metadataFormatType.getMetadataPrefix().equals(MetadataPrefix.MARC21WITHHOLDINGS.getName()));
assertThat(oaiPmhResponse.getListMetadataFormats().getMetadataFormats(), is(notNullValue()));
assertThat(oaiPmhResponse.getListMetadataFormats().getMetadataFormats().size(), equalTo(3));
assertTrue(isMarc21WithHoldingsPrefixPresent);
assertThat(oaiPmhResponse.getErrors(), is(empty()));
}
use of org.openarchives.oai._2.VerbType.LIST_METADATA_FORMATS in project mod-oai-pmh by folio-org.
the class OaiPmhImplTest method getOaiMetadataFormats.
@Test
void getOaiMetadataFormats(VertxTestContext testContext) {
logger.info("=== Test Metadata Formats without identifier ===");
RequestSpecification request = createBaseRequest().with().param(VERB_PARAM, LIST_METADATA_FORMATS.value());
OAIPMH oaiPmhResponseWithoutIdentifier = verify200WithXml(request, LIST_METADATA_FORMATS);
assertThat(oaiPmhResponseWithoutIdentifier.getListMetadataFormats(), is(notNullValue()));
assertThat(oaiPmhResponseWithoutIdentifier.getErrors(), is(empty()));
testContext.completeNow();
}
use of org.openarchives.oai._2.VerbType.LIST_METADATA_FORMATS in project mod-oai-pmh by folio-org.
the class OaiPmhImplTest method getOaiMetadataFormatsWithInvalidIdentifier.
@Test
void getOaiMetadataFormatsWithInvalidIdentifier(VertxTestContext testContext) {
logger.info("=== Test Metadata Formats with invalid identifier format ===");
// Check that error message is returned
RequestSpecification request = createBaseRequest().with().param(VERB_PARAM, LIST_METADATA_FORMATS.value()).param(IDENTIFIER_PARAM, OkapiMockServer.INVALID_IDENTIFIER);
OAIPMH oaipmh = verifyResponseWithErrors(request, LIST_METADATA_FORMATS, 400, 1);
assertThat(oaipmh.getListMetadataFormats(), is(nullValue()));
assertThat(oaipmh.getErrors().get(0).getCode(), equalTo(BAD_ARGUMENT));
testContext.completeNow();
}
use of org.openarchives.oai._2.VerbType.LIST_METADATA_FORMATS in project mod-oai-pmh by folio-org.
the class OaiPmhImplTest method getOaiMetadataFormatsWithNonExistingIdentifier.
@Test
void getOaiMetadataFormatsWithNonExistingIdentifier(VertxTestContext testContext) {
logger.info("=== Test Metadata Formats with non-existing identifier ===");
// Check that error message is returned
String identifier = IDENTIFIER_PREFIX + OkapiMockServer.NON_EXISTING_IDENTIFIER;
RequestSpecification request = createBaseRequest().with().param(VERB_PARAM, LIST_METADATA_FORMATS.value()).param(IDENTIFIER_PARAM, identifier);
OAIPMH oaipmh = verifyResponseWithErrors(request, LIST_METADATA_FORMATS, 404, 1);
assertThat(oaipmh.getListMetadataFormats(), is(nullValue()));
assertThat(oaipmh.getErrors().get(0).getCode(), equalTo(ID_DOES_NOT_EXIST));
testContext.completeNow();
}
Aggregations