cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r664673 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test: java/org/apache/cayenne/access/DataContextEJBQLFlattenedRelationshipsTest.java resources/dml/access.DataContextEJBQLFlattenedRelationshipsTest.xml
Date Mon, 09 Jun 2008 10:44:16 GMT
Author: aadamchik
Date: Mon Jun  9 03:44:16 2008
New Revision: 664673

URL: http://svn.apache.org/viewvc?rev=664673&view=rev
Log:
CAY-1069 EJBQL: support paths across flattened relationships
(edge case unit test... still failing)

Added:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLFlattenedRelationshipsTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/access.DataContextEJBQLFlattenedRelationshipsTest.xml

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLFlattenedRelationshipsTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLFlattenedRelationshipsTest.java?rev=664673&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLFlattenedRelationshipsTest.java
(added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLFlattenedRelationshipsTest.java
Mon Jun  9 03:44:16 2008
@@ -0,0 +1,55 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.access;
+
+import org.apache.cayenne.DataObjectUtils;
+import org.apache.cayenne.ObjectContext;
+import org.apache.cayenne.query.EJBQLQuery;
+import org.apache.cayenne.testdo.relationship.FlattenedTest1;
+import org.apache.cayenne.unit.RelationshipCase;
+
+public class DataContextEJBQLFlattenedRelationshipsTest extends RelationshipCase {
+
+    public void testCollectionMemberOfThetaJoin() throws Exception {
+        createTestData("testCollectionMemberOfThetaJoin");
+
+        String ejbql = "SELECT f FROM FlattenedTest3 f, FlattenedTest1 ft "
+                + "WHERE f MEMBER OF ft.ft3Array AND ft = :ft";
+
+        ObjectContext context = createDataContext();
+        FlattenedTest1 ft = DataObjectUtils.objectForPK(context, FlattenedTest1.class, 1);
+        EJBQLQuery query = new EJBQLQuery(ejbql);
+        query.setParameter("ft", ft);
+
+        // TODO: andrus 2008/06/09 - this fails until we fix CAY-1069 (for correlated join
+        // case see EJBQLConditionTranslator.visitMemberOf(..)
+        // List<?> objects = context.performQuery(query);
+        // assertEquals(2, objects.size());
+        //
+        // Set<Object> ids = new HashSet<Object>();
+        // Iterator<?> it = objects.iterator();
+        // while (it.hasNext()) {
+        // Object id = DataObjectUtils.pkForObject((Persistent) it.next());
+        // ids.add(id);
+        // }
+        //
+        // assertTrue(ids.contains(new Integer(2)));
+        // assertTrue(ids.contains(new Integer(3)));
+    }
+}

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/access.DataContextEJBQLFlattenedRelationshipsTest.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/access.DataContextEJBQLFlattenedRelationshipsTest.xml?rev=664673&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/access.DataContextEJBQLFlattenedRelationshipsTest.xml
(added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/access.DataContextEJBQLFlattenedRelationshipsTest.xml
Mon Jun  9 03:44:16 2008
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans default-lazy-init="true">	
+
+	<bean id="FT11" class="org.apache.cayenne.unit.util.UpdatingSQLTemplate">
+		<constructor-arg type="java.lang.Class"><value>org.apache.cayenne.testdo.relationship.FlattenedTest1</value></constructor-arg>
+		<constructor-arg><value>
+		insert into FLATTENED_TEST_1 (FT1_ID, NAME) values (1, 'ft1')
+		</value></constructor-arg>
+	</bean>
+	<bean id="FT12" class="org.apache.cayenne.unit.util.UpdatingSQLTemplate">
+		<constructor-arg type="java.lang.Class"><value>org.apache.cayenne.testdo.relationship.FlattenedTest1</value></constructor-arg>
+		<constructor-arg><value>
+		insert into FLATTENED_TEST_1 (FT1_ID, NAME) values (2, 'ft12')
+		</value></constructor-arg>
+	</bean>
+	<bean id="FT21" class="org.apache.cayenne.unit.util.UpdatingSQLTemplate">
+		<constructor-arg type="java.lang.Class"><value>org.apache.cayenne.testdo.relationship.FlattenedTest2</value></constructor-arg>
+		<constructor-arg><value>
+		insert into FLATTENED_TEST_2 (FT2_ID, FT1_ID, NAME) values (1, 1, 'ft2')
+		</value></constructor-arg>
+	</bean>
+	<bean id="FT22" class="org.apache.cayenne.unit.util.UpdatingSQLTemplate">
+		<constructor-arg type="java.lang.Class"><value>org.apache.cayenne.testdo.relationship.FlattenedTest2</value></constructor-arg>
+		<constructor-arg><value>
+		insert into FLATTENED_TEST_2 (FT2_ID, FT1_ID, NAME) values (2, 2, 'ft22')
+		</value></constructor-arg>
+	</bean>
+	<bean id="FT31" class="org.apache.cayenne.unit.util.UpdatingSQLTemplate">
+		<constructor-arg type="java.lang.Class"><value>org.apache.cayenne.testdo.relationship.FlattenedTest3</value></constructor-arg>
+		<constructor-arg><value>
+		insert into FLATTENED_TEST_3 (FT3_ID, FT2_ID, NAME) values (1, 1, 'ft3')
+		</value></constructor-arg>
+	</bean>
+	<bean id="FT32" class="org.apache.cayenne.unit.util.UpdatingSQLTemplate">
+		<constructor-arg type="java.lang.Class"><value>org.apache.cayenne.testdo.relationship.FlattenedTest3</value></constructor-arg>
+		<constructor-arg><value>
+		insert into FLATTENED_TEST_3 (FT3_ID, FT2_ID, NAME) values (2, 2, 'ft3-a')
+		</value></constructor-arg>
+	</bean>
+	<bean id="FT33" class="org.apache.cayenne.unit.util.UpdatingSQLTemplate">
+		<constructor-arg type="java.lang.Class"><value>org.apache.cayenne.testdo.relationship.FlattenedTest3</value></constructor-arg>
+		<constructor-arg><value>
+		insert into FLATTENED_TEST_3 (FT3_ID, FT2_ID, NAME) values (3, 2, 'ft3-b')
+		</value></constructor-arg>
+	</bean>
+
+	<bean id="testCollectionMemberOfThetaJoin" class="java.util.ArrayList">
+		<constructor-arg>
+			<list>
+				<ref bean="FT11"/>
+				<ref bean="FT12"/>
+				<ref bean="FT21"/>
+				<ref bean="FT22"/>
+				<ref bean="FT31"/>
+				<ref bean="FT32"/>
+				<ref bean="FT33"/>
+			</list>
+		</constructor-arg>
+	</bean>
+</beans>
\ No newline at end of file



Mime
View raw message