コード例 #1
0
ファイル: TestCollector.java プロジェクト: zahidMed/kpi4j
  @Test
  public void testIncrementCounterWithDimention() throws ClassNotFoundException {
    Collector collector = Collector.getCollector("TestCollector");

    collector.incrementCounter("ObjectType", "ot2", "dim1", 1, "dim2", "Cell=997", "ctr1", 1);
    collector.incrementCounter("ObjectType", "ot2", "dim1", 45, "dim2", "Cell=998", "ctr2", 12L);

    collector.incrementCounter("ObjectType", "ot2", "dim1", 1, "dim2", "Cell=997", "ctr1", 1);
    collector.incrementCounter("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(2, lf.getValue());
    assertEquals(
        24L,
        ((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());
  }
コード例 #2
0
ファイル: TestCollector.java プロジェクト: zahidMed/kpi4j
  @Test
  public void testCheckInputWithoutDimention() throws ClassNotFoundException {
    Collector collector = Collector.getCollector("TestCollector");
    assertEquals(true, collector.checkInput("ObjectType", "ot1", "ctr1", 1));
    assertEquals(true, collector.checkInput("ObjectType", "ot1", "ctr2", 1L));
    assertEquals(true, collector.checkInput("ObjectType", "ot1", "ctr3", "kdjkjsk"));

    assertEquals(false, collector.checkInput("ObjectType", "ot1", "ctr1", 12L));
    assertEquals(false, collector.checkInput("ObjectType", "ot1", "ctr2", "mksmkfms"));
    assertEquals(false, collector.checkInput("ObjectType", "ot1", "ctr3", 1));
  }
コード例 #3
0
ファイル: TestCollector.java プロジェクト: zahidMed/kpi4j
  @Test
  public void testIncrementCounterWithoutDimension() throws ClassNotFoundException {
    Collector collector = Collector.getCollector("TestCollector");

    collector.incrementCounter("ObjectType", "ot1", "ctr1", 10);
    collector.incrementCounter("ObjectType", "ot1", "ctr2", 11L);

    collector.incrementCounter("ObjectType", "ot1", "ctr1", 10);
    collector.incrementCounter("ObjectType", "ot1", "ctr2", 11L);
    collector.setCounterValue("ObjectType", "ot1", "ctr3", "kdjkjsk");

    assertEquals(
        20,
        ((BranchRecord) collector.getOBjectTypeRecord("ot1")).getChildren().get("ctr1").getValue());
    assertEquals(
        22L,
        ((BranchRecord) collector.getOBjectTypeRecord("ot1")).getChildren().get("ctr2").getValue());
    assertEquals(
        "kdjkjsk",
        ((BranchRecord) collector.getOBjectTypeRecord("ot1")).getChildren().get("ctr3").getValue());
  }
コード例 #4
0
ファイル: TestCollector.java プロジェクト: zahidMed/kpi4j
  @Test
  public void testCheckInputWithDimention() throws ClassNotFoundException {
    Collector collector = Collector.getCollector("TestCollector");
    assertEquals(
        true, collector.checkInput("ObjectType", "ot2", "dim1", 1, "dim2", "Cell=997", "ctr1", 1));
    assertEquals(
        true,
        collector.checkInput("ObjectType", "ot2", "dim1", 45, "dim2", "Cell=998", "ctr2", 1L));
    assertEquals(
        true,
        collector.checkInput(
            "ObjectType", "ot2", "dim1", 32, "dim2", "Cell=999", "ctr3", "kdjkjsk"));

    assertEquals(false, collector.checkInput("ObjectType", "ot2", "ctr1", 12L));
    assertEquals(false, collector.checkInput("ObjectType", "ot2", "dim1", 1, "ctr2", "mksmkfms"));
    assertEquals(
        false,
        collector.checkInput("ObjectType", "ot2", "dim1", 1L, "dim2", "Cell=997", "ctr3", 1));
    assertEquals(
        false,
        collector.checkInput("ObjectType", "ot2", "dim1", "lsjdl", "dim2", "Cell=997", "ctr3", 1));
  }