mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-12-05 13:48:10 +08:00
Merge remote-tracking branch 'upstream/dev' into spilit
This commit is contained in:
commit
591f4f2830
@ -33,33 +33,33 @@ public class MailParamsConstants {
|
|||||||
public static final String NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS = "receiverCcs";
|
public static final String NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS = "receiverCcs";
|
||||||
|
|
||||||
public static final String MAIL_PROTOCOL = "transport.protocol";
|
public static final String MAIL_PROTOCOL = "transport.protocol";
|
||||||
public static final String NAME_MAIL_PROTOCOL = "protocol";
|
public static final String NAME_MAIL_PROTOCOL = "mail.protocol";
|
||||||
|
|
||||||
public static final String MAIL_SMTP_HOST = "smtp.host";
|
public static final String MAIL_SMTP_HOST = "mail.smtp.host";
|
||||||
public static final String NAME_MAIL_SMTP_HOST = "serverHost";
|
public static final String NAME_MAIL_SMTP_HOST = "serverHost";
|
||||||
|
|
||||||
public static final String MAIL_SMTP_PORT = "smtp.port";
|
public static final String MAIL_SMTP_PORT = "mail.smtp.port";
|
||||||
public static final String NAME_MAIL_SMTP_PORT = "serverPort";
|
public static final String NAME_MAIL_SMTP_PORT = "serverPort";
|
||||||
|
|
||||||
public static final String MAIL_SENDER = "sender";
|
public static final String MAIL_SENDER = "mail.sender";
|
||||||
public static final String NAME_MAIL_SENDER = "sender";
|
public static final String NAME_MAIL_SENDER = "sender";
|
||||||
|
|
||||||
public static final String MAIL_SMTP_AUTH = "smtp.auth";
|
public static final String MAIL_SMTP_AUTH = "mail.smtp.auth";
|
||||||
public static final String NAME_MAIL_SMTP_AUTH = "enableSmtpAuth";
|
public static final String NAME_MAIL_SMTP_AUTH = "enableSmtpAuth";
|
||||||
|
|
||||||
public static final String MAIL_USER = "user";
|
public static final String MAIL_USER = "mail.user";
|
||||||
public static final String NAME_MAIL_USER = "user";
|
public static final String NAME_MAIL_USER = "user";
|
||||||
|
|
||||||
public static final String MAIL_PASSWD = "passwd";
|
public static final String MAIL_PASSWD = "mail.passwd";
|
||||||
public static final String NAME_MAIL_PASSWD = "passwd";
|
public static final String NAME_MAIL_PASSWD = "passwd";
|
||||||
|
|
||||||
public static final String MAIL_SMTP_STARTTLS_ENABLE = "smtp.starttls.enable";
|
public static final String MAIL_SMTP_STARTTLS_ENABLE = "mail.smtp.starttls.enable";
|
||||||
public static final String NAME_MAIL_SMTP_STARTTLS_ENABLE = "starttlsEnable";
|
public static final String NAME_MAIL_SMTP_STARTTLS_ENABLE = "starttlsEnable";
|
||||||
|
|
||||||
public static final String MAIL_SMTP_SSL_ENABLE = "smtp.ssl.enable";
|
public static final String MAIL_SMTP_SSL_ENABLE = "mail.smtp.ssl.enable";
|
||||||
public static final String NAME_MAIL_SMTP_SSL_ENABLE = "sslEnable";
|
public static final String NAME_MAIL_SMTP_SSL_ENABLE = "sslEnable";
|
||||||
|
|
||||||
public static final String MAIL_SMTP_SSL_TRUST = "smtp.ssl.trust";
|
public static final String MAIL_SMTP_SSL_TRUST = "mail.smtp.ssl.trust";
|
||||||
public static final String NAME_MAIL_SMTP_SSL_TRUST = "smtpSslTrust";
|
public static final String NAME_MAIL_SMTP_SSL_TRUST = "smtpSslTrust";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ public class MailUtilsTest {
|
|||||||
emailConfig.put(MailParamsConstants.NAME_MAIL_SENDER, "xxx1.xxx.com");
|
emailConfig.put(MailParamsConstants.NAME_MAIL_SENDER, "xxx1.xxx.com");
|
||||||
emailConfig.put(MailParamsConstants.NAME_MAIL_USER, "xxx2.xxx.com");
|
emailConfig.put(MailParamsConstants.NAME_MAIL_USER, "xxx2.xxx.com");
|
||||||
emailConfig.put(MailParamsConstants.NAME_MAIL_PASSWD, "111111");
|
emailConfig.put(MailParamsConstants.NAME_MAIL_PASSWD, "111111");
|
||||||
|
emailConfig.put(MailParamsConstants.NAME_MAIL_SMTP_AUTH, "true");
|
||||||
emailConfig.put(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE, "true");
|
emailConfig.put(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE, "true");
|
||||||
emailConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE, "false");
|
emailConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE, "false");
|
||||||
emailConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST, "false");
|
emailConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST, "false");
|
||||||
|
@ -133,7 +133,7 @@ public enum Status {
|
|||||||
QUERY_TASK_INSTANCE_LOG_ERROR(10103, "view task instance log error", "查询任务实例日志错误"),
|
QUERY_TASK_INSTANCE_LOG_ERROR(10103, "view task instance log error", "查询任务实例日志错误"),
|
||||||
DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR(10104, "download task instance log file error", "下载任务日志文件错误"),
|
DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR(10104, "download task instance log file error", "下载任务日志文件错误"),
|
||||||
CREATE_PROCESS_DEFINITION(10105, "create process definition", "创建工作流错误"),
|
CREATE_PROCESS_DEFINITION(10105, "create process definition", "创建工作流错误"),
|
||||||
VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR(10106, "verify process definition name unique error", "工作流定义名称已存在"),
|
VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR(10106, "verify process definition name unique error", "工作流定义名称验证错误"),
|
||||||
UPDATE_PROCESS_DEFINITION_ERROR(10107, "update process definition error", "更新工作流定义错误"),
|
UPDATE_PROCESS_DEFINITION_ERROR(10107, "update process definition error", "更新工作流定义错误"),
|
||||||
RELEASE_PROCESS_DEFINITION_ERROR(10108, "release process definition error", "上线工作流错误"),
|
RELEASE_PROCESS_DEFINITION_ERROR(10108, "release process definition error", "上线工作流错误"),
|
||||||
QUERY_DATAIL_OF_PROCESS_DEFINITION_ERROR(10109, "query datail of process definition error", "查询工作流详细信息错误"),
|
QUERY_DATAIL_OF_PROCESS_DEFINITION_ERROR(10109, "query datail of process definition error", "查询工作流详细信息错误"),
|
||||||
@ -199,6 +199,7 @@ public enum Status {
|
|||||||
FORCE_TASK_SUCCESS_ERROR(10165, "force task success error", "强制成功任务实例错误"),
|
FORCE_TASK_SUCCESS_ERROR(10165, "force task success error", "强制成功任务实例错误"),
|
||||||
TASK_INSTANCE_STATE_OPERATION_ERROR(10166, "the status of task instance {0} is {1},Cannot perform force success operation", "任务实例[{0}]的状态是[{1}],无法执行强制成功操作"),
|
TASK_INSTANCE_STATE_OPERATION_ERROR(10166, "the status of task instance {0} is {1},Cannot perform force success operation", "任务实例[{0}]的状态是[{1}],无法执行强制成功操作"),
|
||||||
DATASOURCE_TYPE_NOT_EXIST(10167, "data source type not exist", "数据源类型不存在"),
|
DATASOURCE_TYPE_NOT_EXIST(10167, "data source type not exist", "数据源类型不存在"),
|
||||||
|
PROCESS_DEFINITION_NAME_EXIST(10168, "process definition name {0} already exists", "工作流定义名称[{0}]已存在"),
|
||||||
|
|
||||||
UDF_FUNCTION_NOT_EXIST(20001, "UDF function not found", "UDF函数不存在"),
|
UDF_FUNCTION_NOT_EXIST(20001, "UDF function not found", "UDF函数不存在"),
|
||||||
UDF_FUNCTION_EXISTS(20002, "UDF function already exists", "UDF函数已存在"),
|
UDF_FUNCTION_EXISTS(20002, "UDF function already exists", "UDF函数已存在"),
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
package org.apache.dolphinscheduler.api.interceptor;
|
package org.apache.dolphinscheduler.api.interceptor;
|
||||||
|
|
||||||
import org.apache.dolphinscheduler.api.service.BaseService;
|
|
||||||
import org.apache.dolphinscheduler.common.Constants;
|
import org.apache.dolphinscheduler.common.Constants;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -30,12 +29,13 @@ import org.springframework.context.i18n.LocaleContextHolder;
|
|||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||||
|
import org.springframework.web.util.WebUtils;
|
||||||
|
|
||||||
public class LocaleChangeInterceptor extends HandlerInterceptorAdapter {
|
public class LocaleChangeInterceptor extends HandlerInterceptorAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
||||||
Cookie cookie = BaseService.getCookie(request, Constants.LOCALE_LANGUAGE);
|
Cookie cookie = WebUtils.getCookie(request, Constants.LOCALE_LANGUAGE);
|
||||||
if (cookie != null) {
|
if (cookie != null) {
|
||||||
// Proceed in cookie
|
// Proceed in cookie
|
||||||
return true;
|
return true;
|
||||||
|
@ -113,27 +113,6 @@ public class BaseService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get cookie info by name
|
|
||||||
*
|
|
||||||
* @param request request
|
|
||||||
* @param name 'sessionId'
|
|
||||||
* @return get cookie info
|
|
||||||
*/
|
|
||||||
public static Cookie getCookie(HttpServletRequest request, String name) {
|
|
||||||
Cookie[] cookies = request.getCookies();
|
|
||||||
if (cookies != null && cookies.length > 0) {
|
|
||||||
for (Cookie cookie : cookies) {
|
|
||||||
if (StringUtils.isNotEmpty(name) && name.equalsIgnoreCase(cookie.getName())) {
|
|
||||||
return cookie;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create tenant dir if not exists
|
* create tenant dir if not exists
|
||||||
*
|
*
|
||||||
|
@ -480,7 +480,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|||||||
// check whether the new process define name exist
|
// check whether the new process define name exist
|
||||||
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getId(), name);
|
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getId(), name);
|
||||||
if (definition != null) {
|
if (definition != null) {
|
||||||
putMsg(result, Status.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR, name);
|
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -575,7 +575,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
|
|||||||
if (processDefinition == null) {
|
if (processDefinition == null) {
|
||||||
putMsg(result, Status.SUCCESS);
|
putMsg(result, Status.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
putMsg(result, Status.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR, name);
|
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.util.WebUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* session service implement
|
* session service implement
|
||||||
@ -60,7 +61,7 @@ public class SessionServiceImpl extends BaseService implements SessionService {
|
|||||||
String sessionId = request.getHeader(Constants.SESSION_ID);
|
String sessionId = request.getHeader(Constants.SESSION_ID);
|
||||||
|
|
||||||
if (StringUtils.isBlank(sessionId)) {
|
if (StringUtils.isBlank(sessionId)) {
|
||||||
Cookie cookie = getCookie(request, Constants.SESSION_ID);
|
Cookie cookie = WebUtils.getCookie(request, Constants.SESSION_ID);
|
||||||
|
|
||||||
if (cookie != null) {
|
if (cookie != null) {
|
||||||
sessionId = cookie.getValue();
|
sessionId = cookie.getValue();
|
||||||
|
@ -117,14 +117,14 @@ public class ProcessDefinitionControllerTest {
|
|||||||
public void testVerifyProcessDefinitionName() throws Exception {
|
public void testVerifyProcessDefinitionName() throws Exception {
|
||||||
|
|
||||||
Map<String, Object> result = new HashMap<>();
|
Map<String, Object> result = new HashMap<>();
|
||||||
putMsg(result, Status.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR);
|
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST);
|
||||||
String projectName = "test";
|
String projectName = "test";
|
||||||
String name = "dag_test";
|
String name = "dag_test";
|
||||||
|
|
||||||
Mockito.when(processDefinitionService.verifyProcessDefinitionName(user, projectName, name)).thenReturn(result);
|
Mockito.when(processDefinitionService.verifyProcessDefinitionName(user, projectName, name)).thenReturn(result);
|
||||||
|
|
||||||
Result response = processDefinitionController.verifyProcessDefinitionName(user, projectName, name);
|
Result response = processDefinitionController.verifyProcessDefinitionName(user, projectName, name);
|
||||||
Assert.assertEquals(Status.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR.getCode(), response.getCode().intValue());
|
Assert.assertEquals(Status.PROCESS_DEFINITION_NAME_EXIST.getCode(), response.getCode().intValue());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,20 +94,6 @@ public class BaseServiceTest {
|
|||||||
baseService.putMsg(result,Status.PROJECT_NOT_FOUNT,"test");
|
baseService.putMsg(result,Status.PROJECT_NOT_FOUNT,"test");
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
public void testGetCookie(){
|
|
||||||
|
|
||||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
|
||||||
MockCookie mockCookie = new MockCookie("userId","1");
|
|
||||||
request.setCookies(mockCookie);
|
|
||||||
//cookie is not null
|
|
||||||
Cookie cookie = BaseService.getCookie(request,"userId");
|
|
||||||
Assert.assertNotNull(cookie);
|
|
||||||
//cookie is null
|
|
||||||
cookie = BaseService.getCookie(request,"userName");
|
|
||||||
Assert.assertNull(cookie);
|
|
||||||
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void testCreateTenantDirIfNotExists(){
|
public void testCreateTenantDirIfNotExists(){
|
||||||
|
|
||||||
PowerMockito.mockStatic(HadoopUtils.class);
|
PowerMockito.mockStatic(HadoopUtils.class);
|
||||||
|
@ -657,7 +657,7 @@ public class ProcessDefinitionServiceTest {
|
|||||||
Mockito.when(processDefineMapper.verifyByDefineName(project.getId(), "test_pdf")).thenReturn(getProcessDefinition());
|
Mockito.when(processDefineMapper.verifyByDefineName(project.getId(), "test_pdf")).thenReturn(getProcessDefinition());
|
||||||
Map<String, Object> processExistRes = processDefinitionService.verifyProcessDefinitionName(loginUser,
|
Map<String, Object> processExistRes = processDefinitionService.verifyProcessDefinitionName(loginUser,
|
||||||
"project_test1", "test_pdf");
|
"project_test1", "test_pdf");
|
||||||
Assert.assertEquals(Status.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR, processExistRes.get(Constants.STATUS));
|
Assert.assertEquals(Status.PROCESS_DEFINITION_NAME_EXIST, processExistRes.get(Constants.STATUS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -14,12 +14,6 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
# mysql
|
|
||||||
#spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
|
||||||
#spring.datasource.url=jdbc:mysql://localhost:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8
|
|
||||||
#spring.datasource.username=root
|
|
||||||
#spring.datasource.password=123456
|
|
||||||
|
|
||||||
# postgresql
|
# postgresql
|
||||||
spring.datasource.driver-class-name=org.postgresql.Driver
|
spring.datasource.driver-class-name=org.postgresql.Driver
|
||||||
@ -33,7 +27,6 @@ spring.datasource.password=test
|
|||||||
#spring.datasource.username=xxxx
|
#spring.datasource.username=xxxx
|
||||||
#spring.datasource.password=xxxx
|
#spring.datasource.password=xxxx
|
||||||
|
|
||||||
|
|
||||||
# connection configuration
|
# connection configuration
|
||||||
#spring.datasource.initialSize=5
|
#spring.datasource.initialSize=5
|
||||||
# min connection number
|
# min connection number
|
||||||
|
Loading…
Reference in New Issue
Block a user