当前位置: 首页>>代码示例>>Java>>正文


Java RelaxedDataBinder.setConversionService方法代码示例

本文整理汇总了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"));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:18,代码来源:ShellPropertiesTests.java

示例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"));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:18,代码来源:ShellPropertiesTests.java

示例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"));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:18,代码来源:ShellPropertiesTests.java

示例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());
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:11,代码来源:ShellPropertiesTests.java

示例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());
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:13,代码来源:ShellPropertiesTests.java

示例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());
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:13,代码来源:ShellPropertiesTests.java

示例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());
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:13,代码来源:ShellPropertiesTests.java

示例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());
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:13,代码来源:ShellPropertiesTests.java

示例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"));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:16,代码来源:ShellPropertiesTests.java

示例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"));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:16,代码来源:ShellPropertiesTests.java

示例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"));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:16,代码来源:ShellPropertiesTests.java

示例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"));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:16,代码来源:ShellPropertiesTests.java

示例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"));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:15,代码来源:ShellPropertiesTests.java


注:本文中的org.springframework.boot.bind.RelaxedDataBinder.setConversionService方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。