本文整理汇总了Java中org.springframework.boot.bind.RelaxedDataBinder.setConversionService方法的典型用法代码示例。如果您正苦于以下问题:Java RelaxedDataBinder.setConversionService方法的具体用法?Java RelaxedDataBinder.setConversionService怎么用?Java RelaxedDataBinder.setConversionService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.boot.bind.RelaxedDataBinder
的用法示例。
在下文中一共展示了RelaxedDataBinder.setConversionService方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBindingSsh
import org.springframework.boot.bind.RelaxedDataBinder; //导入方法依赖的package包/类
@Test
public void testBindingSsh() {
ShellProperties props = new ShellProperties();
RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell");
binder.setConversionService(new DefaultConversionService());
Map<String, String> map = new HashMap<String, String>();
map.put("shell.ssh.enabled", "true");
map.put("shell.ssh.port", "2222");
map.put("shell.ssh.key_path", "~/.ssh/test.pem");
binder.bind(new MutablePropertyValues(map));
assertFalse(binder.getBindingResult().hasErrors());
Properties p = props.asCrshShellConfig();
assertEquals("2222", p.get("crash.ssh.port"));
assertEquals("~/.ssh/test.pem", p.get("crash.ssh.keypath"));
}
示例2: testBindingSshIgnored
import org.springframework.boot.bind.RelaxedDataBinder; //导入方法依赖的package包/类
@Test
public void testBindingSshIgnored() {
ShellProperties props = new ShellProperties();
RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell");
binder.setConversionService(new DefaultConversionService());
Map<String, String> map = new HashMap<String, String>();
map.put("shell.ssh.enabled", "false");
map.put("shell.ssh.port", "2222");
map.put("shell.ssh.key_path", "~/.ssh/test.pem");
binder.bind(new MutablePropertyValues(map));
assertFalse(binder.getBindingResult().hasErrors());
Properties p = props.asCrshShellConfig();
assertNull(p.get("crash.ssh.port"));
assertNull(p.get("crash.ssh.keypath"));
}
示例3: testBindingSimple
import org.springframework.boot.bind.RelaxedDataBinder; //导入方法依赖的package包/类
@Test
public void testBindingSimple() {
SimpleAuthenticationProperties props = new SimpleAuthenticationProperties();
RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell.auth.simple");
binder.setConversionService(new DefaultConversionService());
Map<String, String> map = new HashMap<String, String>();
map.put("shell.auth.simple.user.name", "username123");
map.put("shell.auth.simple.user.password", "password123");
binder.bind(new MutablePropertyValues(map));
assertFalse(binder.getBindingResult().hasErrors());
Properties p = new Properties();
props.applyToCrshShellConfig(p);
assertEquals("username123", p.get("crash.auth.simple.username"));
assertEquals("password123", p.get("crash.auth.simple.password"));
}
示例4: testBindingCommandRefreshInterval
import org.springframework.boot.bind.RelaxedDataBinder; //导入方法依赖的package包/类
@Test
public void testBindingCommandRefreshInterval() {
ShellProperties props = new ShellProperties();
RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell");
binder.setConversionService(new DefaultConversionService());
binder.bind(new MutablePropertyValues(
Collections.singletonMap("shell.command_refresh_interval", "1")));
assertFalse(binder.getBindingResult().hasErrors());
assertEquals(1, props.getCommandRefreshInterval());
}
示例5: testBindingCommandPathPatterns
import org.springframework.boot.bind.RelaxedDataBinder; //导入方法依赖的package包/类
@Test
public void testBindingCommandPathPatterns() {
ShellProperties props = new ShellProperties();
RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell");
binder.setConversionService(new DefaultConversionService());
binder.bind(new MutablePropertyValues(Collections
.singletonMap("shell.command_path_patterns", "pattern1, pattern2")));
assertFalse(binder.getBindingResult().hasErrors());
assertEquals(2, props.getCommandPathPatterns().length);
Assert.assertArrayEquals(new String[] { "pattern1", "pattern2" },
props.getCommandPathPatterns());
}
示例6: testBindingConfigPathPatterns
import org.springframework.boot.bind.RelaxedDataBinder; //导入方法依赖的package包/类
@Test
public void testBindingConfigPathPatterns() {
ShellProperties props = new ShellProperties();
RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell");
binder.setConversionService(new DefaultConversionService());
binder.bind(new MutablePropertyValues(Collections
.singletonMap("shell.config_path_patterns", "pattern1, pattern2")));
assertFalse(binder.getBindingResult().hasErrors());
assertEquals(2, props.getConfigPathPatterns().length);
Assert.assertArrayEquals(new String[] { "pattern1", "pattern2" },
props.getConfigPathPatterns());
}
示例7: testBindingDisabledPlugins
import org.springframework.boot.bind.RelaxedDataBinder; //导入方法依赖的package包/类
@Test
public void testBindingDisabledPlugins() {
ShellProperties props = new ShellProperties();
RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell");
binder.setConversionService(new DefaultConversionService());
binder.bind(new MutablePropertyValues(Collections
.singletonMap("shell.disabled_plugins", "pattern1, pattern2")));
assertFalse(binder.getBindingResult().hasErrors());
assertEquals(2, props.getDisabledPlugins().length);
assertArrayEquals(new String[] { "pattern1", "pattern2" },
props.getDisabledPlugins());
}
示例8: testBindingDisabledCommands
import org.springframework.boot.bind.RelaxedDataBinder; //导入方法依赖的package包/类
@Test
public void testBindingDisabledCommands() {
ShellProperties props = new ShellProperties();
RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell");
binder.setConversionService(new DefaultConversionService());
binder.bind(new MutablePropertyValues(Collections
.singletonMap("shell.disabled_commands", "pattern1, pattern2")));
assertFalse(binder.getBindingResult().hasErrors());
assertEquals(2, props.getDisabledCommands().length);
assertArrayEquals(new String[] { "pattern1", "pattern2" },
props.getDisabledCommands());
}
示例9: testBindingTelnet
import org.springframework.boot.bind.RelaxedDataBinder; //导入方法依赖的package包/类
@Test
public void testBindingTelnet() {
ShellProperties props = new ShellProperties();
RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell");
binder.setConversionService(new DefaultConversionService());
Map<String, String> map = new HashMap<String, String>();
map.put("shell.telnet.enabled", "true");
map.put("shell.telnet.port", "2222");
binder.bind(new MutablePropertyValues(map));
assertFalse(binder.getBindingResult().hasErrors());
Properties p = props.asCrshShellConfig();
assertEquals("2222", p.get("crash.telnet.port"));
}
示例10: testBindingTelnetIgnored
import org.springframework.boot.bind.RelaxedDataBinder; //导入方法依赖的package包/类
@Test
public void testBindingTelnetIgnored() {
ShellProperties props = new ShellProperties();
RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell");
binder.setConversionService(new DefaultConversionService());
Map<String, String> map = new HashMap<String, String>();
map.put("shell.telnet.enabled", "false");
map.put("shell.telnet.port", "2222");
binder.bind(new MutablePropertyValues(map));
assertFalse(binder.getBindingResult().hasErrors());
Properties p = props.asCrshShellConfig();
assertNull(p.get("crash.telnet.port"));
}
示例11: testBindingJaas
import org.springframework.boot.bind.RelaxedDataBinder; //导入方法依赖的package包/类
@Test
public void testBindingJaas() {
JaasAuthenticationProperties props = new JaasAuthenticationProperties();
RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell.auth.jaas");
binder.setConversionService(new DefaultConversionService());
Map<String, String> map = new HashMap<String, String>();
map.put("shell.auth.jaas.domain", "my-test-domain");
binder.bind(new MutablePropertyValues(map));
assertFalse(binder.getBindingResult().hasErrors());
Properties p = new Properties();
props.applyToCrshShellConfig(p);
assertEquals("my-test-domain", p.get("crash.auth.jaas.domain"));
}
示例12: testBindingKey
import org.springframework.boot.bind.RelaxedDataBinder; //导入方法依赖的package包/类
@Test
public void testBindingKey() {
KeyAuthenticationProperties props = new KeyAuthenticationProperties();
RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell.auth.key");
binder.setConversionService(new DefaultConversionService());
Map<String, String> map = new HashMap<String, String>();
map.put("shell.auth.key.path", "~/.ssh/test.pem");
binder.bind(new MutablePropertyValues(map));
assertFalse(binder.getBindingResult().hasErrors());
Properties p = new Properties();
props.applyToCrshShellConfig(p);
assertEquals("~/.ssh/test.pem", p.get("crash.auth.key.path"));
}
示例13: testBindingKeyIgnored
import org.springframework.boot.bind.RelaxedDataBinder; //导入方法依赖的package包/类
@Test
public void testBindingKeyIgnored() {
KeyAuthenticationProperties props = new KeyAuthenticationProperties();
RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell.auth.key");
binder.setConversionService(new DefaultConversionService());
Map<String, String> map = new HashMap<String, String>();
binder.bind(new MutablePropertyValues(map));
assertFalse(binder.getBindingResult().hasErrors());
Properties p = new Properties();
props.applyToCrshShellConfig(p);
assertNull(p.get("crash.auth.key.path"));
}