|
@@ -1,103 +0,0 @@
|
|
|
-package com.fs.course.controller;
|
|
|
|
|
-
|
|
|
|
|
-import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
|
-import com.fs.FSApplication;
|
|
|
|
|
-import com.fs.common.annotation.DataSource;
|
|
|
|
|
-import com.fs.im.dto.OpenImMsgDTO;
|
|
|
|
|
-import com.fs.im.dto.OpenImResponseDTO;
|
|
|
|
|
-import com.fs.im.service.OpenIMService;
|
|
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
-import org.junit.Test;
|
|
|
|
|
-import org.junit.runner.RunWith;
|
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
-import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
|
|
|
|
-import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
-import org.springframework.boot.test.mock.mockito.MockBean;
|
|
|
|
|
-import org.springframework.data.redis.core.RedisTemplate;
|
|
|
|
|
-import org.springframework.test.context.ActiveProfiles;
|
|
|
|
|
-
|
|
|
|
|
-import static org.junit.Assert.assertNotNull;
|
|
|
|
|
-
|
|
|
|
|
-@Slf4j
|
|
|
|
|
-@ActiveProfiles("druid-fby-test")
|
|
|
|
|
-@RunWith(org.springframework.test.context.junit4.SpringRunner.class)
|
|
|
|
|
-@SpringBootTest(classes = FSApplication.class)
|
|
|
|
|
-public class OpenIMServiceTest {
|
|
|
|
|
-
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private OpenIMService openIMService;
|
|
|
|
|
- @Test
|
|
|
|
|
- public void openIMSendMsg() {
|
|
|
|
|
- OpenImMsgDTO openImMsgDTO = new OpenImMsgDTO();
|
|
|
|
|
- openImMsgDTO.setSendID("fbyC8584");
|
|
|
|
|
- openImMsgDTO.setRecvID("fbyU1077739");
|
|
|
|
|
-// openImMsgDTO.setGroupID("group789");
|
|
|
|
|
- openImMsgDTO.setSenderNickname("测试用户");
|
|
|
|
|
- openImMsgDTO.setSenderFaceURL("https://example.com/avatar.jpg");
|
|
|
|
|
- openImMsgDTO.setSenderPlatformID(1);
|
|
|
|
|
- openImMsgDTO.setContentType(101);
|
|
|
|
|
- openImMsgDTO.setSessionType(1);
|
|
|
|
|
- openImMsgDTO.setOnlineOnly(false);
|
|
|
|
|
- openImMsgDTO.setNotOfflinePush(false);
|
|
|
|
|
- openImMsgDTO.setSendTime(System.currentTimeMillis());
|
|
|
|
|
- openImMsgDTO.setEx("额外信息");
|
|
|
|
|
-
|
|
|
|
|
- // Content
|
|
|
|
|
- OpenImMsgDTO.Content content = new OpenImMsgDTO.Content();
|
|
|
|
|
- content.setContent("Hello World");
|
|
|
|
|
- content.setData("test data");
|
|
|
|
|
- content.setDescription("测试消息");
|
|
|
|
|
- content.setExtension("ext");
|
|
|
|
|
- openImMsgDTO.setContent(content);
|
|
|
|
|
-
|
|
|
|
|
- // OfflinePushInfo
|
|
|
|
|
- OpenImMsgDTO.OfflinePushInfo offlinePushInfo = new OpenImMsgDTO.OfflinePushInfo();
|
|
|
|
|
- offlinePushInfo.setTitle("新消息");
|
|
|
|
|
- offlinePushInfo.setDesc("您收到一条新消息");
|
|
|
|
|
- offlinePushInfo.setEx("push ex");
|
|
|
|
|
- offlinePushInfo.setIOSPushSound("default");
|
|
|
|
|
- offlinePushInfo.setIOSBadgeCount(true);
|
|
|
|
|
- openImMsgDTO.setOfflinePushInfo(offlinePushInfo);
|
|
|
|
|
-
|
|
|
|
|
- // 调用方法
|
|
|
|
|
- OpenImResponseDTO result = openIMService.openIMSendMsg(openImMsgDTO);
|
|
|
|
|
-
|
|
|
|
|
- // 断言
|
|
|
|
|
- assertNotNull(result);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Test
|
|
|
|
|
- public void aiAutoReply() {
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Test
|
|
|
|
|
- public void sendUtil() {
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Test
|
|
|
|
|
- public void sendUtilUserToDoctor() {
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Test
|
|
|
|
|
- public void editConversation() {
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Test
|
|
|
|
|
- public void sendCourse() throws JsonProcessingException {
|
|
|
|
|
- Long userId = 1077739L;
|
|
|
|
|
- Long companyUserId = 8584L;
|
|
|
|
|
- String url = "https://example.com/course/123";
|
|
|
|
|
- String title = "Java编程基础课程";
|
|
|
|
|
- String linkImageUrl = "https://example.com/images/course-cover.jpg";
|
|
|
|
|
- String cropId = "crop_123456";
|
|
|
|
|
-
|
|
|
|
|
- OpenImResponseDTO actualResponse = openIMService.sendCourse(
|
|
|
|
|
- userId, companyUserId, url, title, linkImageUrl, cropId
|
|
|
|
|
- );
|
|
|
|
|
- log.info("返回结果: {}",actualResponse);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Test
|
|
|
|
|
- public void sendPackageUtil() {
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|