Search in sources :

Example 11 with VerbType

use of org.openarchives.oai._2.VerbType in project mod-oai-pmh by folio-org.

the class OaiPmhImplTest method headersDatestampsShouldCorrespondToDateOnlyGranularitySetting.

@ParameterizedTest
@MethodSource("allMetadataPrefixesAndListVerbsProvider")
void headersDatestampsShouldCorrespondToDateOnlyGranularitySetting(MetadataPrefix prefix, VerbType verb) {
    String timeGranularity = System.getProperty(REPOSITORY_TIME_GRANULARITY);
    System.setProperty(REPOSITORY_TIME_GRANULARITY, GranularityType.YYYY_MM_DD_THH_MM_SS_Z.value());
    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);
    verifyHeaderDateStamp(oaipmh, verb, GranularityType.YYYY_MM_DD_THH_MM_SS_Z.value());
    System.setProperty(REPOSITORY_TIME_GRANULARITY, timeGranularity);
}
Also used : OAIPMH(org.openarchives.oai._2.OAIPMH) RequestSpecification(io.restassured.specification.RequestSpecification) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Matchers.isEmptyString(org.hamcrest.Matchers.isEmptyString) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 12 with VerbType

use of org.openarchives.oai._2.VerbType in project mod-oai-pmh by folio-org.

the class OaiPmhImplTest method checkSupportDeletedRecordsWhenDeletedConfigIsNoAndSuppressedConfigFalse.

@ParameterizedTest
@MethodSource("metadataPrefixAndVerbProviderExceptMarc21withHoldings")
void checkSupportDeletedRecordsWhenDeletedConfigIsNoAndSuppressedConfigFalse(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, "false");
    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);
}
Also used : OAIPMH(org.openarchives.oai._2.OAIPMH) RequestSpecification(io.restassured.specification.RequestSpecification) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Matchers.isEmptyString(org.hamcrest.Matchers.isEmptyString) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 13 with VerbType

use of org.openarchives.oai._2.VerbType in project mod-oai-pmh by folio-org.

the class OaiPmhImplTest method getOaiListVerbWithoutParams.

@ParameterizedTest
@EnumSource(value = VerbType.class, names = { "LIST_IDENTIFIERS", "LIST_RECORDS" })
void getOaiListVerbWithoutParams(VerbType verb) {
    RequestSpecification request = createBaseRequest().with().param(VERB_PARAM, verb.value());
    List<OAIPMHerrorType> errors = verifyResponseWithErrors(request, verb, 400, 1).getErrors();
    OAIPMHerrorType error = errors.get(0);
    assertThat(error.getCode(), equalTo(BAD_ARGUMENT));
    assertThat(error.getValue(), equalTo(LIST_NO_REQUIRED_PARAM_ERROR));
}
Also used : OAIPMHerrorType(org.openarchives.oai._2.OAIPMHerrorType) RequestSpecification(io.restassured.specification.RequestSpecification) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 14 with VerbType

use of org.openarchives.oai._2.VerbType in project mod-oai-pmh by folio-org.

the class OaiPmhImplTest method checkSupportDeletedRecordsWhenDeletedConfigIsNoAndSuppressedConfigTrueAndRecordMarkedAsDeleted.

@ParameterizedTest
@MethodSource("metadataPrefixAndVerbProviderExceptMarc21withHoldings")
void checkSupportDeletedRecordsWhenDeletedConfigIsNoAndSuppressedConfigTrueAndRecordMarkedAsDeleted(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_WITH_ONE_MARK_DELETED_RECORD).param(METADATA_PREFIX_PARAM, prefix.getName());
    OAIPMH oaipmh = verify200WithXml(request, verb);
    verifyListResponse(oaipmh, verb, 2);
    System.setProperty(REPOSITORY_SUPPRESSED_RECORDS_PROCESSING, repositorySuppressDiscovery);
    System.setProperty(REPOSITORY_DELETED_RECORDS, repositoryDeletedRecords);
}
Also used : OAIPMH(org.openarchives.oai._2.OAIPMH) RequestSpecification(io.restassured.specification.RequestSpecification) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Matchers.isEmptyString(org.hamcrest.Matchers.isEmptyString) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 15 with VerbType

use of org.openarchives.oai._2.VerbType in project mod-oai-pmh by folio-org.

the class OaiPmhImplTest method checkSupportDeletedRecordsWhenDeletedConfigPersistentAndSuppressedConfigFalseAndSuppressInRecordTrue.

@ParameterizedTest
@MethodSource("metadataPrefixAndVerbProviderExceptMarc21withHoldings")
void checkSupportDeletedRecordsWhenDeletedConfigPersistentAndSuppressedConfigFalseAndSuppressInRecordTrue(MetadataPrefix prefix, VerbType verb) {
    String repositorySuppressDiscovery = System.getProperty(REPOSITORY_SUPPRESSED_RECORDS_PROCESSING);
    String repositoryDeletedRecords = System.getProperty(REPOSITORY_DELETED_RECORDS);
    System.setProperty(REPOSITORY_DELETED_RECORDS, "persistent");
    System.setProperty(REPOSITORY_SUPPRESSED_RECORDS_PROCESSING, "false");
    RequestSpecification request = createBaseRequest().with().param(VERB_PARAM, verb.value()).param(FROM_PARAM, NO_RECORDS_DATE).param(METADATA_PREFIX_PARAM, prefix.getName());
    OAIPMH oaipmh = verifyResponseWithErrors(request, verb, 404, 1);
    assertThat(oaipmh.getErrors().get(0).getCode(), equalTo(NO_RECORDS_MATCH));
    System.setProperty(REPOSITORY_SUPPRESSED_RECORDS_PROCESSING, repositorySuppressDiscovery);
    System.setProperty(REPOSITORY_DELETED_RECORDS, repositoryDeletedRecords);
}
Also used : OAIPMH(org.openarchives.oai._2.OAIPMH) RequestSpecification(io.restassured.specification.RequestSpecification) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Matchers.isEmptyString(org.hamcrest.Matchers.isEmptyString) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

OAIPMH (org.openarchives.oai._2.OAIPMH)39 RequestSpecification (io.restassured.specification.RequestSpecification)38 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)36 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)35 Matchers.isEmptyString (org.hamcrest.Matchers.isEmptyString)35 MethodSource (org.junit.jupiter.params.provider.MethodSource)25 ResumptionTokenType (org.openarchives.oai._2.ResumptionTokenType)13 EnumSource (org.junit.jupiter.params.provider.EnumSource)12 OAIPMHerrorType (org.openarchives.oai._2.OAIPMHerrorType)8 NameValuePair (org.apache.http.NameValuePair)6 HeaderType (org.openarchives.oai._2.HeaderType)4 OAIPMHerrorcodeType (org.openarchives.oai._2.OAIPMHerrorcodeType)2 DataFieldType (gov.loc.marc21.slim.DataFieldType)1 SubfieldatafieldType (gov.loc.marc21.slim.SubfieldatafieldType)1 RestAssured (io.restassured.RestAssured)1 RestAssured.given (io.restassured.RestAssured.given)1 DecoderConfig (io.restassured.config.DecoderConfig)1 ContentDecoder (io.restassured.config.DecoderConfig.ContentDecoder)1 RestAssuredConfig (io.restassured.config.RestAssuredConfig)1 ContentType (io.restassured.http.ContentType)1