Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2015-10-11 09:18:24 +0000
committerEike Stepper2015-10-11 09:18:24 +0000
commit2ab2a9b4d02d69c251e34b0a4a135b85de12ae5c (patch)
treeddadd430ebe86c4dacd3b4adab43b44d3a739db2
parentc34ea38795d4c1754e2e2c88bd3189bcde541ae2 (diff)
downloadcdo-2ab2a9b4d02d69c251e34b0a4a135b85de12ae5c.tar.gz
cdo-2ab2a9b4d02d69c251e34b0a4a135b85de12ae5c.tar.xz
cdo-2ab2a9b4d02d69c251e34b0a4a135b85de12ae5c.zip
[Releng] Add OCLQueryTest.testAuditWithDetachedObject()
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OCLQueryTest.java33
1 files changed, 29 insertions, 4 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OCLQueryTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OCLQueryTest.java
index 8b5cfc6ab4..2fc0e814bb 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OCLQueryTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OCLQueryTest.java
@@ -10,9 +10,11 @@
*/
package org.eclipse.emf.cdo.tests;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.server.ISession;
import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.tests.config.IRepositoryConfig;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTest.CleanRepositoriesBefore;
import org.eclipse.emf.cdo.tests.model1.Customer;
import org.eclipse.emf.cdo.tests.model1.Order;
@@ -23,6 +25,7 @@ import org.eclipse.emf.cdo.tests.model1.VAT;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.util.CommitException;
import org.eclipse.emf.cdo.view.CDOQuery;
+import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.net4j.util.collection.CloseableIterator;
import org.eclipse.net4j.util.io.IOUtil;
@@ -128,7 +131,8 @@ public class OCLQueryTest extends AbstractCDOTest
public void testAllProductsWithNameParameter() throws Exception
{
- CDOQuery query = createQuery("Product1.allInstances()->select(p | p.name=myname)", getModel1Package().getProduct1());
+ CDOQuery query = createQuery("Product1.allInstances()->select(p | p.name=myname)",
+ getModel1Package().getProduct1());
query.setParameter("myname", "1");
List<Product1> products = query.getResult();
@@ -137,8 +141,8 @@ public class OCLQueryTest extends AbstractCDOTest
public void testAllProductsWithVAT() throws Exception
{
- CDOQuery query = createQuery("Product1.allInstances()->select(p | p.vat=VAT::vat15)", getModel1Package()
- .getProduct1());
+ CDOQuery query = createQuery("Product1.allInstances()->select(p | p.vat=VAT::vat15)",
+ getModel1Package().getProduct1());
List<Product1> products = query.getResult();
assertEquals(10, products.size());
@@ -263,7 +267,7 @@ public class OCLQueryTest extends AbstractCDOTest
assertEquals(numOfProducts, products.size());
}
- public void testAuditWithDetachedObject() throws Exception
+ public void testTransactionWithDetachedObject() throws Exception
{
Product1 p1 = getModel1Factory().createProduct1();
p1.setName("p1");
@@ -279,6 +283,27 @@ public class OCLQueryTest extends AbstractCDOTest
assertEquals(NUM_OF_PRODUCTS, products.size());
}
+ @Requires(IRepositoryConfig.CAPABILITY_AUDITING)
+ public void testAuditWithDetachedObject() throws Exception
+ {
+ assertEquals(NUM_OF_PRODUCTS, products.size());
+
+ Product1 p1 = getModel1Factory().createProduct1();
+ p1.setName("p1");
+ resource.getContents().add(0, p1);
+ CDOCommitInfo commitInfo = transaction.commit();
+
+ resource.getContents().remove(0);
+ transaction.commit();
+
+ CDOView audit = transaction.getSession().openView(commitInfo);
+ CDOQuery query = audit.createQuery("ocl", "Product1.allInstances()", getModel1Package().getProduct1());
+ query.setParameter("cdoLazyExtents", useLazyExtents());
+
+ List<Product1> result = query.getResult();
+ assertEquals(NUM_OF_PRODUCTS + 1, result.size());
+ }
+
public void testMultipleQueries() throws Exception
{
ISession session = getRepository().getSessionManager().getElements()[0];

Back to the top