DagBuilder { public static Dag getPurgingDag(JsonCluster cluster, ClusterRuntime clusterEntity, ClusterStats clusterStats, TaskSubmitter submitter, Map<String, JsonObject> chefJsons) throws KaramelException { Dag dag = new Dag(); Map<String, RunRecipeTask> allRecipeTasks = new HashMap<>(); CookbookCache cache = ClusterDefinitionService.CACHE; List<KaramelizedCookbook> kcbs = cache.loadRootKaramelizedCookbooks(cluster); machineLevelTasks(cluster, clusterEntity, clusterStats, submitter, dag, kcbs); cookbookLevelPurgingTasks(cluster, clusterEntity, clusterStats, chefJsons, submitter, allRecipeTasks, dag, kcbs); return dag; }  static Dag getPurgingDag(JsonCluster cluster, ClusterRuntime clusterEntity, ClusterStats clusterStats,
      TaskSubmitter submitter, Map<String, JsonObject> chefJsons); static Dag getInstallationDag(JsonCluster cluster, ClusterRuntime clusterEntity, ClusterStats clusterStats,
      TaskSubmitter submitter, Map<String, JsonObject> chefJsons); static Map<String, Map<String, Task>> recipeLevelTasks(JsonCluster cluster, ClusterRuntime clusterEntity,
      ClusterStats clusterStats, Map<String, JsonObject> chefJsons, TaskSubmitter submitter,
      Map<String, RunRecipeTask> allRecipeTasks, Dag dag,
      List<KaramelizedCookbook> rootCookbooks); static Map<String, Map<String, Task>> cookbookLevelPurgingTasks(JsonCluster cluster,
      ClusterRuntime clusterEntity, ClusterStats clusterStats, Map<String, JsonObject> chefJsons,
      TaskSubmitter submitter, Map<String, RunRecipeTask> allRecipeTasks, Dag dag,
      List<KaramelizedCookbook> rootCookbooks); static Map<String, Map<String, Task>> cookbookLevelInstallationTasks(JsonCluster cluster,
      ClusterRuntime clusterEntity, ClusterStats clusterStats, Map<String, JsonObject> chefJsons,
      TaskSubmitter submitter, Map<String, RunRecipeTask> allRecipeTasks, Dag dag,
      List<KaramelizedCookbook> rootCookbooks); static void machineLevelTasks(JsonCluster cluster, ClusterRuntime clusterEntity, ClusterStats clusterStats,
      TaskSubmitter submitter, Dag dag, List<KaramelizedCookbook> rootCookbooks);  }
@Test public void testHopsworksPurgingDag() throws IOException, KaramelException { TaskSubmitter dummyTaskSubmitter = new TaskSubmitter() { @Override public void submitTask(Task task) throws KaramelException { System.out.println(task.uniqueId()); task.succeed(); } @Override public void prepareToStart(Task task) throws KaramelException { } @Override public void killMe(Task task) throws KaramelException { } @Override public void retryMe(Task task) throws KaramelException { } @Override public void skipMe(Task task) throws KaramelException { } @Override public void terminate(Task task) throws KaramelException { } }; Settings.CB_CLASSPATH_MODE = true; String ymlString = Resources.toString(Resources.getResource("se/kth/karamel/client/model/test-definitions/hopsworks.yml"), Charsets.UTF_8); JsonCluster definition = ClusterDefinitionService.yamlToJsonObject(ymlString); ClusterRuntime dummyRuntime = MockingUtil.dummyRuntime(definition); Map<String, JsonObject> chefJsons = ChefJsonGenerator.generateClusterChefJsonsForPurge(definition, dummyRuntime); ClusterStats clusterStats = new ClusterStats(); Dag dag = DagBuilder.getPurgingDag(definition, dummyRuntime, clusterStats, dummyTaskSubmitter, chefJsons); dag.validate(); System.out.println(dag.print()); }