Browse Source

Merge pull request #2 from apache/dev

merge
pull/2/head
Simon 5 years ago committed by GitHub
parent
commit
0b11275880
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
  2. 41
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/SqoopJobType.java
  3. 99
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/sqoop/SqoopParameters.java
  4. 2
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/sqoop/targets/TargetMysqlParameter.java
  5. 32
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java
  6. 39
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sqoop/generator/CommonGenerator.java
  7. 22
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sqoop/generator/SqoopJobGenerator.java
  8. 14
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sqoop/generator/sources/MysqlSourceGenerator.java
  9. 2
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sqoop/generator/targets/MysqlTargetGenerator.java
  10. 2
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/datasource.vue
  11. 962
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sqoop.vue
  12. 7
      dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
  13. 7
      dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
  14. 34
      e2e/src/test/java/org/apache/dolphinscheduler/common/BrowserCommon.java
  15. 36
      e2e/src/test/java/org/apache/dolphinscheduler/data/security/AlertManageData.java
  16. 42
      e2e/src/test/java/org/apache/dolphinscheduler/data/security/QueueManageData.java
  17. 24
      e2e/src/test/java/org/apache/dolphinscheduler/data/security/TokenManageData.java
  18. 35
      e2e/src/test/java/org/apache/dolphinscheduler/locator/security/AlertManageLocator.java
  19. 31
      e2e/src/test/java/org/apache/dolphinscheduler/locator/security/QueueManageLocator.java
  20. 41
      e2e/src/test/java/org/apache/dolphinscheduler/locator/security/TokenManageLocator.java
  21. 77
      e2e/src/test/java/org/apache/dolphinscheduler/page/security/AlertManagePage.java
  22. 85
      e2e/src/test/java/org/apache/dolphinscheduler/page/security/QueueManagePage.java
  23. 94
      e2e/src/test/java/org/apache/dolphinscheduler/page/security/TokenManagePage.java
  24. 4
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/TestLogin.java
  25. 42
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteAlert.java
  26. 6
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteProject.java
  27. 6
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteTenant.java
  28. 42
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteToken.java
  29. 6
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteUser.java
  30. 6
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteWorkflow.java
  31. 6
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestCreateProject.java
  32. 6
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestCreateWorkflow.java
  33. 36
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestAlertManage.java
  34. 42
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestQueueManage.java
  35. 6
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestTenantManage.java
  36. 43
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestTokenManage.java
  37. 6
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestUserManage.java
  38. 28
      e2e/testng.xml

2
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java

@ -218,7 +218,7 @@ public enum Status {
DATA_IS_NOT_VALID(50017,"data {0} not valid", "数据[{0}]无效"),
DATA_IS_NULL(50018,"data {0} is null", "数据[{0}]不能为空"),
PROCESS_NODE_HAS_CYCLE(50019,"process node has cycle", "流程节点间存在循环依赖"),
PROCESS_NODE_S_PARAMETER_INVALID(50020,"process node %s parameter invalid", "流程节点[%s]参数无效"),
PROCESS_NODE_S_PARAMETER_INVALID(50020,"process node {0} parameter invalid", "流程节点[{0}]参数无效"),
PROCESS_DEFINE_STATE_ONLINE(50021, "process definition {0} is already on line", "工作流定义[{0}]已上线"),
DELETE_PROCESS_DEFINE_BY_ID_ERROR(50022,"delete process definition by id error", "删除工作流定义错误"),
SCHEDULE_CRON_STATE_ONLINE(50023,"the status of schedule {0} is already on line", "调度配置[{0}]已上线"),

41
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/SqoopJobType.java

@ -0,0 +1,41 @@
/*
* 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.common.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
public enum SqoopJobType {
CUSTOM(0, "CUSTOM"),
TEMPLATE(1, "TEMPLATE");
SqoopJobType(int code, String descp){
this.code = code;
this.descp = descp;
}
@EnumValue
private final int code;
private final String descp;
public int getCode() {
return code;
}
public String getDescp() {
return descp;
}
}

99
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/sqoop/SqoopParameters.java

@ -16,6 +16,8 @@
*/
package org.apache.dolphinscheduler.common.task.sqoop;
import org.apache.dolphinscheduler.common.enums.SqoopJobType;
import org.apache.dolphinscheduler.common.process.Property;
import org.apache.dolphinscheduler.common.process.ResourceInfo;
import org.apache.dolphinscheduler.common.task.AbstractParameters;
import org.apache.dolphinscheduler.common.utils.StringUtils;
@ -28,6 +30,23 @@ import java.util.List;
*/
public class SqoopParameters extends AbstractParameters {
/**
* sqoop job type:
* CUSTOM - custom sqoop job
* TEMPLATE - sqoop template job
*/
private String jobType;
/**
* customJob eq 1, use customShell
*/
private String customShell;
/**
* sqoop job name - map-reduce job name
*/
private String jobName;
/**
* model type
*/
@ -53,6 +72,16 @@ public class SqoopParameters extends AbstractParameters {
*/
private String targetParams;
/**
* hadoop custom param for sqoop job
*/
private List<Property> hadoopCustomParams;
/**
* sqoop advanced param
*/
private List<Property> sqoopAdvancedParams;
public String getModelType() {
return modelType;
}
@ -101,18 +130,74 @@ public class SqoopParameters extends AbstractParameters {
this.targetParams = targetParams;
}
public String getJobType() {
return jobType;
}
public void setJobType(String jobType) {
this.jobType = jobType;
}
public String getJobName() {
return jobName;
}
public void setJobName(String jobName) {
this.jobName = jobName;
}
public String getCustomShell() {
return customShell;
}
public void setCustomShell(String customShell) {
this.customShell = customShell;
}
public List<Property> getHadoopCustomParams() {
return hadoopCustomParams;
}
public void setHadoopCustomParams(List<Property> hadoopCustomParams) {
this.hadoopCustomParams = hadoopCustomParams;
}
public List<Property> getSqoopAdvancedParams() {
return sqoopAdvancedParams;
}
public void setSqoopAdvancedParams(List<Property> sqoopAdvancedParams) {
this.sqoopAdvancedParams = sqoopAdvancedParams;
}
@Override
public boolean checkParameters() {
return StringUtils.isNotEmpty(modelType)&&
concurrency != 0 &&
StringUtils.isNotEmpty(sourceType)&&
StringUtils.isNotEmpty(targetType)&&
StringUtils.isNotEmpty(sourceParams)&&
StringUtils.isNotEmpty(targetParams);
boolean sqoopParamsCheck = false;
if (StringUtils.isEmpty(jobType)) {
return sqoopParamsCheck;
}
if (SqoopJobType.TEMPLATE.getDescp().equals(jobType)) {
sqoopParamsCheck = StringUtils.isEmpty(customShell) &&
StringUtils.isNotEmpty(modelType) &&
StringUtils.isNotEmpty(jobName) &&
concurrency != 0 &&
StringUtils.isNotEmpty(sourceType) &&
StringUtils.isNotEmpty(targetType) &&
StringUtils.isNotEmpty(sourceParams) &&
StringUtils.isNotEmpty(targetParams);
} else if (SqoopJobType.CUSTOM.getDescp().equals(jobType)) {
sqoopParamsCheck = StringUtils.isNotEmpty(customShell) &&
StringUtils.isEmpty(jobName);
}
return sqoopParamsCheck;
}
@Override
public List<ResourceInfo> getResourceFilesList() {
return new ArrayList<>();
return new ArrayList<>();
}
}

2
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/sqoop/targets/TargetMysqlParameter.java

@ -106,7 +106,7 @@ public class TargetMysqlParameter {
this.preQuery = preQuery;
}
public boolean isUpdate() {
public boolean getIsUpdate() {
return isUpdate;
}

32
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java

@ -18,6 +18,7 @@
package org.apache.dolphinscheduler.server.master.consumer;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.common.enums.SqoopJobType;
import org.apache.dolphinscheduler.common.enums.TaskType;
import org.apache.dolphinscheduler.common.enums.UdfType;
import org.apache.dolphinscheduler.common.model.TaskNode;
@ -257,29 +258,32 @@ public class TaskPriorityQueueConsumer extends Thread{
/**
* set datax task relation
* set sqoop task relation
* @param sqoopTaskExecutionContext sqoopTaskExecutionContext
* @param taskNode taskNode
*/
private void setSqoopTaskRelation(SqoopTaskExecutionContext sqoopTaskExecutionContext, TaskNode taskNode) {
SqoopParameters sqoopParameters = JSONUtils.parseObject(taskNode.getParams(), SqoopParameters.class);
SourceMysqlParameter sourceMysqlParameter = JSONUtils.parseObject(sqoopParameters.getSourceParams(), SourceMysqlParameter.class);
TargetMysqlParameter targetMysqlParameter = JSONUtils.parseObject(sqoopParameters.getTargetParams(), TargetMysqlParameter.class);
// sqoop job type is template set task relation
if (sqoopParameters.getJobType().equals(SqoopJobType.TEMPLATE.getDescp())) {
SourceMysqlParameter sourceMysqlParameter = JSONUtils.parseObject(sqoopParameters.getSourceParams(), SourceMysqlParameter.class);
TargetMysqlParameter targetMysqlParameter = JSONUtils.parseObject(sqoopParameters.getTargetParams(), TargetMysqlParameter.class);
DataSource dataSource = processService.findDataSourceById(sourceMysqlParameter.getSrcDatasource());
DataSource dataTarget = processService.findDataSourceById(targetMysqlParameter.getTargetDatasource());
DataSource dataSource = processService.findDataSourceById(sourceMysqlParameter.getSrcDatasource());
DataSource dataTarget = processService.findDataSourceById(targetMysqlParameter.getTargetDatasource());
if (dataSource != null){
sqoopTaskExecutionContext.setDataSourceId(dataSource.getId());
sqoopTaskExecutionContext.setSourcetype(dataSource.getType().getCode());
sqoopTaskExecutionContext.setSourceConnectionParams(dataSource.getConnectionParams());
}
if (dataSource != null){
sqoopTaskExecutionContext.setDataSourceId(dataSource.getId());
sqoopTaskExecutionContext.setSourcetype(dataSource.getType().getCode());
sqoopTaskExecutionContext.setSourceConnectionParams(dataSource.getConnectionParams());
}
if (dataTarget != null){
sqoopTaskExecutionContext.setDataTargetId(dataTarget.getId());
sqoopTaskExecutionContext.setTargetType(dataTarget.getType().getCode());
sqoopTaskExecutionContext.setTargetConnectionParams(dataTarget.getConnectionParams());
if (dataTarget != null){
sqoopTaskExecutionContext.setDataTargetId(dataTarget.getId());
sqoopTaskExecutionContext.setTargetType(dataTarget.getType().getCode());
sqoopTaskExecutionContext.setTargetConnectionParams(dataTarget.getConnectionParams());
}
}
}

39
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sqoop/generator/CommonGenerator.java

@ -16,10 +16,17 @@
*/
package org.apache.dolphinscheduler.server.worker.task.sqoop.generator;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.process.Property;
import org.apache.dolphinscheduler.common.task.sqoop.SqoopParameters;
import org.apache.dolphinscheduler.common.utils.CollectionUtils;
import org.apache.dolphinscheduler.common.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
/**
* common script generator
*/
@ -32,6 +39,38 @@ public class CommonGenerator {
try{
result.append("sqoop ")
.append(sqoopParameters.getModelType());
//set sqoop job name
result.append(" -D mapred.job.name")
.append(Constants.EQUAL_SIGN)
.append(sqoopParameters.getJobName());
//set hadoop custom param
List<Property> hadoopCustomParams = sqoopParameters.getHadoopCustomParams();
if (CollectionUtils.isNotEmpty(hadoopCustomParams)) {
for (Property hadoopCustomParam : hadoopCustomParams) {
String hadoopCustomParamStr = " -D " + hadoopCustomParam.getProp()
+ Constants.EQUAL_SIGN + hadoopCustomParam.getValue();
if (StringUtils.isNotEmpty(hadoopCustomParamStr)) {
result.append(hadoopCustomParamStr);
}
}
}
//set sqoop advanced custom param
List<Property> sqoopAdvancedParams = sqoopParameters.getSqoopAdvancedParams();
if (CollectionUtils.isNotEmpty(sqoopAdvancedParams)) {
for (Property sqoopAdvancedParam : sqoopAdvancedParams) {
String sqoopAdvancedParamStr = " " + sqoopAdvancedParam.getProp()
+ " " + sqoopAdvancedParam.getValue();
if (StringUtils.isNotEmpty(sqoopAdvancedParamStr)) {
result.append(sqoopAdvancedParamStr);
}
}
}
if(sqoopParameters.getConcurrency() >0){
result.append(" -m ")
.append(sqoopParameters.getConcurrency());

22
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sqoop/generator/SqoopJobGenerator.java

@ -16,6 +16,7 @@
*/
package org.apache.dolphinscheduler.server.worker.task.sqoop.generator;
import org.apache.dolphinscheduler.common.enums.SqoopJobType;
import org.apache.dolphinscheduler.common.task.sqoop.SqoopParameters;
import org.apache.dolphinscheduler.server.entity.TaskExecutionContext;
import org.apache.dolphinscheduler.server.worker.task.sqoop.generator.sources.HdfsSourceGenerator;
@ -62,14 +63,23 @@ public class SqoopJobGenerator {
* @return
*/
public String generateSqoopJob(SqoopParameters sqoopParameters,TaskExecutionContext taskExecutionContext){
createSqoopJobGenerator(sqoopParameters.getSourceType(),sqoopParameters.getTargetType());
if(sourceGenerator == null || targetGenerator == null){
return null;
String sqoopScripts = "";
if (SqoopJobType.TEMPLATE.getDescp().equals(sqoopParameters.getJobType())) {
createSqoopJobGenerator(sqoopParameters.getSourceType(),sqoopParameters.getTargetType());
if(sourceGenerator == null || targetGenerator == null){
throw new RuntimeException("sqoop task source type or target type is null");
}
sqoopScripts = commonGenerator.generate(sqoopParameters)
+ sourceGenerator.generate(sqoopParameters,taskExecutionContext)
+ targetGenerator.generate(sqoopParameters,taskExecutionContext);
} else if (SqoopJobType.CUSTOM.getDescp().equals(sqoopParameters.getJobType())) {
sqoopScripts = sqoopParameters.getCustomShell().replaceAll("\\r\\n", "\n");
}
return commonGenerator.generate(sqoopParameters)
+ sourceGenerator.generate(sqoopParameters,taskExecutionContext)
+ targetGenerator.generate(sqoopParameters,taskExecutionContext);
return sqoopScripts;
}
/**

14
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sqoop/generator/sources/MysqlSourceGenerator.java

@ -77,19 +77,19 @@ public class MysqlSourceGenerator implements ISourceGenerator {
}else{
srcQuery += " WHERE $CONDITIONS";
}
result.append(" --query \'"+srcQuery+"\'");
result.append(" --query \'").append(srcQuery).append("\'");
}
List<Property> mapColumnHive = sourceMysqlParameter.getMapColumnHive();
if(mapColumnHive != null && !mapColumnHive.isEmpty()){
String columnMap = "";
StringBuilder columnMap = new StringBuilder();
for(Property item:mapColumnHive){
columnMap = item.getProp()+"="+ item.getValue()+",";
columnMap.append(item.getProp()).append("=").append(item.getValue()).append(",");
}
if(StringUtils.isNotEmpty(columnMap)){
if(StringUtils.isNotEmpty(columnMap.toString())){
result.append(" --map-column-hive ")
.append(columnMap.substring(0,columnMap.length()-1));
}
@ -98,12 +98,12 @@ public class MysqlSourceGenerator implements ISourceGenerator {
List<Property> mapColumnJava = sourceMysqlParameter.getMapColumnJava();
if(mapColumnJava != null && !mapColumnJava.isEmpty()){
String columnMap = "";
StringBuilder columnMap = new StringBuilder();
for(Property item:mapColumnJava){
columnMap = item.getProp()+"="+ item.getValue()+",";
columnMap.append(item.getProp()).append("=").append(item.getValue()).append(",");
}
if(StringUtils.isNotEmpty(columnMap)){
if(StringUtils.isNotEmpty(columnMap.toString())){
result.append(" --map-column-java ")
.append(columnMap.substring(0,columnMap.length()-1));
}

2
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sqoop/generator/targets/MysqlTargetGenerator.java

@ -78,7 +78,7 @@ public class MysqlTargetGenerator implements ITargetGenerator {
result.append(" --lines-terminated-by '").append(targetMysqlParameter.getLinesTerminated()).append("'");
}
if(targetMysqlParameter.isUpdate()
if(targetMysqlParameter.getIsUpdate()
&& StringUtils.isNotEmpty(targetMysqlParameter.getTargetUpdateKey())
&& StringUtils.isNotEmpty(targetMysqlParameter.getTargetUpdateMode())){
result.append(" --update-key ").append(targetMysqlParameter.getTargetUpdateKey())

2
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/datasource.vue

@ -131,7 +131,7 @@
},
created () {
let supportType = this.supportType || []
this.typeList = _.cloneDeep(this.store.state.dag.dsTypeListS)
this.typeList = this.data.typeList || _.cloneDeep(this.store.state.dag.dsTypeListS)
// Have a specified data source
if (supportType.length) {
let is = (type) => {

962
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sqoop.vue

File diff suppressed because it is too large Load Diff

7
dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js

@ -540,6 +540,9 @@ export default {
'Whether directory': 'Whether directory',
Yes: 'Yes',
No: 'No',
'Hadoop Custom Params': 'Hadoop Params',
'Sqoop Advanced Parameters': 'Sqoop Params',
'Sqoop Job Name': 'Job Name',
'Please enter Mysql Database(required)': 'Please enter Mysql Database(required)',
'Please enter Mysql Table(required)': 'Please enter Mysql Table(required)',
'Please enter Columns (Comma separated)': 'Please enter Columns (Comma separated)',
@ -554,6 +557,8 @@ export default {
'Please enter Lines Terminated': 'Please enter Lines Terminated',
'Please enter Concurrency': 'Please enter Concurrency',
'Please enter Update Key': 'Please enter Update Key',
'Please enter Job Name(required)': 'Please enter Job Name(required)',
'Please enter Custom Shell(required)': 'Please enter Custom Shell(required)',
Direct: 'Direct',
Type: 'Type',
ModelType: 'ModelType',
@ -587,6 +592,8 @@ export default {
'All Columns': 'All Columns',
'Some Columns': 'Some Columns',
'Branch flow': 'Branch flow',
'Custom Job': 'Custom Job',
'Custom Script': 'Custom Script',
'Cannot select the same node for successful branch flow and failed branch flow': 'Cannot select the same node for successful branch flow and failed branch flow',
'Successful branch flow and failed branch flow are required': 'Successful branch flow and failed branch flow are required',
'Unauthorized or deleted resources': 'Unauthorized or deleted resources',

7
dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js

@ -540,6 +540,9 @@ export default {
'Whether directory': '是否文件夹',
Yes: '是',
No: '否',
'Hadoop Custom Params': 'Hadoop参数',
'Sqoop Advanced Parameters': 'Sqoop参数',
'Sqoop Job Name': '任务名称',
'Please enter Mysql Database(required)': '请输入Mysql数据库(必填)',
'Please enter Mysql Table(required)': '请输入Mysql表名(必填)',
'Please enter Columns (Comma separated)': '请输入列名 , 隔开',
@ -554,6 +557,8 @@ export default {
'Please enter Lines Terminated': '请输入行分隔符',
'Please enter Concurrency': '请输入并发度',
'Please enter Update Key': '请输入更新列',
'Please enter Job Name(required)': '请输入任务名称(必填)',
'Please enter Custom Shell(required)': '请输入自定义脚本',
Direct: '流向',
Type: '类型',
ModelType: '模式',
@ -587,6 +592,8 @@ export default {
'All Columns': '全表导入',
'Some Columns': '选择列',
'Branch flow': '分支流转',
'Custom Job': '自定义任务',
'Custom Script': '自定义脚本',
'Cannot select the same node for successful branch flow and failed branch flow': '成功分支流转和失败分支流转不能选择同一个节点',
'Successful branch flow and failed branch flow are required': '成功分支流转和失败分支流转必填',
'Unauthorized or deleted resources': '未授权或已删除资源',

34
e2e/src/test/java/org/apache/dolphinscheduler/common/BrowserCommon.java

@ -23,7 +23,7 @@ import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import redis.clients.jedis.Jedis;
import org.openqa.selenium.JavascriptExecutor;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@ -115,6 +115,7 @@ public class BrowserCommon {
/**
* Click button element
*
* @param locator By
* @return clickButton
*/
@ -128,12 +129,13 @@ public class BrowserCommon {
/**
* Click Navigation Bar element
*
* @param locator By
* @return clickButton
*/
public void clickTopElement(By locator) {
WebElement element = driver.findElement(locator);
JavascriptExecutor executor = (JavascriptExecutor)driver;
JavascriptExecutor executor = (JavascriptExecutor) driver;
executor.executeScript("arguments[0].click();", element);
}
@ -164,6 +166,7 @@ public class BrowserCommon {
inputElement.sendKeys(content);
return inputElement;
}
/**
* clear element
*
@ -182,9 +185,8 @@ public class BrowserCommon {
*
* @param codeMirrorLocator By codeMirror
* @param codeMirrorLineLocator By codeMirrorLine
*/
public void inputCodeMirror(By codeMirrorLocator,By codeMirrorLineLocator,String content) {
public void inputCodeMirror(By codeMirrorLocator, By codeMirrorLineLocator, String content) {
WebElement codeMirrorElement = locateElement(codeMirrorLocator);
WebElement codeMirrorLineElement = locateElement(codeMirrorLineLocator);
codeMirrorElement.click();
@ -193,10 +195,11 @@ public class BrowserCommon {
/**
* move to element
*
* @param locator BY
* @return actions
*/
public Actions moveToElement(By locator){
public Actions moveToElement(By locator) {
return actions.moveToElement(locateElement(locator));
}
@ -206,14 +209,14 @@ public class BrowserCommon {
* @param source_locator BY
* @param target_locator BY
*/
public void dragAndDrop(By source_locator, By target_locator){
public void dragAndDrop(By source_locator, By target_locator) {
WebElement sourceElement = locateElement(source_locator);
WebElement targetElement = locateElement(target_locator);
actions.dragAndDrop(sourceElement, targetElement).perform();
actions.release();
}
public void moveToDragElement(By target_locator, int X, int Y){
public void moveToDragElement(By target_locator, int X, int Y) {
WebElement targetElement = locateElement(target_locator);
actions.dragAndDropBy(targetElement, X, Y).perform();
actions.release();
@ -249,9 +252,22 @@ public class BrowserCommon {
return driver;
}
/**
* select time
*
* @return WebElement
*/
public WebElement selectDate(String js, By locator_time, String date) {
JavascriptExecutor removeAttribute = (JavascriptExecutor) driver;
removeAttribute.executeScript("var setDate=" + js + ";setDate.removeAttribute('readonly');");
WebElement dateElement = locateElement(locator_time);
//input date
dateElement.clear();
dateElement.sendKeys(Keys.HOME,Keys.chord(Keys.SHIFT,Keys.END));
dateElement.sendKeys(date);
return dateElement;
}
/**
* Multi-window switch handle, according to the handle number passed in

36
e2e/src/test/java/org/apache/dolphinscheduler/data/security/AlertManageData.java

@ -0,0 +1,36 @@
/*
* 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.data.security;
public class AlertManageData {
/**
* Alert Name
*/
public static final String ALERT_NAME = "selenium_alert_Name";
/**
* Alert Type
*/
public static final String ALERT_TYPE = "邮件";
/**
* Alert Description
*/
public static final String DESCRIPTION = "create alert test";
public static final String ALERT_MANAGE = "告警组管理 - DolphinScheduler";
}

42
e2e/src/test/java/org/apache/dolphinscheduler/data/security/QueueManageData.java

@ -0,0 +1,42 @@
/*
* 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.data.security;
public class QueueManageData {
/**
* Create Queue Name
*/
public static final String QUEUE_NAME = "selenium_queue_name";
/**
* Create Queue Value
*/
public static final String QUEUE_VALUE = "selenium_queue_value";
/**
* Edit Queue Name
*/
public static final String EDIT_QUEUE_NAME = "_edit";
/**
* Edit Queue Value
*/
public static final String EDIT_QUEUE_VALUE = "_edit";
public static final String QUEUE_MANAGE = "队列管理 - DolphinScheduler";
}

24
e2e/src/test/java/org/apache/dolphinscheduler/data/security/TokenManageData.java

@ -0,0 +1,24 @@
/*
* 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.data.security;
public class TokenManageData {
public static final String TOKEN_MANAGE = "令牌管理 - DolphinScheduler";
public static final String DATE = "2038-06-10 00:00:00";
}

35
e2e/src/test/java/org/apache/dolphinscheduler/locator/security/AlertManageLocator.java

@ -0,0 +1,35 @@
/*
* 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.locator.security;
import org.openqa.selenium.By;
public class AlertManageLocator {
//create alert locator
public static final By CLICK_ALERT_MANAGE = By.xpath("//div[4]/div/a/div/a/span");
public static final By CLICK_CREATE_ALERT = By.xpath("//div[1]/div[2]/div/div[2]/div[2]/div/div[1]/button/span");
public static final By INPUT_ALERT_NAME = By.xpath("//div[2]/div/div[1]/div[2]/div/input");
public static final By CLICK_ALERT_TYPE = By.xpath("//div[2]/div/div[2]/div/div[2]/div[2]/div/div[1]/div/input");
public static final By SELECT_ALERT_EMAIL = By.xpath("//div[2]/div/div[2]/div/div[2]/div[2]/div/div[2]/div/div/div/ul/li[1]/span");
public static final By INPUT_ALERT_DESCRIPTION = By.xpath("//textarea");
public static final By SUBMIT_ALERT = By.xpath("//div[3]/button[2]/span");
//delete alert locator
public static final By DELETE_ALERT_BUTTON = By.xpath("//span/button");
public static final By CONFIRM_DELETE_ALERT_BUTTON = By.xpath("//div[2]/div/button[2]/span");
}

31
e2e/src/test/java/org/apache/dolphinscheduler/locator/security/QueueManageLocator.java

@ -0,0 +1,31 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.locator.security;
import org.openqa.selenium.By;
public class QueueManageLocator {
//create queue locator
public static final By CLICK_QUEUE_MANAGE = By.xpath("//div[6]/div/a/div/a/span");
public static final By CLICK_CREATE_QUEUE = By.xpath("//button/span");
public static final By INPUT_QUEUE_NAME = By.xpath("//div[2]/div/div/div[2]/div/input");
public static final By INPUT_QUEUE_VALUE = By.xpath("//div[2]/div[2]/div/input");
public static final By SUBMIT_QUEUE = By.xpath("//button[2]/span");
//edit queue locator
public static final By CLICK_EDIT_QUEUE = By.xpath("//td[6]/button/i");
}

41
e2e/src/test/java/org/apache/dolphinscheduler/locator/security/TokenManageLocator.java

@ -0,0 +1,41 @@
/*
* 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.locator.security;
import org.openqa.selenium.By;
public class TokenManageLocator {
//create token
public static final By CLICK_TOKEN_MANAGE = By.xpath("//div[7]/div/a/div/a/span");
public static final By CLICK_CREATE_TOKEN = By.xpath("//div[2]/div/div[2]/div[2]/div/div[1]/button/span");
public static final By SELECT_USER = By.xpath("//div[2]/div[2]/div/div/div/span/i");
public static final By CLICK_GENERATE_TOKEN_BUTTON = By.xpath("//div[3]/div[2]/button/span");
public static final By CLICK_SUBMIT_BUTTON = By.xpath("//div[3]/button[2]/span");
//edit token
public static final By CLICK_EDIT_BUTTON = By.xpath("//div[3]/div[1]/div/table/tr[2]/td[7]/button/i");
//delete token
public static final By CLICK_DELETE_BUTTON = By.xpath("//div[3]/div[1]/div/table/tr[2]/td[7]/span/button");
public static final By CLICK_CONFIRM_DELETE_BUTTON = By.xpath("//div[2]/div/button[2]/span");
}

77
e2e/src/test/java/org/apache/dolphinscheduler/page/security/AlertManagePage.java

@ -0,0 +1,77 @@
/*
* 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.page.security;
import org.apache.dolphinscheduler.common.PageCommon;
import org.apache.dolphinscheduler.data.security.AlertManageData;
import org.apache.dolphinscheduler.locator.security.AlertManageLocator;
import org.openqa.selenium.WebDriver;
public class AlertManagePage extends PageCommon {
/**
* Unique constructor
* @param driver driver
*/
public AlertManagePage(WebDriver driver) {
super(driver);
}
/**
* createTenant
*
* @return Whether to enter the specified page after create tenant
*/
public boolean createAlert() throws InterruptedException {
// click alert manage
clickElement(AlertManageLocator.CLICK_ALERT_MANAGE);
Thread.sleep(1000);
// click create alert button
clickElement(AlertManageLocator.CLICK_CREATE_ALERT);
Thread.sleep(1000);
// input alert data
sendInput(AlertManageLocator.INPUT_ALERT_NAME, AlertManageData.ALERT_NAME);
clickElement(AlertManageLocator.CLICK_ALERT_TYPE);
clickElement(AlertManageLocator.SELECT_ALERT_EMAIL);
sendInput(AlertManageLocator.INPUT_ALERT_DESCRIPTION, AlertManageData.DESCRIPTION);
// click button
clickButton(AlertManageLocator.SUBMIT_ALERT);
// Whether to enter the specified page after submit
return ifTitleContains(AlertManageData.ALERT_MANAGE);
}
public boolean deleteAlert() throws InterruptedException {
// click user manage
clickElement(AlertManageLocator.CLICK_ALERT_MANAGE);
// click delete user button
clickButton(AlertManageLocator.DELETE_ALERT_BUTTON);
// click confirm delete button
clickButton(AlertManageLocator.CONFIRM_DELETE_ALERT_BUTTON);
// Whether to enter the specified page after submit
return ifTitleContains(AlertManageData.ALERT_MANAGE);
}
}

85
e2e/src/test/java/org/apache/dolphinscheduler/page/security/QueueManagePage.java

@ -0,0 +1,85 @@
/*
* 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.page.security;
import org.apache.dolphinscheduler.common.PageCommon;
import org.apache.dolphinscheduler.data.security.QueueManageData;
import org.apache.dolphinscheduler.locator.security.QueueManageLocator;
import org.openqa.selenium.WebDriver;
public class QueueManagePage extends PageCommon {
/**
* Unique constructor
* @param driver driver
*/
public QueueManagePage(WebDriver driver) {
super(driver);
}
/**
* create queue
*
* @return Whether to enter the specified page after create queue
*/
public boolean createQueue() throws InterruptedException {
// click queue manage
clickElement(QueueManageLocator.CLICK_QUEUE_MANAGE);
Thread.sleep(1000);
// click create queue button
clickElement(QueueManageLocator.CLICK_CREATE_QUEUE);
Thread.sleep(1000);
// input queue data
sendInput(QueueManageLocator.INPUT_QUEUE_NAME, QueueManageData.QUEUE_NAME);
sendInput(QueueManageLocator.INPUT_QUEUE_VALUE, QueueManageData.QUEUE_VALUE);
// click button
clickButton(QueueManageLocator.SUBMIT_QUEUE);
// Whether to enter the specified page after submit
return ifTitleContains(QueueManageData.QUEUE_MANAGE);
}
/**
* edit queue
*
* @return Whether to enter the specified page after create queue
*/
public boolean editQueue() throws InterruptedException {
// click queue manage
Thread.sleep(1000);
clickElement(QueueManageLocator.CLICK_QUEUE_MANAGE);
Thread.sleep(1000);
// click edit queue button
clickElement(QueueManageLocator.CLICK_EDIT_QUEUE);
Thread.sleep(1000);
// input queue data
sendInput(QueueManageLocator.INPUT_QUEUE_NAME, QueueManageData.EDIT_QUEUE_NAME);
sendInput(QueueManageLocator.INPUT_QUEUE_VALUE, QueueManageData.EDIT_QUEUE_VALUE);
// click button
clickButton(QueueManageLocator.SUBMIT_QUEUE);
// Whether to enter the specified page after submit
return ifTitleContains(QueueManageData.QUEUE_MANAGE);
}
}

94
e2e/src/test/java/org/apache/dolphinscheduler/page/security/TokenManagePage.java

@ -0,0 +1,94 @@
/*
* 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.page.security;
import org.apache.dolphinscheduler.common.PageCommon;
import org.apache.dolphinscheduler.data.security.TokenManageData;
import org.apache.dolphinscheduler.locator.security.TokenManageLocator;
import org.openqa.selenium.WebDriver;
public class TokenManagePage extends PageCommon {
public TokenManagePage(WebDriver driver) {
super(driver);
}
/**
* createTenant
*
* @return Whether to enter the specified page after creat tenant
*/
public boolean createToken() throws InterruptedException {
//create token
Thread.sleep(1000);
clickElement(TokenManageLocator.CLICK_TOKEN_MANAGE);
Thread.sleep(1000);
// click create token button
clickButton(TokenManageLocator.CLICK_CREATE_TOKEN);
Thread.sleep(1000);
//selectDate(TokenManageLocator.js, TokenManageLocator.CLICK_TIME, TokenManageData.DATE);
clickButton(TokenManageLocator.SELECT_USER);
clickButton(TokenManageLocator.CLICK_GENERATE_TOKEN_BUTTON);
Thread.sleep(2500);
// click button
clickButton(TokenManageLocator.CLICK_SUBMIT_BUTTON);
// Whether to enter the specified page after submit
return ifTitleContains(TokenManageData.TOKEN_MANAGE);
}
//edit token
public boolean editToken() throws InterruptedException {
// click token manage
clickElement(TokenManageLocator.CLICK_TOKEN_MANAGE);
Thread.sleep(1000);
// click create token button
clickButton(TokenManageLocator.CLICK_EDIT_BUTTON);
Thread.sleep(1000);
clickButton(TokenManageLocator.SELECT_USER);
clickButton(TokenManageLocator.CLICK_GENERATE_TOKEN_BUTTON);
Thread.sleep(2500);
// click button
clickButton(TokenManageLocator.CLICK_SUBMIT_BUTTON);
// Whether to enter the specified page after submit
return ifTitleContains(TokenManageData.TOKEN_MANAGE);
}
//delete token
public boolean deleteToken() throws InterruptedException {
// click token manage
clickElement(TokenManageLocator.CLICK_TOKEN_MANAGE);
Thread.sleep(1000);
clickButton(TokenManageLocator.CLICK_DELETE_BUTTON);
clickButton(TokenManageLocator.CLICK_CONFIRM_DELETE_BUTTON);
return ifTitleContains(TokenManageData.TOKEN_MANAGE);
}
}

4
e2e/src/test/java/org/apache/dolphinscheduler/testcase/LoginTest.java → e2e/src/test/java/org/apache/dolphinscheduler/testcase/TestLogin.java

@ -22,10 +22,10 @@ import org.testng.annotations.Test;
import static org.apache.dolphinscheduler.base.BaseTest.driver;
@Test(groups={"functionTests","login"})
public class LoginTest {
public class TestLogin {
private LoginPage loginPage;
@Test(description = "LoginTest", priority = 1)
@Test(description = "TestLogin")
public void testLogin() throws InterruptedException {
loginPage = new LoginPage(driver);
System.out.println("===================================");

42
e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteAlert.java

@ -0,0 +1,42 @@
/*
* 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.testcase.testDeleteData;
import org.apache.dolphinscheduler.base.BaseTest;
import org.apache.dolphinscheduler.page.security.AlertManagePage;
import org.apache.dolphinscheduler.page.security.TenantManagePage;
import org.testng.annotations.Test;
public class TestDeleteAlert extends BaseTest {
private AlertManagePage alertManagePage;
private TenantManagePage tenantManagePage;
@Test(groups={"functionTests"},dependsOnGroups = { "login","alert" },description = "TestDeleteAlert",priority=8)
public void testDeleteAlert() throws InterruptedException {
tenantManagePage = new TenantManagePage(driver);
System.out.println("jump to testSecurity to delete alert");
tenantManagePage.jumpSecurity();
alertManagePage = new AlertManagePage(driver);
//assert alert manage page
System.out.println("start delete alert");
assert alertManagePage.deleteAlert();
System.out.println("end delete alert");
System.out.println("===================================");
}
}

6
e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteProjectTest.java → e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteProject.java

@ -14,16 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.testcase.deleteData;
package org.apache.dolphinscheduler.testcase.testDeleteData;
import org.apache.dolphinscheduler.base.BaseTest;
import org.apache.dolphinscheduler.page.project.CreateProjectPage;
import org.testng.annotations.Test;
public class DeleteProjectTest extends BaseTest {
public class TestDeleteProject extends BaseTest {
private CreateProjectPage createProjectPage;
@Test(groups={"functionTests"},dependsOnGroups = { "login","project"},description = "DeleteProjectTest",priority=7)
@Test(groups={"functionTests"},dependsOnGroups = { "login","project"},description = "TestDeleteProject")
public void testDeleteProject() throws InterruptedException {
createProjectPage = new CreateProjectPage(driver);
//jump to project manage page

6
e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteTenantTest.java → e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteTenant.java

@ -14,16 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.testcase.deleteData;
package org.apache.dolphinscheduler.testcase.testDeleteData;
import org.apache.dolphinscheduler.base.BaseTest;
import org.apache.dolphinscheduler.page.security.TenantManagePage;
import org.testng.annotations.Test;
public class DeleteTenantTest extends BaseTest {
public class TestDeleteTenant extends BaseTest {
private TenantManagePage tenantManagePage;
@Test(groups={"functionTests"},dependsOnGroups = { "login","createTenant"},description = "DeleteTenantTest",priority=9)
@Test(groups={"functionTests"},dependsOnGroups = { "login","createTenant"},description = "TestDeleteTenant")
public void testDeleteTenant() throws InterruptedException {
tenantManagePage = new TenantManagePage(driver);
//assert tenant manage page

42
e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteToken.java

@ -0,0 +1,42 @@
/*
* 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.testcase.testDeleteData;
import org.apache.dolphinscheduler.base.BaseTest;
import org.apache.dolphinscheduler.page.security.TenantManagePage;
import org.apache.dolphinscheduler.page.security.TokenManagePage;
import org.testng.annotations.Test;
public class TestDeleteToken extends BaseTest {
private TokenManagePage tokenManagePage;
private TenantManagePage tenantManagePage;
@Test(groups = {"functionTests"}, dependsOnGroups = {"login", "token"}, description = "TestDeleteToken")
public void testUserManage() throws InterruptedException {
tenantManagePage = new TenantManagePage(driver);
System.out.println("jump to security to delete token");
tenantManagePage.jumpSecurity();
tokenManagePage = new TokenManagePage(driver);
//delete token
System.out.println("start delete token");
assert tokenManagePage.deleteToken();
System.out.println("end delete token");
System.out.println("===================================");
}
}

6
e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteUserTest.java → e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteUser.java

@ -14,18 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.testcase.deleteData;
package org.apache.dolphinscheduler.testcase.testDeleteData;
import org.apache.dolphinscheduler.base.BaseTest;
import org.apache.dolphinscheduler.page.security.TenantManagePage;
import org.apache.dolphinscheduler.page.security.UserManagePage;
import org.testng.annotations.Test;
public class DeleteUserTest extends BaseTest {
public class TestDeleteUser extends BaseTest {
private UserManagePage userManagePage;
private TenantManagePage tenantManagePage;
@Test(groups={"functionTests"},dependsOnGroups = { "login","user" },description = "DeleteUserTest",priority=8)
@Test(groups={"functionTests"},dependsOnGroups = { "login","user" },description = "TestDeleteUser")
public void testDeleteUser() throws InterruptedException {
tenantManagePage = new TenantManagePage(driver);
System.out.println("jump to security to delete user");

6
e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteWorkflowTest.java → e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteWorkflow.java

@ -14,18 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.testcase.deleteData;
package org.apache.dolphinscheduler.testcase.testDeleteData;
import org.apache.dolphinscheduler.base.BaseTest;
import org.apache.dolphinscheduler.page.project.CreateProjectPage;
import org.apache.dolphinscheduler.page.project.CreateWorkflowPage;
import org.testng.annotations.Test;
public class DeleteWorkflowTest extends BaseTest {
public class TestDeleteWorkflow extends BaseTest {
private CreateWorkflowPage createWorkflowPage;
private CreateProjectPage createProjectPage;
@Test(groups={"functionTests"},dependsOnGroups = { "login","workflow"},description = "DeleteWorkflowTest",priority=6)
@Test(groups={"functionTests"},dependsOnGroups = { "login","workflow"},description = "TestDeleteWorkflow")
public void testDeleteWorkflow() throws InterruptedException {
createProjectPage = new CreateProjectPage(driver);
//jump to project manage page

6
e2e/src/test/java/org/apache/dolphinscheduler/testcase/project/CreateProjectTest.java → e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestCreateProject.java

@ -14,16 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.testcase.project;
package org.apache.dolphinscheduler.testcase.testProject;
import org.apache.dolphinscheduler.base.BaseTest;
import org.apache.dolphinscheduler.page.project.CreateProjectPage;
import org.testng.annotations.Test;
public class CreateProjectTest extends BaseTest {
public class TestCreateProject extends BaseTest {
private CreateProjectPage createProjectPage;
@Test(groups={"functionTests","project"},dependsOnGroups = { "login" },description = "CreateProjectTest",priority=4)
@Test(groups={"functionTests","project"},dependsOnGroups = { "login" },description = "CreateProjectTest")
public void testCreateProject() throws InterruptedException {
createProjectPage = new CreateProjectPage(driver);
// enter user manage page

6
e2e/src/test/java/org/apache/dolphinscheduler/testcase/project/CreateWorkflowTest.java → e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestCreateWorkflow.java

@ -14,19 +14,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.testcase.project;
package org.apache.dolphinscheduler.testcase.testProject;
import org.apache.dolphinscheduler.base.BaseTest;
import org.apache.dolphinscheduler.page.project.CreateProjectPage;
import org.apache.dolphinscheduler.page.project.CreateWorkflowPage;
import org.testng.annotations.Test;
public class CreateWorkflowTest extends BaseTest {
public class TestCreateWorkflow extends BaseTest {
private CreateWorkflowPage createWorkflowPage;
private CreateProjectPage createProjectPage;
@Test(groups={"functionTests","workflow"},dependsOnGroups = { "login" },description = "CreateWorkflowTest",priority=5)
@Test(groups={"functionTests","workflow"},dependsOnGroups = { "login" },description = "TestCreateWorkflow")
public void testCreateWorkflow() throws InterruptedException {
createProjectPage = new CreateProjectPage(driver);
System.out.println("jump to the projectManage page to create workflow");

36
e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestAlertManage.java

@ -0,0 +1,36 @@
/*
* 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.testcase.testSecurity;
import org.apache.dolphinscheduler.base.BaseTest;
import org.apache.dolphinscheduler.page.security.AlertManagePage;
import org.testng.annotations.Test;
public class TestAlertManage extends BaseTest {
private AlertManagePage alertManagePage;
@Test(groups={"functionTests","alert"},dependsOnGroups = { "login" },description = "AlertManagePage")
public void testAlertManage() throws InterruptedException {
alertManagePage = new AlertManagePage(driver);
//assert alert manage page
System.out.println("start create alert");
assert alertManagePage.createAlert();
System.out.println("end create alert");
System.out.println("===================================");
}
}

42
e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestQueueManage.java

@ -0,0 +1,42 @@
/*
* 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.testcase.testSecurity;
import org.apache.dolphinscheduler.base.BaseTest;
import org.apache.dolphinscheduler.page.security.QueueManagePage;
import org.testng.annotations.Test;
public class TestQueueManage extends BaseTest {
private QueueManagePage queueManagePage;
@Test(groups={"functionTests","queue"},dependsOnGroups = { "login" },description = "TestQueueManage")
public void testTenantManage() throws InterruptedException {
queueManagePage = new QueueManagePage(driver);
//create queue
System.out.println("start create queue");
assert queueManagePage.createQueue();
System.out.println("end create queue");
System.out.println("===================================");
//edit queue
System.out.println("start edit queue");
assert queueManagePage.editQueue();
System.out.println("end edit queue");
System.out.println("===================================");
}
}

6
e2e/src/test/java/org/apache/dolphinscheduler/testcase/security/TenantManageTest.java → e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestTenantManage.java

@ -14,17 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.testcase.security;
package org.apache.dolphinscheduler.testcase.testSecurity;
import org.apache.dolphinscheduler.base.BaseTest;
import org.apache.dolphinscheduler.page.security.TenantManagePage;
import org.testng.annotations.Test;
public class TenantManageTest extends BaseTest {
public class TestTenantManage extends BaseTest {
private TenantManagePage tenantManagePage;
@Test(groups={"functionTests","createTenant"},dependsOnGroups = { "login" },description = "TenantManageTest",priority=2)
@Test(groups={"functionTests","createTenant"},dependsOnGroups = { "login" },description = "TestTenantManage")
public void testTenantManage() throws InterruptedException {
tenantManagePage = new TenantManagePage(driver);
//assert tenant manage page

43
e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestTokenManage.java

@ -0,0 +1,43 @@
/*
* 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.testcase.testSecurity;
import org.apache.dolphinscheduler.base.BaseTest;
import org.apache.dolphinscheduler.page.security.TokenManagePage;
import org.testng.annotations.Test;
public class TestTokenManage extends BaseTest {
private TokenManagePage tokenManagePage;
@Test(groups={"functionTests","token"},dependsOnGroups = { "login" },description = "TestTokenManage")
public void testUserManage() throws InterruptedException {
tokenManagePage = new TokenManagePage(driver);
//generate token
System.out.println("start create token");
assert tokenManagePage.createToken();
System.out.println("end create token");
System.out.println("===================================");
//edit token
System.out.println("start edit token");
assert tokenManagePage.editToken();
System.out.println("end edit token");
System.out.println("===================================");
}
}

6
e2e/src/test/java/org/apache/dolphinscheduler/testcase/security/UserManageTest.java → e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestUserManage.java

@ -14,16 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.testcase.security;
package org.apache.dolphinscheduler.testcase.testSecurity;
import org.apache.dolphinscheduler.base.BaseTest;
import org.apache.dolphinscheduler.page.security.UserManagePage;
import org.testng.annotations.Test;
public class UserManageTest extends BaseTest {
public class TestUserManage extends BaseTest {
private UserManagePage userManagePage;
@Test(groups={"functionTests","user"},dependsOnGroups = { "login" },description = "UserManageTest",priority=3)
@Test(groups={"functionTests","user"},dependsOnGroups = { "login" },description = "TestUserManage")
public void testUserManage() throws InterruptedException {
userManagePage = new UserManagePage(driver);
//assert user manage page

28
e2e/testng.xml

@ -16,24 +16,30 @@
~ limitations under the License.
-->
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="dolphinscheduler_e2e" parallel="true">
<suite name="dolphinscheduler_e2e" verbose="1">
<test name="dolphinscheduler_test" preserve-order="true">
<groups>
<run>
<include name="functionTests"/>
</run>
</groups>
<classes>
<class name="org.apache.dolphinscheduler.testcase.LoginTest"></class>
<class name="org.apache.dolphinscheduler.testcase.security.TenantManageTest"></class>
<class name="org.apache.dolphinscheduler.testcase.security.UserManageTest"></class>
<class name="org.apache.dolphinscheduler.testcase.project.CreateProjectTest"></class>
<class name="org.apache.dolphinscheduler.testcase.project.CreateWorkflowTest"></class>
<class name="org.apache.dolphinscheduler.testcase.deleteData.DeleteWorkflowTest"></class>
<class name="org.apache.dolphinscheduler.testcase.deleteData.DeleteProjectTest"></class>
<class name="org.apache.dolphinscheduler.testcase.deleteData.DeleteUserTest"></class>
<class name="org.apache.dolphinscheduler.testcase.deleteData.DeleteTenantTest"></class>
<class name="org.apache.dolphinscheduler.testcase.TestLogin"></class>
<class name="org.apache.dolphinscheduler.testcase.testSecurity.TestTenantManage"></class>
<class name="org.apache.dolphinscheduler.testcase.testSecurity.TestUserManage"></class>
<class name="org.apache.dolphinscheduler.testcase.testSecurity.TestAlertManage"></class>
<class name="org.apache.dolphinscheduler.testcase.testSecurity.TestQueueManage"></class>
<class name="org.apache.dolphinscheduler.testcase.testSecurity.TestTokenManage"></class>
<class name="org.apache.dolphinscheduler.testcase.testProject.TestCreateProject"></class>
<class name="org.apache.dolphinscheduler.testcase.testProject.TestCreateWorkflow"></class>
<class name="org.apache.dolphinscheduler.testcase.testDeleteData.TestDeleteWorkflow"></class>
<class name="org.apache.dolphinscheduler.testcase.testDeleteData.TestDeleteProject"></class>
<class name="org.apache.dolphinscheduler.testcase.testDeleteData.TestDeleteAlert"></class>
<class name="org.apache.dolphinscheduler.testcase.testDeleteData.TestDeleteToken"></class>
<class name="org.apache.dolphinscheduler.testcase.testDeleteData.TestDeleteUser"></class>
<class name="org.apache.dolphinscheduler.testcase.testDeleteData.TestDeleteTenant"></class>
</classes>
</test>

Loading…
Cancel
Save