@Test
public void testGetAllTimeseriesCount() {

  // set storage group first
  MTree root = new MTree();
  try {
    root.setStorageGroup(new PartialPath("root.laptop"));
    root.createTimeseries(new PartialPath("root.laptop.d1.s1"), TSDataType.INT32, TSEncoding.PLAIN,
        CompressionType.GZIP, null, null);
    root.createTimeseries(new PartialPath("root.laptop.d1.s2"), TSDataType.INT32, TSEncoding.PLAIN,
        CompressionType.GZIP, null, null);
    root.createTimeseries(new PartialPath("root.laptop.d2.s1"), TSDataType.INT32, TSEncoding.PLAIN,
        CompressionType.GZIP, null, null);
    root.createTimeseries(new PartialPath("root.laptop.d2.s2"), TSDataType.INT32, TSEncoding.PLAIN,
        CompressionType.GZIP, null, null);
    assertEquals(4, root.getAllTimeseriesCount(new PartialPath("root.laptop")));
    assertEquals(2, root.getNodesCountInGivenLevel(new PartialPath("root.laptop"), 2));
    assertEquals(4, root.getNodesCountInGivenLevel(new PartialPath("root.laptop"), 3));
    assertEquals(2, root.getNodesCountInGivenLevel(new PartialPath("root.laptop.d1"), 3));
    assertEquals(0, root.getNodesCountInGivenLevel(new PartialPath("root.laptop.d1"), 4));
  } catch (MetadataException e) {
    e.printStackTrace();
    fail(e.getMessage());
  }
}