@Test public void testGetAllTimeseriesCount() { 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()); } }
int getAllTimeseriesCount(PartialPath prefixPath) throws MetadataException { String[] nodes = prefixPath.getNodes(); if (nodes.length == 0 || !nodes[0].equals(root.getName())) { throw new IllegalPathException(prefixPath.getFullPath()); } return getCount(root, nodes, 1); }
MTree implements Serializable { int getAllTimeseriesCount(PartialPath prefixPath) throws MetadataException { String[] nodes = prefixPath.getNodes(); if (nodes.length == 0 || !nodes[0].equals(root.getName())) { throw new IllegalPathException(prefixPath.getFullPath()); } return getCount(root, nodes, 1); } }
MTree implements Serializable { int getAllTimeseriesCount(PartialPath prefixPath) throws MetadataException { String[] nodes = prefixPath.getNodes(); if (nodes.length == 0 || !nodes[0].equals(root.getName())) { throw new IllegalPathException(prefixPath.getFullPath()); } return getCount(root, nodes, 1); } MTree(); private  MTree(MNode root); }
MTree implements Serializable { int getAllTimeseriesCount(PartialPath prefixPath) throws MetadataException { String[] nodes = prefixPath.getNodes(); if (nodes.length == 0 || !nodes[0].equals(root.getName())) { throw new IllegalPathException(prefixPath.getFullPath()); } return getCount(root, nodes, 1); } MTree(); private  MTree(MNode root); void serializeTo(String snapshotPath); @SuppressWarnings("squid:S3776") // Suppress high Cognitive Complexity warning static MTree deserializeFrom(File mtreeSnapshot); @Override String toString(); }
MTree implements Serializable { int getAllTimeseriesCount(PartialPath prefixPath) throws MetadataException { String[] nodes = prefixPath.getNodes(); if (nodes.length == 0 || !nodes[0].equals(root.getName())) { throw new IllegalPathException(prefixPath.getFullPath()); } return getCount(root, nodes, 1); } MTree(); private  MTree(MNode root); void serializeTo(String snapshotPath); @SuppressWarnings("squid:S3776") // Suppress high Cognitive Complexity warning static MTree deserializeFrom(File mtreeSnapshot); @Override String toString(); static final Gson GSON; }