abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From calav...@apache.org
Subject svn commit: r955502 - in /abdera/java/trunk/dependencies/i18n/src: main/java/org/apache/abdera/i18n/templates/Operation.java test/java/org/apache/abdera/i18n/test/templates/ test/java/org/apache/abdera/i18n/test/templates/TestTemplate.java
Date Thu, 17 Jun 2010 08:06:37 GMT
Author: calavera
Date: Thu Jun 17 08:06:36 2010
New Revision: 955502

URL: http://svn.apache.org/viewvc?rev=955502&view=rev
Log:
fixes negative behaviour on uri templates

Added:
    abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/templates/
    abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/templates/TestTemplate.java
Modified:
    abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/templates/Operation.java

Modified: abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/templates/Operation.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/templates/Operation.java?rev=955502&r1=955501&r2=955502&view=diff
==============================================================================
--- abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/templates/Operation.java
(original)
+++ abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/templates/Operation.java
Thu Jun 17 08:06:36 2010
@@ -543,10 +543,10 @@ public abstract class Operation implemen
         public String evaluate(String var, String arg, Context context) {
             String[] vardefs = var.split("\\s*,\\s*");
             for (String v : vardefs) {
-                if (!isdefined(v, context))
-                    return arg;
+                if (isdefined(v, context))
+                    return null;
             }
-            return null;
+            return arg;
         }
 
         public void explain(String var, String arg, Appendable buf) throws IOException {

Added: abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/templates/TestTemplate.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/templates/TestTemplate.java?rev=955502&view=auto
==============================================================================
--- abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/templates/TestTemplate.java
(added)
+++ abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/templates/TestTemplate.java
Thu Jun 17 08:06:36 2010
@@ -0,0 +1,23 @@
+package org.apache.abdera.i18n.test.templates;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.abdera.i18n.templates.Template;
+
+import org.junit.Test;
+
+public class TestTemplate {
+  
+    @Test
+    public void testTemplateNeg() {
+        Template t = new Template("*http://cnn.com/{-neg|all|foo,bar}");
+        Map m = new HashMap();
+        m.put("foo", "value");
+        String out = t.expand(m);
+
+        assertEquals("*http://cnn.com/", out);
+    }
+}



Mime
View raw message