Search in sources :

Example 6 with PluginOperationOptions

use of org.syncany.operations.plugin.PluginOperationOptions in project syncany by syncany.

the class PluginOperationTest method testPluginListLocalOnly.

@Test
public void testPluginListLocalOnly() throws Exception {
    // Setup
    LocalTransferSettings testConnection = (LocalTransferSettings) TestConfigUtil.createTestLocalConnection();
    TestClient client = new TestClient("A", testConnection);
    PluginOperationOptions pluginOptions = new PluginOperationOptions();
    pluginOptions.setAction(PluginOperationAction.LIST);
    pluginOptions.setListMode(PluginListMode.LOCAL);
    // Run
    PluginOperationResult pluginResult = client.plugin(pluginOptions);
    // for comparison only!
    List<Plugin> pluginList = Plugins.list();
    // Test
    assertNotNull(pluginResult);
    assertEquals(PluginResultCode.OK, pluginResult.getResultCode());
    assertEquals(pluginList.size(), pluginResult.getPluginList().size());
    // local and unreliable_local
    assertEquals(EXPECTED_NUM_PLUGINS, pluginResult.getPluginList().size());
    for (ExtendedPluginInfo pluginInfo : pluginResult.getPluginList()) {
        assertNull(pluginInfo.getRemotePluginInfo());
        assertNotNull(pluginInfo.getLocalPluginInfo());
        assertNull(pluginInfo.getLocalPluginInfo().getDownloadUrl());
        assertNull(pluginInfo.getLocalPluginInfo().getSha256sum());
        assertNotNull(pluginInfo.getLocalPluginInfo().getPluginId());
        assertNotNull(pluginInfo.getLocalPluginInfo().getPluginVersion());
        // The rest is not important for processing ...
        assertNotNull(Plugins.get(pluginInfo.getLocalPluginInfo().getPluginId()));
    }
    // Tear down
    client.deleteTestData();
}
Also used : LocalTransferSettings(org.syncany.plugins.local.LocalTransferSettings) ExtendedPluginInfo(org.syncany.operations.plugin.ExtendedPluginInfo) TestClient(org.syncany.tests.util.TestClient) PluginOperationResult(org.syncany.operations.plugin.PluginOperationResult) PluginOperationOptions(org.syncany.operations.plugin.PluginOperationOptions) Plugin(org.syncany.plugins.Plugin) Test(org.junit.Test)

Example 7 with PluginOperationOptions

use of org.syncany.operations.plugin.PluginOperationOptions in project syncany by syncany.

the class PluginCommand method execute.

@Override
public int execute(String[] operationArgs) throws Exception {
    PluginOperationOptions operationOptions = parseOptions(operationArgs);
    PluginOperationResult operationResult = new PluginOperation(config, operationOptions).execute();
    printResults(operationResult);
    return 0;
}
Also used : PluginOperation(org.syncany.operations.plugin.PluginOperation) PluginOperationResult(org.syncany.operations.plugin.PluginOperationResult) PluginOperationOptions(org.syncany.operations.plugin.PluginOperationOptions)

Aggregations

PluginOperationOptions (org.syncany.operations.plugin.PluginOperationOptions)7 PluginOperationResult (org.syncany.operations.plugin.PluginOperationResult)6 Test (org.junit.Test)5 LocalTransferSettings (org.syncany.plugins.local.LocalTransferSettings)5 TestClient (org.syncany.tests.util.TestClient)5 File (java.io.File)2 ExtendedPluginInfo (org.syncany.operations.plugin.ExtendedPluginInfo)2 OptionParser (joptsimple.OptionParser)1 OptionSet (joptsimple.OptionSet)1 PluginOperation (org.syncany.operations.plugin.PluginOperation)1 PluginOperationAction (org.syncany.operations.plugin.PluginOperationAction)1 Plugin (org.syncany.plugins.Plugin)1