Skip to content
Snippets Groups Projects
Commit 47e60c05 authored by OZGCloud's avatar OZGCloud
Browse files

Merge remote-tracking branch 'origin/master' into...

Merge remote-tracking branch 'origin/master' into OZG-5012-AdjustBescheidServiceToNotUseNativeStateData
parents 07e5ab60 d569c362
Branches
Tags
No related merge requests found
Showing
with 24 additions and 20 deletions
......@@ -29,6 +29,7 @@ import de.ozgcloud.alfa.common.binaryfile.FileId;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
......@@ -36,10 +37,13 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@AllArgsConstructor(access = AccessLevel.PACKAGE)
@Getter
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
public class OzgFile {
@JsonIgnore
@EqualsAndHashCode.Include
private FileId id;
@EqualsAndHashCode.Include
private String name;
private long size;
......
......@@ -259,12 +259,12 @@ class PostfachMailServiceTest {
class TestCall {
private final Stream<PostfachMail> postfachMail = Stream.of(postfachNachricht);
private final Stream<OzgFile> ozgFile = Stream.of(OzgFileTestFactory.create());
private final Stream<OzgFile> ozgFiles = Stream.of(OzgFileTestFactory.create());
@BeforeEach
void mock() {
when(remoteService.findPostfachMails(anyString())).thenReturn(postfachMail);
when(fileService.getFiles(anyList())).thenReturn(ozgFile);
when(fileService.getFiles(anyList())).thenReturn(ozgFiles);
}
@Test
......
package de.ozgcloud.alfa.export;
import java.util.List;
import java.util.Set;
import de.ozgcloud.alfa.common.file.OzgFile;
import de.xoev.xdomea.AbgabeAbgabe0401;
......@@ -16,6 +16,6 @@ class ExportData {
private String exportFilename;
private AbgabeAbgabe0401 abgabe;
private List<OzgFile> exportFiles;
private Set<OzgFile> exportFiles;
}
......@@ -6,8 +6,9 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
......@@ -78,7 +79,7 @@ class ExportService {
postfachMailData.getAttachments().stream(),
bescheidData.getFiles().stream())
.flatMap(s -> s)
.toList();
.collect(Collectors.toSet());
return ExportData.builder().abgabe(abgabe).exportFilename(buildXmlFilename(filenameId)).exportFiles(exportFiles).build();
}
......@@ -114,7 +115,7 @@ class ExportService {
zipOutputStream.closeEntry();
}
private void putFilesIntoZip(List<OzgFile> ozgFiles, ZipOutputStream zipOutputStream) {
private void putFilesIntoZip(Set<OzgFile> ozgFiles, ZipOutputStream zipOutputStream) {
ozgFiles.forEach(ozgFile -> putOzgFileIntoZip(ozgFile, zipOutputStream));
}
......
......@@ -34,7 +34,7 @@ import de.xoev.xdomea.IdentifikationObjektType;
class DokumentTypeBuilderTest {
private final String fullName = UserProfileTestFactory.FULLNAME;
private final Bescheid bescheid = BescheidTestFactory.create();
private final OzgFile document = OzgFileTestFactory.create();
private final OzgFile document = OzgFileTestFactory.createWithUniqueId();
@Spy
private final DokumentTypeBuilder builder = DokumentTypeBuilder.builder()
......@@ -149,7 +149,7 @@ class DokumentTypeBuilderTest {
@Nested
class TestWithOneAnlage {
private final AnlageDokumentType anlageDokumentAttachment = AnlageDokumentTypeTestFactory.create();
private final OzgFile attachment = OzgFileTestFactory.create();
private final OzgFile attachment = OzgFileTestFactory.createWithUniqueId();
@Test
void shouldHaveOneAnlage() {
......@@ -250,7 +250,7 @@ class DokumentTypeBuilderTest {
@Mock
private AnlageDokumentTypeBuilder anlageDokumentTypeBuilder;
private final AnlageDokumentType expectedAnlage = AnlageDokumentTypeTestFactory.create();
private final OzgFile attachment = OzgFileTestFactory.create();
private final OzgFile attachment = OzgFileTestFactory.createWithUniqueId();
@BeforeEach
void setUp() {
......
......@@ -154,8 +154,8 @@ class ExportBescheidServiceTest {
class TestCreateBescheidExportInput {
private final VorgangWithEingang vorgang = VorgangWithEingangTestFactory.create();
private final Bescheid bescheid = BescheidTestFactory.create();
private final OzgFile document = OzgFileTestFactory.create();
private final OzgFile attachment = OzgFileTestFactory.create();
private final OzgFile document = OzgFileTestFactory.createWithUniqueId();
private final OzgFile attachment = OzgFileTestFactory.createWithUniqueId();
@BeforeEach
void setUpMocks() {
......@@ -243,7 +243,7 @@ class ExportBescheidServiceTest {
@Test
void shouldReturnGottenOzgFiles() {
var expectedOzgFile = OzgFileTestFactory.create();
var expectedOzgFile = OzgFileTestFactory.createWithUniqueId();
when(binaryFileService.getFiles(fileIds)).thenReturn(Stream.of(expectedOzgFile));
var resultOzgFiles = service.getAttachments(bescheid);
......@@ -255,7 +255,6 @@ class ExportBescheidServiceTest {
@Nested
class TestAddBescheidExportData {
private final List<OzgFile> files = BescheidExportInputTestFactory.FILES;
private final OzgFile document = OzgFileTestFactory.create();
private final DokumentType dokumentType = DokumentTypeTestFactory.create();
private final BescheidExportInput exportInput = BescheidExportInputTestFactory.create();
......
......@@ -16,7 +16,7 @@ import de.ozgcloud.alfa.common.file.OzgFileTestFactory;
class PrimaerdokumentTypeBuilderTest {
private final PrimaerdokumentTypeBuilder builder = PrimaerdokumentTypeBuilder.builder().withOzgFile(OzgFileTestFactory.create());
private final PrimaerdokumentTypeBuilder builder = PrimaerdokumentTypeBuilder.builder().withOzgFile(OzgFileTestFactory.createWithUniqueId());
@Nested
class TestBuild {
......@@ -26,7 +26,7 @@ class PrimaerdokumentTypeBuilderTest {
private static final String ERSTELLER = "Ersteller";
private static final String GENERATED_FILE_NAME = "file_name";
private static final ZonedDateTime CREATED_AT = ZonedDateTime.now();
private final OzgFile ozgFile = OzgFileTestFactory.create();
private final OzgFile ozgFile = OzgFileTestFactory.createWithUniqueId();
@BeforeEach
void setUp() {
......
package de.ozgcloud.alfa.export;
import java.util.List;
import java.util.Set;
import de.ozgcloud.alfa.common.file.OzgFile;
import de.ozgcloud.alfa.common.file.OzgFileTestFactory;
......@@ -20,6 +20,6 @@ class ExportDataTestFactory {
return ExportData.builder()
.exportFilename(EXPORT_FILENAME)
.abgabe(ABGABE)
.exportFiles(List.of(OZG_FILE));
.exportFiles(Set.of(OZG_FILE));
}
}
......@@ -136,8 +136,8 @@ class ExportServiceTest {
private final NkAbgabeType kopfType = NkAbgabeTypeTestFactory.create();
private final AbgabeAbgabe0401 abgabe = AbgabeAbgabe0401TestFactory.create();
private final AkteType akteType = AkteTypeTestFactory.create();
private final List<OzgFile> representations = List.of(OzgFileTestFactory.create());
private final List<OzgFile> attachments = List.of(OzgFileTestFactory.create());
private final List<OzgFile> representations = List.of(OzgFileTestFactory.createWithUniqueId());
private final List<OzgFile> attachments = List.of(OzgFileTestFactory.createWithUniqueId());
private final List<DokumentType> representationsDokumentTypes = List.of(DokumentTypeTestFactory.create());
private final List<DokumentType> attachmentsDokumentTypes = List.of(DokumentTypeTestFactory.create());
private final List<HistorienProtokollInformationType> historienProtokollInformationTypes = List.of(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment