Search in sources :

Example 1 with DaemonOperationResult

use of org.syncany.operations.daemon.DaemonOperationResult in project syncany by syncany.

the class DaemonOperationTest method testExecuteList.

@Test
public void testExecuteList() throws Exception {
    when(options.getAction()).thenReturn(DaemonAction.LIST);
    DaemonOperationResult res = deamonOp.execute();
    assertNotNull(res);
    assertEquals(DaemonResultCode.OK, res.getResultCode());
    assertNotNull(res.getWatchList());
}
Also used : DaemonOperationResult(org.syncany.operations.daemon.DaemonOperationResult) Test(org.junit.Test)

Example 2 with DaemonOperationResult

use of org.syncany.operations.daemon.DaemonOperationResult in project syncany by syncany.

the class DaemonOperationTest method testExecuteAdd.

@Test
public void testExecuteAdd() throws Exception {
    when(options.getAction()).thenReturn(DaemonAction.ADD);
    List<String> watchRoots = new ArrayList<String>();
    watchRoots.add(tempWatchRootAppFolder.getParent());
    when(options.getWatchRoots()).thenReturn(watchRoots);
    DaemonOperationResult res = deamonOp.execute();
    assertNotNull(res);
    assertEquals(DaemonResultCode.OK, res.getResultCode());
    assertNotNull(res.getWatchList());
    assertEquals(1, res.getWatchList().size());
    assertEquals(tempWatchRootAppFolder.getParentFile().getAbsolutePath(), res.getWatchList().get(0).getPath());
}
Also used : ArrayList(java.util.ArrayList) DaemonOperationResult(org.syncany.operations.daemon.DaemonOperationResult) Test(org.junit.Test)

Example 3 with DaemonOperationResult

use of org.syncany.operations.daemon.DaemonOperationResult in project syncany by syncany.

the class DaemonCommand method execute.

@Override
public int execute(String[] operationArgs) throws Exception {
    DaemonOperationOptions operationOptions = parseOptions(operationArgs);
    DaemonOperationResult operationResult = new DaemonOperation(operationOptions).execute();
    printResults(operationResult);
    return 0;
}
Also used : DaemonOperation(org.syncany.operations.daemon.DaemonOperation) DaemonOperationResult(org.syncany.operations.daemon.DaemonOperationResult) DaemonOperationOptions(org.syncany.operations.daemon.DaemonOperationOptions)

Example 4 with DaemonOperationResult

use of org.syncany.operations.daemon.DaemonOperationResult in project syncany by syncany.

the class DaemonOperationResultTest method setUp.

@Before
public void setUp() {
    folder = new FolderTO("test");
    watchList = new ArrayList<FolderTO>();
    watchList.add(folder);
    result = new DaemonOperationResult(DaemonResultCode.OK, watchList);
}
Also used : FolderTO(org.syncany.config.to.FolderTO) DaemonOperationResult(org.syncany.operations.daemon.DaemonOperationResult) Before(org.junit.Before)

Example 5 with DaemonOperationResult

use of org.syncany.operations.daemon.DaemonOperationResult in project syncany by syncany.

the class DaemonOperationTest method testExecuteRemove.

@Test
public void testExecuteRemove() throws Exception {
    when(options.getAction()).thenReturn(DaemonAction.REMOVE);
    List<String> watchRoots = new ArrayList<String>();
    watchRoots.add(tempWatchRootAppFolder.getParent());
    when(options.getWatchRoots()).thenReturn(watchRoots);
    DaemonOperationResult res = deamonOp.execute();
    assertNotNull(res);
    assertEquals(DaemonResultCode.OK, res.getResultCode());
    assertNotNull(res.getWatchList());
    assertTrue(res.getWatchList().isEmpty());
}
Also used : ArrayList(java.util.ArrayList) DaemonOperationResult(org.syncany.operations.daemon.DaemonOperationResult) Test(org.junit.Test)

Aggregations

DaemonOperationResult (org.syncany.operations.daemon.DaemonOperationResult)5 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 Before (org.junit.Before)1 FolderTO (org.syncany.config.to.FolderTO)1 DaemonOperation (org.syncany.operations.daemon.DaemonOperation)1 DaemonOperationOptions (org.syncany.operations.daemon.DaemonOperationOptions)1