status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
timestamp[us, tz=UTC]
language
stringclasses
5 values
commit_datetime
timestamp[us, tz=UTC]
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,687
[Bug] [dolphinscheduler-api] in the task define,click edit,timeoutStategy status consistent
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened this is null, but not null ![image](https://user-images.githubusercontent.com/61672564/199691514-ecd81f64-93a2-4f00-ba23-511c5e66d909.png) ### What you expected to happen same ### How to reproduce 1. create task 2. in the task define, click edit ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12687
https://github.com/apache/dolphinscheduler/pull/12689
04c6b5e4131c87258e47cdcfb4d5b3f21f9e78e4
641a2559eafd02d95ced7a88c781c9d38379531a
2022-11-03T09:57:36Z
java
2022-11-09T03:48:12Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
for (int i = 0; i < genNum; i++) { taskCodes.add(CodeGenerateUtils.getInstance().genCode()); } } catch (CodeGenerateException e) { logger.error("Generate task definition code error.", e); putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, "Error generating task definition code"); } putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, taskCodes); return result; } /** * release task definition * * @param loginUser login user * @param projectCode project code * @param code task definition code * @param releaseState releaseState * @return update result code */ @Transactional @Override public Map<String, Object> releaseTaskDefinition(User loginUser, long projectCode, long code, ReleaseState releaseState) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, null); Status resultStatus = (Status) result.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,687
[Bug] [dolphinscheduler-api] in the task define,click edit,timeoutStategy status consistent
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened this is null, but not null ![image](https://user-images.githubusercontent.com/61672564/199691514-ecd81f64-93a2-4f00-ba23-511c5e66d909.png) ### What you expected to happen same ### How to reproduce 1. create task 2. in the task define, click edit ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12687
https://github.com/apache/dolphinscheduler/pull/12689
04c6b5e4131c87258e47cdcfb4d5b3f21f9e78e4
641a2559eafd02d95ced7a88c781c9d38379531a
2022-11-03T09:57:36Z
java
2022-11-09T03:48:12Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
return result; } if (null == releaseState) { putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE); return result; } TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(code); if (taskDefinition == null || projectCode != taskDefinition.getProjectCode()) { putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } TaskDefinitionLog taskDefinitionLog = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(code, taskDefinition.getVersion()); if (taskDefinitionLog == null) { logger.error("Task definition does not exist, taskDefinitionCode:{}.", code); putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } switch (releaseState) { case OFFLINE: taskDefinition.setFlag(Flag.NO); taskDefinitionLog.setFlag(Flag.NO); break; case ONLINE: String resourceIds = taskDefinition.getResourceIds(); if (StringUtils.isNotBlank(resourceIds)) { Integer[] resourceIdArray = Arrays.stream(resourceIds.split(",")).map(Integer::parseInt).toArray(Integer[]::new); PermissionCheck<Integer> permissionCheck = new PermissionCheck(AuthorizationType.RESOURCE_FILE_ID, processService, resourceIdArray, loginUser.getId(), logger);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,687
[Bug] [dolphinscheduler-api] in the task define,click edit,timeoutStategy status consistent
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened this is null, but not null ![image](https://user-images.githubusercontent.com/61672564/199691514-ecd81f64-93a2-4f00-ba23-511c5e66d909.png) ### What you expected to happen same ### How to reproduce 1. create task 2. in the task define, click edit ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12687
https://github.com/apache/dolphinscheduler/pull/12689
04c6b5e4131c87258e47cdcfb4d5b3f21f9e78e4
641a2559eafd02d95ced7a88c781c9d38379531a
2022-11-03T09:57:36Z
java
2022-11-09T03:48:12Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
try { permissionCheck.checkPermission(); } catch (Exception e) { logger.error("Resources permission check error, resourceIds:{}.", resourceIds, e); putMsg(result, Status.RESOURCE_NOT_EXIST_OR_NO_PERMISSION); return result; } } taskDefinition.setFlag(Flag.YES); taskDefinitionLog.setFlag(Flag.YES); break; default: logger.warn("Parameter releaseState is invalid."); putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE); return result; } int update = taskDefinitionMapper.updateById(taskDefinition); int updateLog = taskDefinitionLogMapper.updateById(taskDefinitionLog); if ((update == 0 && updateLog == 1) || (update == 1 && updateLog == 0)) { logger.error("Update taskDefinition state or taskDefinitionLog state error, taskDefinitionCode:{}.", code); putMsg(result, Status.UPDATE_TASK_DEFINITION_ERROR); throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR); } logger.error("Update taskDefinition state or taskDefinitionLog state to complete, taskDefinitionCode:{}.", code); putMsg(result, Status.SUCCESS); return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,687
[Bug] [dolphinscheduler-api] in the task define,click edit,timeoutStategy status consistent
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened this is null, but not null ![image](https://user-images.githubusercontent.com/61672564/199691514-ecd81f64-93a2-4f00-ba23-511c5e66d909.png) ### What you expected to happen same ### How to reproduce 1. create task 2. in the task define, click edit ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12687
https://github.com/apache/dolphinscheduler/pull/12689
04c6b5e4131c87258e47cdcfb4d5b3f21f9e78e4
641a2559eafd02d95ced7a88c781c9d38379531a
2022-11-03T09:57:36Z
java
2022-11-09T03:48:12Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskDefinitionVo.java
/* * 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.dolphinscheduler.api.vo; import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation; import org.apache.dolphinscheduler.dao.entity.TaskDefinition; import java.util.List; import lombok.Data; /** * @author fanwanlong */ @Data
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,687
[Bug] [dolphinscheduler-api] in the task define,click edit,timeoutStategy status consistent
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened this is null, but not null ![image](https://user-images.githubusercontent.com/61672564/199691514-ecd81f64-93a2-4f00-ba23-511c5e66d909.png) ### What you expected to happen same ### How to reproduce 1. create task 2. in the task define, click edit ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12687
https://github.com/apache/dolphinscheduler/pull/12689
04c6b5e4131c87258e47cdcfb4d5b3f21f9e78e4
641a2559eafd02d95ced7a88c781c9d38379531a
2022-11-03T09:57:36Z
java
2022-11-09T03:48:12Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskDefinitionVo.java
public class TaskDefinitionVo extends TaskDefinition { /** * process task related list */ private List<ProcessTaskRelation> processTaskRelationList; public TaskDefinitionVo() { } public TaskDefinitionVo(List<ProcessTaskRelation> processTaskRelationList) { this.processTaskRelationList = processTaskRelationList; } public static TaskDefinitionVo fromTaskDefinition(TaskDefinition taskDefinition) { TaskDefinitionVo taskDefinitionVo = new TaskDefinitionVo(); taskDefinitionVo.setId(taskDefinition.getId()); taskDefinitionVo.setCode(taskDefinition.getCode()); taskDefinitionVo.setName(taskDefinition.getName()); taskDefinitionVo.setVersion(taskDefinition.getVersion()); taskDefinitionVo.setDescription(taskDefinition.getDescription()); taskDefinitionVo.setProjectCode(taskDefinition.getProjectCode());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,687
[Bug] [dolphinscheduler-api] in the task define,click edit,timeoutStategy status consistent
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened this is null, but not null ![image](https://user-images.githubusercontent.com/61672564/199691514-ecd81f64-93a2-4f00-ba23-511c5e66d909.png) ### What you expected to happen same ### How to reproduce 1. create task 2. in the task define, click edit ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12687
https://github.com/apache/dolphinscheduler/pull/12689
04c6b5e4131c87258e47cdcfb4d5b3f21f9e78e4
641a2559eafd02d95ced7a88c781c9d38379531a
2022-11-03T09:57:36Z
java
2022-11-09T03:48:12Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskDefinitionVo.java
taskDefinitionVo.setUserId(taskDefinition.getUserId()); taskDefinitionVo.setTaskType(taskDefinition.getTaskType()); taskDefinitionVo.setTaskParams(taskDefinition.getTaskParams()); taskDefinitionVo.setTaskParamList(taskDefinition.getTaskParamList()); taskDefinitionVo.setTaskParamMap(taskDefinition.getTaskParamMap()); taskDefinitionVo.setFlag(taskDefinition.getFlag()); taskDefinitionVo.setTaskPriority(taskDefinition.getTaskPriority()); taskDefinitionVo.setUserName(taskDefinition.getUserName()); taskDefinitionVo.setProjectName(taskDefinition.getProjectName()); taskDefinitionVo.setWorkerGroup(taskDefinition.getWorkerGroup()); taskDefinitionVo.setEnvironmentCode(taskDefinition.getEnvironmentCode()); taskDefinitionVo.setFailRetryTimes(taskDefinition.getFailRetryTimes()); taskDefinitionVo.setFailRetryInterval(taskDefinition.getFailRetryInterval()); taskDefinitionVo.setTimeoutFlag(taskDefinition.getTimeoutFlag()); taskDefinitionVo.setTimeoutNotifyStrategy(taskDefinition.getTimeoutNotifyStrategy()); taskDefinitionVo.setTimeout(taskDefinition.getTimeout()); taskDefinitionVo.setDelayTime(taskDefinition.getDelayTime()); taskDefinitionVo.setResourceIds(taskDefinition.getResourceIds()); taskDefinitionVo.setCreateTime(taskDefinition.getCreateTime()); taskDefinitionVo.setUpdateTime(taskDefinition.getUpdateTime()); taskDefinitionVo.setModifyBy(taskDefinition.getModifyBy()); taskDefinitionVo.setTaskGroupId(taskDefinition.getTaskGroupId()); taskDefinitionVo.setTaskGroupPriority(taskDefinition.getTaskGroupPriority()); taskDefinitionVo.setCpuQuota(taskDefinition.getCpuQuota()); taskDefinitionVo.setMemoryMax(taskDefinition.getMemoryMax()); taskDefinitionVo.setTaskExecuteType(taskDefinition.getTaskExecuteType()); return taskDefinitionVo; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,850
[Improvement][UT] Improve the ut of DataSourceMapperTest
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of DataSourceMapperTest ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12850
https://github.com/apache/dolphinscheduler/pull/12851
2ba5bd47dde2defb90c18dcac4117d19d55b9076
7c711e622f8e5c7efbcbbd349aeb5f117ddab792
2022-11-10T04:06:09Z
java
2022-11-12T15:57:40Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/DataSourceMapperTest.java
/* * 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.dolphinscheduler.dao.mapper;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,850
[Improvement][UT] Improve the ut of DataSourceMapperTest
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of DataSourceMapperTest ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12850
https://github.com/apache/dolphinscheduler/pull/12851
2ba5bd47dde2defb90c18dcac4117d19d55b9076
7c711e622f8e5c7efbcbbd349aeb5f117ddab792
2022-11-10T04:06:09Z
java
2022-11-12T15:57:40Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/DataSourceMapperTest.java
import static java.util.stream.Collectors.toList; import org.apache.dolphinscheduler.common.constants.Constants; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.dao.BaseDaoTest; import org.apache.dolphinscheduler.dao.entity.DataSource; import org.apache.dolphinscheduler.dao.entity.DatasourceUser; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.spi.enums.DbType; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; /** * datasource mapper test */ public class DataSourceMapperTest extends BaseDaoTest { /** * datasource mapper */ @Autowired private DataSourceMapper dataSourceMapper; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,850
[Improvement][UT] Improve the ut of DataSourceMapperTest
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of DataSourceMapperTest ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12850
https://github.com/apache/dolphinscheduler/pull/12851
2ba5bd47dde2defb90c18dcac4117d19d55b9076
7c711e622f8e5c7efbcbbd349aeb5f117ddab792
2022-11-10T04:06:09Z
java
2022-11-12T15:57:40Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/DataSourceMapperTest.java
* datasource user relation mapper */ @Autowired private DataSourceUserMapper dataSourceUserMapper; @Autowired private UserMapper userMapper; /** * test insert */ @Test public void testInsert() { DataSource dataSource = createDataSource(); Assertions.assertTrue(dataSource.getId() > 0); } /** * test query */ @Test public void testSelectById() { DataSource expectedDataSource = createDataSource(); DataSource actualDataSource = dataSourceMapper.selectById(expectedDataSource.getId()); Assertions.assertEquals(expectedDataSource, actualDataSource); } /** * test query */ @Test public void testUpdate() { DataSource expectedDataSource = createDataSource(); expectedDataSource.setName("modify " + expectedDataSource.getName());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,850
[Improvement][UT] Improve the ut of DataSourceMapperTest
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of DataSourceMapperTest ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12850
https://github.com/apache/dolphinscheduler/pull/12851
2ba5bd47dde2defb90c18dcac4117d19d55b9076
7c711e622f8e5c7efbcbbd349aeb5f117ddab792
2022-11-10T04:06:09Z
java
2022-11-12T15:57:40Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/DataSourceMapperTest.java
expectedDataSource.setNote("modifiy " + expectedDataSource.getNote()); expectedDataSource.setUserId(2); expectedDataSource.setType(DbType.HIVE); expectedDataSource.setConnectionParams("modify " + expectedDataSource.getConnectionParams()); expectedDataSource.setUpdateTime(DateUtils.getCurrentDate()); dataSourceMapper.updateById(expectedDataSource); DataSource actualDataSource = dataSourceMapper.selectById(expectedDataSource.getId()); Assertions.assertEquals(expectedDataSource, actualDataSource); } /** * test delete */ @Test public void testDelete() { DataSource expectedDataSource = createDataSource(); dataSourceMapper.deleteById(expectedDataSource.getId()); DataSource actualDataSource = dataSourceMapper.selectById(expectedDataSource.getId()); Assertions.assertNull(actualDataSource); } /** * test query datasource by type */ @Test public void testQueryDataSourceByType() { Integer userId = 1; Map<Integer, DataSource> datasourceMap = createDataSourceMap(userId, "test"); List<DataSource> actualDataSources = dataSourceMapper.queryDataSourceByType( 0, DbType.MYSQL.ordinal(), Constants.TEST_FLAG_NO); Assertions.assertTrue(actualDataSources.size() >= 2); for (DataSource actualDataSource : actualDataSources) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,850
[Improvement][UT] Improve the ut of DataSourceMapperTest
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of DataSourceMapperTest ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12850
https://github.com/apache/dolphinscheduler/pull/12851
2ba5bd47dde2defb90c18dcac4117d19d55b9076
7c711e622f8e5c7efbcbbd349aeb5f117ddab792
2022-11-10T04:06:09Z
java
2022-11-12T15:57:40Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/DataSourceMapperTest.java
DataSource expectedDataSource = datasourceMap.get(actualDataSource.getId()); if (expectedDataSource != null) { Assertions.assertEquals(expectedDataSource, actualDataSource); } } } /** * test page */ @Test public void testSelectPaging() { String name = "test"; Integer userId = 1; Map<Integer, DataSource> expectedDataSourceMap = createDataSourceMap(userId, name); Page page = new Page(0, 4); IPage<DataSource> dataSourceIPage = dataSourceMapper.selectPaging(page, userId, name); List<DataSource> actualDataSources = dataSourceIPage.getRecords(); for (DataSource actualDataSource : actualDataSources) { DataSource expectedDataSource = expectedDataSourceMap.get(actualDataSource.getId()); if (expectedDataSource != null) { Assertions.assertEquals(expectedDataSource, actualDataSource); } } } /** * test query datasource by name */ @Test public void testQueryDataSourceByName() { String name = "test";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,850
[Improvement][UT] Improve the ut of DataSourceMapperTest
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of DataSourceMapperTest ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12850
https://github.com/apache/dolphinscheduler/pull/12851
2ba5bd47dde2defb90c18dcac4117d19d55b9076
7c711e622f8e5c7efbcbbd349aeb5f117ddab792
2022-11-10T04:06:09Z
java
2022-11-12T15:57:40Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/DataSourceMapperTest.java
DataSource expectedDataSource = createDataSource(name); List<DataSource> actualDataSources = dataSourceMapper.queryDataSourceByName(name); for (DataSource actualDataSource : actualDataSources) { if (expectedDataSource.getId().equals(actualDataSource.getId())) { Assertions.assertEquals(expectedDataSource, actualDataSource); } } } /** * test query authed datasource */ @Test public void testQueryAuthedDatasource() { String name = "test"; Integer userId = 1; Map<Integer, DataSource> expectedDataSourceMap = createDataSourceMap(userId, name); List<DataSource> actualDataSources = dataSourceMapper.queryAuthedDatasource(userId); for (DataSource actualDataSource : actualDataSources) { DataSource expectedDataSource = expectedDataSourceMap.get(actualDataSource.getId()); if (expectedDataSource != null) { Assertions.assertEquals(expectedDataSource, actualDataSource); } } } /** * test query datasource except userId */ @Test public void testQueryDatasourceExceptUserId() { String name = "test";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,850
[Improvement][UT] Improve the ut of DataSourceMapperTest
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of DataSourceMapperTest ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12850
https://github.com/apache/dolphinscheduler/pull/12851
2ba5bd47dde2defb90c18dcac4117d19d55b9076
7c711e622f8e5c7efbcbbd349aeb5f117ddab792
2022-11-10T04:06:09Z
java
2022-11-12T15:57:40Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/DataSourceMapperTest.java
Integer userId = 1; Map<Integer, DataSource> expectedDataSourceMap = createDataSourceMap(userId, name); List<DataSource> actualDataSources = dataSourceMapper.queryDatasourceExceptUserId(userId); for (DataSource actualDataSource : actualDataSources) { DataSource expectedDataSource = expectedDataSourceMap.get(actualDataSource.getId()); if (expectedDataSource != null) { Assertions.assertEquals(expectedDataSource, actualDataSource); } } } /** * test list all datasource by type */ @Test public void testListAllDataSourceByType() { Integer count = 1; Map<Integer, DataSource> expectedDataSourceMap = createDataSourceMap(count); List<DataSource> actualDataSources = dataSourceMapper.listAllDataSourceByType(DbType.MYSQL.ordinal()); Assertions.assertTrue(actualDataSources.size() >= count); for (DataSource actualDataSource : actualDataSources) { DataSource expectedDataSource = expectedDataSourceMap.get(actualDataSource.getId()); if (expectedDataSource != null) { Assertions.assertEquals(expectedDataSource, actualDataSource); } } } @Test public void testListAuthorizedDataSource() { User generalUser1 = createGeneralUser("user1");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,850
[Improvement][UT] Improve the ut of DataSourceMapperTest
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of DataSourceMapperTest ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12850
https://github.com/apache/dolphinscheduler/pull/12851
2ba5bd47dde2defb90c18dcac4117d19d55b9076
7c711e622f8e5c7efbcbbd349aeb5f117ddab792
2022-11-10T04:06:09Z
java
2022-11-12T15:57:40Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/DataSourceMapperTest.java
User generalUser2 = createGeneralUser("user2"); DataSource dataSource = createDataSource(generalUser1.getId(), "ds-1"); DataSource unauthorizdDataSource = createDataSource(generalUser2.getId(), "ds-2"); Integer[] dataSourceIds = new Integer[]{dataSource.getId(), unauthorizdDataSource.getId()}; List<DataSource> authorizedDataSource = dataSourceMapper.listAuthorizedDataSource(generalUser1.getId(), dataSourceIds); Assertions.assertEquals(generalUser1.getId().intValue(), dataSource.getUserId()); Assertions.assertNotEquals(generalUser1.getId().intValue(), unauthorizdDataSource.getUserId()); Assertions.assertFalse(authorizedDataSource.stream().map(t -> t.getId()).collect(toList()) .containsAll(Arrays.asList(dataSourceIds))); createUserDataSource(generalUser1, unauthorizdDataSource); authorizedDataSource = dataSourceMapper.listAuthorizedDataSource(generalUser1.getId(), dataSourceIds); Assertions.assertTrue(authorizedDataSource.stream().map(t -> t.getId()).collect(toList()) .containsAll(Arrays.asList(dataSourceIds))); } /** * create datasource relation * @param userId */ private Map<Integer, DataSource> createDataSourceMap(Integer userId, String name) { Map<Integer, DataSource> dataSourceMap = new HashMap<>(); DataSource dataSource = createDataSource(userId, name); dataSourceMap.put(dataSource.getId(), dataSource); DataSource otherDataSource = createDataSource(userId + 1, name + "1"); DatasourceUser datasourceUser = new DatasourceUser(); datasourceUser.setDatasourceId(otherDataSource.getId()); datasourceUser.setUserId(userId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,850
[Improvement][UT] Improve the ut of DataSourceMapperTest
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of DataSourceMapperTest ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12850
https://github.com/apache/dolphinscheduler/pull/12851
2ba5bd47dde2defb90c18dcac4117d19d55b9076
7c711e622f8e5c7efbcbbd349aeb5f117ddab792
2022-11-10T04:06:09Z
java
2022-11-12T15:57:40Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/DataSourceMapperTest.java
datasourceUser.setPerm(7); datasourceUser.setCreateTime(DateUtils.getCurrentDate()); datasourceUser.setUpdateTime(DateUtils.getCurrentDate()); dataSourceUserMapper.insert(datasourceUser); dataSourceMap.put(otherDataSource.getId(), otherDataSource); return dataSourceMap; } /** * create datasource map * @param count datasource count * @return datasource map */ private Map<Integer, DataSource> createDataSourceMap(Integer count) { Map<Integer, DataSource> dataSourceMap = new HashMap<>(); for (int i = 0; i < count; i++) { DataSource dataSource = createDataSource("test"); dataSourceMap.put(dataSource.getId(), dataSource); } return dataSourceMap; } /** * create datasource * @return datasource */ private DataSource createDataSource() { return createDataSource(1, "test"); } /** * create datasource * @param name name
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,850
[Improvement][UT] Improve the ut of DataSourceMapperTest
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of DataSourceMapperTest ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12850
https://github.com/apache/dolphinscheduler/pull/12851
2ba5bd47dde2defb90c18dcac4117d19d55b9076
7c711e622f8e5c7efbcbbd349aeb5f117ddab792
2022-11-10T04:06:09Z
java
2022-11-12T15:57:40Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/DataSourceMapperTest.java
* @return datasource */ private DataSource createDataSource(String name) { return createDataSource(1, name); } /** * create datasource * @param userId userId * @param name name * @return datasource */ private DataSource createDataSource(Integer userId, String name) { Random random = new Random(); DataSource dataSource = new DataSource(); dataSource.setUserId(userId); dataSource.setName(name); dataSource.setType(DbType.MYSQL); dataSource.setNote("mysql test"); dataSource.setConnectionParams("hello mysql"); dataSource.setTestFlag(Constants.TEST_FLAG_NO); dataSource.setUpdateTime(DateUtils.getCurrentDate()); dataSource.setCreateTime(DateUtils.getCurrentDate()); dataSourceMapper.insert(dataSource); return dataSource; } /** * create general user * @return User */ private User createGeneralUser(String userName) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,850
[Improvement][UT] Improve the ut of DataSourceMapperTest
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of DataSourceMapperTest ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12850
https://github.com/apache/dolphinscheduler/pull/12851
2ba5bd47dde2defb90c18dcac4117d19d55b9076
7c711e622f8e5c7efbcbbd349aeb5f117ddab792
2022-11-10T04:06:09Z
java
2022-11-12T15:57:40Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/DataSourceMapperTest.java
User user = new User(); user.setUserName(userName); user.setUserPassword("1"); user.setEmail("[email protected]"); user.setUserType(UserType.GENERAL_USER); user.setCreateTime(new Date()); user.setTenantId(1); user.setUpdateTime(new Date()); userMapper.insert(user); return user; } /** * create the relation of user and data source * * @param user user * @param dataSource data source * @return DatasourceUser */ private DatasourceUser createUserDataSource(User user, DataSource dataSource) { DatasourceUser datasourceUser = new DatasourceUser(); datasourceUser.setDatasourceId(dataSource.getId()); datasourceUser.setUserId(user.getId()); datasourceUser.setPerm(7); datasourceUser.setCreateTime(DateUtils.getCurrentDate()); datasourceUser.setUpdateTime(DateUtils.getCurrentDate()); dataSourceUserMapper.insert(datasourceUser); return datasourceUser; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java
/* * 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.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java
* See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.plugin.alert.dingtalk; import static org.apache.dolphinscheduler.common.constants.Constants.STRING_FALSE; import static org.apache.dolphinscheduler.common.constants.Constants.STRING_NO; import static org.apache.dolphinscheduler.common.constants.Constants.STRING_TRUE; import static org.apache.dolphinscheduler.common.constants.Constants.STRING_YES; import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; import org.apache.dolphinscheduler.spi.params.PasswordParam; import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.params.radio.RadioParam; import java.util.Arrays; import java.util.List; import com.google.auto.service.AutoService; @AutoService(AlertChannelFactory.class) public final class DingTalkAlertChannelFactory implements AlertChannelFactory { @Override public String name() { return "DingTalk"; } @Override public List<PluginParams> params() { InputParam webHookParam = InputParam .newBuilder(DingTalkParamsConstants.NAME_DING_TALK_WEB_HOOK, DingTalkParamsConstants.DING_TALK_WEB_HOOK) .addValidate(Validate.newBuilder()
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java
.setRequired(true) .build()) .build(); InputParam keywordParam = InputParam .newBuilder(DingTalkParamsConstants.NAME_DING_TALK_KEYWORD, DingTalkParamsConstants.DING_TALK_KEYWORD) .addValidate(Validate.newBuilder() .setRequired(false) .build()) .build(); InputParam secretParam = InputParam .newBuilder(DingTalkParamsConstants.NAME_DING_TALK_SECRET, DingTalkParamsConstants.DING_TALK_SECRET) .addValidate(Validate.newBuilder() .setRequired(false) .build()) .build(); RadioParam msgTypeParam = RadioParam .newBuilder(DingTalkParamsConstants.NAME_DING_TALK_MSG_TYPE, DingTalkParamsConstants.DING_TALK_MSG_TYPE) .addParamsOptions(new ParamsOptions(DingTalkParamsConstants.DING_TALK_MSG_TYPE_TEXT, DingTalkParamsConstants.DING_TALK_MSG_TYPE_TEXT, false)) .addParamsOptions(new ParamsOptions(DingTalkParamsConstants.DING_TALK_MSG_TYPE_MARKDOWN, DingTalkParamsConstants.DING_TALK_MSG_TYPE_MARKDOWN, false)) .setValue(DingTalkParamsConstants.DING_TALK_MSG_TYPE_TEXT) .addValidate(Validate.newBuilder() .setRequired(false) .build()) .build(); InputParam atMobilesParam = InputParam .newBuilder(DingTalkParamsConstants.NAME_DING_TALK_AT_MOBILES, DingTalkParamsConstants.DING_TALK_AT_MOBILES) .addValidate(Validate.newBuilder()
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java
.setRequired(false) .build()) .build(); InputParam atUserIdsParam = InputParam .newBuilder(DingTalkParamsConstants.NAME_DING_TALK_AT_USERIDS, DingTalkParamsConstants.DING_TALK_AT_USERIDS) .addValidate(Validate.newBuilder() .setRequired(false) .build()) .build(); RadioParam isAtAll = RadioParam .newBuilder(DingTalkParamsConstants.NAME_DING_TALK_AT_ALL, DingTalkParamsConstants.DING_TALK_AT_ALL) .addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false)) .addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false)) .setValue(STRING_FALSE) .addValidate(Validate.newBuilder() .setRequired(false) .build()) .build(); RadioParam isEnableProxy = RadioParam .newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PROXY_ENABLE, DingTalkParamsConstants.DING_TALK_PROXY_ENABLE) .addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false)) .addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false)) .setValue(STRING_FALSE) .addValidate(Validate.newBuilder() .setRequired(false) .build()) .build(); InputParam proxyParam = InputParam
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java
.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PROXY, DingTalkParamsConstants.DING_TALK_PROXY) .addValidate(Validate.newBuilder() .setRequired(false) .build()) .build(); InputParam portParam = InputParam .newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PORT, DingTalkParamsConstants.DING_TALK_PORT) .addValidate(Validate.newBuilder() .setRequired(false) .build()) .build(); InputParam userParam = InputParam .newBuilder(DingTalkParamsConstants.NAME_DING_TALK_USER, DingTalkParamsConstants.DING_TALK_USER) .addValidate(Validate.newBuilder() .setRequired(false) .build()) .build(); PasswordParam passwordParam = PasswordParam .newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PASSWORD, DingTalkParamsConstants.DING_TALK_PASSWORD) .setPlaceholder("if enable use authentication, you need input password") .build(); return Arrays.asList(webHookParam, keywordParam, secretParam, msgTypeParam, atMobilesParam, atUserIdsParam, isAtAll, isEnableProxy, proxyParam, portParam, userParam, passwordParam); } @Override public AlertChannel create() { return new DingTalkAlertChannel(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java
/* * 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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java
* limitations under the License. */ package org.apache.dolphinscheduler.plugin.alert.email; import static org.apache.dolphinscheduler.common.constants.Constants.STRING_FALSE; import static org.apache.dolphinscheduler.common.constants.Constants.STRING_NO; import static org.apache.dolphinscheduler.common.constants.Constants.STRING_TRUE; import static org.apache.dolphinscheduler.common.constants.Constants.STRING_YES; import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; import org.apache.dolphinscheduler.alert.api.AlertConstants; import org.apache.dolphinscheduler.alert.api.ShowType; import org.apache.dolphinscheduler.spi.params.PasswordParam; import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.params.radio.RadioParam; import java.util.ArrayList; import java.util.List; import com.google.auto.service.AutoService; @AutoService(AlertChannelFactory.class) public final class EmailAlertChannelFactory implements AlertChannelFactory { @Override public String name() { return "Email"; } @Override public List<PluginParams> params() { List<PluginParams> paramsList = new ArrayList<>(); InputParam receivesParam = InputParam
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java
.newBuilder(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, MailParamsConstants.PLUGIN_DEFAULT_EMAIL_RECEIVERS) .setPlaceholder("please input receives") .addValidate(Validate.newBuilder() .setRequired(true) .build()) .build(); InputParam receiveCcsParam = InputParam .newBuilder(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS, MailParamsConstants.PLUGIN_DEFAULT_EMAIL_RECEIVERCCS) .build(); InputParam mailSmtpHost = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_HOST, MailParamsConstants.MAIL_SMTP_HOST) .addValidate(Validate.newBuilder().setRequired(true).build()) .build(); InputParam mailSmtpPort = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_PORT, MailParamsConstants.MAIL_SMTP_PORT) .setValue("25") .addValidate(Validate.newBuilder() .setRequired(true) .build()) .build(); InputParam mailSender = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SENDER, MailParamsConstants.MAIL_SENDER) .addValidate(Validate.newBuilder().setRequired(true).build()) .build(); RadioParam enableSmtpAuth = RadioParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_AUTH, MailParamsConstants.MAIL_SMTP_AUTH) .addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false)) .addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false))
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java
.setValue(STRING_TRUE) .addValidate(Validate.newBuilder().setRequired(true).build()) .build(); InputParam mailUser = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_USER, MailParamsConstants.MAIL_USER) .setPlaceholder("if enable use authentication, you need input user") .build(); PasswordParam mailPassword = PasswordParam.newBuilder(MailParamsConstants.NAME_MAIL_PASSWD, MailParamsConstants.MAIL_PASSWD) .setPlaceholder("if enable use authentication, you need input password") .build(); RadioParam enableTls = RadioParam .newBuilder(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE, MailParamsConstants.MAIL_SMTP_STARTTLS_ENABLE) .addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false)) .addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false)) .setValue(STRING_FALSE) .addValidate(Validate.newBuilder().setRequired(true).build()) .build(); RadioParam enableSsl = RadioParam .newBuilder(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE, MailParamsConstants.MAIL_SMTP_SSL_ENABLE) .addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false)) .addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false)) .setValue(STRING_FALSE) .addValidate(Validate.newBuilder().setRequired(true).build()) .build(); InputParam sslTrust = InputParam .newBuilder(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST, MailParamsConstants.MAIL_SMTP_SSL_TRUST) .setValue("*") .addValidate(Validate.newBuilder().setRequired(true).build()) .build();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java
RadioParam showType = RadioParam.newBuilder(AlertConstants.NAME_SHOW_TYPE, AlertConstants.SHOW_TYPE) .addParamsOptions(new ParamsOptions(ShowType.TABLE.getDescp(), ShowType.TABLE.getDescp(), false)) .addParamsOptions(new ParamsOptions(ShowType.TEXT.getDescp(), ShowType.TEXT.getDescp(), false)) .addParamsOptions( new ParamsOptions(ShowType.ATTACHMENT.getDescp(), ShowType.ATTACHMENT.getDescp(), false)) .addParamsOptions(new ParamsOptions(ShowType.TABLE_ATTACHMENT.getDescp(), ShowType.TABLE_ATTACHMENT.getDescp(), false)) .setValue(ShowType.TABLE.getDescp()) .addValidate(Validate.newBuilder().setRequired(true).build()) .build(); paramsList.add(receivesParam); paramsList.add(receiveCcsParam); paramsList.add(mailSmtpHost); paramsList.add(mailSmtpPort); paramsList.add(mailSender); paramsList.add(enableSmtpAuth); paramsList.add(mailUser); paramsList.add(mailPassword); paramsList.add(enableTls); paramsList.add(enableSsl); paramsList.add(sslTrust); paramsList.add(showType); return paramsList; } @Override public AlertChannel create() { return new EmailAlertChannel(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java
/* * 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.dolphinscheduler.plugin.alert.feishu; import static org.apache.dolphinscheduler.common.constants.Constants.STRING_FALSE; import static org.apache.dolphinscheduler.common.constants.Constants.STRING_NO; import static org.apache.dolphinscheduler.common.constants.Constants.STRING_TRUE; import static org.apache.dolphinscheduler.common.constants.Constants.STRING_YES; import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; import org.apache.dolphinscheduler.spi.params.PasswordParam;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java
import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.params.radio.RadioParam; import java.util.Arrays; import java.util.List; import com.google.auto.service.AutoService; @AutoService(AlertChannelFactory.class) public final class FeiShuAlertChannelFactory implements AlertChannelFactory { @Override public String name() { return "Feishu"; } @Override public List<PluginParams> params() { InputParam webHookParam = InputParam.newBuilder(FeiShuParamsConstants.NAME_WEB_HOOK, FeiShuParamsConstants.WEB_HOOK) .addValidate(Validate.newBuilder() .setRequired(true) .build()) .build(); RadioParam isEnableProxy = RadioParam .newBuilder(FeiShuParamsConstants.NAME_FEI_SHU_PROXY_ENABLE, FeiShuParamsConstants.FEI_SHU_PROXY_ENABLE) .addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false)) .addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false)) .setValue(STRING_TRUE) .addValidate(Validate.newBuilder()
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java
.setRequired(false) .build()) .build(); InputParam proxyParam = InputParam.newBuilder(FeiShuParamsConstants.NAME_FEI_SHU_PROXY, FeiShuParamsConstants.FEI_SHU_PROXY) .addValidate(Validate.newBuilder() .setRequired(false).build()) .build(); InputParam portParam = InputParam.newBuilder(FeiShuParamsConstants.NAME_FEI_SHU_PORT, FeiShuParamsConstants.FEI_SHU_PORT) .addValidate(Validate.newBuilder() .setRequired(false).build()) .build(); InputParam userParam = InputParam.newBuilder(FeiShuParamsConstants.NAME_FEI_SHU_USER, FeiShuParamsConstants.FEI_SHU_USER) .addValidate(Validate.newBuilder() .setRequired(false).build()) .build(); PasswordParam passwordParam = PasswordParam .newBuilder(FeiShuParamsConstants.NAME_FEI_SHU_PASSWORD, FeiShuParamsConstants.FEI_SHU_PASSWORD) .setPlaceholder("if enable use authentication, you need input password") .build(); return Arrays.asList(webHookParam, isEnableProxy, proxyParam, portParam, userParam, passwordParam); } @Override public AlertChannel create() { return new FeiShuAlertChannel(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java
/* * 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.dolphinscheduler.plugin.alert.http; import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; import org.apache.dolphinscheduler.spi.params.input.InputParam; import java.util.Arrays; import java.util.List; import com.google.auto.service.AutoService; @AutoService(AlertChannelFactory.class)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java
public final class HttpAlertChannelFactory implements AlertChannelFactory { @Override public String name() { return "Http"; } @Override public List<PluginParams> params() { InputParam url = InputParam.newBuilder(HttpAlertConstants.NAME_URL, HttpAlertConstants.URL) .setPlaceholder("input request URL") .addValidate(Validate.newBuilder() .setRequired(true) .build()) .build(); InputParam headerParams = InputParam.newBuilder(HttpAlertConstants.NAME_HEADER_PARAMS, HttpAlertConstants.HEADER_PARAMS) .setPlaceholder("input request headers as JSON format ") .addValidate(Validate.newBuilder() .setRequired(true) .build())
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java
.build(); InputParam bodyParams = InputParam.newBuilder(HttpAlertConstants.NAME_BODY_PARAMS, HttpAlertConstants.BODY_PARAMS) .setPlaceholder("input request body as JSON format ") .addValidate(Validate.newBuilder() .setRequired(false) .build()) .build(); InputParam contentField = InputParam.newBuilder(HttpAlertConstants.NAME_CONTENT_FIELD, HttpAlertConstants.CONTENT_FIELD) .setPlaceholder("input alert msg field name") .addValidate(Validate.newBuilder() .setRequired(true) .build()) .build(); InputParam requestType = InputParam.newBuilder(HttpAlertConstants.NAME_REQUEST_TYPE, HttpAlertConstants.REQUEST_TYPE) .setPlaceholder("input request type POST or GET") .addValidate(Validate.newBuilder() .setRequired(true) .build()) .build(); return Arrays.asList(url, requestType, headerParams, bodyParams, contentField); } @Override public AlertChannel create() { return new HttpAlertChannel(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java
/* * 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.dolphinscheduler.plugin.alert.script; import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.params.radio.RadioParam; import java.util.Arrays; import java.util.List; import com.google.auto.service.AutoService; @AutoService(AlertChannelFactory.class)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java
public final class ScriptAlertChannelFactory implements AlertChannelFactory { @Override public String name() { return "Script"; } @Override public List<PluginParams> params() { InputParam scriptUserParam = InputParam
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java
.newBuilder(ScriptParamsConstants.NAME_SCRIPT_USER_PARAMS, ScriptParamsConstants.SCRIPT_USER_PARAMS) .addValidate(Validate.newBuilder() .setRequired(false) .build()) .setPlaceholder( "please enter your custom parameters, which will be passed to you when calling your script") .build(); InputParam scriptPathParam = InputParam.newBuilder(ScriptParamsConstants.NAME_SCRIPT_PATH, ScriptParamsConstants.SCRIPT_PATH) .addValidate(Validate.newBuilder() .setRequired(true) .build()) .setPlaceholder("please upload the file to the disk directory of the alert server," + " and ensure that the path is absolute and has the corresponding access rights") .build(); RadioParam scriptTypeParams = RadioParam .newBuilder(ScriptParamsConstants.NAME_SCRIPT_TYPE, ScriptParamsConstants.SCRIPT_TYPE) .addParamsOptions(new ParamsOptions(ScriptType.SHELL.getDescp(), ScriptType.SHELL.getDescp(), false)) .setValue(ScriptType.SHELL.getDescp()) .addValidate(Validate.newBuilder().setRequired(true).build()) .build(); return Arrays.asList(scriptUserParam, scriptPathParam, scriptTypeParams); } @Override public AlertChannel create() { return new ScriptAlertChannel(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactory.java
/* * 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.dolphinscheduler.plugin.alert.slack; import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; import org.apache.dolphinscheduler.spi.params.input.InputParam; import java.util.LinkedList; import java.util.List; import com.google.auto.service.AutoService; @AutoService(AlertChannelFactory.class) public final class SlackAlertChannelFactory implements AlertChannelFactory {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactory.java
@Override public String name() { return "Slack"; } @Override public List<PluginParams> params() { List<PluginParams> paramsList = new LinkedList<>(); InputParam webHookParam = InputParam .newBuilder(SlackParamsConstants.SLACK_WEB_HOOK_URL_NAME, SlackParamsConstants.SLACK_WEB_HOOK_URL) .addValidate(Validate.newBuilder() .setRequired(true) .build()) .setPlaceholder("Input WebHook Url") .build(); InputParam botName = InputParam.newBuilder(SlackParamsConstants.SLACK_BOT_NAME, SlackParamsConstants.SLACK_BOT) .addValidate(Validate.newBuilder() .setRequired(true) .build()) .setPlaceholder("Input the bot username") .build(); paramsList.add(webHookParam); paramsList.add(botName); return paramsList; } @Override public AlertChannel create() { return new SlackAlertChannel(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-telegram/src/main/java/org/apache/dolphinscheduler/plugin/alert/telegram/TelegramAlertChannelFactory.java
/* * 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.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-telegram/src/main/java/org/apache/dolphinscheduler/plugin/alert/telegram/TelegramAlertChannelFactory.java
* 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.dolphinscheduler.plugin.alert.telegram; import static org.apache.dolphinscheduler.common.constants.Constants.STRING_FALSE; import static org.apache.dolphinscheduler.common.constants.Constants.STRING_NO; import static org.apache.dolphinscheduler.common.constants.Constants.STRING_TRUE; import static org.apache.dolphinscheduler.common.constants.Constants.STRING_YES; import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; import org.apache.dolphinscheduler.spi.params.PasswordParam; import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.params.radio.RadioParam; import org.apache.dolphinscheduler.spi.params.select.SelectParam; import java.util.Arrays; import java.util.List; import com.google.auto.service.AutoService; @AutoService(AlertChannelFactory.class)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-telegram/src/main/java/org/apache/dolphinscheduler/plugin/alert/telegram/TelegramAlertChannelFactory.java
public final class TelegramAlertChannelFactory implements AlertChannelFactory { @Override public String name() { return "Telegram"; } @Override public AlertChannel create() { return new TelegramAlertChannel(); } @Override public List<PluginParams> params() { InputParam webHookParam = InputParam .newBuilder(TelegramParamsConstants.NAME_TELEGRAM_WEB_HOOK, TelegramParamsConstants.TELEGRAM_WEB_HOOK) .addValidate(Validate.newBuilder() .setRequired(true) .build()) .setPlaceholder("telegram web hook") .build(); InputParam botTokenParam = InputParam .newBuilder(TelegramParamsConstants.NAME_TELEGRAM_BOT_TOKEN, TelegramParamsConstants.TELEGRAM_BOT_TOKEN) .addValidate(Validate.newBuilder() .setRequired(true) .build()) .setPlaceholder("telegram bot token") .build(); InputParam chatIdParam = InputParam .newBuilder(TelegramParamsConstants.NAME_TELEGRAM_CHAT_ID, TelegramParamsConstants.TELEGRAM_CHAT_ID) .addValidate(Validate.newBuilder()
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-telegram/src/main/java/org/apache/dolphinscheduler/plugin/alert/telegram/TelegramAlertChannelFactory.java
.setRequired(true) .build()) .setPlaceholder("telegram channel chat id") .build(); SelectParam parseMode = SelectParam .newBuilder(TelegramParamsConstants.NAME_TELEGRAM_PARSE_MODE, TelegramParamsConstants.TELEGRAM_PARSE_MODE) .addOptions(new ParamsOptions(TelegramAlertConstants.PARSE_MODE_TXT, TelegramAlertConstants.PARSE_MODE_TXT, false)) .addOptions(new ParamsOptions(TelegramAlertConstants.PARSE_MODE_MARKDOWN, TelegramAlertConstants.PARSE_MODE_MARKDOWN, false)) .addOptions(new ParamsOptions(TelegramAlertConstants.PARSE_MODE_MARKDOWN_V2, TelegramAlertConstants.PARSE_MODE_MARKDOWN_V2, false)) .addOptions(new ParamsOptions(TelegramAlertConstants.PARSE_MODE_HTML, TelegramAlertConstants.PARSE_MODE_HTML, false)) .setValue(TelegramAlertConstants.PARSE_MODE_TXT) .addValidate(Validate.newBuilder() .setRequired(true) .build()) .build(); RadioParam isEnableProxy = RadioParam .newBuilder(TelegramParamsConstants.NAME_TELEGRAM_PROXY_ENABLE, TelegramParamsConstants.TELEGRAM_PROXY_ENABLE) .addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false)) .addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false)) .setValue(STRING_FALSE) .addValidate(Validate.newBuilder() .setRequired(false) .build()) .build();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-telegram/src/main/java/org/apache/dolphinscheduler/plugin/alert/telegram/TelegramAlertChannelFactory.java
InputParam proxyParam = InputParam .newBuilder(TelegramParamsConstants.NAME_TELEGRAM_PROXY, TelegramParamsConstants.TELEGRAM_PROXY) .addValidate(Validate.newBuilder() .setRequired(false) .build()) .build(); InputParam portParam = InputParam.newBuilder(TelegramParamsConstants.NAME_TELEGRAM_PORT, TelegramParamsConstants.TELEGRAM_PORT) .addValidate(Validate.newBuilder() .setRequired(false) .build()) .build(); InputParam userParam = InputParam.newBuilder(TelegramParamsConstants.NAME_TELEGRAM_USER, TelegramParamsConstants.TELEGRAM_USER) .addValidate(Validate.newBuilder() .setRequired(false) .build()) .build(); PasswordParam passwordParam = PasswordParam .newBuilder(TelegramParamsConstants.NAME_TELEGRAM_PASSWORD, TelegramParamsConstants.TELEGRAM_PASSWORD) .addValidate(Validate.newBuilder() .setRequired(false) .build()) .setPlaceholder("if enable use authentication, you need input password") .build(); return Arrays.asList(webHookParam, botTokenParam, chatIdParam, parseMode, isEnableProxy, proxyParam, portParam, userParam, passwordParam); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-webexteams/src/main/java/org/apache/dolphinscheduler/plugin/alert/webexteams/WebexTeamsAlertChannelFactory.java
/* * 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.dolphinscheduler.plugin.alert.webexteams; import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.params.radio.RadioParam; import java.util.ArrayList; import java.util.List; import com.google.auto.service.AutoService; @AutoService(AlertChannelFactory.class)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-webexteams/src/main/java/org/apache/dolphinscheduler/plugin/alert/webexteams/WebexTeamsAlertChannelFactory.java
public final class WebexTeamsAlertChannelFactory implements AlertChannelFactory { @Override public String name() { return "WebexTeams"; } @Override public List<PluginParams> params() { List<PluginParams> paramsList = new ArrayList<>(); InputParam botAccessToken = InputParam .newBuilder(WebexTeamsParamsConstants.NAME_WEBEX_TEAMS_BOT_ACCESS_TOKEN, WebexTeamsParamsConstants.WEBEX_TEAMS_BOT_ACCESS_TOKEN) .setPlaceholder("Please enter the robot's access token you were given") .addValidate(Validate.newBuilder() .setRequired(true)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-webexteams/src/main/java/org/apache/dolphinscheduler/plugin/alert/webexteams/WebexTeamsAlertChannelFactory.java
.build()) .build(); InputParam roomId = InputParam .newBuilder(WebexTeamsParamsConstants.NAME_WEBEX_TEAMS_ROOM_ID, WebexTeamsParamsConstants.WEBEX_TEAMS_ROOM_ID) .setPlaceholder("The room ID of the message") .addValidate(Validate.newBuilder() .setRequired(false) .build()) .build(); InputParam toPersonId = InputParam .newBuilder(WebexTeamsParamsConstants.NAME_WEBEX_TEAMS_TO_PERSON_ID, WebexTeamsParamsConstants.WEBEX_TEAMS_TO_PERSON_ID) .setPlaceholder("The person ID of the message recipient") .addValidate(Validate.newBuilder() .setRequired(false) .build()) .build(); InputParam toPersonEmail = InputParam .newBuilder(WebexTeamsParamsConstants.NAME_WEBEX_TEAMS_TO_PERSON_EMAIL, WebexTeamsParamsConstants.WEBEX_TEAMS_TO_PERSON_EMAIL) .setPlaceholder("The email address of the message recipient") .addValidate(Validate.newBuilder() .setRequired(false) .build()) .build(); InputParam atSomeoneInRoom = InputParam .newBuilder(WebexTeamsParamsConstants.NAME_WEBEX_TEAMS_AT_SOMEONE_IN_ROOM, WebexTeamsParamsConstants.WEBEX_TEAMS_AT_SOMEONE_IN_ROOM) .setPlaceholder("use ,(eng commas) to separate multiple emails")
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-webexteams/src/main/java/org/apache/dolphinscheduler/plugin/alert/webexteams/WebexTeamsAlertChannelFactory.java
.addValidate(Validate.newBuilder() .setRequired(false) .build()) .build(); RadioParam destination = RadioParam .newBuilder(WebexTeamsParamsConstants.NAME_WEBEX_TEAMS_DESTINATION, WebexTeamsParamsConstants.WEBEX_TEAMS_DESTINATION) .addParamsOptions(new ParamsOptions(WebexTeamsDestination.ROOM_ID.getDescp(), WebexTeamsDestination.ROOM_ID.getDescp(), false)) .addParamsOptions(new ParamsOptions(WebexTeamsDestination.PERSON_EMAIL.getDescp(), WebexTeamsDestination.PERSON_EMAIL.getDescp(), false)) .addParamsOptions(new ParamsOptions(WebexTeamsDestination.PERSON_ID.getDescp(), WebexTeamsDestination.PERSON_ID.getDescp(), false)) .setValue(WebexTeamsDestination.ROOM_ID.getDescp()) .addValidate(Validate.newBuilder().setRequired(true).build()) .build(); paramsList.add(botAccessToken); paramsList.add(roomId); paramsList.add(toPersonId); paramsList.add(toPersonEmail); paramsList.add(atSomeoneInRoom); paramsList.add(destination); return paramsList; } @Override public AlertChannel create() { return new WebexTeamsAlertChannel(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactory.java
/* * 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.dolphinscheduler.plugin.alert.wechat; import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; import org.apache.dolphinscheduler.alert.api.AlertConstants; import org.apache.dolphinscheduler.alert.api.ShowType; import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.params.radio.RadioParam; import java.util.Arrays; import java.util.List; import com.google.auto.service.AutoService; @AutoService(AlertChannelFactory.class)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactory.java
public final class WeChatAlertChannelFactory implements AlertChannelFactory { @Override
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactory.java
public String name() { return "WeChat"; } @Override public List<PluginParams> params() { InputParam corpIdParam = InputParam .newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_CORP_ID, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_CORP_ID) .setPlaceholder("please input corp id ") .addValidate(Validate.newBuilder() .setRequired(true) .build()) .build(); InputParam secretParam = InputParam .newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_SECRET, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_SECRET) .setPlaceholder("please input secret ") .addValidate(Validate.newBuilder() .setRequired(true) .build()) .build(); InputParam usersParam = InputParam .newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_USERS, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_USERS) .setPlaceholder("use `|` to separate userIds and `@all` to everyone ") .addValidate(Validate.newBuilder() .setRequired(false) .build()) .build(); InputParam agentIdParam = InputParam
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,865
[Bug] [Alert] translate alert input field tips to chinese when using chinese
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened the alert input field tips is in English when the UI using Chinese as language. ![image](https://user-images.githubusercontent.com/36755957/201279618-25a33cee-a425-4a81-bb6e-acf2f12fb02b.png) ### What you expected to happen the input field tips should be Chinese when using the language ### How to reproduce check alert instance page ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12865
https://github.com/apache/dolphinscheduler/pull/12879
403c6a6bb6ec9fc380ffd763301891ad57029e2b
250d81bcf81bc4432f832197e1f96ad440944d5d
2022-11-11T06:45:13Z
java
2022-11-14T03:14:14Z
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactory.java
.newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_AGENT_ID, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_AGENT_ID) .setPlaceholder("please input agent id or chat id ") .addValidate(Validate.newBuilder() .setRequired(true) .build()) .build(); RadioParam sendType = RadioParam .newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_SEND_TYPE, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_SEND_TYPE) .addParamsOptions(new ParamsOptions(WeChatType.APP.getDescp(), WeChatType.APP.getDescp(), false)) .addParamsOptions( new ParamsOptions(WeChatType.APPCHAT.getDescp(), WeChatType.APPCHAT.getDescp(), false)) .setValue(WeChatType.APP.getDescp()) .addValidate(Validate.newBuilder().setRequired(true).build()) .build(); RadioParam showType = RadioParam.newBuilder(AlertConstants.NAME_SHOW_TYPE, AlertConstants.SHOW_TYPE) .addParamsOptions(new ParamsOptions(ShowType.MARKDOWN.getDescp(), ShowType.MARKDOWN.getDescp(), false)) .addParamsOptions(new ParamsOptions(ShowType.TEXT.getDescp(), ShowType.TEXT.getDescp(), false)) .setValue(ShowType.MARKDOWN.getDescp()) .addValidate(Validate.newBuilder().setRequired(true).build()) .build(); return Arrays.asList(corpIdParam, secretParam, usersParam, agentIdParam, sendType, showType); } @Override public AlertChannel create() { return new WeChatAlertChannel(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java
/* * 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,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java
* 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.dolphinscheduler.api.service.impl; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKER_GROUP_CREATE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKER_GROUP_DELETE; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.WorkerGroupService; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.constants.Constants; import org.apache.dolphinscheduler.common.enums.AuthorizationType; import org.apache.dolphinscheduler.common.enums.NodeType; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.dao.entity.EnvironmentWorkerGroupRelation; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.entity.WorkerGroup; import org.apache.dolphinscheduler.dao.mapper.EnvironmentWorkerGroupRelationMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper; import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper; import org.apache.dolphinscheduler.dao.mapper.WorkerGroupMapper; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.registry.RegistryClient; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import java.util.ArrayList;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java
import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.facebook.presto.jdbc.internal.guava.base.Strings; /** * worker group service impl */ @Service public class WorkerGroupServiceImpl extends BaseServiceImpl implements WorkerGroupService { private static final Logger logger = LoggerFactory.getLogger(WorkerGroupServiceImpl.class); @Autowired private WorkerGroupMapper workerGroupMapper; @Autowired private ProcessInstanceMapper processInstanceMapper; @Autowired private RegistryClient registryClient; @Autowired private EnvironmentWorkerGroupRelationMapper environmentWorkerGroupRelationMapper; @Autowired
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java
private ProcessService processService; @Autowired private ScheduleMapper scheduleMapper; /** * create or update a worker group * * @param loginUser login user * @param id worker group id * @param name worker group name * @param addrList addr list * @return create or update result code */ @Override @Transactional public Map<String, Object> saveWorkerGroup(User loginUser, int id, String name, String addrList, String description, String otherParamsJson) { Map<String, Object> result = new HashMap<>(); if (!canOperatorPermissions(loginUser, null, AuthorizationType.WORKER_GROUP, WORKER_GROUP_CREATE)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } if (StringUtils.isEmpty(name)) { logger.warn("Parameter name can ot be null."); putMsg(result, Status.NAME_NULL); return result; } Date now = new Date(); WorkerGroup workerGroup; if (id != 0) { workerGroup = workerGroupMapper.selectById(id);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java
if (workerGroup == null) { workerGroup = new WorkerGroup(); workerGroup.setCreateTime(now); } } else { workerGroup = new WorkerGroup(); workerGroup.setCreateTime(now); } workerGroup.setName(name); workerGroup.setAddrList(addrList); workerGroup.setUpdateTime(now); workerGroup.setDescription(description); if (checkWorkerGroupNameExists(workerGroup)) { logger.warn("Worker group with the same name already exists, name:{}.", workerGroup.getName()); putMsg(result, Status.NAME_EXIST, workerGroup.getName()); return result; } String invalidAddr = checkWorkerGroupAddrList(workerGroup); if (invalidAddr != null) { logger.warn("Worker group address is invalid, invalidAddr:{}.", invalidAddr); putMsg(result, Status.WORKER_ADDRESS_INVALID, invalidAddr); return result; } handleDefaultWorkGroup(workerGroupMapper, workerGroup, loginUser, otherParamsJson); logger.info("Worker group save complete, workerGroupName:{}.", workerGroup.getName()); putMsg(result, Status.SUCCESS); return result; } protected void handleDefaultWorkGroup(WorkerGroupMapper workerGroupMapper, WorkerGroup workerGroup, User loginUser,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java
String otherParamsJson) { if (workerGroup.getId() != null) { workerGroupMapper.updateById(workerGroup); } else { workerGroupMapper.insert(workerGroup); permissionPostHandle(AuthorizationType.WORKER_GROUP, loginUser.getId(), Collections.singletonList(workerGroup.getId()), logger); } } /** * check worker group name exists * * @param workerGroup worker group * @return boolean */ private boolean checkWorkerGroupNameExists(WorkerGroup workerGroup) { List<WorkerGroup> workerGroupList = workerGroupMapper.queryWorkerGroupByName(workerGroup.getName()); if (CollectionUtils.isNotEmpty(workerGroupList)) { if (workerGroup.getId() == null) { return true; } for (WorkerGroup group : workerGroupList) { if (Objects.equals(group.getId(), workerGroup.getId())) { return true; } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java
String workerGroupPath = Constants.REGISTRY_DOLPHINSCHEDULER_WORKERS + Constants.SINGLE_SLASH + workerGroup.getName(); return registryClient.exists(workerGroupPath); } /** * check worker group addr list * * @param workerGroup worker group * @return boolean */ private String checkWorkerGroupAddrList(WorkerGroup workerGroup) { if (Strings.isNullOrEmpty(workerGroup.getAddrList())) { return null; } Map<String, String> serverMaps = registryClient.getServerMaps(NodeType.WORKER); for (String addr : workerGroup.getAddrList().split(Constants.COMMA)) { if (!serverMaps.containsKey(addr)) { return addr; } } return null; } /** * query worker group paging * * @param loginUser login user * @param pageNo page number * @param searchVal search value * @param pageSize page size * @return worker group list page
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java
*/ @Override public Result queryAllGroupPaging(User loginUser, Integer pageNo, Integer pageSize, String searchVal) { int fromIndex = (pageNo - 1) * pageSize; int toIndex = (pageNo - 1) * pageSize + pageSize; Result result = new Result(); List<WorkerGroup> workerGroups; if (loginUser.getUserType().equals(UserType.ADMIN_USER)) { workerGroups = getWorkerGroups(null); } else { Set<Integer> ids = resourcePermissionCheckService .userOwnedResourceIdsAcquisition(AuthorizationType.WORKER_GROUP, loginUser.getId(), logger); workerGroups = getWorkerGroups(ids.isEmpty() ? Collections.emptyList() : new ArrayList<>(ids)); } List<WorkerGroup> resultDataList = new ArrayList<>(); int total = 0; if (CollectionUtils.isNotEmpty(workerGroups)) { List<WorkerGroup> searchValDataList = new ArrayList<>(); if (!StringUtils.isEmpty(searchVal)) { for (WorkerGroup workerGroup : workerGroups) { if (workerGroup.getName().contains(searchVal)) { searchValDataList.add(workerGroup); } } } else { searchValDataList = workerGroups; } total = searchValDataList.size();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java
if (fromIndex < searchValDataList.size()) { if (toIndex > searchValDataList.size()) { toIndex = searchValDataList.size(); } resultDataList = searchValDataList.subList(fromIndex, toIndex); } } PageInfo<WorkerGroup> pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotal(total); pageInfo.setTotalList(resultDataList); result.setData(pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * query all worker group * * @param loginUser * @return all worker group list */ @Override public Map<String, Object> queryAllGroup(User loginUser) { Map<String, Object> result = new HashMap<>(); List<WorkerGroup> workerGroups; if (loginUser.getUserType().equals(UserType.ADMIN_USER)) { workerGroups = getWorkerGroups(null); } else { Set<Integer> ids = resourcePermissionCheckService .userOwnedResourceIdsAcquisition(AuthorizationType.WORKER_GROUP, loginUser.getId(), logger); workerGroups = getWorkerGroups(ids.isEmpty() ? Collections.emptyList() : new ArrayList<>(ids));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java
} List<String> availableWorkerGroupList = workerGroups.stream() .map(WorkerGroup::getName) .collect(Collectors.toList()); result.put(Constants.DATA_LIST, availableWorkerGroupList); putMsg(result, Status.SUCCESS); return result; } /** * get worker groups * * @return WorkerGroup list */ private List<WorkerGroup> getWorkerGroups(List<Integer> ids) { List<WorkerGroup> workerGroups; if (ids != null) { workerGroups = ids.isEmpty() ? new ArrayList<>() : workerGroupMapper.selectBatchIds(ids); } else { workerGroups = workerGroupMapper.queryAllWorkerGroup(); } Optional<Boolean> containDefaultWorkerGroups = workerGroups.stream() .map(workerGroup -> Constants.DEFAULT_WORKER_GROUP.equals(workerGroup.getName())).findAny(); if (!containDefaultWorkerGroups.isPresent() || !containDefaultWorkerGroups.get()) { Set<String> activeWorkerNodes = registryClient.getServerNodeSet(NodeType.WORKER); WorkerGroup defaultWorkerGroup = new WorkerGroup(); defaultWorkerGroup.setName(Constants.DEFAULT_WORKER_GROUP); defaultWorkerGroup.setAddrList(String.join(Constants.COMMA, activeWorkerNodes)); defaultWorkerGroup.setCreateTime(new Date());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java
defaultWorkerGroup.setUpdateTime(new Date()); defaultWorkerGroup.setSystemDefault(true); workerGroups.add(defaultWorkerGroup); } return workerGroups; } /** * delete worker group by id * * @param id worker group id * @return delete result code */ @Override @Transactional public Map<String, Object> deleteWorkerGroupById(User loginUser, Integer id) { Map<String, Object> result = new HashMap<>(); if (!canOperatorPermissions(loginUser, null, AuthorizationType.WORKER_GROUP, WORKER_GROUP_DELETE)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } WorkerGroup workerGroup = workerGroupMapper.selectById(id); if (workerGroup == null) { logger.error("Worker group does not exist, workerGroupId:{}.", id); putMsg(result, Status.DELETE_WORKER_GROUP_NOT_EXIST); return result; } List<ProcessInstance> processInstances = processInstanceMapper .queryByWorkerGroupNameAndStatus(workerGroup.getName(), org.apache.dolphinscheduler.service.utils.Constants.NOT_TERMINATED_STATES); if (CollectionUtils.isNotEmpty(processInstances)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java
List<Integer> processInstanceIds = processInstances.stream().map(ProcessInstance::getId).collect(Collectors.toList()); logger.warn( "Delete worker group failed because there are {} processInstances are using it, processInstanceIds:{}.", processInstances.size(), processInstanceIds); putMsg(result, Status.DELETE_WORKER_GROUP_BY_ID_FAIL, processInstances.size()); return result; } List<EnvironmentWorkerGroupRelation> environmentWorkerGroupRelationList = environmentWorkerGroupRelationMapper.queryByWorkerGroupName(workerGroup.getName()); if (CollectionUtils.isNotEmpty(environmentWorkerGroupRelationList)) { putMsg(result, Status.DELETE_WORKER_GROUP_BY_ID_FAIL_ENV, environmentWorkerGroupRelationList.size(), workerGroup.getName()); return result; } workerGroupMapper.deleteById(id); processInstanceMapper.updateProcessInstanceByWorkerGroupName(workerGroup.getName(), ""); logger.info("Delete worker group complete, workerGroupName:{}.", workerGroup.getName()); putMsg(result, Status.SUCCESS); return result; } /** * query all worker address list * * @return all worker address list */ @Override public Map<String, Object> getWorkerAddressList() { Map<String, Object> result = new HashMap<>(); Set<String> serverNodeList = registryClient.getServerNodeSet(NodeType.WORKER);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java
result.put(Constants.DATA_LIST, serverNodeList); putMsg(result, Status.SUCCESS); return result; } @Override public String getTaskWorkerGroup(TaskInstance taskInstance) { if (taskInstance == null) { return null; } String workerGroup = taskInstance.getWorkerGroup(); if (StringUtils.isNotEmpty(workerGroup)) { return workerGroup; } int processInstanceId = taskInstance.getProcessInstanceId(); ProcessInstance processInstance = processService.findProcessInstanceById(processInstanceId); if (processInstance != null) { return processInstance.getWorkerGroup(); } logger.info("task : {} will use default worker group", taskInstance.getId()); return Constants.DEFAULT_WORKER_GROUP; } @Override public Map<Long, String> queryWorkerGroupByProcessDefinitionCodes(List<Long> processDefinitionCodeList) { List<Schedule> processDefinitionScheduleList = scheduleMapper.querySchedulesByProcessDefinitionCodes(processDefinitionCodeList); return processDefinitionScheduleList.stream().collect(Collectors.toMap(Schedule::getProcessDefinitionCode, Schedule::getWorkerGroup)); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkerGroupServiceTest.java
/* * 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.dolphinscheduler.api.service; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKER_GROUP_CREATE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKER_GROUP_DELETE; import static org.mockito.ArgumentMatchers.any; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.permission.ResourcePermissionCheckService; import org.apache.dolphinscheduler.api.service.impl.BaseServiceImpl; import org.apache.dolphinscheduler.api.service.impl.WorkerGroupServiceImpl; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.constants.Constants;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkerGroupServiceTest.java
import org.apache.dolphinscheduler.common.enums.AuthorizationType; import org.apache.dolphinscheduler.common.enums.NodeType; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.entity.WorkerGroup; import org.apache.dolphinscheduler.dao.mapper.EnvironmentWorkerGroupRelationMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper; import org.apache.dolphinscheduler.dao.mapper.WorkerGroupMapper; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.registry.RegistryClient; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; import org.mockito.junit.jupiter.MockitoSettings; import org.mockito.quality.Strictness; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @ExtendWith(MockitoExtension.class)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkerGroupServiceTest.java
@MockitoSettings(strictness = Strictness.LENIENT) public class WorkerGroupServiceTest { private static final Logger logger = LoggerFactory.getLogger(WorkerGroupServiceTest.class); private static final Logger baseServiceLogger = LoggerFactory.getLogger(BaseServiceImpl.class); private static final Logger serviceLogger = LoggerFactory.getLogger(WorkerGroupService.class); @InjectMocks private WorkerGroupServiceImpl workerGroupService; @Mock private WorkerGroupMapper workerGroupMapper; @Mock private ProcessInstanceMapper processInstanceMapper; @Mock private ProcessService processService; @Mock private RegistryClient registryClient; @Mock private ResourcePermissionCheckService resourcePermissionCheckService; @Mock private EnvironmentWorkerGroupRelationMapper environmentWorkerGroupRelationMapper; private final String GROUP_NAME = "testWorkerGroup"; private User getLoginUser() { User loginUser = new User(); loginUser.setUserType(UserType.GENERAL_USER); loginUser.setUserName("workerGroupTestUser"); loginUser.setId(1);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkerGroupServiceTest.java
return loginUser; } @Test public void giveNoPermission_whenSaveWorkerGroup_expectNoOperation() { User loginUser = getLoginUser(); Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.WORKER_GROUP, 1, WORKER_GROUP_CREATE, baseServiceLogger)).thenReturn(false); Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.WORKER_GROUP, null, 1, baseServiceLogger)).thenReturn(false); Map<String, Object> result = workerGroupService.saveWorkerGroup(loginUser, 1, GROUP_NAME, "localhost:0000", "test group", ""); Assertions.assertEquals(Status.USER_NO_OPERATION_PERM.getCode(), ((Status) result.get(Constants.STATUS)).getCode()); } @Test public void giveNullName_whenSaveWorkerGroup_expectNAME_NULL() { User loginUser = getLoginUser(); Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.WORKER_GROUP, 1, WORKER_GROUP_CREATE, baseServiceLogger)).thenReturn(true); Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.WORKER_GROUP, null, 1, baseServiceLogger)).thenReturn(true); Map<String, Object> result = workerGroupService.saveWorkerGroup(loginUser, 1, "", "localhost:0000", "test group", ""); Assertions.assertEquals(Status.NAME_NULL.getCode(), ((Status) result.get(Constants.STATUS)).getCode()); } @Test public void giveSameUserName_whenSaveWorkerGroup_expectNAME_EXIST() { User loginUser = getLoginUser(); Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.WORKER_GROUP, 1,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkerGroupServiceTest.java
WORKER_GROUP_CREATE, baseServiceLogger)).thenReturn(true); Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.WORKER_GROUP, null, 1, baseServiceLogger)).thenReturn(true); Mockito.when(workerGroupMapper.selectById(1)).thenReturn(null); List<WorkerGroup> workerGroupList = new ArrayList<WorkerGroup>(); workerGroupList.add(getWorkerGroup(1)); Mockito.when(workerGroupMapper.queryWorkerGroupByName(GROUP_NAME)).thenReturn(workerGroupList); Map<String, Object> result = workerGroupService.saveWorkerGroup(loginUser, 1, GROUP_NAME, "localhost:0000", "test group", ""); Assertions.assertEquals(Status.NAME_EXIST.getCode(), ((Status) result.get(Constants.STATUS)).getCode()); } @Test public void giveInvalidAddress_whenSaveWorkerGroup_expectADDRESS_INVALID() { User loginUser = getLoginUser(); Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.WORKER_GROUP, 1, WORKER_GROUP_CREATE, baseServiceLogger)).thenReturn(true); Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.WORKER_GROUP, null, 1, baseServiceLogger)).thenReturn(true); Mockito.when(workerGroupMapper.selectById(1)).thenReturn(null); Mockito.when(workerGroupMapper.queryWorkerGroupByName(GROUP_NAME)).thenReturn(null); String workerGroupPath = Constants.REGISTRY_DOLPHINSCHEDULER_WORKERS + Constants.SINGLE_SLASH + GROUP_NAME; Mockito.when(registryClient.exists(workerGroupPath)).thenReturn(false); Map<String, String> serverMaps = new HashMap<>(); serverMaps.put("localhost1:0000", ""); Mockito.when(registryClient.getServerMaps(NodeType.WORKER)).thenReturn(serverMaps); Map<String, Object> result = workerGroupService.saveWorkerGroup(loginUser, 1, GROUP_NAME, "localhost:0000", "test group", ""); Assertions.assertEquals(Status.WORKER_ADDRESS_INVALID.getCode(),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkerGroupServiceTest.java
((Status) result.get(Constants.STATUS)).getCode()); } @Test public void giveValidWorkerGroup_whenSaveWorkerGroup_expectSuccess() { User loginUser = getLoginUser(); Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.WORKER_GROUP, 1, WORKER_GROUP_CREATE, baseServiceLogger)).thenReturn(true); Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.WORKER_GROUP, null, 1, baseServiceLogger)).thenReturn(true); Mockito.when(workerGroupMapper.selectById(1)).thenReturn(null); Mockito.when(workerGroupMapper.queryWorkerGroupByName(GROUP_NAME)).thenReturn(null); String workerGroupPath = Constants.REGISTRY_DOLPHINSCHEDULER_WORKERS + Constants.SINGLE_SLASH + GROUP_NAME; Mockito.when(registryClient.exists(workerGroupPath)).thenReturn(false); Map<String, String> serverMaps = new HashMap<>(); serverMaps.put("localhost:0000", ""); Mockito.when(registryClient.getServerMaps(NodeType.WORKER)).thenReturn(serverMaps); Mockito.when(workerGroupMapper.insert(any())).thenReturn(1); Map<String, Object> result = workerGroupService.saveWorkerGroup(loginUser, 1, GROUP_NAME, "localhost:0000", "test group", ""); Assertions.assertEquals(Status.SUCCESS.getCode(), ((Status) result.get(Constants.STATUS)).getCode()); } @Test public void giveValidParams_whenQueryAllGroupPaging_expectSuccess() { User loginUser = getLoginUser(); Set<Integer> ids = new HashSet<>(); ids.add(1); List<WorkerGroup> workerGroups = new ArrayList<>(); workerGroups.add(getWorkerGroup(1));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkerGroupServiceTest.java
Mockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.WORKER_GROUP, loginUser.getId(), serviceLogger)).thenReturn(ids); Mockito.when(workerGroupMapper.selectBatchIds(ids)).thenReturn(workerGroups); Set<String> activeWorkerNodes = new HashSet<>(); activeWorkerNodes.add("localhost:12345"); activeWorkerNodes.add("localhost:23456"); Mockito.when(registryClient.getServerNodeSet(NodeType.WORKER)).thenReturn(activeWorkerNodes); Result result = workerGroupService.queryAllGroupPaging(loginUser, 1, 1, null); Assertions.assertEquals(result.getCode(), Status.SUCCESS.getCode()); } @Test public void testQueryAllGroup() { Map<String, Object> result = workerGroupService.queryAllGroup(getLoginUser()); List<String> workerGroups = (List<String>) result.get(Constants.DATA_LIST); Assertions.assertEquals(workerGroups.size(), 1); } @Test public void giveNotExistsWorkerGroup_whenDeleteWorkerGroupById_expectNotExists() { User loginUser = getLoginUser(); Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.WORKER_GROUP, 1, WORKER_GROUP_DELETE, baseServiceLogger)).thenReturn(true); Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.WORKER_GROUP, null, 1, baseServiceLogger)).thenReturn(true); Mockito.when(workerGroupMapper.selectById(1)).thenReturn(null); Map<String, Object> notExistResult = workerGroupService.deleteWorkerGroupById(loginUser, 1); Assertions.assertEquals(Status.DELETE_WORKER_GROUP_NOT_EXIST.getCode(), ((Status) notExistResult.get(Constants.STATUS)).getCode()); } @Test public void giveRunningProcess_whenDeleteWorkerGroupById_expectFailed() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkerGroupServiceTest.java
User loginUser = getLoginUser(); Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.WORKER_GROUP, 1, WORKER_GROUP_DELETE, baseServiceLogger)).thenReturn(true); Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.WORKER_GROUP, null, 1, baseServiceLogger)).thenReturn(true); WorkerGroup workerGroup = getWorkerGroup(1); Mockito.when(workerGroupMapper.selectById(1)).thenReturn(workerGroup); ProcessInstance processInstance = new ProcessInstance(); processInstance.setId(1); List<ProcessInstance> processInstances = new ArrayList<ProcessInstance>(); processInstances.add(processInstance); Mockito.when(processInstanceMapper.queryByWorkerGroupNameAndStatus(workerGroup.getName(), org.apache.dolphinscheduler.service.utils.Constants.NOT_TERMINATED_STATES)) .thenReturn(processInstances); Map<String, Object> deleteFailed = workerGroupService.deleteWorkerGroupById(loginUser, 1); Assertions.assertEquals(Status.DELETE_WORKER_GROUP_BY_ID_FAIL.getCode(), ((Status) deleteFailed.get(Constants.STATUS)).getCode()); } @Test public void giveValidParams_whenDeleteWorkerGroupById_expectSuccess() { User loginUser = getLoginUser(); Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.WORKER_GROUP, 1, WORKER_GROUP_DELETE, baseServiceLogger)).thenReturn(true); Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.WORKER_GROUP, null, 1, baseServiceLogger)).thenReturn(true); WorkerGroup workerGroup = getWorkerGroup(1); Mockito.when(workerGroupMapper.selectById(1)).thenReturn(workerGroup); Mockito.when(processInstanceMapper.queryByWorkerGroupNameAndStatus(workerGroup.getName(), org.apache.dolphinscheduler.service.utils.Constants.NOT_TERMINATED_STATES)).thenReturn(null); Mockito.when(workerGroupMapper.deleteById(1)).thenReturn(1);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkerGroupServiceTest.java
Mockito.when(processInstanceMapper.updateProcessInstanceByWorkerGroupName(workerGroup.getName(), "")) .thenReturn(1); Mockito.when(environmentWorkerGroupRelationMapper.queryByWorkerGroupName(workerGroup.getName())) .thenReturn(null); Map<String, Object> successResult = workerGroupService.deleteWorkerGroupById(loginUser, 1); Assertions.assertEquals(Status.SUCCESS.getCode(), ((Status) successResult.get(Constants.STATUS)).getCode()); } @Test public void testQueryAllGroupWithDefault() { Map<String, Object> result = workerGroupService.queryAllGroup(getLoginUser()); List<String> workerGroups = (List<String>) result.get(Constants.DATA_LIST); Assertions.assertEquals(1, workerGroups.size()); Assertions.assertEquals("default", workerGroups.toArray()[0]); } @Test public void giveNull_whenGetTaskWorkerGroup_expectNull() { String nullWorkerGroup = workerGroupService.getTaskWorkerGroup(null); Assertions.assertNull(nullWorkerGroup); } @Test public void giveCorrectTaskInstance_whenGetTaskWorkerGroup_expectTaskWorkerGroup() { TaskInstance taskInstance = new TaskInstance(); taskInstance.setId(1); taskInstance.setWorkerGroup("cluster1"); String workerGroup = workerGroupService.getTaskWorkerGroup(taskInstance); Assertions.assertEquals("cluster1", workerGroup); } @Test public void giveNullWorkerGroup_whenGetTaskWorkerGroup_expectProcessWorkerGroup() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,832
[Bug] [api] cannot modify worker group
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened cannot modify worker group in worker group manage page. alert worker group already exists. ### What you expected to happen can modify worker group ### How to reproduce modify worker group in worker group manage page. ### Anything else _No response_ ### Version 3.1.x ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12832
https://github.com/apache/dolphinscheduler/pull/12874
250d81bcf81bc4432f832197e1f96ad440944d5d
e3cf72cbcd022adb0527b5c22199a851b11be6bf
2022-11-09T04:00:21Z
java
2022-11-14T03:20:51Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkerGroupServiceTest.java
TaskInstance taskInstance = new TaskInstance(); taskInstance.setId(1); taskInstance.setProcessInstanceId(1); ProcessInstance processInstance = new ProcessInstance(); processInstance.setId(1); processInstance.setWorkerGroup("cluster1"); Mockito.when(processService.findProcessInstanceById(1)).thenReturn(processInstance); String workerGroup = workerGroupService.getTaskWorkerGroup(taskInstance); Assertions.assertEquals("cluster1", workerGroup); } @Test public void giveNullTaskAndProcessWorkerGroup_whenGetTaskWorkerGroup_expectDefault() { TaskInstance taskInstance = new TaskInstance(); taskInstance.setId(1); taskInstance.setProcessInstanceId(1); Mockito.when(processService.findProcessInstanceById(1)).thenReturn(null); String defaultWorkerGroup = workerGroupService.getTaskWorkerGroup(taskInstance); Assertions.assertEquals(Constants.DEFAULT_WORKER_GROUP, defaultWorkerGroup); } /** * get Group */ private WorkerGroup getWorkerGroup(int id) { WorkerGroup workerGroup = new WorkerGroup(); workerGroup.setName(GROUP_NAME); workerGroup.setId(id); return workerGroup; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
/* * 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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
* 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.dolphinscheduler.api.service.impl; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.DATASOURCE_DELETE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.DATASOURCE_UPDATE; import org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.exceptions.ServiceException; import org.apache.dolphinscheduler.api.service.DataSourceService; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.constants.Constants; import org.apache.dolphinscheduler.common.enums.AuthorizationType; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.entity.DataSource; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper; import org.apache.dolphinscheduler.dao.mapper.DataSourceUserMapper; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; import org.apache.dolphinscheduler.plugin.datasource.api.utils.DataSourceUtils; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; import org.apache.commons.collections4.CollectionUtils;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
import org.apache.commons.lang3.StringUtils; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DuplicateKeyException; import org.springframework.stereo.Service; import org.springframework.transaction.annotation.Transactional; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fasterxml.jackson.databind.node.ObjectNode; /** * data source service impl */ @Service public class DataSourceServiceImpl extends BaseServiceImpl implements DataSourceService { private static final Logger logger = LoggerFactory.getLogger(DataSourceServiceImpl.class);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
@Autowired private DataSourceMapper dataSourceMapper; @Autowired private DataSourceUserMapper datasourceUserMapper; private static final String TABLE = "TABLE"; private static final String VIEW = "VIEW"; private static final String[] TABLE_TYPES = new String[]{TABLE, VIEW}; private static final String TABLE_NAME = "TABLE_NAME"; private static final String COLUMN_NAME = "COLUMN_NAME"; /** * create data source * * @param loginUser login user * @param datasourceParam datasource parameters * @return create result code */ @Override @Transactional public Result<Object> createDataSource(User loginUser, BaseDataSourceParamDTO datasourceParam) { DataSourceUtils.checkDatasourceParam(datasourceParam); Result<Object> result = new Result<>(); if (!canOperatorPermissions(loginUser, null, AuthorizationType.DATASOURCE, ApiFuncIdentificationConstant.DATASOURCE_CREATE_DATASOURCE)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } if (checkName(datasourceParam.getName())) { logger.warn("Datasource with the same name already exists, name:{}.", datasourceParam.getName()); putMsg(result, Status.DATASOURCE_EXIST);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
return result; } if (checkDescriptionLength(datasourceParam.getNote())) { logger.warn("Parameter description is too long, description:{}.", datasourceParam.getNote()); putMsg(result, Status.DESCRIPTION_TOO_LONG_ERROR); return result; } ConnectionParam connectionParam = DataSourceUtils.buildConnectionParams(datasourceParam); Result<Object> isConnection = checkConnection(datasourceParam.getType(), connectionParam); if (Status.SUCCESS.getCode() != isConnection.getCode()) { putMsg(result, Status.DATASOURCE_CONNECT_FAILED); return result; } DataSource dataSource = new DataSource(); Date now = new Date(); dataSource.setName(datasourceParam.getName().trim()); dataSource.setNote(datasourceParam.getNote()); dataSource.setUserId(loginUser.getId()); dataSource.setUserName(loginUser.getUserName()); dataSource.setType(datasourceParam.getType()); dataSource.setConnectionParams(JSONUtils.toJsonString(connectionParam)); dataSource.setCreateTime(now); dataSource.setUpdateTime(now); dataSource.setTestFlag(datasourceParam.getTestFlag()); dataSource.setBindTestId(datasourceParam.getBindTestId()); try { dataSourceMapper.insert(dataSource); putMsg(result, Status.SUCCESS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
permissionPostHandle(AuthorizationType.DATASOURCE, loginUser.getId(), Collections.singletonList(dataSource.getId()), logger); logger.info("Datasource create complete, dbType:{}, datasourceName:{}.", dataSource.getType().getDescp(), dataSource.getName()); } catch (DuplicateKeyException ex) { logger.error("Datasource create error.", ex); putMsg(result, Status.DATASOURCE_EXIST); } return result; } /** * updateProcessInstance datasource * * @param loginUser login user * @param id data source id * @return update result code */ @Override public Result<Object> updateDataSource(int id, User loginUser, BaseDataSourceParamDTO dataSourceParam) { DataSourceUtils.checkDatasourceParam(dataSourceParam); Result<Object> result = new Result<>(); DataSource dataSource = dataSourceMapper.selectById(id); if (dataSource == null) { logger.error("Datasource does not exist, id:{}.", id); putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } if (!canOperatorPermissions(loginUser, new Object[]{dataSource.getId()}, AuthorizationType.DATASOURCE, DATASOURCE_UPDATE)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } if (!dataSource.getName().trim().equals(dataSource.getName()) && checkName(dataSource.getName())) { logger.warn("Datasource with the same name already exists, name:{}.", dataSource.getName()); putMsg(result, Status.DATASOURCE_EXIST); return result; } if (checkDescriptionLength(dataSourceParam.getNote())) { logger.warn("Parameter description is too long, description:{}.", dataSourceParam.getNote()); putMsg(result, Status.DESCRIPTION_TOO_LONG_ERROR); return result; } BaseConnectionParam connectionParam = (BaseConnectionParam) DataSourceUtils.buildConnectionParams(dataSourceParam); String password = connectionParam.getPassword(); if (StringUtils.isBlank(password)) { String oldConnectionParams = dataSource.getConnectionParams(); ObjectNode oldParams = JSONUtils.parseObject(oldConnectionParams); connectionParam.setPassword(oldParams.path(Constants.PASSWORD).asText()); } Result<Object> isConnection = checkConnection(dataSource.getType(), connectionParam); if (isConnection.isFailed()) { return isConnection; } Date now = new Date(); dataSource.setName(dataSourceParam.getName().trim()); dataSource.setNote(dataSourceParam.getNote());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
dataSource.setUserName(loginUser.getUserName()); dataSource.setType(dataSource.getType()); dataSource.setConnectionParams(JSONUtils.toJsonString(connectionParam)); dataSource.setUpdateTime(now); if (dataSource.getTestFlag() == 1 && dataSourceParam.getTestFlag() == 0) { clearBindTestId(id); } dataSource.setTestFlag(dataSourceParam.getTestFlag()); dataSource.setBindTestId(dataSourceParam.getBindTestId()); try { dataSourceMapper.updateById(dataSource); logger.info("Update datasource complete, datasourceId:{}, datasourceName:{}.", dataSource.getId(), dataSource.getName()); putMsg(result, Status.SUCCESS); } catch (DuplicateKeyException ex) { logger.error("Update datasource error, datasourceId:{}, datasourceName:{}.", dataSource.getId(), dataSource.getName()); putMsg(result, Status.DATASOURCE_EXIST); } return result; } private boolean checkName(String name) { List<DataSource> queryDataSource = dataSourceMapper.queryDataSourceByName(name.trim()); return queryDataSource != null && !queryDataSource.isEmpty(); } /** * updateProcessInstance datasource * * @param id datasource id * @return data source detail
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
*/ @Override public Map<String, Object> queryDataSource(int id) { Map<String, Object> result = new HashMap<>(); DataSource dataSource = dataSourceMapper.selectById(id); if (dataSource == null) { logger.error("Datasource does not exist, id:{}.", id); putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } // BaseDataSourceParamDTO baseDataSourceParamDTO = DataSourceUtils.buildDatasourceParamDTO( dataSource.getType(), dataSource.getConnectionParams()); baseDataSourceParamDTO.setId(dataSource.getId()); baseDataSourceParamDTO.setName(dataSource.getName()); baseDataSourceParamDTO.setNote(dataSource.getNote()); baseDataSourceParamDTO.setTestFlag(dataSource.getTestFlag()); baseDataSourceParamDTO.setBindTestId(dataSource.getBindTestId()); result.put(Constants.DATA_LIST, baseDataSourceParamDTO); putMsg(result, Status.SUCCESS); return result; } /** * query datasource list by keyword * * @param loginUser login user * @param searchVal search value * @param pageNo page number * @param pageSize page size * @return data source list page
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
*/ @Override public Result queryDataSourceListPaging(User loginUser, String searchVal, Integer pageNo, Integer pageSize) { Result result = new Result(); IPage<DataSource> dataSourceList = null; Page<DataSource> dataSourcePage = new Page<>(pageNo, pageSize); PageInfo<DataSource> pageInfo = new PageInfo<>(pageNo, pageSize); if (loginUser.getUserType().equals(UserType.ADMIN_USER)) { dataSourceList = dataSourceMapper.selectPaging(dataSourcePage, UserType.ADMIN_USER.equals(loginUser.getUserType()) ? 0 : loginUser.getId(), searchVal); } else { Set<Integer> ids = resourcePermissionCheckService .userOwnedResourceIdsAcquisition(AuthorizationType.DATASOURCE, loginUser.getId(), logger); if (ids.isEmpty()) { result.setData(pageInfo); putMsg(result, Status.SUCCESS); return result; } dataSourceList = dataSourceMapper.selectPagingByIds(dataSourcePage, new ArrayList<>(ids), searchVal); } List<DataSource> dataSources = dataSourceList != null ? dataSourceList.getRecords() : new ArrayList<>(); handlePasswd(dataSources); pageInfo.setTotal((int) (dataSourceList != null ? dataSourceList.getTotal() : 0L)); pageInfo.setTotalList(dataSources); result.setData(pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * handle datasource connection password for safety
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
*/ private void handlePasswd(List<DataSource> dataSourceList) { for (DataSource dataSource : dataSourceList) { String connectionParams = dataSource.getConnectionParams(); ObjectNode object = JSONUtils.parseObject(connectionParams); object.put(Constants.PASSWORD, getHiddenPassword()); dataSource.setConnectionParams(object.toString()); } } /** * get hidden password (resolve the security hotspot) * * @return hidden password */ private String getHiddenPassword() { return Constants.XXXXXX; } /** * query data resource list * * @param loginUser login user * @param data source * @return data source list page */ @Override public Map<String, Object> queryDataSourceList(User loginUser, Integer , int testFlag) { Map<String, Object> result = new HashMap<>(); List<DataSource> datasourceList = null; if (loginUser.getUserType().equals(UserType.ADMIN_USER)) { datasourceList = dataSourceMapper.queryDataSourceByType(0, , testFlag);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
} else { Set<Integer> ids = resourcePermissionCheckService .userOwnedResourceIdsAcquisition(AuthorizationType.DATASOURCE, loginUser.getId(), logger); if (ids.isEmpty()) { result.put(Constants.DATA_LIST, Collections.emptyList()); putMsg(result, Status.SUCCESS); return result; } datasourceList = dataSourceMapper.selectBatchIds(ids).stream() .filter(dataSource -> dataSource.getType().getCode() == ) .filter(dataSource -> dataSource.getTestFlag() == testFlag).collect(Collectors.toList()); } result.put(Constants.DATA_LIST, datasourceList); putMsg(result, Status.SUCCESS); return result; } /** * verify datasource exists * * @param name datasource name * @return true if data datasource not exists, otherwise return false */ @Override public Result<Object> verifyDataSourceName(String name) { Result<Object> result = new Result<>(); List<DataSource> dataSourceList = dataSourceMapper.queryDataSourceByName(name); if (dataSourceList != null && !dataSourceList.isEmpty()) { logger.warn("Datasource with the same name already exists, dataSourceName:{}.", dataSourceList.get(0).getName()); putMsg(result, Status.DATASOURCE_EXIST);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
} else { putMsg(result, Status.SUCCESS); } return result; } /** * check connection * * @param data source * @param connectionParam connectionParam * @return true if connect successfully, otherwise false * @return true if connect successfully, otherwise false */ @Override public Result<Object> checkConnection(DbType , ConnectionParam connectionParam) { Result<Object> result = new Result<>(); try (Connection connection = DataSourceClientProvider.getInstance().getConnection(, connectionParam)) { if (connection == null) { logger.error("Connection test to {} datasource failed, connectionParam:{}.", .getDescp(), connectionParam); putMsg(result, Status.CONNECTION_TEST_FAILURE); return result; } logger.info("Connection test to {} datasource success, connectionParam:{}", .getDescp(), connectionParam); putMsg(result, Status.SUCCESS); return result; } catch (Exception e) { String message = Optional.of(e).map(Throwable::getCause) .map(Throwable::getMessage)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
.orElse(e.getMessage()); logger.error("Datasource test connection error, dbType:{}, connectionParam:{}, message:{}.", , connectionParam, message); return new Result<>(Status.CONNECTION_TEST_FAILURE.getCode(), message); } } /** * test connection * * @param id datasource id * @return connect result code */ @Override public Result<Object> connectionTest(int id) { DataSource dataSource = dataSourceMapper.selectById(id); if (dataSource == null) { Result<Object> result = new Result<>(); logger.error("Datasource does not exist, datasourceId:{}.", id); putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } return checkConnection(dataSource.getType(), DataSourceUtils.buildConnectionParams(dataSource.getType(), dataSource.getConnectionParams())); } /** * delete datasource * * @param loginUser login user * @param datasourceId data source id * @return delete result code
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
*/ @Override @Transactional public Result<Object> delete(User loginUser, int datasourceId) { Result<Object> result = new Result<>(); try { // DataSource dataSource = dataSourceMapper.selectById(datasourceId); if (dataSource == null) { logger.warn("Datasource does not exist, datasourceId:{}.", datasourceId); putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } if (!canOperatorPermissions(loginUser, new Object[]{dataSource.getId()}, AuthorizationType.DATASOURCE, DATASOURCE_DELETE)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } dataSourceMapper.deleteById(datasourceId); datasourceUserMapper.deleteByDatasourceId(datasourceId); clearBindTestId(datasourceId); logger.info("Delete datasource complete, datasourceId:{}.", datasourceId); putMsg(result, Status.SUCCESS); } catch (Exception e) { logger.error("Delete datasource complete, datasourceId:{}.", datasourceId, e); throw new ServiceException(Status.DELETE_DATA_SOURCE_FAILURE); } return result; } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
* unauthorized datasource * * @param loginUser login user * @param userId user id * @return unauthed data source result code */ @Override public Map<String, Object> unauthDatasource(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); List<DataSource> datasourceList; if (canOperatorPermissions(loginUser, null, AuthorizationType.DATASOURCE, null)) { // datasourceList = dataSourceMapper.queryDatasourceExceptUserId(userId); } else { // datasourceList = dataSourceMapper.selectByMap(Collections.singletonMap("user_id", loginUser.getId())); } List<DataSource> resultList = new ArrayList<>(); Set<DataSource> datasourceSet; if (datasourceList != null && !datasourceList.isEmpty()) { datasourceSet = new HashSet<>(datasourceList); List<DataSource> authedDataSourceList = dataSourceMapper.queryAuthedDatasource(userId); Set<DataSource> authedDataSourceSet; if (authedDataSourceList != null && !authedDataSourceList.isEmpty()) { authedDataSourceSet = new HashSet<>(authedDataSourceList); datasourceSet.removeAll(authedDataSourceSet); } resultList = new ArrayList<>(datasourceSet); } result.put(Constants.DATA_LIST, resultList);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
putMsg(result, Status.SUCCESS); return result; } /** * authorized datasource * * @param loginUser login user * @param userId user id * @return authorized result code */ @Override public Map<String, Object> authedDatasource(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); List<DataSource> authedDatasourceList = dataSourceMapper.queryAuthedDatasource(userId); result.put(Constants.DATA_LIST, authedDatasourceList); putMsg(result, Status.SUCCESS); return result; } @Override public Map<String, Object> getTables(Integer datasourceId) { Map<String, Object> result = new HashMap<>(); DataSource dataSource = dataSourceMapper.selectById(datasourceId); List<String> tableList = null; BaseConnectionParam connectionParam = (BaseConnectionParam) DataSourceUtils.buildConnectionParams( dataSource.getType(), dataSource.getConnectionParams()); if (null == connectionParam) { putMsg(result, Status.DATASOURCE_CONNECT_FAILED); return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
} Connection connection = DataSourceUtils.getConnection(dataSource.getType(), connectionParam); ResultSet tables = null; try { if (null == connection) { putMsg(result, Status.DATASOURCE_CONNECT_FAILED); return result; } DatabaseMetaData metaData = connection.getMetaData(); String schema = null; try { schema = metaData.getConnection().getSchema(); } catch (SQLException e) { logger.error("Cant not get the schema, datasourceId:{}.", datasourceId, e); } tables = metaData.getTables( connectionParam.getDatabase(), getDbSchemaPattern(dataSource.getType(), schema, connectionParam), "%", TABLE_TYPES); if (null == tables) { logger.error("Get datasource tables error, datasourceId:{}.", datasourceId); putMsg(result, Status.GET_DATASOURCE_TABLES_ERROR); return result; } tableList = new ArrayList<>(); while (tables.next()) { String name = tables.getString(TABLE_NAME); tableList.add(name); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
} catch (Exception e) { logger.error("Get datasource tables error, datasourceId:{}.", datasourceId, e); putMsg(result, Status.GET_DATASOURCE_TABLES_ERROR); return result; } finally { closeResult(tables); releaseConnection(connection); } List<ParamsOptions> options = getParamsOptions(tableList); result.put(Constants.DATA_LIST, options); putMsg(result, Status.SUCCESS); return result; } @Override public Map<String, Object> getTableColumns(Integer datasourceId, String tableName) { Map<String, Object> result = new HashMap<>(); DataSource dataSource = dataSourceMapper.selectById(datasourceId); BaseConnectionParam connectionParam = (BaseConnectionParam) DataSourceUtils.buildConnectionParams( dataSource.getType(), dataSource.getConnectionParams()); if (null == connectionParam) { putMsg(result, Status.DATASOURCE_CONNECT_FAILED); return result; } Connection connection = DataSourceUtils.getConnection(dataSource.getType(), connectionParam); List<String> columnList = new ArrayList<>(); ResultSet rs = null; try {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
String database = connectionParam.getDatabase(); if (null == connection) { return result; } DatabaseMetaData metaData = connection.getMetaData(); if (dataSource.getType() == DbType.ORACLE) { database = null; } rs = metaData.getColumns(database, null, tableName, "%"); if (rs == null) { return result; } while (rs.next()) { columnList.add(rs.getString(COLUMN_NAME)); } } catch (Exception e) { logger.error("Get datasource table columns error, datasourceId:{}.", dataSource.getId(), e); } finally { closeResult(rs); releaseConnection(connection); } List<ParamsOptions> options = getParamsOptions(columnList); result.put(Constants.DATA_LIST, options); putMsg(result, Status.SUCCESS); return result; } private List<ParamsOptions> getParamsOptions(List<String> columnList) { List<ParamsOptions> options = null; if (CollectionUtils.isNotEmpty(columnList)) { options = new ArrayList<>();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
for (String column : columnList) { ParamsOptions childrenOption = new ParamsOptions(column, column, false); options.add(childrenOption); } } return options; } private String getDbSchemaPattern(DbType dbType, String schema, BaseConnectionParam connectionParam) { if (dbType == null) { return null; } String schemaPattern = null; switch (dbType) { case HIVE: schemaPattern = connectionParam.getDatabase(); break; case ORACLE: schemaPattern = connectionParam.getUser(); if (null != schemaPattern) { schemaPattern = schemaPattern.toUpperCase(); } break; case SQLSERVER: schemaPattern = "dbo"; break; case CLICKHOUSE: case PRESTO: if (!StringUtils.isEmpty(schema)) { schemaPattern = schema;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
} break; default: break; } return schemaPattern; } private static void releaseConnection(Connection connection) { if (null != connection) { try { connection.close(); } catch (Exception e) { logger.error("Connection release error", e); } } } private static void closeResult(ResultSet rs) { if (rs != null) { try { rs.close(); } catch (Exception e) { logger.error("ResultSet close error", e); } } } private void clearBindTestId(Integer bindTestId) { dataSourceMapper.clearBindTestId(bindTestId); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataSourceServiceTest.java
/* * 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.dolphinscheduler.api.service; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.DATASOURCE_DELETE; import org.apache.dolphinscheduler.api.enums.Status;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataSourceServiceTest.java
import org.apache.dolphinscheduler.api.permission.ResourcePermissionCheckService; import org.apache.dolphinscheduler.api.service.impl.BaseServiceImpl; import org.apache.dolphinscheduler.api.service.impl.DataSourceServiceImpl; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.constants.Constants; import org.apache.dolphinscheduler.common.constants.DataSourceConstants; import org.apache.dolphinscheduler.common.enums.AuthorizationType; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.PropertyUtils; import org.apache.dolphinscheduler.dao.entity.DataSource; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper; import org.apache.dolphinscheduler.dao.mapper.DataSourceUserMapper; import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; import org.apache.dolphinscheduler.plugin.datasource.api.utils.DataSourceUtils; import org.apache.dolphinscheduler.plugin.datasource.hive.param.HiveDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.mysql.param.MySQLDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.oracle.param.OracleDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.postgresql.param.PostgreSQLDataSourceParamDTO; import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; import org.apache.dolphinscheduler.spi.enums.DbConnectType; import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.commons.collections.CollectionUtils; import java.sql.Connection; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataSourceServiceTest.java
import java.util.List; import java.util.Map; import java.util.Set; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockedStatic; import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * data source service test */ @ExtendWith(MockitoExtension.class) public class DataSourceServiceTest { private static final Logger baseServiceLogger = LoggerFactory.getLogger(BaseServiceImpl.class); private static final Logger logger = LoggerFactory.getLogger(DataSourceServiceTest.class); private static final Logger dataSourceServiceLogger = LoggerFactory.getLogger(DataSourceServiceImpl.class); @InjectMocks private DataSourceServiceImpl dataSourceService; @Mock private DataSourceMapper dataSourceMapper; @Mock private DataSourceUserMapper datasourceUserMapper; @Mock private ResourcePermissionCheckService resourcePermissionCheckService; public void createDataSourceTest() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,838
[Improvement][UT] Improve the ut of datasource
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Improve the ut of datasource ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12838
https://github.com/apache/dolphinscheduler/pull/12839
e3cf72cbcd022adb0527b5c22199a851b11be6bf
813c44b22b3561f4c32524781ef395892512aef8
2022-11-09T08:23:10Z
java
2022-11-14T03:30:10Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataSourceServiceTest.java
User loginUser = getAdminUser(); String dataSourceName = "dataSource01"; String dataSourceDesc = "test dataSource"; PostgreSQLDataSourceParamDTO postgreSqlDatasourceParam = new PostgreSQLDataSourceParamDTO(); postgreSqlDatasourceParam.setDatabase(dataSourceName); postgreSqlDatasourceParam.setNote(dataSourceDesc); postgreSqlDatasourceParam.setHost("172.16.133.200"); postgreSqlDatasourceParam.setPort(5432); postgreSqlDatasourceParam.setDatabase("dolphinscheduler"); postgreSqlDatasourceParam.setUserName("postgres"); postgreSqlDatasourceParam.setPassword(""); List<DataSource> dataSourceList = new ArrayList<>(); DataSource dataSource = new DataSource(); dataSource.setName(dataSourceName); dataSourceList.add(dataSource); Mockito.when(dataSourceMapper.queryDataSourceByName(dataSourceName.trim())).thenReturn(dataSourceList); Result dataSourceExitsResult = dataSourceService.createDataSource(loginUser, postgreSqlDatasourceParam); Assertions.assertEquals(Status.DATASOURCE_EXIST.getCode(), dataSourceExitsResult.getCode().intValue()); ConnectionParam connectionParam = DataSourceUtils.buildConnectionParams(postgreSqlDatasourceParam); DbType dataSourceType = postgreSqlDatasourceParam.getType(); Mockito.when(dataSourceMapper.queryDataSourceByName(dataSourceName.trim())).thenReturn(null); Result connectionResult = new Result(Status.DATASOURCE_CONNECT_FAILED.getCode(), Status.DATASOURCE_CONNECT_FAILED.getMsg()); Mockito.doReturn(connectionResult).when(dataSourceService).checkConnection(dataSourceType, connectionParam); Result connectFailedResult = dataSourceService.createDataSource(loginUser, postgreSqlDatasourceParam); Assertions.assertEquals(Status.DATASOURCE_CONNECT_FAILED.getCode(), connectFailedResult.getCode().intValue()); Mockito.when(dataSourceMapper.queryDataSourceByName(dataSourceName.trim())).thenReturn(null);