예제 #1
0
 private Connection getSYBASEConnection() {
   try {
     Class.forName("com.sybase.jdbc2.jdbc.SybDriver");
     return DriverManager.getConnection("jdbc:sybase:Tds:fe-test:2048/feDB", "sa", null);
   } catch (Exception e) {
     e.printStackTrace();
     return null;
   }
 }
예제 #2
0
 private Connection getSOLIDConnection() {
   try {
     Class.forName("solid.jdbc.SolidDriver");
     return DriverManager.getConnection("jdbc:solid://nms-clienttest1:1313/dba/dba", "dba", "dba");
   } catch (Exception e) {
     e.printStackTrace();
     return null;
   }
 }
예제 #3
0
 private Connection getTIMESTENConnection() {
   try {
     Class.forName("com.timesten.jdbc.TimesTenDriver");
     return DriverManager.getConnection("jdbc:timesten:direct:WebNmsDB", "root", null);
   } catch (Exception e) {
     e.printStackTrace();
     return null;
   }
 }
예제 #4
0
 private Connection getMYSQLConnection() {
   try {
     Class.forName("org.gjt.mm.mysql.Driver");
     return DriverManager.getConnection("jdbc:mysql://localhost/WebNmsDB", "root", null);
   } catch (Exception e) {
     e.printStackTrace();
     return null;
   }
 }
예제 #5
0
  private void executeTestCase034() {
    try {
      System.out.println(
          "Properties "
              + dbxmlutil.getNodeAttributes("Network Database", "root", "Network Database"));

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
예제 #6
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();
    }
  }
예제 #7
0
  private Connection getORACLEConnection() {
    try {

      Class.forName("oracle.jdbc.driver.OracleDriver");
      return DriverManager.getConnection(
          "jdbc:oracle:thin:@kernel-win:1521:oracle", "BFW3", "BFW3");
    } catch (Exception e) {
      e.printStackTrace();
      return null;
    }
  }
예제 #8
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();
   }
 }
예제 #9
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();
   }
 }
예제 #10
0
 private void executeTestCase123() {
   try {
     Hashtable hash = dbxmlutil.getAllPanelAttribute("SHIVA");
     int s = (int) hash.size();
     if (s == 0) {
       System.out.println("CATS-JCF-API-DXU-123   ---> PASSED");
     } else {
       System.out.println("CATS-JCF-API-DXU-123   ---> FAILED");
     }
   } 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 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();
    }
  }
예제 #13
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();
    }
  }
예제 #14
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();
   }
 }
예제 #15
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();
    }
  }
예제 #16
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();
    }
  }
예제 #17
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();
    }
  }
예제 #18
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();
    }
  }
예제 #19
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);
  }