コード例 #1
0
  private void executeTestCase026() {
    try {
      Properties viewProperties = new Properties();
      viewProperties.put("ICON-FILE", "images/tick.png");
      viewProperties.put("TREE-NAME", "MKG");
      viewProperties.put("ID", "Events");
      viewProperties.put("PARENT", "Fault");
      Properties panelProperties = new Properties();
      panelProperties.put("PARENT", "Maps");

      boolean add26 =
          dbxmlutil.addNode(
              "newNode_26", "LEVEL-1", "All", "Fault", "Default", viewProperties, panelProperties);
      boolean node261 =
          dbxmlutil.modifyNode("newNode", "All", "Default", viewProperties, panelProperties);

      boolean remove26 = dbxmlutil.removeNode("newNode_26", "All", "Fault", true);
      boolean node26 =
          dbxmlutil.modifyNode("newNode", "All", "Default", viewProperties, panelProperties);

      // System.out.println("node261 , node26"+node261+node26);
      if (node26) {
        System.out.println("CATS-JCF-API-DXU-026   ---> FAILED");
      } else {
        System.out.println("CATS-JCF-API-DXU-026   ---> PASSED");
      }
    } catch (Exception e) {
      // e.printStackTrace();
    }
  }
コード例 #2
0
  private void executeTestCase012() {
    try {
      Properties viewProperties = new Properties();
      viewProperties.put("ICON-FILE", "images/tick.png");
      viewProperties.put("TREE-NAME", "MKG");
      viewProperties.put("ID", "Events");
      viewProperties.put("PARENT", "Fault");

      Properties panelProperties = new Properties();
      panelProperties.put("PARENT", "Maps");

      // adding newNode
      boolean add1 =
          dbxmlutil.addNode(
              "newNode_12", "LEVEL-1", "All", "Fault", "Default", viewProperties, panelProperties);
      // removing newNode
      boolean remove = dbxmlutil.removeNode("newNode_12", "All", "Fault", true);

      // readding the newNode
      boolean add2 =
          dbxmlutil.addNode(
              "newNode_12", "LEVEL-1", "All", "Fault", "Default", viewProperties, panelProperties);
      if (add2 == true) {
        System.out.println("CATS-JCF-API-DXU-012   ---> PASSED");
      } else {
        System.out.println("CATS-JCF-API-DXU-012   ---> FAILED");
      }
      // removing newNode
      boolean remove1 = dbxmlutil.removeNode("newNode_12", "All", "Fault", true);
    } catch (Exception e) {
      // e.printStackTrace();
    }
  }
コード例 #3
0
 private void executeTestCase002() {
   try {
     Vector v = dbxmlutil.getAllNodeID(null, null);
   } catch (Exception e) {
     // e.printStackTrace();
     System.out.println("CATS-JCF-API-DXU-002   ---> PASSED");
   }
   System.out.println("CATS-JCF-API-DXU-002   ---> FAILED");
 }
コード例 #4
0
  private void executeTestCase034() {
    try {
      System.out.println(
          "Properties "
              + dbxmlutil.getNodeAttributes("Network Database", "root", "Network Database"));

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #5
0
  private void executeTestCase004() {

    try {
      System.out.println("Properties " + dbxmlutil.getAllAttributes("test", "Network Database"));
    } catch (Exception es) {
      // return new OperationResult(userName,"Failed", "Failed", es.toString());
      // es.printStackTrace();
      es.printStackTrace();
    }
  }
コード例 #6
0
 private void executeTestCase028() {
   try {
     boolean movenode = dbxmlutil.moveNode("ipnet.netmap", "All", "WebNMS-Panels");
     if (movenode) {
       System.out.println("CATS-JCF-API-DXU-028   ---> PASSED");
     } else {
       System.out.println("CATS-JCF-API-DXU-028   ---> FAILED");
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
コード例 #7
0
 private void executeTestCase001() {
   try {
     Vector v = dbxmlutil.getAllNodeID("root", "Events");
     if (v != null) {
       System.out.println("CATS-JCF-API-DXU-001   ---> PASSED");
     } else {
       System.out.println("CATS-JCF-API-DXU-001   ---> FAILED");
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
コード例 #8
0
  private void executeTestCase075() {
    try {
      String rootnode = dbxmlutil.getRootNodeID("root", null);

      if (rootnode.equals("AdventNet")) {
        System.out.println("CATS-JCF-API-DXU-075   ---> PASSED");
      } else {
        System.out.println("CATS-JCF-API-DXU-075   ---> FAILED");
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #9
0
 private void executeTestCase124() {
   try {
     Hashtable hash = dbxmlutil.getAllPanelAttribute(null);
     int s = (int) hash.size();
     if (s == 0) {
       System.out.println("CATS-JCF-API-DXU-124   ---> PASSED");
     } else {
       System.out.println("CATS-JCF-API-DXU-124   ---> FAILED");
     }
   } catch (Exception e) {
     // e.printStackTrace();
   }
 }
コード例 #10
0
  private void executeTestCase109() {
    try {
      boolean root109 = dbxmlutil.isRootNodeExist("root", "SHIVA");

      if (root109) {
        System.out.println("CATS-JCF-API-DXU-109   ---> FAILED");
      } else {
        System.out.println("CATS-JCF-API-DXU-109   ---> PASSED");
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #11
0
 private void executeTestCase122() {
   try {
     Hashtable hash = dbxmlutil.getAllPanelAttribute("root");
     System.out.println("The all panel attributes are     = " + hash);
     if (hash != null) {
       System.out.println("CATS-JCF-API-DXU-122   ---> PASSED");
     } else {
       System.out.println("CATS-JCF-API-DXU-122   ---> FAILED");
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
コード例 #12
0
 private void executeTestCase108() {
   try {
     boolean root = dbxmlutil.isRootNodeExist("root", "Maps");
     // System.out.println("Root Node     = " +root);
     if (root) {
       System.out.println("CATS-JCF-API-DXU-108   ---> PASSED");
     } else {
       System.out.println("CATS-JCF-API-DXU-108   ---> FAILED");
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
コード例 #13
0
  private void executeTestCase087() {
    try {
      boolean add1 = dbxmlutil.removeNode("Fault", "root", "Default", true);

      if (add1) {
        System.out.println("CATS-JCF-API-DXU-086   ---> PASSED");
      } else {
        System.out.println("CATS-JCF-API-DXU-086   ---> FAILED");
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #14
0
  private void executeTestCase116() {
    try {
      String last = dbxmlutil.getLastChild("root", "shivaprakash");

      if (last == "START") {

        System.out.println("CATS-JCF-API-DXU-116   ---> PASSED");
      } else {
        System.out.println("CATS-JCF-API-DXU-116   ---> FAILED");
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #15
0
  private void executeTestCase085() {
    try {
      Properties viewProperties = new Properties();
      viewProperties.put("ICON-FILE", "images/AdventNet.jpg");
      viewProperties.put("TREE-NAME", "MKG");
      viewProperties.put("ID", "Map_Val22");
      // viewProperties.put("PARENT","Fault");
      Properties panelProperties = new Properties();
      // panelProperties.put("PARENT","Fault");

      boolean add1 =
          dbxmlutil.modifyNode("Map_Val22", "All", "Default", viewProperties, panelProperties);

      if (add1) {
        System.out.println("CATS-JCF-API-DXU-085   ---> PASSED");
      } else {
        System.out.println("CATS-JCF-API-DXU-085   ---> FAILED");
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #16
0
  private void executeTestCase084() {
    try {
      Properties viewProperties = new Properties();
      viewProperties.put("ICON-FILE", "images/tick.png");
      viewProperties.put("TREE-NAME", "MKG");
      viewProperties.put("ID", "Maps_Val22");
      viewProperties.put("PARENT", "Maps");
      Properties panelProperties = new Properties();
      panelProperties.put("PARENT", "Maps");

      boolean add1 =
          dbxmlutil.addNode(
              "Maps_Val22", "LEVEL-1", "All", "Maps", "Default", viewProperties, panelProperties);

      if (add1) {
        System.out.println("CATS-JCF-API-DXU-084   ---> PASSED");
      } else {
        System.out.println("CATS-JCF-API-DXU-084   ---> FAILED");
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #17
0
  private void startProcess(String WebNmsHome, String Database) {

    // Connection con=null;

    String webnmshome = WebNmsHome + File.separator;
    System.out.println("WEBNMS HOME... :  " + webnmshome);
    PureUtils.rootDir = webnmshome;
    PureUtils.usersDir = webnmshome;
    String db1 = Database.toUpperCase();
    System.out.println("DATA BASE..... :  " + db1);
    System.out.println();

    try {
      if (db1.equals("MYSQL")) {
        con = getMYSQLConnection();
      } else if (db1.equals("ORACLE")) {
        con = getORACLEConnection();
      } else if (db1.equals("TIMESTEN")) {
        con = getTIMESTENConnection();
      } else if (db1.equals("SOLID")) {
        con = getSOLIDConnection();
      } else if (db1.equals("SYBASE")) {
        con = getSYBASEConnection();
      } else {
        System.out.println("DATABASE NOT SELECTED");
        System.exit(0);
      }

      // sunilg
      dbxmlutil = DBXmlUtility.getInstance(con);
      String parseFileName = PureUtils.rootDir + "conf" + "/" + "database_params.conf";
      File parseFile = new File(parseFileName);
      DBParamsParser parse =
          DBParamsParser.getInstance(
              parseFile); // Database related details are read to create a DB connection.
      String url = parse.getURL();
      String user = parse.getUserName();
      String driver = parse.getDriverName();
      String passwd = parse.getPassword();
      RelationalAPI relapi = new RelationalAPI(url, user, passwd, driver, false);
      RelationalUtil.init(relapi);
    } catch (Exception e) {
      // return new OperationResult(userName,"Failed", "Failed", e.toString());
      e.printStackTrace();
    }
    try {
      // CustomViewUtilities for all are created to register in DBXmlUtility to get update for CV
      // related tables.
      AlertCustomViewUtility acvu = new AlertCustomViewUtility(con);
      EventCustomViewUtility ecvu = new EventCustomViewUtility(con);
      TopoCustomViewUtility tcvu = new TopoCustomViewUtility(con);
      AuditCustomViewUtility aucvu = new AuditCustomViewUtility(con);
      PerfCustomViewUtility pcvu = new PerfCustomViewUtility(con);
      JdbcAPI jdbc = (JdbcAPI) JdbcAPIImpl.getAPI();

      PureServerUtils.getDatabaseParams();

      acvu.setJDBCAPI(jdbc);
      ecvu.setJDBCAPI(jdbc);
      tcvu.setJDBCAPI(jdbc);
      pcvu.setJDBCAPI(jdbc);
      aucvu.setJDBCAPI(jdbc);

      SeverityFEAPIImpl sevAPI = (SeverityFEAPIImpl) SeverityFEAPIImpl.getAPI();
      acvu.setSeverityAPI(sevAPI);
      ecvu.setSeverityAPI(sevAPI);
      tcvu.setSeverityAPI(sevAPI);
      pcvu.setSeverityAPI(sevAPI);
      aucvu.setSeverityAPI(sevAPI);

      // Register to update Custonview related table when DB is updated
      dbxmlutil.registerObjectForTable("Alerts", acvu);
      dbxmlutil.registerObjectForTable("Events", ecvu);
      dbxmlutil.registerObjectForTable("Network Database", tcvu);
      dbxmlutil.registerObjectForTable("Audit", aucvu);
      dbxmlutil.registerObjectForTable("Stats Admin", pcvu);

    } catch (Exception e) {
      System.out.println("unable to instantiate DBXmlUtility");
      e.printStackTrace();
      System.exit(0);
    }

    /* try
    {

    //String sr = dbxmlutil.getPreviousNode("root","Alerts");
    String sr = dbxmlutil.getPreviousNodeForNodeIndex("root","Fault",2);
    System.out.println("The previous node is ... "+sr);
    }
    catch(Exception e)
    {
    e.printStackTrace();
    }   */
    // sunil
    /*executeTestCase004();
    executeTestCase028();
    executeTestCase029();
    executeTestCase034();
    executeTestCase075();*/

    // executeTestCase084();
    // executeTestCase085();
    // executeTestCase086();
    // executeTestCase087();
    executeTestCase108();
    executeTestCase122();
    // sunil

    // System.out.println(" DBXmlUpdate object is successfully created");
    /*executeTestCase025();

          	executeTestCase001();
    executeTestCase002();
    executeTestCase012();
           executeTestCase026();
    executeTestCase029_1();
    executeTestCase075();
    executeTestCase109();
    executeTestCase116();

    executeTestCase123();
    executeTestCase124();
    System.out.println();*/
    System.exit(0);
  }