@Test public void testCreateQueueListValue() throws IOException { JobDetails jd = new JobDetails(null); jd.setQueue("queue1"); byte[] qb = Bytes.toBytes("queue2!queue3!"); Cell existingQueuesCell = CellUtil.createCell(Bytes.toBytes("rowkey"), Constants.INFO_FAM_BYTES, Constants.HRAVEN_QUEUE_BYTES, HConstants.LATEST_TIMESTAMP, KeyValue.Type.Put.getCode(), qb); AppSummaryService appSummaryService = new AppSummaryService(hbaseConnection); String qlist = appSummaryService.createQueueListValue(jd, Bytes.toString(CellUtil.cloneValue(existingQueuesCell))); assertNotNull(qlist); String expQlist = "queue2!queue3!queue1!"; assertEquals(expQlist, qlist); jd.setQueue("queue3"); qlist = appSummaryService.createQueueListValue(jd, Bytes.toString(CellUtil.cloneValue(existingQueuesCell))); assertNotNull(qlist); expQlist = "queue2!queue3!"; assertEquals(expQlist, qlist); }
String createQueueListValue(JobDetails jobDetails, String existingQueues) { String queue = jobDetails.getQueue(); queue = queue.concat(Constants.SEP); if (existingQueues == null) { return queue; } if (!existingQueues.contains(queue)) { existingQueues = existingQueues.concat(queue); } return existingQueues; }
AppSummaryService { String createQueueListValue(JobDetails jobDetails, String existingQueues) { String queue = jobDetails.getQueue(); queue = queue.concat(Constants.SEP); if (existingQueues == null) { return queue; } if (!existingQueues.contains(queue)) { existingQueues = existingQueues.concat(queue); } return existingQueues; } }
AppSummaryService { String createQueueListValue(JobDetails jobDetails, String existingQueues) { String queue = jobDetails.getQueue(); queue = queue.concat(Constants.SEP); if (existingQueues == null) { return queue; } if (!existingQueues.contains(queue)) { existingQueues = existingQueues.concat(queue); } return existingQueues; } AppSummaryService(Connection hbaseConnection); }
AppSummaryService { String createQueueListValue(JobDetails jobDetails, String existingQueues) { String queue = jobDetails.getQueue(); queue = queue.concat(Constants.SEP); if (existingQueues == null) { return queue; } if (!existingQueues.contains(queue)) { existingQueues = existingQueues.concat(queue); } return existingQueues; } AppSummaryService(Connection hbaseConnection); List<AppSummary> getNewApps(JobHistoryService jhs, String cluster,
      String user, long startTime, long endTime, int limit); List<AppKey> createNewAppKeysFromResults(Scan scan, long startTime,
      long endTime, int maxCount); boolean aggregateJobDetails(JobDetails jobDetails,
      AggregationConstants.AGGREGATION_TYPE aggType); List<AppSummary> getAllApps(String cluster, String user,
      long startTime, long endTime, int limit); }
AppSummaryService { String createQueueListValue(JobDetails jobDetails, String existingQueues) { String queue = jobDetails.getQueue(); queue = queue.concat(Constants.SEP); if (existingQueues == null) { return queue; } if (!existingQueues.contains(queue)) { existingQueues = existingQueues.concat(queue); } return existingQueues; } AppSummaryService(Connection hbaseConnection); List<AppSummary> getNewApps(JobHistoryService jhs, String cluster,
      String user, long startTime, long endTime, int limit); List<AppKey> createNewAppKeysFromResults(Scan scan, long startTime,
      long endTime, int maxCount); boolean aggregateJobDetails(JobDetails jobDetails,
      AggregationConstants.AGGREGATION_TYPE aggType); List<AppSummary> getAllApps(String cluster, String user,
      long startTime, long endTime, int limit);  }