diff options
author | Eike Stepper | 2016-04-17 05:00:14 +0000 |
---|---|---|
committer | Eike Stepper | 2016-04-17 05:00:14 +0000 |
commit | 5890a16b29787b4f04988fc1a30587eefc29e3c8 (patch) | |
tree | a7e3a29d77436942c0de34109c703eb73e33451a /plugins/org.eclipse.emf.cdo.tests/src | |
parent | bb06d61bf76e5be079ef500a33ce9c74ff998a7d (diff) | |
download | cdo-5890a16b29787b4f04988fc1a30587eefc29e3c8.tar.gz cdo-5890a16b29787b4f04988fc1a30587eefc29e3c8.tar.xz cdo-5890a16b29787b4f04988fc1a30587eefc29e3c8.zip |
[491499] CDOTransaction.postCommit fails to resolve direct resource
https://bugs.eclipse.org/bugs/show_bug.cgi?id=491499
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.tests/src')
-rw-r--r-- | plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_491499_Test.java | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_491499_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_491499_Test.java new file mode 100644 index 0000000000..5152872acb --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_491499_Test.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2016 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: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.tests.bugzilla; + +import org.eclipse.emf.cdo.CDOObject; +import org.eclipse.emf.cdo.CDOState; +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.transaction.CDOTransaction; +import org.eclipse.emf.cdo.view.CDOObjectHandler; +import org.eclipse.emf.cdo.view.CDOView; + +/** + * Bug 491499 - CDOTransaction.postCommit fails to resolve direct resource + * + * @author Eike Stepper + */ +public class Bugzilla_491499_Test extends AbstractCDOTest +{ + public void testObjectOrderWithObjectHandler() throws Exception + { + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + + CDOResource resource1 = transaction.createResource(getResourcePath("res1")); + for (int i = 0; i < 5000; i++) + { + resource1.getContents().add(getModel1Factory().createCompany()); + } + + CDOResource resource2 = transaction.createResource(getResourcePath("res2")); + resource2.getContents().addAll(resource1.getContents()); + + transaction.addObjectHandler(new CDOObjectHandler() + { + public void objectStateChanged(CDOView view, CDOObject object, CDOState oldState, CDOState newState) + { + if (newState == CDOState.CLEAN || newState == CDOState.NEW) + { + // Can lead to exception if not all committed objects are remapped! + object.cdoResource(); + } + } + }); + + transaction.commit(); + } +} |