Skip to content

Commit

Permalink
Merge pull request #158 from DiSSCo/bug-fix/minor-fixes
Browse files Browse the repository at this point in the history
Two minor fixes, annotation-creator and mjr for target
  • Loading branch information
samleeflang authored Dec 16, 2024
2 parents de16d3b + 4214864 commit b7d5228
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private DigitalSpecimen mapToDigitalSpecimen(ObjectNode json) {

public Pair<Long, List<Annotation>> getAnnotationsForCreator(String userId,
int pageNumber, int pageSize) throws IOException {
var fieldName = "dcterms:creator.@id";
var fieldName = "dcterms:creator.@id.keyword";
var offset = getOffset(pageNumber, pageSize);
var pageSizePlusOne = pageSize + ONE_TO_CHECK_NEXT;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,10 @@ public JsonApiWrapper getMasJobRecordById(String masJobRecordHandle, String path
}

public JsonApiListResponseWrapper getMasJobRecordByTargetId(String targetId,
JobState state, String path, int pageNum, int pageSize) throws NotFoundException {
JobState state, String path, int pageNum, int pageSize) {
var pageSizePlusOne = pageSize + 1;
var masJobRecordListPlusOne = masJobRecordRepository.getMasJobRecordsByTargetId(targetId, state,
pageNum, pageSizePlusOne);
if (masJobRecordListPlusOne.isEmpty()) {
throw new NotFoundException("No MAS Jobs for " + targetId + " found");
}
return packageList(masJobRecordListPlusOne, path, pageNum, pageSize);
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/eu/dissco/backend/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

public class TestUtils {

public static final String USER_ID_TOKEN = "e2befba6-9324-4bb4-9f41-d7dfae4a44b0";
public static final String USER_ID_TOKEN = "https://orcid.org/0000-0002-5669-2769";
public static final String FORBIDDEN_MESSAGE =
"User: " + USER_ID_TOKEN + " is not allowed to perform this action";
public static final String HANDLE = "https://hdl.handle.net/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
class ElasticSearchRepositoryIT {

private static final DockerImageName ELASTIC_IMAGE = DockerImageName.parse(
"docker.elastic.co/elasticsearch/elasticsearch").withTag("8.7.1");
"docker.elastic.co/elasticsearch/elasticsearch").withTag("8.15.0");
private static final String DIGITAL_SPECIMEN_INDEX = "digital-specimen";
private static final String ANNOTATION_INDEX = "annotation";
private static final String ELASTICSEARCH_USERNAME = "elastic";
Expand Down Expand Up @@ -441,7 +441,8 @@ void testGetAnnotationsForCreator() throws IOException {
expected.add(givenAnnotationResponse(id, USER_ID_TOKEN));
}
givenAnnotations.add(givenAnnotationResponse(id, USER_ID_TOKEN));
givenAnnotations.add(givenAnnotationResponse(id + "1", "A different User"));
givenAnnotations.add(
givenAnnotationResponse(id + "1", "https://orcid.org/0000-1112-5669-2769"));
}
postAnnotations(parseAnnotationToElasticFormat(givenAnnotations));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,6 @@ void testGetMasJobRecordById() throws Exception {
assertThat(result).isEqualTo(expected);
}

@Test
void testGetMasJobRecordNotFound() {
// Given
given(masJobRecordRepository.getMasJobRecordsByTargetId(ID,
JobState.SCHEDULED, 1, 2)).willReturn(Collections.emptyList());

// Then
assertThrows(NotFoundException.class,
() -> masJobRecordService.getMasJobRecordByTargetId(ID, JobState.SCHEDULED, MJR_URI,
1, 1));
}

@Test
void testGetMasJobRecordByIdEmpty() {
// Given
Expand Down

0 comments on commit b7d5228

Please sign in to comment.