diff options
author | Eike Stepper | 2011-11-10 12:14:05 +0000 |
---|---|---|
committer | Eike Stepper | 2011-11-10 12:14:05 +0000 |
commit | d5aed7d307356951ee772ccad6e29f6d24816237 (patch) | |
tree | 822100aee56ce31335681c5cbb8d2b9468fde4a4 | |
parent | b0a0f5730fc52573b1c16d4929aea1cf40f59122 (diff) | |
download | cdo-d5aed7d307356951ee772ccad6e29f6d24816237.tar.gz cdo-d5aed7d307356951ee772ccad6e29f6d24816237.tar.xz cdo-d5aed7d307356951ee772ccad6e29f6d24816237.zip |
[363287] CDODeltaNotification.getOldValue() returns a CDOIDObjectLongImpl on remotely detached CDOObject
https://bugs.eclipse.org/bugs/show_bug.cgi?id=363287
3 files changed, 69 insertions, 1 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 192cc30118..a1dfd475f3 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 @@ -245,5 +245,6 @@ public abstract class AllConfigs extends ConfigTestSuite testClasses.add(Bugzilla_357441_Test.class); testClasses.add(Bugzilla_359669_Test.class); testClasses.add(Bugzilla_359992_Test.class); + testClasses.add(Bugzilla_363287_Test.class); } } diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_363287_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_363287_Test.java new file mode 100644 index 0000000000..fb5cd1425e --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_363287_Test.java @@ -0,0 +1,67 @@ +/* + * 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: + * Eike Stepper - initial API and implementation + * Simon McDuff - maintenance + */ +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.model1.Company; +import org.eclipse.emf.cdo.tests.util.TestAdapter; +import org.eclipse.emf.cdo.transaction.CDOTransaction; +import org.eclipse.emf.cdo.view.CDOAdapterPolicy; +import org.eclipse.emf.cdo.view.CDOView; + +/** + * @author Eike Stepper + */ +public class Bugzilla_363287_Test extends AbstractCDOTest +{ + public void testDetach() throws Exception + { + Company company = getModel1Factory().createCompany(); + + CDOSession session1 = openSession(); + CDOTransaction transaction = session1.openTransaction(); + CDOResource resource1 = transaction.createResource(getResourcePath("/test1")); + + resource1.getContents().add(company); + transaction.commit(); + + // ************************************************************* // + + CDOSession session2 = openSession(); + CDOView view = session2.openTransaction(); + view.options().addChangeSubscriptionPolicy(CDOAdapterPolicy.ALL); + + CDOResource resource2 = view.getResource(getResourcePath("/test1")); + + final TestAdapter testAdapter = new TestAdapter(); + resource2.eAdapters().add(testAdapter); + + // ************************************************************* // + + resource1.getContents().remove(0); + transaction.commit(); + + new PollingTimeOuter() + { + @Override + protected boolean successful() + { + return testAdapter.getNotifications().length == 1; + } + }.assertNoTimeOut(); + + Object oldValue = testAdapter.getNotifications()[0].getOldValue(); + assertNull(oldValue); + } +} diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDODeltaNotificationImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDODeltaNotificationImpl.java index 1ad4e443f7..86b6a3c3d2 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDODeltaNotificationImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDODeltaNotificationImpl.java @@ -93,7 +93,7 @@ public class CDODeltaNotificationImpl extends ENotificationImpl implements CDODe } catch (ObjectNotFoundException ex) { - // Do nothing + object = null; } } |