-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EPMRPP-95844 get invitation by id #2133
Closed
Closed
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0b3dd6c
EPMRPP-95844 implement get invitations by id
grabsefx ca9725a
EPMRPP-95844 remove old invitation endpoint
grabsefx 3825b81
EPMRPP-95844 merge conflicts
grabsefx e3e6e67
EPMRPP-95844 update dependency
grabsefx 0f7f28c
EPMRPP-95844 update dependency
grabsefx 3cb1250
EPMRPP-95844 merge conflicts
grabsefx 61a5d87
EPMRPP-95844 merge conflicts
grabsefx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule reportportal-common-api
updated
11 files
+2 −2 | api/openapi/apis/_info.yaml | |
+161 −2 | api/openapi/apis/activities.yaml | |
+451 −6 | api/openapi/apis/organizations.yaml | |
+57 −2 | api/openapi/apis/projects.yaml | |
+676 −4 | api/openapi/apis/users.yaml | |
+2 −2 | api/openapi/enums/filterOperation.yaml | |
+1,562 −224 | api/openapi/reportportal-api.yaml | |
+16 −12 | docs/index.html | |
+0 −19 | docs/web/org.html | |
+0 −19 | docs/web/ref.html | |
+0 −35 | docs/web/styles.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/main/java/com/epam/ta/reportportal/ws/converter/converters/InvitationConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright 2024 EPAM Systems | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.epam.ta.reportportal.ws.converter.converters; | ||
|
||
import com.epam.reportportal.api.model.Invitation; | ||
import com.epam.reportportal.api.model.InvitationStatus; | ||
import com.epam.ta.reportportal.entity.user.UserCreationBid; | ||
import java.time.temporal.ChronoUnit; | ||
import java.util.UUID; | ||
import java.util.function.Function; | ||
|
||
public class InvitationConverter { | ||
|
||
private InvitationConverter() { | ||
} | ||
|
||
public static final Function<UserCreationBid, Invitation> TO_INVITATION = bid -> { | ||
var invitation = new Invitation(); | ||
|
||
invitation.setId(UUID.fromString(bid.getUuid())); | ||
invitation.setEmail(bid.getEmail()); | ||
invitation.setStatus(InvitationStatus.PENDING); | ||
invitation.setCreatedAt(bid.getLastModified()); | ||
invitation.setExpiresAt(bid.getLastModified().plus(1, ChronoUnit.DAYS)); | ||
invitation.setUserId(bid.getInvitingUser().getId()); | ||
invitation.setFullName(bid.getInvitingUser().getFullName()); | ||
|
||
return invitation; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ | |
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.springframework.http.MediaType.APPLICATION_JSON; | ||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; | ||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||
|
||
import com.epam.reportportal.api.model.Invitation; | ||
|
@@ -34,7 +36,6 @@ | |
import java.util.List; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; | ||
|
||
class InvitationControllerTest extends BaseMvcTest { | ||
|
||
|
@@ -65,11 +66,11 @@ void createInvitationByAdmin() throws Exception { | |
rq.setEmail("[email protected]"); | ||
rq.setOrganizations(organizations); | ||
|
||
var result = mockMvc.perform(MockMvcRequestBuilders.post(INVITATIONS_ENDPOINT) | ||
var result = mockMvc.perform(post(INVITATIONS_ENDPOINT) | ||
.content(objectMapper.writeValueAsBytes(rq)) | ||
.contentType(APPLICATION_JSON) | ||
.with(token(oAuthHelper.getSuperadminToken()))) | ||
.andExpect(status().isOk()) | ||
.andExpect(status().isCreated()) | ||
.andReturn() | ||
.getResponse().getContentAsString(); | ||
|
||
|
@@ -79,6 +80,17 @@ void createInvitationByAdmin() throws Exception { | |
|
||
assertEquals(InvitationStatus.PENDING, invitation.getStatus()); | ||
|
||
var storedInvitationString = mockMvc.perform(get(INVITATIONS_ENDPOINT + "/" + invitation.getId()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
.content(objectMapper.writeValueAsBytes(rq)) | ||
.contentType(APPLICATION_JSON) | ||
.with(token(oAuthHelper.getSuperadminToken()))) | ||
.andExpect(status().isOk()) | ||
.andReturn() | ||
.getResponse().getContentAsString(); | ||
var storedInvitation = objectMapper.readValue(storedInvitationString, Invitation.class); | ||
|
||
assertEquals(storedInvitation, invitation); | ||
|
||
} | ||
|
||
|
||
|
@@ -104,7 +116,7 @@ void createInvitationNotEnoughPermissions() throws Exception { | |
rq.setEmail("[email protected]"); | ||
rq.setOrganizations(organizations); | ||
|
||
mockMvc.perform(MockMvcRequestBuilders.post(INVITATIONS_ENDPOINT) | ||
mockMvc.perform(post(INVITATIONS_ENDPOINT) | ||
.content(objectMapper.writeValueAsBytes(rq)) | ||
.contentType(APPLICATION_JSON) | ||
.with(token(oAuthHelper.getDefaultToken()))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a Javadoc comment.