[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch master updated. v_0.9.30-57-gef24930

Gitbot git-noreply at pixie.qos.ch
Thu Oct 27 22:22:23 CEST 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".

The branch, master has been updated
       via  ef24930c341565098856495fda5deb942fa975de (commit)
      from  4243de1d6d18cc09e6f49d9d09b24a08b0aebd34 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=ef24930c341565098856495fda5deb942fa975de
http://github.com/ceki/logback/commit/ef24930c341565098856495fda5deb942fa975de

commit ef24930c341565098856495fda5deb942fa975de
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Thu Oct 27 22:22:01 2011 +0200

    conditional configuration now supports all property scopes

diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/IfAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/IfAction.java
index 6fcea69..764674c 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/IfAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/IfAction.java
@@ -58,7 +58,7 @@ public class IfAction extends Action {
 
     if (!OptionHelper.isEmpty(conditionAttribute)) {
       conditionAttribute = OptionHelper.substVars(conditionAttribute, ic, context);
-      PropertyEvalScriptBuilder pesb = new PropertyEvalScriptBuilder();
+      PropertyEvalScriptBuilder pesb = new PropertyEvalScriptBuilder(ic);
       pesb.setContext(context);
       try {
         condition = pesb.build(conditionAttribute);
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/MapWrapperForScripts.java b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/MapWrapperForScripts.java
deleted file mode 100644
index 6f4cf9e..0000000
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/MapWrapperForScripts.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- *   or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.core.joran.conditional;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class MapWrapperForScripts {
-  public Map map = new HashMap<String, String>();
-  public String name;
-  
-  
-  public void setMap(Map map) {
-    this.map = map;
-  }
-  public void setName(String name) {
-    this.name = name;
-  }
-  
-  public boolean isNull(String k) {
-    Object o = map.get(k);
-    if (o instanceof String) {
-      return false;
-    }
-    return (System.getProperty(k) == null);
-  }
-  
-  public String p(String k) {
-    return property(k);
-  }
-  
-  public String property(String k) {
-    Object o = map.get(k);
-    if (o instanceof String) {
-      return (String) o;
-    }
-    String v = System.getProperty(k);
-    if(v != null) {
-      return v;
-    }
-    System.getProperties();
-    return "";
-  }
-   
-
-}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyEvalScriptBuilder.java b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyEvalScriptBuilder.java
index d14e0e5..84a26ac 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyEvalScriptBuilder.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyEvalScriptBuilder.java
@@ -18,6 +18,7 @@ import java.lang.reflect.Method;
 import java.util.HashMap;
 import java.util.Map;
 
+import ch.qos.logback.core.spi.PropertyContainer;
 import org.codehaus.janino.ClassBodyEvaluator;
 import org.codehaus.janino.CompileException;
 import org.codehaus.janino.Parser.ParseException;
@@ -28,31 +29,31 @@ import ch.qos.logback.core.spi.ContextAwareBase;
 public class PropertyEvalScriptBuilder extends ContextAwareBase {
 
   private static String SCRIPT_PREFIX = ""
-      + "public boolean evaluate() { return ";
+          + "public boolean evaluate() { return ";
   private static String SCRIPT_SUFFIX = "" + "; }";
 
-  static String SCRIPT = ""
-      + "public boolean eval() { return p(\"Ka\").equals(\"Va\"); }";
+  final PropertyContainer localPropContainer;
+
+  PropertyEvalScriptBuilder(PropertyContainer localPropContainer) {
+    this.localPropContainer = localPropContainer;
+  }
 
   Map<String, String> map = new HashMap<String, String>();
 
   public Condition build(String script) throws IllegalAccessException,
-      CompileException, ParseException, ScanException, InstantiationException,
-      SecurityException, NoSuchMethodException, IllegalArgumentException,
-      InvocationTargetException {
+          CompileException, ParseException, ScanException, InstantiationException,
+          SecurityException, NoSuchMethodException, IllegalArgumentException,
+          InvocationTargetException {
 
     ClassBodyEvaluator cbe = new ClassBodyEvaluator();
-    cbe.setImplementedTypes(new Class[] { Condition.class });
-    cbe.setExtendedType(MapWrapperForScripts.class);
+    cbe.setImplementedTypes(new Class[]{Condition.class});
+    cbe.setExtendedType(PropertyWrapperForScripts.class);
     cbe.cook(SCRIPT_PREFIX + script + SCRIPT_SUFFIX);
 
     Class<?> clazz = cbe.getClazz();
     Condition instance = (Condition) clazz.newInstance();
-    Method setMapMethod = clazz.getMethod("setMap", Map.class);
-    setMapMethod.invoke(instance, context.getCopyOfPropertyMap());
-
-    Method setNameMethod = clazz.getMethod("setName", String.class);
-    setNameMethod.invoke(instance, context.getName());
+    Method setMapMethod = clazz.getMethod("setPropertyContainers", PropertyContainer.class, PropertyContainer.class);
+    setMapMethod.invoke(instance, localPropContainer, context);
 
     return instance;
   }
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyWrapperForScripts.java b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyWrapperForScripts.java
new file mode 100644
index 0000000..f277885
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyWrapperForScripts.java
@@ -0,0 +1,54 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ *   or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.core.joran.conditional;
+
+import ch.qos.logback.core.spi.PropertyContainer;
+import ch.qos.logback.core.util.OptionHelper;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class PropertyWrapperForScripts {
+
+  PropertyContainer local;
+  PropertyContainer context;
+
+  // this method is invoked by reflection in PropertyEvalScriptBuilder
+  public void setPropertyContainers(PropertyContainer local, PropertyContainer context) {
+    this.local = local;
+    this.context = context;
+  }
+
+  public boolean isNull(String k) {
+    String val = OptionHelper.propertyLookup(k, local, context);
+    return (val == null);
+  }
+
+  public boolean isDefined(String k) {
+    String val = OptionHelper.propertyLookup(k, local, context);
+    return (val != null);
+  }
+
+  public String p(String k) {
+    return property(k);
+  }
+  
+  public String property(String k) {
+    String val = OptionHelper.propertyLookup(k, local, context);
+    if(val != null)
+      return val;
+    else
+      return "";
+  }
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ThenAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ThenAction.java
index 1a126ff..d8a44c1 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ThenAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ThenAction.java
@@ -22,7 +22,6 @@ public class ThenAction  extends ThenOrElseActionBase {
   @Override
   void registerEventList(IfAction ifAction, List<SaxEvent> eventList) {
    ifAction.setThenSaxEventList(eventList);
-    
   }
 
 }
diff --git a/logback-core/src/main/java/ch/qos/logback/core/util/OptionHelper.java b/logback-core/src/main/java/ch/qos/logback/core/util/OptionHelper.java
index cdbf8c6..aee1d47 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/util/OptionHelper.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/util/OptionHelper.java
@@ -129,7 +129,7 @@ public class OptionHelper {
           String key = extracted[0];
           String defaultReplacement = extracted[1]; // can be null
 
-          String replacement = lookup(key, pc1, pc2);
+          String replacement = propertyLookup(key, pc1, pc2);
 
           // if replacement is still null, use the defaultReplacement which
           // can be null as well
@@ -156,7 +156,7 @@ public class OptionHelper {
     }
   }
 
-  private static String lookup(String key, PropertyContainer pc1,
+  public static String propertyLookup(String key, PropertyContainer pc1,
                                PropertyContainer pc2) {
     String value = null;
     // first try the props passed as parameter
@@ -292,8 +292,8 @@ public class OptionHelper {
     return dEfault;
   }
 
-  public static boolean isEmpty(String val) {
-    return ((val == null) || CoreConstants.EMPTY_STRING.equals(val));
+  public static boolean isEmpty(String str) {
+    return ((str == null) || CoreConstants.EMPTY_STRING.equals(str));
   }
 
 
diff --git a/logback-core/src/test/input/joran/conditional/if0.xml b/logback-core/src/test/input/joran/conditional/if0.xml
index b843dcc..aed2ac3 100644
--- a/logback-core/src/test/input/joran/conditional/if0.xml
+++ b/logback-core/src/test/input/joran/conditional/if0.xml
@@ -2,7 +2,7 @@
 
 <x>
   <stack name="BEGIN"/>
-  <if condition='p("Ki1").equals("Val1")'>
+  <if condition='p("ki1").equals("val1")'>
     <then>
       <stack name="a"/>
     </then>
diff --git a/logback-core/src/test/input/joran/conditional/ifWithoutElse.xml b/logback-core/src/test/input/joran/conditional/ifSystem.xml
similarity index 56%
copy from logback-core/src/test/input/joran/conditional/ifWithoutElse.xml
copy to logback-core/src/test/input/joran/conditional/ifSystem.xml
index ef1a39f..609a51e 100644
--- a/logback-core/src/test/input/joran/conditional/ifWithoutElse.xml
+++ b/logback-core/src/test/input/joran/conditional/ifSystem.xml
@@ -2,9 +2,10 @@
 
 <x>
   <stack name="BEGIN"/>
-  <if condition='p("Ki1").equals("Val1")'>
+
+  <if condition='isNull("sysKey")'>
     <then>
-      <stack name="a"/>
+      <property scope="context" name="dynaKey" value="dynaVal"/>
     </then>   
   </if>
   <stack name="END"/>
diff --git a/logback-core/src/test/input/joran/conditional/ifWithoutElse.xml b/logback-core/src/test/input/joran/conditional/ifWithoutElse.xml
index ef1a39f..63a02ed 100644
--- a/logback-core/src/test/input/joran/conditional/ifWithoutElse.xml
+++ b/logback-core/src/test/input/joran/conditional/ifWithoutElse.xml
@@ -2,7 +2,7 @@
 
 <x>
   <stack name="BEGIN"/>
-  <if condition='p("Ki1").equals("Val1")'>
+  <if condition='p("ki1").equals("val1")'>
     <then>
       <stack name="a"/>
     </then>   
diff --git a/logback-core/src/test/input/joran/conditional/if0.xml b/logback-core/src/test/input/joran/conditional/if_localProperty.xml
similarity index 86%
copy from logback-core/src/test/input/joran/conditional/if0.xml
copy to logback-core/src/test/input/joran/conditional/if_localProperty.xml
index b843dcc..650f9fa 100644
--- a/logback-core/src/test/input/joran/conditional/if0.xml
+++ b/logback-core/src/test/input/joran/conditional/if_localProperty.xml
@@ -2,6 +2,7 @@
 
 <x>
   <stack name="BEGIN"/>
+  <property name="Ki1" value="Val1"/>
   <if condition='p("Ki1").equals("Val1")'>
     <then>
       <stack name="a"/>
diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/conditional/IfThenElseTest.java b/logback-core/src/test/java/ch/qos/logback/core/joran/conditional/IfThenElseTest.java
index 86acd87..6c6ebcc 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/joran/conditional/IfThenElseTest.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/joran/conditional/IfThenElseTest.java
@@ -14,13 +14,11 @@
 package ch.qos.logback.core.joran.conditional;
 
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Stack;
 
+import ch.qos.logback.core.joran.action.PropertyAction;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -38,14 +36,21 @@ import ch.qos.logback.core.testUtil.RandomUtil;
 import ch.qos.logback.core.util.CoreTestConstants;
 import ch.qos.logback.core.util.StatusPrinter;
 
+import static org.junit.Assert.*;
+
 public class IfThenElseTest {
 
   Context context = new ContextBase();
+  StatusChecker checker = new StatusChecker(context);
   TrivialConfigurator tc;
   int diff = RandomUtil.getPositiveInt();
   static final String CONDITIONAL_DIR_PREFIX = CoreTestConstants.JORAN_INPUT_PREFIX
   + "conditional/";
 
+  String ki1 = "ki1";
+  String val1 = "val1";
+  String sysKey = "sysKey";
+  String dynaKey = "dynaKey";
 
   StackAction stackAction = new StackAction();
 
@@ -54,12 +59,13 @@ public class IfThenElseTest {
     HashMap<Pattern, Action> rulesMap = new HashMap<Pattern, Action>();
     rulesMap.put(new Pattern("x"), new NOPAction());
     rulesMap.put(new Pattern("x/stack"), stackAction);
+    rulesMap.put(new Pattern("x/property"), new PropertyAction());
     rulesMap.put(new Pattern("*/if"), new IfAction());
     rulesMap.put(new Pattern("*/if/then"), new ThenAction());
     rulesMap.put(new Pattern("*/if/then/*"), new NOPAction());
     rulesMap.put(new Pattern("*/if/else"), new ElseAction());
-    rulesMap.put(new Pattern("*/if/else/*"), new NOPAction());    
-    
+    rulesMap.put(new Pattern("*/if/else/*"), new NOPAction());
+
     tc = new TrivialConfigurator(rulesMap);
     tc.setContext(context);
   }
@@ -67,51 +73,73 @@ public class IfThenElseTest {
   @After
   public void tearDown() throws Exception {
     StatusPrinter.printIfErrorsOccured(context);
-    //StackAction.reset();
+    System.clearProperty(sysKey);
   }
 
   @Test
-  public void if0_Then() throws JoranException {
-    context.putProperty("Ki1", "Val1");
+  public void whenContextPropertyIsSet_IfThenBranchIsEvaluated() throws JoranException {
+    context.putProperty(ki1, val1);
     tc.doConfigure(CONDITIONAL_DIR_PREFIX+"if0.xml");
     verifyConfig(new String[] {"BEGIN", "a", "END"});
   }
 
   @Test
-  public void if0_Else() throws JoranException {
+  public void whenLocalPropertyIsSet_IfThenBranchIsEvaluated() throws JoranException {
+    tc.doConfigure(CONDITIONAL_DIR_PREFIX+"if_localProperty.xml");
+    verifyConfig(new String[] {"BEGIN", "a", "END"});
+  }
+
+
+  @Test
+  public void whenNoPropertyIsDefined_ElseBranchIsEvaluated() throws JoranException {
     tc.doConfigure(CONDITIONAL_DIR_PREFIX+"if0.xml");
     verifyConfig(new String[] {"BEGIN", "b", "END"});
   }
 
   @Test
-  public void ifWithoutElse_True() throws JoranException {
-    context.putProperty("Ki1", "Val1");
+  public void whenContextPropertyIsSet_IfThenBranchIsEvaluated_NO_ELSE_DEFINED() throws JoranException {
+    context.putProperty(ki1, val1);
     tc.doConfigure(CONDITIONAL_DIR_PREFIX+"ifWithoutElse.xml");
     verifyConfig(new String[] {"BEGIN", "a", "END"});
   }
 
   @Test
-  public void ifWithoutElse_False() throws JoranException {
+  public void whenNoPropertyIsDefined_IfThenBranchIsNotEvaluated_NO_ELSE_DEFINED() throws JoranException {
     tc.doConfigure(CONDITIONAL_DIR_PREFIX+"ifWithoutElse.xml");
     verifyConfig(new String[] {"BEGIN", "END"});
-    StatusChecker checker = new StatusChecker(context);
     assertTrue(checker.isErrorFree(0));
   }
 
-  
   @Test
   public void nestedIf() throws JoranException {
     tc.doConfigure(CONDITIONAL_DIR_PREFIX+"nestedIf.xml");
-    StatusPrinter.printIfErrorsOccured(context);
     verifyConfig(new String[] {"BEGIN", "a", "c", "END"});
+    assertTrue(checker.isErrorFree(0));
   }
-  
-  void verifyConfig(String[] expected) {
+
+  @Test
+  public void useNonExistenceOfSystemPropertyToDefineAContextProperty() throws JoranException {
+    assertNull(System.getProperty(sysKey));
+    assertNull(context.getProperty(dynaKey));
+    tc.doConfigure(CONDITIONAL_DIR_PREFIX+"ifSystem.xml");
+    System.out.println(dynaKey+"="+context.getProperty(dynaKey));
+    assertNotNull(context.getProperty(dynaKey));
+  }
+
+  @Test
+  public void noContextPropertyShouldBeDefinedIfSystemPropertyExists() throws JoranException {
+    System.setProperty(sysKey, "a");
+    assertNull(context.getProperty(dynaKey));
+    System.out.println("before "+dynaKey+"="+context.getProperty(dynaKey));
+    tc.doConfigure(CONDITIONAL_DIR_PREFIX+"ifSystem.xml");
+    System.out.println(dynaKey+"="+context.getProperty(dynaKey));
+    assertNull(context.getProperty(dynaKey));
+  }
+
+  private void verifyConfig(String[] expected) {
     Stack<String> witness = new Stack<String>();
     witness.addAll(Arrays.asList(expected));
     assertEquals(witness, stackAction.getStack());
   }
-  
-  
-  
+
 }
diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/conditional/PropertyEvalScriptBuilderTest.java b/logback-core/src/test/java/ch/qos/logback/core/joran/conditional/PropertyEvalScriptBuilderTest.java
index 22b7d0c..30f6e74 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/joran/conditional/PropertyEvalScriptBuilderTest.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/joran/conditional/PropertyEvalScriptBuilderTest.java
@@ -15,6 +15,13 @@ package ch.qos.logback.core.joran.conditional;
 
 import static org.junit.Assert.*;
 
+import ch.qos.logback.core.joran.spi.InterpretationContext;
+import ch.qos.logback.core.joran.spi.Interpreter;
+import ch.qos.logback.core.spi.PropertyContainer;
+import org.codehaus.janino.CompileException;
+import org.codehaus.janino.Parser;
+import org.codehaus.janino.Scanner;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -22,57 +29,93 @@ import ch.qos.logback.core.Context;
 import ch.qos.logback.core.ContextBase;
 import ch.qos.logback.core.testUtil.RandomUtil;
 
+import java.lang.reflect.InvocationTargetException;
+
 public class PropertyEvalScriptBuilderTest {
 
-  
+
   Context context = new ContextBase();
-  PropertyEvalScriptBuilder pesb = new PropertyEvalScriptBuilder();
+  InterpretationContext localPropContainer = new InterpretationContext(context, null);
+  PropertyEvalScriptBuilder pesb = new PropertyEvalScriptBuilder(localPropContainer);
   int diff = RandomUtil.getPositiveInt();
-  
+
+  String k = "ka" + diff;
+  String v = "va";
+  String containsScript = "p(\"" + k + "\").contains(\"" + v + "\")";
+
+  String isNullScriptStr = "isNull(\"" + k + "\")";
+
   @Before
   public void setUp() {
-    context.setName("c"+diff);
+    context.setName("c" + diff);
     pesb.setContext(context);
   }
-  
-  @Test
-  public void existing() throws Exception {
-    String k = "ka"+diff;
-    context.putProperty("ka"+diff, "va");
-    Condition condition = pesb.build("p(\""+k+"\").contains(\"va\")");
+
+  @After
+  public void tearDown() {
+    System.clearProperty(k);
+  }
+
+
+  void buildAndAssertTrue(String scriptStr) throws Exception {
+    Condition condition = pesb.build(scriptStr);
     assertNotNull(condition);
     assertTrue(condition.evaluate());
   }
 
-  @Test
-  public void isNullForExisting() throws Exception {
-    String k = "ka"+diff;
-    context.putProperty("ka"+diff, "va");
-    Condition condition = pesb.build("isNull(\""+k+"\")");
+  void buildAndAssertFalse(String scriptStr) throws Exception {
+    Condition condition = pesb.build(scriptStr);
     assertNotNull(condition);
     assertFalse(condition.evaluate());
   }
 
-  
   @Test
-  public void inexistentProperty() throws Exception {
-    String k = "ka"+diff;
-    Condition condition = pesb.build("p(\""+k+"\").contains(\"va\")");
-    assertNotNull(condition);
-    assertFalse(condition.evaluate());
+  public void existingLocalPropertyShouldEvaluateToTrue() throws Exception {
+    localPropContainer.addSubstitutionProperty(k, v);
+    buildAndAssertTrue(containsScript);
   }
 
   @Test
-  public void isNullForInexistent() throws Exception {
-    String k = "ka"+diff;
-    Condition condition = pesb.build("isNull(\""+k+"\")");
-    assertNotNull(condition);
-    assertTrue(condition.evaluate());
+  public void existingContextPropertyShouldEvaluateToTrue() throws Exception {
+    context.putProperty(k, v);
+    buildAndAssertTrue(containsScript);
+  }
+
+  @Test
+  public void existingSystemPropertyShouldEvaluateToTrue() throws Exception {
+    System.setProperty(k, v);
+    buildAndAssertTrue(containsScript);
+  }
+
+  @Test
+  public void isNullForExistingLocalProperty() throws Exception {
+    localPropContainer.addSubstitutionProperty(k, v);
+    buildAndAssertFalse(isNullScriptStr);
+  }
+  @Test
+  public void isNullForExistingContextProperty() throws Exception {
+    context.putProperty(k, v);
+    buildAndAssertFalse(isNullScriptStr);
+  }
+  @Test
+  public void isNullForExistingSystemProperty() throws Exception {
+    System.setProperty(k, v);
+    buildAndAssertFalse(isNullScriptStr);
+  }
+
+  @Test
+  public void inexistentPropertyShouldEvaluateToFalse() throws Exception {
+    buildAndAssertFalse(containsScript);
+  }
+
+  @Test
+  public void isNullForInexistentPropertyShouldEvaluateToTrue() throws Exception {
+    buildAndAssertTrue(isNullScriptStr);
   }
 
   @Test
   public void nameOK() throws Exception {
-    Condition condition = pesb.build("name.contains(\""+context.getName()+"\")");
+    Condition condition = pesb.build("name.contains(\"" + context.getName() + "\")");
     assertNotNull(condition);
     assertTrue(condition.evaluate());
   }
@@ -83,5 +126,5 @@ public class PropertyEvalScriptBuilderTest {
     assertNotNull(condition);
     assertFalse(condition.evaluate());
   }
-  
+
 }
diff --git a/logback-site/src/site/pages/dependencies.html b/logback-site/src/site/pages/dependencies.html
index 2d541ab..51bf6bf 100644
--- a/logback-site/src/site/pages/dependencies.html
+++ b/logback-site/src/site/pages/dependencies.html
@@ -44,16 +44,6 @@
       </tr>
 
       <tr class="b">
-        <td>JMSAppender</td>
-        <td>
-          <ul>
-            <li><a href="http://java.sun.com/products/jms/docs.html">JMS
-            API</a> version 1.1
-            </li>
-          </ul>
-        </td>      
-      </tr>
-        <tr class="a">
         <td><code>JaninoEventEvaluatorBase</code> and derived classes</td>
         <td>
           <ul>
@@ -62,7 +52,7 @@
         </td>
       </tr>
 
-      <tr class="b">
+      <tr class="a">
         <td><code>SMTPAppenderBase</code> and derived classes</td>
         <td>
           <ul>         
@@ -169,7 +159,7 @@
         <td>Overall</td>
         <td>
           <ul>
-            <li>JDK 1.5
+            <li>JDK 1.6
             </li>
           </ul>
         </td>       
@@ -201,7 +191,7 @@
         <td>ch.qos.logback.access.jetty.*</td>
         <td>
           <ul>
-            <li><a href="http://jetty.mortbay.org">Jetty</a> version 6.1.1
+            <li><a href="http://jetty.mortbay.org">Jetty</a> version 7.5.1
             </li>
           </ul>
         </td>       
@@ -211,7 +201,7 @@
         <td>ch.qos.logback.access.tomcat.*</td>
         <td>
           <ul>
-            <li><a href="http://tomcat.apache.org">Tomcat</a> version 5.5.15
+            <li><a href="http://tomcat.apache.org">Tomcat</a> version 7.0.21
             </li>
           </ul>
         </td>       
diff --git a/logback-site/src/site/pages/manual/introduction.html b/logback-site/src/site/pages/manual/introduction.html
index ced1c5d..8fef46f 100644
--- a/logback-site/src/site/pages/manual/introduction.html
+++ b/logback-site/src/site/pages/manual/introduction.html
@@ -257,19 +257,10 @@ public class HelloWorld2 {
   adhere to the conditions of the LGPL license or the EPL license.
   </p>
 
-  <p>Certain logback <b>test cases</b> are written in Scala. Moreover,
-  logback offers a Groovy-based configurator. If you wish to hack
-  logback, you will probably want to import it as a project into your
-  favorite IDE. As of this writing (2011-10-26), the author was unable
-  to have the project build under Eclipse due to problems related to
-  Scala and/or Groovy support. Fortunately, assuming the Scala plugin
-  is installed, logback can be imported into IntelliJ IDEA within
-  seconds and builds just fine.</p>
-
-  <p>If you are able to install both Scala and Groovy under Eclipse,
-  and thus presumably build logback under Eclipse, please report your
-  extraordinary technical feat on the logback-dev mailing list.</p>
-
+  <p>For building logback udner an IDE, please see the <a
+  href="../setup.html#ide">relevant section on the class path setup
+  page</a>.</p>
+  
   <script src="../templates/footer.js" type="text/javascript"></script>
 </div>
 </body>
diff --git a/logback-site/src/site/pages/setup.html b/logback-site/src/site/pages/setup.html
index 7ec3047..79638d0 100644
--- a/logback-site/src/site/pages/setup.html
+++ b/logback-site/src/site/pages/setup.html
@@ -104,14 +104,23 @@
    
     
 
-   <h3><a name="eclipse" href="#eclipse">Using an IDE,
-   e.g. Eclipse</a></h3>
+   <h3><a name="ide" href="#ide">Building with an IDE, e.g. IntelliJ
+   IDEA</a></h3>
    
-   <p>You can import the logback project into Eclipse. Since logback
-   uses maven as its build system, the "maven eclipse:eclipse" command
-   will create the <em>.classpath</em> and <em>.project</em> files for
-   Eclipse. You can then import the logback project into Eclipse in one
-   or two clicks.</p>
+   <p>Certain logback test cases are written in Scala. Moreover,
+   logback offers a Groovy-based configurator. If you wish to hack
+   logback, you will probably want to import it as a project into your
+   favorite IDE. As of this writing (2011-10-26), the author was
+   unable to have the project build under Eclipse due to problems
+   related to Scala and/or Groovy support. Fortunately, assuming the
+   Scala plugin is installed, logback can be imported into IntelliJ
+   IDEA within seconds and built just fine.
+   </p>
+
+   <p>If you are able to install both Scala and Groovy under Eclipse,
+   and thus presumably build logback under Eclipse, please report your
+   extraordinary technical feat on the logback-dev mailing list.
+   </p>
 
 	
    <script src="templates/footer.js" type="text/javascript"></script>
diff --git a/logback-site/src/site/pages/templates/creative.js b/logback-site/src/site/pages/templates/creative.js
index 555b746..0fe04c7 100644
--- a/logback-site/src/site/pages/templates/creative.js
+++ b/logback-site/src/site/pages/templates/creative.js
@@ -5,7 +5,7 @@ document.write('        <td>        ');
 document.write('          <p class="author">');
 document.write('            Authors: Ceki Gülcü, Sébastien Pennec');
 document.write('          <br/>');
-document.write('          Copyright © 2000-2010, QOS.ch</p>');
+document.write('          Copyright © 2000-2011, QOS.ch</p>');
 document.write('        </td>');
 document.write('        <td>');
 document.write('            <a rel="license"');

-----------------------------------------------------------------------

Summary of changes:
 .../logback/core/joran/conditional/IfAction.java   |    2 +-
 .../joran/conditional/MapWrapperForScripts.java    |   57 -----------
 .../conditional/PropertyEvalScriptBuilder.java     |   27 +++---
 .../conditional/PropertyWrapperForScripts.java     |   54 +++++++++++
 .../logback/core/joran/conditional/ThenAction.java |    1 -
 .../ch/qos/logback/core/util/OptionHelper.java     |    8 +-
 .../src/test/input/joran/conditional/if0.xml       |    2 +-
 .../{ifWithoutElse.xml => ifSystem.xml}            |    5 +-
 .../test/input/joran/conditional/ifWithoutElse.xml |    2 +-
 .../conditional/{if0.xml => if_localProperty.xml}  |    1 +
 .../core/joran/conditional/IfThenElseTest.java     |   68 ++++++++++----
 .../conditional/PropertyEvalScriptBuilderTest.java |   99 ++++++++++++++------
 logback-site/src/site/pages/dependencies.html      |   18 +---
 .../src/site/pages/manual/introduction.html        |   17 +---
 logback-site/src/site/pages/setup.html             |   23 +++--
 logback-site/src/site/pages/templates/creative.js  |    2 +-
 16 files changed, 223 insertions(+), 163 deletions(-)
 delete mode 100644 logback-core/src/main/java/ch/qos/logback/core/joran/conditional/MapWrapperForScripts.java
 create mode 100644 logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyWrapperForScripts.java
 copy logback-core/src/test/input/joran/conditional/{ifWithoutElse.xml => ifSystem.xml} (56%)
 copy logback-core/src/test/input/joran/conditional/{if0.xml => if_localProperty.xml} (86%)


hooks/post-receive
-- 
Logback: the generic, reliable, fast and flexible logging framework.


More information about the logback-dev mailing list