diff --git a/linkis-dist/helm/charts/linkis/templates/configmap-linkis-config.yaml b/linkis-dist/helm/charts/linkis/templates/configmap-linkis-config.yaml index 1da739e51f..912886222b 100644 --- a/linkis-dist/helm/charts/linkis/templates/configmap-linkis-config.yaml +++ b/linkis-dist/helm/charts/linkis/templates/configmap-linkis-config.yaml @@ -94,6 +94,12 @@ data: include: refresh,info logging: config: classpath:log4j2.xml + springfox: + documentation: + enabled: false + auto-startup: false + swagger-ui: + enabled: false pagehelper: helper-dialect: mysql @@ -139,6 +145,12 @@ data: prefer-file-system-access: false server: port: {{ .Values.mgEureka.port }} + springfox: + documentation: + enabled: false + auto-startup: false + swagger-ui: + enabled: false eureka: instance: preferIpAddress: true @@ -186,6 +198,12 @@ data: defaultZone: {{- include "linkis.registration.url" . | quote | indent 1 }} registry-fetch-interval-seconds: 8 initial-instance-info-replication-interval-seconds: 10 + springfox: + documentation: + enabled: false + auto-startup: false + swagger-ui: + enabled: false management: endpoints: web: diff --git a/linkis-public-enhancements/linkis-instance-label/linkis-instance-label-server/src/test/resources/application.properties b/linkis-public-enhancements/linkis-instance-label/linkis-instance-label-server/src/test/resources/application.properties index b8b65f39b6..86a03a279d 100644 --- a/linkis-public-enhancements/linkis-instance-label/linkis-instance-label-server/src/test/resources/application.properties +++ b/linkis-public-enhancements/linkis-instance-label/linkis-instance-label-server/src/test/resources/application.properties @@ -22,7 +22,10 @@ spring.datasource.url=jdbc:h2:mem:test;MODE=MySQL;DB_CLOSE_DELAY=-1;DATABASE_TO_ #spring.datasource.url=jdbc:h2:mem:testPgDb;MODE=PostgreSQL;IGNORECASE=TRUE;DATABASE_TO_LOWER=TRUE; spring.datasource.username=sa spring.datasource.password= -spring.datasource.schema=classpath:create.sql +spring.sql.init.schema-locations=classpath:create.sql +springfox.documentation.enabled=false +springfox.documentation.auto-startup=false +springfox.documentation.swagger-ui.enabled=false #spring.datasource.schema=classpath:create_pg.sql mybatis-plus.mapper-locations=classpath*:mapper/common/*.xml,classpath*:mapper/mysql/*.xml diff --git a/linkis-public-enhancements/linkis-instance-label/linkis-instance-label-server/src/test/resources/application.yml b/linkis-public-enhancements/linkis-instance-label/linkis-instance-label-server/src/test/resources/application.yml deleted file mode 100644 index 89984b916c..0000000000 --- a/linkis-public-enhancements/linkis-instance-label/linkis-instance-label-server/src/test/resources/application.yml +++ /dev/null @@ -1,21 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -springfox: - documentation: - enabled: false - auto-startup: false - swagger-ui: - enabled: false \ No newline at end of file diff --git a/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-authentication/src/test/java/org/apache/linkis/gateway/authentication/dao/TokenDaoTest.java b/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-authentication/src/test/java/org/apache/linkis/gateway/authentication/dao/TokenDaoTest.java index 86f8730a01..d9ccad7e3c 100644 --- a/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-authentication/src/test/java/org/apache/linkis/gateway/authentication/dao/TokenDaoTest.java +++ b/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-authentication/src/test/java/org/apache/linkis/gateway/authentication/dao/TokenDaoTest.java @@ -18,12 +18,19 @@ package org.apache.linkis.gateway.authentication.dao; import org.apache.linkis.common.conf.CommonVars; +import org.apache.linkis.gateway.authentication.entity.TokenEntity; import org.springframework.beans.factory.annotation.Autowired; +import java.util.List; + +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; + class TokenDaoTest extends BaseDaoTest { private static final Logger logger = LoggerFactory.getLogger(BaseDaoTest.class); @@ -33,15 +40,15 @@ class TokenDaoTest extends BaseDaoTest { @Autowired TokenDao tokenDao; - // @Test - // void testSelectTokenByName() { - // TokenEntity result = tokenDao.selectTokenByName(TokenName); - // assertEquals(result.getTokenName(), TokenName); - // } - // - // @Test - // void testGetAllTokens() { - // List result = tokenDao.getAllTokens(); - // assertNotEquals(result.size(), 0); - // } + @Test + void testSelectTokenByName() { + TokenEntity result = tokenDao.selectTokenByName(TokenName); + assertEquals(result.getTokenName(), TokenName); + } + + @Test + void testGetAllTokens() { + List result = tokenDao.getAllTokens(); + assertNotEquals(result.size(), 0); + } } diff --git a/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-authentication/src/test/java/org/apache/linkis/gateway/authentication/service/CachedTokenServiceTest.java b/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-authentication/src/test/java/org/apache/linkis/gateway/authentication/service/CachedTokenServiceTest.java index dc9fc9ae76..6f111352e9 100644 --- a/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-authentication/src/test/java/org/apache/linkis/gateway/authentication/service/CachedTokenServiceTest.java +++ b/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-authentication/src/test/java/org/apache/linkis/gateway/authentication/service/CachedTokenServiceTest.java @@ -20,11 +20,13 @@ import org.apache.linkis.common.conf.CommonVars; import org.apache.linkis.gateway.authentication.Scan; import org.apache.linkis.gateway.authentication.WebApplicationServer; +import org.apache.linkis.gateway.authentication.exception.TokenAuthException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,43 +43,41 @@ public class CachedTokenServiceTest { @Autowired CachedTokenService tokenService; - // @Test - // void testIsTokenValid() { - // boolean isOk = tokenService.isTokenValid(TokenName); - // assertTrue(isOk); - // } - // - // @Test - // void testIsTokenAcceptableWithUser() { - // boolean isOk = tokenService.isTokenAcceptableWithUser(TokenName, "test"); - // assertTrue(isOk); - // isOk = tokenService.isTokenAcceptableWithUser(TokenName, "test1"); - // assertFalse(isOk); - // } - // - // @Test - // void testIsTokenAcceptableWithHost() { - // boolean isOk = tokenService.isTokenAcceptableWithHost(TokenName, "127.0.0.1"); - // assertTrue(isOk); - // isOk = tokenService.isTokenAcceptableWithHost(TokenName, "10.10.10.10"); - // assertFalse(isOk); - // } - // - // @Test - // void testDoAuth() { - // boolean isOk = tokenService.doAuth(TokenName, "test", "127.0.0.1"); - // assertTrue(isOk); - // - // Exception exception = - // assertThrows( - // TokenAuthException.class, () -> tokenService.doAuth(TokenName, "test1", - // "127.0.0.1")); - // logger.info("assertThrows:{}", exception.getMessage()); - // - // exception = - // assertThrows( - // TokenAuthException.class, () -> tokenService.doAuth(TokenName, "test", - // "10.10.10.10")); - // logger.info("assertThrows:{}", exception.getMessage()); - // } + @Test + void testIsTokenValid() { + boolean isOk = tokenService.isTokenValid(TokenName); + assertTrue(isOk); + } + + @Test + void testIsTokenAcceptableWithUser() { + boolean isOk = tokenService.isTokenAcceptableWithUser(TokenName, "test"); + assertTrue(isOk); + isOk = tokenService.isTokenAcceptableWithUser(TokenName, "test1"); + assertFalse(isOk); + } + + @Test + void testIsTokenAcceptableWithHost() { + boolean isOk = tokenService.isTokenAcceptableWithHost(TokenName, "127.0.0.1"); + assertTrue(isOk); + isOk = tokenService.isTokenAcceptableWithHost(TokenName, "10.10.10.10"); + assertFalse(isOk); + } + + @Test + void testDoAuth() { + boolean isOk = tokenService.doAuth(TokenName, "test", "127.0.0.1"); + assertTrue(isOk); + + Exception exception = + assertThrows( + TokenAuthException.class, () -> tokenService.doAuth(TokenName, "test1", "127.0.0.1")); + logger.info("assertThrows:{}", exception.getMessage()); + + exception = + assertThrows( + TokenAuthException.class, () -> tokenService.doAuth(TokenName, "test", "10.10.10.10")); + logger.info("assertThrows:{}", exception.getMessage()); + } } diff --git a/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-authentication/src/test/resources/application.properties b/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-authentication/src/test/resources/application.properties index b012930d58..82b0cc6314 100644 --- a/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-authentication/src/test/resources/application.properties +++ b/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-authentication/src/test/resources/application.properties @@ -32,7 +32,10 @@ wds.linkis.login_encrypt.enable=false spring.datasource.driver-class-name=org.h2.Driver spring.datasource.url=jdbc:h2:mem:test;MODE=MySQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=true -spring.datasource.schema=classpath:create.sql +spring.sql.init.schema-locations=classpath:create.sql +springfox.documentation.enabled=false +springfox.documentation.auto-startup=false +springfox.documentation.swagger-ui.enabled=false #pgtest #spring.datasource.url=jdbc:h2:mem:testPgDb;MODE=PostgreSQL;IGNORECASE=TRUE;DATABASE_TO_LOWER=TRUE; #spring.datasource.schema=classpath:create_pg.sql