本文整理了Java中uk.gov.dstl.baleen.core.utils.yaml.YamlConfiguration.<init>()
方法的一些代码示例,展示了YamlConfiguration.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlConfiguration.<init>()
方法的具体详情如下:
包路径:uk.gov.dstl.baleen.core.utils.yaml.YamlConfiguration
类名称:YamlConfiguration
方法名:<init>
[英]New instance.
[中]新的例子。
代码示例来源:origin: dstl/baleen
private static YamlConfiguration createConfigurtion(Optional<File> configurationFile)
throws BaleenException {
if (configurationFile.isPresent()) {
try (InputStream is = new FileInputStream(configurationFile.get())) {
LOGGER.info("Configuration file provided {}", configurationFile.get().getAbsolutePath());
return new YamlConfiguration(configurationFile.get());
} catch (Exception ioe) {
throw new BaleenException("Unable to read configuration file", ioe);
}
} else {
LOGGER.info("No configuration file provided - default configuration will be used");
}
try {
return new YamlConfiguration();
} catch (Exception e) {
throw new BaleenException("Unable to read configuration file", e);
}
}
代码示例来源:origin: uk.gov.dstl.baleen/baleen-core
private static YamlConfiguration createConfigurtion(Optional<File> configurationFile)
throws BaleenException {
if (configurationFile.isPresent()) {
try (InputStream is = new FileInputStream(configurationFile.get())) {
LOGGER.info("Configuration file provided {}", configurationFile.get().getAbsolutePath());
return new YamlConfiguration(configurationFile.get());
} catch (Exception ioe) {
throw new BaleenException("Unable to read configuration file", ioe);
}
} else {
LOGGER.info("No configuration file provided - default configuration will be used");
}
try {
return new YamlConfiguration();
} catch (Exception e) {
throw new BaleenException("Unable to read configuration file", e);
}
}
代码示例来源:origin: dstl/baleen
BaleenManager baleen = new BaleenManager(new YamlConfiguration(yaml));
if (dryRun) {
baleen.run(manager -> LOGGER.info("Dry run mode: closing immediately"));
代码示例来源:origin: dstl/baleen
@Before
public void setup() throws IOException {
config = new YamlConfiguration(YamlConfigurationTest.class, YAMLCONFIGURATION_YAML);
}
代码示例来源:origin: dstl/baleen
@Test
public void testNonExistentFile() {
try {
new YamlConfiguration(new File("missing.yaml"));
} catch (IOException ioe) {
return;
}
fail("Didn't throw expected IOException");
}
代码示例来源:origin: dstl/baleen
@Test
public void testReadString() throws IOException {
YamlConfiguration yc =
new YamlConfiguration("example:\n color: red\n count: 7\n list:\n - a\n - b\n - c");
assertTrue(yc.getAsList("example.list").containsAll(Arrays.asList("a", "b", "c")));
assertEquals("red", yc.get(String.class, "example.color").get());
}
代码示例来源:origin: dstl/baleen
@Test
public void testCleanTabs() throws IOException {
assertEquals(
"test: \"Hello\\tWorld!\"\n" + "testing:\n" + "- 1.. 2.. 3.. 4..\n",
new YamlConfiguration("\t\ttest: Hello\tWorld!\n\t\ttesting:\n\t\t- 1.. 2.. 3.. 4.. ")
.toString());
}
}
代码示例来源:origin: dstl/baleen
public static void runServer(BaleenManager manager, Runnable run)
throws BaleenException, IOException {
BaleenWebApi web = new BaleenWebApi(manager);
try {
web.configure(new YamlConfiguration());
web.start();
// Wait for the server to be up
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// Do nothing
}
run.run();
} finally {
web.stop();
}
}
代码示例来源:origin: dstl/baleen
@Test
public void testWithSinglePipeline() throws Exception {
BaleenPipelineManager manager = new BaleenPipelineManager();
try {
YamlConfiguration config = new YamlConfiguration(getClass(), "single.yaml");
manager.configure(config);
assertEquals(1, manager.getAll().size());
assertTrue(manager.get("single").isPresent());
} finally {
manager.stop();
}
}
代码示例来源:origin: dstl/baleen
@Test
public void testRemoveSinglePipeline() throws Exception {
BaleenPipelineManager manager = new BaleenPipelineManager();
try {
YamlConfiguration config = new YamlConfiguration(getClass(), "single.yaml");
manager.configure(config);
manager.remove("single");
assertEquals(0, manager.getAll().size());
} finally {
manager.stop();
}
}
代码示例来源:origin: dstl/baleen
@Test
public void testWithRemoveAllPipelines() throws Exception {
BaleenPipelineManager manager = new BaleenPipelineManager();
try {
YamlConfiguration config = new YamlConfiguration(getClass(), "multiplicity.yaml");
manager.configure(config);
manager.removeAll("multi");
assertEquals(0, manager.getAll().size());
} finally {
manager.stop();
}
}
}
代码示例来源:origin: dstl/baleen
@Test
public void testWithDoublePipeline() throws Exception {
BaleenPipelineManager manager = new BaleenPipelineManager();
try {
YamlConfiguration config = new YamlConfiguration(getClass(), "double.yaml");
manager.configure(config);
assertEquals(2, manager.getAll().size());
assertTrue(manager.get("one").isPresent());
assertTrue(manager.get("two").isPresent());
} finally {
manager.stop();
}
}
代码示例来源:origin: dstl/baleen
@Test
public void testWithoutConfiguration() throws Exception {
BaleenPipelineManager manager = new BaleenPipelineManager();
try {
manager.configure(new YamlConfiguration());
assertEquals(0, manager.getAll().size());
} finally {
manager.stop();
}
}
代码示例来源:origin: dstl/baleen
@Test
public void testWithMultiplicityPipeline() throws Exception {
BaleenPipelineManager manager = new BaleenPipelineManager();
try {
YamlConfiguration config = new YamlConfiguration(getClass(), "multiplicity.yaml");
manager.configure(config);
assertEquals(4, manager.getAll().size());
assertTrue(manager.get("multi-1").isPresent());
assertTrue(manager.get("multi-2").isPresent());
assertTrue(manager.get("multi-3").isPresent());
assertTrue(manager.get("multi-4").isPresent());
} finally {
manager.stop();
}
}
代码示例来源:origin: dstl/baleen
@Test
public void testAbstract() throws BaleenException, IOException {
BCT bct = new BCT();
bct.configure(new YamlConfiguration());
bct.start();
bct.stop();
}
}
代码示例来源:origin: dstl/baleen
@Test
public void testConfiguration() throws Exception {
YamlConfiguration configuration =
new YamlConfiguration(MetricsFactoryTest.class, "reporters.yaml");
metrics.configure(configuration);
metrics.start();
try {
metrics.getCounter(MetricsFactoryTest.class, "testConfiguration").inc();
metrics.getCounter(MetricsFactoryTest.class, "testConfiguration").inc();
MetricsFactory.getMetrics("test", MetricsFactoryTest.class)
.getCounter("testConfigurationMetric")
.inc();
metrics.report();
Thread.sleep(1000);
} finally {
metrics.stop();
}
// Delete the directory of CSV tests
TestingUtils.deleteDirectory("test_csvmetrics");
}
}
代码示例来源:origin: dstl/baleen
@Test
public void testComponents() throws BaleenException, IOException {
metrics.configure(new YamlConfiguration());
metrics.start();
metrics.getCounter(MetricsFactoryTest.class, "removeC");
metrics.stop();
assertTrue(metrics.getRegistry().getMetrics().isEmpty());
}
代码示例来源:origin: dstl/baleen
@Test
public void run() throws Exception {
BaleenWebApi web = new BaleenWebApi(baleenManager);
try {
web.configure(new YamlConfiguration());
web.start();
// Wait for the server to be up
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
// Do nothing
}
String metrics = getResponse("/metrics");
assertFalse(metrics.isEmpty());
String status = getResponse("/status");
assertTrue(status.contains("ok"));
String pipelines = getResponse("/pipelines");
assertFalse(pipelines.isEmpty());
} finally {
web.stop();
}
}
代码示例来源:origin: dstl/baleen
@Test
public void config() throws Exception {
YamlConfiguration configuration =
new YamlConfiguration(BaleenLoggingTest.class, "dummyConfig.yaml");
代码示例来源:origin: dstl/baleen
new YamlConfiguration(BaleenSecureWebApiTest.class, "secure.yaml");
内容来源于网络,如有侵权,请联系作者删除!