weaver      2004/04/22 14:14:42

  Modified:    components/profiler Tag: NANOCONTAINER_DEPLOYER project.xml
                        project.properties maven.xml
               components/profiler/src/test/org/apache/jetspeed/profiler
                        Tag: NANOCONTAINER_DEPLOYER TestProfiler.java
  Added:       components/profiler/src/test Tag: NANOCONTAINER_DEPLOYER
                        repository.dtd OJB.properties
                        repository_internal.xml repository.xml
                        Log4j.properties repository_database.xml
  Log:
  - Uses ChildAwareContainer

  - Added more deployment jars to test:test pre-goal

  - changed location of test data
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.1   +927 -0    
jakarta-jetspeed-2/components/profiler/src/test/Attic/repository.dtd
  
  
  
  
  1.1.2.1   +437 -0    
jakarta-jetspeed-2/components/profiler/src/test/Attic/OJB.properties
  
  
  
  
  1.1.2.1   +347 -0    
jakarta-jetspeed-2/components/profiler/src/test/Attic/repository_internal.xml
  
  
  
  
  1.1.2.1   +18 -0     
jakarta-jetspeed-2/components/profiler/src/test/Attic/repository.xml
  
  
  
  
  1.1.2.1   +43 -0     
jakarta-jetspeed-2/components/profiler/src/test/Attic/Log4j.properties
  
  
  
  
  1.1.2.1   +36 -0     
jakarta-jetspeed-2/components/profiler/src/test/Attic/repository_database.xml
  
  
  
  
  No                   revision
  No                   revision
  1.1.2.2   +29 -1     jakarta-jetspeed-2/components/profiler/Attic/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/profiler/Attic/project.xml,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- project.xml       20 Apr 2004 03:08:48 -0000      1.1.2.1
  +++ project.xml       22 Apr 2004 21:14:42 -0000      1.1.2.2
  @@ -33,6 +33,13 @@
   
     <shortDescription>Profiler Components</shortDescription>
     <dependencies>  
  +             <dependency>
  +      <id>castor</id>
  +      <version>0.9.4.3</version>
  +      <properties>
  +        <war.bundle.jar>true</war.bundle.jar>
  +      </properties>
  +    </dependency>
        <dependency>
         <id>jetspeed-cm</id>
         <groupId>jetspeed2</groupId>
  @@ -65,7 +72,28 @@
         <properties>
           <war.bundle.jar>true</war.bundle.jar>
         </properties>
  -    </dependency>    
  +    </dependency>
  +        <dependency>
  +      <id>jetspeed2:jetspeed-id-generator</id>
  +      <version>2.0-a1-dev</version>
  +      <properties>
  +        <war.bundle.jar>true</war.bundle.jar>
  +      </properties>
  +    </dependency>
  +    <dependency>
  +      <id>jetspeed2:jetspeed-file-cache</id>
  +      <version>2.0-a1-dev</version>
  +      <properties>
  +        <war.bundle.jar>true</war.bundle.jar>
  +      </properties>
  +    </dependency> 
  +    <dependency>
  +      <id>jetspeed2:jetspeed-page-manager</id>
  +      <version>2.0-a1-dev</version>
  +      <properties>
  +        <war.bundle.jar>true</war.bundle.jar>
  +      </properties>
  +    </dependency>            
         <dependency>
         <id>commons-lang</id>
         <version>2.0</version>
  
  
  
  1.1.2.2   +3 -1      jakarta-jetspeed-2/components/profiler/Attic/project.properties
  
  Index: project.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/profiler/Attic/project.properties,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- project.properties        20 Apr 2004 03:08:48 -0000      1.1.2.1
  +++ project.properties        22 Apr 2004 21:14:42 -0000      1.1.2.2
  @@ -45,11 +45,13 @@
   maven.junit.sysproperties=org.apache.jetspeed.database.url \
   org.apache.jetspeed.database.driver \
   org.apache.jetspeed.database.user \
  -org.apache.jetspeed.database.password
  +org.apache.jetspeed.database.password \
  +org.apache.jetspeed.application_root
   
   org.apache.jetspeed.database.url = jdbc:hsqldb:hsql://127.0.0.1:9001
   org.apache.jetspeed.database.driver = org.hsqldb.jdbcDriver
   org.apache.jetspeed.database.user = sa
   org.apache.jetspeed.database.password = 
  +org.apache.jetspeed.application_root = ${basedir}
   
   maven.junit.fork=true
  
  
  
  1.1.2.2   +5 -2      jakarta-jetspeed-2/components/profiler/Attic/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/profiler/Attic/maven.xml,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- maven.xml 20 Apr 2004 03:08:48 -0000      1.1.2.1
  +++ maven.xml 22 Apr 2004 21:14:42 -0000      1.1.2.2
  @@ -54,8 +54,11 @@
    </goal> 
    
     <preGoal name="test:test">
  -      <copy todir="${basedir}/target/deploy" 
file="${maven.repo.local}/jetspeed2/jars/jetspeed-rdbms-2.0-a1-dev.jar" />
  -     <copy todir="${basedir}/target/deploy" 
file="${maven.repo.local}/jetspeed2/jars/jetspeed-persistence-2.0-a1-dev.jar" />
  +      <copy todir="${basedir}/target/deploy" 
file="${maven.repo.local}/jetspeed2/jars/jetspeed-rdbms-2.0-a1-dev.jar" 
overwrite="true"/>
  +     <copy todir="${basedir}/target/deploy" 
file="${maven.repo.local}/jetspeed2/jars/jetspeed-persistence-2.0-a1-dev.jar" 
overwrite="true"/>
  +     <copy todir="${basedir}/target/deploy" 
file="${maven.repo.local}/jetspeed2/jars/jetspeed-page-manager-2.0-a1-dev.jar" 
overwrite="true" />
  +     <copy todir="${basedir}/target/deploy" 
file="${maven.repo.local}/jetspeed2/jars/jetspeed-id-generator-2.0-a1-dev.jar" 
overwrite="true" />
  +     <copy todir="${basedir}/target/deploy" 
file="${maven.repo.local}/jetspeed2/jars/jetspeed-file-cache-2.0-a1-dev.jar" 
overwrite="true" />
     </preGoal>
   
   </project>
  
  
  
  No                   revision
  No                   revision
  1.1.2.2   +141 -130  
jakarta-jetspeed-2/components/profiler/src/test/org/apache/jetspeed/profiler/Attic/TestProfiler.java
  
  Index: TestProfiler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/profiler/src/test/org/apache/jetspeed/profiler/Attic/TestProfiler.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- TestProfiler.java 20 Apr 2004 03:08:49 -0000      1.1.2.1
  +++ TestProfiler.java 22 Apr 2004 21:14:42 -0000      1.1.2.2
  @@ -1,17 +1,17 @@
   /*
    * Copyright 2000-2004 The Apache Software Foundation.
    * 
  - * Licensed under the Apache License, Version 2.0 (the "License");
  - * you may not use this file except in compliance with the License.
  - * You may obtain a copy of the License at
  + * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  + * use this file except in compliance with the License. You may obtain a copy of
  + * the License at
    * 
  - *      http://www.apache.org/licenses/LICENSE-2.0
  + * 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.
  + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  + * License for the specific language governing permissions and limitations under
  + * the License.
    */
   package org.apache.jetspeed.profiler;
   
  @@ -41,53 +41,72 @@
   
   /**
    * TestProfiler
  - *
  - * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
  + * 
  + * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor </a>
    * @version $Id$
    */
   public class TestProfiler extends AbstractComponentAwareTestCase
   {
       private Profiler profiler = null;
       private MutablePicoContainer container;
  -    
  +
       /**
        * Defines the testcase name for JUnit.
  -     *
  -     * @param name the testcase's name.
  +     * 
  +     * @param name
  +     *            the testcase's name.
        */
  -    public TestProfiler(String name)
  +    public TestProfiler( String name )
       {
           super(name);
       }
   
       /**
        * Start the tests.
  -     *
  -     * @param args the arguments. Not used
  +     * 
  +     * @param args
  +     *            the arguments. Not used
        */
  -    public static void main(String args[])
  +    public static void main( String args[] )
       {
  -        junit.awtui.TestRunner.main(new String[] { TestProfiler.class.getName()});
  +        junit.awtui.TestRunner.main(new String[]{TestProfiler.class.getName()});
       }
   
       protected void setUp() throws Exception
       {
           super.setUp();
           container = (MutablePicoContainer) getContainer();
  -        profiler = (Profiler) container.getComponentInstance(Profiler.class);       
 
  +        profiler = (Profiler) container.getComponentInstance(Profiler.class);
  +        request = new MockRequestContext();
  +        requestDefaultOther = new MockRequestContext("default-other");
  +        requestChiefs = new MockRequestContext("/football/nfl/chiefs");
  +        Principal principal = null;
  +        Set principals = new HashSet();
  +        if (principal == null)
  +        {
  +            principal = new UserPrincipalImpl(profiler.getAnonymousUser());
  +        }
  +        principals.add(principal);
  +        fieldSubject = new Subject(true, principals, new HashSet(), new HashSet()); 
       
  +
  +        request.setSubject(fieldSubject);
  +        requestDefaultOther.setSubject(fieldSubject);
  +        requestChiefs.setSubject(fieldSubject);       
  +        
       }
   
       /**
        * Creates the test suite.
  -     *
  -     * @return a test suite (<code>TestSuite</code>) that includes all methods
  -     *         starting with "test"
  +     * 
  +     * @return a test suite (<code>TestSuite</code>) that includes all
  +     *         methods starting with "test"
        */
       public static Test suite()
       {
  -        // ComponentAwareTestSuite suite = new 
ComponentAwareTestSuite(TestProfiler.class);
  +        // ComponentAwareTestSuite suite = new
  +        // ComponentAwareTestSuite(TestProfiler.class);
           // 
suite.setScript("org/apache/jetspeed/profiler/containers/profiler-container.groovy");
  -     NanoDeployerBasedTestSuite suite = new 
NanoDeployerBasedTestSuite(TestProfiler.class);
  +        NanoDeployerBasedTestSuite suite = new 
NanoDeployerBasedTestSuite(TestProfiler.class);
           return suite;
       }
   
  @@ -96,18 +115,21 @@
       private static final int EXPECTED_STANDARD = 1;
       private static final int EXPECTED_FALLBACK = 1;
       private static final String DEFAULT_PAGE = "default-page";
  -    
  -        
  +    private Subject fieldSubject = null;
  +    protected MockRequestContext request;
  +    private RequestContext requestDefaultOther;
  +    private RequestContext requestChiefs;
  +
       /**
        * Tests
  -     *
  +     * 
        * @throws Exception
        */
       public void testRules() throws Exception
       {
           assertNotNull("profiler service is null", profiler);
  -        
  -        // Test Default Rule        
  +
  +        // Test Default Rule
           ProfilingRule rule = profiler.getDefaultRule();
           assertNotNull("Default profiling rule is null", rule);
           assertTrue("default rule unexpected, = " + rule.getId(), 
rule.getId().equals(DEFAULT_RULE));
  @@ -117,38 +139,39 @@
           ProfilingRule anonRule = profiler.getRuleForPrincipal(new 
UserPrincipalImpl("anon"));
           assertNotNull("anonymous rule is null", anonRule);
           assertTrue("anonymous rule is j1", anonRule.getId().equals(DEFAULT_RULE));
  -        
  +
           // Test Retrieving All Rules
           int standardCount = 0;
  -        int fallbackCount = 0;        
  +        int fallbackCount = 0;
           Iterator rules = profiler.getRules().iterator();
           while (rules.hasNext())
           {
  -            rule = (ProfilingRule)rules.next();
  -            if (rule.getId().equals(DEFAULT_RULE))                                  
     
  +            rule = (ProfilingRule) rules.next();
  +            if (rule.getId().equals(DEFAULT_RULE))
               {
                   assertTrue("standard rule class not mapped", rule instanceof 
StandardProfilingRule);
                   checkStandardCriteria(rule);
  -                standardCount++;                                 
  +                standardCount++;
               }
  -            else if (rule.getId().equals(FALLBACK_RULE))                            
           
  +            else if (rule.getId().equals(FALLBACK_RULE))
               {
                   assertTrue("role fallback rule class not mapped", rule instanceof 
RoleFallbackProfilingRule);
  -                checkFallbackCriteria(rule);                
  -                fallbackCount++;             
  +                checkFallbackCriteria(rule);
  +                fallbackCount++;
               }
               else
               {
  -                // assertTrue("Unknown rule encountered: " + rule.getId(), false);  
          
  +                // assertTrue("Unknown rule encountered: " + rule.getId(),
  +                // false);
               }
  -                        
  +
           }
           assertTrue("didnt find expected number of standard rules, expected = " + 
EXPECTED_STANDARD, standardCount == 1);
           assertTrue("didnt find expected number of fallback rules, expected = " + 
EXPECTED_FALLBACK, fallbackCount == 1);
  -        
  -    }    
  -    
  -    private void checkStandardCriteria(ProfilingRule rule)
  +
  +    }
  +
  +    private void checkStandardCriteria( ProfilingRule rule )
       {
           Collection criteriaCollection = rule.getRuleCriteria();
           assertNotNull("Criteria is null", criteriaCollection);
  @@ -156,44 +179,43 @@
           int count = 0;
           while (criteria.hasNext())
           {
  -            RuleCriterion criterion = (RuleCriterion)criteria.next();
  +            RuleCriterion criterion = (RuleCriterion) criteria.next();
               assertNotNull("criteria type ", criterion.getType());
  -            System.out.println("criteria name = " + criterion.getName());           
 
  +            System.out.println("criteria name = " + criterion.getName());
               switch (count)
               {
  -                case 0:
  -                    assertTrue("criteria name " + criterion.getName(), 
  -                                
criterion.getName().equals(ProfilingRule.STANDARD_PAGE));
  +                case 0 :
  +                    assertTrue("criteria name " + criterion.getName(), 
criterion.getName().equals(ProfilingRule.STANDARD_PAGE));
                       assertNotNull("criteria value", criterion.getValue());
                       assertTrue("criteria value", 
criterion.getValue().equals(DEFAULT_PAGE));
                       assertTrue("fallback type", criterion.getFallbackType() == 
RuleCriterion.FALLBACK_STOP);
                       break;
  -                case 1:
  +                case 1 :
                       assertTrue("criteria name", 
criterion.getName().equals(ProfilingRule.STANDARD_USER));
                       assertNull("criteria value", criterion.getValue());
                       assertTrue("fallback type", criterion.getFallbackType() == 
RuleCriterion.FALLBACK_STOP);
                       break;
  -                case 2:
  +                case 2 :
                       assertTrue("criteria name", 
criterion.getName().equals(ProfilingRule.STANDARD_MEDIATYPE));
                       assertNull("criteria value", criterion.getValue());
                       assertTrue("fallback type", criterion.getFallbackType() == 
RuleCriterion.FALLBACK_CONTINUE);
                       break;
  -                case 3:
  +                case 3 :
                       assertTrue("criteria name", 
criterion.getName().equals(ProfilingRule.STANDARD_LANGUAGE));
                       assertNull("criteria value", criterion.getValue());
                       assertTrue("fallback type", criterion.getFallbackType() == 
RuleCriterion.FALLBACK_CONTINUE);
                       break;
  -                case 4:
  +                case 4 :
                       assertTrue("criteria name", 
criterion.getName().equals(ProfilingRule.STANDARD_COUNTRY));
                       assertNull("criteria value", criterion.getValue());
                       assertTrue("fallback type", criterion.getFallbackType() == 
RuleCriterion.FALLBACK_CONTINUE);
  -                    break;                                    
  -            }   
  +                    break;
  +            }
               count++;
  -        }        
  +        }
       }
  -    
  -    private void checkFallbackCriteria(ProfilingRule rule)
  +
  +    private void checkFallbackCriteria( ProfilingRule rule )
       {
           Collection criteriaCollection = rule.getRuleCriteria();
           assertNotNull("Criteria is null", criteriaCollection);
  @@ -201,98 +223,88 @@
           int count = 0;
           while (criteria.hasNext())
           {
  -            RuleCriterion criterion = (RuleCriterion)criteria.next();
  +            RuleCriterion criterion = (RuleCriterion) criteria.next();
               assertNotNull("fallback criteria type", criterion.getType());
  -            
  +
               switch (count)
               {
  -                case 0:
  +                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:
  +                    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);                    
  +                    assertTrue("fallback type", criterion.getFallbackType() == 
RuleCriterion.FALLBACK_LOOP);
                       break;
  -                case 2:
  +                case 2 :
                       assertTrue("fallback criteria name", 
criterion.getName().equals(ProfilingRule.STANDARD_MEDIATYPE));
                       assertNull("fallback criteria value", criterion.getValue());
  -                    assertTrue("fallback type", criterion.getFallbackType() == 
RuleCriterion.FALLBACK_CONTINUE);                    
  +                    assertTrue("fallback type", criterion.getFallbackType() == 
RuleCriterion.FALLBACK_CONTINUE);
                       break;
  -                case 3:
  +                case 3 :
                       assertTrue("fallback criteria name", 
criterion.getName().equals(ProfilingRule.STANDARD_LANGUAGE));
                       assertNull("fallback criteria value", criterion.getValue());
                       assertTrue("fallback type", criterion.getFallbackType() == 
RuleCriterion.FALLBACK_CONTINUE);
                       break;
  -                case 4:
  +                case 4 :
                       assertTrue("fallback criteria name", 
criterion.getName().equals(ProfilingRule.STANDARD_COUNTRY));
                       assertNull("fallback criteria value", criterion.getValue());
                       assertTrue("fallback type", criterion.getFallbackType() == 
RuleCriterion.FALLBACK_CONTINUE);
  -                    break;                                    
  +                    break;
               }
  -            count++;               
  -        }        
  +            count++;
  +        }
       }
   
  -    public void testStandardRule()
  -        throws Exception
  +    public void testStandardRule() throws Exception
       {
           assertNotNull("profiler service is null", profiler);
   
  -        RequestContext request = new MockRequestContext("default-other");
           
  -        request.setSubject(createSubject("anon"));
  -        request.setLocale(new Locale("en", "US"));        
  -        request.setMediaType("HTML");
  -        request.setMimeType("text/html");
  -        Map params = request.getParameterMap();
  +        requestDefaultOther.setSubject(createSubject("anon"));
  +        requestDefaultOther.setLocale(new Locale("en", "US"));
  +        requestDefaultOther.setMediaType("HTML");
  +        requestDefaultOther.setMimeType("text/html");
  +        Map params = requestDefaultOther.getParameterMap();
           params.put("page", "default-other");
           params.put("path", "/sports/football/nfl/chiefs");
  -        
  -        ProfileLocator locator = profiler.getProfile(request);
  +
  +        ProfileLocator locator = profiler.getProfile(requestDefaultOther);
           assertNotNull("rule test on getProfile returned null", locator);
           String path = locator.getLocatorPath();
  -        System.out.println("locator = " + path);        
  -        assertTrue("locator key value unexpected: " + path, 
  -                    path.equals(
  -              
"page:default-other:user:anon:mediatype:HTML:language:en:country:US"));
  +        System.out.println("locator = " + path);
  +        assertTrue("locator key value unexpected: " + path, 
path.equals("page:default-other:user:anon:mediatype:HTML:language:en:country:US"));
   
           // test fallback
           Iterator fallback = locator.iterator();
           int count = 0;
           while (fallback.hasNext())
           {
  -            String locatorPath = (String)fallback.next();
  +            String locatorPath = (String) fallback.next();
               switch (count)
               {
  -                case 0:
  -                    assertTrue("locatorPath[0]: " + locatorPath, 
  -                                locatorPath.equals(
  -                        
"page:default-other:user:anon:mediatype:HTML:language:en:country:US"));
  -                    break;
  -                case 1:
  -                    assertTrue("locatorPath[1]: " + locatorPath, 
  -                                locatorPath.equals(
  -                         
"page:default-other:user:anon:mediatype:HTML:language:en"));
  -                    break;                
  -                case 2:
  -                    assertTrue("locatorPath[2]: " + locatorPath, 
  -                                
locatorPath.equals("page:default-other:user:anon:mediatype:HTML"));
  -                    break;                
  -                case 3:
  -                    assertTrue("locatorPath[3]: " + locatorPath, 
  -                                locatorPath.equals("page:default-other:user:anon"));
  -                    break;                
  -                
  +                case 0 :
  +                    assertTrue("locatorPath[0]: " + locatorPath, 
locatorPath.equals("page:default-other:user:anon:mediatype:HTML:language:en:country:US"));
  +                    break;
  +                case 1 :
  +                    assertTrue("locatorPath[1]: " + locatorPath, 
locatorPath.equals("page:default-other:user:anon:mediatype:HTML:language:en"));
  +                    break;
  +                case 2 :
  +                    assertTrue("locatorPath[2]: " + locatorPath, 
locatorPath.equals("page:default-other:user:anon:mediatype:HTML"));
  +                    break;
  +                case 3 :
  +                    assertTrue("locatorPath[3]: " + locatorPath, 
locatorPath.equals("page:default-other:user:anon"));
  +                    break;
  +
               }
               count++;
  -            System.out.println("path = " + locatorPath);                            
 
  +            System.out.println("path = " + locatorPath);
           }
           assertTrue("fallback count = 4, " + count, count == 4);
  -        
  +
           // create a simple locator
           ProfileLocator locator2 = profiler.createLocator();
           locator2.add("page", "test");
  @@ -300,12 +312,11 @@
           count = 0;
           while (fallback.hasNext())
           {
  -            String locatorPath = (String)fallback.next();
  -            assertTrue("locatorPath: " + locatorPath, 
  -                        locatorPath.equals("page:test"));
  -            
  +            String locatorPath = (String) fallback.next();
  +            assertTrue("locatorPath: " + locatorPath, 
locatorPath.equals("page:test"));
  +
               System.out.println("Simple Test: path = " + locatorPath);
  -            count++;            
  +            count++;
           }
           assertTrue("fallback count = 1, " + count, count == 1);
   
  @@ -315,53 +326,53 @@
           count = 0;
           while (fallback.hasNext())
           {
  -            String locatorPath = (String)fallback.next();
  -            count++;            
  +            String locatorPath = (String) fallback.next();
  +            count++;
           }
           assertTrue("fallback count = 0, " + count, count == 0);
  -                
  +
       }
  -    
  -    private Subject createSubject(String principalName)
  +
  +    private Subject createSubject( String principalName )
       {
           Principal principal = new UserPrincipalImpl(principalName);
           Set principals = new HashSet();
           principals.add(principal);
  -        return new Subject(true, principals, new HashSet(), new HashSet());        
  +        return new Subject(true, principals, new HashSet(), new HashSet());
       }
   
       public void testPage() throws Exception
       {
           assertNotNull("profiler service is null", profiler);
   
  -        RequestContext request = new MockRequestContext();
  -    
  +        
  +
           request.setSubject(createSubject("anon"));
  -        request.setLocale(new Locale("en", "US"));        
  +        request.setLocale(new Locale("en", "US"));
           request.setMediaType("HTML");
           request.setMimeType("text/html");
           Map params = request.getParameterMap();
           // params.put("page", "default");
  -    
  +
           ProfileLocator locator = profiler.getProfile(request);
           assertNotNull("rule test on getProfile returned null", locator);
           System.out.println("page = " + locator.getValue("page"));
  -        
  +
           Page page = profiler.getPage(locator);
  -        assertNotNull("page is null", page);                 
  +        assertNotNull("page is null", page);
       }
  -   
  +
       public void testPath() throws Exception
       {
           assertNotNull("profiler service is null", profiler);
   
  -        RequestContext request = new MockRequestContext("/football/nfl/chiefs");
  -        ProfilingRule rule = profiler.getRule("path");            
  -        ProfileLocator locator = profiler.getProfile(request, rule);
  +        
  +        ProfilingRule rule = profiler.getRule("path");
  +        ProfileLocator locator = profiler.getProfile(requestChiefs, rule);
           assertNotNull("rule test on getProfile returned null", locator);
           String path = locator.getLocatorPath();
           System.out.println("locator = " + path);
           assertTrue("locator path: " + path, 
path.equals("path:/football/nfl/chiefs"));
       }
  -    
  -}
  +
  +}
  \ No newline at end of file
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to