EasemobIMUsers { public static ObjectNode createNewIMUserBatchGen(String usernamePrefix, Long perNumber, Long totalNumber) { ObjectNode objectNode = factory.objectNode(); if (totalNumber == 0 || perNumber == 0) { return objectNode; } System.out.println("你即将注册" + totalNumber + "个用户，如果大于" + perNumber + "了,会分批注册,每次注册" + perNumber + "个"); ArrayNode genericArrayNode = EasemobIMUsers.genericArrayNode( usernamePrefix, totalNumber); if (totalNumber <= perNumber) { objectNode = EasemobIMUsers.createNewIMUserBatch(genericArrayNode); } else { for (int i = 0; i < genericArrayNode.size(); i++) { ArrayNode tmpArrayNode = factory.arrayNode(); tmpArrayNode.add(genericArrayNode.get(i)); if ((i + 1) % perNumber == 0) { objectNode = EasemobIMUsers .createNewIMUserBatch(genericArrayNode); tmpArrayNode.removeAll(); continue; } if (i > (genericArrayNode.size() / perNumber * perNumber - 1)) { objectNode = EasemobIMUsers .createNewIMUserBatch(genericArrayNode); tmpArrayNode.removeAll(); } } } 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 testCreateNewIMUserBatchGen() throws Exception { String usernamePrefix = "test_user_xx"; Long perNumber = 10L; Long totalNumber = 3L; ObjectNode createNewIMUserBatchGenNode = EasemobIMUsers.createNewIMUserBatchGen(usernamePrefix, perNumber, totalNumber); if (null != createNewIMUserBatchGenNode) { LOGGER.info("注册IM用户[批量]: " + createNewIMUserBatchGenNode.toString()); } }