test_class.file: dataprep-backend-service/src/test/java/org/talend/dataprep/lock/DistributedLockWatcherTest.java
test_class.identifier: DistributedLockWatcherTest
test_case.body: @Test
      public void shouldWatchOnLock() throws Exception {
          // given
          final LockFactory delegate = mock(LockFactory.class);
          final DistributedLock mock = mock(DistributedLock.class);
          when(mock.getKey()).thenReturn("1234");
          when(delegate.getLock(eq("1234"))).thenReturn(mock);
          final DistributedLockWatcher watcher = new DistributedLockWatcher(delegate);
  
          // when
          final DistributedLock lock = watcher.getLock("1234");
  
          // then
          assertEquals(DistributedLockWatcher.WatchedDistributedLock.class, lock.getClass());
      }
test_case.class_method_signature: DistributedLockWatcherTest.shouldWatchOnLock()
test_case.full_signature: @Test public void shouldWatchOnLock()
test_case.identifier: shouldWatchOnLock
test_case.invocations: mock mock thenReturn when getKey thenReturn when getLock eq getLock assertEquals getClass
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldWatchOnLock()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(DistributedLockWatcher.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(DistributedLockWatcher.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: locks = new HashMap<>()
focal_class.modifier: private final
focal_class.original_string: private final Map<String, DistributedLock> locks = new HashMap<>();
focal_class.type: Map<String, DistributedLock>
focal_class.var_name: locks
focal_class.declarator: delegate
focal_class.modifier: private final
focal_class.original_string: private final LockFactory delegate;
focal_class.type: LockFactory
focal_class.var_name: delegate
focal_class.file: dataprep-backend-service/src/main/java/org/talend/dataprep/lock/DistributedLockWatcher.java
focal_class.identifier: DistributedLockWatcher
focal_class.interfaces: implements LockFactory, ApplicationListener<ContextClosedEvent>
focal_class.class_method_signature: DistributedLockWatcher.DistributedLockWatcher(LockFactory delegate)
focal_class.full_signature: public  DistributedLockWatcher(LockFactory delegate)
focal_class.identifier: DistributedLockWatcher
focal_class.modifiers: public
focal_class.parameters: (LockFactory delegate)
focal_class.signature:  DistributedLockWatcher(LockFactory delegate)
focal_class.class_method_signature: DistributedLockWatcher.getLock(String id)
focal_class.full_signature: @Override public DistributedLock getLock(String id)
focal_class.identifier: getLock
focal_class.modifiers: @Override public
focal_class.parameters: (String id)
focal_class.return: DistributedLock
focal_class.signature: DistributedLock getLock(String id)
focal_class.class_method_signature: DistributedLockWatcher.onApplicationEvent(ContextClosedEvent event)
focal_class.full_signature: @Override public void onApplicationEvent(ContextClosedEvent event)
focal_class.identifier: onApplicationEvent
focal_class.modifiers: @Override public
focal_class.parameters: (ContextClosedEvent event)
focal_class.return: void
focal_class.signature: void onApplicationEvent(ContextClosedEvent event)
focal_class.class_method_signature: DistributedLockWatcher.getLocks()
focal_class.full_signature: public Collection<DistributedLock> getLocks()
focal_class.identifier: getLocks
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Collection<DistributedLock>
focal_class.signature: Collection<DistributedLock> getLocks()
focal_method.body: @Override
      public DistributedLock getLock(String id) {
          final DistributedLock lock = delegate.getLock(id);
          final WatchedDistributedLock watchedDistributedLock = new WatchedDistributedLock(lock);
          locks.put(watchedDistributedLock.getKey(), watchedDistributedLock);
          return watchedDistributedLock;
      }
focal_method.class_method_signature: DistributedLockWatcher.getLock(String id)
focal_method.full_signature: @Override public DistributedLock getLock(String id)
focal_method.identifier: getLock
focal_method.invocations: getLock put getKey
focal_method.modifiers: @Override public
focal_method.parameters: (String id)
focal_method.return: DistributedLock
focal_method.signature: DistributedLock getLock(String id)