/** * 获取一份新的数据 * * @param idStep * @return */ protected Network genInfoCopy(int idStep) { Network result = new Network(); result.setId(_info.getId() + idStep); result.setUserId(_info.getUserId()); result.setStage(_info.getStage()); result.setNetworkId(_info.getNetworkId() + idStep); result.setNetworkName(_info.getNetworkName() + ".new"); result.setInfoId(_info.getInfoId()); result.setJoinTime(_info.getJoinTime()); result.setStatus(_info.getStatus() + idStep); return result; }
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>(); }
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; }