EasemobChatGroups { public static ObjectNode addUsersToGroupBatch(String toAddBacthChatgroupid, ObjectNode usernames) { 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.isBlank(toAddBacthChatgroupid.trim())) { LOGGER.error("Property that named toAddBacthChatgroupid must be provided ."); objectNode.put("message", "Property that named toAddBacthChatgroupid must be provided ."); return objectNode; } if (null != usernames && !usernames.has("usernames")) { LOGGER.error("Property that named usernames must be provided ."); objectNode.put("message", "Property that named usernames must be provided ."); return objectNode; } try { objectNode = JerseyUtils.sendRequest(EndPoints.CHATGROUPS_TARGET.path(toAddBacthChatgroupid).path("users"), usernames, credential, HTTPMethod.METHOD_POST, null); } catch (Exception e) { e.printStackTrace(); } return objectNode; }  static ObjectNode getAllChatgroupids(); static ObjectNode getGroupDetailsByChatgroupid(String[] chatgroupIDs); static ObjectNode createChatGroups(ObjectNode dataObjectNode); static ObjectNode deleteChatGroups(String chatgroupid); static ObjectNode getAllMemberssByGroupId(String chatgroupid); static ObjectNode addUserToGroup(String chatgroupid, String userprimarykey); static ObjectNode deleteUserFromGroup(String chatgroupid, String userprimarykey); static ObjectNode getJoinedChatgroupsForIMUser(String username); static ObjectNode addUsersToGroupBatch(String toAddBacthChatgroupid, ObjectNode usernames);  }
@Test public void testAddUsersToGroupBatch() throws Exception { String toAddBacthChatgroupid = "1405735927133519"; ArrayNode usernames = JsonNodeFactory.instance.arrayNode(); usernames.add("xiaojianguo002"); usernames.add("xiaojianguo003"); ObjectNode usernamesNode = JsonNodeFactory.instance.objectNode(); usernamesNode.put("usernames", usernames); ObjectNode addUserToGroupBatchNode = EasemobChatGroups.addUsersToGroupBatch(toAddBacthChatgroupid, usernamesNode); System.out.println(addUserToGroupBatchNode.toString()); }