2022-04-28 11:24:51 +08:00
|
|
|
package io.renren;
|
|
|
|
|
2022-05-09 15:30:52 +08:00
|
|
|
import cn.hutool.core.lang.UUID;
|
2022-05-31 11:32:16 +08:00
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
2022-04-28 11:24:51 +08:00
|
|
|
import io.renren.common.redis.RedisUtils;
|
|
|
|
import io.renren.modules.processForm.service.ApiGatewayService;
|
2022-05-31 11:32:16 +08:00
|
|
|
import io.renren.modules.resource.dao.ResourceDao;
|
|
|
|
import io.renren.modules.resource.entity.ResourceEntity;
|
2022-04-28 11:24:51 +08:00
|
|
|
import io.renren.modules.sys.entity.SysUserEntity;
|
|
|
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
|
|
import org.junit.Test;
|
|
|
|
import org.junit.runner.RunWith;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
2022-05-31 11:32:16 +08:00
|
|
|
import java.util.List;
|
|
|
|
|
2022-04-28 11:24:51 +08:00
|
|
|
@RunWith(SpringRunner.class)
|
|
|
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
|
|
|
public class ApiGatewayServiceTest {
|
|
|
|
@Autowired
|
|
|
|
private ApiGatewayService apiGatewayService;
|
|
|
|
|
2022-05-31 11:32:16 +08:00
|
|
|
@Autowired
|
|
|
|
private ResourceDao resourceDao;
|
|
|
|
|
2022-04-28 11:24:51 +08:00
|
|
|
@Test
|
2022-05-09 15:30:52 +08:00
|
|
|
public void registerApi2Gateway() {
|
2022-05-31 11:32:16 +08:00
|
|
|
// String[] resourceIds = {"1522550194833530884","1522550194535735298","1522550194544123906"};
|
|
|
|
// for (String resourceId : resourceIds) {
|
|
|
|
// apiGatewayService.registerApi2Gateway(resourceId);
|
|
|
|
// }
|
|
|
|
|
|
|
|
LambdaQueryWrapper<ResourceEntity> select = new QueryWrapper<ResourceEntity>().lambda()
|
|
|
|
.select(ResourceEntity::getId)
|
|
|
|
.eq(ResourceEntity::getType, "组件服务")
|
|
|
|
.in(ResourceEntity::getApiMethodType, new String[]{"POST", "GET"})
|
|
|
|
.like(ResourceEntity::getApiUrl,"http%");
|
|
|
|
List<ResourceEntity> resourceEntities = resourceDao.selectList(select);
|
|
|
|
resourceEntities.forEach(item -> {
|
|
|
|
apiGatewayService.registerApi2Gateway(String.valueOf(item.getId()));
|
|
|
|
});
|
|
|
|
|
2022-05-09 15:30:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void registerCode2Group() {
|
|
|
|
String code = UUID.randomUUID().toString();
|
2022-05-11 16:26:06 +08:00
|
|
|
apiGatewayService.subscribeCode("1523913824099762177", code);
|
2022-04-28 11:24:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|