Skip to main content
summaryrefslogtreecommitdiffstats
blob: 7c828d61993f45e52a0f9d71b491fcb592c7883a (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
58
59
60
61
/**
 * Copyright (c) 2004 - 2011 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:
 *     Martin Fluegge - initial API and implementation
 */
package org.eclipse.emf.cdo.tests.bugzilla;

import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.tests.AbstractCDOTest;
import org.eclipse.emf.cdo.tests.config.IModelConfig;
import org.eclipse.emf.cdo.tests.model1.OrderDetail;
import org.eclipse.emf.cdo.tests.model1.Product1;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.util.CDOUtil;

import org.eclipse.emf.ecore.resource.Resource;

/**
 * @author Martin Fluegge
 */
public class Bugzilla_329753_Test extends AbstractCDOTest
{
  @Requires(IModelConfig.CAPABILITY_LEGACY)
  public void testIncreasingVersion() throws Exception
  {
    CDOSession session = openSession();
    CDOTransaction transaction = session.openTransaction();

    OrderDetail orderDetail = getModel1Factory().createOrderDetail();

    Product1 product1 = getModel1Factory().createProduct1();
    orderDetail.setProduct(product1);

    String path = "/test";
    Resource resource = transaction.createResource(getResourcePath(path));
    resource.getContents().add(orderDetail);
    resource.getContents().add(product1);

    transaction.commit();

    CDOObject cdoObject = CDOUtil.getCDOObject(orderDetail);
    CDORevision cdoRevision1 = cdoObject.cdoRevision();

    int version1 = cdoRevision1.getVersion();

    orderDetail.setProduct(product1);

    transaction.commit();

    CDORevision cdoRevision2 = cdoObject.cdoRevision();
    int version2 = cdoRevision2.getVersion();
    assertEquals(version1, version2);
  }
}

Back to the top