Program: 4747
Project: 4747
Buggy source:
@Test public void testScheduleAuth() throws Exception {
  createAuthNamespace();
  Map<EntityId,Set<Action>> neededPrivileges=ImmutableMap.<EntityId,Set<Action>>builder().put(AUTH_NAMESPACE.app(AppWithSchedule.class.getSimpleName()),EnumSet.of(Action.ADMIN)).put(AUTH_NAMESPACE.artifact(AppWithSchedule.class.getSimpleName(),"String_Node_Str"),EnumSet.of(Action.ADMIN)).put(AUTH_NAMESPACE.dataset(AppWithSchedule.INPUT_NAME),EnumSet.of(Action.ADMIN)).put(AUTH_NAMESPACE.dataset(AppWithSchedule.OUTPUT_NAME),EnumSet.of(Action.ADMIN)).put(AUTH_NAMESPACE.datasetType(ObjectStore.class.getName()),EnumSet.of(Action.ADMIN)).build();
  setUpPrivilegeAndRegisterForDeletion(ALICE,neededPrivileges);
  ApplicationManager appManager=deployApplication(AUTH_NAMESPACE,AppWithSchedule.class);
  ProgramId workflowID=new ProgramId(AUTH_NAMESPACE.getNamespace(),AppWithSchedule.class.getSimpleName(),ProgramType.WORKFLOW,AppWithSchedule.SampleWorkflow.class.getSimpleName());
  cleanUpEntities.add(workflowID);
  final WorkflowManager workflowManager=appManager.getWorkflowManager(AppWithSchedule.SampleWorkflow.class.getSimpleName());
  ScheduleManager scheduleManager=workflowManager.getSchedule(AppWithSchedule.EVERY_HOUR_SCHEDULE);
  SecurityRequestContext.setUserId(BOB.getName());
  try {
    scheduleManager.resume();
    Assert.fail("String_Node_Str");
  }
 catch (  Exception e) {
    Assert.assertTrue(e.getCause() instanceof UnauthorizedException);
  }
  try {
    scheduleManager.status(HttpURLConnection.HTTP_FORBIDDEN);
    Assert.fail("String_Node_Str");
  }
 catch (  Exception e) {
    Assert.assertTrue(e.getCause() instanceof UnauthorizedException);
  }
  SecurityRequestContext.setUserId(ALICE.getName());
  grantAndAssertSuccess(workflowID,BOB,EnumSet.of(Action.READ));
  SecurityRequestContext.setUserId(BOB.getName());
  try {
    scheduleManager.resume();
    Assert.fail("String_Node_Str");
  }
 catch (  Exception e) {
    Assert.assertTrue(e.getCause() instanceof UnauthorizedException);
  }
  Assert.assertEquals(ProgramScheduleStatus.SUSPENDED.name(),scheduleManager.status(HttpURLConnection.HTTP_OK));
  SecurityRequestContext.setUserId(ALICE.getName());
  grantAndAssertSuccess(workflowID,BOB,EnumSet.of(Action.EXECUTE));
  SecurityRequestContext.setUserId(BOB.getName());
  scheduleManager.resume();
  Assert.assertEquals(ProgramScheduleStatus.SCHEDULED.name(),scheduleManager.status(HttpURLConnection.HTTP_OK));
  scheduleManager.suspend();
  Assert.assertEquals(ProgramScheduleStatus.SUSPENDED.name(),scheduleManager.status(HttpURLConnection.HTTP_OK));
  SecurityRequestContext.setUserId(ALICE.getName());
}

Fixed version (ground truth):
@Test public void testScheduleAuth() throws Exception {
  createAuthNamespace();
  Map<EntityId,Set<Action>> neededPrivileges=ImmutableMap.<EntityId,Set<Action>>builder().put(AUTH_NAMESPACE.app(AppWithSchedule.class.getSimpleName()),EnumSet.of(Action.ADMIN)).put(AUTH_NAMESPACE.artifact(AppWithSchedule.class.getSimpleName(),"String_Node_Str"),EnumSet.of(Action.ADMIN)).put(AUTH_NAMESPACE.dataset(AppWithSchedule.INPUT_NAME),EnumSet.of(Action.ADMIN)).put(AUTH_NAMESPACE.dataset(AppWithSchedule.OUTPUT_NAME),EnumSet.of(Action.ADMIN)).put(AUTH_NAMESPACE.datasetType(ObjectStore.class.getName()),EnumSet.of(Action.ADMIN)).build();
  setUpPrivilegeAndRegisterForDeletion(ALICE,neededPrivileges);
  ApplicationManager appManager=deployApplication(AUTH_NAMESPACE,AppWithSchedule.class);
  ProgramId workflowID=new ProgramId(AUTH_NAMESPACE.getNamespace(),AppWithSchedule.class.getSimpleName(),ProgramType.WORKFLOW,AppWithSchedule.SampleWorkflow.class.getSimpleName());
  cleanUpEntities.add(workflowID);
  final WorkflowManager workflowManager=appManager.getWorkflowManager(AppWithSchedule.SampleWorkflow.class.getSimpleName());
  ScheduleManager scheduleManager=workflowManager.getSchedule(AppWithSchedule.EVERY_HOUR_SCHEDULE);
  SecurityRequestContext.setUserId(BOB.getName());
  try {
    scheduleManager.resume();
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  try {
    scheduleManager.status(HttpURLConnection.HTTP_FORBIDDEN);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  SecurityRequestContext.setUserId(ALICE.getName());
  grantAndAssertSuccess(workflowID,BOB,EnumSet.of(Action.READ));
  SecurityRequestContext.setUserId(BOB.getName());
  try {
    scheduleManager.resume();
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  Assert.assertEquals(ProgramScheduleStatus.SUSPENDED.name(),scheduleManager.status(HttpURLConnection.HTTP_OK));
  SecurityRequestContext.setUserId(ALICE.getName());
  grantAndAssertSuccess(workflowID,BOB,EnumSet.of(Action.EXECUTE));
  SecurityRequestContext.setUserId(BOB.getName());
  scheduleManager.resume();
  Assert.assertEquals(ProgramScheduleStatus.SCHEDULED.name(),scheduleManager.status(HttpURLConnection.HTTP_OK));
  scheduleManager.suspend();
  Assert.assertEquals(ProgramScheduleStatus.SUSPENDED.name(),scheduleManager.status(HttpURLConnection.HTTP_OK));
  SecurityRequestContext.setUserId(ALICE.getName());
}