Пример #1
0
 /**
  * Must be executed as part of a test suite that opens the database connection.
  *
  * @throws Exception Flow network error.
  */
 @Override
 protected void define() throws Exception {
   /**
    * String userHome = System.getProperty("user.home"); StringBuilder sb = new StringBuilder();
    * String[] subStr = userHome.split("\\Q\\\\E"); for (String subStr1 : subStr) {
    * sb.append(subStr1); sb.append("/"); } sb.append(".fbpTest/db"); String dbName =
    * sb.toString(); String connectionURL = "jdbc:derby:" + dbName + ";create=true";
    * System.out.println("Insert Test '" + connectionURL + "'");
    * SingletonDbWrapper.instance().setConnectionUrl(connectionURL);
    *
    * <p>conn = SingletonDbWrapper.instance().getConnection();
    */
   Enumeration<Driver> dList = DriverManager.getDrivers();
   while (dList.hasMoreElements()) {
     Driver aDriver = dList.nextElement();
     System.out.println(aDriver.toString());
   }
   tableStruct();
   component("DbInsert", Insert.class);
   component("Output", Output.class);
   connect(
       component("DbInsert"), port(Insert.OP),
       component("Output"), port("IN"));
   //  connect("DbInsert.COMPLETION_STATUS", "Output.IN");
   String insertStmt = "INSERT INTO TEST_ONE (TEXT_STRING, INT_VALUE)" + " VALUES (?, ?)";
   Map<String, Object> params = new HashMap();
   params.put(RDB_CONNECTION, conn);
   params.put(SQL_INSERT_STATEMENT_KEY, insertStmt);
   params.put(Integer.toString(0), "String");
   params.put(Integer.toString(1), "Integer");
   initialize(params, component("DbInsert"), port(Insert.IIP));
   String[] recd01 = {"First Value", "12"};
   initialize(recd01, component("DbInsert"), port(Insert.IP));
 }
Пример #2
0
 private boolean isExpectedDriver(Driver driver, String className) {
   String actual;
   if (driver instanceof WrappedDriver) actual = driver.toString();
   else actual = driver.getClass().getName();
   return isExpectedDriverClass(actual, className);
 }