svn commit: r595609 - /lenya/trunk/src/impl/test/org/apache/lenya/cms/site/SimpleSiteManagerTest.java

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Fri Nov 16 01:25:49 2007
New Revision: 595609

URL: http://svn.apache.org/viewvc?rev=595609&view=rev
Log:
SiteTree test: updated to new site code (don't fail for non-UUID nodes)

Modified:
    lenya/trunk/src/impl/test/org/apache/lenya/cms/site/SimpleSiteManagerTest.java

Modified: lenya/trunk/src/impl/test/org/apache/lenya/cms/site/SimpleSiteManagerTest.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/impl/test/org/apache/lenya/cms/site/SimpleSiteManagerTest.java?rev=595609&r1=595608&r2=595609&view=diff
==============================================================================
--- lenya/trunk/src/impl/test/org/apache/lenya/cms/site/SimpleSiteManagerTest.java (original)
+++ lenya/trunk/src/impl/test/org/apache/lenya/cms/site/SimpleSiteManagerTest.java Fri Nov 16 01:25:49 2007
@@ -29,7 +29,6 @@
 import org.apache.lenya.cms.publication.PublicationException;
 import org.apache.lenya.cms.publication.ResourceType;
 import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.RepositoryUtil;
 import org.apache.lenya.cms.repository.Session;
 import org.apache.lenya.cms.site.Link;
 import org.apache.lenya.cms.site.SiteException;
@@ -99,9 +98,6 @@
 
                 SiteNode node = structure.getNode(nodes[i].getPath());
                 assertNotNull(node);
-                if (node.getLanguages().length > 0) {
-                    assertNotNull(node.getUuid());
-                }
                 assertEquals(nodes[i], node);
 
                 checkLinks(siteManager, node);
@@ -144,21 +140,24 @@
             Link link = node.getLink(languages[i]);
             assertEquals(link.getLanguage(), languages[i]);
             assertNotNull(link.getLabel());
-            Document doc = link.getDocument();
-            assertNotNull(doc);
-
-            String docUuid = doc.getUUID();
-            String nodeUuid = node.getUuid();
-
-            assertNotNull(doc.getUUID());
-            assertEquals(docUuid, nodeUuid);
-            assertEquals(doc.getLanguage(), link.getLanguage());
-
-            // it may not be allowed to insert the doc twice
-            try {
-                siteManager.add("/sidebar", doc);
-                assertTrue("No exception thrown", false);
-            } catch (Exception expected) {
+            
+            if (node.getUuid() != null) {
+                Document doc = link.getDocument();
+                assertNotNull(doc);
+    
+                String docUuid = doc.getUUID();
+                String nodeUuid = node.getUuid();
+    
+                assertNotNull(doc.getUUID());
+                assertEquals(docUuid, nodeUuid);
+                assertEquals(doc.getLanguage(), link.getLanguage());
+    
+                // it may not be allowed to insert the doc twice
+                try {
+                    siteManager.add("/sidebar", doc);
+                    assertTrue("No exception thrown", false);
+                } catch (Exception expected) {
+                }
             }
         }
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.