DirectoryYamlFlowLoader implements FlowLoader { @Override public ValidationReport loadProjectFlow(final Project project, final File projectDir) { convertYamlFiles(projectDir); FlowLoaderUtils.checkJobProperties(project.getId(), this.props, this.jobPropsMap, this.errors); return FlowLoaderUtils.generateFlowLoaderReport(this.errors); } DirectoryYamlFlowLoader(final Props props); @Override Map<String, Flow> getFlowMap(); @Override Set<String> getErrors(); Map<String, List<Edge>> getEdgeMap(); @Override ValidationReport loadProjectFlow(final Project project, final File projectDir); static final Pattern CONDITION_VARIABLE_REPLACEMENT_PATTERN; static final Pattern CONDITION_ON_JOB_STATUS_PATTERN; static final Pattern DIGIT_STRING_PATTERN; static final String VALID_CONDITION_OPERATORS; }
@Test public void testLoadBasicYamlFile() { final DirectoryYamlFlowLoader loader = new DirectoryYamlFlowLoader(new Props()); loader.loadProjectFlow(this.project, ExecutionsTestUtil.getFlowDir(BASIC_FLOW_YAML_DIR)); checkFlowLoaderProperties(loader, 0, 1, 1); checkFlowProperties(loader, BASIC_FLOW_1, 0, 4, 1, 3, null); }
@Test public void testLoadMultipleYamlFiles() { final DirectoryYamlFlowLoader loader = new DirectoryYamlFlowLoader(new Props()); loader.loadProjectFlow(this.project, ExecutionsTestUtil.getFlowDir(MULTIPLE_FLOW_YAML_DIR)); checkFlowLoaderProperties(loader, 0, 2, 2); checkFlowProperties(loader, BASIC_FLOW_1, 0, 4, 1, 3, null); checkFlowProperties(loader, BASIC_FLOW_2, 0, 3, 1, 2, null); }
@Test public void testLoadYamlFileRecursively() { final DirectoryYamlFlowLoader loader = new DirectoryYamlFlowLoader(new Props()); loader.loadProjectFlow(this.project, ExecutionsTestUtil.getFlowDir(RECURSIVE_DIRECTORY_FLOW_YAML_DIR)); checkFlowLoaderProperties(loader, 0, 2, 2); checkFlowProperties(loader, BASIC_FLOW_1, 0, 3, 1, 2, null); checkFlowProperties(loader, BASIC_FLOW_2, 0, 4, 1, 3, null); }
@Test public void testLoadEmbeddedFlowYamlFile() { final DirectoryYamlFlowLoader loader = new DirectoryYamlFlowLoader(new Props()); loader.loadProjectFlow(this.project, ExecutionsTestUtil.getFlowDir(EMBEDDED_FLOW_YAML_DIR)); checkFlowLoaderProperties(loader, 0, 3, 3); checkFlowProperties(loader, EMBEDDED_FLOW, 0, 4, 1, 3, null); checkFlowProperties(loader, EMBEDDED_FLOW_1, 0, 4, 1, 3, null); checkFlowProperties(loader, EMBEDDED_FLOW_2, 0, 2, 1, 1, null); }
@Test public void testLoadMultipleEmbeddedFlowYamlFiles() { final DirectoryYamlFlowLoader loader = new DirectoryYamlFlowLoader(new Props()); loader.loadProjectFlow(this.project, ExecutionsTestUtil.getFlowDir(MULTIPLE_EMBEDDED_FLOW_YAML_DIR)); checkFlowLoaderProperties(loader, 0, 6, 6); checkFlowProperties(loader, EMBEDDED_FLOW, 0, 4, 1, 3, null); checkFlowProperties(loader, EMBEDDED_FLOW_1, 0, 4, 1, 3, null); checkFlowProperties(loader, EMBEDDED_FLOW_2, 0, 2, 1, 1, null); checkFlowProperties(loader, EMBEDDED_FLOW_B, 0, 4, 1, 3, null); checkFlowProperties(loader, EMBEDDED_FLOW_B1, 0, 4, 1, 3, null); checkFlowProperties(loader, EMBEDDED_FLOW_B2, 0, 2, 1, 1, null); }
@Test public void testLoadInvalidFlowYamlFileWithCycle() { final DirectoryYamlFlowLoader loader = new DirectoryYamlFlowLoader(new Props()); loader.loadProjectFlow(this.project, ExecutionsTestUtil.getFlowDir(CYCLE_FOUND_YAML_DIR)); checkFlowLoaderProperties(loader, 1, 1, 1); checkFlowProperties(loader, CYCLE_FOUND_FLOW, 1, 4, 1, 4, CYCLE_FOUND_ERROR); }
@Test public void testLoadNoFlowYamlFile() { final DirectoryYamlFlowLoader loader = new DirectoryYamlFlowLoader(new Props()); loader.loadProjectFlow(this.project, ExecutionsTestUtil.getFlowDir(NO_FLOW_YAML_DIR)); checkFlowLoaderProperties(loader, 0, 0, 0); }