Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEsteban Dugueperoux2014-12-04 08:55:11 +0000
committerEsteban Dugueperoux2014-12-04 08:55:11 +0000
commitb50f4b0b335bd35f271d19c8a9d2c45eb13a78bc (patch)
treee74085a45934c1900848b25e1792bcfd32d1e267 /plugins
parent7d0171987a44a0ef5cbdcaeb11a5414d23fb3dd9 (diff)
downloadcdo-b50f4b0b335bd35f271d19c8a9d2c45eb13a78bc.tar.gz
cdo-b50f4b0b335bd35f271d19c8a9d2c45eb13a78bc.tar.xz
cdo-b50f4b0b335bd35f271d19c8a9d2c45eb13a78bc.zip
[435198] Add a test to Bugzilla_435198_Test on
AbstractCDOView.getObject() call with a CDOResource's id This will allow to close https://bugs.eclipse.org/bugs/show_bug.cgi?id=306216 Change-Id: If8197adb8617f2129db8d4f0bfcd235b5d907ec4 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=435198 Signed-off-by: Esteban Dugueperoux <esteban.dugueperoux@obeo.fr>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_435198_Test.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_435198_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_435198_Test.java
index d187d1a670..411bb7dffe 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_435198_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_435198_Test.java
@@ -22,6 +22,8 @@ import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.junit.Assert;
+
import javax.annotation.Resource;
/**
@@ -36,6 +38,8 @@ public class Bugzilla_435198_Test extends AbstractCDOTest
private CDOID companyID;
+ private CDOID resourceCDOID;
+
@Override
public void setUp() throws Exception
{
@@ -46,6 +50,7 @@ public class Bugzilla_435198_Test extends AbstractCDOTest
CDOResource resource = transaction.getOrCreateResource(getResourcePath(RESOURCE_NAME));
resource.getContents().add(getModel1Factory().createCompany());
transaction.commit();
+ resourceCDOID = resource.cdoID();
companyID = CDOUtil.getCDOObject(resource.getContents().get(0)).cdoID();
}
@@ -64,6 +69,23 @@ public class Bugzilla_435198_Test extends AbstractCDOTest
}
/**
+ * Test the simple working case, a {@link CDOView#getObject(CDOID)} with a CDOResource's id call add the {@link Resource} to the {@link ResourceSet}.
+ */
+ public void testAbstractCDOView_GetObjectWithCDOResourceId_ResourceSetAddition() throws Exception
+ {
+ CDOSession session = openSession();
+ CDOView view = session.openView();
+
+ CDOObject object = view.getObject(resourceCDOID);
+ Assert.assertTrue(object instanceof CDOResource);
+ CDOResource resource = (CDOResource)object;
+ EObject company = resource.getContents().get(0);
+
+ assertEquals(1, view.getResourceSet().getResources().size());
+ assertEquals(view.getResourceSet().getResources().get(0), company.eResource());
+ }
+
+ /**
* Test the simple working case, a {@link CDOView#getResource(String)} call add the {@link Resource} to the {@link ResourceSet}.
*/
public void testAbstractCDOView_GetResource_ResourceSetAddition() throws Exception

Back to the top