@Test
public void Pohui() throws Exception {
//HttpClient
HttpClient httpClient = createHttpClient();
//login
HttpGet requestLogin = createRequestLogin(usernameManager2, passwordManager2);
HttpResponse resp
int siteId = 21;
String queryStr = String.format("select count(id) FROM schedule WHERE site_id = '%d';", siteId);
DbConnector dbC DbConnector();
ResultSet rs = dbConnector.executeQuery(queryStr);
rs.next();
int countId = rs.getInt("count(id)");
HttpGet getSchedulesRequest =new HttpGet(String.format("%sapi/%s/sites/%d/schedules?max=%d", ipAddress, apiVersion, siteId, countId));
HttpResponse getSchedulesResp
Set<Integer> js HashSet<Integer>();
ObjectMapper mapper = new ObjectMapper();
JsonNode objectRoot = mapper.readTree(getSchedulesResponse.getEntity().getContent());
JsonNode node = objectRoot.findValue("schedules");
Iterator<JsonNode> it = node.elements();
while (it.hasNext()) {
JsonNode scheduleNode = it.next();
jsonIds.add(scheduleNode.findValue("id").asInt());
}
Set<Integer> queryIds = new HashSet<Integer>();
String queryStr2 = String.format("select id FROM schedule WHERE site_id = '%d';", siteId);
ResultSet rs2 = dbConnector.executeQuery(queryStr2);
while(rs2.next()) {
queryIds.add(rs2.getInt("id"));
}
assert(jsonIds.equals(queryIds));
}Add a code snippet to your website: www.paste.org