public static String toDotString(Pipeline pipeline) {
    final PipelineDotRenderer visitor = new PipelineDotRenderer();
    visitor.begin();
    pipeline.traverseTopologically(visitor);
    visitor.end();
    return visitor.dotBuilder.toString();
  }
@Test
  public void testCompositePipeline() {
    p.apply(
            Create.timestamped(
                TimestampedValue.of(KV.of(1, 1), new Instant(1)),
                TimestampedValue.of(KV.of(2, 2), new Instant(2))))
        .apply(Window.into(FixedWindows.of(Duration.millis(10))))
        .apply(Sum.integersPerKey());
    assertEquals(
        "digraph {"
            + "    rankdir=LR"
            + "    subgraph cluster_0 {"
            + "        label = \"\""
            + "        subgraph cluster_1 {"
            + "            label = \"Create.TimestampedValues\""
            + "            subgraph cluster_2 {"
            + "                label = \"Create.TimestampedValues/Create.Values\""
            + "                subgraph cluster_3 {"
            + "                    label = \"Create.TimestampedValues/Create.Values/Read(CreateSource)\""
            + "                    4 [label=\"Impulse\"]"
            + "                    subgraph cluster_5 {"
            + "                        label = \"Create.TimestampedValues/Create.Values/Read(CreateSource)/ParDo(OutputSingleSource)\""
            + "                        6 [label=\"ParMultiDo(OutputSingleSource)\"]"
            + "                        4 -> 6 [style=solid label=\"\"]"
            + "                    }"
            + "                    subgraph cluster_7 {"
            + "                        label = \"Create.TimestampedValues/Create.Values/Read(CreateSource)/ParDo(BoundedSourceAsSDFWrapper)\""
            + "                        8 [label=\"ParMultiDo(BoundedSourceAsSDFWrapper)\"]"
            + "                        6 -> 8 [style=solid label=\"\"]"
            + "                    }"
            + "                }"
            + "            }"
            + "            subgraph cluster_9 {"
            + "                label = \"Create.TimestampedValues/ParDo(ConvertTimestamps)\""
            + "                10 [label=\"ParMultiDo(ConvertTimestamps)\"]"
            + "                8 -> 10 [style=solid label=\"\"]"
            + "            }"
            + "        }"
            + "        subgraph cluster_11 {"
            + "            label = \"Window.Into()\""
            + "            12 [label=\"Window.Assign\"]"
            + "            10 -> 12 [style=solid label=\"\"]"
            + "        }"
            + "        subgraph cluster_13 {"
            + "            label = \"Combine.perKey(SumInteger)\""
            + "            14 [label=\"GroupByKey\"]"
            + "            12 -> 14 [style=solid label=\"\"]"
            + "            subgraph cluster_15 {"
            + "                label = \"Combine.perKey(SumInteger)/Combine.GroupedValues\""
            + "                subgraph cluster_16 {"
            + "                    label = \"Combine.perKey(SumInteger)/Combine.GroupedValues/ParDo(Anonymous)\""
            + "                    17 [label=\"ParMultiDo(Anonymous)\"]"
            + "                    14 -> 17 [style=solid label=\"\"]"
            + "                }"
            + "            }"
            + "        }"
            + "    }"
            + "}",
        PipelineDotRenderer.toDotString(p).replaceAll(System.lineSeparator(), ""));
  }