Example #1
0
 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>();
 }
Example #2
0
 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;
 }