aboutsummaryrefslogtreecommitdiff
path: root/juick-server-jdbc/src/test/java/com/juick/service/MockImagesService.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-03-15 23:24:13 +0300
committerGravatar Vitaly Takmazov2018-03-15 23:24:13 +0300
commitef9bb70fa1fe3744e971837eb78c6c004cd1e989 (patch)
treecee55dfcdcf9daf29c4835b200e1277a5d90b101 /juick-server-jdbc/src/test/java/com/juick/service/MockImagesService.java
parent55ec9f370d76a76aa33e290a093995d576e70bdb (diff)
boot: simplify test configuration
Diffstat (limited to 'juick-server-jdbc/src/test/java/com/juick/service/MockImagesService.java')
-rw-r--r--juick-server-jdbc/src/test/java/com/juick/service/MockImagesService.java59
1 files changed, 0 insertions, 59 deletions
diff --git a/juick-server-jdbc/src/test/java/com/juick/service/MockImagesService.java b/juick-server-jdbc/src/test/java/com/juick/service/MockImagesService.java
deleted file mode 100644
index 33cc1243..00000000
--- a/juick-server-jdbc/src/test/java/com/juick/service/MockImagesService.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.juick.service;
-
-import com.juick.Attachment;
-import com.juick.Message;
-import com.juick.Photo;
-import org.springframework.util.StringUtils;
-
-public class MockImagesService implements ImagesService {
- @Override
- public void setAttachmentMetadata(String imgDir, String baseUrl, Message msg) throws Exception {
- if (!StringUtils.isEmpty(msg.getAttachmentType())) {
- Photo photo = new Photo();
- if (msg.getRid()> 0) {
- photo.setSmall(String.format("%sphotos-512/%d-%d.%s", baseUrl, msg.getMid(), msg.getRid(), msg.getAttachmentType()));
- photo.setMedium(String.format("%sphotos-1024/%d-%d.%s", baseUrl, msg.getMid(), msg.getRid(), msg.getAttachmentType()));
- photo.setThumbnail(String.format("%sps/%d-%d.%s", baseUrl, msg.getMid(), msg.getRid(), msg.getAttachmentType()));
- } else {
- photo.setSmall(String.format("%sphotos-512/%d.%s", baseUrl, msg.getMid(), msg.getAttachmentType()));
- photo.setMedium(String.format("%sphotos-1024/%d.%s", baseUrl, msg.getMid(), msg.getAttachmentType()));
- photo.setThumbnail(String.format("%sps/%d.%s", baseUrl, msg.getMid(), msg.getAttachmentType()));
- }
- msg.setPhoto(photo);
- StringBuilder builder = new StringBuilder();
- builder.append(baseUrl);
- builder.append(msg.getAttachmentType().equals("mp4") ? "video" : "p");
- builder.append("/").append(msg.getMid());
- if (msg.getRid() > 0) {
- builder.append("-").append(msg.getRid());
- }
- builder.append(".").append(msg.getAttachmentType());
- String originalUrl = builder.toString();
-
- Attachment original = new Attachment();
- original.setUrl(originalUrl);
- original.setHeight(2048);
- original.setWidth(2048);
-
- Attachment medium = new Attachment();
- medium.setUrl(photo.getMedium());
- medium.setWidth(1024);
- medium.setHeight(1024);
- original.setMedium(medium);
-
- Attachment small = new Attachment();
- small.setUrl(photo.getSmall());
- small.setWidth(1024);
- small.setHeight(1024);
- original.setSmall(small);
-
- Attachment thumb = new Attachment();
- thumb.setUrl(photo.getMedium());
- thumb.setWidth(1024);
- thumb.setHeight(1024);
- original.setThumbnail(thumb);
-
- msg.setAttachment(original);
- }
- }
-}