lenya-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jann Forrer <jann.for...@id.uzh.ch>
Subject Re: svn commit: r653799 - in /lenya/branches/branch_1_2_x_shibboleth/src: java/org/apache/lenya/ac/impl/antlr/ test/org/apache/lenya/ac/impl/
Date Tue, 13 May 2008 09:09:19 GMT
Hi Andreas
> 
> Jann Forrer schrieb:
>> Hi Andereas
>>
>> What about the
>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src.......
>> references everywhere? Seems to be your local home directory ;-)
> 
> thanks for spotting! Now the Java files are generated during the build
> process, so the paths should correspond to your local directory structure.
> 
Thanks for fixing it. It seems that the used antlr version needs java
1.5. It does not build with java 1.4.2.

Jann


> -- Andreas
> 
> 
>>
>> Jann
>>
>>
>>
>>> New Revision: 653799
>>>
>>> URL: http://svn.apache.org/viewvc?rev=653799&view=rev
>>> Log:
>>> Adding capability to handle multi-value attributes with test case.
>>>
>>> Added:
>>>    
>>> lenya/branches/branch_1_2_x_shibboleth/src/test/org/apache/lenya/ac/impl/RuleEvaluatorTest.java
>>>
>>> Modified:
>>>    
>>> lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g
>>>
>>>    
>>> lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/ExpressionsLexer.java
>>>
>>>    
>>> lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/ExpressionsParser.java
>>>
>>>    
>>> lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/expressions__.g
>>>
>>>
>>> Modified:
>>> lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g
>>>
>>> URL:
>>> http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g?rev=653799&r1=653798&r2=653799&view=diff
>>>
>>> ==============================================================================
>>>
>>> ---
>>> lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g
>>> (original)
>>> +++
>>> lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g
>>> Tue May  6 08:11:12 2008
>>> @@ -3,12 +3,12 @@
>>>  @header {
>>>  package org.apache.lenya.ac.impl.antlr;
>>>  import java.util.HashMap;
>>> -import org.apache.lenya.ac.impl.ErrorHandler;
>>> +import org.apache.lenya.ac.ErrorHandler;
>>>  }
>>>  
>>>  @lexer::header {
>>>  package org.apache.lenya.ac.impl.antlr;
>>> -import org.apache.lenya.ac.impl.ErrorHandler;
>>> +import org.apache.lenya.ac.ErrorHandler;
>>>  }
>>>  
>>>  @members {
>>> @@ -65,17 +65,31 @@
>>>      ;
>>>       comparison returns [boolean value]
>>> -    :   a=atom EQUALS b=atom {$value = $a.value.equals($b.value);}
>>> +    :   a=atom EQUALS b=atom {
>>> +            if ($a.value instanceof String && $b.value instanceof
>>> String) {
>>> +                $value = $a.value.equals($b.value);
>>> +            }
>>> +            else if ($a.value instanceof String &&
>>> $b.value.getClass().isArray()) {
>>> +                $value = java.util.Arrays.asList((String[])
>>> $b.value).contains($a.value);
>>> +            }
>>> +            else if ($a.value.getClass().isArray() && $b.value
>>> instanceof String) {
>>> +                $value = java.util.Arrays.asList((String[])
>>> $a.value).contains($b.value);
>>> +            }
>>> +            else {
>>> +                throw new FailedPredicateException(input, $a.text +
>>> " == " + $b.text,
>>> +                    "Incompatible arguments for comparison: " +
>>> $a.value + ", " + $b.value);
>>> +            }
>>> +        }
>>>      |   LEFTPAR e=orExpression RIGHTPAR {$value = $e.value;}
>>>      ;
>>>  
>>> -atom returns [String value]
>>> +atom returns [Object value]
>>>      :   quotedString {$value = $quotedString.value;}
>>>      |   ID
>>>          {
>>> -            String s = (String) memory.get($ID.text);
>>> -            if ( s != null ) {
>>> -                $value = s;
>>> +            Object v = memory.get($ID.text);
>>> +            if ( v != null ) {
>>> +                $value = v;
>>>              }
>>>              else {
>>>                  $value = "undefined";
>>>
>>> Modified:
>>> lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/ExpressionsLexer.java
>>>
>>> URL:
>>> http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/ExpressionsLexer.java?rev=653799&r1=653798&r2=653799&view=diff
>>>
>>> ==============================================================================
>>>
>>> ---
>>> lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/ExpressionsLexer.java
>>> (original)
>>> +++
>>> lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/ExpressionsLexer.java
>>> Tue May  6 08:11:12 2008
>>> @@ -1,4 +1,4 @@
>>> -// $ANTLR 3.0 src/java/org/apache/lenya/ac/impl/antlr/Expressions.g
>>> 2007-06-19 15:30:41
>>> +// $ANTLR 3.0.1
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g
>>> 2008-05-06 16:50:47
>>>  
>>>  package org.apache.lenya.ac.impl.antlr;
>>>  import org.apache.lenya.ac.ErrorHandler;
>>> @@ -37,17 +37,17 @@
>>>      public ExpressionsLexer(CharStream input) {
>>>          super(input);
>>>      }
>>> -    public String getGrammarFileName() { return
>>> "src/java/org/apache/lenya/ac/impl/antlr/Expressions.g"; }
>>> +    public String getGrammarFileName() { return
>>> "/Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g";
>>> }
>>>  
>>>      // $ANTLR start LITERAL
>>>      public final void mLITERAL() throws RecognitionException {
>>>          try {
>>>              int _type = LITERAL;
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:92:10: ( '\"' (
>>> 'a' .. 'z' | 'A' .. 'Z' | '_' | ' ' | '.' )* '\"' )
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:92:10: '\"' (
>>> 'a' .. 'z' | 'A' .. 'Z' | '_' | ' ' | '.' )* '\"'
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:106:8:
>>> ( '\"' ( 'a' .. 'z' | 'A' .. 'Z' | '_' | ' ' | '.' )* '\"' )
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:106:10:
>>> '\"' ( 'a' .. 'z' | 'A' .. 'Z' | '_' | ' ' | '.' )* '\"'
>>>              {
>>>              match('\"'); -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:92:14: ( 'a' ..
>>> 'z' | 'A' .. 'Z' | '_' | ' ' | '.' )*
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:106:14:
>>> ( 'a' .. 'z' | 'A' .. 'Z' | '_' | ' ' | '.' )*
>>>              loop1:
>>>              do {
>>>                  int alt1=2;
>>> @@ -60,7 +60,7 @@
>>>  
>>>                  switch (alt1) {
>>>                  case 1 :
>>> -                    //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:
>>> +                    //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:
>>>
>>>                      {
>>>                      if ( input.LA(1)=='
>>> '||input.LA(1)=='.'||(input.LA(1)>='A' &&
>>> input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' &&
>>> input.LA(1)<='z') ) {
>>>                          input.consume();
>>> @@ -96,8 +96,8 @@
>>>      public final void mID() throws RecognitionException {
>>>          try {
>>>              int _type = ID;
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:93:5: ( ( 'a'
>>> .. 'z' | 'A' .. 'Z' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' )* )
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:93:5: ( 'a' ..
>>> 'z' | 'A' .. 'Z' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' )*
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:107:3:
>>> ( ( 'a' .. 'z' | 'A' .. 'Z' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9'
>>> )* )
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:107:5:
>>> ( 'a' .. 'z' | 'A' .. 'Z' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' )*
>>>              {
>>>              if ( (input.LA(1)>='A' &&
>>> input.LA(1)<='Z')||(input.LA(1)>='a' && input.LA(1)<='z') ) {
>>>                  input.consume();
>>> @@ -109,7 +109,7 @@
>>>                  recover(mse);    throw mse;
>>>              }
>>>  
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:93:25: ( 'a' ..
>>> 'z' | 'A' .. 'Z' | '0' .. '9' )*
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:107:25:
>>> ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' )*
>>>              loop2:
>>>              do {
>>>                  int alt2=2;
>>> @@ -122,7 +122,7 @@
>>>  
>>>                  switch (alt2) {
>>>                  case 1 :
>>> -                    //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:
>>> +                    //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:
>>>
>>>                      {
>>>                      if ( (input.LA(1)>='0' &&
>>> input.LA(1)<='9')||(input.LA(1)>='A' &&
>>> input.LA(1)<='Z')||(input.LA(1)>='a' && input.LA(1)<='z') ) {
>>>                          input.consume();
>>> @@ -157,8 +157,8 @@
>>>      public final void mEQUALS() throws RecognitionException {
>>>          try {
>>>              int _type = EQUALS;
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:94:9: ( '==' )
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:94:9: '=='
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:108:7:
>>> ( '==' )
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:108:9:
>>> '=='
>>>              {
>>>              match("==");  
>>> @@ -176,8 +176,8 @@
>>>      public final void mQUOT() throws RecognitionException {
>>>          try {
>>>              int _type = QUOT;
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:95:7: ( '\"' )
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:95:7: '\"'
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:109:5:
>>> ( '\"' )
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:109:7:
>>> '\"'
>>>              {
>>>              match('\"');  
>>> @@ -194,8 +194,8 @@
>>>      public final void mOR() throws RecognitionException {
>>>          try {
>>>              int _type = OR;
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:96:5: ( '||' )
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:96:5: '||'
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:110:3:
>>> ( '||' )
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:110:5:
>>> '||'
>>>              {
>>>              match("||");  
>>> @@ -213,8 +213,8 @@
>>>      public final void mAND() throws RecognitionException {
>>>          try {
>>>              int _type = AND;
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:97:6: ( '&&' )
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:97:6: '&&'
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:111:4:
>>> ( '&&' )
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:111:6:
>>> '&&'
>>>              {
>>>              match("&&");  
>>> @@ -232,8 +232,8 @@
>>>      public final void mLEFTPAR() throws RecognitionException {
>>>          try {
>>>              int _type = LEFTPAR;
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:98:10: ( '(' )
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:98:10: '('
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:112:8:
>>> ( '(' )
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:112:10:
>>> '('
>>>              {
>>>              match('(');  
>>> @@ -250,8 +250,8 @@
>>>      public final void mRIGHTPAR() throws RecognitionException {
>>>          try {
>>>              int _type = RIGHTPAR;
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:99:11: ( ')' )
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:99:11: ')'
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:113:9:
>>> ( ')' )
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:113:11:
>>> ')'
>>>              {
>>>              match(')');  
>>> @@ -268,10 +268,10 @@
>>>      public final void mWS() throws RecognitionException {
>>>          try {
>>>              int _type = WS;
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:100:5: ( ( ' '
>>> | '\\t' )+ )
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:100:5: ( ' ' |
>>> '\\t' )+
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:114:3:
>>> ( ( ' ' | '\\t' )+ )
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:114:5:
>>> ( ' ' | '\\t' )+
>>>              {
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:100:5: ( ' ' |
>>> '\\t' )+
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:114:5:
>>> ( ' ' | '\\t' )+
>>>              int cnt3=0;
>>>              loop3:
>>>              do {
>>> @@ -285,7 +285,7 @@
>>>  
>>>                  switch (alt3) {
>>>                  case 1 :
>>> -                    //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:
>>> +                    //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:
>>>
>>>                      {
>>>                      if ( input.LA(1)=='\t'||input.LA(1)==' ' ) {
>>>                          input.consume();
>>> @@ -322,7 +322,7 @@
>>>      // $ANTLR end WS
>>>  
>>>      public void mTokens() throws RecognitionException {
>>> -        //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:10: ( LITERAL
>>> | ID | EQUALS | QUOT | OR | AND | LEFTPAR | RIGHTPAR | WS )
>>> +        //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:8:
>>> ( LITERAL | ID | EQUALS | QUOT | OR | AND | LEFTPAR | RIGHTPAR | WS )
>>>          int alt4=9;
>>>          switch ( input.LA(1) ) {
>>>          case '\"':
>>> @@ -432,63 +432,63 @@
>>>  
>>>          switch (alt4) {
>>>              case 1 :
>>> -                //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:10: LITERAL
>>> +                //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:10:
>>> LITERAL
>>>                  {
>>>                  mLITERAL();  
>>>                  }
>>>                  break;
>>>              case 2 :
>>> -                //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:18: ID
>>> +                //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:18:
>>> ID
>>>                  {
>>>                  mID();  
>>>                  }
>>>                  break;
>>>              case 3 :
>>> -                //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:21: EQUALS
>>> +                //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:21:
>>> EQUALS
>>>                  {
>>>                  mEQUALS();  
>>>                  }
>>>                  break;
>>>              case 4 :
>>> -                //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:28: QUOT
>>> +                //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:28:
>>> QUOT
>>>                  {
>>>                  mQUOT();  
>>>                  }
>>>                  break;
>>>              case 5 :
>>> -                //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:33: OR
>>> +                //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:33:
>>> OR
>>>                  {
>>>                  mOR();  
>>>                  }
>>>                  break;
>>>              case 6 :
>>> -                //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:36: AND
>>> +                //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:36:
>>> AND
>>>                  {
>>>                  mAND();  
>>>                  }
>>>                  break;
>>>              case 7 :
>>> -                //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:40: LEFTPAR
>>> +                //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:40:
>>> LEFTPAR
>>>                  {
>>>                  mLEFTPAR();  
>>>                  }
>>>                  break;
>>>              case 8 :
>>> -                //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:48: RIGHTPAR
>>> +                //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:48:
>>> RIGHTPAR
>>>                  {
>>>                  mRIGHTPAR();  
>>>                  }
>>>                  break;
>>>              case 9 :
>>> -                //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:57: WS
>>> +                //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:1:57:
>>> WS
>>>                  {
>>>                  mWS();  
>>>
>>> Modified:
>>> lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/ExpressionsParser.java
>>>
>>> URL:
>>> http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/ExpressionsParser.java?rev=653799&r1=653798&r2=653799&view=diff
>>>
>>> ==============================================================================
>>>
>>> ---
>>> lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/ExpressionsParser.java
>>> (original)
>>> +++
>>> lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/ExpressionsParser.java
>>> Tue May  6 08:11:12 2008
>>> @@ -1,8 +1,7 @@
>>> -// $ANTLR 3.0 src/java/org/apache/lenya/ac/impl/antlr/Expressions.g
>>> 2007-06-19 15:30:40
>>> +// $ANTLR 3.0.1
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g
>>> 2008-05-06 16:50:45
>>>  
>>>  package org.apache.lenya.ac.impl.antlr;
>>>  import java.util.HashMap;
>>> -
>>>  import org.apache.lenya.ac.ErrorHandler;
>>>  
>>>  
>>> @@ -32,7 +31,7 @@
>>>           
>>>      public String[] getTokenNames() { return tokenNames; }
>>> -    public String getGrammarFileName() { return
>>> "src/java/org/apache/lenya/ac/impl/antlr/Expressions.g"; }
>>> +    public String getGrammarFileName() { return
>>> "/Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g";
>>> }
>>>  
>>>  
>>>      /** Map variable name to object holding value */
>>> @@ -62,7 +61,7 @@
>>>  
>>>  
>>>      // $ANTLR start prog
>>> -    // src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:53:1:
>>> prog returns [boolean value] : e= orExpression ;
>>> +    //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:53:1:
>>> prog returns [boolean value] : e= orExpression ;
>>>      public final boolean prog() throws RecognitionException {
>>>          boolean value = false;
>>>  
>>> @@ -70,8 +69,8 @@
>>>  
>>>  
>>>          try {
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:54:7: (e=
>>> orExpression )
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:54:7: e=
>>> orExpression
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:54:5:
>>> (e= orExpression )
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:54:7:
>>> e= orExpression
>>>              {
>>>              pushFollow(FOLLOW_orExpression_in_prog50);
>>>              e=orExpression();
>>> @@ -94,7 +93,7 @@
>>>  
>>>  
>>>      // $ANTLR start orExpression
>>> -    // src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:57:1:
>>> orExpression returns [boolean value] : e= andExpression ( OR e=
>>> andExpression )* ;
>>> +    //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:57:1:
>>> orExpression returns [boolean value] : e= andExpression ( OR e=
>>> andExpression )* ;
>>>      public final boolean orExpression() throws RecognitionException {
>>>          boolean value = false;
>>>  
>>> @@ -102,15 +101,15 @@
>>>  
>>>  
>>>          try {
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:58:9: (e=
>>> andExpression ( OR e= andExpression )* )
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:58:9: e=
>>> andExpression ( OR e= andExpression )*
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:58:5:
>>> (e= andExpression ( OR e= andExpression )* )
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:58:9:
>>> e= andExpression ( OR e= andExpression )*
>>>              {
>>>              pushFollow(FOLLOW_andExpression_in_orExpression77);
>>>              e=andExpression();
>>>              _fsp--;
>>>  
>>>              value = e; -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:59:5: ( OR e=
>>> andExpression )*
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:59:5:
>>> ( OR e= andExpression )*
>>>              loop1:
>>>              do {
>>>                  int alt1=2;
>>> @@ -123,7 +122,7 @@
>>>  
>>>                  switch (alt1) {
>>>                  case 1 :
>>> -                    //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:59:7: OR e=
>>> andExpression
>>> +                    //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:59:7:
>>> OR e= andExpression
>>>                      {
>>>                      match(input,OR,FOLLOW_OR_in_orExpression87);
>>>                      pushFollow(FOLLOW_andExpression_in_orExpression91);
>>> @@ -156,7 +155,7 @@
>>>  
>>>  
>>>      // $ANTLR start andExpression
>>> -    // src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:62:1:
>>> andExpression returns [boolean value] : e= comparison ( AND e=
>>> comparison )* ;
>>> +    //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:62:1:
>>> andExpression returns [boolean value] : e= comparison ( AND e=
>>> comparison )* ;
>>>      public final boolean andExpression() throws RecognitionException {
>>>          boolean value = false;
>>>  
>>> @@ -164,15 +163,15 @@
>>>  
>>>  
>>>          try {
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:63:9: (e=
>>> comparison ( AND e= comparison )* )
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:63:9: e=
>>> comparison ( AND e= comparison )*
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:63:5:
>>> (e= comparison ( AND e= comparison )* )
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:63:9:
>>> e= comparison ( AND e= comparison )*
>>>              {
>>>              pushFollow(FOLLOW_comparison_in_andExpression125);
>>>              e=comparison();
>>>              _fsp--;
>>>  
>>>              value = e;
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:64:5: ( AND e=
>>> comparison )*
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:64:5:
>>> ( AND e= comparison )*
>>>              loop2:
>>>              do {
>>>                  int alt2=2;
>>> @@ -185,7 +184,7 @@
>>>  
>>>                  switch (alt2) {
>>>                  case 1 :
>>> -                    //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:64:7: AND e=
>>> comparison
>>> +                    //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:64:7:
>>> AND e= comparison
>>>                      {
>>>                      match(input,AND,FOLLOW_AND_in_andExpression135);
>>>                      pushFollow(FOLLOW_comparison_in_andExpression139);
>>> @@ -218,19 +217,19 @@
>>>  
>>>  
>>>      // $ANTLR start comparison
>>> -    // src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:67:1:
>>> comparison returns [boolean value] : (a= atom EQUALS b= atom |
>>> LEFTPAR e= orExpression RIGHTPAR );
>>> +    //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:67:1:
>>> comparison returns [boolean value] : (a= atom EQUALS b= atom |
>>> LEFTPAR e= orExpression RIGHTPAR );
>>>      public final boolean comparison() throws RecognitionException {
>>>          boolean value = false;
>>>  
>>> -        String a = null;
>>> +        atom_return a = null;
>>>  
>>> -        String b = null;
>>> +        atom_return b = null;
>>>  
>>>          boolean e = false;
>>>  
>>>  
>>>          try {
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:68:9: (a= atom
>>> EQUALS b= atom | LEFTPAR e= orExpression RIGHTPAR )
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:68:5:
>>> (a= atom EQUALS b= atom | LEFTPAR e= orExpression RIGHTPAR )
>>>              int alt3=2;
>>>              int LA3_0 = input.LA(1);
>>>  
>>> @@ -248,7 +247,7 @@
>>>              }
>>>              switch (alt3) {
>>>                  case 1 :
>>> -                    //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:68:9: a= atom
>>> EQUALS b= atom
>>> +                    //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:68:9:
>>> a= atom EQUALS b= atom
>>>                      {
>>>                      pushFollow(FOLLOW_atom_in_comparison173);
>>>                      a=atom();
>>> @@ -259,12 +258,26 @@
>>>                      b=atom();
>>>                      _fsp--;
>>>  
>>> -                    value = a.equals(b);
>>> +
>>> +                                if (a.value instanceof String &&
>>> b.value instanceof String) {
>>> +                                    value = a.value.equals(b.value);
>>> +                                }
>>> +                                else if (a.value instanceof String
>>> && b.value.getClass().isArray()) {
>>> +                                    value =
>>> java.util.Arrays.asList((String[]) b.value).contains(a.value);
>>> +                                }
>>> +                                else if
>>> (a.value.getClass().isArray() && b.value instanceof String) {
>>> +                                    value =
>>> java.util.Arrays.asList((String[]) a.value).contains(b.value);
>>> +                                }
>>> +                                else {
>>> +                                    throw new
>>> FailedPredicateException(input, input.toString(a.start,a.stop) + " ==
>>> " + input.toString(b.start,b.stop),
>>> +                                        "Incompatible arguments for
>>> comparison: " + a.value + ", " + b.value);
>>> +                                }
>>> +                             
>>>                      }
>>>                      break;
>>>                  case 2 :
>>> -                    //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:69:9: LEFTPAR
>>> e= orExpression RIGHTPAR
>>> +                    //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:83:9:
>>> LEFTPAR e= orExpression RIGHTPAR
>>>                      {
>>>                     
>>> match(input,LEFTPAR,FOLLOW_LEFTPAR_in_comparison191);
>>>                      pushFollow(FOLLOW_orExpression_in_comparison195);
>>> @@ -289,18 +302,22 @@
>>>      }
>>>      // $ANTLR end comparison
>>>  
>>> +    public static class atom_return extends ParserRuleReturnScope {
>>> +        public Object value;
>>> +    };
>>>  
>>>      // $ANTLR start atom
>>> -    // src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:72:1:
>>> atom returns [String value] : ( quotedString | ID );
>>> -    public final String atom() throws RecognitionException {
>>> -        String value = null;
>>> +    //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:86:1:
>>> atom returns [Object value] : ( quotedString | ID );
>>> +    public final atom_return atom() throws RecognitionException {
>>> +        atom_return retval = new atom_return();
>>> +        retval.start = input.LT(1);
>>>  
>>>          Token ID2=null;
>>>          String quotedString1 = null;
>>>  
>>>  
>>>          try {
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:73:9: (
>>> quotedString | ID )
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:87:5:
>>> ( quotedString | ID )
>>>              int alt4=2;
>>>              int LA4_0 = input.LA(1);
>>>  
>>> @@ -312,34 +329,34 @@
>>>              }
>>>              else {
>>>                  NoViableAltException nvae =
>>> -                    new NoViableAltException("72:1: atom returns
>>> [String value] : ( quotedString | ID );", 4, 0, input);
>>> +                    new NoViableAltException("86:1: atom returns
>>> [Object value] : ( quotedString | ID );", 4, 0, input);
>>>  
>>>                  throw nvae;
>>>              }
>>>              switch (alt4) {
>>>                  case 1 :
>>> -                    //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:73:9: quotedString
>>> +                    //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:87:9:
>>> quotedString
>>>                      {
>>>                      pushFollow(FOLLOW_quotedString_in_atom222);
>>>                      quotedString1=quotedString();
>>>                      _fsp--;
>>>  
>>> -                    value = quotedString1;
>>> +                    retval.value = quotedString1;
>>>  
>>>                      }
>>>                      break;
>>>                  case 2 :
>>> -                    //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:74:9: ID
>>> +                    //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:88:9:
>>> ID
>>>                      {
>>>                      ID2=(Token)input.LT(1);
>>>                      match(input,ID,FOLLOW_ID_in_atom234);  
>>> -                                String s = (String)
>>> memory.get(ID2.getText());
>>> -                                if ( s != null ) {
>>> -                                    value = s;
>>> +                                Object v = memory.get(ID2.getText());
>>> +                                if ( v != null ) {
>>> +                                    retval.value = v;
>>>                                  }
>>>                                  else {
>>> -                                    value = "undefined";
>>> +                                    retval.value = "undefined";
>>>                                      throw new
>>> FailedPredicateException(input, ID2.getText(),
>>>                                          "Undefined variable \"" +
>>> ID2.getText() + "\"");
>>>                                  }
>>> @@ -349,6 +366,8 @@
>>>                      break;
>>>  
>>>              }
>>> +            retval.stop = input.LT(-1);
>>> +
>>>          }
>>>          catch (RecognitionException re) {
>>>              reportError(re);
>>> @@ -356,21 +375,21 @@
>>>          }
>>>          finally {
>>>          }
>>> -        return value;
>>> +        return retval;
>>>      }
>>>      // $ANTLR end atom
>>>  
>>>  
>>>      // $ANTLR start quotedString
>>> -    // src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:88:1:
>>> quotedString returns [String value] : LITERAL ;
>>> +    //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:102:1:
>>> quotedString returns [String value] : LITERAL ;
>>>      public final String quotedString() throws RecognitionException {
>>>          String value = null;
>>>  
>>>          Token LITERAL3=null;
>>>  
>>>          try {
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:89:9: ( LITERAL )
>>> -            //
>>> src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:89:9: LITERAL
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:103:7:
>>> ( LITERAL )
>>> +            //
>>> /Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g:103:9:
>>> LITERAL
>>>              {
>>>              LITERAL3=(Token)input.LT(1);
>>>              match(input,LITERAL,FOLLOW_LITERAL_in_quotedString267);
>>> Modified:
>>> lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/expressions__.g
>>>
>>> URL:
>>> http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/expressions__.g?rev=653799&r1=653798&r2=653799&view=diff
>>>
>>> ==============================================================================
>>>
>>> ---
>>> lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/expressions__.g
>>> (original)
>>> +++
>>> lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/expressions__.g
>>> Tue May  6 08:11:12 2008
>>> @@ -13,24 +13,24 @@
>>>  }
>>>  @header {
>>>  package org.apache.lenya.ac.impl.antlr;
>>> -import org.apache.lenya.ac.impl.ErrorHandler;
>>> +import org.apache.lenya.ac.ErrorHandler;
>>>  }
>>>  
>>> -// $ANTLR src
>>> "src/java/org/apache/lenya/ac/impl/antlr/Expressions.g" 92
>>> +// $ANTLR src
>>> "/Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g"
>>> 106
>>>  LITERAL: '"' ('a'..'z'|'A'..'Z'|'_'|' '|'.')* '"';
>>> -// $ANTLR src
>>> "src/java/org/apache/lenya/ac/impl/antlr/Expressions.g" 93
>>> +// $ANTLR src
>>> "/Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g"
>>> 107
>>>  ID: ('a'..'z'|'A'..'Z') ('a'..'z'|'A'..'Z'|'0'..'9')*;
>>> -// $ANTLR src
>>> "src/java/org/apache/lenya/ac/impl/antlr/Expressions.g" 94
>>> +// $ANTLR src
>>> "/Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g"
>>> 108
>>>  EQUALS: '==';
>>> -// $ANTLR src
>>> "src/java/org/apache/lenya/ac/impl/antlr/Expressions.g" 95
>>> +// $ANTLR src
>>> "/Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g"
>>> 109
>>>  QUOT: '"';
>>> -// $ANTLR src
>>> "src/java/org/apache/lenya/ac/impl/antlr/Expressions.g" 96
>>> +// $ANTLR src
>>> "/Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g"
>>> 110
>>>  OR: '||';
>>> -// $ANTLR src
>>> "src/java/org/apache/lenya/ac/impl/antlr/Expressions.g" 97
>>> +// $ANTLR src
>>> "/Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g"
>>> 111
>>>  AND: '&&';
>>> -// $ANTLR src
>>> "src/java/org/apache/lenya/ac/impl/antlr/Expressions.g" 98
>>> +// $ANTLR src
>>> "/Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g"
>>> 112
>>>  LEFTPAR: '(';
>>> -// $ANTLR src
>>> "src/java/org/apache/lenya/ac/impl/antlr/Expressions.g" 99
>>> +// $ANTLR src
>>> "/Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g"
>>> 113
>>>  RIGHTPAR: ')';
>>> -// $ANTLR src
>>> "src/java/org/apache/lenya/ac/impl/antlr/Expressions.g" 100
>>> +// $ANTLR src
>>> "/Users/nobby/apache/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/antlr/Expressions.g"
>>> 114
>>>  WS: (' '|'\t')+ {skip();} ;
>>>
>>> Added:
>>> lenya/branches/branch_1_2_x_shibboleth/src/test/org/apache/lenya/ac/impl/RuleEvaluatorTest.java
>>>
>>> URL:
>>> http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/test/org/apache/lenya/ac/impl/RuleEvaluatorTest.java?rev=653799&view=auto
>>>
>>> ==============================================================================
>>>
>>> ---
>>> lenya/branches/branch_1_2_x_shibboleth/src/test/org/apache/lenya/ac/impl/RuleEvaluatorTest.java
>>> (added)
>>> +++
>>> lenya/branches/branch_1_2_x_shibboleth/src/test/org/apache/lenya/ac/impl/RuleEvaluatorTest.java
>>> Tue May  6 08:11:12 2008
>>> @@ -0,0 +1,55 @@
>>> +/*
>>> + * 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.
>>> + *
>>> + */
>>> +
>>> +/* $Id: GroupManagerTest.java 473841 2006-11-12 00:46:38Z gregor $  */
>>> +package org.apache.lenya.ac.impl;
>>> +
>>> +import junit.framework.TestCase;
>>> +
>>> +import org.apache.avalon.framework.logger.ConsoleLogger;
>>> +import org.apache.lenya.ac.AttributeDefinition;
>>> +import org.apache.lenya.ac.AttributeDefinitionRegistry;
>>> +import org.apache.lenya.ac.AttributeRuleEvaluator;
>>> +import org.apache.lenya.ac.file.FileUser;
>>> +import org.apache.lenya.ac.impl.antlr.AntlrEvaluator;
>>> +
>>> +public class RuleEvaluatorTest extends TestCase {
>>> +    +    protected static final String ATTR_NAME = "attr";
>>> +
>>> +    public void testRuleEvaluation() throws Exception {
>>> +        +        AttributeDefinition def = new AttributeDefinition() {
>>> +            public String[] getAttributeNames() {
>>> +                String[] names = { ATTR_NAME };
>>> +                return names;
>>> +            }
>>> +        };
>>> +        AttributeDefinitionRegistry.register(def);
>>> +        +        AttributeRuleEvaluator evaluator = new
>>> AntlrEvaluator(new ConsoleLogger());
>>> +        +        FileUser user = new FileUser();
>>> +        String[] values = { "foo", "bar" };
>>> +        user.setAttributeValues(ATTR_NAME, values);
>>> +        +        assertTrue(evaluator.isComplied(user, ATTR_NAME + "
>>> == \"bar\""));
>>> +        assertFalse(evaluator.isComplied(user, ATTR_NAME + " ==
>>> \"baz\""));
>>> +    }
>>> +
>>> +}
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
>>> For additional commands, e-mail: commits-help@lenya.apache.org
>>>
>>
>>
> 
> 


-- 
Jann Forrer
Informatikdienste
Universität Zürich
Winterthurerstr. 190
CH-8057 Zürich

oooO   mail:  jann.forrer@id.uzh.ch
(  )   phone: +41 44 63 56772
 \ (   fax:   +41 44 63 54505
  \_)  http://www.id.unizh.ch


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


Mime
View raw message