MemorizeSchedulingLocationListener { public void onLogout( final String sessionId ) { this.locationMap.keySet().removeIf( k -> k.isSameSession( sessionId ) ); }  void recordOutputFile( final PentahoAsyncExecutor.CompositeKey key, final Serializable fileId ); Serializable lookupOutputFile( final PentahoAsyncExecutor.CompositeKey key ); void shutdown(); void onLogout( final String sessionId ); void lock(); void unlock();  }
@Test public void testOnLogout() throws Exception { final MemorizeSchedulingLocationListener memorizeSchedulingLocationListener = new MemorizeSchedulingLocationListener(); final PentahoAsyncExecutor.CompositeKey mock = mock( PentahoAsyncExecutor.CompositeKey.class ); when( mock.isSameSession( "another" ) ).thenReturn( false ); when( mock.isSameSession( "same" ) ).thenReturn( true ); final String path = "test.prpt"; memorizeSchedulingLocationListener.recordOutputFile( mock, path ); assertEquals( path, memorizeSchedulingLocationListener.lookupOutputFile( mock ) ); memorizeSchedulingLocationListener.onLogout( "another" ); assertEquals( path, memorizeSchedulingLocationListener.lookupOutputFile( mock ) ); memorizeSchedulingLocationListener.onLogout( "same" ); assertNull( memorizeSchedulingLocationListener.lookupOutputFile( mock ) ); }