Program: 5917
Project: 5917
Buggy source:
@Test public void test() throws Exception {
  authorizationBootstrapper.run();
  Tasks.waitFor(true,new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      Predicate<EntityId> systemUserFilter=authorizationEnforcementService.createFilter(systemUser);
      return systemUserFilter.apply(instanceId) && systemUserFilter.apply(NamespaceId.SYSTEM);
    }
  }
,10,TimeUnit.SECONDS);
  txManager.startAndWait();
  datasetService.startAndWait();
  waitForService(Constants.Service.DATASET_MANAGER);
  defaultNamespaceEnsurer.startAndWait();
  systemArtifactLoader.startAndWait();
  waitForService(defaultNamespaceEnsurer);
  waitForService(systemArtifactLoader);
  Tasks.waitFor(true,new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      try {
        return namespaceQueryAdmin.exists(NamespaceId.DEFAULT.toId());
      }
 catch (      Exception e) {
        return false;
      }
    }
  }
,10,TimeUnit.SECONDS);
  Assert.assertTrue(defaultNamespaceEnsurer.isRunning());
  Tasks.waitFor(true,new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      try {
        artifactRepository.getArtifact(SYSTEM_ARTIFACT.toId());
        return true;
      }
 catch (      Exception e) {
        return false;
      }
    }
  }
,20,TimeUnit.SECONDS);
  Assert.assertTrue(systemArtifactLoader.isRunning());
  Dataset systemDataset=DatasetsUtil.getOrCreateDataset(dsFramework,NamespaceId.SYSTEM.dataset("String_Node_Str").toId(),Table.class.getName(),DatasetProperties.EMPTY,Collections.<String,String>emptyMap(),this.getClass().getClassLoader());
  Assert.assertNotNull(systemDataset);
  SecurityRequestContext.setUserId("String_Node_Str");
  namespaceAdmin.create(new NamespaceMeta.Builder().setName("String_Node_Str").build());
  SecurityRequestContext.setUserId("String_Node_Str");
  try {
    namespaceAdmin.create(new NamespaceMeta.Builder().setName("String_Node_Str").build());
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException expected) {
  }
}

Fixed version (ground truth):
@Test public void test() throws Exception {
  authorizationBootstrapper.run();
  final Principal systemUser=new Principal(UserGroupInformation.getCurrentUser().getShortUserName(),Principal.PrincipalType.USER);
  Tasks.waitFor(true,new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      Predicate<EntityId> systemUserFilter=authorizationEnforcementService.createFilter(systemUser);
      return systemUserFilter.apply(instanceId) && systemUserFilter.apply(NamespaceId.SYSTEM);
    }
  }
,10,TimeUnit.SECONDS);
  txManager.startAndWait();
  datasetService.startAndWait();
  waitForService(Constants.Service.DATASET_MANAGER);
  defaultNamespaceEnsurer.startAndWait();
  systemArtifactLoader.startAndWait();
  waitForService(defaultNamespaceEnsurer);
  waitForService(systemArtifactLoader);
  Tasks.waitFor(true,new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      try {
        return namespaceQueryAdmin.exists(NamespaceId.DEFAULT.toId());
      }
 catch (      Exception e) {
        return false;
      }
    }
  }
,10,TimeUnit.SECONDS);
  Assert.assertTrue(defaultNamespaceEnsurer.isRunning());
  Tasks.waitFor(true,new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      try {
        artifactRepository.getArtifact(SYSTEM_ARTIFACT.toId());
        return true;
      }
 catch (      Exception e) {
        return false;
      }
    }
  }
,20,TimeUnit.SECONDS);
  Assert.assertTrue(systemArtifactLoader.isRunning());
  Dataset systemDataset=DatasetsUtil.getOrCreateDataset(dsFramework,NamespaceId.SYSTEM.dataset("String_Node_Str").toId(),Table.class.getName(),DatasetProperties.EMPTY,Collections.<String,String>emptyMap(),this.getClass().getClassLoader());
  Assert.assertNotNull(systemDataset);
  SecurityRequestContext.setUserId("String_Node_Str");
  namespaceAdmin.create(new NamespaceMeta.Builder().setName("String_Node_Str").build());
  SecurityRequestContext.setUserId("String_Node_Str");
  try {
    namespaceAdmin.create(new NamespaceMeta.Builder().setName("String_Node_Str").build());
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException expected) {
  }
}