Author: aadamchik
Date: Thu Oct 12 19:15:36 2006
New Revision: 463549

URL: http://svn.apache.org/viewvc?view=rev&rev=463549
Log:
CAY-682:Generic Cayenne POJO enhancer
(failing relationship test)

Added:
    
incubator/cayenne/main/trunk/integration-test/pojo/src/main/java/org/apache/cayenne/itest/pojo/ManyToOneEntity1.java
    
incubator/cayenne/main/trunk/integration-test/pojo/src/main/java/org/apache/cayenne/itest/pojo/OneToManyEntity1.java
    
incubator/cayenne/main/trunk/integration-test/pojo/src/test/java/org/apache/cayenne/itest/pojo/ManyToOneObjectTest.java
Modified:
    
incubator/cayenne/main/trunk/integration-test/pojo/.settings/org.eclipse.jdt.core.prefs
    
incubator/cayenne/main/trunk/integration-test/pojo/src/main/java/org/apache/cayenne/itest/pojo/Entity1.java
    
incubator/cayenne/main/trunk/integration-test/pojo/src/main/resources/pojo-map.map.xml

Modified: 
incubator/cayenne/main/trunk/integration-test/pojo/.settings/org.eclipse.jdt.core.prefs
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/integration-test/pojo/.settings/org.eclipse.jdt.core.prefs?view=diff&rev=463549&r1=463548&r2=463549
==============================================================================
--- 
incubator/cayenne/main/trunk/integration-test/pojo/.settings/org.eclipse.jdt.core.prefs
 (original)
+++ 
incubator/cayenne/main/trunk/integration-test/pojo/.settings/org.eclipse.jdt.core.prefs
 Thu Oct 12 19:15:36 2006
@@ -1,4 +1,4 @@
-#Sun Jul 23 18:13:04 EDT 2006
+#Thu Aug 24 07:23:42 MDT 2006
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5

Modified: 
incubator/cayenne/main/trunk/integration-test/pojo/src/main/java/org/apache/cayenne/itest/pojo/Entity1.java
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/integration-test/pojo/src/main/java/org/apache/cayenne/itest/pojo/Entity1.java?view=diff&rev=463549&r1=463548&r2=463549
==============================================================================
--- 
incubator/cayenne/main/trunk/integration-test/pojo/src/main/java/org/apache/cayenne/itest/pojo/Entity1.java
 (original)
+++ 
incubator/cayenne/main/trunk/integration-test/pojo/src/main/java/org/apache/cayenne/itest/pojo/Entity1.java
 Thu Oct 12 19:15:36 2006
@@ -1,3 +1,21 @@
+/*****************************************************************
+ *   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.itest.pojo;
 
 public class Entity1 {

Added: 
incubator/cayenne/main/trunk/integration-test/pojo/src/main/java/org/apache/cayenne/itest/pojo/ManyToOneEntity1.java
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/integration-test/pojo/src/main/java/org/apache/cayenne/itest/pojo/ManyToOneEntity1.java?view=auto&rev=463549
==============================================================================
--- 
incubator/cayenne/main/trunk/integration-test/pojo/src/main/java/org/apache/cayenne/itest/pojo/ManyToOneEntity1.java
 (added)
+++ 
incubator/cayenne/main/trunk/integration-test/pojo/src/main/java/org/apache/cayenne/itest/pojo/ManyToOneEntity1.java
 Thu Oct 12 19:15:36 2006
@@ -0,0 +1,32 @@
+/*****************************************************************
+ *   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.itest.pojo;
+
+public class ManyToOneEntity1 {
+
+       protected OneToManyEntity1 toOne;
+
+       public OneToManyEntity1 getToOne() {
+               return toOne;
+       }
+
+       public void setToOne(OneToManyEntity1 o) {
+               this.toOne = o;
+       }
+}

Added: 
incubator/cayenne/main/trunk/integration-test/pojo/src/main/java/org/apache/cayenne/itest/pojo/OneToManyEntity1.java
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/integration-test/pojo/src/main/java/org/apache/cayenne/itest/pojo/OneToManyEntity1.java?view=auto&rev=463549
==============================================================================
--- 
incubator/cayenne/main/trunk/integration-test/pojo/src/main/java/org/apache/cayenne/itest/pojo/OneToManyEntity1.java
 (added)
+++ 
incubator/cayenne/main/trunk/integration-test/pojo/src/main/java/org/apache/cayenne/itest/pojo/OneToManyEntity1.java
 Thu Oct 12 19:15:36 2006
@@ -0,0 +1,34 @@
+/*****************************************************************
+ *   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.itest.pojo;
+
+import java.util.List;
+
+public class OneToManyEntity1 {
+
+       protected List<ManyToOneEntity1> toMany;
+
+       public List<ManyToOneEntity1> getToMany() {
+               return toMany;
+       }
+
+       public void setToMany(List<ManyToOneEntity1> c) {
+               this.toMany = c;
+       }
+}

Modified: 
incubator/cayenne/main/trunk/integration-test/pojo/src/main/resources/pojo-map.map.xml
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/integration-test/pojo/src/main/resources/pojo-map.map.xml?view=diff&rev=463549&r1=463548&r2=463549
==============================================================================
--- 
incubator/cayenne/main/trunk/integration-test/pojo/src/main/resources/pojo-map.map.xml
 (original)
+++ 
incubator/cayenne/main/trunk/integration-test/pojo/src/main/resources/pojo-map.map.xml
 Thu Oct 12 19:15:36 2006
@@ -5,7 +5,26 @@
                <db-attribute name="id" type="INTEGER" isPrimaryKey="true" 
isMandatory="true"/>
                <db-attribute name="name" type="VARCHAR" length="100"/>
        </db-entity>
+       <db-entity name="many_to_one_entity1">
+               <db-attribute name="id" type="INTEGER" isPrimaryKey="true" 
isMandatory="true"/>
+               <db-attribute name="one_to_many_entity1_id" type="INTEGER"/>
+       </db-entity>
+       <db-entity name="one_to_many_entity1">
+               <db-attribute name="id" type="INTEGER" isPrimaryKey="true" 
isMandatory="true"/>
+       </db-entity>
        <obj-entity name="Entity1" 
className="org.apache.cayenne.itest.pojo.Entity1" dbEntityName="entity1">
                <obj-attribute name="name" type="java.lang.String" 
db-attribute-path="name"/>
        </obj-entity>
+       <obj-entity name="ManyToOneEntity1" 
className="org.apache.cayenne.itest.pojo.ManyToOneEntity1" 
dbEntityName="many_to_one_entity1">
+       </obj-entity>
+       <obj-entity name="OneToManyEntity1" 
className="org.apache.cayenne.itest.pojo.OneToManyEntity1" 
dbEntityName="one_to_many_entity1">
+       </obj-entity>
+       <db-relationship name="to_one" source="many_to_one_entity1" 
target="one_to_many_entity1" toMany="false">
+               <db-attribute-pair source="one_to_many_entity1_id" target="id"/>
+       </db-relationship>
+       <db-relationship name="to_many" source="one_to_many_entity1" 
target="many_to_one_entity1" toMany="true">
+               <db-attribute-pair source="id" target="one_to_many_entity1_id"/>
+       </db-relationship>
+       <obj-relationship name="toOne" source="ManyToOneEntity1" 
target="OneToManyEntity1" db-relationship-path="to_one"/>
+       <obj-relationship name="toMany" source="OneToManyEntity1" 
target="ManyToOneEntity1" db-relationship-path="to_many"/>
 </data-map>

Added: 
incubator/cayenne/main/trunk/integration-test/pojo/src/test/java/org/apache/cayenne/itest/pojo/ManyToOneObjectTest.java
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/integration-test/pojo/src/test/java/org/apache/cayenne/itest/pojo/ManyToOneObjectTest.java?view=auto&rev=463549
==============================================================================
--- 
incubator/cayenne/main/trunk/integration-test/pojo/src/test/java/org/apache/cayenne/itest/pojo/ManyToOneObjectTest.java
 (added)
+++ 
incubator/cayenne/main/trunk/integration-test/pojo/src/test/java/org/apache/cayenne/itest/pojo/ManyToOneObjectTest.java
 Thu Oct 12 19:15:36 2006
@@ -0,0 +1,48 @@
+/*****************************************************************
+ *   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.itest.pojo;
+
+
+public class ManyToOneObjectTest extends PojoContextCase {
+
+    public void testSelectToOne() throws Exception {
+        getDbHelper().deleteAll("many_to_one_entity1");
+        getDbHelper().deleteAll("one_to_many_entity1");
+        getDbHelper().insert("one_to_many_entity1", new String[] {
+            "id"
+        }, new Object[] {
+            5
+        });
+
+        getDbHelper().insert("many_to_one_entity1", new String[] {
+                "id", "one_to_many_entity1_id"
+        }, new Object[] {
+                16, 5
+        });
+
+        // TODO: andrus, 10/12/2006 this fails due to the lack of correct arc 
descriptors
+        // SelectQuery q = new SelectQuery(ManyToOneEntity1.class);
+        // List results = context.performQuery(q);
+        // assertEquals(1, results.size());
+        //        
+        // ManyToOneEntity1 o1 = (ManyToOneEntity1) results.get(0);
+        // OneToManyEntity1 or = o1.getToOne();
+        // assertNotNull(or);
+    }
+}


Reply via email to