@Test
public void testApplyAclToEvent() throws Exception {

  // post nothing
  given().expect().statusCode(HttpStatus.SC_BAD_REQUEST).when().post(rt.host("notExists/access"));
  // invalid acl format
  given().formParam("acl", "INVALID").expect().statusCode(HttpStatus.SC_BAD_REQUEST).when()
          .post(rt.host("asdasd/access"));
  // post an acl update
  String acl = "{\"acl\":{\"ace\":[{\"allow\":true,\"role\":\"ROLE_ADMIN\",\"action\":\"read\"},{\"allow\":true,\"role\":\"ROLE_ADMIN\",\"action\":\"write\"}]}}";
  given().formParam("acl", acl).expect().statusCode(HttpStatus.SC_OK).when().post(rt.host("asdasd/access"));
  // post an acl update for an scheduled event
  given().formParam("acl", acl).expect().statusCode(HttpStatus.SC_OK).when().post(rt.host("asdasd/access"));
  // post an acl update for an archived event
  given().formParam("acl", acl).expect().statusCode(HttpStatus.SC_OK).when().post(rt.host("archivedid/access"));
  // post an acl update for an workflow event - conflict
  given().formParam("acl", acl).expect().statusCode(HttpStatus.SC_CONFLICT).when()
          .post(rt.host("workflowid/access"));
}