Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 613796eb3cbe37493c747db6822253b22e720c12 (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
/*
 * Copyright (c) 2012 Eike Stepper (Loehne, 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.eresource.CDOResource;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.tests.AbstractCDOTest;
import org.eclipse.emf.cdo.tests.model6.BaseObject;
import org.eclipse.emf.cdo.tests.model6.Root;
import org.eclipse.emf.cdo.transaction.CDOTransaction;

/**
 * @author Esteban Dugueperoux
 */
public class Bugzilla_374418_Test extends AbstractCDOTest
{
  public void testControlUncontrol() throws Throwable
  {
    Root root = getModel6Factory().createRoot();
    BaseObject childRoot = getModel6Factory().createBaseObject();
    childRoot.setAttributeRequired("test");
    root.getListA().add(childRoot);

    CDOSession session = openSession();
    CDOTransaction transaction = session.openTransaction();
    CDOResource mainResource = transaction.createResource(getResourcePath("/mainResource.model1"));
    mainResource.getContents().add(root);
    transaction.commit();

    // Control childRoot to a new resource
    CDOResource fragmentResource = transaction.createResource(getResourcePath("/fragmentResource.model1"));
    fragmentResource.getContents().add(childRoot);
    transaction.commit();

    // Uncontrol category1 to its original resource
    fragmentResource.getContents().remove(childRoot);
    transaction.setSavepoint(); // <---- Problem here!!!
    transaction.commit();

    // Control again childRoot to the new resource
    fragmentResource.getContents().add(childRoot);
    transaction.commit();
  }
}

Back to the top