Skip to content

Commit

Permalink
updated for newer OpenAPI Generator versions
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-kuba committed May 15, 2023
1 parent daec0ca commit 822ab24
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
4 changes: 0 additions & 4 deletions chat-client-java-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@
</build>

<dependencies>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,9 @@ public ResponseEntity<ChatMessage> createMessage(NewChatMessageRequest r, String
String text = r.getText();
BackgroundColorEnum backgroundColor = r.getBackgroundColor();
TextColorEnum textColor = r.getTextColor();
ChatMessage chatMessage = new ChatMessage()
.id(UUID.randomUUID().toString())
.timestamp(OffsetDateTime.now())
ChatMessage chatMessage = new ChatMessage(UUID.randomUUID().toString(), OffsetDateTime.now(), text)
.author(author)
.text(text)
.textColor(textColor.getValue())
.textColor(textColor != null ? textColor.getValue() : null)
.backgroundColor(backgroundColor);
messages.add(0, chatMessage);
return new ResponseEntity<>(chatMessage, HttpStatus.CREATED);
Expand All @@ -70,16 +67,14 @@ public ResponseEntity<PageChatMessage> paged(Integer page, Integer size, List<St
SortObject s = new SortObject()
.sorted(p.getSort().isSorted())
.unsorted(p.getSort().isUnsorted())
.empty(p.getSort().isEmpty())
;
.empty(p.getSort().isEmpty());
PageableObject pageableObject = new PageableObject()
.paged(p.isPaged())
.unpaged(p.isUnpaged())
.pageNumber(p.getPageNumber())
.pageSize(p.getPageSize())
.sort(s)
.offset(p.getOffset())
;
.offset(p.getOffset());
PageChatMessage pageChatMessage = new PageChatMessage()
.content(chatMessages)
.pageable(pageableObject)
Expand All @@ -91,9 +86,8 @@ public ResponseEntity<PageChatMessage> paged(Integer page, Integer size, List<St
.number(m.getNumber())
.numberOfElements(m.getNumberOfElements())
.size(m.getSize())
.sort(s)
;
return new ResponseEntity<>(pageChatMessage, HttpStatus.OK);
.sort(s);
return new ResponseEntity<>(pageChatMessage, HttpStatus.OK);
}

private final List<ChatMessage> messages = new CopyOnWriteArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ void testMessageIds() throws Exception {
String text = "message " + i;
TextColorEnum textColor = TextColorEnum.BLACK;
BackgroundColorEnum backgroundColor = BackgroundColorEnum.WHITE;
NewChatMessageRequest n = new NewChatMessageRequest();
n.setText(text);
NewChatMessageRequest n = new NewChatMessageRequest(text);
n.setTextColor(textColor);
n.setBackgroundColor(backgroundColor);
String response = mockMvc.perform(post("/api/messages?author=" + author)
Expand Down

0 comments on commit 822ab24

Please sign in to comment.