Usages of
public Item getItem(String serverPath, VersionSpec version, DeletedState deletedState, GetItemsOptions options) { // only changeset version or latest version are accepted // deleted state and get options are ignored int versionChangesetNumber = getChangesetNumberFromVersion(version); if (versionChangesetNumber == INVALID_CHANGESET_NUMBER) { return null; } for (int backwardChangesetCounter = versionChangesetNumber; backwardChangesetCounter > 0; backwardChangesetCounter--) { if (!itemData.containsKey(new Integer(versionChangesetNumber))) { continue; } HashSet<String> changesetData = itemData.get(new Integer(backwardChangesetCounter)); if (!DoesChangesetDataHasServerPath(changesetData, serverPath)) { continue; } Item toReturn = new Item(); toReturn.setChangeSetID(backwardChangesetCounter); toReturn.setServerItem(serverPath); toReturn.setItemType(ItemType.FOLDER); return toReturn; } return null; }
@Test public void assertLoggingWhenChangeset() throws Exception { final User user = mock(User.class); when(user.getId()).thenReturn("piedefer"); final UserLookup userLookup = mock(UserLookup.class); when(userLookup.find("piedefer")).thenReturn(user); final Item item = new Item(); item.setServerItem("Arithmetica.iTeX"); item.setItemType(ItemType.FILE); final Change serverChange = new Change(item, ChangeType.EDIT, null); final Changeset serverChangeset = new Changeset( new Change[]{serverChange}, "I have discovered a truly marvellous proof of this, which this margin is too narrow to contain.", null, null, "piedefer", "Pierre de Fermat", fixedPointInTime.getDate(), 1637, "piedefer", "Pierre de Fermat", null ); final Changeset[] serverChangesets = new Changeset[]{serverChangeset}; when(vcc.queryHistory( isA(String.class), isA(VersionSpec.class), anyInt(), isA(RecursionType.class), (String) isNull(), (VersionSpec) isNull(), (VersionSpec) isNull(), anyInt(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean())).thenReturn(serverChangesets); final RemoteChangesetVersionCommand command = new RemoteChangesetVersionCommand(server, "$/RemotePath", LatestVersionSpec.INSTANCE) { @Override public Server createServer() { return server; } }; final Callable<Integer, Exception> callable = command.getCallable(); final Integer actual =; Assert.assertNotNull(actual); Assert.assertEquals(1637, (int)actual); assertLog( "Querying for remote changeset at '$/RemotePath' as of 'T'...", "Query result is: Changeset #1637 by 'piedefer' on '2013-07-02T15:40:50Z'." ); }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes