cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r439587 - in /incubator/cayenne/main/trunk/core/cayenne-jdk1.5/src/test/java/org/apache/cayenne/access/types: EnumTypeFactoryTst.java ExtendedTypeMapEnumsTst.java
Date Sat, 02 Sep 2006 13:00:58 GMT
Author: aadamchik
Date: Sat Sep  2 06:00:58 2006
New Revision: 439587

URL: http://svn.apache.org/viewvc?rev=439587&view=rev
Log:
CAY-648 - refactoring ExtendedTypeMap to use ExtendedTypeFactories for all non-standard types
such as enums and serializables 

Added:
    incubator/cayenne/main/trunk/core/cayenne-jdk1.5/src/test/java/org/apache/cayenne/access/types/EnumTypeFactoryTst.java
Modified:
    incubator/cayenne/main/trunk/core/cayenne-jdk1.5/src/test/java/org/apache/cayenne/access/types/ExtendedTypeMapEnumsTst.java

Added: incubator/cayenne/main/trunk/core/cayenne-jdk1.5/src/test/java/org/apache/cayenne/access/types/EnumTypeFactoryTst.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.5/src/test/java/org/apache/cayenne/access/types/EnumTypeFactoryTst.java?rev=439587&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.5/src/test/java/org/apache/cayenne/access/types/EnumTypeFactoryTst.java
(added)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.5/src/test/java/org/apache/cayenne/access/types/EnumTypeFactoryTst.java
Sat Sep  2 06:00:58 2006
@@ -0,0 +1,29 @@
+/*****************************************************************
+ *   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.types;
+
+import junit.framework.TestCase;
+
+public class EnumTypeFactoryTst extends TestCase {
+
+    public void testSupportsEnums() {
+        EnumTypeFactory map = new EnumTypeFactory();
+        assertNotNull(map.getType(MockEnum.class));
+    }
+}

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.5/src/test/java/org/apache/cayenne/access/types/ExtendedTypeMapEnumsTst.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.5/src/test/java/org/apache/cayenne/access/types/ExtendedTypeMapEnumsTst.java?rev=439587&r1=439586&r2=439587&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.5/src/test/java/org/apache/cayenne/access/types/ExtendedTypeMapEnumsTst.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.5/src/test/java/org/apache/cayenne/access/types/ExtendedTypeMapEnumsTst.java
Sat Sep  2 06:00:58 2006
@@ -23,48 +23,45 @@
 
 public class ExtendedTypeMapEnumsTst extends TestCase {
 
-    public void testSupportsEnums() {
-        ExtendedTypeMap map = new ExtendedTypeMap();
-        assertNotNull(map.enumTypeConstructor);
-    }
-
-    public void testGetDefaultType1_5() {
+    public void testCreateType1_5() {
         ExtendedTypeMap map = new ExtendedTypeMap();
 
-        assertNull(map.getDefaultType(Object.class.getName()));
+        assertNull(map.createType(Object.class.getName()));
 
-        ExtendedType type = map.getDefaultType(MockEnum.class.getName());
+        ExtendedType type = map.createType(MockEnum.class.getName());
         assertTrue(type instanceof EnumType);
         assertEquals(MockEnum.class, ((EnumType) type).enumClass);
 
-        ExtendedType type2 = map.getDefaultType(MockEnum2.class.getName());
+        ExtendedType type2 = map.createType(MockEnum2.class.getName());
         assertNotSame(type, type2);
     }
 
-    public void testGetDefaultType1_5InnerEnum() {
+    public void testCreateType1_5InnerEnum() {
         ExtendedTypeMap map = new ExtendedTypeMap();
 
-        ExtendedType type = map.getDefaultType(InnerEnumHolder.InnerEnum.class.getName());
+        ExtendedType type = map.createType(InnerEnumHolder.InnerEnum.class.getName());
         assertTrue(type instanceof EnumType);
         assertEquals(InnerEnumHolder.InnerEnum.class, ((EnumType) type).enumClass);
-        
+
         // use a string name with $
-        ExtendedType type1 = map.getDefaultType(InnerEnumHolder.class.getName() + "$InnerEnum");
+        ExtendedType type1 = map.createType(InnerEnumHolder.class.getName()
+                + "$InnerEnum");
         assertNotNull(type1);
         assertSame(type.getClassName(), type1.getClassName());
-        
+
         // use a string name with .
-        ExtendedType type2 = map.getDefaultType(InnerEnumHolder.class.getName() + ".InnerEnum");
+        ExtendedType type2 = map.createType(InnerEnumHolder.class.getName()
+                + ".InnerEnum");
         assertNotNull(type2);
         assertSame(type.getClassName(), type2.getClassName());
     }
 
     public void testGetDefaultType1_4() {
         ExtendedTypeMap map = new ExtendedTypeMap();
-        map.enumTypeConstructor = null;
+        map.internalTypeFactories.clear();
 
-        assertNull(map.getDefaultType(Object.class.getName()));
-        assertNull(map.getDefaultType(MockEnum.class.getName()));
-        assertNull(map.getDefaultType(MockEnum2.class.getName()));
+        assertNull(map.createType(Object.class.getName()));
+        assertNull(map.createType(MockEnum.class.getName()));
+        assertNull(map.createType(MockEnum2.class.getName()));
     }
 }



Mime
View raw message