use of com.twitter.heron.spi.statemgr.Lock in project heron by twitter.
the class LocalFileSystemStateManagerTest method testGetLock.
@Test
public void testGetLock() throws Exception {
initMocks();
String expectedLockPath = String.format("//locks/%s__%s", TOPOLOGY_NAME, LOCK_NAME.getName());
byte[] expectedContents = Thread.currentThread().getName().getBytes(Charset.defaultCharset());
Lock lock = manager.getLock(TOPOLOGY_NAME, LOCK_NAME);
assertTrue(lock.tryLock(0, TimeUnit.MILLISECONDS));
assertWriteToFile(expectedLockPath, expectedContents, false);
lock.unlock();
assertDeleteFile(expectedLockPath);
}
Aggregations