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/portal/src/test/org/apache/jetspeed/mockobjects/request MockRequestContext.java
Date Tue, 30 Mar 2004 22:02:34 GMT
taylor      2004/03/30 14:02:34

  Modified:    portal/src/test/org/apache/jetspeed/containers
                        test-navstate-container.groovy
               portal/src/test/org/apache/jetspeed/profiler
                        TestProfiler.java
               portal/src/test/org/apache/jetspeed/container/session
                        TestNavigationalState.java
               portal/src/test/org/apache/jetspeed/mockobjects/request
                        MockRequestContext.java
  Log:
  refactoring of RequestContext to a component
  continued refactoring of Nav State
  synced up tests to use new components
  
  PR:
  Obtained from:
  Submitted by:	
  Reviewed by:	
  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.2       +19 -4     jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/containers/test-navstate-container.groovy
  
  Index: test-navstate-container.groovy
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/containers/test-navstate-container.groovy,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- test-navstate-container.groovy	24 Mar 2004 23:31:19 -0000	1.1
  +++ test-navstate-container.groovy	30 Mar 2004 22:02:34 -0000	1.2
  @@ -20,8 +20,11 @@
   import org.picocontainer.Parameter
   import org.apache.jetspeed.components.util.NanoQuickAssembler
    
  -import org.apache.jetspeed.container.session.NavigationalState
  -import org.apache.jetspeed.container.session.impl.PathNavigationalState
  +import org.apache.jetspeed.request.RequestContextComponent
  +import org.apache.jetspeed.request.JetspeedRequestContextComponent
  +import org.apache.jetspeed.container.session.NavigationalStateComponent
  +import org.apache.jetspeed.container.session.impl.JetspeedNavigationalStateComponent
  +
   
   
   // def register(container) 
  @@ -31,8 +34,20 @@
   container = new DefaultPicoContainer()
   
   
  -container.registerComponentImplementation(NavigationalState, 
  -                                          PathNavigationalState)
  +//
  +// Navigational State component
  +//
  +navStateClass = "org.apache.jetspeed.container.session.impl.PathNavigationalState"
  +container.registerComponentImplementation(NavigationalStateComponent, JetspeedNavigationalStateComponent,
  +               new Parameter[] {new ConstantParameter(navStateClass)} )
  +
  +//
  +// Request Context component
  +//
  +requestContextClass = "org.apache.jetspeed.request.JetspeedRequestContext"
  +container.registerComponentImplementation(RequestContextComponent, JetspeedRequestContextComponent,

  +    new Parameter[] {new ComponentParameter(NavigationalStateComponent),
  +                     new ConstantParameter(requestContextClass)} )
   
   return container
   
  
  
  
  1.10      +4 -9      jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/profiler/TestProfiler.java
  
  Index: TestProfiler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/profiler/TestProfiler.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TestProfiler.java	8 Mar 2004 00:37:46 -0000	1.9
  +++ TestProfiler.java	30 Mar 2004 22:02:34 -0000	1.10
  @@ -27,8 +27,6 @@
   
   import junit.framework.Test;
   
  -import org.apache.jetspeed.JetspeedPortalContext;
  -import org.apache.jetspeed.PortalContext;
   import org.apache.jetspeed.components.AbstractComponentAwareTestCase;
   import org.apache.jetspeed.components.ComponentAwareTestSuite;
   import org.apache.jetspeed.mockobjects.request.MockRequestContext;
  @@ -243,8 +241,7 @@
       {
           assertNotNull("profiler service is null", profiler);
   
  -        PortalContext pc = new JetspeedPortalContext(null); // Jetspeed.getContext();
  -        RequestContext request = new MockRequestContext(pc, "default-other");
  +        RequestContext request = new MockRequestContext("default-other");
           
           request.setSubject(createSubject("anon"));
           request.setLocale(new Locale("en", "US"));        
  @@ -336,8 +333,7 @@
       {
           assertNotNull("profiler service is null", profiler);
   
  -        PortalContext pc = new JetspeedPortalContext(null); // Jetspeed.getContext();
  -        RequestContext request = new MockRequestContext(pc);
  +        RequestContext request = new MockRequestContext();
       
           request.setSubject(createSubject("anon"));
           request.setLocale(new Locale("en", "US"));        
  @@ -358,8 +354,7 @@
       {
           assertNotNull("profiler service is null", profiler);
   
  -        PortalContext pc = new JetspeedPortalContext(null); // Jetspeed.getContext();
  -        RequestContext request = new MockRequestContext(pc, "/football/nfl/chiefs");
  +        RequestContext request = new MockRequestContext("/football/nfl/chiefs");
           ProfilingRule rule = profiler.getRule("path");            
           ProfileLocator locator = profiler.getProfile(request, rule);
           assertNotNull("rule test on getProfile returned null", locator);
  
  
  
  1.3       +15 -11    jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/container/session/TestNavigationalState.java
  
  Index: TestNavigationalState.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/container/session/TestNavigationalState.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestNavigationalState.java	25 Mar 2004 21:42:32 -0000	1.2
  +++ TestNavigationalState.java	30 Mar 2004 22:02:34 -0000	1.3
  @@ -23,12 +23,11 @@
   
   import junit.framework.Test;
   
  -import org.apache.jetspeed.JetspeedPortalContext;
   import org.apache.jetspeed.components.AbstractComponentAwareTestCase;
   import org.apache.jetspeed.components.ComponentAwareTestSuite;
   import org.apache.jetspeed.om.window.impl.PortletWindowImpl;
  -import org.apache.jetspeed.request.JetspeedRequestContext;
   import org.apache.jetspeed.request.RequestContext;
  +import org.apache.jetspeed.request.RequestContextComponent;
   import org.apache.pluto.om.window.PortletWindow;
   import org.picocontainer.MutablePicoContainer;
   
  @@ -46,7 +45,8 @@
   public class TestNavigationalState extends AbstractComponentAwareTestCase 
   {
       private MutablePicoContainer container;
  -    private NavigationalState navState;
  +    private NavigationalStateComponent navState;
  +    private RequestContextComponent rcc;
       
       /**
        * Defines the testcase name for JUnit.
  @@ -73,7 +73,8 @@
           super.setUp();
           container = (MutablePicoContainer) getContainer();
           assertNotNull("container is null", container);
  -        navState = (NavigationalState) container.getComponentInstance(NavigationalState.class);
       
  +        navState = (NavigationalStateComponent) container.getComponentInstance(NavigationalStateComponent.class);
       
  +        rcc = (RequestContextComponent) container.getComponentInstance(RequestContextComponent.class);
       
       }
   
       /**
  @@ -91,21 +92,24 @@
   
       public void testBasic()
       {
  +        assertNotNull("nav state component is null", navState);
  +        assertNotNull("request context component is null", rcc);
  +
           MockHttpServletRequest request = new MockHttpServletRequest();
           HttpServletResponse response = new MockHttpServletResponse();
           ServletConfig config = new MockServletConfig();
           request.setPathInfo("/stuff/");
  -        RequestContext context = new JetspeedRequestContext(new JetspeedPortalContext(null),

  -                                                        (HttpServletRequest)request, 
  -                                                        response, 
  -                                                        config);
  +        RequestContext context = rcc.create(
  +                                                (HttpServletRequest)request, 
  +                                                response, 
  +                                                config);
           
  +System.out.println("$$$ context = " + context);
           
  -        assertNotNull("portlet container is null", navState);
           PortletWindow window = new PortletWindowImpl("33");
           PortletWindow window2 = new PortletWindowImpl("222");
           
  -        NavigationalStateContext nav = navState.createContext(context);
  +        NavigationalState nav = navState.create(context);
           nav.setState(window, WindowState.MAXIMIZED);
           nav.setMode(window, PortletMode.HELP);
           
  
  
  
  1.4       +5 -6      jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/mockobjects/request/MockRequestContext.java
  
  Index: MockRequestContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/mockobjects/request/MockRequestContext.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MockRequestContext.java	8 Mar 2004 00:37:00 -0000	1.3
  +++ MockRequestContext.java	30 Mar 2004 22:02:34 -0000	1.4
  @@ -18,7 +18,6 @@
   import java.util.HashMap;
   import java.util.Map;
   
  -import org.apache.jetspeed.PortalContext;
   import org.apache.jetspeed.request.JetspeedRequestContext;
   import org.apache.jetspeed.request.RequestContext;
   
  @@ -35,14 +34,14 @@
       private Map sessionAttributes = new HashMap();
       private String path;
           
  -    public MockRequestContext(PortalContext pc)
  +    public MockRequestContext()
       {
  -        super(pc, null, null, null);
  +        super(null, null, null, null);
       }
   
  -    public MockRequestContext(PortalContext pc, String path)
  +    public MockRequestContext(String path)
       {
  -        super(pc, null, null, null);
  +        super(null, null, null, null);
           this.path = path;
       }
           
  
  
  

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