portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed-2/components/profiler/src/test/org/apache/jetspeed/profiler TestProfiler.java
Date Thu, 23 Sep 2004 19:47:29 GMT
taylor      2004/09/23 12:47:29

  Modified:    components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl
                        GroupRoleUserCriterionResolver.java
                        StandardProfilingRule.java
                        RequestSessionResolver.java StandardResolver.java
                        RoleFallbackProfilingRule.java
                        MediatypeCriterionResolver.java
                        LanguageCriterionResolver.java PathResolver.java
                        GroupCriterionResolver.java
                        PathSessionResolver.java RoleCriterionResolver.java
                        HardCodedResolver.java
                        CountryCriterionResolver.java
                        UserCriterionResolver.java
               components/profiler/src/test/org/apache/jetspeed/profiler
                        TestProfiler.java
  Log:
  fixed bug in role-based fallback to correctly order the fallback over criteria
  
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.3       +3 -1      jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/GroupRoleUserCriterionResolver.java
  
  Index: GroupRoleUserCriterionResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/GroupRoleUserCriterionResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GroupRoleUserCriterionResolver.java	17 Sep 2004 20:03:21 -0000	1.2
  +++ GroupRoleUserCriterionResolver.java	23 Sep 2004 19:47:28 -0000	1.3
  @@ -63,4 +63,6 @@
           return super.resolve(context, criterion);
        }
       
  +    
  +    
   }
  
  
  
  1.3       +2 -2      jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/StandardProfilingRule.java
  
  Index: StandardProfilingRule.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/StandardProfilingRule.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StandardProfilingRule.java	17 Sep 2004 20:03:21 -0000	1.2
  +++ StandardProfilingRule.java	23 Sep 2004 19:47:28 -0000	1.3
  @@ -97,7 +97,7 @@
               if (resolver != null)
               {
                   String value = resolver.resolve(context, criterion);
  -                boolean isControl = resolver.isControl();
  +                boolean isControl = resolver.isControl(criterion);
                   locator.add(criterion, isControl, value);
               }                
           }               
  
  
  
  1.3       +2 -9      jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/RequestSessionResolver.java
  
  Index: RequestSessionResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/RequestSessionResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RequestSessionResolver.java	17 Sep 2004 20:03:21 -0000	1.2
  +++ RequestSessionResolver.java	23 Sep 2004 19:47:28 -0000	1.3
  @@ -25,7 +25,7 @@
    * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
    * @version $Id$
    */
  -public class RequestSessionResolver implements RuleCriterionResolver
  +public class RequestSessionResolver extends StandardResolver implements RuleCriterionResolver
   {
       /* (non-Javadoc)
        * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#resolve(org.apache.jetspeed.request.RequestContext,
org.apache.jetspeed.profiler.rules.RuleCriterion)
  @@ -45,11 +45,4 @@
           return value;            
       }
   
  -    /* (non-Javadoc)
  -     * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#isControl()
  -     */
  -    public boolean isControl()
  -    {
  -        return true;
  -    }
   }
  
  
  
  1.3       +7 -2      jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/StandardResolver.java
  
  Index: StandardResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/StandardResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StandardResolver.java	17 Sep 2004 20:03:21 -0000	1.2
  +++ StandardResolver.java	23 Sep 2004 19:47:28 -0000	1.3
  @@ -47,8 +47,13 @@
       /* (non-Javadoc)
        * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#isControl()
        */
  -    public boolean isControl()
  +    public boolean isControl(RuleCriterion criterion)
       {
  +        if (criterion.getName().equals(RuleCriterionResolver.PATH) ||
  +            criterion.getName().equals(RuleCriterionResolver.PAGE))
  +        {
  +            return false;
  +        }
           return true;
       }
   }
  
  
  
  1.3       +2 -2      jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/RoleFallbackProfilingRule.java
  
  Index: RoleFallbackProfilingRule.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/RoleFallbackProfilingRule.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RoleFallbackProfilingRule.java	17 Sep 2004 20:03:21 -0000	1.2
  +++ RoleFallbackProfilingRule.java	23 Sep 2004 19:47:28 -0000	1.3
  @@ -94,7 +94,7 @@
               if (resolver != null)
               {
                   String value = resolver.resolve(context, criterion);
  -                boolean isControl = resolver.isControl();
  +                boolean isControl = resolver.isControl(criterion);
                   locator.add(criterion, isControl, value);
               }                
           }               
  
  
  
  1.3       +9 -1      jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/MediatypeCriterionResolver.java
  
  Index: MediatypeCriterionResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/MediatypeCriterionResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MediatypeCriterionResolver.java	17 Sep 2004 20:03:21 -0000	1.2
  +++ MediatypeCriterionResolver.java	23 Sep 2004 19:47:28 -0000	1.3
  @@ -44,4 +44,12 @@
           return context.getMediaType();   
       }    
       
  +    /* (non-Javadoc)
  +     * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#isControl()
  +     */
  +    public boolean isControl(RuleCriterion criterion)
  +    {
  +        return true;
  +    }
  +    
   }
  
  
  
  1.3       +10 -1     jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/LanguageCriterionResolver.java
  
  Index: LanguageCriterionResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/LanguageCriterionResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LanguageCriterionResolver.java	17 Sep 2004 20:03:21 -0000	1.2
  +++ LanguageCriterionResolver.java	23 Sep 2004 19:47:28 -0000	1.3
  @@ -44,4 +44,13 @@
           return context.getLocale().getLanguage();   
       }    
       
  +    /* (non-Javadoc)
  +     * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#isControl()
  +     */
  +    public boolean isControl(RuleCriterion criterion)
  +    {
  +        return true;
  +    }
  +    
  +    
   }
  
  
  
  1.3       +2 -2      jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/PathResolver.java
  
  Index: PathResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/PathResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PathResolver.java	17 Sep 2004 20:03:21 -0000	1.2
  +++ PathResolver.java	23 Sep 2004 19:47:28 -0000	1.3
  @@ -55,7 +55,7 @@
       /* (non-Javadoc)
        * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#isControl()
        */
  -    public boolean isControl()
  +    public boolean isControl(RuleCriterion criterion)
       {
           return false;
       }
  
  
  
  1.3       +9 -1      jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/GroupCriterionResolver.java
  
  Index: GroupCriterionResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/GroupCriterionResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GroupCriterionResolver.java	17 Sep 2004 20:03:21 -0000	1.2
  +++ GroupCriterionResolver.java	23 Sep 2004 19:47:28 -0000	1.3
  @@ -70,4 +70,12 @@
            return null;
         }
        
  +     /* (non-Javadoc)
  +      * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#isControl()
  +      */
  +     public boolean isControl(RuleCriterion criterion)
  +     {
  +         return true;
  +     }
  +     
   }
  
  
  
  1.3       +2 -2      jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/PathSessionResolver.java
  
  Index: PathSessionResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/PathSessionResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PathSessionResolver.java	17 Sep 2004 20:03:21 -0000	1.2
  +++ PathSessionResolver.java	23 Sep 2004 19:47:28 -0000	1.3
  @@ -60,7 +60,7 @@
       /* (non-Javadoc)
        * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#isControl()
        */
  -    public boolean isControl()
  +    public boolean isControl(RuleCriterion criterion)
       {
           return false;
       }
  
  
  
  1.3       +10 -1     jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/RoleCriterionResolver.java
  
  Index: RoleCriterionResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/RoleCriterionResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RoleCriterionResolver.java	17 Sep 2004 20:03:21 -0000	1.2
  +++ RoleCriterionResolver.java	23 Sep 2004 19:47:28 -0000	1.3
  @@ -70,4 +70,13 @@
           return null;
        }
       
  +    /* (non-Javadoc)
  +     * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#isControl()
  +     */
  +    public boolean isControl(RuleCriterion criterion)
  +    {
  +        return true;
  +    }
  +    
  +    
   }
  
  
  
  1.3       +2 -9      jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/HardCodedResolver.java
  
  Index: HardCodedResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/HardCodedResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HardCodedResolver.java	17 Sep 2004 20:03:21 -0000	1.2
  +++ HardCodedResolver.java	23 Sep 2004 19:47:29 -0000	1.3
  @@ -25,7 +25,7 @@
    * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
    * @version $Id$
    */
  -public class HardCodedResolver implements RuleCriterionResolver
  +public class HardCodedResolver extends StandardResolver implements RuleCriterionResolver
   {
       /* (non-Javadoc)
        * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#resolve(org.apache.jetspeed.request.RequestContext,
org.apache.jetspeed.profiler.rules.RuleCriterion)
  @@ -35,11 +35,4 @@
           return criterion.getValue();
       }
   
  -    /* (non-Javadoc)
  -     * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#isControl()
  -     */
  -    public boolean isControl()
  -    {
  -        return true;
  -    }
   }
  
  
  
  1.3       +9 -1      jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/CountryCriterionResolver.java
  
  Index: CountryCriterionResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/CountryCriterionResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CountryCriterionResolver.java	17 Sep 2004 20:03:21 -0000	1.2
  +++ CountryCriterionResolver.java	23 Sep 2004 19:47:29 -0000	1.3
  @@ -47,4 +47,12 @@
           return context.getLocale().getCountry();   
       }    
       
  +    /* (non-Javadoc)
  +     * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#isControl()
  +     */
  +    public boolean isControl(RuleCriterion criterion)
  +    {
  +        return true;
  +    }
  +    
   }
  
  
  
  1.3       +10 -1     jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/UserCriterionResolver.java
  
  Index: UserCriterionResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/rules/impl/UserCriterionResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UserCriterionResolver.java	17 Sep 2004 20:03:21 -0000	1.2
  +++ UserCriterionResolver.java	23 Sep 2004 19:47:29 -0000	1.3
  @@ -70,4 +70,13 @@
           return null;
        }
       
  +    /* (non-Javadoc)
  +     * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#isControl()
  +     */
  +    public boolean isControl(RuleCriterion criterion)
  +    {
  +        return true;
  +    }
  +    
  +    
   }
  
  
  
  1.3       +7 -7      jakarta-jetspeed-2/components/profiler/src/test/org/apache/jetspeed/profiler/TestProfiler.java
  
  Index: TestProfiler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/profiler/src/test/org/apache/jetspeed/profiler/TestProfiler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestProfiler.java	17 Sep 2004 20:03:23 -0000	1.2
  +++ TestProfiler.java	23 Sep 2004 19:47:29 -0000	1.3
  @@ -210,16 +210,16 @@
               switch (count)
               {
                   case 0:
  -                    assertTrue("fallback criteria name", criterion.getName().equals(ProfilingRule.STANDARD_PAGE));
  -                    assertNotNull("fallback criteria value", criterion.getValue());
  -                    assertTrue("fallback criteria value", criterion.getValue().equals(DEFAULT_PAGE));
  -                    assertTrue("fallback type", criterion.getFallbackType() == RuleCriterion.FALLBACK_STOP);
  -                    break;                    
  -                case 1:
                       assertTrue("fallback criteria name", criterion.getName().equals(ProfilingRule.STANDARD_ROLE));
                       assertNull("fallback criteria value", criterion.getValue());
                       assertTrue("fallback type", criterion.getFallbackType() == RuleCriterion.FALLBACK_LOOP);
                   
                       break;
  +                case 1:
  +                    assertTrue("fallback criteria name", criterion.getName().equals(ProfilingRule.STANDARD_PAGE));
  +                    assertNotNull("fallback criteria value", criterion.getValue());
  +                    assertTrue("fallback criteria value", criterion.getValue().equals(DEFAULT_PAGE));
  +                    assertTrue("fallback type", criterion.getFallbackType() == RuleCriterion.FALLBACK_STOP);
  +                    break;                                        
                   case 2:
                       assertTrue("fallback criteria name", criterion.getName().equals(ProfilingRule.STANDARD_MEDIATYPE));
                       assertNull("fallback criteria value", criterion.getValue());
  
  
  

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


Mime
View raw message