Search in sources :

Example 1 with DummyTransferSettings

use of org.syncany.plugins.dummy.DummyTransferSettings in project syncany by syncany.

the class PluginOptionsTest method nestedSettingsTest.

@Test
@Ignore
public // TODO rewrite to make this test work again with generic nested transfer settings
void nestedSettingsTest() throws Exception {
    DummyTransferSettings dts = new DummyTransferSettings();
    for (TransferPluginOption option : TransferPluginOptions.getOrderedOptions(DummyTransferSettings.class)) {
        askNestedPluginSettings(dts, option, 0);
    }
    assertNotNull(dts.baz);
    assertNotNull(dts.foo);
    assertNotNull(dts.number);
    assertNotNull(dts.subsettings);
}
Also used : DummyTransferSettings(org.syncany.plugins.dummy.DummyTransferSettings) NestedTransferPluginOption(org.syncany.plugins.transfer.NestedTransferPluginOption) TransferPluginOption(org.syncany.plugins.transfer.TransferPluginOption) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with DummyTransferSettings

use of org.syncany.plugins.dummy.DummyTransferSettings in project syncany by syncany.

the class TransferSettingsTest method testEnumSettingInvalid.

@Test(expected = StorageException.class)
public void testEnumSettingInvalid() throws Exception {
    // does not exist
    final String enumValue = "C";
    DummyTransferSettings testTransferSettings = new DummyTransferSettings();
    testTransferSettings.setField("enumField", enumValue);
}
Also used : DummyTransferSettings(org.syncany.plugins.dummy.DummyTransferSettings) Test(org.junit.Test)

Example 3 with DummyTransferSettings

use of org.syncany.plugins.dummy.DummyTransferSettings in project syncany by syncany.

the class TransferSettingsTest method createNewInvalidConnectionTO.

@Test
public void createNewInvalidConnectionTO() throws Exception {
    TransferPlugin p = Plugins.get("dummy", TransferPlugin.class);
    DummyTransferSettings ts = p.createEmptySettings();
    assertFalse(ts.isValid());
}
Also used : DummyTransferPlugin(org.syncany.plugins.dummy.DummyTransferPlugin) TransferPlugin(org.syncany.plugins.transfer.TransferPlugin) DummyTransferSettings(org.syncany.plugins.dummy.DummyTransferSettings) Test(org.junit.Test)

Example 4 with DummyTransferSettings

use of org.syncany.plugins.dummy.DummyTransferSettings in project syncany by syncany.

the class TransferSettingsTest method testRestore.

@Test
public void testRestore() throws Exception {
    final String fooTest = "foo-test";
    final String bazTest = "baz";
    final int numberTest = 1234;
    final DummyTransferSettings ts = new DummyTransferSettings();
    final LocalTransferSettings lts = new LocalTransferSettings();
    final InitOperationOptions initOperationOptions = TestConfigUtil.createTestInitOperationOptions("syncanytest");
    final ConfigTO conf = initOperationOptions.getConfigTO();
    File repoDir = ((LocalTransferSettings) initOperationOptions.getConfigTO().getTransferSettings()).getPath();
    File localDir = initOperationOptions.getLocalDir();
    conf.setTransferSettings(ts);
    ts.foo = fooTest;
    ts.baz = bazTest;
    ts.number = numberTest;
    lts.setPath(File.createTempFile("aaa", "bbb"));
    ts.subsettings = lts;
    assertTrue(ts.isValid());
    Serializer serializer = new Persister();
    serializer.write(conf, tmpFile);
    System.out.println(new String(Files.readAllBytes(Paths.get(tmpFile.toURI()))));
    ConfigTO confRestored = ConfigTO.load(tmpFile);
    TransferPlugin plugin = Plugins.get(confRestored.getTransferSettings().getType(), TransferPlugin.class);
    assertNotNull(plugin);
    TransferSettings tsRestored = confRestored.getTransferSettings();
    assertNotNull(tsRestored);
    DummyTransferManager transferManager = plugin.createTransferManager(tsRestored, config);
    assertNotNull(transferManager);
    // Tear down
    FileUtils.deleteDirectory(localDir);
    FileUtils.deleteDirectory(repoDir);
}
Also used : DummyTransferPlugin(org.syncany.plugins.dummy.DummyTransferPlugin) TransferPlugin(org.syncany.plugins.transfer.TransferPlugin) LocalTransferSettings(org.syncany.plugins.local.LocalTransferSettings) InitOperationOptions(org.syncany.operations.init.InitOperationOptions) DummyTransferSettings(org.syncany.plugins.dummy.DummyTransferSettings) DummyTransferManager(org.syncany.plugins.dummy.DummyTransferManager) ConfigTO(org.syncany.config.to.ConfigTO) Persister(org.simpleframework.xml.core.Persister) LocalTransferSettings(org.syncany.plugins.local.LocalTransferSettings) TransferSettings(org.syncany.plugins.transfer.TransferSettings) DummyTransferSettings(org.syncany.plugins.dummy.DummyTransferSettings) File(java.io.File) Serializer(org.simpleframework.xml.Serializer) Test(org.junit.Test)

Example 5 with DummyTransferSettings

use of org.syncany.plugins.dummy.DummyTransferSettings in project syncany by syncany.

the class TransferSettingsTest method createNewValidConnectionTO.

@Test
public void createNewValidConnectionTO() throws Exception {
    TransferPlugin p = Plugins.get("dummy", TransferPlugin.class);
    DummyTransferSettings ts = p.createEmptySettings();
    ts.foo = "foo-value";
    ts.number = 5;
    assertTrue(ts.isValid());
}
Also used : DummyTransferPlugin(org.syncany.plugins.dummy.DummyTransferPlugin) TransferPlugin(org.syncany.plugins.transfer.TransferPlugin) DummyTransferSettings(org.syncany.plugins.dummy.DummyTransferSettings) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)6 DummyTransferSettings (org.syncany.plugins.dummy.DummyTransferSettings)6 DummyTransferPlugin (org.syncany.plugins.dummy.DummyTransferPlugin)3 TransferPlugin (org.syncany.plugins.transfer.TransferPlugin)3 File (java.io.File)1 Ignore (org.junit.Ignore)1 Serializer (org.simpleframework.xml.Serializer)1 Persister (org.simpleframework.xml.core.Persister)1 ConfigTO (org.syncany.config.to.ConfigTO)1 InitOperationOptions (org.syncany.operations.init.InitOperationOptions)1 DummyTransferManager (org.syncany.plugins.dummy.DummyTransferManager)1 LocalTransferSettings (org.syncany.plugins.local.LocalTransferSettings)1 NestedTransferPluginOption (org.syncany.plugins.transfer.NestedTransferPluginOption)1 TransferPluginOption (org.syncany.plugins.transfer.TransferPluginOption)1 TransferSettings (org.syncany.plugins.transfer.TransferSettings)1