You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by go...@apache.org on 2022/02/18 04:33:19 UTC

[incubator-inlong] branch master updated: [INLONG-2571][Manager] Fix unit tests bugs (#2577)

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

gosonzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 80b2615  [INLONG-2571][Manager] Fix unit tests bugs (#2577)
80b2615 is described below

commit 80b261545e43a135a29f369b8c53ba642a2e523e
Author: ciscozhou <45...@users.noreply.github.com>
AuthorDate: Fri Feb 18 12:33:13 2022 +0800

    [INLONG-2571][Manager] Fix unit tests bugs (#2577)
---
 .../inlong/manager/dao/RestTemplateConfig.java     | 26 +++-----
 ...est.java => InLongManagerSourceConfigTest.java} |  2 +-
 .../inlong/manager/service/RestTemplateConfig.java | 26 +++-----
 .../main/resources/sql/apache_inlong_manager.sql   | 72 --------------------
 .../manager-web/sql/apache_inlong_manager.sql      | 76 ----------------------
 5 files changed, 19 insertions(+), 183 deletions(-)

diff --git a/inlong-manager/manager-dao/src/test/java/org/apache/inlong/manager/dao/RestTemplateConfig.java b/inlong-manager/manager-dao/src/test/java/org/apache/inlong/manager/dao/RestTemplateConfig.java
index ccef8cc..4e6ed65 100644
--- a/inlong-manager/manager-dao/src/test/java/org/apache/inlong/manager/dao/RestTemplateConfig.java
+++ b/inlong-manager/manager-dao/src/test/java/org/apache/inlong/manager/dao/RestTemplateConfig.java
@@ -17,8 +17,6 @@
 
 package org.apache.inlong.manager.dao;
 
-import java.nio.charset.StandardCharsets;
-import java.util.List;
 import lombok.Data;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.HttpClient;
@@ -31,9 +29,7 @@ import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
 import org.apache.http.impl.client.HttpClientBuilder;
 import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
 import org.apache.http.protocol.HttpContext;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
@@ -43,42 +39,38 @@ import org.springframework.util.ObjectUtils;
 import org.springframework.web.client.DefaultResponseErrorHandler;
 import org.springframework.web.client.RestTemplate;
 
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+
 @Data
 @Configuration
 @ConditionalOnMissingBean(RestTemplate.class)
-@ConfigurationProperties(prefix = "common.http-client")
 public class RestTemplateConfig {
 
     /**
      * Max total
      */
-    @Value("${common.http-client.maxTotal}")
-    private int maxTotal;
+    private final int maxTotal = 5000;
     /**
      * Concurrency
      */
-    @Value("${common.http-client.defaultMaxPerRoute}")
-    private int defaultMaxPerRoute;
+    private final int defaultMaxPerRoute = 2000;
 
-    @Value("${common.http-client.validateAfterInactivity}")
-    private int validateAfterInactivity;
+    private final int validateAfterInactivity = 5000;
 
     /**
      * Time to connect to the server (successful handshake), timeout throws connect timeout
      */
-    @Value("${common.http-client.connectionTimeout}")
-    private int connectionTimeout;
+    private final int connectionTimeout = 3000;
     /**
      * The time for the server to return data (response), timeout throws read timeout
      */
-    @Value("${common.http-client.readTimeout}")
-    private int readTimeout;
+    private final int readTimeout = 10000;
     /**
      * Get the timeout time of the connection from the connection pool,
      * and throw ConnectionPoolTimeoutException when timeout
      */
-    @Value("${common.http-client.connectionRequestTimeout}")
-    private int connectionRequestTimeout;
+    private final int connectionRequestTimeout = 3000;
 
     @Bean
     public PoolingHttpClientConnectionManager httpClientConnectionManager() {
diff --git a/inlong-manager/manager-dao/src/test/java/org/apache/inlong/manager/dao/config/InLongManagerDatasourceConfigTest.java b/inlong-manager/manager-dao/src/test/java/org/apache/inlong/manager/dao/config/InLongManagerSourceConfigTest.java
similarity index 96%
rename from inlong-manager/manager-dao/src/test/java/org/apache/inlong/manager/dao/config/InLongManagerDatasourceConfigTest.java
rename to inlong-manager/manager-dao/src/test/java/org/apache/inlong/manager/dao/config/InLongManagerSourceConfigTest.java
index 0f11c09..4dfb6b0 100644
--- a/inlong-manager/manager-dao/src/test/java/org/apache/inlong/manager/dao/config/InLongManagerDatasourceConfigTest.java
+++ b/inlong-manager/manager-dao/src/test/java/org/apache/inlong/manager/dao/config/InLongManagerSourceConfigTest.java
@@ -25,7 +25,7 @@ import org.junit.Test;
 import org.mybatis.spring.SqlSessionTemplate;
 import org.springframework.beans.factory.annotation.Autowired;
 
-public class InLongManagerDatasourceConfigTest extends DaoBaseTest {
+public class InLongManagerSourceConfigTest extends DaoBaseTest {
 
     @Autowired
     private InLongManagerDatasourceConfig inLongManagerDatasourceConfig;
diff --git a/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/RestTemplateConfig.java b/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/RestTemplateConfig.java
index ac01127..858878f 100644
--- a/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/RestTemplateConfig.java
+++ b/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/RestTemplateConfig.java
@@ -17,8 +17,6 @@
 
 package org.apache.inlong.manager.service;
 
-import java.nio.charset.StandardCharsets;
-import java.util.List;
 import lombok.Data;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.HttpClient;
@@ -31,9 +29,7 @@ import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
 import org.apache.http.impl.client.HttpClientBuilder;
 import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
 import org.apache.http.protocol.HttpContext;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
@@ -43,42 +39,38 @@ import org.springframework.util.ObjectUtils;
 import org.springframework.web.client.DefaultResponseErrorHandler;
 import org.springframework.web.client.RestTemplate;
 
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+
 @Data
 @Configuration
 @ConditionalOnMissingBean(RestTemplate.class)
-@ConfigurationProperties(prefix = "common.http-client")
 public class RestTemplateConfig {
 
     /**
      * Max total
      */
-    @Value("${common.http-client.maxTotal}")
-    private int maxTotal;
+    private final int maxTotal = 5000;
     /**
      * Concurrency
      */
-    @Value("${common.http-client.defaultMaxPerRoute}")
-    private int defaultMaxPerRoute;
+    private final int defaultMaxPerRoute = 2000;
 
-    @Value("${common.http-client.validateAfterInactivity}")
-    private int validateAfterInactivity;
+    private final int validateAfterInactivity = 5000;
 
     /**
      * Time to connect to the server (successful handshake), timeout throws connect timeout
      */
-    @Value("${common.http-client.connectionTimeout}")
-    private int connectionTimeout;
+    private final int connectionTimeout = 3000;
     /**
      * The time for the server to return data (response), timeout throws read timeout
      */
-    @Value("${common.http-client.readTimeout}")
-    private int readTimeout;
+    private final int readTimeout = 10000;
     /**
      * Get the timeout time of the connection from the connection pool,
      * and throw ConnectionPoolTimeoutException when timeout
      */
-    @Value("${common.http-client.connectionRequestTimeout}")
-    private int connectionRequestTimeout;
+    private final int connectionRequestTimeout = 3000;
 
     @Bean
     public PoolingHttpClientConnectionManager httpClientConnectionManager() {
diff --git a/inlong-manager/manager-test/src/main/resources/sql/apache_inlong_manager.sql b/inlong-manager/manager-test/src/main/resources/sql/apache_inlong_manager.sql
index 75e1654..9ec4aa3 100644
--- a/inlong-manager/manager-test/src/main/resources/sql/apache_inlong_manager.sql
+++ b/inlong-manager/manager-test/src/main/resources/sql/apache_inlong_manager.sql
@@ -603,78 +603,6 @@ CREATE TABLE `data_storage_field`
 );
 
 -- ----------------------------
--- Table structure for task
--- ----------------------------
-DROP TABLE IF EXISTS `task`;
-CREATE TABLE `task`
-(
-    `id`          bigint(20)   NOT NULL,
-    `taskflow_id` bigint(20)   NOT NULL COMMENT 'Owning task flow id',
-    `task_def_id` bigint(20)    DEFAULT NULL COMMENT 'task definition id',
-    `task_name`   varchar(256) NOT NULL COMMENT 'task name',
-    `status`      varchar(256)  DEFAULT NULL COMMENT 'task status',
-    `post_param`  varchar(256)  DEFAULT NULL COMMENT 'Task parameters',
-    `resultmsg`   varchar(1000) DEFAULT NULL COMMENT 'Execution result log',
-    `create_time` datetime     NOT NULL COMMENT 'Create time',
-    `create_by`   varchar(256) NOT NULL COMMENT 'creator',
-    `update_time` datetime      DEFAULT NULL COMMENT 'last modified time',
-    `update_by`   varchar(0)    DEFAULT NULL COMMENT 'last modified person',
-    PRIMARY KEY (`id`)
-);
-
--- ----------------------------
--- Table structure for task_def
--- ----------------------------
-DROP TABLE IF EXISTS `task_def`;
-CREATE TABLE `task_def`
-(
-    `id`              bigint(20)   NOT NULL,
-    `taskflow_def_id` bigint(20)   NOT NULL COMMENT 'Task flow definition id',
-    `parent_id`       bigint(20)   DEFAULT NULL COMMENT 'parent task id',
-    `implclass`       varchar(256) DEFAULT NULL COMMENT 'task processing flow class',
-    `task_name`       varchar(256) DEFAULT NULL COMMENT 'task name',
-    `create_time`     datetime     NOT NULL COMMENT 'Create time',
-    `create_by`       varchar(256) NOT NULL COMMENT 'creator',
-    `update_time`     datetime     DEFAULT NULL COMMENT 'last modified time',
-    `update_by`       datetime     DEFAULT NULL COMMENT 'last modified person',
-    `delivery_id`     bigint(20)   DEFAULT NULL COMMENT 'Task push method',
-    PRIMARY KEY (`id`)
-);
-
--- ----------------------------
--- Table structure for taskflow
--- ----------------------------
-DROP TABLE IF EXISTS `taskflow`;
-CREATE TABLE `taskflow`
-(
-    `id`              bigint(20)   NOT NULL AUTO_INCREMENT,
-    `taskflow_def_id` bigint(20)   NOT NULL COMMENT 'Taskflow definition id',
-    `status`          varchar(256) DEFAULT NULL COMMENT 'status',
-    `create_by`       varchar(256) NOT NULL COMMENT 'creator',
-    `create_time`     datetime     DEFAULT NULL COMMENT 'Create time',
-    `update_time`     datetime     DEFAULT NULL COMMENT 'last modified time',
-    `update_by`       varchar(256) DEFAULT NULL COMMENT 'last modified person',
-    `event`           varchar(256) DEFAULT NULL COMMENT 'trigger event',
-    PRIMARY KEY (`id`)
-);
-
--- ----------------------------
--- Table structure for taskflow_def
--- ----------------------------
-DROP TABLE IF EXISTS `taskflow_def`;
-CREATE TABLE `taskflow_def`
-(
-    `id`            bigint(20)   NOT NULL AUTO_INCREMENT,
-    `name`          varchar(256) NOT NULL COMMENT 'Workflow definition name',
-    `descrip`       varchar(256) DEFAULT NULL COMMENT 'Workflow function description',
-    `create_time`   datetime     NOT NULL COMMENT 'Create time',
-    `create_by`     varchar(256) NOT NULL COMMENT 'creator',
-    `isValid`       int(11)      DEFAULT NULL COMMENT 'logical deletion',
-    `trigger_event` varchar(256) DEFAULT NULL COMMENT 'trigger event',
-    PRIMARY KEY (`id`)
-);
-
--- ----------------------------
 -- Table structure for user
 -- ----------------------------
 DROP TABLE IF EXISTS `user`;
diff --git a/inlong-manager/manager-web/sql/apache_inlong_manager.sql b/inlong-manager/manager-web/sql/apache_inlong_manager.sql
index b405247..bc4e2c4 100644
--- a/inlong-manager/manager-web/sql/apache_inlong_manager.sql
+++ b/inlong-manager/manager-web/sql/apache_inlong_manager.sql
@@ -642,82 +642,6 @@ CREATE TABLE `data_storage_field`
   DEFAULT CHARSET = utf8mb4 COMMENT ='Data storage field table';
 
 -- ----------------------------
--- Table structure for task
--- ----------------------------
-DROP TABLE IF EXISTS `task`;
-CREATE TABLE `task`
-(
-    `id`          bigint(20)   NOT NULL,
-    `taskflow_id` bigint(20)   NOT NULL COMMENT 'Owning task flow id',
-    `task_def_id` bigint(20)    DEFAULT NULL COMMENT 'task definition id',
-    `task_name`   varchar(256) NOT NULL COMMENT 'task name',
-    `status`      varchar(256)  DEFAULT NULL COMMENT 'task status',
-    `post_param`  varchar(256)  DEFAULT NULL COMMENT 'Task parameters',
-    `resultmsg`   varchar(1000) DEFAULT NULL COMMENT 'Execution result log',
-    `create_time` datetime     NOT NULL COMMENT 'Create time',
-    `create_by`   varchar(256) NOT NULL COMMENT 'creator',
-    `update_time` datetime      DEFAULT NULL COMMENT 'last modified time',
-    `update_by`   varchar(0)    DEFAULT NULL COMMENT 'last modified person',
-    PRIMARY KEY (`id`)
-) ENGINE = InnoDB
-  DEFAULT CHARSET = latin1 COMMENT ='Task information table';
-
--- ----------------------------
--- Table structure for task_def
--- ----------------------------
-DROP TABLE IF EXISTS `task_def`;
-CREATE TABLE `task_def`
-(
-    `id`              bigint(20)   NOT NULL,
-    `taskflow_def_id` bigint(20)   NOT NULL COMMENT 'Task flow definition id',
-    `parent_id`       bigint(20)   DEFAULT NULL COMMENT 'parent task id',
-    `implclass`       varchar(256) DEFAULT NULL COMMENT 'task processing flow class',
-    `task_name`       varchar(256) DEFAULT NULL COMMENT 'task name',
-    `create_time`     datetime     NOT NULL COMMENT 'Create time',
-    `create_by`       varchar(256) NOT NULL COMMENT 'creator',
-    `update_time`     datetime     DEFAULT NULL COMMENT 'last modified time',
-    `update_by`       datetime     DEFAULT NULL COMMENT 'last modified person',
-    `delivery_id`     bigint(20)   DEFAULT NULL COMMENT 'Task push method',
-    PRIMARY KEY (`id`)
-) ENGINE = InnoDB
-  DEFAULT CHARSET = latin1 COMMENT ='Task definition under workflow';
-
--- ----------------------------
--- Table structure for taskflow
--- ----------------------------
-DROP TABLE IF EXISTS `taskflow`;
-CREATE TABLE `taskflow`
-(
-    `id`              bigint(20)   NOT NULL AUTO_INCREMENT,
-    `taskflow_def_id` bigint(20)   NOT NULL COMMENT 'Taskflow definition id',
-    `status`          varchar(256) DEFAULT NULL COMMENT 'status',
-    `create_by`       varchar(256) NOT NULL COMMENT 'creator',
-    `create_time`     datetime     DEFAULT NULL COMMENT 'Create time',
-    `update_time`     datetime     DEFAULT NULL COMMENT 'last modified time',
-    `update_by`       varchar(256) DEFAULT NULL COMMENT 'last modified person',
-    `event`           varchar(256) DEFAULT NULL COMMENT 'trigger event',
-    PRIMARY KEY (`id`)
-) ENGINE = InnoDB
-  DEFAULT CHARSET = latin1 COMMENT ='Task flow instance';
-
--- ----------------------------
--- Table structure for taskflow_def
--- ----------------------------
-DROP TABLE IF EXISTS `taskflow_def`;
-CREATE TABLE `taskflow_def`
-(
-    `id`            bigint(20)   NOT NULL AUTO_INCREMENT,
-    `name`          varchar(256) NOT NULL COMMENT 'Workflow definition name',
-    `descrip`       varchar(256) DEFAULT NULL COMMENT 'Workflow function description',
-    `create_time`   datetime     NOT NULL COMMENT 'Create time',
-    `create_by`     varchar(256) NOT NULL COMMENT 'creator',
-    `isValid`       int(11)      DEFAULT NULL COMMENT 'logical deletion',
-    `trigger_event` varchar(256) DEFAULT NULL COMMENT 'trigger event',
-    PRIMARY KEY (`id`)
-) ENGINE = InnoDB
-  DEFAULT CHARSET = latin1 COMMENT ='Task flow definition';
-
--- ----------------------------
 -- Table structure for user
 -- ----------------------------
 DROP TABLE IF EXISTS `user`;