mirror of
https://gitee.com/jmix/cuba.git
synced 2024-11-30 10:17:43 +08:00
App property inherited from app component cannot have repetitive parts separated by spaces #1055
This commit is contained in:
parent
dd0b8c618f
commit
bc411fd828
@ -184,14 +184,16 @@ public class AppProperties {
|
||||
|
||||
String compValue = component.getProperty(key);
|
||||
if (StringUtils.isNotEmpty(compValue)) {
|
||||
index = 0;
|
||||
for (String valuePart : split(compValue)) {
|
||||
if (!values.contains(valuePart)) {
|
||||
values.add(index, valuePart);
|
||||
index++;
|
||||
if (component.isAdditiveProperty(key)) {
|
||||
index = 0;
|
||||
for (String valuePart : split(compValue)) {
|
||||
if (!values.contains(valuePart)) {
|
||||
values.add(index, valuePart);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!component.isAdditiveProperty(key)) {
|
||||
} else {
|
||||
values.add(0, compValue);
|
||||
// we found overwrite, stop iteration
|
||||
break;
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ public class AppPropertiesTest {
|
||||
reports.setProperty("prop3", "prop3_reports_val", false);
|
||||
reports.setProperty("prop4", "prop4_reports_val", true);
|
||||
reports.setProperty("prop5", "prop5_reports_val", false);
|
||||
reports.setProperty("cronExpr", "*/10 * * * * *", false);
|
||||
|
||||
AppComponents appComponents = new AppComponents("core");
|
||||
appComponents.add(cuba);
|
||||
@ -72,6 +73,8 @@ public class AppPropertiesTest {
|
||||
assertEquals("prop6_app_val", appProperties.getProperty("prop6"));
|
||||
|
||||
assertNull(appProperties.getProperty("prop7"));
|
||||
|
||||
assertEquals("*/10 * * * * *", appProperties.getProperty("cronExpr"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -84,7 +87,7 @@ public class AppPropertiesTest {
|
||||
@Test
|
||||
public void testGetPropertyNames() {
|
||||
assertArrayEquals(
|
||||
new String[] {"prop1", "prop2", "prop3", "prop4", "prop5", "prop6"},
|
||||
new String[] {"cronExpr", "prop1", "prop2", "prop3", "prop4", "prop5", "prop6"},
|
||||
appProperties.getPropertyNames());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user