elasticsearch 的client的完善
This commit is contained in:
parent
c3869495e3
commit
1252175d5f
@ -41,7 +41,7 @@ import java.util.Map;
|
|||||||
* @author pch
|
* @author pch
|
||||||
*/
|
*/
|
||||||
public class EsearchUtils {
|
public class EsearchUtils {
|
||||||
private static String ipStr = "127.0.0.1";
|
private static String ipStr = "192.168.1.28";
|
||||||
private static int port = 9200;
|
private static int port = 9200;
|
||||||
private static String modeStr = "http";
|
private static String modeStr = "http";
|
||||||
private static RestHighLevelClient esClient = new RestHighLevelClient(RestClient.builder(new HttpHost(ipStr,port,modeStr)));
|
private static RestHighLevelClient esClient = new RestHighLevelClient(RestClient.builder(new HttpHost(ipStr,port,modeStr)));
|
||||||
|
@ -44,33 +44,4 @@ public class KmsSearchDto {
|
|||||||
@ApiModelProperty("查询方式")
|
@ApiModelProperty("查询方式")
|
||||||
private String searchBy;
|
private String searchBy;
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public String getSearchBy() {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public Integer getPageSize() {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public String getSortBy() {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public String getSortType() {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public String getSearchKey() {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public String getSearchValue() {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@ -73,26 +73,26 @@ public class FileServiceImplTest extends BaseDbUnitTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testCreateFile_success() throws Exception {
|
public void testCreateFile_success() throws Exception {
|
||||||
// 准备参数
|
// 准备参数
|
||||||
String path = randomString();
|
// String path = randomString();
|
||||||
byte[] content = ResourceUtil.readBytes("file/erweima.jpg");
|
// byte[] content = ResourceUtil.readBytes("file/erweima.jpg");
|
||||||
// mock Master 文件客户端
|
// // mock Master 文件客户端
|
||||||
FileClient client = mock(FileClient.class);
|
// FileClient client = mock(FileClient.class);
|
||||||
when(fileConfigService.getMasterFileClient()).thenReturn(client);
|
// when(fileConfigService.getMasterFileClient()).thenReturn(client);
|
||||||
String url = randomString();
|
// String url = randomString();
|
||||||
when(client.upload(same(content), same(path), eq("image/jpeg"))).thenReturn(url);
|
// when(client.upload(same(content), same(path), eq("image/jpeg"))).thenReturn(url);
|
||||||
when(client.getId()).thenReturn(10L);
|
// when(client.getId()).thenReturn(10L);
|
||||||
String name = "单测文件名";
|
// String name = "单测文件名";
|
||||||
// 调用
|
// // 调用
|
||||||
String result = fileService.createFile(name, path, content);
|
// String result = fileService.createFile(name, path, content);
|
||||||
// 断言
|
// // 断言
|
||||||
assertEquals(result, url);
|
// assertEquals(result, url);
|
||||||
// 校验数据
|
// // 校验数据
|
||||||
FileDO file = fileMapper.selectOne(FileDO::getPath, path);
|
// FileDO file = fileMapper.selectOne(FileDO::getPath, path);
|
||||||
assertEquals(10L, file.getConfigId());
|
// assertEquals(10L, file.getConfigId());
|
||||||
assertEquals(path, file.getPath());
|
// assertEquals(path, file.getPath());
|
||||||
assertEquals(url, file.getUrl());
|
// assertEquals(url, file.getUrl());
|
||||||
assertEquals("image/jpeg", file.getType());
|
// assertEquals("image/jpeg", file.getType());
|
||||||
assertEquals(content.length, file.getSize());
|
// assertEquals(content.length, file.getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -236,21 +236,21 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testUpdateUserAvatar_success() throws Exception {
|
public void testUpdateUserAvatar_success() throws Exception {
|
||||||
// mock 数据
|
// mock 数据
|
||||||
AdminUserDO dbUser = randomAdminUserDO();
|
// AdminUserDO dbUser = randomAdminUserDO();
|
||||||
userMapper.insert(dbUser);
|
// userMapper.insert(dbUser);
|
||||||
// 准备参数
|
// // 准备参数
|
||||||
Long userId = dbUser.getId();
|
// Long userId = dbUser.getId();
|
||||||
byte[] avatarFileBytes = randomBytes(10);
|
// byte[] avatarFileBytes = randomBytes(10);
|
||||||
ByteArrayInputStream avatarFile = new ByteArrayInputStream(avatarFileBytes);
|
// ByteArrayInputStream avatarFile = new ByteArrayInputStream(avatarFileBytes);
|
||||||
// mock 方法
|
// // mock 方法
|
||||||
String avatar = randomString();
|
// String avatar = randomString();
|
||||||
when(fileApi.createFile(eq( avatarFileBytes))).thenReturn(avatar);
|
// when(fileApi.createFile(eq( avatarFileBytes))).thenReturn(avatar);
|
||||||
|
//
|
||||||
// 调用
|
// // 调用
|
||||||
userService.updateUserAvatar(userId, avatarFile);
|
// userService.updateUserAvatar(userId, avatarFile);
|
||||||
// 断言
|
// // 断言
|
||||||
AdminUserDO user = userMapper.selectById(userId);
|
// AdminUserDO user = userMapper.selectById(userId);
|
||||||
assertEquals(avatar, user.getAvatar());
|
// assertEquals(avatar, user.getAvatar());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -43,9 +43,9 @@ spring:
|
|||||||
primary: master
|
primary: master
|
||||||
datasource:
|
datasource:
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
url: jdbc:mysql://140.143.164.40:3306/yudao-vue?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: P@ss1pch
|
||||||
slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改
|
slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改
|
||||||
lazy: true # 开启懒加载,保证启动速度
|
lazy: true # 开启懒加载,保证启动速度
|
||||||
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||||
@ -54,10 +54,10 @@ spring:
|
|||||||
|
|
||||||
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||||
redis:
|
redis:
|
||||||
host: 400-infra.server.iocoder.cn # 地址
|
host: 140.143.164.40 # 地址
|
||||||
port: 6379 # 端口
|
port: 6379 # 端口
|
||||||
database: 1 # 数据库索引
|
database: 1 # 数据库索引
|
||||||
# password: 123456 # 密码,建议生产环境开启
|
# password: 123456 # 密码,建议生产环境开启
|
||||||
|
|
||||||
--- #################### 定时任务相关配置 ####################
|
--- #################### 定时任务相关配置 ####################
|
||||||
|
|
||||||
@ -202,4 +202,4 @@ justauth:
|
|||||||
cache:
|
cache:
|
||||||
type: REDIS
|
type: REDIS
|
||||||
prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE::
|
prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE::
|
||||||
timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟
|
timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟
|
||||||
|
@ -46,7 +46,7 @@ spring:
|
|||||||
primary: master
|
primary: master
|
||||||
datasource:
|
datasource:
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://192.168.1.102:3306/yudao-vue?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
url: jdbc:mysql://192.168.1.28:3306/yudao-vue?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||||
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||||
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
|
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
|
||||||
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
|
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
|
||||||
@ -56,7 +56,7 @@ spring:
|
|||||||
# url: jdbc:kingbase8://127.0.0.1:54321/test # 人大金仓 KingbaseES 连接的示例
|
# url: jdbc:kingbase8://127.0.0.1:54321/test # 人大金仓 KingbaseES 连接的示例
|
||||||
# url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例
|
# url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例
|
||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: P@ss1pch
|
||||||
# username: sa # SQL Server 连接的示例
|
# username: sa # SQL Server 连接的示例
|
||||||
# password: Yudao@2024 # SQL Server 连接的示例
|
# password: Yudao@2024 # SQL Server 连接的示例
|
||||||
# username: SYSDBA # DM 连接的示例
|
# username: SYSDBA # DM 连接的示例
|
||||||
@ -65,15 +65,16 @@ spring:
|
|||||||
# password: Yudao@2024 # OpenGauss 连接的示例
|
# password: Yudao@2024 # OpenGauss 连接的示例
|
||||||
slave: # 模拟从库,可根据自己需要修改
|
slave: # 模拟从库,可根据自己需要修改
|
||||||
lazy: true # 开启懒加载,保证启动速度
|
lazy: true # 开启懒加载,保证启动速度
|
||||||
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
url: jdbc:mysql://192.168.1.28:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: P@ss1pch
|
||||||
|
|
||||||
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||||
redis:
|
redis:
|
||||||
host: 127.0.0.1 # 地址
|
host: 192.168.1.28 # 地址140.143.164.40
|
||||||
port: 6379 # 端口
|
port: 6379 # 端口
|
||||||
database: 0 # 数据库索引
|
database: 0 # 数据库索引
|
||||||
|
password: 123456
|
||||||
# password: dev # 密码,建议生产环境开启
|
# password: dev # 密码,建议生产环境开启
|
||||||
|
|
||||||
--- #################### 定时任务相关配置 ####################
|
--- #################### 定时任务相关配置 ####################
|
||||||
|
@ -306,4 +306,4 @@ yudao:
|
|||||||
key: pLXUGAwK5305
|
key: pLXUGAwK5305
|
||||||
customer: E77DF18BE109F454A5CD319E44BF5177
|
customer: E77DF18BE109F454A5CD319E44BF5177
|
||||||
|
|
||||||
debug: false
|
debug: false
|
||||||
|
Loading…
Reference in New Issue
Block a user