You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2007/01/25 14:37:05 UTC
svn commit: r499786 - in
/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test:
java/org/apache/cayenne/access/EmbeddingTest.java
resources/dml/access.EmbeddingTest.xml resources/spring-test-resources.xml
Author: aadamchik
Date: Thu Jan 25 05:37:04 2007
New Revision: 499786
URL: http://svn.apache.org/viewvc?view=rev&rev=499786
Log:
CAY-736: Embeddable class support by Cayenne runtime
(initial setup of the unit tests)
Added:
cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/EmbeddingTest.java
cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/dml/access.EmbeddingTest.xml
Modified:
cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/spring-test-resources.xml
Added: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/EmbeddingTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/EmbeddingTest.java?view=auto&rev=499786
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/EmbeddingTest.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/EmbeddingTest.java Thu Jan 25 05:37:04 2007
@@ -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.access;
+
+import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.testdo.embeddable.EmbedEntity1;
+import org.apache.cayenne.unit.AccessStack;
+import org.apache.cayenne.unit.CayenneCase;
+import org.apache.cayenne.unit.CayenneResources;
+
+public class EmbeddingTest extends CayenneCase {
+
+ public static final String EMBEDDING_ACCESS_STACK = "EmbeddingStack";
+
+ protected AccessStack buildAccessStack() {
+ return CayenneResources.getResources().getAccessStack(EMBEDDING_ACCESS_STACK);
+ }
+
+ public void testSelect() throws Exception {
+ createTestData("testSelect");
+
+ SelectQuery query = new SelectQuery(EmbedEntity1.class);
+ query.addOrdering(EmbedEntity1.NAME_PROPERTY, true);
+
+ // TODO: andrus 1/25/2007 - this fails
+
+ // ObjectContext context = createDataContext();
+
+ // List results = context.performQuery(query);
+ // assertEquals(2, results.size());
+ }
+}
Added: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/dml/access.EmbeddingTest.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/dml/access.EmbeddingTest.xml?view=auto&rev=499786
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/dml/access.EmbeddingTest.xml (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/dml/access.EmbeddingTest.xml Thu Jan 25 05:37:04 2007
@@ -0,0 +1,42 @@
+<?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">
+ <!-- ======================================= -->
+ <!-- Named Queries -->
+ <!-- ======================================= -->
+
+ <bean id="DELETE_EMBED_ENTITY1" class="org.apache.cayenne.unit.util.UpdatingSQLTemplate">
+ <constructor-arg type="java.lang.Class"><value>org.apache.cayenne.testdo.embeddable.EmbedEntity1</value></constructor-arg>
+ <constructor-arg><value>
+ delete from "EMBED_ENTITY1"
+ </value></constructor-arg>
+ </bean>
+
+ <bean id="INSERT_EMBED_ENTITY11" class="org.apache.cayenne.unit.util.UpdatingSQLTemplate">
+ <constructor-arg type="java.lang.Class"><value>org.apache.cayenne.testdo.embeddable.EmbedEntity1</value></constructor-arg>
+ <constructor-arg><value>
+ insert into EMBED_ENTITY1 (ID, NAME, EMBEDDED10, EMBEDDED20, EMBEDDED30, EMBEDDED40) values (1, 'n1', 'e1', 'e2', 'e3', 'e4')
+ </value></constructor-arg>
+ </bean>
+
+ <bean id="INSERT_EMBED_ENTITY12" class="org.apache.cayenne.unit.util.UpdatingSQLTemplate">
+ <constructor-arg type="java.lang.Class"><value>org.apache.cayenne.testdo.embeddable.EmbedEntity1</value></constructor-arg>
+ <constructor-arg><value>
+ insert into EMBED_ENTITY1 (ID, NAME, EMBEDDED10, EMBEDDED20, EMBEDDED30, EMBEDDED40) values (2, 'n2', 'ex1', 'ex2', 'ex3', 'ex4')
+ </value></constructor-arg>
+ </bean>
+
+ <!-- ======================================= -->
+ <!-- Data Sets -->
+ <!-- ======================================= -->
+ <bean id="testSelect" class="java.util.ArrayList">
+ <constructor-arg>
+ <list>
+ <ref bean="DELETE_EMBED_ENTITY1"/>
+ <ref bean="INSERT_EMBED_ENTITY11"/>
+ <ref bean="INSERT_EMBED_ENTITY12"/>
+ </list>
+ </constructor-arg>
+ </bean>
+</beans>
\ No newline at end of file
Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/spring-test-resources.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/spring-test-resources.xml?view=diff&rev=499786&r1=499785&r2=499786
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/spring-test-resources.xml (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/spring-test-resources.xml Thu Jan 25 05:37:04 2007
@@ -88,6 +88,9 @@
<bean id="GenericMap" class="org.apache.cayenne.unit.DataMapFactory">
<constructor-arg><value>generic.map.xml</value></constructor-arg>
</bean>
+ <bean id="EmbeddingMap" class="org.apache.cayenne.unit.DataMapFactory">
+ <constructor-arg><value>embeddable.map.xml</value></constructor-arg>
+ </bean>
<!-- ======================================= -->
<!-- DataSetFactory -->
@@ -109,6 +112,11 @@
<constructor-arg><ref bean="DataSetFactory"/></constructor-arg>
<constructor-arg><list><ref bean="PeopleMap"/></list></constructor-arg>
</bean>
+ <bean id="EmbeddingStack" class="org.apache.cayenne.unit.SimpleAccessStack">
+ <constructor-arg><ref bean="TestResources"/></constructor-arg>
+ <constructor-arg><ref bean="DataSetFactory"/></constructor-arg>
+ <constructor-arg><list><ref bean="EmbeddingMap"/></list></constructor-arg>
+ </bean>
<bean id="LockingStack" class="org.apache.cayenne.unit.SimpleAccessStack">
<constructor-arg><ref bean="TestResources"/></constructor-arg>
<constructor-arg><ref bean="DataSetFactory"/></constructor-arg>
@@ -155,6 +163,7 @@
<ref bean="GenericMap"/>
<ref bean="DB1Map"/>
<ref bean="DB2Map"/>
+ <ref bean="EmbeddingMap"/>
</list>
</constructor-arg>
</bean>