示例#1
0
  @Test
  public void testFileEventAndCmdNonPropagation() throws IOException {
    when(fileSystemState_.updateState(any(FileChangeEvent.class))).thenReturn(false);

    FileEvent evt =
        new FileEvent(StandardWatchEventKinds.ENTRY_CREATE, TEST_FILE_PATH, new byte[1]);
    client_.handleEvent(evt);
    verify(transport_, never()).publish(any(DropboxCmd.class));

    DropboxCmd update = new DropboxCmd(OpCode.UPDATE, TEST_FILE, new byte[1]);
    client_.handleCmd(update);
    verify(fileManager_, never()).write(any(Path.class), any(byte[].class), any(boolean.class));
  }
示例#2
0
  @Before
  public void setUp() {
    FileEventSource es = mock(FileEventSource.class);

    fileSystemState_ = mock(FileSystemState.class);
    when(fileSystemState_.updateState(any(FileChangeEvent.class))).thenReturn(true);

    fileManager_ = mock(FileManager.class);
    when(fileManager_.ensureRelative(TEST_FILE_PATH)).thenReturn(TEST_FILE_PATH);
    when(fileManager_.resolve(any(String.class))).thenReturn(TEST_FILE_RESOLVED_PATH);

    transport_ = mock(DropboxTransport.class);
    client_ = new DropboxClient(fileSystemState_, es, fileManager_, transport_);
  }