Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon McDuff2008-11-02 20:19:21 -0500
committerSimon McDuff2008-11-02 20:19:21 -0500
commit164b9ba5540a0412baba24293618abe1d09313aa (patch)
tree85a2ea00bbd3b6b8dc22f9ded4a5da78e0ea4234
parentc7995acfe4e92fbbec426c8eadcc537d52b34626 (diff)
downloadcdo-164b9ba5540a0412baba24293618abe1d09313aa.tar.gz
cdo-164b9ba5540a0412baba24293618abe1d09313aa.tar.xz
cdo-164b9ba5540a0412baba24293618abe1d09313aa.zip
[253107] ResourceTest contains testcases related to Audit mode.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=253107
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AuditTest.java64
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ResourceTest.java46
2 files changed, 68 insertions, 42 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AuditTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AuditTest.java
index 7a91455474..d563c69373 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AuditTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AuditTest.java
@@ -16,9 +16,12 @@ import org.eclipse.emf.cdo.CDOTransaction;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.tests.model1.Company;
+import org.eclipse.emf.cdo.util.CDOURIUtil;
import org.eclipse.net4j.signal.SignalRemoteException;
+import org.eclipse.emf.common.util.URI;
+
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Map;
@@ -391,6 +394,67 @@ public class AuditTest extends AbstractCDOTest
}
}
+ public void testChangePath() throws Exception
+ {
+ long commitTime1;
+ long commitTime2;
+
+ {
+ CDOSession session = openModel1Session();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource("/my/resource");
+ transaction.commit();
+ commitTime1 = transaction.getLastCommitTime();
+
+ resource.setPath("/renamed");
+ transaction.commit();
+ commitTime2 = transaction.getLastCommitTime();
+ session.close();
+ }
+
+ CDOSession session = openModel1Session();
+ CDOAudit audit1 = session.openAudit(commitTime1);
+ assertEquals(true, audit1.hasResource("/my/resource"));
+ assertEquals(false, audit1.hasResource("/renamed"));
+
+ CDOAudit audit2 = session.openAudit(commitTime2);
+ assertEquals(false, audit2.hasResource("/my/resource"));
+ assertEquals(true, audit2.hasResource("/renamed"));
+ session.close();
+ }
+
+ public void testChangeURI() throws Exception
+ {
+ long commitTime1;
+ long commitTime2;
+
+ {
+ CDOSession session = openModel1Session();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource("/my/resource");
+ transaction.commit();
+ commitTime1 = transaction.getLastCommitTime();
+
+ URI uri = URI.createURI("cdo://repo1/renamed");
+ assertEquals(CDOURIUtil.createResourceURI(session, "/renamed"), uri);
+ resource.setURI(uri);
+
+ transaction.commit();
+ commitTime2 = transaction.getLastCommitTime();
+ session.close();
+ }
+
+ CDOSession session = openModel1Session();
+ CDOAudit audit1 = session.openAudit(commitTime1);
+ assertEquals(true, audit1.hasResource("/my/resource"));
+ assertEquals(false, audit1.hasResource("/renamed"));
+
+ CDOAudit audit2 = session.openAudit(commitTime2);
+ assertEquals(false, audit2.hasResource("/my/resource"));
+ assertEquals(true, audit2.hasResource("/renamed"));
+ session.close();
+ }
+
/**
* @author Eike Stepper
*/
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 89aa28413b..135a047331 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
@@ -11,7 +11,6 @@
**************************************************************************/
package org.eclipse.emf.cdo.tests;
-import org.eclipse.emf.cdo.CDOAudit;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDOSession;
import org.eclipse.emf.cdo.CDOState;
@@ -604,65 +603,28 @@ public class ResourceTest extends AbstractCDOTest
return path;
}
- public void testChangePath() throws Exception
- {
- long commitTime1;
- long commitTime2;
-
- {
- CDOSession session = openModel1Session();
- CDOTransaction transaction = session.openTransaction();
- CDOResource resource = transaction.createResource("/my/resource");
- transaction.commit();
- commitTime1 = transaction.getLastCommitTime();
-
- resource.setPath("/renamed");
- transaction.commit();
- commitTime2 = transaction.getLastCommitTime();
- session.close();
- }
-
- CDOSession session = openModel1Session();
- CDOAudit audit1 = session.openAudit(commitTime1);
- assertEquals(true, audit1.hasResource("/my/resource"));
- assertEquals(false, audit1.hasResource("/renamed"));
-
- CDOAudit audit2 = session.openAudit(commitTime2);
- assertEquals(false, audit2.hasResource("/my/resource"));
- assertEquals(true, audit2.hasResource("/renamed"));
- session.close();
- }
-
public void testChangeURI() throws Exception
{
- long commitTime1;
- long commitTime2;
-
{
CDOSession session = openModel1Session();
CDOTransaction transaction = session.openTransaction();
CDOResource resource = transaction.createResource("/my/resource");
transaction.commit();
- commitTime1 = transaction.getLastCommitTime();
URI uri = URI.createURI("cdo://repo1/renamed");
assertEquals(CDOURIUtil.createResourceURI(session, "/renamed"), uri);
resource.setURI(uri);
transaction.commit();
- commitTime2 = transaction.getLastCommitTime();
session.close();
}
+ clearCache(getRepository().getRevisionManager());
CDOSession session = openModel1Session();
- CDOAudit audit1 = session.openAudit(commitTime1);
- assertEquals(true, audit1.hasResource("/my/resource"));
- assertEquals(false, audit1.hasResource("/renamed"));
+ CDOTransaction transaction = session.openTransaction();
- CDOAudit audit2 = session.openAudit(commitTime2);
- assertEquals(false, audit2.hasResource("/my/resource"));
- assertEquals(true, audit2.hasResource("/renamed"));
- session.close();
+ assertFalse(transaction.hasResource("/my/resource"));
+ assertTrue(transaction.hasResource("/renamed"));
}
public void testPathNotNull() throws Exception

Back to the top