portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wea...@apache.org
Subject cvs commit: jakarta-jetspeed-2/cps/src/test/org/apache/jetspeed/cps/rewriter TestRewriterRules.java
Date Fri, 10 Oct 2003 14:00:50 GMT
weaver      2003/10/10 07:00:50

  Modified:    cps/src/test/org/apache/jetspeed/cps/rewriter
                        TestRewriterRules.java
  Log:
  Fixed TestRewriterRules to run from allBuild.  
  - corrected the setup() method to setUp() and call super.setUp() to init CPS
  - using the service.getRealPath() to fix the test pathing probelms.
  
  Revision  Changes    Path
  1.5       +11 -26    jakarta-jetspeed-2/cps/src/test/org/apache/jetspeed/cps/rewriter/TestRewriterRules.java
  
  Index: TestRewriterRules.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/cps/src/test/org/apache/jetspeed/cps/rewriter/TestRewriterRules.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestRewriterRules.java	7 Oct 2003 04:44:52 -0000	1.4
  +++ TestRewriterRules.java	10 Oct 2003 14:00:49 -0000	1.5
  @@ -77,6 +77,8 @@
    */
   public class TestRewriterRules extends CPSTest
   {
  +    private RewriterService service;
  +
       /**
         * Defines the testcase name for JUnit.
         *
  @@ -97,9 +99,11 @@
           junit.awtui.TestRunner.main( new String[] { TestRewriterRules.class.getName() }
);
       }
   
  -    public void setup() 
  +    public void setUp() 
       {
           System.out.println("Setup: Testing Rewriter rules");
  +        super.setUp();
  +        service = (RewriterService)CommonPortletServices.getPortalService(RewriterService.SERVICE_NAME);
       }
   
       public static Test suite()
  @@ -110,8 +114,7 @@
   
       public void testFactories()
                 throws Exception
  -    { 
  -        RewriterService service = (RewriterService)CommonPortletServices.getPortalService(RewriterService.SERVICE_NAME);
  +    {         
           assertNotNull("rewriter service is null", service);
           Rewriter basic = service.createRewriter();
           assertNotNull("basic rewriter is null", basic);
  @@ -128,7 +131,7 @@
       public void testRules()
                 throws Exception
       { 
  -        RewriterService service = (RewriterService)CommonPortletServices.getPortalService(RewriterService.SERVICE_NAME);
  +        
           assertNotNull("rewriter service is null", service);
           FileReader reader = getTestReader("test-rewriter-rules.xml");  
           Ruleset ruleset = service.loadRuleset(reader);
  @@ -227,7 +230,7 @@
       public void testRewriting()
                 throws Exception
       { 
  -        RewriterService service = (RewriterService)CommonPortletServices.getPortalService(RewriterService.SERVICE_NAME);
  +        
           assertNotNull("rewriter service is null", service);
           
           FileReader reader = getTestReader("test-remove-rules.xml");  
  @@ -285,16 +288,7 @@
       {
           String cwd = System.getProperty("user.dir");
           String path;
  -        
  -        if (cwd.endsWith("jakarta-jetspeed-2"))
  -        {
  -            path = "./cps/test/rewriter/" + filename;             
  -        }
  -        else
  -        {
  -            path = "./test/rewriter/" + filename;             
  -        }
  -        return new FileReader(path);
  +        return new FileReader(service.getRealPath("rewriter/" + filename));
       }
   
       /**
  @@ -313,16 +307,7 @@
       {
           String cwd = System.getProperty("user.dir");
           String path;
  -        
  -        if (cwd.endsWith("jakarta-jetspeed-2"))
  -        {
  -            path = "./cps/test/rewriter/" + filename;             
  -        }
  -        else
  -        {
  -            path = "./test/rewriter/" + filename;             
  -        }
  -        return new FileWriter(path);
  +        return new FileWriter(service.getRealPath("rewriter/" + filename));
       }
           
   }
  
  
  

---------------------------------------------------------------------
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