cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r602238 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src: main/resources/dotemplates/v1_2/ test/java/org/apache/cayenne/tools/
Date Fri, 07 Dec 2007 21:51:38 GMT
Author: aadamchik
Date: Fri Dec  7 13:51:37 2007
New Revision: 602238

URL: http://svn.apache.org/viewvc?rev=602238&view=rev
Log:
CAY-933 Embeddable classes - support class generation
(test environment setup; placeholder templates)

Added:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/embeddable-subclass.vm
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/embeddable-superclass.vm
Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/tools/CayenneGeneratorTaskTest.java

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/embeddable-subclass.vm
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/embeddable-subclass.vm?rev=602238&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/embeddable-subclass.vm
(added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/embeddable-subclass.vm
Fri Dec  7 13:51:37 2007
@@ -0,0 +1,30 @@
+##  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.
+##
+##Terminology:
+##	Base class - super superclass of embeddable, usually java.lang.Object
+##  Super class - superclass of embeddable, ie,  org.apache.cayenne.art.auto._Embeddable
+##	Sub class - class of entity, ie, org.apache.cayenne.art.Embeddable
+##
+##  Classes available in template
+##    embeddable - the Embeddable class: See org.apache.cayenne.map.Embeddable
+##    stringUtils - class for string "helper" functions: See org.apache.cayenne.gen.StringUtils
+##    entityUtils - class for entity "helper" functions: See org.apache.cayenne.gen.EntityUtils
+##    importUtils - class for import statement management: See org.apache.cayenne.gen.ImportUtils
+##
+##
+// subclass
\ No newline at end of file

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/embeddable-superclass.vm
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/embeddable-superclass.vm?rev=602238&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/embeddable-superclass.vm
(added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/embeddable-superclass.vm
Fri Dec  7 13:51:37 2007
@@ -0,0 +1,30 @@
+##  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.
+##
+##Terminology:
+##	Base class - super superclass of embeddable, usually java.lang.Object
+##  Super class - superclass of embeddable, ie,  org.apache.cayenne.art.auto._Embeddable
+##	Sub class - class of entity, ie, org.apache.cayenne.art.Embeddable
+##
+##  Classes available in template
+##    embeddable - the Embeddable class: See org.apache.cayenne.map.Embeddable
+##    stringUtils - class for string "helper" functions: See org.apache.cayenne.gen.StringUtils
+##    entityUtils - class for entity "helper" functions: See org.apache.cayenne.gen.EntityUtils
+##    importUtils - class for import statement management: See org.apache.cayenne.gen.ImportUtils
+##
+##
+// superclass
\ No newline at end of file

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/tools/CayenneGeneratorTaskTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/tools/CayenneGeneratorTaskTest.java?rev=602238&r1=602237&r2=602238&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/tools/CayenneGeneratorTaskTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/tools/CayenneGeneratorTaskTest.java
Fri Dec  7 13:51:37 2007
@@ -25,7 +25,7 @@
 import java.io.InputStreamReader;
 import java.net.URL;
 
-import org.apache.cayenne.unit.CayenneCase;
+import org.apache.cayenne.unit.BasicCase;
 import org.apache.cayenne.unit.CayenneResources;
 import org.apache.cayenne.util.ResourceLocator;
 import org.apache.cayenne.util.Util;
@@ -33,12 +33,13 @@
 import org.apache.tools.ant.Location;
 import org.apache.tools.ant.Project;
 
-public class CayenneGeneratorTaskTest extends CayenneCase {
+public class CayenneGeneratorTaskTest extends BasicCase {
 
     private static final Perl5Util regexUtil = new Perl5Util();
     private static final Project project = new Project();
     private static final File baseDir = CayenneResources.getResources().getTestDir();
     private static final File map = new File(baseDir, "antmap.xml");
+    private static final File mapEmbeddables = new File(baseDir, "antmap-embeddables.xml");
     private static final File template = new File(baseDir, "velotemplate.vm");
 
     static {
@@ -59,6 +60,9 @@
         Util.copy(url1, map);
         URL url2 = locator.findResource("testtemplate.vm");
         Util.copy(url2, template);
+
+        URL url3 = locator.findResource("embeddable.map.xml");
+        Util.copy(url3, mapEmbeddables);
     }
 
     public void setUp() {
@@ -224,6 +228,37 @@
         File _a = new File(mapDir, convertPath("org/apache/superart/_Artist.java"));
         assertTrue(_a.exists());
         assertContents(_a, "_Artist", "org.apache.superart", "CayenneDataObject");
+    }
+
+    public void testPairsEmbeddable3() throws Exception {
+        // prepare destination directory
+        File mapDir = new File(baseDir, "pairs-embeddables3-split");
+        assertTrue(mapDir.mkdirs());
+
+        // setup task
+        task.setDestDir(mapDir);
+        task.setMap(mapEmbeddables);
+        task.setMakepairs(true);
+        task.setUsepkgpath(true);
+        task.setSuperpkg("org.apache.cayenne.testdo.embeddable.auto");
+
+        // run task
+        task.execute();
+
+        // check results
+        File a = new File(
+                mapDir,
+                convertPath("org/apache/cayenne/testdo/embeddable/EmbedEntity1.java"));
+        assertTrue(a.isFile());
+        assertContents(
+                a,
+                "EmbedEntity1",
+                "org.apache.cayenne.testdo.embeddable",
+                "_EmbedEntity1");
+
+        File _a = new File(mapDir, convertPath("org/apache/cayenne/testdo/embeddable/auto/_EmbedEntity1.java"));
+        assertTrue(_a.exists());
+        assertContents(_a, "_EmbedEntity1", "org.apache.cayenne.testdo.embeddable.auto",
"CayenneDataObject");
     }
 
     private String convertPath(String unixPath) {



Mime
View raw message