@Test public void testLocalIdManager() throws Exception { LocalIdManager manager = new LocalIdManager(temporaryFolder.newFolder("test")); manager.clear(); String localId1 = manager.createLocalId(); assertNotNull(localId1); manager.retainLocalIdOnDisk(localId1); assertNull(manager.getObjectId(localId1)); String localId2 = manager.createLocalId(); assertNotNull(localId2); manager.retainLocalIdOnDisk(localId2); assertNull(manager.getObjectId(localId2)); manager.retainLocalIdOnDisk(localId1); assertNull(manager.getObjectId(localId1)); assertNull(manager.getObjectId(localId2)); manager.releaseLocalIdOnDisk(localId1); assertNull(manager.getObjectId(localId1)); assertNull(manager.getObjectId(localId2)); String objectId1 = "objectId1"; manager.setObjectId(localId1, objectId1); assertEquals(objectId1, manager.getObjectId(localId1)); assertNull(manager.getObjectId(localId2)); manager.retainLocalIdOnDisk(localId1); assertEquals(objectId1, manager.getObjectId(localId1)); assertNull(manager.getObjectId(localId2)); String objectId2 = "objectId2"; manager.setObjectId(localId2, objectId2); assertEquals(objectId1, manager.getObjectId(localId1)); assertEquals(objectId2, manager.getObjectId(localId2)); manager.releaseLocalIdOnDisk(localId1); assertEquals(objectId1, manager.getObjectId(localId1)); assertEquals(objectId2, manager.getObjectId(localId2)); manager.releaseLocalIdOnDisk(localId1); assertNull(manager.getObjectId(localId1)); assertEquals(objectId2, manager.getObjectId(localId2)); manager.releaseLocalIdOnDisk(localId2); assertNull(manager.getObjectId(localId1)); assertNull(manager.getObjectId(localId2)); assertFalse(manager.clear()); }
LocalIdManager(File root) { diskPath = new File(root, "LocalId"); random = new Random(); }
LocalIdManager { LocalIdManager(File root) { diskPath = new File(root, "LocalId"); random = new Random(); } }
LocalIdManager { LocalIdManager(File root) { diskPath = new File(root, "LocalId"); random = new Random(); } LocalIdManager(File root); }
LocalIdManager { LocalIdManager(File root) { diskPath = new File(root, "LocalId"); random = new Random(); } LocalIdManager(File root);  }
LocalIdManager { LocalIdManager(File root) { diskPath = new File(root, "LocalId"); random = new Random(); } LocalIdManager(File root);   }