use of org.folio.rest.jaxrs.model.Provider in project mod-kb-ebsco-java by folio-org.
the class ProviderConverter method convert.
@Override
public Provider convert(@NonNull VendorResult result) {
VendorById vendor = result.getVendor();
org.folio.holdingsiq.model.Packages packages = result.getPackages();
TokenInfo vendorToken = vendor.getVendorByIdToken();
Provider provider = new Provider().withData(new ProviderData().withId(String.valueOf(vendor.getVendorId())).withType(PROVIDERS_TYPE).withAttributes(new ProviderGetDataAttributes().withName(vendor.getVendorName()).withPackagesTotal(vendor.getPackagesTotal()).withPackagesSelected(vendor.getPackagesSelected()).withSupportsCustomPackages(vendor.isCustomer()).withProviderToken(tokenInfoConverter.convert(vendorToken)).withProxy(new Proxy().withId(vendor.getProxy().getId()).withInherited(vendor.getProxy().getInherited())).withTags(result.getTags())).withRelationships(createEmptyProviderRelationships())).withJsonapi(RestConstants.JSONAPI);
if (packages != null) {
provider.withIncluded(packagesConverter.convert(packages).getData()).getData().withRelationships(new Relationships().withPackages(new Packages().withMeta(new MetaDataIncluded().withIncluded(true)).withData(convertPackagesRelationship(packages))));
}
return provider;
}
use of org.folio.rest.jaxrs.model.Provider in project mod-kb-ebsco-java by folio-org.
the class EholdingsProvidersImplTest method shouldReturnProviderWithTagWhenValidId.
@Test
public void shouldReturnProviderWithTagWhenValidId() throws IOException, URISyntaxException {
saveTag(vertx, STUB_VENDOR_ID, PROVIDER, STUB_TAG_VALUE);
String stubResponseFile = "responses/rmapi/vendors/get-vendor-by-id-response.json";
stubFor(get(PROVIDER_URL_PATTERN).willReturn(new ResponseDefinitionBuilder().withBody(readFile(stubResponseFile))));
Provider provider = getWithOk(PROVIDER_BY_ID, STUB_TOKEN_HEADER).as(Provider.class);
assertTrue(provider.getData().getAttributes().getTags().getTagList().contains(STUB_TAG_VALUE));
}
Aggregations