-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* - 이미지 리사이징로직 테스트 추가 * - 이미지 리사이징로직 테스트 추가 * github 환경변수 추가 * Update testAfterPR.yml testAfterPR 수정 * Update testAfterPR.yml testAfterPR 다시 수정 * - kakaoBookInfoFetcher 주석처리 * Update testAfterPR.yml testAfterPR 초기화
- Loading branch information
Showing
22 changed files
with
455 additions
and
128 deletions.
There are no files selected for viewing
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
23 changes: 23 additions & 0 deletions
23
...src/main/java/com/dongnebook/domain/model/image/infrastructure/DefaultImageIOService.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,23 @@ | ||
package com.dongnebook.domain.model.image.infrastructure; | ||
|
||
import java.awt.image.BufferedImage; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
import javax.imageio.ImageIO; | ||
|
||
import org.apache.tomcat.util.http.fileupload.ByteArrayOutputStream; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class DefaultImageIOService implements ImageIOService { | ||
@Override | ||
public BufferedImage read(InputStream inputStream) throws IOException { | ||
return ImageIO.read(inputStream); | ||
} | ||
|
||
@Override | ||
public void write(BufferedImage resizedImage, String jpg, ByteArrayOutputStream baos) throws IOException { | ||
ImageIO.write(resizedImage, jpg, baos); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
backend/src/main/java/com/dongnebook/domain/model/image/infrastructure/ImageIOService.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,13 @@ | ||
package com.dongnebook.domain.model.image.infrastructure; | ||
|
||
import java.awt.image.BufferedImage; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
import org.apache.tomcat.util.http.fileupload.ByteArrayOutputStream; | ||
|
||
public interface ImageIOService { | ||
BufferedImage read(InputStream inputStream) throws IOException; | ||
|
||
void write(BufferedImage resizedImage, String jpg, ByteArrayOutputStream baos) throws IOException; | ||
} |
22 changes: 22 additions & 0 deletions
22
...nd/src/main/java/com/dongnebook/domain/model/image/infrastructure/TestImageIOService.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,22 @@ | ||
package com.dongnebook.domain.model.image.infrastructure; | ||
|
||
import java.awt.image.BufferedImage; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
import org.apache.tomcat.util.http.fileupload.ByteArrayOutputStream; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
public class TestImageIOService implements ImageIOService{ | ||
@Override | ||
public BufferedImage read(InputStream inputStream) throws IOException { | ||
return new BufferedImage(200,200 ,BufferedImage.TYPE_INT_RGB ); | ||
} | ||
|
||
@Override | ||
public void write(BufferedImage resizedImage, String jpg, ByteArrayOutputStream baos) throws IOException { | ||
log.info("do Nothing"); | ||
} | ||
} |
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
28 changes: 0 additions & 28 deletions
28
backend/src/main/java/com/dongnebook/global/security/auth/oauth/OAuthAttributes.java
This file was deleted.
Oops, something went wrong.
53 changes: 0 additions & 53 deletions
53
backend/src/main/java/com/dongnebook/global/security/auth/oauth/OAuthService.java
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
backend/src/main/java/com/dongnebook/global/security/auth/oauth/OAuthUserProfile.java
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
backend/src/test/java/com/dongnebook/domain/chat/controller/RedisPublisherTest.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,45 @@ | ||
package com.dongnebook.domain.chat.controller; | ||
|
||
import static org.mockito.BDDMockito.*; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
import org.springframework.data.redis.core.RedisTemplate; | ||
import org.springframework.data.redis.listener.ChannelTopic; | ||
|
||
import com.dongnebook.domain.chat.domain.RedisChat; | ||
import com.dongnebook.domain.chat.ui.RedisPublisher; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
class RedisPublisherTest { | ||
@InjectMocks | ||
private RedisPublisher redisPublisher; | ||
|
||
@Mock | ||
private RedisTemplate<String, Object> redisTemplate; | ||
|
||
@Test | ||
@DisplayName("레디스로 채팅을 보낸다.") | ||
void publish(){ | ||
// Given | ||
Long roomId = 1L; | ||
Long senderId = 2L; | ||
String message = "hello"; | ||
LocalDateTime createdAt = LocalDateTime.now(); | ||
RedisChat redisChat = new RedisChat(roomId, senderId, message, createdAt); | ||
doNothing().when(redisTemplate).convertAndSend(anyString(), eq(redisChat)); | ||
ChannelTopic topic = ChannelTopic.of("room" + roomId); | ||
|
||
// When | ||
redisPublisher.publish(topic,redisChat); | ||
|
||
// Then | ||
verify(redisTemplate,times(1)).convertAndSend(String.valueOf(topic),redisChat); | ||
} | ||
} |
Oops, something went wrong.