User
user.addmedia: 向用户添加媒体
user.create: 创建新用户
user.delete: 删除用户
user.deletemedia: 从用户中删除媒体
user.get: 检索用户
user.isreadable: 检查用户是否是可读的
user.iswritable: 检查用户是否是可写的
user.login: 用户登录
user.logout: 用户登出
user.update: 更新用户
user.updatemedia: 更新用户媒体
user.updateprofile: 更新当前登录的用户
UserTest
package cn.com.yeexun.testzabbix.zabbix4j.example.user;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import org.junit.Test;
import com.zabbix4j.ZabbixApiException;
import com.zabbix4j.user.User;
import com.zabbix4j.user.UserLoginRequest;
import com.zabbix4j.user.UserLoginResponse;
/**
* Created by Suguru Yajima on 2014/04/26.
*/
public class UserTest {
public UserTest() {
}
@Test
public void testLogin1() {
User user = new User("http://192.168.200.10/zabbix/api_jsonrpc.php");
UserLoginRequest request = new UserLoginRequest();
request.getParams().setUser("admin");
request.getParams().setPassword("zabbix");
try {
UserLoginResponse response = user.login(request);
assertNotNull(response);
assertNotNull(response.getResult());
} catch (ZabbixApiException e) {
fail();
}
}
}