Program: 90104
Project: 90104
Buggy source:
public void testProcessMissingRequest() throws Exception {
  Settings.set(ArchiveSettings.DIR_ARCREPOSITORY_BITPRESERVATION,TestInfo.WORKING_DIR.getAbsolutePath());
  Settings.set(ArchiveSettings.DIRS_ARCREPOSITORY_ADMIN,TestInfo.WORKING_DIR.getAbsolutePath());
  AdminData.getUpdateableInstance();
  MockFileBasedActiveBitPreservation mockabp=new MockFileBasedActiveBitPreservation();
  MockHttpServletRequest request=new MockHttpServletRequest();
  String ba1="String_Node_Str";
  String ba2="String_Node_Str";
  String filename1="String_Node_Str";
  String filename2="String_Node_Str";
  Locale defaultLocale=new Locale("String_Node_Str");
  Map<String,String[]> args=new HashMap<String,String[]>();
  args.put(ADD_COMMAND,new String[]{ba1 + Constants.STRING_FILENAME_SEPARATOR + filename1});
  request.setupAddParameter(ADD_COMMAND,new String[]{ba1 + Constants.STRING_FILENAME_SEPARATOR + filename1});
  args.put(GET_INFO_COMMAND,new String[]{filename1});
  request.setupAddParameter(GET_INFO_COMMAND,new String[]{filename1});
  args.put(BITARCHIVE_NAME_PARAM,new String[]{Location.get(ba1).getName()});
  request.setupAddParameter(BITARCHIVE_NAME_PARAM,new String[]{Location.get(ba1).getName()});
  request.setupGetParameterMap(args);
  request.setupGetParameterNames(new Vector(args.keySet()).elements());
  Map<String,FilePreservationState> status=BitpreserveFileState.processMissingRequest(getDummyPageContext(defaultLocale,request),new StringBuilder());
  assertEquals("String_Node_Str",1,mockabp.getCallCount(ADD_METHOD));
  assertEquals("String_Node_Str",1,mockabp.getCallCount(GET_INFO_METHOD));
  assertEquals("String_Node_Str",null,status.get(filename1));
  mockabp.calls.clear();
  request=new MockHttpServletRequest();
  args.clear();
  args.put(BITARCHIVE_NAME_PARAM,new String[]{Location.get(ba1).getName()});
  request.setupAddParameter(BITARCHIVE_NAME_PARAM,new String[]{Location.get(ba1).getName()});
  request.setupGetParameterMap(args);
  status=BitpreserveFileState.processMissingRequest(getDummyPageContext(defaultLocale,request),new StringBuilder());
  assertEquals("String_Node_Str",0,mockabp.getCallCount(ADD_METHOD));
  assertEquals("String_Node_Str",0,mockabp.getCallCount(GET_INFO_METHOD));
  assertEquals("String_Node_Str",0,status.size());
  mockabp.calls.clear();
  request=new MockHttpServletRequest();
  args.clear();
  args.put(BITARCHIVE_NAME_PARAM,new String[]{Location.get(ba2).getName()});
  request.setupAddParameter(BITARCHIVE_NAME_PARAM,new String[]{Location.get(ba2).getName()});
  request.setupAddParameter(ADD_COMMAND,new String[]{ba2 + Constants.STRING_FILENAME_SEPARATOR + filename1,ba2 + Constants.STRING_FILENAME_SEPARATOR + filename1});
  args.put(ADD_COMMAND,new String[]{ba2 + Constants.STRING_FILENAME_SEPARATOR + filename1,ba2 + Constants.STRING_FILENAME_SEPARATOR + filename1});
  request.setupAddParameter(GET_INFO_COMMAND,new String[]{filename1,filename2,filename1});
  args.put(GET_INFO_COMMAND,new String[]{filename1,filename2,filename1});
  request.setupGetParameterMap(args);
  status=BitpreserveFileState.processMissingRequest(getDummyPageContext(defaultLocale,request),new StringBuilder());
  assertEquals("String_Node_Str",2,mockabp.getCallCount(ADD_METHOD));
  assertEquals("String_Node_Str",3,mockabp.getCallCount(GET_INFO_METHOD));
  assertEquals("String_Node_Str",2,status.size());
  assertEquals("String_Node_Str",null,status.get(filename1));
  assertEquals("String_Node_Str",null,status.get(filename2));
  CollectionAsserts.assertIteratorEquals("String_Node_Str",Arrays.asList(new String[]{filename1 + "String_Node_Str" + ba2,filename1 + "String_Node_Str" + ba2}).iterator(),mockabp.calls.get(ADD_METHOD).iterator());
  CollectionAsserts.assertIteratorEquals("String_Node_Str",Arrays.asList(new String[]{filename1,filename2,filename1}).iterator(),mockabp.calls.get(GET_INFO_METHOD).iterator());
}

Fixed version (ground truth):
public void testProcessMissingRequest() throws Exception {
  Settings.set(ArchiveSettings.DIR_ARCREPOSITORY_BITPRESERVATION,TestInfo.WORKING_DIR.getAbsolutePath());
  Settings.set(ArchiveSettings.DIRS_ARCREPOSITORY_ADMIN,TestInfo.WORKING_DIR.getAbsolutePath());
  AdminData.getUpdateableInstance();
  MockFileBasedActiveBitPreservation mockabp=new MockFileBasedActiveBitPreservation();
  MockHttpServletRequest request=new MockHttpServletRequest();
  String ba1="String_Node_Str";
  String ba2="String_Node_Str";
  String filename1="String_Node_Str";
  String filename2="String_Node_Str";
  Locale defaultLocale=new Locale("String_Node_Str");
  Map<String,String[]> args=new HashMap<String,String[]>();
  args.put(ADD_COMMAND,new String[]{ba1 + Constants.STRING_FILENAME_SEPARATOR + filename1});
  request.setupAddParameter(ADD_COMMAND,new String[]{ba1 + Constants.STRING_FILENAME_SEPARATOR + filename1});
  args.put(GET_INFO_COMMAND,new String[]{filename1});
  request.setupAddParameter(GET_INFO_COMMAND,new String[]{filename1});
  args.put(BITARCHIVE_NAME_PARAM,new String[]{Location.get(ba1).getName()});
  request.setupAddParameter(BITARCHIVE_NAME_PARAM,new String[]{Location.get(ba1).getName()});
  request.setupGetParameterMap(args);
  request.setupGetParameterNames(new Vector<String>(args.keySet()).elements());
  Map<String,FilePreservationState> status=BitpreserveFileState.processMissingRequest(getDummyPageContext(defaultLocale,request),new StringBuilder());
  assertEquals("String_Node_Str",1,mockabp.getCallCount(ADD_METHOD));
  assertEquals("String_Node_Str",1,mockabp.getCallCount(GET_INFO_METHOD));
  assertEquals("String_Node_Str",null,status.get(filename1));
  mockabp.calls.clear();
  request=new MockHttpServletRequest();
  args.clear();
  args.put(BITARCHIVE_NAME_PARAM,new String[]{Location.get(ba1).getName()});
  request.setupAddParameter(BITARCHIVE_NAME_PARAM,new String[]{Location.get(ba1).getName()});
  request.setupGetParameterMap(args);
  status=BitpreserveFileState.processMissingRequest(getDummyPageContext(defaultLocale,request),new StringBuilder());
  assertEquals("String_Node_Str",0,mockabp.getCallCount(ADD_METHOD));
  assertEquals("String_Node_Str",0,mockabp.getCallCount(GET_INFO_METHOD));
  assertEquals("String_Node_Str",0,status.size());
  mockabp.calls.clear();
  request=new MockHttpServletRequest();
  args.clear();
  args.put(BITARCHIVE_NAME_PARAM,new String[]{Location.get(ba2).getName()});
  request.setupAddParameter(BITARCHIVE_NAME_PARAM,new String[]{Location.get(ba2).getName()});
  request.setupAddParameter(ADD_COMMAND,new String[]{ba2 + Constants.STRING_FILENAME_SEPARATOR + filename1,ba2 + Constants.STRING_FILENAME_SEPARATOR + filename1});
  args.put(ADD_COMMAND,new String[]{ba2 + Constants.STRING_FILENAME_SEPARATOR + filename1,ba2 + Constants.STRING_FILENAME_SEPARATOR + filename1});
  request.setupAddParameter(GET_INFO_COMMAND,new String[]{filename1,filename2,filename1});
  args.put(GET_INFO_COMMAND,new String[]{filename1,filename2,filename1});
  request.setupGetParameterMap(args);
  status=BitpreserveFileState.processMissingRequest(getDummyPageContext(defaultLocale,request),new StringBuilder());
  assertEquals("String_Node_Str",2,mockabp.getCallCount(ADD_METHOD));
  assertEquals("String_Node_Str",3,mockabp.getCallCount(GET_INFO_METHOD));
  assertEquals("String_Node_Str",2,status.size());
  assertEquals("String_Node_Str",null,status.get(filename1));
  assertEquals("String_Node_Str",null,status.get(filename2));
  CollectionAsserts.assertIteratorEquals("String_Node_Str",Arrays.asList(new String[]{filename1 + "String_Node_Str" + ba2,filename1 + "String_Node_Str" + ba2}).iterator(),mockabp.calls.get(ADD_METHOD).iterator());
  CollectionAsserts.assertIteratorEquals("String_Node_Str",Arrays.asList(new String[]{filename1,filename2,filename1}).iterator(),mockabp.calls.get(GET_INFO_METHOD).iterator());
}