Browse Source

change escheduler to dolphinscheduler (#928)

* rename from DatasourceUserMapper to DataSourceUserMapper

* add unit test in UserMapper and WorkerGroupMapper

* change cn.escheduler to org.apache.dolphinscheduler
pull/2/head
lgcareer 5 years ago committed by bao liang
parent
commit
0798b7d1e9
  1. 2
      dockerfile/conf/escheduler/conf/master_logback.xml
  2. 6
      dockerfile/conf/escheduler/conf/worker_logback.xml
  3. 2
      dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java
  4. 2
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/ApiApplicationServer.java
  5. 2
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/CombinedApplicationServer.java
  6. 4
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/SwaggerConfig.java
  7. 4
      dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
  8. 6
      dolphinscheduler-common/src/main/resources/quartz.properties
  9. 2
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java
  10. 2
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/config/MybatisPlusConfig.java
  11. 2
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/datasource/ConnectionFactory.java
  12. 4
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/datasource/DatabaseConfiguration.java
  13. 1
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/UserAlertGroup.java
  14. 2
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/UserAlertGroupMapper.java
  15. 12
      dolphinscheduler-dao/src/main/resources/application.yml
  16. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapper.xml
  17. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/AlertGroupMapper.xml
  18. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/AlertMapper.xml
  19. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/CommandMapper.xml
  20. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/DataSourceMapper.xml
  21. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/DataSourceUserMapper.xml
  22. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ErrorCommandMapper.xml
  23. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml
  24. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapMapper.xml
  25. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.xml
  26. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.xml
  27. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProjectUserMapper.xml
  28. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/QueueMapper.xml
  29. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ResourceMapper.xml
  30. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ResourceUserMapper.xml
  31. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.xml
  32. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/SessionMapper.xml
  33. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapper.xml
  34. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TenantMapper.xml
  35. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/UDFUserMapper.xml
  36. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/UdfFuncMapper.xml
  37. 6
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/UserAlertGroupMapper.xml
  38. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/UserMapper.xml
  39. 0
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/WorkerGroupMapper.xml
  40. 138
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UDFUserMapperTest.java
  41. 148
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UserAlertGroupMapperTest.java
  42. 2
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/AbstractServer.java
  43. 2
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java
  44. 2
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
  45. 8
      dolphinscheduler-ui/src/view/docs/zh_CN/_book/pages/deploy-background.html
  46. 2
      script/create-dolphinscheduler.sh
  47. 10
      script/dolphinscheduler-daemon.sh
  48. 2
      script/upgrade-dolphinscheduler.sh

2
dockerfile/conf/escheduler/conf/master_logback.xml

@ -12,7 +12,7 @@
<appender name="MASTERLOGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="MASTERLOGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.base}/escheduler-master.log</file> <file>${log.base}/escheduler-master.log</file>
<filter class="cn.escheduler.server.master.log.MasterLogFilter"> <filter class="org.apache.dolphinscheduler.server.master.log.MasterLogFilter">
<level>INFO</level> <level>INFO</level>
</filter> </filter>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">

6
dockerfile/conf/escheduler/conf/worker_logback.xml

@ -13,8 +13,8 @@
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level> <level>INFO</level>
</filter> </filter>
<filter class="cn.escheduler.server.worker.log.TaskLogFilter"></filter> <filter class="org.apache.dolphinscheduler.server.worker.log.TaskLogFilter"></filter>
<Discriminator class="cn.escheduler.server.worker.log.TaskLogDiscriminator"> <Discriminator class="org.apache.dolphinscheduler.server.worker.log.TaskLogDiscriminator">
<key>taskAppId</key> <key>taskAppId</key>
</Discriminator> </Discriminator>
<sift> <sift>
@ -33,7 +33,7 @@
<appender name="WORKERLOGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="WORKERLOGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.base}/escheduler-worker.log</file> <file>${log.base}/escheduler-worker.log</file>
<filter class="cn.escheduler.server.worker.log.WorkerLogFilter"> <filter class="org.apache.dolphinscheduler.server.worker.log.WorkerLogFilter">
<level>INFO</level> <level>INFO</level>
</filter> </filter>

2
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java

@ -33,7 +33,7 @@ import java.util.List;
/** /**
* alert of start * alert of start
*/ */
@ComponentScan("cn.escheduler") @ComponentScan("org.apache.dolphinscheduler")
public class AlertServer implements CommandLineRunner { public class AlertServer implements CommandLineRunner {
private static final Logger logger = LoggerFactory.getLogger(AlertServer.class); private static final Logger logger = LoggerFactory.getLogger(AlertServer.class);
/** /**

2
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/ApiApplicationServer.java

@ -25,7 +25,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication @SpringBootApplication
@ServletComponentScan @ServletComponentScan
@ComponentScan("cn.escheduler") @ComponentScan("org.apache.dolphinscheduler")
@EnableSwagger2 @EnableSwagger2
public class ApiApplicationServer extends SpringBootServletInitializer { public class ApiApplicationServer extends SpringBootServletInitializer {

2
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/CombinedApplicationServer.java

@ -32,7 +32,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication @SpringBootApplication
@ServletComponentScan @ServletComponentScan
@ComponentScan("cn.escheduler") @ComponentScan("org.apache.dolphinscheduler")
@EnableSwagger2 @EnableSwagger2
public class CombinedApplicationServer extends SpringBootServletInitializer { public class CombinedApplicationServer extends SpringBootServletInitializer {

4
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/SwaggerConfig.java

@ -42,12 +42,12 @@ public class SwaggerConfig implements WebMvcConfigurer {
@Bean @Bean
public Docket createRestApi() { public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select() return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
.apis(RequestHandlerSelectors.basePackage("cn.escheduler.api.controller")).paths(PathSelectors.any()) .apis(RequestHandlerSelectors.basePackage("org.apache.dolphinscheduler.api.controller")).paths(PathSelectors.any())
.build(); .build();
} }
private ApiInfo apiInfo() { private ApiInfo apiInfo() {
return new ApiInfoBuilder().title("Easy Scheduler Api Docs").description("Easy Scheduler Api Docs") return new ApiInfoBuilder().title("Dolphin Scheduler Api Docs").description("Dolphin Scheduler Api Docs")
.build(); .build();
} }

4
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java

@ -57,8 +57,8 @@ public class ProcessInstanceServiceTest {
@Test @Test
public void testDependResult(){ public void testDependResult(){
String logString = "[INFO] 2019-03-19 17:11:08.475 cn.escheduler.server.worker.log.TaskLogger:[172] - [taskAppId=TASK_223_10739_452334] dependent item complete :|| 223-ALL-day-last1Day,SUCCESS\n" + String logString = "[INFO] 2019-03-19 17:11:08.475 org.apache.dolphinscheduler.server.worker.log.TaskLogger:[172] - [taskAppId=TASK_223_10739_452334] dependent item complete :|| 223-ALL-day-last1Day,SUCCESS\n" +
"[INFO] 2019-03-19 17:11:08.476 cn.escheduler.server.worker.runner.TaskScheduleThread:[172] - task : 223_10739_452334 exit status code : 0\n" + "[INFO] 2019-03-19 17:11:08.476 org.apache.dolphinscheduler.server.worker.runner.TaskScheduleThread:[172] - task : 223_10739_452334 exit status code : 0\n" +
"[root@node2 current]# "; "[root@node2 current]# ";
try { try {
Map<String, DependResult> resultMap = Map<String, DependResult> resultMap =

6
dolphinscheduler-common/src/main/resources/quartz.properties

@ -1,7 +1,7 @@
#============================================================================ #============================================================================
# Configure Main Scheduler Properties # Configure Main Scheduler Properties
#============================================================================ #============================================================================
org.quartz.scheduler.instanceName = EasyScheduler org.quartz.scheduler.instanceName = DolphinScheduler
org.quartz.scheduler.instanceId = AUTO org.quartz.scheduler.instanceId = AUTO
org.quartz.scheduler.makeSchedulerThreadDaemon = true org.quartz.scheduler.makeSchedulerThreadDaemon = true
org.quartz.jobStore.useProperties = false org.quartz.jobStore.useProperties = false
@ -30,9 +30,9 @@ org.quartz.jobStore.dataSource = myDs
#============================================================================ #============================================================================
# Configure Datasources # Configure Datasources
#============================================================================ #============================================================================
org.quartz.dataSource.myDs.connectionProvider.class = cn.escheduler.server.quartz.DruidConnectionProvider org.quartz.dataSource.myDs.connectionProvider.class = org.apache.dolphinscheduler.server.quartz.DruidConnectionProvider
org.quartz.dataSource.myDs.driver = com.mysql.jdbc.Driver org.quartz.dataSource.myDs.driver = com.mysql.jdbc.Driver
org.quartz.dataSource.myDs.URL = jdbc:mysql://192.168.xx.xx:3306/escheduler?characterEncoding=utf8 org.quartz.dataSource.myDs.URL = jdbc:mysql://192.168.xx.xx:3306/dolphinscheduler?characterEncoding=utf8
org.quartz.dataSource.myDs.user = xx org.quartz.dataSource.myDs.user = xx
org.quartz.dataSource.myDs.password = xx org.quartz.dataSource.myDs.password = xx
org.quartz.dataSource.myDs.maxConnections = 10 org.quartz.dataSource.myDs.maxConnections = 10

2
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java

@ -82,7 +82,7 @@ public class AlertDao extends AbstractBaseDao {
*/ */
public List<User> queryUserByAlertGroupId(int alerGroupId){ public List<User> queryUserByAlertGroupId(int alerGroupId){
return userAlertGroupMapper.queryForUser(alerGroupId); return userAlertGroupMapper.listUserByAlertgroupId(alerGroupId);
} }
/** /**
* MasterServer or WorkerServer stoped * MasterServer or WorkerServer stoped

2
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/config/MybatisPlusConfig.java

@ -7,7 +7,7 @@ import org.springframework.context.annotation.Configuration;
@Configuration @Configuration
@MapperScan("cn.escheduler.*.mapper") @MapperScan("org.apache.dolphinscheduler.*.mapper")
public class MybatisPlusConfig { public class MybatisPlusConfig {
@Bean @Bean
public PaginationInterceptor paginationInterceptor() { public PaginationInterceptor paginationInterceptor() {

2
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/datasource/ConnectionFactory.java

@ -74,7 +74,7 @@ public class ConnectionFactory {
Configuration configuration = new Configuration(environment); Configuration configuration = new Configuration(environment);
configuration.setLazyLoadingEnabled(true); configuration.setLazyLoadingEnabled(true);
configuration.addMappers("cn.escheduler.dao.mapper"); configuration.addMappers("org.apache.dolphinscheduler.dao.mapper");
SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder(); SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();

4
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/datasource/DatabaseConfiguration.java

@ -14,7 +14,7 @@
// * See the License for the specific language governing permissions and // * See the License for the specific language governing permissions and
// * limitations under the License. // * limitations under the License.
// */ // */
//package cn.escheduler.dao.datasource; //package org.apache.dolphinscheduler.dao.datasource;
// //
//import com.alibaba.druid.pool.DruidDataSource; //import com.alibaba.druid.pool.DruidDataSource;
//import org.apache.ibatis.session.SqlSessionFactory; //import org.apache.ibatis.session.SqlSessionFactory;
@ -34,7 +34,7 @@
// */ // */
//@Configuration //@Configuration
//@PropertySource({"classpath:application.yml"}) //@PropertySource({"classpath:application.yml"})
//@MapperScan(basePackages = "cn.escheduler.dao.mapper", sqlSessionFactoryRef = "SqlSessionFactory") //@MapperScan(basePackages = "org.apache.dolphinscheduler.dao.mapper", sqlSessionFactoryRef = "SqlSessionFactory")
//public class DatabaseConfiguration { //public class DatabaseConfiguration {
// //
// /** // /**

1
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/UserAlertGroup.java

@ -57,6 +57,7 @@ public class UserAlertGroup {
/** /**
* user name * user name
*/ */
@TableField(exist = false)
private String userName; private String userName;
/** /**

2
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/UserAlertGroupMapper.java

@ -25,8 +25,6 @@ import java.util.List;
public interface UserAlertGroupMapper extends BaseMapper<UserAlertGroup> { public interface UserAlertGroupMapper extends BaseMapper<UserAlertGroup> {
List<User> queryForUser(@Param("alertgroupId") int alertgroupId);
int deleteByAlertgroupId(@Param("alertgroupId") int alertgroupId); int deleteByAlertgroupId(@Param("alertgroupId") int alertgroupId);
List<User> listUserByAlertgroupId(@Param("alertgroupId") int alertgroupId); List<User> listUserByAlertgroupId(@Param("alertgroupId") int alertgroupId);

12
dolphinscheduler-dao/src/main/resources/application.yml

@ -5,18 +5,18 @@ spring:
# driver-class-name: com.mysql.jdbc.Driver # driver-class-name: com.mysql.jdbc.Driver
url: jdbc:postgresql://192.168.220.154:5432/escheduler url: jdbc:postgresql://192.168.220.154:5432/escheduler
# url: jdbc:mysql://192.168.220.188:3306/escheduler_new?useUnicode=true&characterEncoding=UTF-8 # url: jdbc:mysql://192.168.220.188:3306/escheduler_new?useUnicode=true&characterEncoding=UTF-8
username: root username: xx
password: root@123 password: xx
# platform: # platform:
continue-on-error: true continue-on-error: true
#mybatis #mybatis
mybatis-plus: mybatis-plus:
mapper-locations: classpath*:/cn.escheduler.dao.mapper/*.xml mapper-locations: classpath*:/org.apache.dolphinscheduler.dao.mapper/*.xml
typeEnumsPackage: cn.escheduler.*.enums typeEnumsPackage: org.apache.dolphinscheduler.*.enums
#实体扫描,多个package用逗号或者分号分隔 #实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: cn.escheduler.dao.entity typeAliasesPackage: org.apache.dolphinscheduler.dao.entity
global-config: global-config:
#数据库相关配置 #数据库相关配置
db-config: db-config:
@ -40,5 +40,5 @@ mybatis-plus:
# Logger Config # Logger Config
logging: logging:
level: level:
cn.escheduler.dao: debug org.apache.dolphinscheduler.dao: debug

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/AccessTokenMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/AlertGroupMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/AlertGroupMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/AlertMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/AlertMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/CommandMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/CommandMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/DataSourceMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/DataSourceMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/DataSourceUserMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/DataSourceUserMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/ErrorCommandMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ErrorCommandMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/ProcessDefinitionMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/ProcessInstanceMapMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/ProcessInstanceMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/ProjectMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/ProjectUserMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProjectUserMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/QueueMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/QueueMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/ResourceMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ResourceMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/ResourceUserMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ResourceUserMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/ScheduleMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/SessionMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/SessionMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/TaskInstanceMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/TenantMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TenantMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/UDFUserMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/UDFUserMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/UdfFuncMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/UdfFuncMapper.xml

6
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/UserAlertGroupMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/UserAlertGroupMapper.xml

@ -5,12 +5,6 @@
delete from t_escheduler_relation_user_alertgroup delete from t_escheduler_relation_user_alertgroup
where `alertgroup_id` = #{alertgroupId} where `alertgroup_id` = #{alertgroupId}
</delete> </delete>
<select id="queryForUser" resultType="org.apache.dolphinscheduler.dao.entity.User">
SELECT u.*
FROM t_escheduler_relation_user_alertgroup g_u
JOIN t_escheduler_user u on g_u.user_id = u.id
WHERE g_u.alertgroup_id = #{alertgroupId}
</select>
<select id="listUserByAlertgroupId" resultType="org.apache.dolphinscheduler.dao.entity.User"> <select id="listUserByAlertgroupId" resultType="org.apache.dolphinscheduler.dao.entity.User">
SELECT u.* SELECT u.*
FROM t_escheduler_relation_user_alertgroup g_u FROM t_escheduler_relation_user_alertgroup g_u

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/UserMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/UserMapper.xml

0
dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/WorkerGroupMapper.xml → dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/WorkerGroupMapper.xml

138
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UDFUserMapperTest.java

@ -17,20 +17,158 @@
package org.apache.dolphinscheduler.dao.mapper; package org.apache.dolphinscheduler.dao.mapper;
import org.apache.dolphinscheduler.common.enums.UdfType;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.dao.entity.UDFUser;
import org.apache.dolphinscheduler.dao.entity.UdfFunc;
import org.apache.dolphinscheduler.dao.entity.User;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import java.util.Date;
import java.util.List;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
public class UDFUserMapperTest { public class UDFUserMapperTest {
@Autowired
UDFUserMapper udfUserMapper;
@Autowired
UserMapper userMapper;
@Autowired
UdfFuncMapper udfFuncMapper;
private UDFUser insertOne(){
UDFUser udfUser = new UDFUser();
udfUser.setUdfId(1);
udfUser.setUserId(1);
udfUser.setCreateTime(new Date());
udfUser.setUpdateTime(new Date());
udfUserMapper.insert(udfUser);
return udfUser;
}
private UDFUser insertOne(User user,UdfFunc udfFunc){
UDFUser udfUser = new UDFUser();
udfUser.setUdfId(udfFunc.getId());
udfUser.setUserId(user.getId());
udfUser.setCreateTime(new Date());
udfUser.setUpdateTime(new Date());
udfUserMapper.insert(udfUser);
return udfUser;
}
/**
* insert one user
* @return
*/
private User insertOneUser(){
User user = new User();
user.setUserName("user1");
user.setUserPassword("1");
user.setEmail("xx@123.com");
user.setUserType(UserType.GENERAL_USER);
user.setCreateTime(new Date());
user.setTenantId(1);
user.setQueue("dolphin");
user.setUpdateTime(new Date());
userMapper.insert(user);
return user;
}
/**
* insert one udf
* @return
*/
private UdfFunc insertOneUdfFunc(){
UdfFunc udfFunc = new UdfFunc();
udfFunc.setFuncName("dolphin_udf_func");
udfFunc.setClassName("org.apache.dolphinscheduler.test.mr");
udfFunc.setType(UdfType.HIVE);
udfFunc.setResourceId(1);
udfFunc.setResourceName("dolphin_resource");
udfFunc.setCreateTime(new Date());
udfFunc.setUpdateTime(new Date());
udfFuncMapper.insert(udfFunc);
return udfFunc;
}
@Test
public void testUpdate(){
//insertOneUser
User user = insertOneUser();
//insertOneUdfFunc
UdfFunc udfFunc = insertOneUdfFunc();
//insertOne
UDFUser udfUser = insertOne(user, udfFunc);
udfUser.setUserId(2);
udfUser.setUdfId(2);
int update = udfUserMapper.updateById(udfUser);
Assert.assertEquals(update, 1);
udfUserMapper.deleteById(udfUser.getId());
udfFuncMapper.deleteById(udfFunc.getId());
userMapper.deleteById(user.getId());
}
@Test
public void testDelete(){
//insertOneUser
User user = insertOneUser();
//insertOneUdfFunc
UdfFunc udfFunc = insertOneUdfFunc();
//insertOne
UDFUser udfUser = insertOne(user, udfFunc);
int delete = udfUserMapper.deleteById(udfUser.getId());
Assert.assertEquals(delete, 1);
userMapper.deleteById(user.getId());
udfFuncMapper.deleteById(udfFunc.getId());
}
@Test
public void testQuery(){
//insertOne
UDFUser udfUser = insertOne();
//query
List<UDFUser> udfUserList = udfUserMapper.selectList(null);
Assert.assertNotEquals(udfUserList.size(), 0);
userMapper.deleteById(udfUser.getId());
}
@Test @Test
public void testDeleteByUserId() { public void testDeleteByUserId() {
//insertOneUser
User user = insertOneUser();
//insertOneUdfFunc
UdfFunc udfFunc = insertOneUdfFunc();
//insertOne
UDFUser udfUser = insertOne(user, udfFunc);
int delete = udfUserMapper.deleteByUserId(user.getId());
Assert.assertEquals(delete, 1);
userMapper.deleteById(user.getId());
udfFuncMapper.deleteById(udfFunc.getId());
} }
@Test @Test
public void testDeleteByUdfFuncId() { public void testDeleteByUdfFuncId() {
//insertOneUser
User user = insertOneUser();
//insertOneUdfFunc
UdfFunc udfFunc = insertOneUdfFunc();
//insertOne
UDFUser udfUser = insertOne(user, udfFunc);
int delete = udfUserMapper.deleteByUdfFuncId(udfFunc.getId());
Assert.assertEquals(delete, 1);
userMapper.deleteById(user.getId());
udfFuncMapper.deleteById(udfFunc.getId());
} }
} }

148
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UserAlertGroupMapperTest.java

@ -17,24 +17,170 @@
package org.apache.dolphinscheduler.dao.mapper; package org.apache.dolphinscheduler.dao.mapper;
import org.apache.dolphinscheduler.common.enums.AlertType;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.dao.entity.AlertGroup;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.entity.UserAlertGroup;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import java.util.Date;
import java.util.List;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
public class UserAlertGroupMapperTest { public class UserAlertGroupMapperTest {
@Autowired
private UserMapper userMapper;
@Autowired
AlertGroupMapper alertGroupMapper;
@Autowired
private UserAlertGroupMapper userAlertGroupMapper;
/**
* insert one UserAlertGroup
* @param user
* @param alertGroup
* @return
*/
private UserAlertGroup insertOne(User user,AlertGroup alertGroup){
UserAlertGroup userAlertGroup = new UserAlertGroup();
userAlertGroup.setAlertgroupName(alertGroup.getGroupName());
userAlertGroup.setAlertgroupId(alertGroup.getId());
userAlertGroup.setUserId(user.getId());
userAlertGroup.setCreateTime(new Date());
userAlertGroup.setUpdateTime(new Date());
userAlertGroupMapper.insert(userAlertGroup);
return userAlertGroup;
}
/**
* insert one UserAlertGroup
* @return
*/
private UserAlertGroup insertOne(){
UserAlertGroup userAlertGroup = new UserAlertGroup();
userAlertGroup.setAlertgroupName("dolphin_alert_group");
userAlertGroup.setAlertgroupId(10);
userAlertGroup.setUserId(4);
userAlertGroup.setCreateTime(new Date());
userAlertGroup.setUpdateTime(new Date());
userAlertGroupMapper.insert(userAlertGroup);
return userAlertGroup;
}
/**
* insert one user
* @return
*/
private User insertOneUser(){
User user = new User();
user.setUserName("user1");
user.setUserPassword("1");
user.setEmail("xx@123.com");
user.setUserType(UserType.GENERAL_USER);
user.setCreateTime(new Date());
user.setTenantId(1);
user.setQueue("dolphin");
user.setUpdateTime(new Date());
userMapper.insert(user);
return user;
}
/**
* insert one AlertGroup
* @return
*/
private AlertGroup insertOneAlertGroup(){
//insertOne
AlertGroup alertGroup = new AlertGroup();
alertGroup.setGroupName("alert group 1");
alertGroup.setDescription("alert test1");
alertGroup.setGroupType(AlertType.EMAIL);
alertGroup.setCreateTime(new Date());
alertGroup.setUpdateTime(new Date());
alertGroupMapper.insert(alertGroup);
return alertGroup;
}
@Test
public void testUpdate(){
//insertOneUser
User user = insertOneUser();
//insertOneAlertGroup
AlertGroup alertGroup = insertOneAlertGroup();
//insertOne
UserAlertGroup userAlertGroup = insertOne();
//update
userAlertGroup.setUserId(user.getId());
userAlertGroup.setAlertgroupId(alertGroup.getId());
userAlertGroup.setUpdateTime(new Date());
int update = userAlertGroupMapper.updateById(userAlertGroup);
Assert.assertEquals(update, 1);
userAlertGroupMapper.deleteById(userAlertGroup.getId());
userMapper.deleteById(user.getId());
alertGroupMapper.deleteById(alertGroup.getId());
}
@Test @Test
public void testQueryForUser() { public void testDelete(){
//insertOne
UserAlertGroup userAlertGroup = insertOne();
//delete
int delete = userAlertGroupMapper.deleteById(userAlertGroup.getId());
Assert.assertEquals(delete, 1);
}
@Test
public void testQuery() {
//insertOne
UserAlertGroup userAlertGroup = insertOne();
//query
List<UserAlertGroup> userAlertGroupList = userAlertGroupMapper.selectList(null);
Assert.assertNotEquals(userAlertGroupList.size(), 0);
userAlertGroupMapper.deleteById(userAlertGroup.getId());
} }
@Test @Test
public void testDeleteByAlertgroupId() { public void testDeleteByAlertgroupId() {
//insertOneUser
User user = insertOneUser();
//insertOneAlertGroup
AlertGroup alertGroup = insertOneAlertGroup();
//insertOne
UserAlertGroup userAlertGroup = insertOne(user,alertGroup);
int delete = userAlertGroupMapper.deleteByAlertgroupId(alertGroup.getId());
Assert.assertEquals(delete, 1);
userMapper.deleteById(user.getId());
alertGroupMapper.deleteById(alertGroup.getId());
} }
@Test @Test
public void testListUserByAlertgroupId() { public void testListUserByAlertgroupId() {
//insertOneUser
User user = insertOneUser();
//insertOneAlertGroup
AlertGroup alertGroup = insertOneAlertGroup();
//insertOne
UserAlertGroup userAlertGroup = insertOne(user,alertGroup);
List<User> userList = userAlertGroupMapper.listUserByAlertgroupId(alertGroup.getId());
Assert.assertNotEquals(userList.size(), 0);
userAlertGroupMapper.deleteByAlertgroupId(alertGroup.getId());
userMapper.deleteById(user.getId());
alertGroupMapper.deleteById(alertGroup.getId());
} }
} }

2
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/AbstractServer.java

@ -26,7 +26,7 @@ import org.springframework.context.annotation.ComponentScan;
/** /**
* master server * master server
*/ */
@ComponentScan("cn.escheduler") @ComponentScan("org.apache.dolphinscheduler")
public abstract class AbstractServer implements CommandLineRunner, IStoppable { public abstract class AbstractServer implements CommandLineRunner, IStoppable {
private static final Logger logger = LoggerFactory.getLogger(AbstractServer.class); private static final Logger logger = LoggerFactory.getLogger(AbstractServer.class);

2
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java

@ -43,7 +43,7 @@ import java.util.concurrent.TimeUnit;
/** /**
* master server * master server
*/ */
@ComponentScan("cn.escheduler") @ComponentScan("org.apache.dolphinscheduler")
public class MasterServer extends AbstractServer { public class MasterServer extends AbstractServer {
private static final Logger logger = LoggerFactory.getLogger(MasterServer.class); private static final Logger logger = LoggerFactory.getLogger(MasterServer.class);

2
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java

@ -50,7 +50,7 @@ import java.util.concurrent.TimeUnit;
/** /**
* worker server * worker server
*/ */
@ComponentScan("cn.escheduler") @ComponentScan("org.apache.dolphinscheduler")
public class WorkerServer extends AbstractServer { public class WorkerServer extends AbstractServer {
private static final Logger logger = LoggerFactory.getLogger(WorkerServer.class); private static final Logger logger = LoggerFactory.getLogger(WorkerServer.class);

8
dolphinscheduler-ui/src/view/docs/zh_CN/_book/pages/deploy-background.html

@ -1274,7 +1274,7 @@ master.reserved.memory=1
&lt;appender name=&quot;MASTERLOGFILE&quot; class=&quot;ch.qos.logback.core.rolling.RollingFileAppender&quot;&gt; &lt;appender name=&quot;MASTERLOGFILE&quot; class=&quot;ch.qos.logback.core.rolling.RollingFileAppender&quot;&gt;
&lt;file&gt;${log.base}/escheduler-master.log&lt;/file&gt; &lt;file&gt;${log.base}/escheduler-master.log&lt;/file&gt;
&lt;filter class=&quot;cn.escheduler.server.master.log.MasterLogFilter&quot;&gt; &lt;filter class=&quot;org.apache.dolphinscheduler.server.master.log.MasterLogFilter&quot;&gt;
&lt;level&gt;INFO&lt;/level&gt; &lt;level&gt;INFO&lt;/level&gt;
&lt;/filter&gt; &lt;/filter&gt;
&lt;rollingPolicy class=&quot;ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy&quot;&gt; &lt;rollingPolicy class=&quot;ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy&quot;&gt;
@ -1329,11 +1329,11 @@ worker.reserved.memory=1
&lt;charset&gt;UTF-8&lt;/charset&gt; &lt;charset&gt;UTF-8&lt;/charset&gt;
&lt;/encoder&gt; &lt;/encoder&gt;
&lt;/appender&gt; &lt;/appender&gt;
&lt;appender name=&quot;TASKLOGFILE&quot; class=&quot;cn.escheduler.server.worker.log.TaskLogAppender&quot;&gt; &lt;appender name=&quot;TASKLOGFILE&quot; class=&quot;org.apache.dolphinscheduler.server.worker.log.TaskLogAppender&quot;&gt;
&lt;filter class=&quot;ch.qos.logback.classic.filter.ThresholdFilter&quot;&gt; &lt;filter class=&quot;ch.qos.logback.classic.filter.ThresholdFilter&quot;&gt;
&lt;level&gt;INFO&lt;/level&gt; &lt;level&gt;INFO&lt;/level&gt;
&lt;/filter&gt; &lt;/filter&gt;
&lt;filter class=&quot;cn.escheduler.server.worker.log.TaskLogFilter&quot;&gt;&lt;/filter&gt; &lt;filter class=&quot;org.apache.dolphinscheduler.server.worker.log.TaskLogFilter&quot;&gt;&lt;/filter&gt;
&lt;file&gt;${log.base}/{processDefinitionId}/{processInstanceId}/{taskInstanceId}.log&lt;/file&gt; &lt;file&gt;${log.base}/{processDefinitionId}/{processInstanceId}/{taskInstanceId}.log&lt;/file&gt;
&lt;encoder&gt; &lt;encoder&gt;
&lt;pattern&gt; &lt;pattern&gt;
@ -1346,7 +1346,7 @@ worker.reserved.memory=1
&lt;appender name=&quot;WORKERLOGFILE&quot; class=&quot;ch.qos.logback.core.rolling.RollingFileAppender&quot;&gt; &lt;appender name=&quot;WORKERLOGFILE&quot; class=&quot;ch.qos.logback.core.rolling.RollingFileAppender&quot;&gt;
&lt;file&gt;${log.base}/escheduler-worker.log&lt;/file&gt; &lt;file&gt;${log.base}/escheduler-worker.log&lt;/file&gt;
&lt;filter class=&quot;cn.escheduler.server.worker.log.WorkerLogFilter&quot;&gt; &lt;filter class=&quot;org.apache.dolphinscheduler.server.worker.log.WorkerLogFilter&quot;&gt;
&lt;level&gt;INFO&lt;/level&gt; &lt;level&gt;INFO&lt;/level&gt;
&lt;/filter&gt; &lt;/filter&gt;

2
script/create-dolphinscheduler.sh

@ -13,7 +13,7 @@ export ESCHEDULER_LIB_JARS=$ESCHEDULER_HOME/lib/*
export ESCHEDULER_OPTS="-server -Xmx1g -Xms1g -Xss512k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70" export ESCHEDULER_OPTS="-server -Xmx1g -Xms1g -Xss512k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70"
export STOP_TIMEOUT=5 export STOP_TIMEOUT=5
CLASS=cn.escheduler.dao.upgrade.shell.CreateDolphinScheduler CLASS=org.apache.dolphinscheduler.dao.upgrade.shell.CreateDolphinScheduler
exec_command="$ESCHEDULER_OPTS -classpath $ESCHEDULER_CONF_DIR:$ESCHEDULER_LIB_JARS $CLASS" exec_command="$ESCHEDULER_OPTS -classpath $ESCHEDULER_CONF_DIR:$ESCHEDULER_LIB_JARS $CLASS"

10
script/dolphinscheduler-daemon.sh

@ -42,18 +42,18 @@ cd $ESCHEDULER_HOME
if [ "$command" = "api-server" ]; then if [ "$command" = "api-server" ]; then
LOG_FILE="-Dlogging.config=conf/apiserver_logback.xml" LOG_FILE="-Dlogging.config=conf/apiserver_logback.xml"
CLASS=cn.escheduler.api.ApiApplicationServer CLASS=org.apache.dolphinscheduler.api.ApiApplicationServer
elif [ "$command" = "master-server" ]; then elif [ "$command" = "master-server" ]; then
LOG_FILE="-Dspring.config.location=conf/application_master.properties -Ddruid.mysql.usePingMethod=false" LOG_FILE="-Dspring.config.location=conf/application_master.properties -Ddruid.mysql.usePingMethod=false"
CLASS=cn.escheduler.server.master.MasterServer CLASS=org.apache.dolphinscheduler.server.master.MasterServer
elif [ "$command" = "worker-server" ]; then elif [ "$command" = "worker-server" ]; then
LOG_FILE="-Dspring.config.location=conf/application_worker.properties -Ddruid.mysql.usePingMethod=false" LOG_FILE="-Dspring.config.location=conf/application_worker.properties -Ddruid.mysql.usePingMethod=false"
CLASS=cn.escheduler.server.worker.WorkerServer CLASS=org.apache.dolphinscheduler.server.worker.WorkerServer
elif [ "$command" = "alert-server" ]; then elif [ "$command" = "alert-server" ]; then
LOG_FILE="-Dspring.config.location=conf/application_alert.properties -Ddruid.mysql.usePingMethod=false" LOG_FILE="-Dspring.config.location=conf/application_alert.properties -Ddruid.mysql.usePingMethod=false"
CLASS=cn.escheduler.alert.AlertServer CLASS=org.apache.dolphinscheduler.alert.AlertServer
elif [ "$command" = "logger-server" ]; then elif [ "$command" = "logger-server" ]; then
CLASS=cn.escheduler.server.rpc.LoggerServer CLASS=org.apache.dolphinscheduler.server.rpc.LoggerServer
else else
echo "Error: No command named \`$command' was found." echo "Error: No command named \`$command' was found."
exit 1 exit 1

2
script/upgrade-dolphinscheduler.sh

@ -13,7 +13,7 @@ export ESCHEDULER_LIB_JARS=$ESCHEDULER_HOME/lib/*
export ESCHEDULER_OPTS="-server -Xmx1g -Xms1g -Xss512k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70" export ESCHEDULER_OPTS="-server -Xmx1g -Xms1g -Xss512k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70"
export STOP_TIMEOUT=5 export STOP_TIMEOUT=5
CLASS=cn.escheduler.dao.upgrade.shell.UpgradeDolphinScheduler CLASS=org.apache.dolphinscheduler.dao.upgrade.shell.UpgradeDolphinScheduler
exec_command="$ESCHEDULER_OPTS -classpath $ESCHEDULER_CONF_DIR:$ESCHEDULER_LIB_JARS $CLASS" exec_command="$ESCHEDULER_OPTS -classpath $ESCHEDULER_CONF_DIR:$ESCHEDULER_LIB_JARS $CLASS"

Loading…
Cancel
Save