Skip to content

Commit 3d5d46e

Browse files
authored
Merge branch 'apache:dev' into Improvement-18045
2 parents 8a91e49 + baecd8d commit 3d5d46e

File tree

18 files changed

+251
-241
lines changed

18 files changed

+251
-241
lines changed

.github/workflows/publish-docker.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,6 @@ jobs:
3636
- uses: actions/checkout@v4
3737
with:
3838
submodules: true
39-
- name: Maximize runner space
40-
uses: ./.github/actions/maximize-build-space
41-
with:
42-
root-reserve-mb: 28672
43-
temp-reserve-mb: 10240
44-
remove-dotnet: 'true'
45-
remove-android: 'true'
46-
remove-haskell: 'true'
47-
remove-codeql: 'true'
48-
remove-docker-images: 'true'
4939
- uses: actions/checkout@v4
5040
- name: Cache local Maven repository
5141
uses: actions/cache@v4
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.dolphinscheduler.api.validator;
19+
20+
import org.apache.dolphinscheduler.plugin.task.api.model.Property;
21+
22+
import org.apache.commons.collections.CollectionUtils;
23+
import org.apache.commons.lang3.StringUtils;
24+
25+
import java.util.HashSet;
26+
import java.util.List;
27+
import java.util.Set;
28+
29+
import lombok.extern.slf4j.Slf4j;
30+
31+
import org.springframework.stereotype.Component;
32+
33+
/**
34+
* Validator for the list of start parameters (Property list).
35+
* <p> If startParamList is not valid, an {@link IllegalArgumentException} will be thrown. </p>
36+
*/
37+
@Slf4j
38+
@Component
39+
public class StartParamListValidator implements IValidator<List<Property>> {
40+
41+
@Override
42+
public void validate(List<Property> startParamList) {
43+
if (CollectionUtils.isEmpty(startParamList)) {
44+
return;
45+
}
46+
47+
Set<String> keys = new HashSet<>();
48+
for (Property param : startParamList) {
49+
if (StringUtils.isBlank(param.getProp())) {
50+
throw new IllegalArgumentException("Parameter key cannot be empty");
51+
}
52+
53+
String key = param.getProp().trim();
54+
if (keys.contains(key)) {
55+
throw new IllegalArgumentException("Duplicate parameter key: " + key);
56+
}
57+
keys.add(key);
58+
}
59+
}
60+
}

dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/workflow/BackfillWorkflowDTOValidator.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.apache.dolphinscheduler.api.validator.workflow;
1919

2020
import org.apache.dolphinscheduler.api.validator.IValidator;
21+
import org.apache.dolphinscheduler.api.validator.StartParamListValidator;
2122
import org.apache.dolphinscheduler.api.validator.TenantExistValidator;
2223
import org.apache.dolphinscheduler.common.enums.CommandType;
2324
import org.apache.dolphinscheduler.common.enums.ReleaseState;
@@ -34,8 +35,12 @@ public class BackfillWorkflowDTOValidator implements IValidator<BackfillWorkflow
3435

3536
private final TenantExistValidator tenantExistValidator;
3637

37-
public BackfillWorkflowDTOValidator(TenantExistValidator tenantExistValidator) {
38+
private final StartParamListValidator startParamListValidator;
39+
40+
public BackfillWorkflowDTOValidator(TenantExistValidator tenantExistValidator,
41+
StartParamListValidator startParamListValidator) {
3842
this.tenantExistValidator = tenantExistValidator;
43+
this.startParamListValidator = startParamListValidator;
3944
}
4045

4146
@Override
@@ -59,6 +64,9 @@ public void validate(final BackfillWorkflowDTO backfillWorkflowDTO) {
5964
if (backfillWorkflowDTO.getWorkflowDefinition().getReleaseState() != ReleaseState.ONLINE) {
6065
throw new IllegalStateException("The workflowDefinition should be online");
6166
}
67+
6268
tenantExistValidator.validate(backfillWorkflowDTO.getTenantCode());
69+
70+
startParamListValidator.validate(backfillWorkflowDTO.getStartParamList());
6371
}
6472
}

dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/workflow/TriggerWorkflowDTOValidator.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.apache.dolphinscheduler.api.validator.workflow;
1919

2020
import org.apache.dolphinscheduler.api.validator.IValidator;
21+
import org.apache.dolphinscheduler.api.validator.StartParamListValidator;
2122
import org.apache.dolphinscheduler.api.validator.TenantExistValidator;
2223
import org.apache.dolphinscheduler.common.enums.CommandType;
2324
import org.apache.dolphinscheduler.common.enums.ReleaseState;
@@ -32,8 +33,12 @@ public class TriggerWorkflowDTOValidator implements IValidator<TriggerWorkflowDT
3233

3334
private final TenantExistValidator tenantExistValidator;
3435

35-
public TriggerWorkflowDTOValidator(TenantExistValidator tenantExistValidator) {
36+
private final StartParamListValidator startParamListValidator;
37+
38+
public TriggerWorkflowDTOValidator(TenantExistValidator tenantExistValidator,
39+
StartParamListValidator startParamListValidator) {
3640
this.tenantExistValidator = tenantExistValidator;
41+
this.startParamListValidator = startParamListValidator;
3742
}
3843

3944
@Override
@@ -47,6 +52,9 @@ public void validate(final TriggerWorkflowDTO triggerWorkflowDTO) {
4752
if (triggerWorkflowDTO.getWorkflowDefinition().getReleaseState() != ReleaseState.ONLINE) {
4853
throw new IllegalStateException("The workflowDefinition should be online");
4954
}
55+
5056
tenantExistValidator.validate(triggerWorkflowDTO.getTenantCode());
57+
58+
startParamListValidator.validate(triggerWorkflowDTO.getStartParamList());
5159
}
5260
}
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.dolphinscheduler.api.validator;
19+
20+
import static org.assertj.core.api.Assertions.assertThatCode;
21+
import static org.assertj.core.api.Assertions.assertThatThrownBy;
22+
23+
import org.apache.dolphinscheduler.plugin.task.api.enums.DataType;
24+
import org.apache.dolphinscheduler.plugin.task.api.enums.Direct;
25+
import org.apache.dolphinscheduler.plugin.task.api.model.Property;
26+
27+
import java.util.ArrayList;
28+
import java.util.Collections;
29+
import java.util.List;
30+
31+
import org.junit.jupiter.api.Test;
32+
import org.junit.jupiter.api.extension.ExtendWith;
33+
import org.mockito.InjectMocks;
34+
import org.mockito.junit.jupiter.MockitoExtension;
35+
36+
@ExtendWith(MockitoExtension.class)
37+
class StartParamListValidatorTest {
38+
39+
@InjectMocks
40+
private StartParamListValidator startParamListValidator;
41+
42+
@Test
43+
void testValidate_nullList() {
44+
assertThatCode(() -> startParamListValidator.validate(null))
45+
.doesNotThrowAnyException();
46+
}
47+
48+
@Test
49+
void testValidate_emptyList() {
50+
assertThatCode(() -> startParamListValidator.validate(Collections.emptyList()))
51+
.doesNotThrowAnyException();
52+
}
53+
54+
@Test
55+
void testValidate_validParameters() {
56+
List<Property> params = Collections.singletonList(
57+
new Property("workflow_id", Direct.IN, DataType.VARCHAR, "1001"));
58+
assertThatCode(() -> startParamListValidator.validate(params))
59+
.doesNotThrowAnyException();
60+
}
61+
62+
@Test
63+
void testValidate_rejectsBlankOrEmptyKeys() {
64+
assertThrowsIllegalArgument("");
65+
66+
assertThrowsIllegalArgument(" ");
67+
68+
assertThrowsIllegalArgument("\t");
69+
70+
assertThrowsIllegalArgument("\n");
71+
72+
assertThrowsIllegalArgument(" \t\n ");
73+
}
74+
75+
private void assertThrowsIllegalArgument(String propValue) {
76+
List<Property> params = Collections.singletonList(
77+
new Property(propValue, Direct.IN, DataType.VARCHAR, "dummyValue"));
78+
79+
assertThatThrownBy(() -> startParamListValidator.validate(params))
80+
.isInstanceOf(IllegalArgumentException.class)
81+
.hasMessage("Parameter key cannot be empty");
82+
}
83+
84+
@Test
85+
void testValidate_duplicateKeys() {
86+
List<Property> params = new ArrayList<>();
87+
params.add(new Property("app_name", Direct.IN, DataType.VARCHAR, "A"));
88+
params.add(new Property("app_name", Direct.IN, DataType.VARCHAR, "B"));
89+
90+
assertThatThrownBy(() -> startParamListValidator.validate(params))
91+
.isInstanceOf(IllegalArgumentException.class)
92+
.hasMessageContaining("Duplicate parameter key: app_name");
93+
}
94+
95+
@Test
96+
void testValidate_duplicateKeysAfterTrim() {
97+
List<Property> params = new ArrayList<>();
98+
params.add(new Property(" app_name ", Direct.IN, DataType.VARCHAR, "A"));
99+
params.add(new Property("app_name", Direct.IN, DataType.VARCHAR, "B"));
100+
101+
assertThatThrownBy(() -> startParamListValidator.validate(params))
102+
.isInstanceOf(IllegalArgumentException.class)
103+
.hasMessageContaining("Duplicate parameter key: app_name");
104+
}
105+
106+
@Test
107+
void testValidate_inTypeEmptyValueAllowed() {
108+
List<Property> params = Collections.singletonList(
109+
new Property("input_var", Direct.IN, DataType.VARCHAR, ""));
110+
111+
assertThatCode(() -> startParamListValidator.validate(params))
112+
.doesNotThrowAnyException();
113+
}
114+
115+
@Test
116+
void testValidate_outTypeEmptyValueAllowed() {
117+
List<Property> params = Collections.singletonList(
118+
new Property("output_var", Direct.OUT, DataType.VARCHAR, ""));
119+
120+
assertThatCode(() -> startParamListValidator.validate(params))
121+
.doesNotThrowAnyException();
122+
}
123+
}

dolphinscheduler-ui/src/env.d.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*/
1717

1818
import { DefineComponent } from 'vue'
19-
// import * as $ from 'jquery'
2019

2120
declare module '*.vue' {
2221
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
@@ -30,14 +29,6 @@ declare global {
3029
}
3130
}
3231

33-
declare global {
34-
interface Navigator {
35-
msSaveBlob?: (blob: any, defaultName?: string) => boolean
36-
}
37-
}
38-
39-
declare namespace jquery {}
40-
4132
declare module '*.png'
4233
declare module '*.jpg'
4334
declare module '*.jpeg'

dolphinscheduler-ui/src/locales/en_US/profile.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,5 @@ export default {
3232
email_tips: 'Please enter your email',
3333
email_correct_tips: 'Please enter your email in the correct format',
3434
phone_tips: 'Please enter your phone',
35-
state_tips: 'Please choose your state',
36-
enable: 'Enable',
37-
disable: 'Disable',
38-
timezone_success: 'Time zone updated successful',
3935
please_select_timezone: 'Choose timeZone'
4036
}

dolphinscheduler-ui/src/locales/en_US/project.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ export default {
353353
update_directly: 'Whether to update the workflow definition',
354354
dag_name_empty: 'DAG graph name cannot be empty',
355355
positive_integer: 'Please enter a positive integer greater than 0',
356-
prop_empty: 'prop is empty',
357-
prop_repeat: 'prop is repeat',
356+
prop_key_repeat: 'prop key is repeat',
357+
prop_key_empty: 'prop key is empty',
358358
node_not_created: 'Failed to save node not created',
359359
copy_name: 'Copy Name',
360360
view_variables: 'View Variables',

dolphinscheduler-ui/src/locales/zh_CN/profile.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,5 @@ export default {
3232
email_tips: '请输入邮箱',
3333
email_correct_tips: '请输入正确格式的邮箱',
3434
phone_tips: '请输入手机号',
35-
state_tips: '请选择状态',
36-
enable: '启用',
37-
disable: '禁用',
38-
timezone_success: '时区更新成功',
3935
please_select_timezone: '请选择时区'
4036
}

dolphinscheduler-ui/src/locales/zh_CN/project.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ export default {
347347
update_directly: '是否更新工作流定义',
348348
dag_name_empty: 'DAG图名称不能为空',
349349
positive_integer: '请输入大于 0 的正整数',
350-
prop_empty: '自定义参数prop不能为空',
351-
prop_repeat: 'prop中有重复',
350+
prop_key_repeat: '自定义参数prop中key有重复',
351+
prop_key_empty: '自定义参数prop中key不能为空',
352352
node_not_created: '未创建节点保存失败',
353353
copy_name: '复制名称',
354354
view_variables: '查看变量',

0 commit comments

Comments
 (0)