From c4ca1ad03128600fa544c8b4c131b24440469bcc Mon Sep 17 00:00:00 2001 From: Valentyn Grygoriev Date: Fri, 22 Dec 2023 08:50:11 +0200 Subject: [PATCH] Fixed typo in the SignupJsonInput class and in the classes that depends on it. #1139 --- .../signup/AnonymousSignupCreateService.java | 20 +++++------ .../signup/SignupJsonInput.java | 12 +++---- .../signup/SignupJsonInputValidator.java | 4 +-- ...AnonymousSignupRestControllerMockTest.java | 4 +-- .../signup/SignupCreateServiceTest.java | 2 +- .../mercedesbenz/sechub/api/UserSignup.java | 6 ++-- .../model/InternalAccessUserSignup.java | 8 ++--- .../src/main/resources/reduced-openapi3.json | 36 +++++++++---------- ...nymousSignupRestControllerRestDocTest.java | 4 +-- .../sechub/integrationtest/api/AsUser.java | 2 +- 10 files changed, 49 insertions(+), 49 deletions(-) diff --git a/sechub-administration/src/main/java/com/mercedesbenz/sechub/domain/administration/signup/AnonymousSignupCreateService.java b/sechub-administration/src/main/java/com/mercedesbenz/sechub/domain/administration/signup/AnonymousSignupCreateService.java index 828f20f822..b6458ca161 100644 --- a/sechub-administration/src/main/java/com/mercedesbenz/sechub/domain/administration/signup/AnonymousSignupCreateService.java +++ b/sechub-administration/src/main/java/com/mercedesbenz/sechub/domain/administration/signup/AnonymousSignupCreateService.java @@ -54,7 +54,7 @@ public class AnonymousSignupCreateService { @UseCaseUserSignup(@Step(number = 2, name = "Persistence", description = "Valid self registration input will be persisted to database.")) public void register(@Valid SignupJsonInput userSelfRegistrationInput) { String userId = userSelfRegistrationInput.getUserId(); - String emailAddress = userSelfRegistrationInput.getEmailAdress(); + String emailAddress = userSelfRegistrationInput.getEmailAddress(); LOG.debug("user tries to register himself:{},mail:{}", userId, emailAddress); @@ -63,7 +63,7 @@ public void register(@Valid SignupJsonInput userSelfRegistrationInput) { assertNotAlreadySignedIn(userId, emailAddress); assertUsernameNotUsedAlready(userId, emailAddress); - assertEmailAdressNotUsedAlready(userId, emailAddress); + assertEmailAddressNotUsedAlready(userId, emailAddress); Signup entity = new Signup(); @@ -89,29 +89,29 @@ private void informAboutSignupRequest(Signup signup) { eventBusService.sendAsynchron(infoRequest); } - private void assertEmailAdressNotUsedAlready(String userId, String emailAdress) { - Optional foundUserByMail = userRepository.findByEmailAddress(emailAdress); + private void assertEmailAddressNotUsedAlready(String userId, String emailAddress) { + Optional foundUserByMail = userRepository.findByEmailAddress(emailAddress); if (foundUserByMail.isPresent()) { - LOG.warn("Self registration coming in for emailadress:{} and user:{} but an existing user does already have this email adress. So not accepted", - emailAdress, userId); + LOG.warn("Self registration coming in for email address:{} and user:{} but an existing user does already have this email address. So not accepted", + emailAddress, userId); handleRegistrationNotPossible(); } } - private void assertUsernameNotUsedAlready(String userId, String emailAdress) { + private void assertUsernameNotUsedAlready(String userId, String emailAddress) { Optional foundUser = userRepository.findById(userId); if (foundUser.isPresent()) { - LOG.warn("Self registration coming in for emailadress:{} and user:{} but existing user found by name. So not accepted", emailAdress, userId); + LOG.warn("Self registration coming in for email address:{} and user:{} but existing user found by name. So not accepted", emailAddress, userId); handleRegistrationNotPossible(); } } - private void assertNotAlreadySignedIn(String userId, String emailAdress) { + private void assertNotAlreadySignedIn(String userId, String emailAddress) { Optional found = userSelfRegistrationRepository.findById(userId); if (found.isPresent()) { - LOG.warn("Self registration coming in for emailadress:{} and user:{} but signup already exists. So not accepted", emailAdress, userId); + LOG.warn("Self registration coming in for email address:{} and user:{} but signup already exists. So not accepted", emailAddress, userId); handleRegistrationNotPossible(); } } diff --git a/sechub-administration/src/main/java/com/mercedesbenz/sechub/domain/administration/signup/SignupJsonInput.java b/sechub-administration/src/main/java/com/mercedesbenz/sechub/domain/administration/signup/SignupJsonInput.java index c840cd8668..632deabf26 100644 --- a/sechub-administration/src/main/java/com/mercedesbenz/sechub/domain/administration/signup/SignupJsonInput.java +++ b/sechub-administration/src/main/java/com/mercedesbenz/sechub/domain/administration/signup/SignupJsonInput.java @@ -11,11 +11,11 @@ public class SignupJsonInput implements JSONable { public static final String PROPERTY_API_VERSION = "apiVersion"; public static final String PROPERTY_USER_ID = "userId"; - public static final String PROPERTY_EMAIL_ADRESS = "emailAdress"; + public static final String PROPERTY_EMAIL_ADDRESS = "emailAddress"; private String apiVersion; private String userId; - private String emailAdress; + private String emailAddress; @Override public Class getJSONTargetClass() { @@ -38,12 +38,12 @@ public void setUserId(String userId) { this.userId = userId; } - public String getEmailAdress() { - return emailAdress; + public String getEmailAddress() { + return emailAddress; } - public void setEmailAdress(String emailAdress) { - this.emailAdress = emailAdress; + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; } } diff --git a/sechub-administration/src/main/java/com/mercedesbenz/sechub/domain/administration/signup/SignupJsonInputValidator.java b/sechub-administration/src/main/java/com/mercedesbenz/sechub/domain/administration/signup/SignupJsonInputValidator.java index 7d73dd9201..54399062c5 100644 --- a/sechub-administration/src/main/java/com/mercedesbenz/sechub/domain/administration/signup/SignupJsonInputValidator.java +++ b/sechub-administration/src/main/java/com/mercedesbenz/sechub/domain/administration/signup/SignupJsonInputValidator.java @@ -62,9 +62,9 @@ public void validate(Object target, Errors errors) { return; } - ValidationResult emailValidationResult = emailValidation.validate(selfRegistration.getEmailAdress()); + ValidationResult emailValidationResult = emailValidation.validate(selfRegistration.getEmailAddress()); if (!emailValidationResult.isValid()) { - errors.rejectValue(PROPERTY_EMAIL_ADRESS, "api.error.email.invalid", "Invalid email adress"); + errors.rejectValue(PROPERTY_EMAIL_ADDRESS, "api.error.email.invalid", "Invalid email address"); return; } LOG.debug("Selfregistration of {} was accepted", selfRegistration.getUserId()); diff --git a/sechub-administration/src/test/java/com/mercedesbenz/sechub/domain/administration/signup/AnonymousSignupRestControllerMockTest.java b/sechub-administration/src/test/java/com/mercedesbenz/sechub/domain/administration/signup/AnonymousSignupRestControllerMockTest.java index bf591fc69e..22644552b1 100644 --- a/sechub-administration/src/test/java/com/mercedesbenz/sechub/domain/administration/signup/AnonymousSignupRestControllerMockTest.java +++ b/sechub-administration/src/test/java/com/mercedesbenz/sechub/domain/administration/signup/AnonymousSignupRestControllerMockTest.java @@ -65,7 +65,7 @@ public void calling_with_api_1_0_and_valid_userid_and_email_calls_signup_create_ this.mockMvc.perform( post(https(PORT_USED).buildUserSignUpUrl()). contentType(MediaType.APPLICATION_JSON_VALUE). - content("{\"apiVersion\":\"1.0\",\"userId\":\"valid_userid\",\"emailAdress\":\"valid_mailadress@test.com\"}") + content("{\"apiVersion\":\"1.0\",\"userId\":\"valid_userid\",\"emailAddress\":\"valid_mailaddress@test.com\"}") ). andExpect(status().isOk() ); @@ -163,7 +163,7 @@ private SignupJsonInput createUserSelfRegistration(String api, String email, Str SignupJsonInput created = new SignupJsonInput(); created.setApiVersion(api); - created.setEmailAdress(email); + created.setEmailAddress(email); created.setUserId(name); return created; } diff --git a/sechub-administration/src/test/java/com/mercedesbenz/sechub/domain/administration/signup/SignupCreateServiceTest.java b/sechub-administration/src/test/java/com/mercedesbenz/sechub/domain/administration/signup/SignupCreateServiceTest.java index 29561ec78e..abc1f6a91b 100644 --- a/sechub-administration/src/test/java/com/mercedesbenz/sechub/domain/administration/signup/SignupCreateServiceTest.java +++ b/sechub-administration/src/test/java/com/mercedesbenz/sechub/domain/administration/signup/SignupCreateServiceTest.java @@ -37,7 +37,7 @@ public void a_created_signup_sends_event_containing_userid_and_email() { /* prepare */ SignupJsonInput userSelfRegistrationInput = mock(SignupJsonInput.class); when(userSelfRegistrationInput.getUserId()).thenReturn("schlaubi"); - when(userSelfRegistrationInput.getEmailAdress()).thenReturn("schlaubi@schlumpfhausen.de"); + when(userSelfRegistrationInput.getEmailAddress()).thenReturn("schlaubi@schlumpfhausen.de"); /* execute */ serviceToTest.register(userSelfRegistrationInput); diff --git a/sechub-api-java/src/main/java/com/mercedesbenz/sechub/api/UserSignup.java b/sechub-api-java/src/main/java/com/mercedesbenz/sechub/api/UserSignup.java index e835e38bee..971b03dced 100644 --- a/sechub-api-java/src/main/java/com/mercedesbenz/sechub/api/UserSignup.java +++ b/sechub-api-java/src/main/java/com/mercedesbenz/sechub/api/UserSignup.java @@ -55,7 +55,7 @@ public String getApiVersion() { } public String getEmailAdress() { - return internalAccess.getEmailAdress(); + return internalAccess.getEmailAddress(); } public String getUserId() { @@ -66,8 +66,8 @@ public void setApiVersion(String apiVersion) { internalAccess.setApiVersion(apiVersion); } - public void setEmailAdress(String emailAdress) { - internalAccess.setEmailAdress(emailAdress); + public void setEmailAdress(String emailAddress) { + internalAccess.setEmailAddress(emailAddress); } public void setUserId(String userId) { diff --git a/sechub-api-java/src/main/java/com/mercedesbenz/sechub/api/internal/model/InternalAccessUserSignup.java b/sechub-api-java/src/main/java/com/mercedesbenz/sechub/api/internal/model/InternalAccessUserSignup.java index 9daf521f73..2064cc2ff6 100644 --- a/sechub-api-java/src/main/java/com/mercedesbenz/sechub/api/internal/model/InternalAccessUserSignup.java +++ b/sechub-api-java/src/main/java/com/mercedesbenz/sechub/api/internal/model/InternalAccessUserSignup.java @@ -35,8 +35,8 @@ public String getApiVersion() { return delegate.getApiVersion(); } - public String getEmailAdress() { - return delegate.getEmailAdress(); + public String getEmailAddress() { + return delegate.getEmailAddress(); } public String getUserId() { @@ -47,8 +47,8 @@ public void setApiVersion(String apiVersion) { delegate.setApiVersion(apiVersion); } - public void setEmailAdress(String emailAdress) { - delegate.setEmailAdress(emailAdress); + public void setEmailAddress(String emailAddress) { + delegate.setEmailAddress(emailAddress); } public void setUserId(String userId) { diff --git a/sechub-api-java/src/main/resources/reduced-openapi3.json b/sechub-api-java/src/main/resources/reduced-openapi3.json index 7bbc78b6c3..05bff0085f 100644 --- a/sechub-api-java/src/main/resources/reduced-openapi3.json +++ b/sechub-api-java/src/main/resources/reduced-openapi3.json @@ -2524,24 +2524,6 @@ "description": "List of user signups" } }, - "UserSignup": { - "title": "UserSignup", - "type": "object", - "properties": { - "apiVersion": { - "type": "string", - "description": "The api version, currently only 1.0 is supported" - }, - "emailAdress": { - "type": "string", - "description": "Email adress" - }, - "userId": { - "type": "string", - "description": "Wanted userid, the userid must be lowercase only!" - } - } - }, "Project": { "title": "Project", "type": "object", @@ -2590,6 +2572,24 @@ "title": "ExecutorConfigurationId", "type": "object" }, + "UserSignup": { + "title": "UserSignup", + "type": "object", + "properties": { + "emailAddress": { + "type": "string", + "description": "Email address" + }, + "apiVersion": { + "type": "string", + "description": "The api version, currently only 1.0 is supported" + }, + "userId": { + "type": "string", + "description": "Wanted userid, the userid must be lowercase only!" + } + } + }, "ProjectJobList": { "title": "ProjectJobList", "type": "object", diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousSignupRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousSignupRestControllerRestDocTest.java index 03dba165fc..7d4b7ea5a5 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousSignupRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousSignupRestControllerRestDocTest.java @@ -69,7 +69,7 @@ public void calling_with_api_1_0_and_valid_userid_and_email_returns_HTTP_200() t this.mockMvc.perform( post(apiEndpoint). contentType(MediaType.APPLICATION_JSON_VALUE). - content("{\"apiVersion\":\"1.0\",\"userId\":\"valid_userid\",\"emailAdress\":\"valid_mailadress@test.com\"}") + content("{\"apiVersion\":\"1.0\",\"userId\":\"valid_userid\",\"emailAddress\":\"valid_mailaddress@test.com\"}") )./*andDo(print()).*/ andExpect(status().isOk()). andDo(defineRestService(). @@ -84,7 +84,7 @@ public void calling_with_api_1_0_and_valid_userid_and_email_returns_HTTP_200() t requestFields( fieldWithPath("apiVersion").description("The api version, currently only 1.0 is supported"), fieldWithPath("userId").description("Wanted userid, the userid must be lowercase only!"), - fieldWithPath("emailAdress").description("Email adress") + fieldWithPath("emailAddress").description("Email address") ) ) diff --git a/sechub-integrationtest/src/main/java/com/mercedesbenz/sechub/integrationtest/api/AsUser.java b/sechub-integrationtest/src/main/java/com/mercedesbenz/sechub/integrationtest/api/AsUser.java index 62b5a88fb5..fd2ec72d3d 100644 --- a/sechub-integrationtest/src/main/java/com/mercedesbenz/sechub/integrationtest/api/AsUser.java +++ b/sechub-integrationtest/src/main/java/com/mercedesbenz/sechub/integrationtest/api/AsUser.java @@ -167,7 +167,7 @@ private TestRestHelper getRestHelper() { */ public AsUser signUpAs(TestUser user) { - String json = "{\"apiVersion\":\"1.0\",\r\n" + " \"userId\":\"" + user.getUserId() + "\",\r\n" + " \"emailAdress\":\"" + user.getEmail() + String json = "{\"apiVersion\":\"1.0\",\r\n" + " \"userId\":\"" + user.getUserId() + "\",\r\n" + " \"emailAddress\":\"" + user.getEmail() + "\"}"; getRestHelper().postJson(getUrlBuilder().buildUserSignUpUrl(), json); return this;