You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rd...@apache.org on 2006/02/19 16:59:13 UTC

svn commit: r378914 - in /jakarta/commons/proper/betwixt/trunk/src: java/org/apache/commons/betwixt/strategy/ValueSuppressionStrategy.java test/org/apache/commons/betwixt/strategy/TestValueSuppressionStrategy.java

Author: rdonkin
Date: Sun Feb 19 07:59:12 2006
New Revision: 378914

URL: http://svn.apache.org/viewcvs?rev=378914&view=rev
Log:
Fixed ALLOW_ALL_VALUES bug. Issue#38684.

Added:
    jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/strategy/TestValueSuppressionStrategy.java
Modified:
    jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/strategy/ValueSuppressionStrategy.java

Modified: jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/strategy/ValueSuppressionStrategy.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/strategy/ValueSuppressionStrategy.java?rev=378914&r1=378913&r2=378914&view=diff
==============================================================================
--- jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/strategy/ValueSuppressionStrategy.java (original)
+++ jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/strategy/ValueSuppressionStrategy.java Sun Feb 19 07:59:12 2006
@@ -32,7 +32,7 @@
      */
     public static final ValueSuppressionStrategy ALLOW_ALL_VALUES = new ValueSuppressionStrategy() {
         public boolean suppressAttribute(AttributeDescriptor attributeDescriptor, String value) {
-            return true;
+            return false;
         }
     };
 

Added: jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/strategy/TestValueSuppressionStrategy.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/strategy/TestValueSuppressionStrategy.java?rev=378914&view=auto
==============================================================================
--- jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/strategy/TestValueSuppressionStrategy.java (added)
+++ jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/strategy/TestValueSuppressionStrategy.java Sun Feb 19 07:59:12 2006
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed 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.commons.betwixt.strategy;
+
+import org.apache.commons.betwixt.AttributeDescriptor;
+import org.apache.commons.betwixt.XMLBeanInfo;
+import org.apache.commons.betwixt.XMLIntrospector;
+import org.apache.commons.betwixt.io.read.AddressBean;
+
+import junit.framework.TestCase;
+
+public class TestValueSuppressionStrategy extends TestCase {
+
+    public void testALLOW_ALL_VALUESStrategy() throws Exception {
+        XMLIntrospector introspector = new XMLIntrospector();
+        introspector.getConfiguration().setAttributesForPrimitives(true);
+        XMLBeanInfo beanInfo = introspector.introspect(AddressBean.class);
+        AttributeDescriptor[] descriptors = beanInfo.getElementDescriptor().getAttributeDescriptors();
+        assertTrue(descriptors.length>0);
+        for (int i=0;i<descriptors.length;i++)
+        {
+            assertFalse(ValueSuppressionStrategy.ALLOW_ALL_VALUES.suppressAttribute(descriptors[i], "Arbitrary Value"));
+            assertFalse(ValueSuppressionStrategy.ALLOW_ALL_VALUES.suppressAttribute(descriptors[i], ""));
+            assertFalse(ValueSuppressionStrategy.ALLOW_ALL_VALUES.suppressAttribute(descriptors[i], null));
+        }
+    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org