Exemplo n.º 1
0
 protected void showOverview() {
   for (SmiModule module : m_mib.get().getModules()) {
     for (SmiSymbol symbol : module.getSymbols()) {
       String msg =
           module.getId() + ": " + symbol.getId() + ": " + symbol.getClass().getSimpleName();
       if (symbol instanceof SmiOidValue) {
         SmiOidValue oidValue = (SmiOidValue) symbol;
         msg += ": " + oidValue.getOidStr();
       }
       System.out.println(msg);
     }
   }
 }
Exemplo n.º 2
0
  protected void checkOidTree(SmiMib mib) {
    // mib.getRootNode().dumpTree(System.out, "");

    int count = 0;
    for (SmiSymbol symbol : mib.getSymbols()) {
      if (symbol instanceof SmiOidValue) {
        SmiOidValue oidValue = (SmiOidValue) symbol;
        // oidValue.dumpAncestors(System.out);
        if (oidValue.getNode() != mib.getRootNode()) {
          String msg = oidValue.getIdToken().toString();
          assertNotNull(msg, oidValue.getNode().getParent());

          SmiOidNode foundOidNode =
              oidValue.getNode().getParent().findChild(oidValue.getNode().getValue());
          assertNotNull(msg, foundOidNode);
          assertSame(msg, oidValue.getNode(), foundOidNode);
          assertTrue(msg, oidValue.getNode().getParent().contains(oidValue.getNode()));
        }
        //                SmiOidValue foundSymbol = findOidSymbol(mib.getRootNode(),
        // symbol.getId());
        //                assertNotNull(symbol.getId(), foundSymbol);
        //                assertSame(symbol.getId(), symbol, foundSymbol);
        count++;
      }
    }

    // mib.getRootNode().dumpTree(System.out, "");
    int totalChildCount = mib.getRootNode().getTotalChildCount();
    // assertTrue(count + " < " +  totalChildCount, count < totalChildCount);
    // System.out.println("totalChildCount: " + totalChildCount);

    // I don't think you can draw any conclusions based on the count:
    // - due to anonymous oid node, you can have more oid nodes than oid symbols
    // - due to duplicated symbols you can have more symbols than nodes:
    // assertEquals(count + mib.getDummyOidNodesCount(), totalChildCount);
  }