org.apache.brooklyn.util.text.Strings.removeLines()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(145)

本文整理了Java中org.apache.brooklyn.util.text.Strings.removeLines()方法的一些代码示例,展示了Strings.removeLines()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Strings.removeLines()方法的具体详情如下:
包路径:org.apache.brooklyn.util.text.Strings
类名称:Strings
方法名:removeLines

Strings.removeLines介绍

暂无

代码示例

代码示例来源:origin: org.apache.brooklyn/brooklyn-utils-common

public void testRemoveLines() {
  Assert.assertEquals(Strings.removeLines(Strings.lines("a", "b"), StringPredicates.containsLiteralIgnoreCase("A")), "b");
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-camp

@Test
public void testSshConfigFromDefault() throws Exception {
  RecordingSshTool.setCustomResponse(".*myCommand.*", new RecordingSshTool.CustomResponse(0, "myResponse", null));
  
  String bp = loadYaml("config-type-coercion-test.yaml",
    "location:",
    "  localhost:",
    "    sshToolClass: "+RecordingSshTool.class.getName());
  // remove all lines referring to "exact" -- that's useful for expository and running in UI
  // but it will fail (timeout) if the port isn't available so not good in tests
  bp = Strings.removeLines(bp, StringPredicates.containsLiteralIgnoreCase("exact"));
  
  Entity app = createAndStartApplication(bp);
  waitForApplicationTasks(app);
  Map<?, ?> props = RecordingSshTool.getLastExecCmd().env;
  
  Assert.assertEquals(props.get("RANGE_PORT_SENSOR"), "20003");
  Asserts.assertStringContains((String)props.get("RANGE_PORT_CONFIG"), "{\"start\"", "20003");
  
  Assert.assertEquals(props.get("INT_PORT_CONFIG"), "20001");
  Assert.assertEquals(props.get("INT_PORT_DEFAULT_CONFIG"), "30001");
  
  Assert.assertEquals(props.get("RANGE_PORT_DEFAULT_SENSOR"), "30003");
  // NB: change in Oct 2016, default values are now coerced just like explicit value
  // (previous to Oct 2016 this would have returned just "30003+", no json)
  Asserts.assertStringContains((String)props.get("RANGE_PORT_DEFAULT_CONFIG"), "{\"start\"", "30003");
}

相关文章