EasemobIMUsers { public static ObjectNode imUserLogin(String ownerUserPrimaryKey, String password) { 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(password)) { LOGGER.error("Your password must be provided，the value is username or uuid of imuser."); objectNode.put("message", "Your password must be provided，the value is username or uuid of imuser."); return objectNode; } try { ObjectNode dataNode = factory.objectNode(); dataNode.put("grant_type", "password"); dataNode.put("username", ownerUserPrimaryKey); dataNode.put("password", password); List<NameValuePair> headers = new ArrayList<NameValuePair>(); headers.add(new BasicNameValuePair("Content-Type", "application/json")); objectNode = JerseyUtils.sendRequest(EndPoints.TOKEN_APP_TARGET .resolveTemplate("org_name", APPKEY.split("#")[0]) .resolveTemplate("app_name", APPKEY.split("#")[1]), dataNode, null, HTTPMethod.METHOD_POST, headers); } catch (Exception e) { throw new RuntimeException( "Some errors ocuured while fetching a token by usename and passowrd ."); } 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 testImUserLogin() throws Exception { ObjectNode imUserLoginNode = EasemobIMUsers.imUserLogin("101", "1"); if (null != imUserLoginNode) { LOGGER.info("IM用户登录: " + imUserLoginNode.toString()); } }