You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by ca...@apache.org on 2022/08/12 10:23:35 UTC

[incubator-linkis] branch dev-1.2.1 updated: Add ErrorCode module unit test configuration file entry (#2725)

This is an automated email from the ASF dual-hosted git repository.

casion pushed a commit to branch dev-1.2.1
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git


The following commit(s) were added to refs/heads/dev-1.2.1 by this push:
     new 2b49e05a8 Add ErrorCode module unit test configuration file entry (#2725)
2b49e05a8 is described below

commit 2b49e05a8ca2d2250af9ac38d91936a4348a1c2d
Author: 成彬彬 <10...@users.noreply.github.com>
AuthorDate: Fri Aug 12 18:23:30 2022 +0800

    Add ErrorCode module unit test configuration file entry (#2725)
---
 .../org/apache/linkis/errorcode/server/Scan.java   | 26 +++++++++
 .../errorcode/server/WebApplicationServer.java     | 34 ++++++++++++
 .../linkis/errorcode/server/dao/BaseDaoTest.java   | 31 +++++++++++
 .../src/test/resources/application.properties      | 62 ++++++++++++++++++++++
 .../src/test/resources/create.sql                  | 30 +++++++++++
 .../src/test/resources/data.sql                    | 20 +++++++
 .../src/test/resources/linkis.properties           | 21 ++++++++
 7 files changed, 224 insertions(+)

diff --git a/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/java/org/apache/linkis/errorcode/server/Scan.java b/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/java/org/apache/linkis/errorcode/server/Scan.java
new file mode 100644
index 000000000..ba48710af
--- /dev/null
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/java/org/apache/linkis/errorcode/server/Scan.java
@@ -0,0 +1,26 @@
+/*
+ * 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.errorcode.server;
+
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+
+import org.mybatis.spring.annotation.MapperScan;
+
+@EnableAutoConfiguration
+@MapperScan("org.apache.linkis.errorcode.server.dao")
+public class Scan {}
diff --git a/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/java/org/apache/linkis/errorcode/server/WebApplicationServer.java b/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/java/org/apache/linkis/errorcode/server/WebApplicationServer.java
new file mode 100644
index 000000000..c686302ea
--- /dev/null
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/java/org/apache/linkis/errorcode/server/WebApplicationServer.java
@@ -0,0 +1,34 @@
+/*
+ * 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.errorcode.server;
+
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.servlet.ServletComponentScan;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+import org.springframework.context.annotation.ComponentScan;
+
+@EnableAutoConfiguration
+@ServletComponentScan
+@ComponentScan
+public class WebApplicationServer extends SpringBootServletInitializer {
+
+    public static void main(String[] args) {
+        new SpringApplicationBuilder(WebApplicationServer.class).run(args);
+    }
+}
diff --git a/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/java/org/apache/linkis/errorcode/server/dao/BaseDaoTest.java b/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/java/org/apache/linkis/errorcode/server/dao/BaseDaoTest.java
new file mode 100644
index 000000000..5022444db
--- /dev/null
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/java/org/apache/linkis/errorcode/server/dao/BaseDaoTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.errorcode.server.dao;
+
+import org.apache.linkis.errorcode.server.Scan;
+
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.Rollback;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import org.springframework.transaction.annotation.Transactional;
+
+@SpringBootTest(classes = Scan.class)
+@Transactional
+@Rollback()
+@EnableTransactionManagement
+public abstract class BaseDaoTest {}
diff --git a/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/resources/application.properties b/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/resources/application.properties
new file mode 100644
index 000000000..bd67bb1ab
--- /dev/null
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/resources/application.properties
@@ -0,0 +1,62 @@
+#
+# 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.
+#
+
+#wds.linkis.test.mode=true
+wds.linkis.server.version=v1
+
+#test
+wds.linkis.test.mode=true
+wds.linkis.test.user=hadoop
+
+
+##Linkis governance station administrators
+wds.linkis.governance.station.admin=hadoop
+wds.linkis.gateway.conf.publicservice.list=query,jobhistory,application,configuration,filesystem,udf,variable,microservice,errorcode,bml,datasource
+#
+
+#logging.level.root=debug
+#logging.file=./test.log
+#debug=true
+
+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.datasource.data=classpath:data.sql
+spring.datasource.username=sa
+spring.datasource.password=
+spring.datasource.hikari.connection-test-query=select 1
+spring.datasource.hikari.minimum-idle=5
+spring.datasource.hikari.auto-commit=true
+spring.datasource.hikari.validation-timeout=3000
+spring.datasource.hikari.pool-name=linkis-test
+spring.datasource.hikari.maximum-pool-size=50
+spring.datasource.hikari.connection-timeout=30000
+spring.datasource.hikari.idle-timeout=600000
+spring.datasource.hikari.leak-detection-threshold=0
+spring.datasource.hikari.initialization-fail-timeout=1
+
+spring.main.web-application-type=servlet
+server.port=1234
+spring.h2.console.enabled=true
+
+
+#disable eureka discovery client
+spring.cloud.service-registry.auto-registration.enabled=false
+eureka.client.enabled=false
+eureka.client.serviceUrl.registerWithEureka=false
+
+mybatis-plus.mapper-locations=classpath:org/apache/linkis/errorcode/server/dao/impl/*.xml
+mybatis-plus.type-aliases-package=org.apache.linkis.errorcode.common
+mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
\ No newline at end of file
diff --git a/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/resources/create.sql b/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/resources/create.sql
new file mode 100644
index 000000000..a7a8a1ec1
--- /dev/null
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/resources/create.sql
@@ -0,0 +1,30 @@
+/*
+ * 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.
+*/
+SET
+    FOREIGN_KEY_CHECKS = 0;
+SET
+    REFERENTIAL_INTEGRITY FALSE;
+
+DROP TABLE IF EXISTS `linkis_ps_error_code`;
+CREATE TABLE `linkis_ps_error_code` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `error_code` varchar(50)   NOT NULL,
+  `error_desc` varchar(1024)   NOT NULL,
+  `error_regex` varchar(1024)   DEFAULT NULL,
+  `error_type` int(3) DEFAULT '0',
+  PRIMARY KEY (`id`)
+);
\ No newline at end of file
diff --git a/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/resources/data.sql b/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/resources/data.sql
new file mode 100644
index 000000000..04efde723
--- /dev/null
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/resources/data.sql
@@ -0,0 +1,20 @@
+/*
+ * 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.
+*/
+
+DELETE FROM linkis_ps_error_code;
+INSERT INTO linkis_ps_error_code (error_code,error_desc,error_regex,error_type) VALUES ('01002','Linkis服务负载过高,请联系管理员扩容','Unexpected end of file from server',0);
+INSERT INTO linkis_ps_error_code (error_code,error_desc,error_regex,error_type) VALUES ('01001','您的任务没有路由到后台ECM,请联系管理员','The em of labels',0);
\ No newline at end of file
diff --git a/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/resources/linkis.properties b/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/resources/linkis.properties
new file mode 100644
index 000000000..1c575edc5
--- /dev/null
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-error-code/linkis-error-code-server/src/test/resources/linkis.properties
@@ -0,0 +1,21 @@
+# 
+# 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.
+#
+
+#wds.linkis.test.mode=true
+wds.linkis.server.version=v1
+
+#test
+wds.linkis.test.mode=true
+wds.linkis.test.user=hadoop
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org