Skip to content

Commit

Permalink
Modify configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengJie1053 committed Nov 25, 2023
1 parent 812f49b commit 86a499d
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<TokenEntity> result = tokenDao.getAllTokens();
// assertNotEquals(result.size(), 0);
// }
@Test
void testSelectTokenByName() {
TokenEntity result = tokenDao.selectTokenByName(TokenName);
assertEquals(result.getTokenName(), TokenName);
}

@Test
void testGetAllTokens() {
List<TokenEntity> result = tokenDao.getAllTokens();
assertNotEquals(result.size(), 0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 86a499d

Please sign in to comment.