use of org.folio.rest.support.IndividualResource in project mod-inventory-storage by folio-org.
the class InstanceDiscoverySuppressMigrationScriptTest method canSetDiscoverySuppressIfNotPresent.
@Test
public void canSetDiscoverySuppressIfNotPresent() throws Exception {
List<IndividualResource> allInstances = createInstances(3);
for (IndividualResource instance : allInstances) {
assertThat(unsetJsonbProperty("instance", instance.getId(), DISCOVERY_SUPPRESS).rowCount(), is(1));
}
executeMultipleSqlStatements(MIGRATION_SCRIPT);
verifyNotSuppressed(allInstances);
}
use of org.folio.rest.support.IndividualResource in project mod-inventory-storage by folio-org.
the class InstanceStorageTest method canSearchByStaffSuppressProperty.
@Test
public void canSearchByStaffSuppressProperty() throws Exception {
final IndividualResource suppressedInstance = createInstance(smallAngryPlanet(UUID.randomUUID()).put(STAFF_SUPPRESS, true));
final IndividualResource notSuppressedInstance = createInstance(smallAngryPlanet(UUID.randomUUID()).put(STAFF_SUPPRESS, false));
final IndividualResource notSuppressedInstanceDefault = createInstance(smallAngryPlanet(UUID.randomUUID()));
final List<IndividualResource> suppressedInstances = instancesClient.getMany("%s==true", STAFF_SUPPRESS);
final List<IndividualResource> notSuppressedInstances = instancesClient.getMany("cql.allRecords=1 not %s==true", STAFF_SUPPRESS);
assertThat(suppressedInstances.size(), is(1));
assertThat(suppressedInstances.get(0).getId(), is(suppressedInstance.getId()));
assertThat(notSuppressedInstances.size(), is(2));
assertThat(notSuppressedInstances.stream().map(IndividualResource::getId).collect(Collectors.toList()), containsInAnyOrder(notSuppressedInstance.getId(), notSuppressedInstanceDefault.getId()));
}
use of org.folio.rest.support.IndividualResource in project mod-inventory-storage by folio-org.
the class PrecedingSucceedingTitleTest method canUpdateConnectedPrecedingSucceedingTitle.
@Test
public void canUpdateConnectedPrecedingSucceedingTitle() {
IndividualResource instance1Resource = createInstance("Title One");
IndividualResource instance2Resource = createInstance("Title Two");
String instance1Id = instance1Resource.getId().toString();
String instance2Id = instance2Resource.getId().toString();
PrecedingSucceedingTitle precedingSucceedingTitle = new PrecedingSucceedingTitle(instance1Id, instance2Id, null, null, null);
IndividualResource response = precedingSucceedingTitleClient.create(precedingSucceedingTitle.getJson());
PrecedingSucceedingTitle newPrecedingSucceedingTitle = new PrecedingSucceedingTitle(instance2Id, instance1Id, null, null, null);
precedingSucceedingTitleClient.replace(response.getId(), newPrecedingSucceedingTitle.getJson());
assertPrecedingSucceedingTitle(response, instance2Id, instance1Id, null, null, new JsonArray());
}
use of org.folio.rest.support.IndividualResource in project mod-inventory-storage by folio-org.
the class PrecedingSucceedingTitleTest method canGetPrecedingSucceedingTitleByQuery.
@Test
public void canGetPrecedingSucceedingTitleByQuery() {
IndividualResource instance1Resource = createInstance("Title One");
IndividualResource instance2Resource = createInstance("Title Two");
String instance1Id = instance1Resource.getId().toString();
String instance2Id = instance2Resource.getId().toString();
JsonArray identifiers = new JsonArray();
identifiers.add(identifier(UUID_ISBN, "9781473619777"));
PrecedingSucceedingTitle precedingSucceedingTitle = new PrecedingSucceedingTitle(instance1Id, instance2Id, TITLE, HRID, identifiers);
IndividualResource response = precedingSucceedingTitleClient.create(precedingSucceedingTitle.getJson());
List<JsonObject> badParameterResponse = precedingSucceedingTitleClient.getByQuery("?query=succeedingInstanceId=" + instance2Id);
assertThat(badParameterResponse.size(), is(1));
assertPrecedingSucceedingTitle(badParameterResponse.get(0), response.getId().toString(), instance1Id, instance2Id, TITLE, HRID, identifiers);
}
use of org.folio.rest.support.IndividualResource in project mod-inventory-storage by folio-org.
the class TestBaseWithInventoryUtil method getInstanceStatusByCode.
private IndividualResource getInstanceStatusByCode(String code) {
CompletableFuture<Response> getCompleted = new CompletableFuture<>();
client.get(instanceStatusesUrl("?query=code=" + code), TENANT_ID, ResponseHandler.json(getCompleted));
JsonObject instanceStatus = get(getCompleted).getJson().getJsonArray("instanceStatuses").getJsonObject(0);
return new IndividualResource(instanceStatus);
}
Aggregations