コード例 #1
0
ファイル: NetworkTestCase.java プロジェクト: goby/oce
 public NetworkTestCase(
     int id,
     int userId,
     int stage,
     int networkId,
     String networkName,
     int infoId,
     String joinTime,
     int status) {
   _info = new Network();
   _info.setId(id);
   _info.setUserId(userId);
   _info.setStage(stage);
   _info.setNetworkId(networkId);
   _info.setNetworkName(networkName);
   _info.setInfoId(infoId);
   _info.setJoinTime(DateFormatter.parse(joinTime));
   _info.setStatus(status);
   _infos = new ArrayList<Network>();
 }
コード例 #2
0
ファイル: NetworkTestCase.java プロジェクト: goby/oce
 protected List<Network> readDB(String sql) {
   List<Network> result = new ArrayList<Network>();
   try {
     Connection c = XceAdapter.getInstance().getReadConnection("common");
     try {
       Statement s = c.createStatement();
       try {
         ResultSet rs = s.executeQuery(sql);
         while (rs.next()) {
           Network info = new Network();
           info.setId(rs.getInt("id"));
           info.setUserId(rs.getInt("userid"));
           info.setStage(rs.getInt("stage"));
           info.setNetworkId(rs.getInt("network_id"));
           info.setNetworkName(rs.getString("network_name"));
           info.setInfoId(rs.getInt("info_id"));
           info.setJoinTime(DateFormatter.parse(rs.getString("join_time")));
           info.setStatus(rs.getInt("status"));
           result.add(info);
         }
         rs.close();
       } catch (Exception e) {
         e.printStackTrace();
         Assert.assertFalse(true);
       } finally {
         s.close();
       }
     } catch (Exception e) {
       e.printStackTrace();
       Assert.assertFalse(true);
     } finally {
       c.close();
     }
   } catch (Exception e) {
     e.printStackTrace();
     Assert.assertFalse(true);
   }
   return result;
 }
コード例 #3
0
ファイル: NetworkTestCase.java プロジェクト: goby/oce
 protected void setDBAndInfos(int recordId, Network info) {
   String sql =
       "replace into network_history(id,userid,stage,network_id,network_name,info_id,join_time,status) values ("
           + recordId
           + ","
           + info.getUserId()
           + ","
           + info.getStage()
           + ","
           + info.getNetworkId()
           + ",'"
           + info.getNetworkName()
           + "',"
           + info.getInfoId()
           + ",'"
           + DateFormatter.format(info.getJoinTime())
           + "',"
           + info.getStatus()
           + ")";
   writeDB(sql);
   _infos.add(info);
 }