This commit is contained in:
parent
4a8e148b42
commit
f9c91b8cbe
|
|
@ -28,7 +28,7 @@ public class StatusTest {
|
|||
|
||||
@Test
|
||||
public void testGetCode() {
|
||||
assertEquals(Status.SUCCESS.getCode(), 0);
|
||||
assertEquals(0, Status.SUCCESS.getCode());
|
||||
assertNotEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR.getCode(), 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import org.apache.dolphinscheduler.common.enums.ProgramType;
|
|||
import org.apache.dolphinscheduler.common.process.ResourceInfo;
|
||||
import org.apache.dolphinscheduler.common.task.AbstractParameters;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -222,11 +223,14 @@ public class SparkParameters extends AbstractParameters {
|
|||
@Override
|
||||
public List<String> getResourceFilesList() {
|
||||
if(resourceList !=null ) {
|
||||
this.resourceList.add(mainJar);
|
||||
return resourceList.stream()
|
||||
List<String> resourceFilesList = resourceList.stream()
|
||||
.map(ResourceInfo::getRes).collect(Collectors.toList());
|
||||
if(mainJar != null){
|
||||
resourceFilesList.add(mainJar.getRes());
|
||||
}
|
||||
return resourceFilesList;
|
||||
}
|
||||
return null;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
*/
|
||||
public class Stopper {
|
||||
|
||||
private static volatile AtomicBoolean signal = new AtomicBoolean(false);
|
||||
private static AtomicBoolean signal = new AtomicBoolean(false);
|
||||
|
||||
public static final boolean isStopped(){
|
||||
return signal.get();
|
||||
|
|
|
|||
|
|
@ -24,12 +24,6 @@ import java.util.List;
|
|||
|
||||
public class StringTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void test1(){
|
||||
System.out.println(String.format("%s_%010d_%010d", String.valueOf(1), Long.valueOf(3), Integer.valueOf(4)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stringCompareTest(){
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ public class SubProcessTaskExecThread extends MasterBaseTaskExecThread {
|
|||
* set task instance state
|
||||
* @return
|
||||
*/
|
||||
private Boolean setTaskInstanceState(){
|
||||
private boolean setTaskInstanceState(){
|
||||
subProcessInstance = processService.findSubProcessInstance(processInstance.getId(), taskInstance.getId());
|
||||
if(subProcessInstance == null || taskInstance.getState().typeIsFinished()){
|
||||
return false;
|
||||
|
|
@ -131,8 +131,8 @@ public class SubProcessTaskExecThread extends MasterBaseTaskExecThread {
|
|||
if (taskInstance.getState().typeIsFinished()) {
|
||||
logger.info("sub work flow task {} already complete. task state:{}, parent work flow instance state:{}",
|
||||
this.taskInstance.getName(),
|
||||
this.taskInstance.getState().toString(),
|
||||
this.processInstance.getState().toString());
|
||||
this.taskInstance.getState(),
|
||||
this.processInstance.getState());
|
||||
return;
|
||||
}
|
||||
while (Stopper.isRunning()) {
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ public class SqlTask extends AbstractTask {
|
|||
List<User> users = alertDao.queryUserByAlertGroupId(instance.getWarningGroupId());
|
||||
|
||||
// receiving group list
|
||||
List<String> receviersList = new ArrayList<String>();
|
||||
List<String> receviersList = new ArrayList<>();
|
||||
for(User user:users){
|
||||
receviersList.add(user.getEmail().trim());
|
||||
}
|
||||
|
|
@ -406,7 +406,7 @@ public class SqlTask extends AbstractTask {
|
|||
}
|
||||
|
||||
// copy list
|
||||
List<String> receviersCcList = new ArrayList<String>();
|
||||
List<String> receviersCcList = new ArrayList<>();
|
||||
// Custom Copier
|
||||
String receiversCc = sqlParameters.getReceiversCc();
|
||||
if (StringUtils.isNotEmpty(receiversCc)){
|
||||
|
|
@ -420,7 +420,7 @@ public class SqlTask extends AbstractTask {
|
|||
if(EnumUtils.isValidEnum(ShowType.class,showTypeName)){
|
||||
Map<String, Object> mailResult = MailUtils.sendMails(receviersList,
|
||||
receviersCcList, title, content, ShowType.valueOf(showTypeName));
|
||||
if(!(Boolean) mailResult.get(STATUS)){
|
||||
if(!(boolean) mailResult.get(STATUS)){
|
||||
throw new RuntimeException("send mail failed!");
|
||||
}
|
||||
}else{
|
||||
|
|
@ -477,22 +477,7 @@ public class SqlTask extends AbstractTask {
|
|||
ProcessInstance processInstance = processService.findProcessInstanceByTaskId(taskProps.getTaskInstId());
|
||||
int userId = processInstance.getExecutorId();
|
||||
|
||||
PermissionCheck<Integer> permissionCheckUdf = new PermissionCheck<Integer>(AuthorizationType.UDF, processService,udfFunIds,userId,logger);
|
||||
PermissionCheck<Integer> permissionCheckUdf = new PermissionCheck<>(AuthorizationType.UDF, processService,udfFunIds,userId,logger);
|
||||
permissionCheckUdf.checkPermission();
|
||||
}
|
||||
|
||||
/**
|
||||
* check data source permission
|
||||
* @param dataSourceId data source id
|
||||
* @return if has download permission return true else false
|
||||
*/
|
||||
private void checkDataSourcePermission(int dataSourceId) throws Exception{
|
||||
// process instance
|
||||
ProcessInstance processInstance = processService.findProcessInstanceByTaskId(taskProps.getTaskInstId());
|
||||
int userId = processInstance.getExecutorId();
|
||||
|
||||
PermissionCheck<Integer> permissionCheckDataSource = new PermissionCheck<Integer>(AuthorizationType.DATASOURCE, processService,new Integer[]{dataSourceId},userId,logger);
|
||||
permissionCheckDataSource.checkPermission();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ public class SparkTaskTest {
|
|||
|
||||
logger.info("spark task command : {}", sparkArgs);
|
||||
|
||||
Assert.assertEquals(sparkArgs.split(" ")[0], SPARK2_COMMAND );
|
||||
Assert.assertEquals(SPARK2_COMMAND, sparkArgs.split(" ")[0]);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue