Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-04-01 00:38:56 -0400
committerEike Stepper2013-04-01 01:42:45 -0400
commit24adc89aa3a28d355b2029f449a613eb79d4ab1a (patch)
tree857d702a7228cb661d99cfd9a3da9fbd5b99eb19
parentf506b7c1466a97c214b83041923f6bf6107b0cd6 (diff)
downloadcdo-24adc89aa3a28d355b2029f449a613eb79d4ab1a.tar.gz
cdo-24adc89aa3a28d355b2029f449a613eb79d4ab1a.tar.xz
cdo-24adc89aa3a28d355b2029f449a613eb79d4ab1a.zip
dd testDeleteResourceFromRoot()
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ResourceTest.java65
1 files changed, 65 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ResourceTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ResourceTest.java
index c0623f558c..7e750ef7bb 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ResourceTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ResourceTest.java
@@ -897,6 +897,71 @@ public class ResourceTest extends AbstractCDOTest
session.close();
}
+ @CleanRepositoriesBefore
+ public void testDeleteResourceFromRoot() throws Exception
+ {
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+
+ Product1 p = getModel1Factory().createProduct1();
+ p.setName("Product1");
+ p.setVat(VAT.VAT0);
+
+ CDOResource resource = transaction.createResource("/res-" + System.currentTimeMillis());
+ resource.getContents().add(p);
+
+ CDOID resourceID = resource.cdoID();
+
+ CDOObject object = CDOUtil.getCDOObject(resource.getContents().get(0));
+ CDOID objectID = object.cdoID();
+
+ transaction.commit();
+ resource.delete(null);
+ transaction.commit();
+ transaction.close();
+
+ CDOView view = session.openView();
+ assertEquals(false, view.hasResource(getResourcePath("/resource1")));
+
+ try
+ {
+ view.getResourceNode("/resource1");
+ fail("Exception expected");
+ }
+ catch (Exception expected)
+ {
+ }
+
+ try
+ {
+ view.getResource(getResourcePath("/resource1"));
+ fail("Exception expected");
+ }
+ catch (Exception expected)
+ {
+ }
+
+ try
+ {
+ view.getObject(resourceID);
+ fail("ObjectNotFoundException expected");
+ }
+ catch (ObjectNotFoundException expected)
+ {
+ }
+
+ try
+ {
+ view.getObject(objectID);
+ fail("ObjectNotFoundException expected");
+ }
+ catch (ObjectNotFoundException expected)
+ {
+ }
+
+ session.close();
+ }
+
public void testDeleteResource() throws Exception
{
CDOSession session = openSession();

Back to the top