ARTEMIS-4818 Support classes with .class in the package

This commit is contained in:
Domenico Francesco Bruscino 2024-06-18 13:24:31 +02:00 committed by Robbie Gemmell
parent a10694f202
commit e5e95f4a18
2 changed files with 17 additions and 4 deletions

View File

@ -958,13 +958,12 @@ public class ConfigurationImpl implements Configuration, Serializable {
updateApplyStatus(propsId, errors); updateApplyStatus(propsId, errors);
} }
private static boolean isClassProperty(String property) { protected static boolean isClassProperty(String property) {
return property.endsWith(PROPERTY_CLASS_SUFFIX); return property.endsWith(PROPERTY_CLASS_SUFFIX);
} }
private static String extractPropertyClassName(String property) { protected static String extractPropertyClassName(String property) {
int propertyClassSuffixIndex = property.indexOf(PROPERTY_CLASS_SUFFIX); return property.substring(0, property.length() - PROPERTY_CLASS_SUFFIX.length());
return property.substring(0, propertyClassSuffixIndex);
} }
private void trackError(HashMap<String, String> errors, Map.Entry<String,?> entry, Throwable oops) { private void trackError(HashMap<String, String> errors, Map.Entry<String,?> entry, Throwable oops) {

View File

@ -2331,6 +2331,20 @@ public class ConfigurationImplTest extends AbstractConfigurationTestBase {
assertEquals(1, dummyConfig.getChildConfig().getChildConfig().getChildConfig().getIntProperty()); assertEquals(1, dummyConfig.getChildConfig().getChildConfig().getChildConfig().getIntProperty());
} }
@Test
public void testIsClass() throws Exception {
assertTrue(ConfigurationImpl.isClassProperty("test.class"));
assertTrue(ConfigurationImpl.isClassProperty("foo.class.bar.class"));
assertFalse(ConfigurationImpl.isClassProperty("test"));
assertFalse(ConfigurationImpl.isClassProperty("foo.class.bar"));
}
@Test
public void testExtractPropertyClassName() throws Exception {
assertEquals("test", ConfigurationImpl.extractPropertyClassName("test.class"));
assertEquals("foo.class.bar", ConfigurationImpl.extractPropertyClassName("foo.class.bar.class"));
}
public static class DummyConfig { public static class DummyConfig {
private int intProperty; private int intProperty;