cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r605181 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/reflect: PropertyUtilsTest.java TestJavaBean.java
Date Tue, 18 Dec 2007 11:01:14 GMT
Author: aadamchik
Date: Tue Dec 18 03:01:13 2007
New Revision: 605181

URL: http://svn.apache.org/viewvc?rev=605181&view=rev
Log:
CAY-945  PropertyUtils support for "compiled" property access

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/reflect/PropertyUtilsTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/reflect/TestJavaBean.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/reflect/PropertyUtilsTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/reflect/PropertyUtilsTest.java?rev=605181&r1=605180&r2=605181&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/reflect/PropertyUtilsTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/reflect/PropertyUtilsTest.java
Tue Dec 18 03:01:13 2007
@@ -40,12 +40,36 @@
 
         TestJavaBean o1 = createBean();
         assertSame(o1.getByteArrayField(), accessor.getValue(o1));
-        
+
         TestJavaBean o2 = new TestJavaBean();
         assertNull(o2.getByteArrayField());
         accessor.setValue(o2, o1.getByteArrayField());
         assertNotNull(o2.getByteArrayField());
         assertSame(o1.getByteArrayField(), o2.getByteArrayField());
+    }
+
+    public void testCreateAccessorNested() {
+
+        Accessor accessor = PropertyUtils.createAccessor(
+                TestJavaBean.class,
+                "related.byteArrayField");
+        assertNotNull(accessor);
+
+        TestJavaBean o1 = createBean();
+        o1.setRelated(new TestJavaBean());
+        o1.getRelated().setByteArrayField(new byte[] {
+                3, 4, 5
+        });
+        assertSame(o1.getRelated().getByteArrayField(), accessor.getValue(o1));
+
+        TestJavaBean o2 = new TestJavaBean();
+        o2.setRelated(new TestJavaBean());
+
+        byte[] b1 = new byte[] {
+                6, 7, 8
+        };
+        accessor.setValue(o2, b1);
+        assertSame(b1, o2.getRelated().getByteArrayField());
     }
 
     public void testGetProperty() {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/reflect/TestJavaBean.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/reflect/TestJavaBean.java?rev=605181&r1=605180&r2=605181&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/reflect/TestJavaBean.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/reflect/TestJavaBean.java
Tue Dec 18 03:01:13 2007
@@ -28,6 +28,7 @@
     protected Number numberField;
     protected byte[] byteArrayField;
     protected Object objectField;
+    protected TestJavaBean related;
 
     public byte[] getByteArrayField() {
         return byteArrayField;
@@ -85,5 +86,15 @@
     
     public void setBooleanField(boolean booleanField) {
         this.booleanField = booleanField;
+    }
+
+    
+    public TestJavaBean getRelated() {
+        return related;
+    }
+
+    
+    public void setRelated(TestJavaBean related) {
+        this.related = related;
     }
 }



Mime
View raw message