use of org.syncany.operations.down.DatabaseBranches in project syncany by syncany.
the class DatabaseReconciliatorTest method testUpdateDetectorConflict5AtMachineA.
@Test
public void testUpdateDetectorConflict5AtMachineA() throws Exception {
System.out.println("CONFLICT 5");
System.out.println("----------------");
/// Input data ///
String localMachineName = "A";
DatabaseVersionHeader currentLocalVersion = null;
DatabaseBranches allBranches = new DatabaseBranches();
// A
allBranches.put("A", 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" }));
// B
allBranches.put("B", TestDatabaseUtil.createBranch(new String[] { "B/(A3,B2,C4)/T=16", "B/(A3,B3,C4)/T=17", // db-b-4
"B/(A3,B4,C4)/T=18", // db-b-5
"B/(A3,B5,C4)/T=20" }));
// C
allBranches.put("C", TestDatabaseUtil.createBranch(new String[] { // db-c-5
"C/(A3,C5)/T=13", "C/(A3,C6)/T=14", // db-c-7
"C/(A3,C7)/T=15", // db-c-8
"C/(A3,C8)/T=21" }));
/// Expected results ///
TestResult expectedTestResult = new TestResult();
expectedTestResult.winnersLastDatabaseVersionHeader = TestDatabaseUtil.createMapWithMachineKey(new String[] { "A", "A/(A6,C4)/T=19" }).firstEntry();
/// Perform test ///
testFromMachinePerspective(localMachineName, currentLocalVersion, allBranches, expectedTestResult);
}
use of org.syncany.operations.down.DatabaseBranches in project syncany by syncany.
the class DatabaseReconciliatorTest method testUpdateDetectorConflict4AtMachineB.
@Test
public void testUpdateDetectorConflict4AtMachineB() throws Exception {
System.out.println("CONFLICT 4");
System.out.println("----------------");
/// Input data ///
String localMachineName = "B";
DatabaseVersionHeader currentLocalVersion = null;
DatabaseBranches allBranches = new DatabaseBranches();
// A
allBranches.put("A", TestDatabaseUtil.createBranch(new String[] { "A/(A4,C4)/T=11", // db-a-5
"A/(A5,C4)/T=12", // db-a-6
"A/(A6,C4)/T=19" }));
// 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", "B/(A3,B2,C4)/T=16", "B/(A3,B3,C4)/T=17", "B/(A3,B4,C4)/T=18", "B/(A3,B5,C4)/T=20" }));
// C
allBranches.put("C", TestDatabaseUtil.createBranch(new String[] { // db-c-5
"C/(A3,C5)/T=13", "C/(A3,C6)/T=14", // db-c-7
"C/(A3,C7)/T=15", // db-c-8
"C/(A3,C8)/T=21" }));
/// Expected results ///
TestResult expectedTestResult = new TestResult();
expectedTestResult.winnersLastDatabaseVersionHeader = TestDatabaseUtil.createMapWithMachineKey(new String[] { "A", "A/(A6,C4)/T=19" }).firstEntry();
/// Perform test ///
testFromMachinePerspective(localMachineName, currentLocalVersion, allBranches, expectedTestResult);
}
use of org.syncany.operations.down.DatabaseBranches in project syncany by syncany.
the class DatabaseReconciliatorTest method testTwoWinningVersionsWithSameTimestamp.
@Test
public void testTwoWinningVersionsWithSameTimestamp() throws Exception {
/* Scenario: Three clients, to conflicting DBVs with the same timestamp
* --> A should win over B (alphabetical order)
*/
Logging.init();
/// Input data ///
String localMachineName = "C";
DatabaseVersionHeader currentLocalVersion = TestDatabaseUtil.createFromString("A/(A2)/T=1376074225230");
DatabaseBranches allBranches = new DatabaseBranches();
allBranches.put("A", TestDatabaseUtil.createBranch(new String[] { "A/(A1)/T=1376074225169", "A/(A2)/T=1376074225230", "A/(A3)/T=1376074225256", // Conflicts with A -> A3,B1; also: SAME timestamp!
"A/(A4)/T=9999999999999" }));
allBranches.put("B", TestDatabaseUtil.createBranch(new String[] { // Conflicts with B -> A4; also: SAME timestamp!
"B/(A3,B1)/T=9999999999999" }));
allBranches.put("C", TestDatabaseUtil.createBranch(new String[] { "A/(A1)/T=1376074225169", "A/(A2)/T=1376074225230" }));
/// Expected results ///
TestResult expectedTestResult = new TestResult();
expectedTestResult.winnersLastDatabaseVersionHeader = TestDatabaseUtil.createMapWithMachineKey(new String[] { "A", "A/(A4)/T=9999999999999" }).firstEntry();
/// Perform test ///
testFromMachinePerspective(localMachineName, currentLocalVersion, allBranches, expectedTestResult);
}
use of org.syncany.operations.down.DatabaseBranches in project syncany by syncany.
the class DatabaseReconciliatorTest method testStitchBranchesIssue226CompleteBranchesWithDatabaseVersionHeaders.
@Test
public void testStitchBranchesIssue226CompleteBranchesWithDatabaseVersionHeaders() throws Exception {
Logging.init();
/// Input data ///
String localMachineName = "T";
DatabaseVersionHeader currentLocalVersion = null;
DatabaseBranches allBranches = new DatabaseBranches();
// T
allBranches.put("T", TestDatabaseUtil.createBranch(new String[] { "T/(T2,d5,k4,t7)/T=697013", // <<< Conflicts with k/(T2,d5,k28,t10)/T=772169
"T/(T3,d5,k24,t8)/T=760721", "T/(T3,d6,k44,t10)/T=822389", "T/(T4,d6,k44,t10)/T=824100" }));
// d
allBranches.put("d", TestDatabaseUtil.createBranch(new String[] { "d/(d1,t1)/T=684310", "d/(d2,t4)/T=687747", "d/(d3,k1,t4)/T=689077", "d/(d4,k1,t5)/T=692428", "d/(d5,k4,t7)/T=696655", "d/(T2,d6,k43,t10)/T=820561" }));
// k
allBranches.put("k", TestDatabaseUtil.createBranch(new String[] { "k/(d2,k1,t4)/T=688323", "k/(d4,k3,t5)/T=693134", "k/(d4,k4,t7)/T=696251", "k/(T2,d5,k5,t8)/T=701066", "k/(T2,d5,k6,t8)/T=703688", "k/(T2,d5,k7,t8)/T=707177", "k/(T2,d5,k8,t8)/T=709571", "k/(T2,d5,k9,t8)/T=712900", "k/(T2,d5,k10,t8)/T=716399", "k/(T2,d5,k11,t8)/T=719119", "k/(T2,d5,k12,t8)/T=722554", "k/(T2,d5,k13,t8)/T=724848", "k/(T2,d5,k14,t8)/T=728286", "k/(T2,d5,k15,t8)/T=731538", "k/(T2,d5,k16,t8)/T=734832", "k/(T2,d5,k17,t8)/T=738089", "k/(T2,d5,k18,t8)/T=740541", "k/(T2,d5,k19,t8)/T=743906", "k/(T2,d5,k20,t8)/T=747192", "k/(T2,d5,k21,t8)/T=750445", "k/(T2,d5,k22,t8)/T=752883", "k/(T2,d5,k23,t8)/T=756264", "k/(T2,d5,k24,t8)/T=759640", "k/(T2,d5,k25,t10)/T=762872", "k/(T2,d5,k26,t10)/T=765293", "k/(T2,d5,k27,t10)/T=768795", // <<< Conflicts with T/(T3,d5,k24,t8)/T=760721
"k/(T2,d5,k28,t10)/T=772169", "k/(T2,d5,k29,t10)/T=774593", "k/(T2,d5,k30,t10)/T=777935", "k/(T2,d5,k31,t10)/T=781320", "k/(T2,d5,k32,t10)/T=784670", "k/(T2,d5,k33,t10)/T=787138", "k/(T2,d5,k34,t10)/T=790501", "k/(T2,d5,k35,t10)/T=793760", "k/(T2,d5,k36,t10)/T=797117", "k/(T2,d5,k37,t10)/T=799638", "k/(T2,d5,k38,t10)/T=803046", "k/(T2,d5,k39,t10)/T=806357", "k/(T2,d5,k40,t10)/T=808699", "k/(T2,d5,k41,t10)/T=812166", "k/(T2,d5,k42,t10)/T=815182", "k/(T2,d5,k43,t10)/T=818604", "k/(T2,d6,k44,t10)/T=821185" }));
// t
allBranches.put("t", TestDatabaseUtil.createBranch(new String[] { "t/(d1,t3)/T=685357", "t/(d1,t4)/T=686957", "t/(d3,k1,t5)/T=690944", "t/(d4,k3,t6)/T=693534", "t/(d4,k3,t7)/T=696048", "t/(T2,d5,k4,t8)/T=700373", "t/(T2,d5,k24,t9)/T=760625", "t/(T2,d5,k24,t10)/T=762172" }));
/// Expected results ///
TestResult expectedTestResult = new TestResult();
expectedTestResult.winnersLastDatabaseVersionHeader = TestDatabaseUtil.createMapWithMachineKey(new String[] { "T", "T/(T4,d6,k44,t10)/T=824100" }).firstEntry();
/// Perform test ///
testFromMachinePerspective(localMachineName, currentLocalVersion, allBranches, expectedTestResult);
}
use of org.syncany.operations.down.DatabaseBranches in project syncany by syncany.
the class DatabaseReconciliatorTest method testUpdateDetectorConflict1AtMachineB.
@Test
public void testUpdateDetectorConflict1AtMachineB() throws Exception {
System.out.println("CONFLICT 1");
System.out.println("----------------");
/// Input data ///
String localMachineName = "B";
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[] { "C/(C1)/T=1", "C/(C2)/T=2", "C/(C3)/T=3", "B/(B1,C3)/T=7" }));
// C
allBranches.put("C", TestDatabaseUtil.createBranch(new String[] { "C/(C4)/T=5" }));
/// Expected results ///
TestResult expectedTestResult = new TestResult();
expectedTestResult.winnersLastDatabaseVersionHeader = TestDatabaseUtil.createMapWithMachineKey(new String[] { "A", "A/(A3,C4)/T=10" }).firstEntry();
/// Perform test ///
testFromMachinePerspective(localMachineName, currentLocalVersion, allBranches, expectedTestResult);
}
Aggregations