You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2005/03/11 00:24:33 UTC

cvs commit: jakarta-tapestry/portlet build.xml

hlship      2005/03/10 15:24:33

  Modified:    src/documentation/content/xdocs tabs.xml site.xml
               portlet  build.xml
  Added:       portlet/src/test/org/apache/tapestry/portlet
                        TestPortletWebResponse.java
                        TestRenderWebResponse.java
               portlet/src/java/org/apache/tapestry/portlet
                        RenderWebResponse.java PortletWebResponse.java
               portlet/src/documentation/content/xdocs/tapestry-portlet
                        index.xml
  Log:
  More Portlet code and documentation.
  
  Revision  Changes    Path
  1.1                  jakarta-tapestry/portlet/src/test/org/apache/tapestry/portlet/TestPortletWebResponse.java
  
  Index: TestPortletWebResponse.java
  ===================================================================
  // Copyright 2005 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
  //
  //     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.
  
  package org.apache.tapestry.portlet;
  
  import javax.portlet.PortletResponse;
  
  import org.easymock.MockControl;
  
  /**
   * Tests for {@link org.apache.tapestry.portlet.PortletWebResponse}.
   * 
   * @author Howard M. Lewis Ship
   * @since 3.1
   */
  public class TestPortletWebResponse extends BasePortletWebTestCase
  {
      private PortletResponse newResponse()
      {
          return (PortletResponse) newMock(PortletResponse.class);
      }
  
      public void testGetOutputStreamUnsupported() throws Exception
      {
          PortletResponse response = newResponse();
  
          replayControls();
  
          PortletWebResponse pwr = new PortletWebResponse(response);
  
          try
          {
              pwr.getOutputStream();
              unreachable();
          }
          catch (UnsupportedOperationException ex)
          {
              // Expected.
          }
  
          verifyControls();
      }
  
      public void testResetUnsupported()
      {
          PortletResponse response = newResponse();
  
          replayControls();
  
          PortletWebResponse pwr = new PortletWebResponse(response);
  
          try
          {
              pwr.reset();
              unreachable();
          }
          catch (UnsupportedOperationException ex)
          {
              // Expected.
          }
  
          verifyControls();
      }
  
      public void testSetContentTypeUnsupported()
      {
          PortletResponse response = newResponse();
  
          replayControls();
  
          PortletWebResponse pwr = new PortletWebResponse(response);
  
          try
          {
              pwr.setContentType("foo");
              unreachable();
          }
          catch (UnsupportedOperationException ex)
          {
              // Expected.
          }
  
          verifyControls();
      }
  
      public void testEncodeURL()
      {
          MockControl control = newControl(PortletResponse.class);
          PortletResponse response = (PortletResponse) control.getMock();
  
          response.encodeURL("/foo");
          control.setReturnValue("/foo;encoded");
  
          replayControls();
  
          PortletWebResponse pwr = new PortletWebResponse(response);
  
          assertEquals("/foo;encoded", pwr.encodeURL("/foo"));
  
          verifyControls();
      }
  }
  
  
  1.1                  jakarta-tapestry/portlet/src/test/org/apache/tapestry/portlet/TestRenderWebResponse.java
  
  Index: TestRenderWebResponse.java
  ===================================================================
  // Copyright 2005 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
  //
  //     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.
  
  package org.apache.tapestry.portlet;
  
  import java.io.File;
  import java.io.FileOutputStream;
  import java.io.OutputStream;
  
  import javax.portlet.RenderResponse;
  
  import org.easymock.MockControl;
  
  /**
   * Tests for {@link org.apache.tapestry.portlet.RenderWebResponse}.
   * 
   * @author Howard M. Lewis Ship
   * @since 3.1
   */
  public class TestRenderWebResponse extends BasePortletWebTestCase
  {
      private RenderResponse newResponse()
      {
          return (RenderResponse) newMock(RenderResponse.class);
      }
  
      public void testReset()
      {
          RenderResponse response = newResponse();
  
          response.reset();
  
          replayControls();
  
          RenderWebResponse rwr = new RenderWebResponse(response);
  
          rwr.reset();
  
          verifyControls();
      }
  
      public void testSetContentType()
      {
          RenderResponse response = newResponse();
  
          response.setContentType("text/html");
  
          replayControls();
  
          RenderWebResponse rwr = new RenderWebResponse(response);
  
          rwr.setContentType("text/html");
  
          verifyControls();
      }
  
      public void testGetOutputStream() throws Exception
      {
          MockControl control = newControl(RenderResponse.class);
          RenderResponse response = (RenderResponse) control.getMock();
  
          OutputStream stream = new FileOutputStream(File.createTempFile("test", "txt"));
  
          response.getPortletOutputStream();
          control.setReturnValue(stream);
  
          replayControls();
  
          RenderWebResponse rwr = new RenderWebResponse(response);
          assertSame(stream, rwr.getOutputStream());
  
          verifyControls();
  
          stream.close();
      }
  }
  
  
  1.1                  jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/RenderWebResponse.java
  
  Index: RenderWebResponse.java
  ===================================================================
  // Copyright 2005 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
  //
  //     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.
  
  package org.apache.tapestry.portlet;
  
  import java.io.IOException;
  import java.io.OutputStream;
  
  import javax.portlet.RenderResponse;
  
  /**
   * @author Howard M. Lewis Ship
   */
  public class RenderWebResponse extends PortletWebResponse
  {
      private final RenderResponse _renderResponse;
  
      public RenderWebResponse(RenderResponse renderResponse)
      {
          super(renderResponse);
  
          _renderResponse = renderResponse;
      }
  
      public OutputStream getOutputStream() throws IOException
      {
          return _renderResponse.getPortletOutputStream();
      }
  
      public void reset()
      {
          _renderResponse.reset();
      }
  
      public void setContentType(String contentType)
      {
          _renderResponse.setContentType(contentType);
      }
  }
  
  
  1.1                  jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletWebResponse.java
  
  Index: PortletWebResponse.java
  ===================================================================
  // Copyright 2005 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
  //
  //     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.
  
  package org.apache.tapestry.portlet;
  
  import java.io.IOException;
  import java.io.OutputStream;
  
  import javax.portlet.PortletResponse;
  
  import org.apache.hivemind.util.Defense;
  import org.apache.tapestry.web.WebResponse;
  
  /**
   * Adapts {@link javax.portlet.PortletResponse}. as {@link org.apache.tapestry.web.WebResponse}.
   * 
   * @author Howard M. Lewis Ship
   * @since 3.1
   */
  public class PortletWebResponse implements WebResponse
  {
      private final PortletResponse _portletResponse;
  
      public PortletWebResponse(PortletResponse portletResponse)
      {
          Defense.notNull(portletResponse, "portletResponse");
  
          _portletResponse = portletResponse;
      }
  
      public OutputStream getOutputStream() throws IOException
      {
          unsupported("getOutputStream");
  
          return null;
      }
  
      public String encodeURL(String url)
      {
          return _portletResponse.encodeURL(url);
      }
  
      public void reset()
      {
          unsupported("reset");
      }
  
      public void setContentType(String contentType)
      {
          unsupported("setContentType");
      }
  
      protected final void unsupported(String methodName)
      {
          throw new UnsupportedOperationException(PortletMessages.unsupportedMethod(methodName));
  
      }
  }
  
  
  1.1                  jakarta-tapestry/portlet/src/documentation/content/xdocs/tapestry-portlet/index.xml
  
  Index: index.xml
  ===================================================================
  <?xml version="1.0"?>
  <!-- 
     Copyright 2005 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
  
         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.
  -->
  
  <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "./dtd/document-v12.dtd">
  <document>
  
    <header>
      <title>Tapestry Portlet Support</title>
  	</header>
  	
    <body>
  <p> An add-on module for Tapestry that enables the use of Tapestry to create <link href="http://www.jcp.org/en/jsr/detail?id=168">JSR-168 Portlets</link>. </p>
      
    </body>
  </document>
  
  
  
  1.8       +1 -0      jakarta-tapestry/src/documentation/content/xdocs/tabs.xml
  
  Index: tabs.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/src/documentation/content/xdocs/tabs.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- tabs.xml	1 Mar 2005 23:35:48 -0000	1.7
  +++ tabs.xml	10 Mar 2005 23:24:33 -0000	1.8
  @@ -26,5 +26,6 @@
     <tab label="Quick Start" dir="QuickStart" id="quick-start"/>
     <tab label="Users Guide" dir="UsersGuide"  id="users-guide"/>
     <tab label="Framework" dir="tapestry" id="tapestry"/>
  +  <tab label="Portlet Support" dir="tapestry-portlet" id="portlet"/>
   
    </tabs>
  
  
  
  1.23      +11 -1     jakarta-tapestry/src/documentation/content/xdocs/site.xml
  
  Index: site.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/src/documentation/content/xdocs/site.xml,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- site.xml	9 Mar 2005 00:52:21 -0000	1.22
  +++ site.xml	10 Mar 2005 23:24:33 -0000	1.23
  @@ -19,6 +19,7 @@
   [
   <!ENTITY project-report-menu.ent SYSTEM "project-report-menu.ent">
   <!ENTITY tapestry-report-menu.ent SYSTEM "tapestry-report-menu.ent">
  +<!ENTITY tapestry-portlet-report-menu.ent SYSTEM "tapestry-portlet-report-menu.ent">
   ]
   >
   
  @@ -58,7 +59,7 @@
       
       <tapestry label="Framework" tab="tapestry" href="tapestry/">
         
  -      <index href="index.html"/>
  +      <index label="Overview" href="index.html"/>
         
         <ComponentReference label="ComponentReference" href="ComponentReference/">
           <ActionLink label="ActionLink" href="ActionLink.html"/>
  @@ -110,6 +111,15 @@
         
       </tapestry>
       
  +   <portlet label="Portlet Support" tab="portlet" href="tapestry-portlet/">
  +      
  +      <index label="Overview" href="index.html"/>
  +    
  +      <reports label="Reports">
  +        &tapestry-portlet-report-menu.ent;
  +      </reports>    
  +   </portlet>
  +    
       <project label="Project">
           <item label="Mailing Lists"     href="http://jakarta.apache.org/site/mail2.html#tapestry"/>
           <item label="Bug Database"     href="http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10573"/>
  
  
  
  1.3       +10 -3     jakarta-tapestry/portlet/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/portlet/build.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- build.xml	10 Mar 2005 15:12:22 -0000	1.2
  +++ build.xml	10 Mar 2005 23:24:33 -0000	1.3
  @@ -25,8 +25,9 @@
   	<property file="${root.dir}/config/common.properties"/>
     
   	<import file="${hivebuild.dir}/jar-module.xml"/>
  -	<import file="${hivebuild.dir}/javadoc-report.xml"/>
  -	<import file="${hivebuild.dir}/clover-report.xml"/>  
  +  <import file="${hivebuild.dir}/javadoc-report.xml"/>
  +  <import file="${hivebuild.dir}/clover-report.xml"/>  
  +  <import file="${hivebuild.dir}/hivedoc-report.xml"/>  
     
   	<target name="compile-dependencies">
       <project-dependency artifact="tapestry"/>
  @@ -38,7 +39,7 @@
       <ibiblio-dependency artifact="ognl"               version="${ognl.version}"     group="ognl"/>
       <ibiblio-dependency artifact="commons-lang"       version="${lang.version}"     group="commons-lang"/>
       <ibiblio-dependency artifact="portlet-api"        version="1.0"                 group="portlet-api"/>
  -      
  +    <ibiblio-dependency artifact="oro"                version="${oro.version}"      group="oro"/>      
       <ibiblio-dependency artifact="easymock"           version="1.1"                 group="easymock" use="test"/>
       <ibiblio-dependency artifact="easymockclassextension" version="1.1"             group="easymock" use="test"/>
       <ibiblio-dependency artifact="cglib-full"         version="2.0.2"               group="cglib"    use="test"/>
  @@ -54,4 +55,10 @@
       -->
   	</target>	
     
  +  <target name="run-reports">
  +    <javadoc-report/>
  +    <clover-report/>
  +    <hivedoc-report/>    
  +  </target>  
  +  
   </project>
  
  
  

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