Skip to content

Commit

Permalink
MET-5637 Code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JoanaCMS committed Dec 1, 2023
1 parent d2af65e commit 2d50d2f
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ public ProgressInfoDto getReport(String datasetId) {
}

// get qty of records completely processed
long completedRecords = getCompletedRecords(stepStatistics);
final long completedRecords = getCompletedRecords(stepStatistics);

// search for dataset
DatasetEntity dataset = getDataset(datasetId);
final DatasetEntity dataset = getDataset(datasetId);

List<DatasetLogDto> datasetLogs = datasetLogService.getAllLogs(datasetId);
if (stepStatistics.isEmpty() || stepStatistics.stream().allMatch(step -> step.getStatus().equals(Status.FAIL))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
import eu.europeana.metis.sandbox.common.exception.XsltProcessingException;
import eu.europeana.metis.sandbox.common.locale.Country;
import eu.europeana.metis.sandbox.common.locale.Language;
import eu.europeana.metis.sandbox.dto.*;
import eu.europeana.metis.sandbox.dto.DatasetInfoDto;
import eu.europeana.metis.sandbox.dto.HarvestingParametricDto;
import eu.europeana.metis.sandbox.dto.FileHarvestingDto;
import eu.europeana.metis.sandbox.dto.HttpHarvestingDto;
import eu.europeana.metis.sandbox.dto.OAIPmhHarvestingDto;
import eu.europeana.metis.sandbox.entity.DatasetEntity;
import eu.europeana.metis.sandbox.entity.HarvestingParameterEntity;
import eu.europeana.metis.sandbox.entity.projection.DatasetIdView;
Expand Down Expand Up @@ -98,7 +102,6 @@ public DatasetInfoDto getDatasetInfo(String datasetId) {
DatasetEntity datasetEntity = datasetRepository.findById(Integer.valueOf(datasetId)).orElseThrow(() -> new InvalidDatasetException(datasetId));
return new DatasetInfoDto(datasetId, datasetEntity.getDatasetName(), datasetEntity.getCreatedDate(), datasetEntity.getLanguage(),
datasetEntity.getCountry(), getHarvestingParameterDto(datasetId), isXsltPresent(datasetId));

}

private boolean isInputStreamAvailable(InputStream stream) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import static eu.europeana.metis.sandbox.common.HarvestProtocol.*;
import static eu.europeana.metis.sandbox.common.HarvestProtocol.FILE;
import static eu.europeana.metis.sandbox.common.HarvestProtocol.HTTP;
import static eu.europeana.metis.sandbox.common.HarvestProtocol.OAI_PMH;
import static java.lang.String.format;
import static java.util.Objects.requireNonNull;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,6 @@ public void retrieveDatasetProgress_expectStatus_ok() throws IOException {
assertNotNull(getDatasetResponse.getBody());
JSONAssert.assertEquals(StringUtils.deleteWhitespace(datasetResponseBodyContent),
StringUtils.deleteWhitespace(getDatasetResponse.getBody()), true);


}

@Test
Expand All @@ -232,8 +230,6 @@ void retrieveDatasetInfo_expectStatus_ok() throws IOException {
assertTrue(getDatasetResponse.getBody().contains("\"creation-date\""));
JSONAssert.assertEquals(StringUtils.deleteWhitespace(datasetResponseBodyContent),
StringUtils.deleteWhitespace(removeCreationDate(getDatasetResponse.getBody())), true);


}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@
import eu.europeana.metis.sandbox.common.exception.InvalidDatasetException;
import eu.europeana.metis.sandbox.common.exception.NoRecordFoundException;
import eu.europeana.metis.sandbox.common.exception.ServiceException;
import eu.europeana.metis.sandbox.common.locale.Country;
import eu.europeana.metis.sandbox.common.locale.Language;
import eu.europeana.metis.sandbox.controller.ratelimit.RateLimitInterceptor;
import eu.europeana.metis.sandbox.domain.DatasetMetadata;
import eu.europeana.metis.sandbox.dto.*;
import eu.europeana.metis.sandbox.dto.DatasetInfoDto;
import eu.europeana.metis.sandbox.dto.FileHarvestingDto;
import eu.europeana.metis.sandbox.dto.HttpHarvestingDto;
import eu.europeana.metis.sandbox.dto.OAIPmhHarvestingDto;
import eu.europeana.metis.sandbox.dto.RecordTiersInfoDto;
import eu.europeana.metis.sandbox.dto.report.ErrorInfoDto;
import eu.europeana.metis.sandbox.dto.report.ProgressByStepDto;
import eu.europeana.metis.sandbox.dto.report.ProgressInfoDto;
Expand Down Expand Up @@ -502,7 +504,9 @@ void retrieveDatasetProgress_expectSuccess() throws Exception {
.andExpect(jsonPath("$.status",
is("COMPLETED")))
.andExpect(jsonPath("$.progress-by-step[1].errors[0].message",
is(message1)));
is(message1)))
.andExpect(jsonPath("$.progress-by-step[1].errors[1].message",
is(message2)));

verify(datasetLogService, never()).logException(any(), any());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@
import eu.europeana.metis.sandbox.entity.problempatterns.ExecutionPoint;
import eu.europeana.metis.sandbox.entity.problempatterns.RecordTitle;
import eu.europeana.metis.sandbox.entity.problempatterns.RecordTitleCompositeKey;
import eu.europeana.metis.sandbox.repository.problempatterns.*;
import eu.europeana.metis.sandbox.repository.problempatterns.RecordTitleRepository;
import eu.europeana.metis.sandbox.repository.problempatterns.ExecutionPointRepository;
import eu.europeana.metis.sandbox.repository.problempatterns.RecordProblemPatternRepository;
import eu.europeana.metis.sandbox.repository.problempatterns.RecordProblemPatternOccurrenceRepository;
import eu.europeana.metis.sandbox.repository.problempatterns.DatasetProblemPatternRepository;
import eu.europeana.metis.sandbox.test.utils.TestContainer;
import eu.europeana.metis.sandbox.test.utils.TestContainerFactoryIT;
import eu.europeana.metis.sandbox.test.utils.TestContainerType;
import eu.europeana.metis.schema.convert.RdfConversionUtils;
import eu.europeana.metis.schema.convert.SerializationException;
import eu.europeana.metis.schema.jibx.RDF;
import eu.europeana.patternanalysis.exception.PatternAnalysisException;
import eu.europeana.patternanalysis.view.*;
import eu.europeana.patternanalysis.view.ProblemPatternDescription;
import eu.europeana.patternanalysis.view.DatasetProblemPatternAnalysis;
import eu.europeana.patternanalysis.view.ProblemPattern;
import eu.europeana.patternanalysis.view.RecordAnalysis;
import eu.europeana.patternanalysis.view.ProblemOccurrence;
import org.apache.commons.io.IOUtils;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.AfterEach;
Expand Down Expand Up @@ -42,7 +50,11 @@
import java.util.Optional;

import static org.apache.commons.lang3.StringUtils.isNotBlank;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;

@ExtendWith(SpringExtension.class)
@EnableAutoConfiguration(exclude = EmbeddedMongoAutoConfiguration.class)
Expand Down

0 comments on commit 2d50d2f

Please sign in to comment.