test_class.file: flink-runtime-web/src/test/java/org/apache/flink/runtime/webmonitor/handlers/JobCheckpointsHandlerTest.java
test_class.identifier: JobCheckpointsHandlerTest
test_case.body: @Test
  	public void testNoCoordinator() throws Exception {
  		JobCheckpointsHandler handler = new JobCheckpointsHandler(
  				mock(ExecutionGraphHolder.class));
  
  		ExecutionGraph graph = mock(ExecutionGraph.class);
  
  		// No coordinator
  		when(graph.getCheckpointStatsTracker()).thenReturn(null);
  
  		String response = handler.handleRequest(graph, Collections.<String, String>emptyMap());
  
  		// Expecting empty response
  		assertEquals("{}", response);
  	}
test_case.class_method_signature: JobCheckpointsHandlerTest.testNoCoordinator()
test_case.full_signature: @Test public void testNoCoordinator()
test_case.identifier: testNoCoordinator
test_case.invocations: mock mock thenReturn when getCheckpointStatsTracker handleRequest emptyMap assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testNoCoordinator()
focal_class.file: flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/JobCheckpointsHandler.java
focal_class.identifier: JobCheckpointsHandler
focal_class.class_method_signature: JobCheckpointsHandler.JobCheckpointsHandler(ExecutionGraphHolder executionGraphHolder)
focal_class.full_signature: public  JobCheckpointsHandler(ExecutionGraphHolder executionGraphHolder)
focal_class.identifier: JobCheckpointsHandler
focal_class.modifiers: public
focal_class.parameters: (ExecutionGraphHolder executionGraphHolder)
focal_class.signature:  JobCheckpointsHandler(ExecutionGraphHolder executionGraphHolder)
focal_class.class_method_signature: JobCheckpointsHandler.handleRequest(ExecutionGraph graph, Map<String, String> params)
focal_class.full_signature: @Override public String handleRequest(ExecutionGraph graph, Map<String, String> params)
focal_class.identifier: handleRequest
focal_class.modifiers: @Override public
focal_class.parameters: (ExecutionGraph graph, Map<String, String> params)
focal_class.return: String
focal_class.signature: String handleRequest(ExecutionGraph graph, Map<String, String> params)
focal_class.superclass: extends AbstractExecutionGraphRequestHandler
focal_method.body: @Override
  	public String handleRequest(ExecutionGraph graph, Map<String, String> params) throws Exception {
  		StringWriter writer = new StringWriter();
  		JsonGenerator gen = JsonFactory.jacksonFactory.createGenerator(writer);
  
  		CheckpointStatsTracker tracker = graph.getCheckpointStatsTracker();
  
  		gen.writeStartObject();
  
  		if (tracker != null) {
  			Option<JobCheckpointStats> stats = tracker.getJobStats();
  
  			if (stats.isDefined()) {
  				// Total number of checkpoints
  				gen.writeNumberField("count", stats.get().getCount());
  
  				// Duration
  				gen.writeFieldName("duration");
  				gen.writeStartObject();
  				gen.writeNumberField("min", stats.get().getMinDuration());
  				gen.writeNumberField("max", stats.get().getMaxDuration());
  				gen.writeNumberField("avg", stats.get().getAverageDuration());
  				gen.writeEndObject();
  
  				// State size
  				gen.writeFieldName("size");
  				gen.writeStartObject();
  				gen.writeNumberField("min", stats.get().getMinStateSize());
  				gen.writeNumberField("max", stats.get().getMaxStateSize());
  				gen.writeNumberField("avg", stats.get().getAverageStateSize());
  				gen.writeEndObject();
  
  				// Recent history
  				gen.writeArrayFieldStart("history");
  				for (CheckpointStats checkpoint : stats.get().getRecentHistory()) {
  					gen.writeStartObject();
  					gen.writeNumberField("id", checkpoint.getCheckpointId());
  					gen.writeNumberField("timestamp", checkpoint.getTriggerTimestamp());
  					gen.writeNumberField("duration", checkpoint.getDuration());
  					gen.writeNumberField("size", checkpoint.getStateSize());
  					gen.writeEndObject();
  				}
  				gen.writeEndArray();
  			}
  		}
  
  		gen.writeEndObject();
  		gen.close();
  
  		return writer.toString();
  	}
focal_method.class_method_signature: JobCheckpointsHandler.handleRequest(ExecutionGraph graph, Map<String, String> params)
focal_method.full_signature: @Override public String handleRequest(ExecutionGraph graph, Map<String, String> params)
focal_method.identifier: handleRequest
focal_method.invocations: createGenerator getCheckpointStatsTracker writeStartObject getJobStats isDefined writeNumberField getCount get writeFieldName writeStartObject writeNumberField getMinDuration get writeNumberField getMaxDuration get writeNumberField getAverageDuration get writeEndObject writeFieldName writeStartObject writeNumberField getMinStateSize get writeNumberField getMaxStateSize get writeNumberField getAverageStateSize get writeEndObject writeArrayFieldStart getRecentHistory get writeStartObject writeNumberField getCheckpointId writeNumberField getTriggerTimestamp writeNumberField getDuration writeNumberField getStateSize writeEndObject writeEndArray writeEndObject close toString
focal_method.modifiers: @Override public
focal_method.parameters: (ExecutionGraph graph, Map<String, String> params)
focal_method.return: String
focal_method.signature: String handleRequest(ExecutionGraph graph, Map<String, String> params)