Search in sources :

Example 11 with DatabaseBranches

use of org.syncany.operations.down.DatabaseBranches in project syncany by syncany.

the class DatabaseReconciliatorTest method testOneLocalVersionDetermineLastCommon.

@Test
public void testOneLocalVersionDetermineLastCommon() throws Exception {
    /* Scenario: The local machine ("C") has only one local database version
		 */
    /// Input data ///
    String localMachineName = "C";
    DatabaseVersionHeader currentLocalVersion = TestDatabaseUtil.createFromString("A/(A1)/T=1376074225169");
    DatabaseBranches allBranches = new DatabaseBranches();
    allBranches.put("A", TestDatabaseUtil.createBranch(new String[] { "A/(A1)/T=1376074225169", "A/(A2)/T=1376074225230" }));
    allBranches.put("C", TestDatabaseUtil.createBranch(new String[] { "A/(A1)/T=1376074225169" }));
    /// Expected results ///
    TestResult expectedTestResult = new TestResult();
    expectedTestResult.winnersLastDatabaseVersionHeader = TestDatabaseUtil.createMapWithMachineKey(new String[] { "A", "A/(A2)/T=1376074225230" }).firstEntry();
    /// Perform test ///
    testFromMachinePerspective(localMachineName, currentLocalVersion, allBranches, expectedTestResult);
}
Also used : DatabaseVersionHeader(org.syncany.database.DatabaseVersionHeader) DatabaseBranches(org.syncany.operations.down.DatabaseBranches) Test(org.junit.Test)

Example 12 with DatabaseBranches

use of org.syncany.operations.down.DatabaseBranches in project syncany by syncany.

the class DatabaseReconciliatorTest method testUpdateDetectorConflict3AtMachineC.

@Test
public void testUpdateDetectorConflict3AtMachineC() throws Exception {
    System.out.println("CONFLICT 3");
    System.out.println("----------------");
    /// Input data ///
    String localMachineName = "C";
    DatabaseVersionHeader currentLocalVersion = null;
    DatabaseBranches allBranches = new DatabaseBranches();
    // A
    allBranches.put("A", TestDatabaseUtil.createBranch(new String[] { "A/(A1,C4)/T=8", "A/(A2,C4)/T=9", "A/(A3,C4)/T=10" }));
    // B
    allBranches.put("B", TestDatabaseUtil.createBranch(new String[] { "B/(B1,C3)/T=7" }));
    // C
    allBranches.put("C", TestDatabaseUtil.createBranch(new String[] { "C/(C1)/T=1", "C/(C2)/T=2", "C/(C3)/T=3", "C/(C4)/T=5" }));
    /// Expected results ///x
    TestResult expectedTestResult = new TestResult();
    expectedTestResult.winnersLastDatabaseVersionHeader = TestDatabaseUtil.createMapWithMachineKey(new String[] { "A", "A/(A3,C4)/T=10" }).firstEntry();
    /// Perform test ///
    testFromMachinePerspective(localMachineName, currentLocalVersion, allBranches, expectedTestResult);
}
Also used : DatabaseVersionHeader(org.syncany.database.DatabaseVersionHeader) DatabaseBranches(org.syncany.operations.down.DatabaseBranches) Test(org.junit.Test)

Example 13 with DatabaseBranches

use of org.syncany.operations.down.DatabaseBranches in project syncany by syncany.

the class DatabaseReconciliatorTest method testStitchBranchesIssue226ConflictingVCsInOneBranch.

@Test
public void testStitchBranchesIssue226ConflictingVCsInOneBranch() throws Exception {
    Logging.init();
    /// Input data ///
    String localMachineName = "ZA";
    DatabaseVersionHeader currentLocalVersion = null;
    DatabaseBranches allBranches = new DatabaseBranches();
    // ZA
    allBranches.put("ZA", TestDatabaseUtil.createBranch(new String[] { /*	"WG/(WG2)/T=1417598306794",
					"jR/(WG2,jR1)/T=1417598308654",
					"WG/(WG3,jR1)/T=1417598309554",
					"oq/(WG3,jR1,oq2)/T=1417598310488",
					"WG/(WG4,jR1,oq2)/T=1417598311995",
					"oq/(WG4,jR1,oq3)/T=1417598313779",
					"jR/(WG4,jR2,oq3)/T=1417598314162",*/
    "ZA/(WG4,ZA1,jR2,oq3)/T=1417598314796", "ZA/(WG4,ZA2,jR2,oq3)/T=1417598316388" }));
    // WG
    allBranches.put("WG", TestDatabaseUtil.createBranch(new String[] { "WG/(WG5,ZA2,jR2,oq3)/T=1417598319102", "WG/(WG6,ZA2,jR5,oq4)/T=1417598321850" }));
    // jR
    allBranches.put("jR", TestDatabaseUtil.createBranch(new String[] { "jR/(WG5,ZA2,jR4,oq3)/T=1417598319954", "jR/(WG5,ZA2,jR5,oq4)/T=1417598320743" }));
    // oq
    allBranches.put("oq", TestDatabaseUtil.createBranch(new String[] { "oq/(WG5,ZA2,jR2,oq4)/T=1417598319900" }));
    /// Expected results ///
    TestResult expectedTestResult = new TestResult();
    expectedTestResult.winnersLastDatabaseVersionHeader = TestDatabaseUtil.createMapWithMachineKey(new String[] { "WG", "WG/(WG6,ZA2,jR5,oq4)/T=1417598321850" }).firstEntry();
    /// Perform test ///
    testFromMachinePerspective(localMachineName, currentLocalVersion, allBranches, expectedTestResult);
}
Also used : DatabaseVersionHeader(org.syncany.database.DatabaseVersionHeader) DatabaseBranches(org.syncany.operations.down.DatabaseBranches) Test(org.junit.Test)

Example 14 with DatabaseBranches

use of org.syncany.operations.down.DatabaseBranches in project syncany by syncany.

the class DatabaseReconciliatorTest method testUpdateDetectorConflict7AtMachineC.

@Test
public void testUpdateDetectorConflict7AtMachineC() throws Exception {
    System.out.println("CONFLICT 7");
    System.out.println("----------------");
    /// Input data ///
    String localMachineName = "C";
    DatabaseVersionHeader currentLocalVersion = null;
    DatabaseBranches allBranches = new DatabaseBranches();
    // B
    allBranches.put("B", TestDatabaseUtil.createBranch(new String[] { "C/(C1)/T=1", "C/(C2)/T=2", "C/(C3)/T=3", "C/(C4)/T=5", "A/(A1,C4)/T=8", "A/(A2,C4)/T=9", "A/(A3,C4)/T=10", "A/(A3,B2,C4)/T=16", "A/(A3,B3,C4)/T=17", // db-b-4
    "A/(A3,B4,C4)/T=18", // db-b-5
    "A/(A3,B5,C4)/T=20", // db-b-6
    "B/(A3,B6,C4)/T=23" }));
    // C
    allBranches.put("C", TestDatabaseUtil.createBranch(new String[] { "C/(C1)/T=1", "C/(C2)/T=2", "C/(C3)/T=3", "C/(C4)/T=5", "A/(A1,C4)/T=8", "A/(A2,C4)/T=9", "A/(A3,C4)/T=10", "A/(A4,C4)/T=11", "A/(A5,C4)/T=12", "A/(A6,C4)/T=19", "C/(A6,C9)/T=22" }));
    /// Expected results ///
    TestResult expectedTestResult = new TestResult();
    expectedTestResult.winnersLastDatabaseVersionHeader = TestDatabaseUtil.createMapWithMachineKey(new String[] { "C", "C/(A6,C9)/T=22" }).firstEntry();
    /// Perform test ///
    testFromMachinePerspective(localMachineName, currentLocalVersion, allBranches, expectedTestResult);
}
Also used : DatabaseVersionHeader(org.syncany.database.DatabaseVersionHeader) DatabaseBranches(org.syncany.operations.down.DatabaseBranches) Test(org.junit.Test)

Aggregations

DatabaseVersionHeader (org.syncany.database.DatabaseVersionHeader)14 DatabaseBranches (org.syncany.operations.down.DatabaseBranches)14 Test (org.junit.Test)13 AbstractMap (java.util.AbstractMap)1 DatabaseBranch (org.syncany.operations.down.DatabaseBranch)1 DatabaseReconciliator (org.syncany.operations.down.DatabaseReconciliator)1