### Question:
KeepAliveDataSource implements DirectDataSource { @Override public void cleanupTransactionOutput(OutputTransactionContext context) throws IOException, InterruptedException { if (context == null) { throw new IllegalArgumentException("context must not be null"); } Counter counter = context.getCounter(); heartbeat.register(counter); try { entity.cleanupTransactionOutput(context); } finally { heartbeat.unregister(counter); } } KeepAliveDataSource(DirectDataSource entity, long interval); @Override String path(String basePath, ResourcePattern resourcePattern); @Override String path(String basePath); @Override List<DirectInputFragment> findInputFragments(
            DataDefinition<T> definition,
            String basePath,
            ResourcePattern resourcePattern); @Override ModelInput<T> openInput(
            DataDefinition<T> definition,
            DirectInputFragment fragment,
            Counter counter); @Override ModelOutput<T> openOutput(
            OutputAttemptContext context,
            DataDefinition<T> definition,
            String basePath,
            String resourcePath,
            Counter counter); @Override List<ResourceInfo> list(
            String basePath,
            ResourcePattern resourcePattern,
            Counter counter); @Override boolean delete(
            String basePath,
            ResourcePattern resourcePattern,
            boolean recursive,
            Counter counter); @Override void setupAttemptOutput(OutputAttemptContext context); @Override void commitAttemptOutput(OutputAttemptContext context); @Override void cleanupAttemptOutput(OutputAttemptContext context); @Override void setupTransactionOutput(OutputTransactionContext context); @Override void commitTransactionOutput(OutputTransactionContext context); @Override void cleanupTransactionOutput(OutputTransactionContext context); @Override Optional<T> findProperty(Class<T> propertyType);  }### Answer:
@Test public void testCleanupTransactionOutput() throws Exception { OutputAttemptContext context = context(); long s1 = counter.count; ds.cleanupTransactionOutput(context.getTransactionContext()); long s2 = counter.count; assertThat(s2, greaterThan(s1)); assertKeepAlive(false); }