Program: 63371
Project: 63371
Buggy source:
@Test public void testBasics() throws JsonProcessingException, SchedulerException {
  Sid adminSid=accessService.getSid("String_Node_Str",true);
  Assert.assertNotNull(adminSid);
  Assert.assertNotNull(AclPermissionFactory.getPermissions());
  AclEntity ae=new MockAclEntity("String_Node_Str");
  accessService.clean(ae,true);
  Acl acl=accessService.getAcl(ae);
  Assert.assertNull(acl);
  acl=accessService.init(ae,AclPermission.ADMINISTRATION);
  Assert.assertTrue(((PrincipalSid)acl.getOwner()).getPrincipal().equals("String_Node_Str"));
  Assert.assertTrue(accessService.generateAceResponses(acl).size() == 1);
  AccessEntryResponse aer=accessService.generateAceResponses(acl).get(0);
  Assert.assertTrue(aer.getId() != null);
  Assert.assertTrue(aer.getPermission() == AclPermission.ADMINISTRATION);
  Assert.assertTrue(((PrincipalSid)aer.getSid()).getPrincipal().equals("String_Node_Str"));
  Sid modeler=accessService.getSid("String_Node_Str",true);
  acl=accessService.grant(ae,AclPermission.ADMINISTRATION,modeler);
  Assert.assertTrue(accessService.generateAceResponses(acl).size() == 2);
  Long modelerEntryId=null;
  for (  AccessControlEntry ace : acl.getEntries()) {
    PrincipalSid sid=(PrincipalSid)ace.getSid();
    if (sid.getPrincipal().equals("String_Node_Str")) {
      modelerEntryId=(Long)ace.getId();
      Assert.assertTrue(ace.getPermission() == AclPermission.ADMINISTRATION);
    }
  }
  acl=accessService.update(ae,modelerEntryId,AclPermission.READ);
  Assert.assertTrue(accessService.generateAceResponses(acl).size() == 2);
  for (  AccessControlEntry ace : acl.getEntries()) {
    PrincipalSid sid=(PrincipalSid)ace.getSid();
    if (sid.getPrincipal().equals("String_Node_Str")) {
      modelerEntryId=(Long)ace.getId();
      Assert.assertTrue(ace.getPermission() == AclPermission.READ);
    }
  }
  AclEntity attachedEntity=new MockAclEntity("String_Node_Str");
  accessService.clean(attachedEntity,true);
  Acl attachedEntityAcl=accessService.getAcl(attachedEntity);
  Assert.assertNull(attachedEntityAcl);
  attachedEntityAcl=accessService.init(attachedEntity,AclPermission.ADMINISTRATION);
  accessService.inherit(attachedEntity,ae);
  attachedEntityAcl=accessService.getAcl(attachedEntity);
  Assert.assertTrue(attachedEntityAcl.getParentAcl() != null);
  Assert.assertTrue(attachedEntityAcl.getParentAcl().getObjectIdentity().getIdentifier().equals("String_Node_Str"));
  Assert.assertTrue(attachedEntityAcl.getEntries().size() == 1);
  acl=accessService.revoke(ae,modelerEntryId);
  Assert.assertTrue(accessService.generateAceResponses(acl).size() == 1);
  accessService.clean(ae,true);
  acl=accessService.getAcl(ae);
  Assert.assertNull(acl);
  attachedEntityAcl=accessService.getAcl(attachedEntity);
  Assert.assertNull(attachedEntityAcl);
}

Fixed version (ground truth):
@Test public void testBasics() throws JsonProcessingException, SchedulerException {
  Sid adminSid=accessService.getSid("String_Node_Str",true);
  Assert.assertNotNull(adminSid);
  Assert.assertNotNull(AclPermissionFactory.getPermissions());
  AclEntity ae=new MockAclEntity("String_Node_Str");
  accessService.clean(ae,true);
  AclEntity attachedEntity=new MockAclEntity("String_Node_Str");
  accessService.clean(attachedEntity,true);
  Acl acl=accessService.getAcl(ae);
  Assert.assertNull(acl);
  acl=accessService.init(ae,AclPermission.ADMINISTRATION);
  Assert.assertTrue(((PrincipalSid)acl.getOwner()).getPrincipal().equals("String_Node_Str"));
  Assert.assertTrue(accessService.generateAceResponses(acl).size() == 1);
  AccessEntryResponse aer=accessService.generateAceResponses(acl).get(0);
  Assert.assertTrue(aer.getId() != null);
  Assert.assertTrue(aer.getPermission() == AclPermission.ADMINISTRATION);
  Assert.assertTrue(((PrincipalSid)aer.getSid()).getPrincipal().equals("String_Node_Str"));
  Sid modeler=accessService.getSid("String_Node_Str",true);
  acl=accessService.grant(ae,AclPermission.ADMINISTRATION,modeler);
  Assert.assertTrue(accessService.generateAceResponses(acl).size() == 2);
  Long modelerEntryId=null;
  for (  AccessControlEntry ace : acl.getEntries()) {
    PrincipalSid sid=(PrincipalSid)ace.getSid();
    if (sid.getPrincipal().equals("String_Node_Str")) {
      modelerEntryId=(Long)ace.getId();
      Assert.assertTrue(ace.getPermission() == AclPermission.ADMINISTRATION);
    }
  }
  acl=accessService.update(ae,modelerEntryId,AclPermission.READ);
  Assert.assertTrue(accessService.generateAceResponses(acl).size() == 2);
  for (  AccessControlEntry ace : acl.getEntries()) {
    PrincipalSid sid=(PrincipalSid)ace.getSid();
    if (sid.getPrincipal().equals("String_Node_Str")) {
      modelerEntryId=(Long)ace.getId();
      Assert.assertTrue(ace.getPermission() == AclPermission.READ);
    }
  }
  accessService.clean(attachedEntity,true);
  Acl attachedEntityAcl=accessService.getAcl(attachedEntity);
  Assert.assertNull(attachedEntityAcl);
  attachedEntityAcl=accessService.init(attachedEntity,AclPermission.ADMINISTRATION);
  accessService.inherit(attachedEntity,ae);
  attachedEntityAcl=accessService.getAcl(attachedEntity);
  Assert.assertTrue(attachedEntityAcl.getParentAcl() != null);
  Assert.assertTrue(attachedEntityAcl.getParentAcl().getObjectIdentity().getIdentifier().equals("String_Node_Str"));
  Assert.assertTrue(attachedEntityAcl.getEntries().size() == 1);
  acl=accessService.revoke(ae,modelerEntryId);
  Assert.assertTrue(accessService.generateAceResponses(acl).size() == 1);
  accessService.clean(ae,true);
  acl=accessService.getAcl(ae);
  Assert.assertNull(acl);
  attachedEntityAcl=accessService.getAcl(attachedEntity);
  Assert.assertNull(attachedEntityAcl);
}