@Test
public void testupdateSecurityRules() {

	
	createDefaultCategory();
    RESTResource res = new RESTResource();
    res.setCategory(new RESTCategory(DEFAULTCATEGORYNAME));
    String timeid = Long.toString(System.currentTimeMillis());
    res.setName("rest_test_resource_" + timeid);
    Long userId = createUser("u1_" + timeid, Role.USER, "---");
    
    UserGroup g1 = new UserGroup();
    g1.setGroupName("g1_"  + timeid);
    Long groupId = adminClient.insertUserGroup(g1);
    
    
    Long id = client.insert(res);
    List<SecurityRule> ruleList = new ArrayList<SecurityRule>();
    
    SecurityRule rule = new SecurityRule();
    rule.setCanRead(true);
    rule.setCanWrite(true);   
    User user = new User();
    user.setId(userId);
    rule.setUser(user);
    ruleList.add(rule);
    
    rule = new SecurityRule();
    rule.setCanRead(true);
    rule.setCanWrite(false); 
    UserGroup group = new UserGroup();
    group.setId(groupId);
    rule.setGroup(group);
    ruleList.add(rule);
    
    SecurityRuleList rules = new SecurityRuleList(ruleList);
    client.updateSecurityRules(id, rules);
    
    SecurityRuleList writtenRules = client.getSecurityRules(id);
    assertNotNull(writtenRules.getList());
    assertEquals(2, rules.getList().size());
}