EasemobIMUsers { public static ObjectNode addFriendSingle(String ownerUserPrimaryKey, String friendUserPrimaryKey) { ObjectNode objectNode = factory.objectNode(); if (!JerseyUtils.match("^(?!-)[0-9a-zA-Z\\-]+#[0-9a-zA-Z]+", APPKEY)) { LOGGER.error("Bad format of Appkey: " + APPKEY); objectNode.put("message", "Bad format of Appkey"); return objectNode; } if (StringUtils.isEmpty(ownerUserPrimaryKey)) { LOGGER.error("Your userPrimaryKey must be provided，the value is username or uuid of imuser."); objectNode .put("message", "Your userPrimaryKey must be provided，the value is username or uuid of imuser."); return objectNode; } if (StringUtils.isEmpty(friendUserPrimaryKey)) { LOGGER.error("The userPrimaryKey of friend must be provided，the value is username or uuid of imuser."); objectNode .put("message", "The userPrimaryKey of friend must be provided，the value is username or uuid of imuser."); return objectNode; } try { JerseyWebTarget webTarget = null; webTarget = EndPoints.USERS_ADDFRIENDS_TARGET .resolveTemplate("org_name", APPKEY.split("#")[0]) .resolveTemplate("app_name", APPKEY.split("#")[1]) .resolveTemplate("ownerUserPrimaryKey", ownerUserPrimaryKey) .resolveTemplate("friendUserPrimaryKey", friendUserPrimaryKey); ObjectNode body = factory.objectNode(); objectNode = JerseyUtils.sendRequest(webTarget, body, credential, HTTPMethod.METHOD_POST, null); } catch (Exception e) { e.printStackTrace(); } return objectNode; }  static ObjectNode createNewIMUserSingle(ObjectNode dataNode); static ObjectNode createNewIMUserBatch(ArrayNode dataArrayNode); static ObjectNode createNewIMUserBatchGen(String usernamePrefix,
			Long perNumber, Long totalNumber); static ObjectNode getIMUsersByPrimaryKey(String userPrimaryKey); static ObjectNode deleteIMUserByUserPrimaryKey(String userPrimaryKey); static ObjectNode deleteIMUserByUsernameBatch(Long limit,
			String queryStr); static ObjectNode modifyIMUserPasswordWithAdminToken(
			String userPrimaryKey, ObjectNode dataObjectNode); static ObjectNode addFriendSingle(String ownerUserPrimaryKey,
			String friendUserPrimaryKey); static ObjectNode deleteFriendSingle(String ownerUserPrimaryKey,
			String friendUserPrimaryKey); static ObjectNode getFriends(String ownerUserPrimaryKey); static ObjectNode imUserLogin(String ownerUserPrimaryKey, String password);  }
@Test public void testAddFriendSingle() throws Exception { String ownerUserPrimaryKey = "101"; String friendUserPrimaryKey = "102"; ObjectNode addFriendSingleNode = EasemobIMUsers.addFriendSingle(ownerUserPrimaryKey, friendUserPrimaryKey); if (null != addFriendSingleNode) { LOGGER.info("添加好友[单个]: " + addFriendSingleNode.toString()); } }