diff options
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_259695_Test.java')
-rw-r--r-- | plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_259695_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_259695_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_259695_Test.java new file mode 100644 index 0000000000..cc5c4f0d44 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_259695_Test.java @@ -0,0 +1,57 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. + * 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: + * Simon McDuff - initial API and implementation + **************************************************************************/ +package org.eclipse.emf.cdo.tests.bugzilla; + +import org.eclipse.emf.cdo.CDOSession; +import org.eclipse.emf.cdo.CDOTransaction; +import org.eclipse.emf.cdo.eresource.CDOResource; +import org.eclipse.emf.cdo.tests.AbstractCDOTest; +import org.eclipse.emf.cdo.tests.model4.GenRefMapNonContained; +import org.eclipse.emf.cdo.tests.model4.GenRefSingleContained; + +import org.eclipse.emf.ecore.EObject; + +import java.util.ArrayList; +import java.util.List; + +/** + * ClassCastException on BasicEMap.clear + * + * @see https://bugs.eclipse.org/259695 + * @author Simon McDuff + */ +public class Bugzilla_259695_Test extends AbstractCDOTest +{ + public void testBugzilla_259695_ClassCast() throws InterruptedException + { + CDOSession session = openSession(); + session.getPackageRegistry().putEPackage(getModel4InterfacesPackage()); + session.getPackageRegistry().putEPackage(getModel4Package()); + + CDOTransaction transaction = session.openTransaction(); + + CDOResource resource1 = transaction.createResource("test1"); + + GenRefMapNonContained elementA = getModel4Factory().createGenRefMapNonContained(); + resource1.getContents().add(elementA); + List<EObject> expectedValue = new ArrayList<EObject>(); + for (int i = 0; i < 10; i++) + { + GenRefSingleContained value = getModel4Factory().createGenRefSingleContained(); + elementA.getElements().put(String.valueOf(i), value); + resource1.getContents().add(value); + expectedValue.add(value); + } + elementA.getElements().clear(); + transaction.commit(); + } + +} |