Skip to content
Snippets Groups Projects
Commit 4066a597 authored by Martin Vogel's avatar Martin Vogel
Browse files

refactor: add bundId to reply channel validation, extend test (planning#2251)

parent 910bdc28
No related branches found
No related tags found
1 merge request!429planning#2223: DeutschlandID Reply Channel
......@@ -308,7 +308,7 @@ public class DefaultValidationService implements ValidationService {
for (AttachmentForValidation attachment : attachmentsForValidation) {
if (attachment.hasFragmentedPayload()) {
final ValidationResult validationResult = validateFragmentedAttachment(attachment, eventAuthTags, validationProblems);
if(validationResult.hasError()){
if (validationResult.hasError()) {
return validationResult;
}
} else {
......@@ -332,6 +332,7 @@ public class DefaultValidationService implements ValidationService {
validationProblems.add(new AttachmentHashMismatch(attachment.getAttachmentId()));
}
}
private ValidationResult validateFragmentedAttachment(AttachmentForValidation attachment, Map<UUID, String> eventAuthTags, List<Problem> validationProblems) {
for (final Fragment fragment : attachment.getFragments()) {
// https://docs.fitko.de/fit-connect/docs/receiving/verification/#authentication-tag-pr%C3%BCfen-2
......@@ -445,7 +446,8 @@ public class DefaultValidationService implements ValidationService {
replyChannel.getDeMail(),
replyChannel.getFink(),
replyChannel.getElster(),
replyChannel.getFitConnect())
replyChannel.getFitConnect(),
replyChannel.getIdBundDeMailbox())
.filter(Objects::nonNull)
// Getting the type is sufficient. We do not want an actual content comparison of objects ,
// since the destinations reply channel content will be null even if they are set.
......
......@@ -438,7 +438,7 @@ public class SenderClientIT extends IntegrationTestBase {
}
@Test
void testSendSubmissionWithApplicationDate() {
void testSendSubmissionWithAdditionalReferenceInfo() {
// Given
final ApplicationConfig config = getConfigWithCredentialsFromEnvironment(true);
......@@ -446,11 +446,14 @@ public class SenderClientIT extends IntegrationTestBase {
final String submissionData = readResourceToString("/submission_data.json");
final LocalDate applicationDate = LocalDate.of(2020, 1, 1);
final UUID idBundDeApplicationId = UUID.randomUUID();
final var submission = SendableSubmission.Builder()
.setDestination(UUID.fromString(System.getenv("TEST_DESTINATION_ID")))
.setServiceType("urn:de:fim:leika:leistung:99400048079000", "Test Service")
.setJsonData(submissionData, URI.create("https://schema.fitko.de/fim/s00000114_1.1.schema.json"))
.setApplicationDate(applicationDate)
.setIdBundDeApplicationId(idBundDeApplicationId)
.build();
final var sentSubmission = ClientFactory.createSenderClient(config).send(submission);
......@@ -466,6 +469,7 @@ public class SenderClientIT extends IntegrationTestBase {
assertNotNull(receivedSubmission);
assertTrue(receivedSubmission.getApplicationDate().isPresent());
assertThat(receivedSubmission.getApplicationDate().get(), is(applicationDate));
assertThat(receivedSubmission.getMetadata().getAdditionalReferenceInfo().getIdBundDeApplicationId(), is(idBundDeApplicationId));
}
@Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment