use of gov.loc.marc21.slim.SubfieldatafieldType in project mod-oai-pmh by folio-org.
the class OaiPmhImplTest method getOaiRecordsMarc21WithHoldingsWhenNoItems.
@Test
void getOaiRecordsMarc21WithHoldingsWhenNoItems() {
RequestSpecification request = createBaseRequest().with().param(VERB_PARAM, LIST_RECORDS.value()).param(FROM_PARAM, NO_ITEMS_DATE).param(METADATA_PREFIX_PARAM, MetadataPrefix.MARC21WITHHOLDINGS.getName());
OAIPMH response = verify200WithXml(request, LIST_RECORDS);
assertThat(response.getErrors(), is(empty()));
response.getListRecords().getRecords().forEach(r -> {
Optional<SubfieldatafieldType> optInstitutionName = findSubfieldByFiledTagAndSubfieldCode(r, "952", "a");
Optional<SubfieldatafieldType> optCampusName = findSubfieldByFiledTagAndSubfieldCode(r, "952", "b");
Optional<SubfieldatafieldType> optLibraryName = findSubfieldByFiledTagAndSubfieldCode(r, "952", "c");
Optional<SubfieldatafieldType> optLocationName = findSubfieldByFiledTagAndSubfieldCode(r, "952", "d");
Optional<SubfieldatafieldType> optCallNumber = findSubfieldByFiledTagAndSubfieldCode(r, "952", "e");
Optional<SubfieldatafieldType> optHoldingsUrlField = findSubfieldByFiledTagAndSubfieldCode(r, "856", "u");
Optional<SubfieldatafieldType> optHoldingsType = findSubfieldByFiledTagAndSubfieldCode(r, "856", "3");
Optional<SubfieldatafieldType> optHoldingsUrlNote = findSubfieldByFiledTagAndSubfieldCode(r, "856", "z");
assertTrue(optInstitutionName.isPresent());
assertTrue(optCampusName.isPresent());
assertTrue(optLibraryName.isPresent());
assertTrue(optLocationName.isPresent());
assertTrue(optCallNumber.isPresent());
assertTrue(optHoldingsUrlField.isPresent());
assertTrue(optHoldingsType.isPresent());
assertTrue(optHoldingsUrlNote.isPresent());
});
}
use of gov.loc.marc21.slim.SubfieldatafieldType in project mod-oai-pmh by folio-org.
the class OaiPmhImplTest method shouldDecodeCyrillicSymbols_whenGetListRecordsAndSomeRecordsHaveCyrillicData.
@ParameterizedTest
// metadata only marc21 and marc21_withh
@MethodSource("metadataPrefixAndEncodingProviderExceptOaiDc")
void shouldDecodeCyrillicSymbols_whenGetListRecordsAndSomeRecordsHaveCyrillicData(MetadataPrefix metadataPrefix, String encoding) {
RequestSpecification request = createBaseRequest().with().param(VERB_PARAM, LIST_RECORDS.value()).param(FROM_PARAM, SRS_RECORDS_WITH_CYRILLIC_DATA_DATE).param(METADATA_PREFIX_PARAM, metadataPrefix.getName());
addAcceptEncodingHeader(request, encoding);
OAIPMH oaipmh = verify200WithXml(request, LIST_RECORDS);
verifyListResponse(oaipmh, LIST_RECORDS, 2);
oaipmh.getListRecords().getRecords().forEach(record -> {
Optional<SubfieldatafieldType> optioanlSubfieldWithCyrillicData = findSubfieldByFiledTagAndSubfieldCode(record, "880", "a");
assertTrue(optioanlSubfieldWithCyrillicData.isPresent());
optioanlSubfieldWithCyrillicData.ifPresent(subfield -> assertEquals(EXPECTED_SUBFIELD_VALUE, subfield.getValue()));
});
}
use of gov.loc.marc21.slim.SubfieldatafieldType in project mod-oai-pmh by folio-org.
the class OaiPmhImplTest method setupPredicates.
private void setupPredicates() {
suppressedDiscoveryMarcFieldPredicate = (dataField) -> {
List<SubfieldatafieldType> subfields = dataField.getSubfields();
if (Objects.nonNull(subfields) && subfields.size() > 0) {
return subfields.stream().anyMatch(subfieldatafieldType -> {
String value = subfieldatafieldType.getValue();
return subfieldatafieldType.getCode().equals("t") && value.equals("0") || value.equals("1");
});
}
return false;
};
suppressedDiscoveryDcFieldPredicate = (jaxbElement) -> {
String value = jaxbElement.getValue().getValue();
return jaxbElement.getName().getLocalPart().equals("rights") && value.equals("discovery suppressed") || value.equals("discovery not suppressed");
};
}
Aggregations