Node n2 = (Node) s2.getItem(n1.getPath());
//log.println("---------------------------------------");
String phase="init";
Version v1_1 = n1.getBaseVersion();
Version v2_1 = n2.getBaseVersion();
check(v1_1, phase, "jcr:rootVersion", 0);
check(v2_1, phase, "jcr:rootVersion", 0);
//log.println("--------checkout/checkin n1 (uncommitted)----------");
phase="checkin N1 uncomitted.";
UserTransaction tx = new UserTransactionImpl(s1);
tx.begin();
n1.checkout();
n1.checkin();
Version v1_2 = n1.getBaseVersion();
check(v1_1, phase, "jcr:rootVersion", 1);
check(v2_1, phase, "jcr:rootVersion", 0);
check(v1_2, phase, "1.0", 0);
//log.println("--------checkout/checkin n1 (comitted)----------");
phase="checkin N1 committed.";
tx.commit();
check(v1_1, phase, "jcr:rootVersion", 1);
check(v2_1, phase, "jcr:rootVersion", 1);
check(v1_2, phase, "1.0", 0);
//log.println("--------restore n2 (uncommitted) ----------");
phase="restore N2 uncommitted.";
tx = new UserTransactionImpl(s2);
tx.begin();
n2.restore("1.0", false);
Version v2_2 = n2.getBaseVersion();
check(v1_1, phase, "jcr:rootVersion", 1);
check(v2_1, phase, "jcr:rootVersion", 1);
check(v1_2, phase, "1.0", 0);
check(v2_2, phase, "1.0", 0);
//log.println("--------restore n2 (comitted) ----------");
phase="restore N2 committed.";
tx.commit();
check(v1_1, phase, "jcr:rootVersion", 1);
check(v2_1, phase, "jcr:rootVersion", 1);
check(v1_2, phase, "1.0", 0);
check(v2_2, phase, "1.0", 0);
//log.println("--------checkout/checkin n2 (uncommitted) ----------");
phase="checkin N2 uncommitted.";
tx = new UserTransactionImpl(s2);
tx.begin();
n2.checkout();
n2.checkin();
Version v2_3 = n2.getBaseVersion();
check(v1_1, phase, "jcr:rootVersion", 1);
check(v2_1, phase, "jcr:rootVersion", 1);
check(v1_2, phase, "1.0", 0);
check(v2_2, phase, "1.0", 1);
check(v2_3, phase, "1.1", 0);
//log.println("--------checkout/checkin n2 (committed) ----------");
phase="checkin N2 committed.";
tx.commit();
check(v1_1, phase, "jcr:rootVersion", 1);
check(v2_1, phase, "jcr:rootVersion", 1);
check(v1_2, phase, "1.0", 1);
check(v2_2, phase, "1.0", 1);
check(v2_3, phase, "1.1", 0);
//log.println("--------checkout/checkin n1 (uncommitted) ----------");
phase="checkin N1 uncommitted.";
tx = new UserTransactionImpl(s1);
tx.begin();
n1.checkout();
n1.checkin();
Version v1_3 = n1.getBaseVersion();
check(v1_1, phase, "jcr:rootVersion", 1);
check(v2_1, phase, "jcr:rootVersion", 1);
check(v1_2, phase, "1.0", 2);
check(v2_2, phase, "1.0", 1);