Skip to content
Snippets Groups Projects
Commit ef39e25e authored by Jan Zickermann's avatar Jan Zickermann
Browse files

OZG-4097 send-attachment: Chunk info mapping

parent 5f7e021f
Branches
Tags
1 merge request!15Ozg 4097 senden und empfangen von anhängen
...@@ -6,12 +6,12 @@ import de.ozgcloud.nachrichten.postfach.osiv2.model.FileChunkInfo; ...@@ -6,12 +6,12 @@ import de.ozgcloud.nachrichten.postfach.osiv2.model.FileChunkInfo;
public class FileChunkInfoTestFactory { public class FileChunkInfoTestFactory {
static final String FILE_UPLOAD_GUID = UUID.randomUUID().toString(); public static final String FILE_UPLOAD_GUID = UUID.randomUUID().toString();
static final String FILE_NAME = "test-file-name"; public static final String FILE_NAME = "test-file-name";
static final String CONTENT_TYPE = "test-content-type"; public static final String CONTENT_TYPE = "test-content-type";
static final Integer CHUNK_INDEX = 1; public static final Integer CHUNK_INDEX = 1;
static final Integer TOTAL_CHUNKS = 10; public static final Integer TOTAL_CHUNKS = 10;
static final Long TOTAL_FILE_SIZE = 1000L; public static final Long TOTAL_FILE_SIZE = 1000L;
public static FileChunkInfo create() { public static FileChunkInfo create() {
......
...@@ -22,12 +22,15 @@ import de.ozgcloud.apilib.file.OzgCloudFileTestFactory; ...@@ -22,12 +22,15 @@ import de.ozgcloud.apilib.file.OzgCloudFileTestFactory;
import de.ozgcloud.nachrichten.postfach.PostfachAddress; import de.ozgcloud.nachrichten.postfach.PostfachAddress;
import de.ozgcloud.nachrichten.postfach.PostfachAddressIdentifier; import de.ozgcloud.nachrichten.postfach.PostfachAddressIdentifier;
import de.ozgcloud.nachrichten.postfach.PostfachNachricht; import de.ozgcloud.nachrichten.postfach.PostfachNachricht;
import de.ozgcloud.nachrichten.postfach.osiv2.factory.FileChunkInfoTestFactory;
import de.ozgcloud.nachrichten.postfach.osiv2.factory.PostfachAddressTestFactory; import de.ozgcloud.nachrichten.postfach.osiv2.factory.PostfachAddressTestFactory;
import de.ozgcloud.nachrichten.postfach.osiv2.factory.PostfachNachrichtTestFactory; import de.ozgcloud.nachrichten.postfach.osiv2.factory.PostfachNachrichtTestFactory;
import de.ozgcloud.nachrichten.postfach.osiv2.gen.model.DomainChunkMetaData;
import de.ozgcloud.nachrichten.postfach.osiv2.gen.model.MessageExchangeFiles; import de.ozgcloud.nachrichten.postfach.osiv2.gen.model.MessageExchangeFiles;
import de.ozgcloud.nachrichten.postfach.osiv2.gen.model.OutSendMessageRequestV2; import de.ozgcloud.nachrichten.postfach.osiv2.gen.model.OutSendMessageRequestV2;
import de.ozgcloud.nachrichten.postfach.osiv2.gen.model.V1EidasLevel; import de.ozgcloud.nachrichten.postfach.osiv2.gen.model.V1EidasLevel;
import de.ozgcloud.nachrichten.postfach.osiv2.gen.model.V1ReplyBehavior; import de.ozgcloud.nachrichten.postfach.osiv2.gen.model.V1ReplyBehavior;
import de.ozgcloud.nachrichten.postfach.osiv2.model.FileChunkInfo;
class Osi2RequestMapperTest { class Osi2RequestMapperTest {
...@@ -257,4 +260,63 @@ class Osi2RequestMapperTest { ...@@ -257,4 +260,63 @@ class Osi2RequestMapperTest {
} }
} }
@DisplayName("map DomainChunkMetaData")
@Nested
class TestMapDomainChunkMetaData {
private final FileChunkInfo chunkInfo = FileChunkInfoTestFactory.create();
@DisplayName("should map upload guid")
@Test
void shouldMapUploadGuid() {
var result = doMapping();
assertThat(result.getUploadUid()).isEqualTo(UUID.fromString(FileChunkInfoTestFactory.FILE_UPLOAD_GUID));
}
@DisplayName("should map file name")
@Test
void shouldMapFileName() {
var result = doMapping();
assertThat(result.getFileName()).isEqualTo(FileChunkInfoTestFactory.FILE_NAME);
}
@DisplayName("should map content type")
@Test
void shouldMapContentType() {
var result = doMapping();
assertThat(result.getContentType()).isEqualTo(FileChunkInfoTestFactory.CONTENT_TYPE);
}
@DisplayName("should map chunk index")
@Test
void shouldMapChunkIndex() {
var result = doMapping();
assertThat(result.getChunkIndex()).isEqualTo(FileChunkInfoTestFactory.CHUNK_INDEX);
}
@DisplayName("should map total chunks")
@Test
void shouldMapTotalChunks() {
var result = doMapping();
assertThat(result.getTotalChunks()).isEqualTo(FileChunkInfoTestFactory.TOTAL_CHUNKS);
}
@DisplayName("should map total file size")
@Test
void shouldMapTotalFileSize() {
var result = doMapping();
assertThat(result.getTotalFileSize()).isEqualTo(FileChunkInfoTestFactory.TOTAL_FILE_SIZE);
}
private DomainChunkMetaData doMapping() {
return mapper.mapDomainChunkMetaData(chunkInfo);
}
}
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment