lenya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject cvs commit: cocoon-lenya/src/test/org/apache/lenya/cms/task PublisherTest.java
Date Fri, 08 Aug 2003 17:05:33 GMT
egli        2003/08/08 10:05:33

  Modified:    src/test/org/apache/lenya/cms/task PublisherTest.java
  Log:
  The unit test case for the publisher had many things hard coded
  and above all did not work anymore.
  Made it more general (with the path mapper) and made it works again.
  
  Revision  Changes    Path
  1.5       +13 -9     cocoon-lenya/src/test/org/apache/lenya/cms/task/PublisherTest.java
  
  Index: PublisherTest.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/test/org/apache/lenya/cms/task/PublisherTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PublisherTest.java	8 Aug 2003 14:17:15 -0000	1.4
  +++ PublisherTest.java	8 Aug 2003 17:05:33 -0000	1.5
  @@ -1,5 +1,5 @@
   /*
  -$Id
  +$Id$
   <License>
   
    ============================================================================
  @@ -63,6 +63,8 @@
   import org.apache.avalon.framework.parameters.Parameters;
   
   import org.apache.lenya.cms.PublicationHelper;
  +import org.apache.lenya.cms.publication.DocumentIdToPathMapper;
  +import org.apache.lenya.cms.publication.Publication;
   
   import java.io.File;
   import java.io.IOException;
  @@ -102,18 +104,18 @@
           TestRunner.run(getSuite());
       }
   
  -    public static final String DOCUMENT_ID = "tutorial";
  -    public static final String LIVE_PATH = "content/live/".replace('/', File.separatorChar);
  +    public static final String DOCUMENT_ID = "/tutorial";
  +    public static final String DOCUMENT_LANGUAGE = "en";
   
   	/**
   	 *  (non-Javadoc)
   	 * @see org.apache.lenya.cms.task.AntTaskTest#evaluateTest()
   	 */
       protected void evaluateTest() throws IOException {
  -        File publicationDirectory = PublicationHelper.getPublication().getDirectory();
  -        String livePath = LIVE_PATH + DOCUMENT_ID + File.separator + "index.xml";
  -        File publishedFile = new File(publicationDirectory, livePath);
  -        System.out.println("Path of file to publish: " + livePath);
  +        Publication pub = PublicationHelper.getPublication();
  +        DocumentIdToPathMapper mapper = pub.getPathMapper();
  +        File publishedFile = mapper.getFile(pub, Publication.LIVE_AREA, DOCUMENT_ID, DOCUMENT_LANGUAGE);
  +        System.out.println("Path of file to publish: " + publishedFile);
           assertTrue(publishedFile.exists());
           System.out.println("Published file exists: " + publishedFile.getCanonicalPath());
       }
  @@ -125,8 +127,10 @@
       protected Parameters getTaskParameters() {
           Parameters parameters = super.getTaskParameters();
           parameters.setParameter("properties.publish.documentid", DOCUMENT_ID);
  -        parameters.setParameter("properties.publish.sources",
  -            DOCUMENT_ID + File.separator + "index.xml");
  +        parameters.setParameter("properties.publish.language", DOCUMENT_LANGUAGE);
  +        Publication pub = PublicationHelper.getPublication();
  +        DocumentIdToPathMapper mapper = pub.getPathMapper();
  +        parameters.setParameter("properties.publish.sources", mapper.getPath(DOCUMENT_ID,
DOCUMENT_LANGUAGE));
   
           return parameters;
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org


Mime
View raw message