Skip to content

Commit

Permalink
Remove TEST_DOC_UNIT status
Browse files Browse the repository at this point in the history
RISDEV-2565
  • Loading branch information
HPrinz committed Oct 13, 2023
1 parent df66408 commit f759638
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public Function<UUID, Mono<Boolean>> userHasWriteAccessByDocumentUnitUuid() {
private Mono<Boolean> userHasReadAccess(DocumentUnit documentUnit) {
List<PublicationStatus> published =
List.of(
PublicationStatus.TEST_DOC_UNIT,
PublicationStatus.PUBLISHED,
PublicationStatus.PUBLISHING,
PublicationStatus.JURIS_PUBLISHED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1364,10 +1364,7 @@ private static Predicate[] getPredicates(
if (searchInput.status().publicationStatus() == PublicationStatus.PUBLISHED) {
status =
root.get("publicationStatus")
.in(
PublicationStatus.PUBLISHED,
PublicationStatus.TEST_DOC_UNIT,
PublicationStatus.JURIS_PUBLISHED);
.in(PublicationStatus.PUBLISHED, PublicationStatus.JURIS_PUBLISHED);
}
if (searchInput.myDocOfficeOnly()
|| searchInput.status().publicationStatus() == PublicationStatus.UNPUBLISHED) {
Expand All @@ -1381,7 +1378,6 @@ private static Predicate[] getPredicates(
.in(
PublicationStatus.PUBLISHED,
PublicationStatus.PUBLISHING,
PublicationStatus.TEST_DOC_UNIT,
PublicationStatus.JURIS_PUBLISHED);
if (searchInput.myDocOfficeOnly()) {
restrictions.add(myDocOffice);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ public static DocumentationUnitSearchEntry transferDTO(
private static DocumentUnitStatus getPublicStatus(
PublicationStatus publicationStatus, Boolean withError) {
List<PublicationStatus> published =
List.of(
PublicationStatus.TEST_DOC_UNIT,
PublicationStatus.PUBLISHED,
PublicationStatus.JURIS_PUBLISHED);
List.of(PublicationStatus.PUBLISHED, PublicationStatus.JURIS_PUBLISHED);

DocumentUnitStatusBuilder builder = DocumentUnitStatus.builder();
if (publicationStatus != null && published.contains(publicationStatus)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ public enum PublicationStatus {
UNPUBLISHED,
PUBLISHED,
PUBLISHING,
TEST_DOC_UNIT,
JURIS_PUBLISHED,
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static de.bund.digitalservice.ris.caselaw.domain.PublicationStatus.JURIS_PUBLISHED;
import static de.bund.digitalservice.ris.caselaw.domain.PublicationStatus.PUBLISHED;
import static de.bund.digitalservice.ris.caselaw.domain.PublicationStatus.PUBLISHING;
import static de.bund.digitalservice.ris.caselaw.domain.PublicationStatus.TEST_DOC_UNIT;
import static de.bund.digitalservice.ris.caselaw.domain.PublicationStatus.UNPUBLISHED;
import static org.assertj.core.api.Assertions.assertThat;

Expand Down Expand Up @@ -111,7 +110,6 @@ static Stream<Arguments> getAuthorizedCases() {
return Stream.of(
Arguments.of("CC-RIS", "BGH", List.of(PUBLISHED)),
Arguments.of("CC-RIS", "BGH", List.of(PUBLISHING)),
Arguments.of("CC-RIS", "BGH", List.of(TEST_DOC_UNIT)),
Arguments.of("CC-RIS", "BGH", List.of(JURIS_PUBLISHED)),
Arguments.of("BGH", "BGH", List.of(UNPUBLISHED)),
Arguments.of("BGH", "BGH", List.of(PUBLISHED)),
Expand Down Expand Up @@ -303,8 +301,7 @@ private PublicationStatus getResultStatus(List<PublicationStatus> publicationSta
}

PublicationStatus lastStatus = publicationStatus.get(publicationStatus.size() - 1);
if (lastStatus == PublicationStatus.TEST_DOC_UNIT
|| lastStatus == PublicationStatus.JURIS_PUBLISHED) {
if (lastStatus == PublicationStatus.JURIS_PUBLISHED) {
return PUBLISHED;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import static de.bund.digitalservice.ris.caselaw.domain.PublicationStatus.JURIS_PUBLISHED;
import static de.bund.digitalservice.ris.caselaw.domain.PublicationStatus.PUBLISHED;
import static de.bund.digitalservice.ris.caselaw.domain.PublicationStatus.PUBLISHING;
import static de.bund.digitalservice.ris.caselaw.domain.PublicationStatus.TEST_DOC_UNIT;
import static de.bund.digitalservice.ris.caselaw.domain.PublicationStatus.UNPUBLISHED;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.argThat;
Expand Down Expand Up @@ -854,7 +853,7 @@ private void testCorrectFEtoBECallBehaviourWithLegalEffect(
@Test
void testSearchResultsAreDeterministic() {
PublicationStatus[] published =
new PublicationStatus[] {PUBLISHED, TEST_DOC_UNIT, PUBLISHING, JURIS_PUBLISHED};
new PublicationStatus[] {PUBLISHED, PUBLISHING, JURIS_PUBLISHED};
Random random = new Random();
Flux.range(0, 20)
.map(index -> UUID.randomUUID())
Expand All @@ -873,7 +872,7 @@ void testSearchResultsAreDeterministic() {
DocumentUnitStatusDTO.builder()
.newEntry(true)
.id(UUID.randomUUID())
.publicationStatus(published[random.nextInt(4)])
.publicationStatus(published[random.nextInt(3)])
.documentUnitId(documentUnitDTO.getUuid())
.build()))
.blockLast();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,6 @@ void testForCorrectResponseWhenRequestingAll() {
.dataSource(DataSource.MIGRATION)
.build())
.block();
DocumentUnitDTO oldNeurisDto =
repository
.save(
DocumentUnitDTO.builder()
.uuid(UUID.randomUUID())
.creationtimestamp(Instant.now())
.documentnumber("NEUR202300007")
.dataSource(DataSource.NEURIS)
.documentationOfficeId(docOfficeDTO.getId())
.build())
.block();
DocumentUnitDTO newNeurisDto =
repository
.save(
Expand All @@ -155,14 +144,6 @@ void testForCorrectResponseWhenRequestingAll() {
.isDeviating(false)
.build())
.block();
fileNumberRepository
.save(
FileNumberDTO.builder()
.documentUnitId(oldNeurisDto.getId())
.fileNumber("AkteX")
.isDeviating(false)
.build())
.block();
fileNumberRepository
.save(
FileNumberDTO.builder()
Expand All @@ -181,15 +162,6 @@ void testForCorrectResponseWhenRequestingAll() {
.publicationStatus(PublicationStatus.JURIS_PUBLISHED)
.build())
.block();
statusRepository
.save(
DocumentUnitStatusDTO.builder()
.id(UUID.randomUUID())
.newEntry(true)
.documentUnitId(oldNeurisDto.getUuid())
.publicationStatus(PublicationStatus.TEST_DOC_UNIT)
.build())
.block();
statusRepository
.save(
DocumentUnitStatusDTO.builder()
Expand All @@ -213,23 +185,17 @@ void testForCorrectResponseWhenRequestingAll() {
.jsonPath("$.content[0].documentNumber")
.isEqualTo("NEUR202300008")
.jsonPath("$.content[1].documentNumber")
.isEqualTo("NEUR202300007")
.jsonPath("$.content[2].documentNumber")
.isEqualTo("MIGR202200012")
.jsonPath("$.content[0].fileNumber")
.isEqualTo("AkteY")
.jsonPath("$.content[1].fileNumber")
.isEqualTo("AkteX")
.jsonPath("$.content[2].fileNumber")
.isEqualTo("AkteM")
.jsonPath("$.content[0].status.publicationStatus")
.isEqualTo("PUBLISHED")
.jsonPath("$.content[1].status.publicationStatus")
.isEqualTo("PUBLISHED")
.jsonPath("$.content[2].status.publicationStatus")
.isEqualTo("PUBLISHED")
.jsonPath("$.totalElements")
.isEqualTo(3);
.isEqualTo(2);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,17 +665,6 @@ void testSearchForDocumentUnitsByProceedingDecisionInput_shouldOnlyFindPublished
"EF",
"DigitalService",
DocumentUnitStatus.builder().publicationStatus(PublicationStatus.PUBLISHED).build());
var du3 =
createDocumentUnit(
"Court3",
"Berlin",
date,
List.of("AkteZ"),
"EF",
"DigitalService",
DocumentUnitStatus.builder()
.publicationStatus(PublicationStatus.TEST_DOC_UNIT)
.build());

var du4 =
createDocumentUnit(
Expand Down Expand Up @@ -710,13 +699,11 @@ void testSearchForDocumentUnitsByProceedingDecisionInput_shouldOnlyFindPublished

simulateAPICall(ProceedingDecision.builder().fileNumber("AkteZ").build())
.jsonPath("$.content.length()")
.isEqualTo(4)
.isEqualTo(3)
.jsonPath("$.content[?(@.uuid=='" + du1.getUuid() + "')]")
.isEmpty()
.jsonPath("$.content[?(@.uuid=='" + du2.getUuid() + "')]")
.isArray()
.jsonPath("$.content[?(@.uuid=='" + du3.getUuid() + "')]")
.isArray()
.jsonPath("$.content[?(@.uuid=='" + du4.getUuid() + "')]")
.isEmpty()
.jsonPath("$.content[?(@.uuid=='" + du5.getUuid() + "')]")
Expand Down

0 comments on commit f759638

Please sign in to comment.