Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 4bc4ca322d12f0413570dfd6a037dea031a02711 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * Copyright (c) 2014, 2015 Eike Stepper (Berlin, Germany) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Esteban Dugueperoux - initial API and implementation
 */
package org.eclipse.emf.cdo.tests.bugzilla;

import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.internal.net4j.protocol.CommitNotificationIndication;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.spi.common.revision.PointerCDORevision;
import org.eclipse.emf.cdo.tests.AbstractCDOTest;
import org.eclipse.emf.cdo.tests.config.IRepositoryConfig;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTest.CleanRepositoriesBefore;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTest.Requires;
import org.eclipse.emf.cdo.transaction.CDOTransaction;

/**
 * Test that {@link CommitNotificationIndication} {@link CDOCommitInfo} decoding with {@link PointerCDORevision} on branch.
 *
 * @author Esteban Dugueperoux
 */
@Requires(IRepositoryConfig.CAPABILITY_BRANCHING)
@CleanRepositoriesBefore(reason = "to not be disturb by branches created by others tests")
public class Bugzilla_449171_Test extends AbstractCDOTest
{
  private static final String RESOURCE_NAME = "test1.model1";

  public void testCommitNotificationIndicationCDOCommitInfoDecoding() throws Exception
  {
    CDOSession session1 = openSession();
    String subBranchName = "b1";
    CDOSession session2 = openSession();
    CDOTransaction txOfSession1 = session1.openTransaction();
    CDOResource resource = txOfSession1.getOrCreateResource(getResourcePath(RESOURCE_NAME));
    resource.getContents().add(getModel1Factory().createCompany());
    txOfSession1.commit();
    txOfSession1.close();
    session1.close();
    session1 = openSession();
    CDOBranch subBranch = session1.getBranchManager().getMainBranch().createBranch(subBranchName);
    txOfSession1 = session1.openTransaction(subBranch);
    resource = txOfSession1.getResource(getResourcePath(RESOURCE_NAME));
    resource.getContents().remove(0);

    CDOTransaction txOfSession2 = session2.openTransaction(subBranch);

    commitAndSync(txOfSession1, txOfSession2);
  }
}

Back to the top