diff --git a/linkis-commons/linkis-storage/pom.xml b/linkis-commons/linkis-storage/pom.xml
index 72ce14950c..95282243fd 100644
--- a/linkis-commons/linkis-storage/pom.xml
+++ b/linkis-commons/linkis-storage/pom.xml
@@ -1,176 +1,176 @@
-
-
-
- 4.0.0
-
-
- org.apache.linkis
- linkis
- ${revision}
- ../../pom.xml
-
- linkis-storage
-
- jar
-
-
-
- org.apache.linkis
- linkis-common
- ${project.version}
-
-
-
- org.apache.linkis
- linkis-hadoop-common
- ${project.version}
-
-
- com.google.protobuf
- protobuf-java
-
-
- io.netty
- netty
-
-
-
-
-
- com.google.protobuf
- protobuf-java
- ${protobuf.version}
-
-
- org.springframework
- spring-core
-
-
-
- org.apache.poi
- poi
- ${poi.version}
-
-
-
- org.apache.poi
- poi-ooxml
- ${poi.version}
-
-
-
- com.github.pjfanning
- excel-streaming-reader
- 5.0.2
-
-
-
- org.apache.commons
- commons-compress
-
-
-
- org.apache.hadoop
- hadoop-aliyun
- 3.3.4
-
-
- com.aliyun.oss
- aliyun-sdk-oss
- 3.16.0
-
-
- org.jdom
- jdom2
-
-
-
- com.amazonaws
- aws-java-sdk-s3
- 1.12.261
-
-
-
- com.azure
- azure-storage-blob
-
-
- com.azure
- azure-storage-common
-
-
- com.azure
- azure-identity
-
-
- org.apache.parquet
- parquet-avro
- ${parquet-avro.version}
- ${storage.parquet.scope}
-
-
- org.apache.hadoop
- hadoop-mapreduce-client-core
- ${hadoop.version}
- ${storage.parquet.scope}
-
-
- log4j
- log4j
-
-
- org.slf4j
- slf4j-log4j12
-
-
-
- ch.qos.reload4j
- reload4j
-
-
- org.slf4j
- slf4j-reload4j
-
-
-
-
- org.apache.orc
- orc-core
- ${orc-core.version}
- nohive
- ${storage.orc.scope}
-
-
- org.apache.hive
- hive-storage-api
-
-
-
-
-
-
-
-
-
- net.alchim31.maven
- scala-maven-plugin
-
-
-
-
-
+
+
+
+ 4.0.0
+
+
+ org.apache.linkis
+ linkis
+ ${revision}
+ ../../pom.xml
+
+ linkis-storage
+
+ jar
+
+
+
+ org.apache.linkis
+ linkis-common
+ ${project.version}
+
+
+
+ org.apache.linkis
+ linkis-hadoop-common
+ ${project.version}
+
+
+ com.google.protobuf
+ protobuf-java
+
+
+ io.netty
+ netty
+
+
+
+
+
+ com.google.protobuf
+ protobuf-java
+ ${protobuf.version}
+
+
+ org.springframework
+ spring-core
+
+
+
+ org.apache.poi
+ poi
+ ${poi.version}
+
+
+
+ org.apache.poi
+ poi-ooxml
+ ${poi.version}
+
+
+
+ com.github.pjfanning
+ excel-streaming-reader
+ 5.0.2
+
+
+
+ org.apache.commons
+ commons-compress
+
+
+
+ org.apache.hadoop
+ hadoop-aliyun
+ 3.3.4
+
+
+ com.aliyun.oss
+ aliyun-sdk-oss
+ 3.16.0
+
+
+ org.jdom
+ jdom2
+
+
+
+ com.amazonaws
+ aws-java-sdk-s3
+ 1.12.261
+
+
+
+ com.azure
+ azure-storage-blob
+
+
+ com.azure
+ azure-storage-common
+
+
+ com.azure
+ azure-identity
+
+
+ org.apache.parquet
+ parquet-avro
+ ${parquet-avro.version}
+ ${storage.parquet.scope}
+
+
+ org.apache.hadoop
+ hadoop-mapreduce-client-core
+ ${hadoop.version}
+ ${storage.parquet.scope}
+
+
+ log4j
+ log4j
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+
+ ch.qos.reload4j
+ reload4j
+
+
+ org.slf4j
+ slf4j-reload4j
+
+
+
+
+ org.apache.orc
+ orc-core
+ ${orc-core.version}
+ nohive
+ ${storage.orc.scope}
+
+
+ org.apache.hive
+ hive-storage-api
+
+
+
+
+
+
+
+
+
+ net.alchim31.maven
+ scala-maven-plugin
+
+
+
+
+
diff --git a/linkis-commons/linkis-storage/src/test/scala/org/apache/linkis/storage/utils/StorageConfigurationTest.scala b/linkis-commons/linkis-storage/src/test/scala/org/apache/linkis/storage/utils/StorageConfigurationTest.scala
index e5adef9124..2d1cff509d 100644
--- a/linkis-commons/linkis-storage/src/test/scala/org/apache/linkis/storage/utils/StorageConfigurationTest.scala
+++ b/linkis-commons/linkis-storage/src/test/scala/org/apache/linkis/storage/utils/StorageConfigurationTest.scala
@@ -1,84 +1,84 @@
-/*
- * 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.
- */
-
-package org.apache.linkis.storage.utils
-
-import org.junit.jupiter.api.{Assertions, DisplayName, Test}
-
-class StorageConfigurationTest {
-
- @Test
- @DisplayName("constTest")
- def constTest(): Unit = {
-
- val storagerootuser = StorageConfiguration.STORAGE_ROOT_USER.getValue
- val hdfsrootuser = StorageConfiguration.HDFS_ROOT_USER.getValue
- val localrootuser = StorageConfiguration.LOCAL_ROOT_USER.getValue
- val storageusergroup = StorageConfiguration.STORAGE_USER_GROUP.getValue
- val storagersfiletype = StorageConfiguration.STORAGE_RS_FILE_TYPE.getValue
- val storagersfilesuffix = StorageConfiguration.STORAGE_RS_FILE_SUFFIX.getValue
- val types = StorageConfiguration.ResultTypes
- val storageresultsetpackage = StorageConfiguration.STORAGE_RESULT_SET_PACKAGE.getValue
- val storageresultsetclasses = StorageConfiguration.STORAGE_RESULT_SET_CLASSES.getValue
- val storagebuildfsclasses = StorageConfiguration.STORAGE_BUILD_FS_CLASSES.getValue
- val issharenode = StorageConfiguration.IS_SHARE_NODE.getValue
- val enableioproxy = StorageConfiguration.ENABLE_IO_PROXY.getValue
- val ioUser = StorageConfiguration.IO_USER.getValue
- val iofsexpiretime = StorageConfiguration.IO_FS_EXPIRE_TIME.getValue
- val iodefaultcreator = StorageConfiguration.IO_DEFAULT_CREATOR.getValue
- val iofsreinit = StorageConfiguration.IO_FS_RE_INIT.getValue
- val ioinitretrylimit = StorageConfiguration.IO_INIT_RETRY_LIMIT.getValue
- val storagehdfsgroup = StorageConfiguration.STORAGE_HDFS_GROUP.getValue
- val doublefractionlen = StorageConfiguration.DOUBLE_FRACTION_LEN.getValue
- val hdfspathprefixcheckon = StorageConfiguration.HDFS_PATH_PREFIX_CHECK_ON.getValue
- val hdfspathprefixremove = StorageConfiguration.HDFS_PATH_PREFIX_REMOVE.getValue
- val fschecksumdisbale = StorageConfiguration.FS_CHECKSUM_DISBALE
-
- Assertions.assertEquals("hadoop", storagerootuser)
- Assertions.assertEquals("hadoop", hdfsrootuser)
- Assertions.assertEquals("root", localrootuser)
- Assertions.assertEquals("bdap", storageusergroup)
- Assertions.assertEquals("utf-8", storagersfiletype)
- Assertions.assertEquals(".dolphin", storagersfilesuffix)
- Assertions.assertTrue(types.size > 0)
- Assertions.assertEquals("org.apache.linkis.storage.resultset", storageresultsetpackage)
- Assertions.assertEquals(
- "txt.TextResultSet,table.TableResultSet,io.IOResultSet,html.HtmlResultSet,picture.PictureResultSet",
- storageresultsetclasses
- )
- Assertions.assertEquals(
- "org.apache.linkis.storage.factory.impl.BuildHDFSFileSystem,org.apache.linkis.storage.factory.impl.BuildLocalFileSystem," +
- "org.apache.linkis.storage.factory.impl.BuildOSSSystem,org.apache.linkis.storage.factory.impl.BuildS3FileSystem," +
- "org.apache.linkis.storage.factory.impl.BuildAzureBlobFileSystem",
- storagebuildfsclasses
- )
- Assertions.assertTrue(issharenode)
- Assertions.assertFalse(enableioproxy)
- Assertions.assertEquals("root", ioUser)
- Assertions.assertTrue(600000 == iofsexpiretime)
- Assertions.assertEquals("IDE", iodefaultcreator)
- Assertions.assertEquals("re-init", iofsreinit)
- Assertions.assertTrue(10 == ioinitretrylimit)
- Assertions.assertEquals("hadoop", storagehdfsgroup)
- Assertions.assertTrue(30 == doublefractionlen)
- Assertions.assertTrue(hdfspathprefixcheckon)
- Assertions.assertTrue(hdfspathprefixremove)
- Assertions.assertFalse(fschecksumdisbale)
-
- }
-
-}
+/*
+ * 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.
+ */
+
+package org.apache.linkis.storage.utils
+
+import org.junit.jupiter.api.{Assertions, DisplayName, Test}
+
+class StorageConfigurationTest {
+
+ @Test
+ @DisplayName("constTest")
+ def constTest(): Unit = {
+
+ val storagerootuser = StorageConfiguration.STORAGE_ROOT_USER.getValue
+ val hdfsrootuser = StorageConfiguration.HDFS_ROOT_USER.getValue
+ val localrootuser = StorageConfiguration.LOCAL_ROOT_USER.getValue
+ val storageusergroup = StorageConfiguration.STORAGE_USER_GROUP.getValue
+ val storagersfiletype = StorageConfiguration.STORAGE_RS_FILE_TYPE.getValue
+ val storagersfilesuffix = StorageConfiguration.STORAGE_RS_FILE_SUFFIX.getValue
+ val types = StorageConfiguration.ResultTypes
+ val storageresultsetpackage = StorageConfiguration.STORAGE_RESULT_SET_PACKAGE.getValue
+ val storageresultsetclasses = StorageConfiguration.STORAGE_RESULT_SET_CLASSES.getValue
+ val storagebuildfsclasses = StorageConfiguration.STORAGE_BUILD_FS_CLASSES.getValue
+ val issharenode = StorageConfiguration.IS_SHARE_NODE.getValue
+ val enableioproxy = StorageConfiguration.ENABLE_IO_PROXY.getValue
+ val ioUser = StorageConfiguration.IO_USER.getValue
+ val iofsexpiretime = StorageConfiguration.IO_FS_EXPIRE_TIME.getValue
+ val iodefaultcreator = StorageConfiguration.IO_DEFAULT_CREATOR.getValue
+ val iofsreinit = StorageConfiguration.IO_FS_RE_INIT.getValue
+ val ioinitretrylimit = StorageConfiguration.IO_INIT_RETRY_LIMIT.getValue
+ val storagehdfsgroup = StorageConfiguration.STORAGE_HDFS_GROUP.getValue
+ val doublefractionlen = StorageConfiguration.DOUBLE_FRACTION_LEN.getValue
+ val hdfspathprefixcheckon = StorageConfiguration.HDFS_PATH_PREFIX_CHECK_ON.getValue
+ val hdfspathprefixremove = StorageConfiguration.HDFS_PATH_PREFIX_REMOVE.getValue
+ val fschecksumdisbale = StorageConfiguration.FS_CHECKSUM_DISBALE
+
+ Assertions.assertEquals("hadoop", storagerootuser)
+ Assertions.assertEquals("hadoop", hdfsrootuser)
+ Assertions.assertEquals("root", localrootuser)
+ Assertions.assertEquals("bdap", storageusergroup)
+ Assertions.assertEquals("utf-8", storagersfiletype)
+ Assertions.assertEquals(".dolphin", storagersfilesuffix)
+ Assertions.assertTrue(types.size > 0)
+ Assertions.assertEquals("org.apache.linkis.storage.resultset", storageresultsetpackage)
+ Assertions.assertEquals(
+ "txt.TextResultSet,table.TableResultSet,io.IOResultSet,html.HtmlResultSet,picture.PictureResultSet",
+ storageresultsetclasses
+ )
+ Assertions.assertEquals(
+ "org.apache.linkis.storage.factory.impl.BuildHDFSFileSystem,org.apache.linkis.storage.factory.impl.BuildLocalFileSystem," +
+ "org.apache.linkis.storage.factory.impl.BuildOSSSystem,org.apache.linkis.storage.factory.impl.BuildS3FileSystem," +
+ "org.apache.linkis.storage.factory.impl.BuildAzureBlobFileSystem",
+ storagebuildfsclasses
+ )
+ Assertions.assertTrue(issharenode)
+ Assertions.assertFalse(enableioproxy)
+ Assertions.assertEquals("root", ioUser)
+ Assertions.assertTrue(600000 == iofsexpiretime)
+ Assertions.assertEquals("IDE", iodefaultcreator)
+ Assertions.assertEquals("re-init", iofsreinit)
+ Assertions.assertTrue(10 == ioinitretrylimit)
+ Assertions.assertEquals("hadoop", storagehdfsgroup)
+ Assertions.assertTrue(30 == doublefractionlen)
+ Assertions.assertTrue(hdfspathprefixcheckon)
+ Assertions.assertTrue(hdfspathprefixremove)
+ Assertions.assertFalse(fschecksumdisbale)
+
+ }
+
+}
diff --git a/linkis-public-enhancements/linkis-datasource/linkis-datasource-manager/service/kafka/pom.xml b/linkis-public-enhancements/linkis-datasource/linkis-datasource-manager/service/kafka/pom.xml
index 38b1a438e8..ed8723c536 100644
--- a/linkis-public-enhancements/linkis-datasource/linkis-datasource-manager/service/kafka/pom.xml
+++ b/linkis-public-enhancements/linkis-datasource/linkis-datasource-manager/service/kafka/pom.xml
@@ -51,6 +51,11 @@
kafka-clients
3.9.1
+
+
+ org.slf4j
+ slf4j-api
+
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 203ea9f903..a118be121c 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
@@ -1,66 +1,66 @@
-/*
- * 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.
- */
-
-package org.apache.linkis.gateway.authentication.dao;
-
-import org.apache.linkis.common.conf.CommonVars;
-import org.apache.linkis.common.conf.Configuration;
-import org.apache.linkis.gateway.authentication.entity.TokenEntity;
-
-import org.apache.commons.lang3.StringUtils;
-
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.util.List;
-
-import org.junit.jupiter.api.BeforeAll;
-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);
-
- private static String TokenName =
- CommonVars.apply("wds.linkis.bml.auth.token.value", Configuration.LINKIS_TOKEN().getValue())
- .getValue();
-
- @Autowired TokenDao tokenDao;
-
- @BeforeAll
- static void before() {
- if (StringUtils.isBlank(TokenName)) {
- TokenName = "LINKIS-UNAVAILABLE-TOKE";
- }
- }
-
- @Test
- void testSelectTokenByName() {
- TokenEntity result = tokenDao.selectTokenByName(TokenName);
- assertEquals(result.getTokenName(), TokenName);
- }
-
- @Test
- void testGetAllTokens() {
- List result = tokenDao.getAllTokens();
- assertNotEquals(result.size(), 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.
+ */
+
+package org.apache.linkis.gateway.authentication.dao;
+
+import org.apache.linkis.common.conf.CommonVars;
+import org.apache.linkis.common.conf.Configuration;
+import org.apache.linkis.gateway.authentication.entity.TokenEntity;
+
+import org.apache.commons.lang3.StringUtils;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+
+import org.junit.jupiter.api.BeforeAll;
+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);
+
+ private static String TokenName =
+ CommonVars.apply("wds.linkis.bml.auth.token.value", Configuration.LINKIS_TOKEN().getValue())
+ .getValue();
+
+ @Autowired TokenDao tokenDao;
+
+ @BeforeAll
+ static void before() {
+ if (StringUtils.isBlank(TokenName)) {
+ TokenName = "LINKIS-UNAVAILABLE-TOKE";
+ }
+ }
+
+ @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 f16024a4f6..a551f9ff13 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
@@ -1,95 +1,95 @@
-/*
- * 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.
- */
-
-package org.apache.linkis.gateway.authentication.service;
-
-import org.apache.linkis.common.conf.CommonVars;
-import org.apache.linkis.common.conf.Configuration;
-import org.apache.linkis.gateway.authentication.Scan;
-import org.apache.linkis.gateway.authentication.WebApplicationServer;
-import org.apache.linkis.gateway.authentication.exception.TokenAuthException;
-
-import org.apache.commons.lang3.StringUtils;
-
-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.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-@ExtendWith(SpringExtension.class)
-@SpringBootTest(classes = {WebApplicationServer.class, Scan.class})
-public class CachedTokenServiceTest {
- private static final Logger logger = LoggerFactory.getLogger(CachedTokenServiceTest.class);
-
- private static String TokenName =
- CommonVars.apply("wds.linkis.bml.auth.token.value", Configuration.LINKIS_TOKEN().getValue())
- .getValue();
-
- @Autowired CachedTokenService tokenService;
-
- @BeforeAll
- static void before() {
- if (StringUtils.isBlank(TokenName)) {
- TokenName = "LINKIS-UNAVAILABLE-TOKE";
- }
- }
-
- @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());
- }
-}
+/*
+ * 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.
+ */
+
+package org.apache.linkis.gateway.authentication.service;
+
+import org.apache.linkis.common.conf.CommonVars;
+import org.apache.linkis.common.conf.Configuration;
+import org.apache.linkis.gateway.authentication.Scan;
+import org.apache.linkis.gateway.authentication.WebApplicationServer;
+import org.apache.linkis.gateway.authentication.exception.TokenAuthException;
+
+import org.apache.commons.lang3.StringUtils;
+
+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.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+@ExtendWith(SpringExtension.class)
+@SpringBootTest(classes = {WebApplicationServer.class, Scan.class})
+public class CachedTokenServiceTest {
+ private static final Logger logger = LoggerFactory.getLogger(CachedTokenServiceTest.class);
+
+ private static String TokenName =
+ CommonVars.apply("wds.linkis.bml.auth.token.value", Configuration.LINKIS_TOKEN().getValue())
+ .getValue();
+
+ @Autowired CachedTokenService tokenService;
+
+ @BeforeAll
+ static void before() {
+ if (StringUtils.isBlank(TokenName)) {
+ TokenName = "LINKIS-UNAVAILABLE-TOKE";
+ }
+ }
+
+ @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());
+ }
+}