uk.gov.dstl.baleen.core.pipelines.YamlPipelineConfiguration.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(121)

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

YamlPipelineConfiguration.<init>介绍

[英]Construct empty configuration
[中]构造空配置

代码示例

代码示例来源:origin: dstl/baleen

/**
 * Cosntruct a new BaleenJob
 *
 * @param name The name of the job
 * @param originalYaml The original YAML
 * @param scheduler The scheduler (i.e. collection reader)
 * @param tasks List of tasks (i.e. annotators)
 * @throws IOException if unable to construct
 */
public BaleenJob(
  String name, String originalYaml, CollectionReader scheduler, List<AnalysisEngine> tasks)
  throws IOException {
 this(name, new YamlPipelineConfiguration(originalYaml), scheduler, tasks);
}

代码示例来源:origin: dstl/baleen

/**
 * Construct a JobBuilder from the name and YAML
 *
 * @param name Pipeline name
 * @param yaml Pipeline YAML
 * @throws IOException if unable to read config
 * @deprecated Use {@link JobBuilder#JobBuilder(String, PipelineConfiguration)}
 */
@Deprecated
public JobBuilder(String name, String yaml) throws IOException {
 this(name, new YamlPipelineConfiguration(yaml));
}

代码示例来源:origin: dstl/baleen

/**
 * Construct a PipelineBuilder from the name and YAML
 *
 * @param name Pipeline name
 * @param yaml Pipeline YAML
 * @throws IOException
 * @deprecated Use {@link PipelineBuilder#PipelineBuilder(String, PipelineConfiguration)}
 */
@Deprecated
public PipelineBuilder(String name, String yaml) throws IOException {
 this(name, new YamlPipelineConfiguration(yaml));
}

代码示例来源:origin: dstl/baleen

/**
 * Create a new pipeline from the provided YAML, with the given name. If multiplicity is greater
 * than 1 names will be suffixed with '-n' for each multiple.
 */
public List<BaleenPipeline> create(String name, InputStream yaml, int multiplicity)
  throws BaleenException {
 try {
  return create(name, new YamlPipelineConfiguration(yaml), multiplicity);
 } catch (IOException e) {
  throw new BaleenException(e);
 }
}

代码示例来源:origin: dstl/baleen

/**
 * Create a new pipeline from the provided YAML file, with the given name. If multiplicity is
 * greater than 1 names will be suffixed with '-n' for each multiple.
 */
public List<BaleenPipeline> create(String name, File file, int multiplicity)
  throws BaleenException {
 try {
  return create(name, new YamlPipelineConfiguration(file), multiplicity);
 } catch (IOException e) {
  throw new BaleenException(e);
 }
}

代码示例来源:origin: dstl/baleen

protected BaleenJob wrapInJob(Class<? extends BaleenTask>... taskClasses)
  throws BaleenException, IOException {
 String yaml = getYaml(taskClasses);
 return (BaleenJob) jobManager.create("testjob", new YamlPipelineConfiguration(yaml));
}

代码示例来源:origin: dstl/baleen

protected BaleenJob wrapInJob(Class<? extends BaleenTask> taskClass, Map<String, String> params)
  throws BaleenException, IOException {
 String yaml = getYaml(taskClass, params);
 return (BaleenJob) jobManager.create("testjob", new YamlPipelineConfiguration(yaml));
}

代码示例来源:origin: dstl/baleen

@Test
public void testEmpty() throws Exception {
 BaleenJob job =
   new BaleenJob("name", new YamlPipelineConfiguration(), null, Collections.emptyList());
 doReturn(Optional.of(job)).when(manager).get(anyString());
 ServletCaller caller = new ServletCaller();
 caller.addParameter("name", "name");
 caller.doGet(new JobConfigServlet(manager));
 assertEquals("", caller.getResponseBody());
}

代码示例来源:origin: dstl/baleen

@Test
public void testNameAndYaml() throws IOException {
 BaleenPipeline bop =
   new BaleenPipeline(
     "Test Name",
     new YamlPipelineConfiguration("Test YAML"),
     new NoOpOrderer(),
     null,
     Collections.emptyList(),
     Collections.emptyList());
 assertEquals("Test Name", bop.getName());
 assertEquals("Test YAML", bop.originalConfig());
 // TODO: Test orderedYaml
}

代码示例来源:origin: dstl/baleen

@Test
public void testEmpty() throws Exception {
 BaleenPipeline pipeline =
   new BaleenPipeline(
     "name",
     new YamlPipelineConfiguration(),
     new NoOpOrderer(),
     null,
     Collections.emptyList(),
     Collections.emptyList());
 doReturn(Optional.of(pipeline)).when(manager).get(anyString());
 ServletCaller caller = new ServletCaller();
 caller.addParameter("name", "name");
 caller.doGet(new PipelineConfigServlet(manager));
 assertEquals("", caller.getResponseBody());
}

代码示例来源:origin: dstl/baleen

@Test
public void testErrorContentExtractorNotFound() throws Exception {
 String yaml =
   Files.asCharSource(getFile("errorNotFoundCEConfig.yaml"), StandardCharsets.UTF_8).read();
 PipelineBuilder pb = new PipelineBuilder("Test Pipeline", new YamlPipelineConfiguration(yaml));
 try {
  pb.createNewPipeline();
  fail("Expected exception not thrown");
 } catch (BaleenException be) {
  // Expected exception, do nothing
 }
}

代码示例来源:origin: dstl/baleen

@Test
 public void testWithConfig() throws Exception {
  BaleenPipeline pipeline =
    new BaleenPipeline(
      "name",
      new YamlPipelineConfiguration("Config"),
      new NoOpOrderer(),
      null,
      Collections.emptyList(),
      Collections.emptyList());
  doReturn(Optional.of(pipeline)).when(manager).get(anyString());

  ServletCaller caller = new ServletCaller();
  caller.addParameter("name", "name");
  caller.doGet(new PipelineConfigServlet(manager));
  assertEquals("Config", caller.getResponseBody());
 }
}

代码示例来源:origin: dstl/baleen

@Test
public void testErrorNoCR() throws Exception {
 String yaml =
   Files.asCharSource(getFile("errorNoCRConfig.yaml"), StandardCharsets.UTF_8).read();
 PipelineBuilder pb = new PipelineBuilder("Test Pipeline", new YamlPipelineConfiguration(yaml));
 try {
  pb.createNewPipeline();
  fail("Expected exception not thrown");
 } catch (BaleenException be) {
  // Expected exception, do nothing
 }
}

代码示例来源:origin: dstl/baleen

@Test
public void testErrorNotFoundCR() throws Exception {
 String yaml =
   Files.asCharSource(getFile("errorNotFoundCRConfig.yaml"), StandardCharsets.UTF_8).read();
 PipelineBuilder pb = new PipelineBuilder("Test Pipeline", new YamlPipelineConfiguration(yaml));
 try {
  pb.createNewPipeline();
  fail("Expected exception not thrown");
 } catch (BaleenException be) {
  // Expected exception, do nothing
 }
}

代码示例来源:origin: dstl/baleen

@Test
public void testLegacy() throws Exception {
 String yaml = Files.asCharSource(getFile("legacyConfig.yaml"), StandardCharsets.UTF_8).read();
 PipelineBuilder pb = new PipelineBuilder("Test Pipeline", new YamlPipelineConfiguration(yaml));
 BaleenPipeline pipeline = pb.createNewPipeline();
 assertEquals("Test Pipeline", pipeline.getName());
 assertEquals(yaml, pipeline.originalConfig());
 // Will throw an exception if the content extractor was not found resource wasn't initialized
}

代码示例来源:origin: dstl/baleen

@Test
public void testErrorNoClass() throws Exception {
 String yaml =
   Files.asCharSource(getFile("errorNoClassConfig.yaml"), StandardCharsets.UTF_8).read();
 PipelineBuilder pb = new PipelineBuilder("Test Pipeline", new YamlPipelineConfiguration(yaml));
 BaleenPipeline pipeline = pb.createNewPipeline();
 CollectionReader cr = pipeline.collectionReader();
 assertEquals("uk.gov.dstl.baleen.testing.DummyCollectionReader", cr.getMetaData().getName());
 List<AnalysisEngine> annotators = pipeline.annotators();
 assertEquals(0, annotators.size());
}

代码示例来源:origin: dstl/baleen

@Test
public void testResources() throws Exception {
 String yaml = Files.asCharSource(getFile("resourceConfig.yaml"), StandardCharsets.UTF_8).read();
 PipelineBuilder pb = new PipelineBuilder("Test Pipeline", new YamlPipelineConfiguration(yaml));
 BaleenPipeline pipeline = pb.createNewPipeline();
 assertEquals("Test Pipeline", pipeline.getName());
 assertEquals(yaml, pipeline.originalConfig());
 // Will throw an exception if the resource wasn't initialized
}

代码示例来源:origin: dstl/baleen

@Test
public void testErrorNotFound() throws Exception {
 String yaml =
   Files.asCharSource(getFile("errorNotFoundConfig.yaml"), StandardCharsets.UTF_8).read();
 PipelineBuilder pb = new PipelineBuilder("Test Pipeline", new YamlPipelineConfiguration(yaml));
 BaleenPipeline pipeline = pb.createNewPipeline();
 CollectionReader cr = pipeline.collectionReader();
 assertEquals("uk.gov.dstl.baleen.testing.DummyCollectionReader", cr.getMetaData().getName());
 List<AnalysisEngine> annotators = pipeline.annotators();
 assertEquals(0, annotators.size());
}

代码示例来源:origin: dstl/baleen

@Test
 public void testPause() throws IOException {
  BaleenPipeline bop =
    new BaleenPipeline(
      "Test Name",
      new YamlPipelineConfiguration(),
      new NoOpOrderer(),
      null,
      Collections.emptyList(),
      Collections.emptyList());

  assertFalse(bop.isPaused());
  bop.pause();
  assertTrue(bop.isPaused());
  bop.unpause();
  assertFalse(bop.isPaused());
 }
}

代码示例来源:origin: dstl/baleen

@Test
public void testValid3() throws Exception {
 String yaml = Files.asCharSource(getFile("jobConfig3.yaml"), Charset.defaultCharset()).read();
 JobBuilder jb = new JobBuilder("Test Job", new YamlPipelineConfiguration(yaml));
 BaleenJob job = (BaleenJob) jb.createNewPipeline();
 assertEquals("Test Job", job.getName());
 assertEquals(yaml, job.originalConfig());
 assertEquals(yaml, job.orderedConfig());
 CollectionReader cr = job.collectionReader();
 assertEquals("uk.gov.dstl.baleen.schedules.Other", cr.getMetaData().getName());
 assertEquals("Foo", cr.getConfigParameterValue("key"));
 List<AnalysisEngine> annotators = job.annotators();
 assertEquals(2, annotators.size());
 AnalysisEngine ann0 = annotators.get(0);
 assertEquals("uk.gov.dstl.baleen.testing.DummyTask", ann0.getMetaData().getName());
 assertEquals("Foo", ann0.getConfigParameterValue("key"));
 AnalysisEngine ann1 = annotators.get(1);
 assertEquals("uk.gov.dstl.baleen.testing.DummyTaskParams", ann1.getMetaData().getName());
 assertEquals("Bar", ann1.getConfigParameterValue("key"));
 List<AnalysisEngine> consumers = job.consumers();
 assertEquals(0, consumers.size());
}

相关文章

YamlPipelineConfiguration类方法