Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Fluegge2010-09-14 18:04:13 +0000
committerMartin Fluegge2010-09-14 18:04:13 +0000
commit365cb3483fdf00738cc4d07afc2d79ce69dad7a7 (patch)
tree2beea1c67f66ef19602f428bd00c6dfd15323bb2
parent9ce7e66fa1f7df3c679afa722bfc329b62785073 (diff)
downloadcdo-365cb3483fdf00738cc4d07afc2d79ce69dad7a7.tar.gz
cdo-365cb3483fdf00738cc4d07afc2d79ce69dad7a7.tar.xz
cdo-365cb3483fdf00738cc4d07afc2d79ce69dad7a7.zip
[314186] Mismatch between CDO_RESOURCE__RESOURCE_SET and RESOURCE__RESOURCE_SET
https://bugs.eclipse.org/bugs/show_bug.cgi?id=314186
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_314186_Test.java72
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java32
3 files changed, 106 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java
index c9a4345731..ad86a649b5 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java
@@ -75,6 +75,7 @@ import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_306710_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_306998_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_308895_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_310574_Test;
+import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_314186_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_314264_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_316145_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_316434_Test;
@@ -235,6 +236,7 @@ public abstract class AllConfigs extends ConfigTestSuite
testClasses.add(Bugzilla_308895_Test.class);
testClasses.add(Bugzilla_310574_Test.class);
// testClasses.add(Bugzilla_313326_Test.class);
+ testClasses.add(Bugzilla_314186_Test.class);
testClasses.add(Bugzilla_314264_Test.class);
testClasses.add(Bugzilla_316145_Test.class);
// testClasses.add(Bugzilla_316887_Test.class); // The test logic is buggy
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_314186_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_314186_Test.java
new file mode 100644
index 0000000000..f16c7f42d2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_314186_Test.java
@@ -0,0 +1,72 @@
+/**
+ * Copyright (c) 2004 - 2010 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.eresource.CDOResource;
+import org.eclipse.emf.cdo.eresource.EresourcePackage;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.tests.AbstractCDOTest;
+import org.eclipse.emf.cdo.tests.mango.MangoValue;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+
+/**
+ * @author Martin Fluegge
+ */
+public class Bugzilla_314186_Test extends AbstractCDOTest
+{
+ public void testEMFCompliance() throws Exception
+ {
+ CDOSession session = openSession();
+ ResourceSet resourceSet = new ResourceSetImpl();
+
+ CDOTransaction transaction = session.openTransaction(resourceSet);
+ CDOResource resource = transaction.createResource("/resource");
+
+ resource.eAdapters().add(new Adapter()
+ {
+ public void setTarget(Notifier newTarget)
+ {
+ }
+
+ public void notifyChanged(Notification notification)
+ {
+ if (notification.getFeature() != null
+ && notification.getFeature().equals(EresourcePackage.eINSTANCE.getCDOResource_ResourceSet()))
+ {
+ assertEquals(Resource.RESOURCE__RESOURCE_SET, notification.getFeatureID(Resource.class));
+ }
+ }
+
+ public boolean isAdapterForType(Object type)
+ {
+ return false;
+ }
+
+ public Notifier getTarget()
+ {
+ return null;
+ }
+ });
+
+ MangoValue mangoValue = getMangoFactory().createMangoValue();
+ resource.getContents().add(mangoValue);
+
+ transaction.commit();
+ session.close();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java
index c44aa4d122..ceb770b4ff 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java
@@ -186,6 +186,38 @@ public class CDOResourceImpl extends CDOResourceNodeImpl implements CDOResource,
return super.eDirectResource();
}
+ @Override
+ public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == CDOResource.class)
+ {
+ return baseFeatureID;
+ }
+
+ if (baseClass == Resource.class)
+ {
+ return baseFeatureID + EresourcePackage.CDO_RESOURCE_NODE_FEATURE_COUNT;
+ }
+
+ return super.eBaseStructuralFeatureID(baseFeatureID, baseClass);
+ }
+
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == CDOResource.class)
+ {
+ return derivedFeatureID;
+ }
+
+ if (baseClass == Resource.class)
+ {
+ return derivedFeatureID - EresourcePackage.CDO_RESOURCE_NODE_FEATURE_COUNT;
+ }
+
+ return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
+ }
+
/**
* @since 2.0
*/

Back to the top