@Test
public void recommenderJobWithIDMapping() throws Exception {

  String[] preferencesWithLongIDs = {
      "5568227754922264005,-4758971626494767444,5.0",
      "5568227754922264005,3688396615879561990,5.0",
      "5568227754922264005,4594226737871995304,2.0",
      "550945997885173934,-4758971626494767444,2.0",
      "550945997885173934,4594226737871995304,3.0",
      "550945997885173934,706816485922781596,5.0",
      "2448095297482319463,3688396615879561990,5.0",
      "2448095297482319463,706816485922781596,3.0",
      "6839920411763636962,-4758971626494767444,3.0",
      "6839920411763636962,706816485922781596,5.0" };
  writeLines(inputFile, preferencesWithLongIDs);
  ParallelALSFactorizationJob alsFactorization = new ParallelALSFactorizationJob();
  alsFactorization.setConf(conf);
  int numFeatures = 3;
  int numIterations = 5;
  double lambda = 0.065;
  Configuration conf = getConfiguration();
  int success = ToolRunner.run(alsFactorization, new String[] {
      "-Dhadoop.tmp.dir=" + conf.get("hadoop.tmp.dir"),
      "--input", inputFile.getAbsolutePath(),
      "--output", intermediateDir.getAbsolutePath(),
      "--tempDir", tmpDir.getAbsolutePath(),
      "--lambda", String.valueOf(lambda),
      "--numFeatures", String.valueOf(numFeatures),
      "--numIterations", String.valueOf(numIterations),
      "--numThreadsPerSolver", String.valueOf(1),
      "--usesLongIDs", String.valueOf(true) });
  assertEquals(0, success);
  // reset as we run in the same JVM
  SharingMapper.reset();
  RecommenderJob recommender = new RecommenderJob();
  success = ToolRunner.run(recommender, new String[] {
      "-Dhadoop.tmp.dir=" + conf.get("hadoop.tmp.dir"),
      "--input", intermediateDir.getAbsolutePath() + "/userRatings/",
      "--userFeatures", intermediateDir.getAbsolutePath() + "/U/",
      "--itemFeatures", intermediateDir.getAbsolutePath() + "/M/",
      "--numRecommendations", String.valueOf(2),
      "--maxRating", String.valueOf(5.0),
      "--numThreads", String.valueOf(2),
      "--usesLongIDs", String.valueOf(true),
      "--userIDIndex", intermediateDir.getAbsolutePath() + "/userIDIndex/",
      "--itemIDIndex", intermediateDir.getAbsolutePath() + "/itemIDIndex/",
      "--output", outputDir.getAbsolutePath() });
  assertEquals(0, success);
}