Skip to content

Commit

Permalink
fix(mod-search): fix export of cql files
Browse files Browse the repository at this point in the history
- Delete unused tests

Closes: MSEARCH-762
  • Loading branch information
viacheslavpoliakov committed Jun 13, 2024
1 parent 8508807 commit fe643e0
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions src/test/java/org/folio/search/service/ResourceIdServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,44 +165,6 @@ void streamResourceIds_positive_emptyCollectionProvided() throws IOException {
assertThat(actual).isEqualTo(new ResourceIds().ids(emptyList()).totalRecords(0));
}

@Test
void streamResourceIds_positive_FilteredByMemberTenant() throws IOException {
String query = "shared==\"false\"";
CqlResourceIdsRequest request = CqlResourceIdsRequest.of(RESOURCE_NAME, TENANT_ID, query, INSTANCE_ID_PATH);
var expectedSearchSource = searchSource().size(QUERY_SIZE).sort("_doc");
doAnswer(invocation -> {
invocation.<Consumer<List<String>>>getArgument(2).accept(emptyList());
return null;
}).when(searchRepository).streamResourceIds(eq(request), eq(expectedSearchSource), any());
when(queryConverter.convertForConsortia(query, RESOURCE_NAME, TENANT_ID)).thenReturn(searchSource());
when(properties.getScrollQuerySize()).thenReturn(QUERY_SIZE);

var outputStream = new ByteArrayOutputStream();
resourceIdService.streamResourceIdsAsJson(request, outputStream);

var actual = objectMapper.readValue(outputStream.toByteArray(), ResourceIds.class);
assertThat(actual).isEqualTo(new ResourceIds().ids(emptyList()).totalRecords(0));
}

@Test
void streamResourceIds_negative_NotSharedActiveAffiliation() throws IOException {
String query = "shared==\"false\"";
CqlResourceIdsRequest request = CqlResourceIdsRequest.of(RESOURCE_NAME, CENTRAL_TENANT_ID, query, INSTANCE_ID_PATH);
var expectedSearchSource = searchSource().size(QUERY_SIZE).sort("_doc");
doAnswer(invocation -> {
invocation.<Consumer<List<String>>>getArgument(2).accept(emptyList());
return null;
}).when(searchRepository).streamResourceIds(eq(request), eq(expectedSearchSource), any());
when(queryConverter.convertForConsortia(query, RESOURCE_NAME, CENTRAL_TENANT_ID)).thenReturn(searchSource());
when(properties.getScrollQuerySize()).thenReturn(QUERY_SIZE);

var outputStream = new ByteArrayOutputStream();
resourceIdService.streamResourceIdsAsJson(request, outputStream);

var actual = objectMapper.readValue(outputStream.toByteArray(), ResourceIds.class);
assertThat(actual).isEqualTo(new ResourceIds().ids(emptyList()).totalRecords(0));
}

@Test
void streamResourceIdsInTextTextType_positive_emptyCollectionProvided() {
mockSearchRepositoryCall(emptyList());
Expand Down

0 comments on commit fe643e0

Please sign in to comment.