From 27afac32a7b5ba3192e541ce9ec216e952c42d3a Mon Sep 17 00:00:00 2001 From: huangweixiong Date: Thu, 28 Apr 2022 11:24:51 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=83=BD=E5=8A=9B=E4=B8=8A=E6=9E=B6?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E3=80=91=E5=AE=A1=E6=89=B9=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E5=90=8E=E7=BD=91=E5=85=B3=E6=B3=A8=E5=86=8C=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E5=8F=AA=E6=9B=B4=E6=96=B0groupid=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ApiGatewayService.java | 6 ++--- .../src/main/resources/application-dev.yml | 8 +++++-- .../java/io/renren/ApiGatewayServiceTest.java | 24 +++++++++++++++++++ 3 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 renren-admin/src/test/java/io/renren/ApiGatewayServiceTest.java diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/service/ApiGatewayService.java b/renren-admin/src/main/java/io/renren/modules/processForm/service/ApiGatewayService.java index 38544dac..156012ee 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/service/ApiGatewayService.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/service/ApiGatewayService.java @@ -29,7 +29,7 @@ public class ApiGatewayService { @Autowired private RestTemplate restTemplate; - @Value("${hisense.gateway.url: http://devtest-security-app.hismarttv.com:8080}") + @Value("${hisense.gateway.url:http://devtest-security-app.hismarttv.com:8080}") private String gatewayUrl; /** @@ -68,7 +68,7 @@ public class ApiGatewayService { } //建路由(接口url) - String routeUrl = gatewayUrl + "/apisix/admin/routes"; + String routeUrl = gatewayUrl + "apiops/api/routers"; HashMap routeEntity = new HashMap(); routeEntity.put("name", "api:1:" + resourceEntity.getName()); routeEntity.put("group", id); @@ -83,7 +83,7 @@ public class ApiGatewayService { LambdaUpdateWrapper updateWrapper = new UpdateWrapper().lambda(); updateWrapper.eq(ResourceEntity::getId, resourceEntity.getId()); updateWrapper.set(ResourceEntity::getGroupId, id); - resourceDao.update(resourceEntity, updateWrapper); + resourceDao.update(null, updateWrapper); } } diff --git a/renren-admin/src/main/resources/application-dev.yml b/renren-admin/src/main/resources/application-dev.yml index a239fb37..823b087b 100644 --- a/renren-admin/src/main/resources/application-dev.yml +++ b/renren-admin/src/main/resources/application-dev.yml @@ -27,13 +27,13 @@ spring: initial-size: 10 max-active: 100 min-idle: 10 - max-wait: 6000 + max-wait: 10 pool-prepared-statements: true max-pool-prepared-statement-per-connection-size: 20 time-between-eviction-runs-millis: 60000 min-evictable-idle-time-millis: 300000 #Oracle需要打开注释 -# validation-query: SELECT 1 FROM DUAL + validation-query: SELECT 1 test-while-idle: true test-on-borrow: false test-on-return: false @@ -61,6 +61,10 @@ big_date: name: 青岛市大数据发展管理局 assignee_role_name: 部门审批人 +hisense: + gateway: + url: http://devtest-security-app.hismarttv.com:8080 + ##多数据源的配置,需要引用renren-dynamic-datasource #dynamic: diff --git a/renren-admin/src/test/java/io/renren/ApiGatewayServiceTest.java b/renren-admin/src/test/java/io/renren/ApiGatewayServiceTest.java new file mode 100644 index 00000000..71134cab --- /dev/null +++ b/renren-admin/src/test/java/io/renren/ApiGatewayServiceTest.java @@ -0,0 +1,24 @@ +package io.renren; + +import io.renren.common.redis.RedisUtils; +import io.renren.modules.processForm.service.ApiGatewayService; +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; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class ApiGatewayServiceTest { + @Autowired + private ApiGatewayService apiGatewayService; + + @Test + public void contextLoads() { + apiGatewayService.registerApi2Gateway("1519505145602723841"); + } + +} \ No newline at end of file