StepUtils { public static Set<Step> getIndependentNonStreamingSteps(Set<Step> steps) { Set<Step> streamsAndDependents = Sets.newHashSet(); for (Step step : steps) { if (step instanceof StreamingStep) { streamsAndDependents.add(step); streamsAndDependents.addAll(StepUtils.getAllDependentSteps(step, steps)); } } return Sets.difference(steps, streamsAndDependents); }  static boolean allStepsSubmitted(Set<Step> steps); static boolean allStepsFinished(Set<Step> steps); static Set<Step> getDependencies(Step step, Set<Step> steps); static boolean hasStreamingStep(Set<Step> steps); static Set<StreamingStep> getStreamingSteps(Set<Step> steps); static Set<Step> getAllDependentSteps(Step rootStep, Set<Step> steps); static Set<Step> getImmediateDependentSteps(Step step, Set<Step> steps); static Set<Step> getIndependentNonStreamingSteps(Set<Step> steps); static String stepNamesAsString(Set<? extends Step> steps); static void resetSteps(Set<Step> steps); static void resetRepeatingSteps(Set<Step> allSteps); static Set<DataStep> getDataSteps(Set<Step> steps); static Optional<Step> getStepForName(String name, Set<Step> steps); static Set<Step> copySteps(Set<Step> steps); static Map<String, Dataset<Row>> getStepDataFrames(Set<Step> steps); static Set<Step> extractSteps(Config config, boolean configure, boolean notify); static Set<Step> mergeLoadedSteps(Set<Step> baseSteps, Step parentStep, Config baseConfig); static Map<String, StepState> getStepStates(Set<Step> steps); static Set<Step> getStepsMatchingState(Set<Step> steps, StepState matching);  }
@Test public void testGetIndependentNonStreamingSteps() { Step step1 = new BatchStep("step1"); Step step2 = new BatchStep("step2"); Step step3 = new BatchStep("step3"); Step step4 = new StreamingStep("step4"); Step step5 = new BatchStep("step5"); Step step6 = new StreamingStep("step6"); Step step7 = new BatchStep("step7"); Step step8 = new BatchStep("step8"); step1.configure(ConfigFactory.empty()); step2.configure(ConfigFactory.empty().withValue("dependencies", ConfigValueFactory.fromIterable(Sets.newHashSet("step1")))); step3.configure(ConfigFactory.empty().withValue("dependencies", ConfigValueFactory.fromIterable(Sets.newHashSet("step2")))); step4.configure(ConfigFactory.empty()); step5.configure(ConfigFactory.empty().withValue("dependencies", ConfigValueFactory.fromIterable(Sets.newHashSet("step3", "step4")))); step6.configure(ConfigFactory.empty()); step7.configure(ConfigFactory.empty().withValue("dependencies", ConfigValueFactory.fromIterable(Sets.newHashSet("step1", "step6")))); step8.configure(ConfigFactory.empty().withValue("dependencies", ConfigValueFactory.fromIterable(Sets.newHashSet("step2", "step6")))); Set<Step> steps = Sets.newHashSet(step1, step2, step3, step4, step5, step6, step7, step8); assertEquals(Sets.newHashSet(step1, step2, step3), StepUtils.getIndependentNonStreamingSteps(steps)); }