本文整理了Java中azkaban.utils.Props.of()
方法的一些代码示例,展示了Props.of()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Props.of()
方法的具体详情如下:
包路径:azkaban.utils.Props
类名称:Props
方法名:of
[英]Create a Props from a list of key value pairing. i.e. [key1, value1, key2, value2 ...]
[中]从键值配对列表中创建道具。i、 e.[key1,value1,key2,value2…]
代码示例来源:origin: azkaban/azkaban
/**
* Create a Props with a null parent from a list of key value pairing. i.e. [key1, value1, key2,
* value2 ...]
*/
public static Props of(final String... args) {
return of((Props) null, args);
}
代码示例来源:origin: azkaban/azkaban
@Test
public void testMalformedExpressionProps() throws IOException {
// unclosed
Props props = Props.of("key", "$(1+2");
failIfNotException(props);
props = Props.of("key", "$((1+2)");
failIfNotException(props);
// bad variable replacement
props = Props.of("key", "$(${dontexist}+2)");
failIfNotException(props);
// bad expression
props = Props.of("key", "$(2 +)");
failIfNotException(props);
// bad expression
props = Props.of("key", "$(2 + #hello)");
failIfNotException(props);
}
代码示例来源:origin: azkaban/azkaban
@Test
public void testExpressionResolution() throws IOException {
final Props props =
Props.of("normkey", "normal", "num1", "1", "num2", "2", "num3", "3",
"variablereplaced", "${num1}", "expression1", "$(1+10)",
"expression2", "$(1+10)*2", "expression3",
"$($(${num1} + ${num3})*10)", "expression4",
"$(${num1} + ${expression3})", "expression5",
"$($($(2+3)) + 3) + $(${expression3} + 1)", "expression6",
"$(1 + ${normkey})", "expression7", "$(\"${normkey}\" + 1)",
"expression8", "${expression1}", "expression9", "$((2+3) + 3)");
final Props resolved = PropsUtils.resolveProps(props);
Assert.assertEquals("normal", resolved.get("normkey"));
Assert.assertEquals("1", resolved.get("num1"));
Assert.assertEquals("2", resolved.get("num2"));
Assert.assertEquals("3", resolved.get("num3"));
Assert.assertEquals("1", resolved.get("variablereplaced"));
Assert.assertEquals("11", resolved.get("expression1"));
Assert.assertEquals("11*2", resolved.get("expression2"));
Assert.assertEquals("40", resolved.get("expression3"));
Assert.assertEquals("41", resolved.get("expression4"));
Assert.assertEquals("8 + 41", resolved.get("expression5"));
Assert.assertEquals("1", resolved.get("expression6"));
Assert.assertEquals("normal1", resolved.get("expression7"));
Assert.assertEquals("11", resolved.get("expression8"));
Assert.assertEquals("8", resolved.get("expression9"));
}
代码示例来源:origin: com.linkedin.azkaban/azkaban
/**
* Create a Props with a null parent from a list of key value pairing. i.e.
* [key1, value1, key2, value2 ...]
*
* @param args
* @return
*/
public static Props of(String... args) {
return of((Props) null, args);
}
代码示例来源:origin: com.linkedin.azkaban/az-core
/**
* Create a Props with a null parent from a list of key value pairing. i.e. [key1, value1, key2,
* value2 ...]
*
* @param args the args
* @return the props
*/
public static Props of(final String... args) {
return of((Props) null, args);
}
内容来源于网络,如有侵权,请联系作者删除!