You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by at...@apache.org on 2004/06/14 14:33:41 UTC

cvs commit: jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/tools/pamanager TestPortletDescriptor.java

ate         2004/06/14 05:33:41

  Modified:    portal/src/test/org/apache/jetspeed/tools/pamanager
                        TestPortletDescriptor.java
  Log:
  - fixed offline testing (real offline: without network, not just maven -o) by resolving web.xml dtd locally
  
  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.22      +21 -2     jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/tools/pamanager/TestPortletDescriptor.java
  
  Index: TestPortletDescriptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/tools/pamanager/TestPortletDescriptor.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- TestPortletDescriptor.java	11 Jun 2004 18:01:35 -0000	1.21
  +++ TestPortletDescriptor.java	14 Jun 2004 12:33:41 -0000	1.22
  @@ -50,6 +50,9 @@
   import org.jdom.Element;
   import org.jdom.input.SAXBuilder;
   import org.jdom.xpath.XPath;
  +import org.xml.sax.EntityResolver;
  +import org.xml.sax.InputSource;
  +import org.xml.sax.SAXException;
   
   /**
    * TestPortletDescriptor - tests loading the portlet.xml deployment descriptor
  @@ -361,6 +364,23 @@
   
           SAXBuilder builder = new SAXBuilder(false);
   
  +        // Use the local dtd instead of remote dtd. This
  +        // allows to deploy the application offline
  +        builder.setEntityResolver(new EntityResolver()
  +        {
  +            public InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
  +                throws SAXException, java.io.IOException
  +            {
  +
  +                if (systemId.equals("http://java.sun.com/dtd/web-app_2_3.dtd"))
  +                {
  +                    return new InputSource(PortletApplicationWar.class.getResourceAsStream("web-app_2_3.dtd"));
  +                }
  +                else
  +                    return null;
  +            }
  +        });
  +
           FileReader srcReader = new FileReader("./test/testdata/deploy/webapp/WEB-INF/web.xml");
           FileReader targetReader = null;
           Document  doc = builder.build(srcReader);
  @@ -380,7 +400,6 @@
   
               targetReader = new FileReader("./target/webapp/WEB-INF/web.xml");
   
  -            builder = new SAXBuilder(false);
               Document targetDoc = builder.build(targetReader);
               Element targetRoot = targetDoc.getRootElement();
   
  
  
  

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