Package org.syncany.plugins.local

Examples of org.syncany.plugins.local.LocalTransferSettings


  }

  @Test(expected = ElementException.class)
  public void testDeserializeWrongClass() throws Exception {

    LocalTransferSettings lts = new LocalTransferSettings();
    lts.setPath(tmpFile);

    Serializer serializer = new Persister();
    serializer.write(lts, tmpFile);

    // This shouldn't blow up!
View Full Code Here


     * This test tries to provoke issue #132, i.e. the deletion of
     * multichunks of DIRTY database versions of other clients.
     */
   
    // Setup
    LocalTransferSettings testConnection = (LocalTransferSettings) TestConfigUtil.createTestLocalConnection();   
    TestClient clientA = new TestClient("A", testConnection);
    TestClient clientB = new TestClient("B", testConnection);

    UpOperationOptions upOptionsWithForce = new UpOperationOptions();
    upOptionsWithForce.setForceUploadEnabled(true);
   
    // Run
    clientA.createNewFile("file1.jpg");
    clientA.up();
   
    clientB.down();   
    clientB.createNewFile("file2.jpg");
    clientB.up();
   
    clientA.createNewFile("file3.jpg");
    clientA.up(upOptionsWithForce);    // No 'down' (creates dirty version) 
   
    FileUtils.copyDirectory(testConnection.getPath(), new File(testConnection.getPath()+"_1_before_down"));
    FileUtils.copyDirectory(clientB.getConfig().getLocalDir(), new File(clientB.getConfig().getLocalDir()+"_1_before_down"));

    assertSqlResultEquals(clientB.getDatabaseFile(), "select count(*) from multichunk_muddy", "0");

    clientB.down(); // Download A's version, realize it's muddy (= dirty by other client)
   
    assertSqlResultEquals(clientB.getDatabaseFile(), "select count(*) from multichunk_muddy", "1");
   
    FileUtils.copyDirectory(testConnection.getPath(), new File(testConnection.getPath()+"_2_after_down_before_cleanup"));
    FileUtils.copyDirectory(clientB.getConfig().getLocalDir(), new File(clientB.getConfig().getLocalDir()+"_2_after_down_before_cleanup"));
   
    assertEquals(3, new File(testConnection.getPath(), "multichunks").listFiles().length);
    clientB.cleanup(); // <<< This should NOT delete any lost multichunks of DIRTY database versions!
    assertEquals(3, new File(testConnection.getPath(), "multichunks").listFiles().length);
   
    FileUtils.copyDirectory(testConnection.getPath(), new File(testConnection.getPath()+"_3_after_cleanup"));
    FileUtils.copyDirectory(clientB.getConfig().getLocalDir(), new File(clientB.getConfig().getLocalDir()+"_3_after_cleanup"));
   
    clientA.down(); // Adds dirty database
    assertSqlResultEquals(clientA.getDatabaseFile(), "select count(*) from databaseversion where status='DIRTY'", "1");
   
View Full Code Here

     * This test tries to provoke issue #132, i.e. the deletion of
     * multichunks of DIRTY database versions of other clients.
     */
   
    // Setup
    LocalTransferSettings testConnection = (LocalTransferSettings) TestConfigUtil.createTestLocalConnection();   
    TestClient clientA = new TestClient("A", testConnection);
    TestClient clientB = new TestClient("B", testConnection);

    UpOperationOptions upOptionsWithForce = new UpOperationOptions();
    upOptionsWithForce.setForceUploadEnabled(true);
   
    // Run
   
    // Round 1
    clientA.createNewFile("file1.jpg");
    clientA.up();
   
    clientB.down();   
    clientB.createNewFile("file2.jpg");
    clientB.up();
   
    clientA.createNewFile("file3.jpg");
    clientA.up(upOptionsWithForce);    // No 'down' (creates dirty version) 
   
    clientB.down(); // Download A's version, realize it's muddy (= dirty by other client)
    assertSqlResultEquals(clientB.getDatabaseFile(), "select count(*) from multichunk_muddy", "1");

    assertEquals(3, new File(testConnection.getPath(), "multichunks").listFiles().length);
    clientB.cleanup(); // <<< This should NOT delete any lost multichunks of DIRTY database versions!
    assertEquals(3, new File(testConnection.getPath(), "multichunks").listFiles().length);
   
    // Round 2
    clientA.createNewFile("file4.jpg");
    clientA.up(upOptionsWithForce);    // This creates ANOTHER dirty version remotely! 
   
    clientB.down(); // Download A's version, realize it's muddy (= dirty by other client)
    assertSqlResultEquals(clientB.getDatabaseFile(), "select count(*) from multichunk_muddy", "2");
   
    assertEquals(4, new File(testConnection.getPath(), "multichunks").listFiles().length);
    clientB.cleanup(); // <<< This should NOT delete any lost multichunks of DIRTY database versions!
    assertEquals(4, new File(testConnection.getPath(), "multichunks").listFiles().length);

    clientA.down(); // Adds dirty databases
    assertSqlResultEquals(clientA.getDatabaseFile(), "select count(*) from databaseversion where status='DIRTY'", "2");
   
    clientA.up();
View Full Code Here

  /**
   * Alters multichunk data to test whether integrity checks work.
   */
  @Test
  public void testAssembler() throws Exception
    LocalTransferSettings testConnection = (LocalTransferSettings) TestConfigUtil.createTestLocalConnection();
   
    TestClient clientA = new TestClient("A", testConnection);
    TestClient clientB = new TestClient("B", testConnection);
   
    clientA.createNewFile("file1.jpg", 20); // small, only one chunk, one multichunk
    clientA.upWithForceChecksum();
   
    // Read chunk from original multichunk
    File repoMultiChunksFolder = new File(testConnection.getPath(), "multichunks");
    File multiChunkFile = repoMultiChunksFolder.listFiles()[0];
   
    MultiChunk multiChunk = clientA.getConfig().getMultiChunker().createMultiChunk(
      clientA.getConfig().getTransformer().createInputStream(new FileInputStream(multiChunkFile)));   
    Chunk chunk = multiChunk.read();
View Full Code Here

*/
public class ManySyncUpsLargeFileScenarioTest {
  @Test
  public void testManySyncUpsWithLargeFile() throws Exception {
    // Setup
    LocalTransferSettings testConnection = (LocalTransferSettings) TestConfigUtil.createTestLocalConnection();   
    TestClient clientA = new TestClient("A", testConnection);
    TestClient clientB = new TestClient("B", testConnection);
   
    // Cause Cleanup with a moderately large file
    for (int i=1; i<=16; i++) {
View Full Code Here

public class Issue227_2_ScenarioTest {
  @Test
  public void testIssue227_MOM() throws Exception {
    // Setup
    LocalTransferSettings testConnection = (LocalTransferSettings) TestConfigUtil.createTestLocalConnection();

    TestClient clientIH = new TestClient("iH", testConnection);
    TestClient clientMOM = new TestClient("MOM", testConnection);
    TestClient clientHSE = new TestClient("hSE", testConnection);

    UpOperationOptions upOptionsWithForce = new UpOperationOptions();
    upOptionsWithForce.setForceUploadEnabled(true);

    clientIH.createNewFile("file1.jpg");
    clientIH.up();

    clientIH.createNewFile("file2.jpg");
    clientIH.up();

    clientMOM.down();
    clientHSE.down();

    // -

    clientMOM.createNewFile("file3.jpg");
    clientMOM.up();

    clientMOM.createNewFile("file4.jpg");
    clientMOM.up();

    clientIH.down();
    clientHSE.down();

    // All in sync

    /*
     * We want to create a time difference situation here between different clients.
     *
     * In reality:
     * - Client "hSE" uploads a new database AFTER client "MOM"
     *
     * In this test:
     * 1. Client "hSE" uploads a new database BEFORE client "MOM"
     * 2. We hide "hSE"'s database by moving it to a temp. file
     *    // ...
     * 5. When we do 'down' at client "IH", the databases of client "MOM" are considered DIRTY
     *
     */

    // 1. Upload new database for hSE
    clientHSE.createNewFile("fileHSE-1.jpg");
    clientHSE.up(upOptionsWithForce);

    File[] hSEDatabaseFiles = new File(testConnection.getPath() + "/databases/").listFiles(new FilenameFilter() {
      public boolean accept(File dir, String name) {
        return name.contains("hSE");
      }
    });

View Full Code Here

  }

  @Test
  public void testIssue227_IH() throws Exception {
    // Setup
    LocalTransferSettings testConnection = (LocalTransferSettings) TestConfigUtil.createTestLocalConnection();

    TestClient clientIH = new TestClient("iH", testConnection);
    TestClient clientMOM = new TestClient("MOM", testConnection);
    TestClient clientHSE = new TestClient("hSE", testConnection);
    TestClient clientMee = new TestClient("Mee", testConnection);

    UpOperationOptions upOptionsWithForce = new UpOperationOptions();
    upOptionsWithForce.setForceUploadEnabled(true);

    clientIH.createNewFile("file1.jpg");
    clientIH.up();

    clientIH.createNewFile("file2.jpg");
    clientIH.up();

    clientMOM.down();
    clientHSE.down();

    // -

    clientMOM.createNewFile("file3.jpg");
    clientMOM.up();

    clientMOM.createNewFile("file4.jpg");
    clientMOM.up();

    clientIH.down();
    clientHSE.down();

    // All in sync

    /*
     * We want to create a time difference situation here between different clients.
     *
     * In reality:
     * - Client "hSE" uploads a new database AFTER client "MOM"
     *
     * In this test:
     * 1. Client "hSE" uploads a new database BEFORE client "MOM"
     * 2. We hide "hSE"'s database by moving it to a temp. file
     *    // ...
     * 5. When we do 'down' at client "IH", the databases of client "MOM" are considered DIRTY
     *
     */

    // 1. Upload new database for hSE
    clientHSE.createNewFile("fileHSE-1.jpg");
    clientHSE.up(upOptionsWithForce);

    File[] hSEDatabaseFiles = new File(testConnection.getPath() + "/databases/").listFiles(new FilenameFilter() {
      public boolean accept(File dir, String name) {
        return name.contains("hSE");
      }
    });

View Full Code Here


  @Test
  public void testIssue227_multiple_resolve() throws Exception {
    // Setup
    LocalTransferSettings testConnection = (LocalTransferSettings) TestConfigUtil.createTestLocalConnection();

    TestClient clientIH = new TestClient("iH", testConnection);
    TestClient clientMOM = new TestClient("MOM", testConnection);
    TestClient clientHSE = new TestClient("hSE", testConnection);
    TestClient clientMee = new TestClient("Mee", testConnection);
    TestClient clientIHtwo = new TestClient("IHtwo", testConnection);

    UpOperationOptions upOptionsWithForce = new UpOperationOptions();
    upOptionsWithForce.setForceUploadEnabled(true);

    clientIH.createNewFile("file1.jpg");
    clientIH.up();

    clientIH.createNewFile("file2.jpg");
    clientIH.up();

    clientMOM.down();
    clientHSE.down();

    // -

    clientMOM.createNewFile("file3.jpg");
    clientMOM.up();

    clientMOM.createNewFile("file4.jpg");
    clientMOM.up();

    clientIH.down();
    clientIHtwo.down();
    clientHSE.down();

    // All in sync

    /*
     * We want to create a time difference situation here between different clients.
     *
     * In reality:
     * - Client "hSE" uploads a new database AFTER client "MOM"
     *
     * In this test:
     * 1. Client "hSE" uploads a new database BEFORE client "MOM"
     * 2. We hide "hSE"'s database by moving it to a temp. file
     *    // ...
     * 5. When we do 'down' at client "IH", the databases of client "MOM" are considered DIRTY
     *
     */

    // 1. Upload new database for hSE
    clientHSE.createNewFile("fileHSE-1.jpg");
    clientHSE.up(upOptionsWithForce);

    File[] hSEDatabaseFiles = new File(testConnection.getPath() + "/databases/").listFiles(new FilenameFilter() {
      public boolean accept(File dir, String name) {
        return name.contains("hSE");
      }
    });

View Full Code Here

TOP

Related Classes of org.syncany.plugins.local.LocalTransferSettings

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.