use of org.folio.holdingsiq.model.PackagePut in project mod-kb-ebsco-java by folio-org.
the class EholdingsPackagesTest method shouldPassIsFullPackageAttributeToRMAPI.
@Test
public void shouldPassIsFullPackageAttributeToRMAPI() throws URISyntaxException, IOException {
PackageByIdData updatedPackage = mapper.readValue(getFile(PACKAGE_STUB_FILE), PackageByIdData.class).toByIdBuilder().isSelected(true).build();
mockUpdateScenario(readFile(PACKAGE_STUB_FILE), mapper.writeValueAsString(updatedPackage));
PackagePutRequest request = mapper.readValue(readFile("requests/kb-ebsco/package/put-package-selected.json"), PackagePutRequest.class);
request.getData().getAttributes().setIsFullPackage(false);
putWithOk(PACKAGES_PATH, mapper.writeValueAsString(request), STUB_TOKEN_HEADER).as(Package.class);
PackagePut rmApiPutRequest = mapper.readValue(readFile("requests/rmapi/packages/put-package-is-selected.json"), PackagePut.class).toBuilder().isFullPackage(false).build();
verify(putRequestedFor(PACKAGE_URL_PATTERN).withRequestBody(new EqualToJsonPattern(mapper.writeValueAsString(rmApiPutRequest), true, true)));
}
use of org.folio.holdingsiq.model.PackagePut in project mod-kb-ebsco-java by folio-org.
the class PackageRequestConverter method convertToRMAPICustomPackagePutRequest.
public PackagePut convertToRMAPICustomPackagePutRequest(PackagePutRequest request) {
PackagePutDataAttributes attributes = request.getData().getAttributes();
PackagePut.PackagePutBuilder builder = convertCommonAttributesToPackagePutRequest(attributes);
builder.packageName(attributes.getName());
Integer contentType = contentTypeToRMAPICode.get(attributes.getContentType());
builder.contentType(contentType != null ? contentType : 6);
return builder.build();
}
use of org.folio.holdingsiq.model.PackagePut in project mod-kb-ebsco-java by folio-org.
the class PackageRequestConverterTest method shouldCreateRequestToChangeCustomPackageCoverageDatesToEmpty.
@Test
public void shouldCreateRequestToChangeCustomPackageCoverageDatesToEmpty() {
PackagePut packagePut = packagesConverter.convertToRMAPICustomPackagePutRequest(PackagesTestData.getPackagePutRequest(new PackagePutDataAttributes().withCustomCoverage(new Coverage().withBeginCoverage("").withEndCoverage(""))));
assertEquals("", packagePut.getCustomCoverage().getBeginCoverage());
assertEquals("", packagePut.getCustomCoverage().getEndCoverage());
}
use of org.folio.holdingsiq.model.PackagePut in project mod-kb-ebsco-java by folio-org.
the class PackageRequestConverterTest method shouldCreateRequestToChangeCustomPackageCoverageDates.
@Test
public void shouldCreateRequestToChangeCustomPackageCoverageDates() {
PackagePut packagePut = packagesConverter.convertToRMAPICustomPackagePutRequest(PackagesTestData.getPackagePutRequest(new PackagePutDataAttributes().withCustomCoverage(new Coverage().withBeginCoverage("2003-01-01").withEndCoverage("2004-01-01"))));
assertEquals("2003-01-01", packagePut.getCustomCoverage().getBeginCoverage());
assertEquals("2004-01-01", packagePut.getCustomCoverage().getEndCoverage());
}
use of org.folio.holdingsiq.model.PackagePut in project mod-kb-ebsco-java by folio-org.
the class PackageRequestConverterTest method shouldCreateRequestToAddCustomCoverage.
@Test
public void shouldCreateRequestToAddCustomCoverage() {
PackagePut packagePut = packagesConverter.convertToRMAPIPackagePutRequest(PackagesTestData.getPackagePutRequest(new PackagePutDataAttributes().withIsSelected(true).withCustomCoverage(new Coverage().withBeginCoverage("2000-10-10").withEndCoverage("2000-11-10"))));
assertEquals("2000-10-10", packagePut.getCustomCoverage().getBeginCoverage());
assertEquals("2000-11-10", packagePut.getCustomCoverage().getEndCoverage());
}
Aggregations