WFClient { public void completeList(WFList toComplete, boolean isComplete) throws IOException { checkLoggedIn(); long time = getClientTimeInSeconds(); PushPoll.Operation completeOp; synchronized (this) { Long prevLm = toComplete.lm; toComplete.cp = isComplete ? time : null; toComplete.lm = time; completeOp = PushPoll.buildCompleteOp(toComplete.id, isComplete, toComplete.cp, prevLm, time); } executePushPoll(ImmutableList.of(completeOp)); } WFClient(); void login(String username, String password); boolean isLoggedIn(); void logout(); void setSession(String session); String getSession(); String getUsername(); void refresh(); List<WFList> getRootLists(); WFList createRootList(Integer insertIndex, String name, String description); WFList createList(WFList parent, Integer insertIndex, String name, String description); void editList(WFList toEdit, String newName, String newDescription); void completeList(WFList toComplete, boolean isComplete); void deleteList(WFList toDelete); synchronized boolean isRootList(WFList list); synchronized boolean hasList(WFList list); synchronized WFList getParentList(WFList child); synchronized WFList getListById(final String listId); synchronized List<WFList> getAncestryPath(WFList list); static final Logger log; static final String LOGIN_URL; static final String API_URL; static final String USER_AGENT; static final int TIMEOUT_MS; static final String CLIENT_VERSION; }
@Test public void testCompleteList() throws IOException { String rootName = "root_" + UUID.randomUUID().toString(); WFList rootList = client.createRootList(0, rootName, null); String childName = rootName + "_child"; client.createList(rootList, 0, childName, null); client.refresh(); rootList = client.getRootLists().get(0); WFList childList = rootList.getChildren().get(0); assertFalse(rootList.isComplete()); assertFalse(childList.isComplete()); client.completeList(rootList, true); client.refresh(); rootList = client.getRootLists().get(0); childList = rootList.getChildren().get(0); assertTrue(rootList.isComplete()); assertFalse(childList.isComplete()); client.completeList(rootList, false); client.completeList(childList, true); client.refresh(); rootList = client.getRootLists().get(0); childList = rootList.getChildren().get(0); assertFalse(rootList.isComplete()); assertTrue(childList.isComplete()); }