PerformanceToolUtil { public static Map<String, String> findPerformanceTestAnnotations(Protos.TaskInfo taskInfo) { TitanProtos.ContainerInfo containerInfo; try { containerInfo = TitanProtos.ContainerInfo.parseFrom(taskInfo.getData()); } catch (InvalidProtocolBufferException e) { return Collections.emptyMap(); } return findTaskLifecycleEnv(containerInfo.getUserProvidedEnvMap()) .map(PerformanceToolUtil::toAnnotations) .orElse(Collections.emptyMap()); }  static Map<String, String> findPerformanceTestAnnotations(Protos.TaskInfo taskInfo); static Map<String, String> toAnnotations(Job job);  }
@Test public void testParser() { Protos.TaskInfo taskInfo = newTaskInfo( "TASK_LIFECYCLE_1", "selector: slots=0.. slotStep=2; launched: delay=2s; startInitiated: delay=3s; started: delay=60s; killInitiated: delay=5s" ); Map<String, String> annotations = PerformanceToolUtil.findPerformanceTestAnnotations(taskInfo); assertThat(annotations).containsEntry(PerformanceToolUtil.PREPARE_TIME, "3s"); assertThat(annotations).containsEntry(PerformanceToolUtil.RUN_TIME, "60s"); assertThat(annotations).containsEntry(PerformanceToolUtil.KILL_TIME, "5s"); }