You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2005/03/21 10:58:27 UTC

svn commit: r158434 - in lenya/trunk/src/test/org/apache/lenya/cms/publication: DefaultDocumentBuilderTest.java DefaultDocumentTest.java DublinCoreTest.java TestPageEnvelope.java file/FilePublicationTest.java

Author: andreas
Date: Mon Mar 21 01:58:26 2005
New Revision: 158434

URL: http://svn.apache.org/viewcvs?view=rev&rev=158434
Log:
updated some tests to new API

Modified:
    lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentBuilderTest.java
    lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentTest.java
    lenya/trunk/src/test/org/apache/lenya/cms/publication/DublinCoreTest.java
    lenya/trunk/src/test/org/apache/lenya/cms/publication/TestPageEnvelope.java
    lenya/trunk/src/test/org/apache/lenya/cms/publication/file/FilePublicationTest.java

Modified: lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentBuilderTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentBuilderTest.java?view=diff&r1=158433&r2=158434
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentBuilderTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentBuilderTest.java Mon Mar 21 01:58:26 2005
@@ -31,42 +31,41 @@
  * Generation>Code and Comments
  */
 public class DefaultDocumentBuilderTest extends DefaultDocumentTest {
-	/**
-	 * Constructor.
-	 * 
-	 * @param test
-	 *            The test.
-	 */
-	public DefaultDocumentBuilderTest(String test) {
-		super(test);
-	}
+    /**
+     * Constructor.
+     * 
+     * @param test The test.
+     */
+    public DefaultDocumentBuilderTest(String test) {
+        super(test);
+    }
 
-	/**
-	 * The main program. The parameters are set from the command line arguments.
-	 * 
-	 * @param args
-	 *            The command line arguments.
-	 */
-	public static void main(String[] args) {
-		PublicationHelper.extractPublicationArguments(args);
-		TestRunner.run(getSuite());
-	}
+    /**
+     * The main program. The parameters are set from the command line arguments.
+     * 
+     * @param args The command line arguments.
+     */
+    public static void main(String[] args) {
+        PublicationHelper.extractPublicationArguments(args);
+        TestRunner.run(getSuite());
+    }
 
-	/**
-	 * Returns the test suite.
-	 * 
-	 * @return A test suite.
-	 */
-	public static Test getSuite() {
-		return new TestSuite(DefaultDocumentBuilderTest.class);
-	}
+    /**
+     * Returns the test suite.
+     * 
+     * @return A test suite.
+     */
+    public static Test getSuite() {
+        return new TestSuite(DefaultDocumentBuilderTest.class);
+    }
 
-	/**
-	 * @see org.apache.lenya.cms.publication.DefaultDocumentTest#getDocument(DocumentTestSet)
-	 */
-	protected Document getDocument(DocumentTestSet set) throws DocumentBuildException {
-		Publication pub = PublicationHelper.getPublication();
+    /**
+     * @see org.apache.lenya.cms.publication.DefaultDocumentTest#getDocument(DocumentTestSet)
+     */
+    protected Document getDocument(DocumentTestSet set) throws DocumentBuildException {
+        Publication pub = PublicationHelper.getPublication();
 
-		return getIdentityMap().getFactory().getFromURL(pub.getId() + "/" + set.getArea() + set.getUrl());
-	}
-}
+        return getIdentityMap().getFactory().getFromURL(pub,
+                pub.getId() + "/" + set.getArea() + set.getUrl());
+    }
+}
\ No newline at end of file

Modified: lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentTest.java?view=diff&r1=158433&r2=158434
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentTest.java Mon Mar 21 01:58:26 2005
@@ -104,8 +104,7 @@
 
     protected DocumentIdentityMap getIdentityMap() {
         if (this.identityMap == null) {
-            Publication pub = PublicationHelper.getPublication();
-            this.identityMap = new DocumentIdentityMap(pub);
+            this.identityMap = new DocumentIdentityMap();
         }
         return this.identityMap;
     }
@@ -118,8 +117,9 @@
      */
     protected Document getDocument(DocumentTestSet testSet) throws DocumentBuildException {
 
-        DefaultDocument document = new DefaultDocument(getIdentityMap(), testSet.getId(), testSet
-                .getArea());
+        Publication pub = PublicationHelper.getPublication();
+        DefaultDocument document = new DefaultDocument(getIdentityMap(), pub, testSet.getId(),
+                testSet.getArea());
         document.setDocumentURL(testSet.getUrl());
         document.setLanguage(testSet.getLanguage());
         document.setExtension(testSet.getExtension());
@@ -145,7 +145,8 @@
          * @param _language The language.
          * @param _extension The extension.
          */
-        public DocumentTestSet(String _url, String _id, String _area, String _language, String _extension) {
+        public DocumentTestSet(String _url, String _id, String _area, String _language,
+                String _extension) {
             this.url = _url;
             this.id = _id;
             this.area = _area;

Modified: lenya/trunk/src/test/org/apache/lenya/cms/publication/DublinCoreTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/publication/DublinCoreTest.java?view=diff&r1=158433&r2=158434
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/publication/DublinCoreTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/cms/publication/DublinCoreTest.java Mon Mar 21 01:58:26 2005
@@ -61,8 +61,8 @@
      */
     final public void testModifySaveAndReload() throws DocumentBuildException, DocumentException {
         Publication publication = PublicationHelper.getPublication();
-        DocumentIdentityMap map = new DocumentIdentityMap(publication);
-        Document doc = map.get(AREA, DOCUMENT_ID, LANGUAGE);
+        DocumentIdentityMap map = new DocumentIdentityMap();
+        Document doc = map.get(publication, AREA, DOCUMENT_ID, LANGUAGE);
         DublinCore dcCore = doc.getDublinCore();
         String title = dcCore.getFirstValue(DublinCore.ELEMENT_TITLE);
         String subject = dcCore.getFirstValue(DublinCore.ELEMENT_SUBJECT);
@@ -72,7 +72,7 @@
         dcCore.setValue(DublinCore.ELEMENT_CREATOR, CREATOR);
         dcCore.save();
 
-        Document doc2 = map.get(AREA, DOCUMENT_ID, LANGUAGE);
+        Document doc2 = map.get(publication, AREA, DOCUMENT_ID, LANGUAGE);
 
         DublinCore dcCore2 = doc2.getDublinCore();
         assertEquals(title, dcCore2.getFirstValue(DublinCore.ELEMENT_TITLE));

Modified: lenya/trunk/src/test/org/apache/lenya/cms/publication/TestPageEnvelope.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/publication/TestPageEnvelope.java?view=diff&r1=158433&r2=158434
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/publication/TestPageEnvelope.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/cms/publication/TestPageEnvelope.java Mon Mar 21 01:58:26 2005
@@ -20,8 +20,8 @@
 package org.apache.lenya.cms.publication;
 
 /**
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
+ * To change the template for this generated type comment go to Window>Preferences>Java>Code
+ * Generation>Code and Comments
  */
 public class TestPageEnvelope extends PageEnvelope {
     /**
@@ -30,15 +30,14 @@
      * @param url The document url (starting with a slash).
      * @throws PageEnvelopeException when something goes wrong.
      */
-    public TestPageEnvelope(Publication publication, String url)
-        throws PageEnvelopeException {
+    public TestPageEnvelope(Publication publication, String url) throws PageEnvelopeException {
         setContext("");
 
         try {
-            DocumentIdentityMap map = new DocumentIdentityMap(publication);
-            setDocument(map.getFactory().getFromURL(url));
+            DocumentIdentityMap map = new DocumentIdentityMap();
+            setDocument(map.getFactory().getFromURL(publication, url));
         } catch (DocumentBuildException e) {
             throw new PageEnvelopeException(e);
         }
     }
-}
+}
\ No newline at end of file

Modified: lenya/trunk/src/test/org/apache/lenya/cms/publication/file/FilePublicationTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/publication/file/FilePublicationTest.java?view=diff&r1=158433&r2=158434
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/publication/file/FilePublicationTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/cms/publication/file/FilePublicationTest.java Mon Mar 21 01:58:26 2005
@@ -92,10 +92,18 @@
      * @throws SiteException
      */
     public void testCopyDocument() throws PublicationException, DocumentException, SiteException {
-        testCopyDocument(Publication.AUTHORING_AREA, sourceDocumentId, sourceLanguage,
-                Publication.AUTHORING_AREA, destinationDocumentId, destinationLanguage);
-        testCopyDocument(Publication.AUTHORING_AREA, sourceDocumentId, sourceLanguage,
-                Publication.LIVE_AREA, sourceDocumentId, sourceLanguage);
+        testCopyDocument(Publication.AUTHORING_AREA,
+                sourceDocumentId,
+                sourceLanguage,
+                Publication.AUTHORING_AREA,
+                destinationDocumentId,
+                destinationLanguage);
+        testCopyDocument(Publication.AUTHORING_AREA,
+                sourceDocumentId,
+                sourceLanguage,
+                Publication.LIVE_AREA,
+                sourceDocumentId,
+                sourceLanguage);
     }
 
     /**
@@ -110,9 +118,10 @@
      * @throws DocumentException
      * @throws SiteException
      */
-    public void testCopyDocument(String sourceArea, String _sourceDocumentId, String _sourceLanguage,
-            String destinationArea, String _destinationDocumentId, String _destinationLanguage)
-            throws PublicationException, DocumentException, SiteException {
+    public void testCopyDocument(String sourceArea, String _sourceDocumentId,
+            String _sourceLanguage, String destinationArea, String _destinationDocumentId,
+            String _destinationLanguage) throws PublicationException, DocumentException,
+            SiteException {
 
         System.out.println("Copy document");
         System.out.println("    Source area:             [" + sourceArea + "]");
@@ -123,10 +132,15 @@
         System.out.println("    Destination language:    [" + _destinationLanguage + "]");
 
         Publication publication = PublicationHelper.getPublication();
-        DocumentIdentityMap map = new DocumentIdentityMap(publication);
+        DocumentIdentityMap map = new DocumentIdentityMap();
 
-        Document sourceDocument = map.getFactory().get(sourceArea, _sourceDocumentId, _sourceLanguage);
-        Document destinationDocument = map.getFactory().get(destinationArea, _destinationDocumentId,
+        Document sourceDocument = map.getFactory().get(publication,
+                sourceArea,
+                _sourceDocumentId,
+                _sourceLanguage);
+        Document destinationDocument = map.getFactory().get(publication,
+                destinationArea,
+                _destinationDocumentId,
                 _destinationLanguage);
 
         publication.copyDocument(sourceDocument, destinationDocument);



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