ARTEMIS-3627 - support 25k type postfix, same feature as xml config, for long values
This commit is contained in:
parent
fb0e4a531a
commit
cdcbfb2ae0
|
@ -96,6 +96,7 @@ import org.apache.activemq.artemis.core.server.plugin.ActiveMQServerResourcePlug
|
|||
import org.apache.activemq.artemis.core.server.plugin.ActiveMQServerSessionPlugin;
|
||||
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
|
||||
import org.apache.activemq.artemis.core.settings.impl.ResourceLimitSettings;
|
||||
import org.apache.activemq.artemis.utils.ByteUtil;
|
||||
import org.apache.activemq.artemis.utils.Env;
|
||||
import org.apache.activemq.artemis.utils.ObjectInputStreamWithClassLoader;
|
||||
import org.apache.activemq.artemis.utils.critical.CriticalAnalyzerPolicy;
|
||||
|
@ -507,6 +508,14 @@ public class ConfigurationImpl implements Configuration, Serializable {
|
|||
return (T) SimpleString.toSimpleString(value.toString());
|
||||
}
|
||||
}, SimpleString.class);
|
||||
// support 25K or 25m etc like xml config
|
||||
beanUtils.getConvertUtils().register(new Converter() {
|
||||
@Override
|
||||
public <T> T convert(Class<T> type, Object value) {
|
||||
return (T) (Long) ByteUtil.convertTextBytes(value.toString());
|
||||
}
|
||||
}, Long.TYPE);
|
||||
|
||||
BeanSupport.customise(beanUtils);
|
||||
|
||||
beanUtils.populate(this, beanProperties);
|
||||
|
|
|
@ -689,6 +689,19 @@ public class ConfigurationImplTest extends ActiveMQTestBase {
|
|||
Assert.assertEquals(SimpleString.toSimpleString("moreImportant"), configuration.getAddressesSettings().get("Name.With.Dots").getExpiryAddress());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValuePostFixModifier() throws Throwable {
|
||||
ConfigurationImpl configuration = new ConfigurationImpl();
|
||||
|
||||
Properties properties = new Properties();
|
||||
|
||||
properties.put("globalMaxSize", "25K");
|
||||
|
||||
configuration.parsePrefixedProperties(properties, null);
|
||||
|
||||
Assert.assertEquals(25 * 1024, configuration.getGlobalMaxSize());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNameWithDotsSurroundWithDollarDollar() throws Throwable {
|
||||
ConfigurationImpl configuration = new ConfigurationImpl();
|
||||
|
|
Loading…
Reference in New Issue