Skip to content

Commit

Permalink
Fixed typo in the sechub-notification module. #1139
Browse files Browse the repository at this point in the history
  • Loading branch information
zigfridus committed Jan 1, 2024
1 parent f3779b0 commit 6b1c75a
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 69 deletions.
98 changes: 49 additions & 49 deletions sechub-api-java/src/main/resources/reduced-openapi3.json
Original file line number Diff line number Diff line change
Expand Up @@ -2938,6 +2938,55 @@
}
}
},
"ExecutionProfileFetch": {
"title": "ExecutionProfileFetch",
"type": "object",
"properties": {
"configurations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"productIdentifier": {
"type": "string",
"description": "executed product"
},
"name": {
"type": "string",
"description": "name of configuration"
},
"executorVersion": {
"type": "number",
"description": "executor version"
},
"uuid": {
"type": "string",
"description": "uuid of configuration"
},
"enabled": {
"type": "boolean",
"description": "enabled state of this config"
}
}
}
},
"description": {
"type": "string",
"description": "A short description for the profile"
},
"projectIds": {
"type": "array",
"description": "Projects can be linked by their ids here",
"items": {
"type": "string"
}
},
"enabled": {
"type": "boolean",
"description": "Enabled state of profile, default is false"
}
}
},
"FalsePositives": {
"title": "FalsePositives",
"type": "object",
Expand Down Expand Up @@ -3051,55 +3100,6 @@
}
}
},
"ExecutionProfileFetch": {
"title": "ExecutionProfileFetch",
"type": "object",
"properties": {
"configurations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"productIdentifier": {
"type": "string",
"description": "executed product"
},
"name": {
"type": "string",
"description": "name of configuration"
},
"executorVersion": {
"type": "number",
"description": "executor version"
},
"uuid": {
"type": "string",
"description": "uuid of configuration"
},
"enabled": {
"type": "boolean",
"description": "enabled state of this config"
}
}
}
},
"description": {
"type": "string",
"description": "A short description for the profile"
},
"projectIds": {
"type": "array",
"description": "Projects can be linked by their ids here",
"items": {
"type": "string"
}
},
"enabled": {
"type": "boolean",
"description": "Enabled state of profile, default is false"
}
}
},
"FullScanDataZIP": {
"title": "FullScanDataZIP",
"type": "object"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
@Component
public class NotificationConfiguration {

@MustBeDocumented(value = "Single mail adress used for emails to administrators. This should an NPM (non personalized mailbox)")
@MustBeDocumented(value = "Single mail address used for emails to administrators. This should an NPM (non personalized mailbox)")
@Value("${sechub.notification.email.administrators}")
private String emailAdministrators;

@MustBeDocumented(value = "Adress used for emails sent by sechub system")
@MustBeDocumented(value = "Address used for emails sent by sechub system")
@Value("${sechub.notification.email.from}")
private String emailFrom;

@MustBeDocumented(value = "Adress used for reply when email was sent by sechub system")
@MustBeDocumented(value = "Address used for reply when email was sent by sechub system")
@Value("${sechub.notification.email.replyto:}")
private String emailReplyTo;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ public class MockEmailRestController {

/* @formatter:off */
@RequestMapping(
path = APIConstants.API_ANONYMOUS+"integrationtest/mock/emails/to/{emailAdress}",
path = APIConstants.API_ANONYMOUS+"integrationtest/mock/emails/to/{emailAddress}",
method = RequestMethod.GET,
produces= {MediaType.APPLICATION_JSON_VALUE})
@ResponseStatus(HttpStatus.OK)
public List<SimpleMailMessage> getMailsFor(@PathVariable(name="emailAdress") String emailAdress) {
public List<SimpleMailMessage> getMailsFor(@PathVariable(name="emailAddress") String emailAddress) {
/* @formatter:on */
return mockMailService.getMailsFor(emailAdress);
return mockMailService.getMailsFor(emailAddress);
}

/* @formatter:off */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public class InformUsersThatProjectHasBeenDeletedNotificationService {
public void notify(ProjectMessage projectMessage, String baseUrl) {
requireNonNull(projectMessage);

Set<String> mailAdresses = projectMessage.getUserEmailAddresses();
if (mailAdresses == null || mailAdresses.isEmpty()) {
LOG.info("No users found for project {} so ignore sending info mail about delete", projectMessage.getProjectId());
Set<String> emailAddresses = projectMessage.getUserEmailAddresses();
if (emailAddresses == null || emailAddresses.isEmpty()) {
LOG.info("No users found for project {} so ignore sending info email about delete", projectMessage.getProjectId());
return;
}
SimpleMailMessage message = factory.createMessage("A SecHub project where you have been a user was deleted: " + projectMessage.getProjectId());
Expand All @@ -44,10 +44,10 @@ public void notify(ProjectMessage projectMessage, String baseUrl) {
emailContent.append("has been deleted.\n\n");
emailContent.append("This means that all report data has been deleted, and thus sechub scans for this project are no longer accessible.\n");

String[] userAdresses = projectMessage.getUserEmailAddresses().toArray(new String[mailAdresses.size()]);
String[] userAddresses = projectMessage.getUserEmailAddresses().toArray(new String[emailAddresses.size()]);

message.setBcc(userAdresses); // we do send per BCC so users do not get other email addresses. Maybe necessary
// because of data protection
message.setBcc(userAddresses); // we do send per BCC so users do not get other email addresses. Maybe necessary
// because of data protection
message.setText(emailContent.toString());

emailService.send(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ void beforeEach() {
@Test
void sends_emails_to_former_and_new_mail_address_containing_expected_content() {
/* prepare */
String emailAddress = "email.adress@example.org";
String formerEmailAddress = "former_email.adress@example.org";
String emailAddress = "email.address@example.org";
String formerEmailAddress = "former_email.address@example.org";

UserMessage userMessage = new UserMessage();
userMessage.setEmailAddress(emailAddress);
userMessage.setFormerEmailAddress(formerEmailAddress);
userMessage.setSubject("Your mail adress has changed by a test");
userMessage.setSubject("Your mail address has changed by a test");

SimpleMailMessage simpleMailmessageFormer = new SimpleMailMessage();
simpleMailmessageFormer.setSubject("<former>");
Expand All @@ -68,29 +68,29 @@ void sends_emails_to_former_and_new_mail_address_containing_expected_content() {
String receivedFormerText = mails.receivedFormer.getText();
String receivedNewText = mails.receivedNew.getText();

assertEquals("Your mail adress has changed by a test and it will not be used any longer for SecHub.\n"
assertEquals("Your mail address has changed by a test and it will not be used any longer for SecHub.\n"
+ "\n"
+ "In case you do not receive a follow up notification to the new email address, please inform your SecHub administrator!",
receivedFormerText);
assertEquals("Your mail adress has changed by a test from former_email.adress@example.org to email.adress@example.org. \n"
assertEquals("Your mail address has changed by a test from former_email.address@example.org to email.address@example.org. \n"
+ "Your old email address is not used in SecHub any longer.",
receivedNewText);
/* @formatter:on */

}

private Mails fetchSentMailsFromMockObjects(String emailAdress, String formerEmailAdress) {
private Mails fetchSentMailsFromMockObjects(String emailAddress, String formerEmailAddress) {
ArgumentCaptor<SimpleMailMessage> messageCaptor = ArgumentCaptor.forClass(SimpleMailMessage.class);
verify(emailService, times(2)).send(messageCaptor.capture());
List<SimpleMailMessage> messagesSent = messageCaptor.getAllValues();

assertEquals(2, messagesSent.size());
Mails data = new Mails();
for (SimpleMailMessage message : messagesSent) {
if (emailAdress.equals(message.getTo()[0])) {
if (emailAddress.equals(message.getTo()[0])) {
data.receivedNew = message;
}
if (formerEmailAdress.equals(message.getTo()[0])) {
if (formerEmailAddress.equals(message.getTo()[0])) {
data.receivedFormer = message;
}
}
Expand Down

0 comments on commit 6b1c75a

Please sign in to comment.