Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-08-02 08:55:50 +0000
committerEike Stepper2012-08-02 08:55:50 +0000
commitdb20ac4436b6efaaa0522f0749ecd367c75c685d (patch)
tree893f0b8f5a7c949ef31ef16b8c9f688a016a9d56
parent697b5b0db3f8793affbd035b8f7a207559593305 (diff)
downloadcdo-db20ac4436b6efaaa0522f0749ecd367c75c685d.tar.gz
cdo-db20ac4436b6efaaa0522f0749ecd367c75c685d.tar.xz
cdo-db20ac4436b6efaaa0522f0749ecd367c75c685d.zip
Make tests clearer
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BranchingTest.java28
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ComplexTest.java12
2 files changed, 25 insertions, 15 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BranchingTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BranchingTest.java
index 714158cc5c..d71b4e1c1c 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BranchingTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BranchingTest.java
@@ -41,6 +41,7 @@ import org.eclipse.net4j.util.ReflectUtil;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.emf.spi.cdo.CDOSessionProtocol;
import org.eclipse.emf.spi.cdo.InternalCDOSession;
import java.lang.reflect.Field;
@@ -665,22 +666,26 @@ public class BranchingTest extends AbstractCDOTest
session.close();
}
- private void check(CDOSession session, CDOBranch branch, long timeStamp, float price, String name,
- int expectedContentsSize)
+ private void check(CDOSession session, CDOBranch branch, long timeStamp, float price, String name, int size)
{
CDOView view = session.openView(branch, timeStamp);
CDOResource resource = view.getResource(getResourcePath("/res"));
- assertEquals(expectedContentsSize, resource.getContents().size());
+
+ int actualSize = resource.getContents().size();
+ assertEquals(size, actualSize);
dumpAll(session);
OrderDetail orderDetail = (OrderDetail)resource.getContents().get(1);
-
dumpAll(session);
- assertEquals(price, orderDetail.getPrice());
+
+ float actualPrice = orderDetail.getPrice();
+ assertEquals(price, actualPrice);
Product1 product = orderDetail.getProduct();
dumpAll(session);
- assertEquals(name, product.getName());
+
+ String actualName = product.getName();
+ assertEquals(name, actualName);
view.close();
}
@@ -912,12 +917,17 @@ public class BranchingTest extends AbstractCDOTest
final List<CDORevision> revisions = new ArrayList<CDORevision>();
- ((InternalCDOSession)session).getSessionProtocol().handleRevisions(null, subBranch, false,
- CDOBranchPoint.UNSPECIFIED_DATE, false, new CDORevisionHandler()
+ CDOSessionProtocol sessionProtocol = ((InternalCDOSession)session).getSessionProtocol();
+ sessionProtocol.handleRevisions(null, subBranch, false, CDOBranchPoint.UNSPECIFIED_DATE, false,
+ new CDORevisionHandler()
{
public boolean handleRevision(CDORevision revision)
{
- assertNotSame("Product1", revision.getEClass().getName());
+ if (revision.getEClass() == getModel1Package().getProduct1())
+ {
+ fail("Product1 has been detached and should not be passed in here");
+ }
+
revisions.add(revision);
return true;
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ComplexTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ComplexTest.java
index d8ba283a5e..1e807fea99 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ComplexTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ComplexTest.java
@@ -82,8 +82,8 @@ public class ComplexTest extends AbstractCDOTest
protected void doSetUp() throws Exception
{
super.doSetUp();
- String path1 = getResourcePath("/resources/folder1/" + uniqueCounter);
- String path2 = getResourcePath("/resources/folder2/" + uniqueCounter);
+ String path1 = getResourcePath("/resources/folder1/res" + uniqueCounter);
+ String path2 = getResourcePath("/resources/folder2/res" + uniqueCounter);
++uniqueCounter;
init(path1, path2);
@@ -1036,12 +1036,12 @@ public class ComplexTest extends AbstractCDOTest
public void testMultipleTransactions3() throws CommitException
{
CDOTransaction transaction1 = session.openTransaction();
- String resource1path = getResourcePath("/resources/3/" + uniqueCounter);
+ String resource1path = getResourcePath("/resources/3/res" + uniqueCounter);
CDOResource resource1 = transaction1.createResource(resource1path);
transaction1.commit();
CDOTransaction transaction2 = session.openTransaction();
- String resource2path = getResourcePath("/resources/4/" + uniqueCounter++);
+ String resource2path = getResourcePath("/resources/4/res" + uniqueCounter++);
CDOResource resource2 = transaction2.createResource(resource2path);
transaction2.commit();
@@ -1090,12 +1090,12 @@ public class ComplexTest extends AbstractCDOTest
public void testMultipleTransactions2() throws CommitException
{
CDOTransaction transaction1 = session.openTransaction();
- String resource1path = getResourcePath("/resources/3/" + uniqueCounter);
+ String resource1path = getResourcePath("/resources/3/res" + uniqueCounter);
CDOResource resource1 = transaction1.createResource(resource1path);
transaction1.commit();
CDOTransaction transaction2 = session.openTransaction();
- String resource2path = getResourcePath("/resources/4/" + uniqueCounter++);
+ String resource2path = getResourcePath("/resources/4/res" + uniqueCounter++);
CDOResource resource2 = transaction2.createResource(resource2path);
transaction2.commit();

Back to the top