@Test public void testSetCounterValueWithoutDimension() throws ClassNotFoundException { Collector collector = Collector.getCollector("TestCollector"); collector.setCounterValue("ObjectType", "ot1", "ctr1", 10); collector.setCounterValue("ObjectType", "ot1", "ctr2", 11L); collector.setCounterValue("ObjectType", "ot1", "ctr3", "kdjkjsk"); assertEquals( 10, ((BranchRecord) collector.getOBjectTypeRecord("ot1")).getChildren().get("ctr1").getValue()); assertEquals( 11L, ((BranchRecord) collector.getOBjectTypeRecord("ot1")).getChildren().get("ctr2").getValue()); assertEquals( "kdjkjsk", ((BranchRecord) collector.getOBjectTypeRecord("ot1")).getChildren().get("ctr3").getValue()); }
@Test public void testSetCounterValuetWithDimention() throws ClassNotFoundException { Collector collector = Collector.getCollector("TestCollector"); collector.setCounterValue("ObjectType", "ot2", "dim1", 1, "dim2", "Cell=997", "ctr1", 1); collector.setCounterValue("ObjectType", "ot2", "dim1", 45, "dim2", "Cell=998", "ctr2", 12L); collector.setCounterValue( "ObjectType", "ot2", "dim1", 32, "dim2", "Cell=999", "ctr3", "kdjkjsk"); BranchRecord br1 = (BranchRecord) ((OBjectTypeRecord) collector.getOBjectTypeRecord("ot2")).getChildren().get(1); BranchRecord br2 = (BranchRecord) br1.getChildren().get("Cell=997"); System.out.println(br2); LeafRecord lf = (LeafRecord) br2.getChildren().get("ctr1"); assertEquals(1, lf.getValue()); assertEquals( 12L, ((BranchRecord) ((BranchRecord) ((OBjectTypeRecord) collector.getOBjectTypeRecord("ot2")) .getChildren() .get(45)) .getChildren() .get("Cell=998")) .getChildren() .get("ctr2") .getValue()); assertEquals( "kdjkjsk", ((BranchRecord) ((BranchRecord) ((OBjectTypeRecord) collector.getOBjectTypeRecord("ot2")) .getChildren() .get(32)) .getChildren() .get("Cell=999")) .getChildren() .get("ctr3") .getValue()); }